Skip to content

Instantly share code, notes, and snippets.

@rumpelsepp
Created March 20, 2016 10:23
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Fuzzy cd for fish shell using fzf
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
@chrisnorris
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment