3 ms·
I use fzf completitions source <(fzf --zsh) > /dev/null and the ** shortcut followed by <TAB>, e.g. cd ~/** # <TAB> along with cd - to change to the dir
by sandreas 1y ago
I use fzf completitions
source <(fzf --zsh) > /dev/null
and the ** shortcut followed by <TAB>, e.g.
cd ~/** # <TAB>
along with cd - to change to the directory before
cd -
- robenkleene 1y agoThis will hang if you have too many subdirectories (e.g., a good-sized company's monorepo). A networked volumes will also often cause it to hang. (PS: In Zsh `cd -<tab>` will show a pop up menu of all directories in the history stack.)
- sandreas 1y agoSeems to be some kind of oh-my-zsh thing... cd - <TAB> does not work on my zsh config.
- robenkleene 1y agoAh, good point, this isn’t `oh-my-zsh` but it does require a couple of options to work as described: 1. `setopt autopushd pushdsilent`: This is the key component, `autopushd` automatically adds directories to the directory stack (and `pushdsilent` option does it without echoing added directories). Without this option, there’s no directory stack to traverse (unless directories are first manually added to it with `pushd` [for completion, `popd` pops directories off the stack navigating back to those directories]). `autopushd` just calls `pushd` on the current directory after each `cd`. 2. To get a menu, Zsh completion also has to be loaded, e.g., `autoload -Uz compinit && compinit -C` 3. Finally `zstyle ':completion:*' menu select` is optional, but that highlights the selected match, which is a nicer UI in my opinion. Those are the options I used to get this working with `zsh -f` (which starts Zsh with a default config).
- sandreas 1y agoWorks, is really nice, thank you. May I (auto-)suggest: https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions Have fun ;-)
- jalk 1y agoin my homedir > fd -t d | wc -l 213842 takes 5 seconds. Population doing `cd ~/**<tab>` takes way way longer than 5 seconds though. But regardless of the speed up one could add to cd + fzf in this case, I will still be using zoxide: > zoxide query -l | wc -l 1294 and `zi` starts instantaneous if I need the dynamic filtering edit: layout