Created
March 20, 2016 10:23
-
-
Save rumpelsepp/b1b416f52d6790de1aee to your computer and use it in GitHub Desktop.
Fuzzy cd for fish shell using fzf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function -d "Fuzzy change directory" fcd | |
if set -q argv[1] | |
set searchdir $argv[1] | |
else | |
set searchdir $HOME | |
end | |
# https://github.com/fish-shell/fish-shell/issues/1362 | |
set -l tmpfile (mktemp) | |
find $searchdir \( ! -regex '.*/\..*' \) ! -name __pycache__ -type d | fzf > $tmpfile | |
set -l destdir (cat $tmpfile) | |
rm -f $tmpfile | |
if test -z "$destdir" | |
return 1 | |
end | |
cd $destdir | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pls consider https://gist.github.com/chrisnorris/fe57c7855fd87a2636999edf1d4d735b