# HG changeset patch # User Zeger Van de Vannet # Date 1714816025 -7200 # Node ID 7db5c9c8016fedb639e8fb0375cd111c2a6d0afe # Parent fb4670b7526aa08e2e6fbc09cf62b3045d22248e feat: Add fzf cd history picker diff -r fb4670b7526a -r 7db5c9c8016f dot_config/private_fish/config.fish --- a/dot_config/private_fish/config.fish Thu May 02 08:48:33 2024 +0200 +++ b/dot_config/private_fish/config.fish Sat May 04 11:47:05 2024 +0200 @@ -33,5 +33,8 @@ # Push current cmdline input to the stack bind \eq push-input + # FZF aliases + alias cdh fzf_cdhist + abbr hgst hg status end diff -r fb4670b7526a -r 7db5c9c8016f dot_config/private_fish/functions/fzf_cdhist.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/functions/fzf_cdhist.fish Sat May 04 11:47:05 2024 +0200 @@ -0,0 +1,14 @@ +function fzf_cdhist-d 'cd to one of the previously visited locations' + # Clear non-existent folders from cdhist. + set -l buf + for i in (seq 1 (count $dirprev)) + set -l dir $dirprev[$i] + if test -d $dir + set buf $buf $dir + end + end + set dirprev $buf + string join \n $dirprev | tac | sed 1d | eval (__fzfcmd) +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CDHIST_OPTS | read -l result + [ "$result" ]; and cd $result + commandline -f repaint +end