A simple Alt
+ arrow
directory navigation for zsh.
This functionality is extracted from the zsh4humans project, so be sure to check it out. 😊
-
git clone --depth=1 https://github.com/Zile995/zsh-dirnav.git ${ZDOTDIR:-$HOME}/zsh-dirnav echo 'source ${ZDOTDIR:-$HOME}/zsh-dirnav/zsh-dirnav.zsh' >>${ZDOTDIR:-$HOME}/.zshrc
-
Add this line to
${ZDOTDIR:-$HOME}/.zsh_plugins.txt
bundle file:Zile995/zsh-dirnav
-
Add these lines to
plugins.toml
file:[plugins.zsh-dirnav] github = "Zile995/zsh-dirnav"
Alt
+ ↑
- Move into the parent directory
Alt
+ ↓
- Fuzzy find directory below the current one, and move into it.
Alt
+ ←
- Go to previous directory
Alt
+ →
- Go to next directory
Use
Shift
instead ofAlt
on a Mac
Dependencies:
fzf
eza
This plugin uses the FZF_ALT_C_COMMAND
environment variable. If it is not set, fzf will use this command:
find . -type d \( ! -name '.git' -a ! -name '.hg' -a ! -name '.svn' -a ! -name 'node_modules' \)
If you want to use the fd
command, you can set something like this in your .zshrc
file:
export FZF_ALT_C_COMMAND='fd --hidden --type d --exclude={.git,.hg,.svn,node_modules}'
In the case of bfs
:
export FZF_ALT_C_COMMAND='bfs -type d -exclude -name '.git' -exclude -name '.hg' -exclude -name '.svn' -exclude -name 'node_modules''
Simply set the keybindings for cd-up
, cd-down
, cd-forward
and cd-back
widgets in the .zshrc
file, for example:
bindkey '^[[1;3A' cd-up
bindkey '^[[1;3B' cd-down
bindkey '^[[1;3D' cd-back
bindkey '^[[1;3C' cd-forward
All credit goes to @romkat