3 ms·
Here’s another one: # For fuzzy-jumping down your home directory. # See http://richardmavis.info/fuzzy-jumping function fcd { cache=~/.conf
by flobosg 4y ago
Here’s another one:
# For fuzzy-jumping down your home directory.
# See http://richardmavis.info/fuzzy-jumping
function fcd {
cache=~/.config/home-dirs-list
if (( $# == 0 )); then
if [ -e $cache ]; then
cd "`fzf --height=10 < ${cache}`"
else
echo "No directory cache."
cd `find ~ -type d | fzf --height=10`
fi
elif (( $# == 1 )); then
if [[ $1 == "--cache" ]]; then
echo "Making home directory cache."
find ~ -type d | sort > $cache
elif [ -e $cache ]; then
cd "`cat ${cache} | grep $1 | fzf --height=10`"
else
echo "No directory cache."
cd `find $1 -type d | fzf --height=10`
fi
else
echo "Usage: fcd [DIR]|--cache"
fi
}