fzf and zoxide let you select files and navigate to directories with fuzzy completion while previewing them

productivitylinux

fzf is a command that filters files fuzzily and select one like peco.

$ brew install fzf
$ find aaa | fzf --height 10% | xargs echo

By passing a command to —preview, file contents can be shown on the preview pane.

fzf --preview='head -$LINES {}'

You can set the default arguments to FZF_DEFAULT_OPTS.

export FZF_DEFAULT_OPTS="--preview='head -$LINES {}' --bind=down:preview-down --bind=up:preview-up"

zoxide is a command that moves directories like cd, and records moved directories, so you can move them with the name.

$ brew install zoxide
$ eval "$(zoxide init zsh)"
$ z aaa/foo
$ cd ../..
$ z foo

zi command that is available if fzf is installed can select one from the recorded directories.

References

naoya on Twitter / X 会社のテックトークで fzf と zoxside 使うといいよという話をした

fzfで快適なターミナルライフ - petitviolet_blog