Mercurial > dotfiles
comparison dot_config/private_fish/functions/fzf_cdhist.fish @ 1045:7db5c9c8016f
feat: Add fzf cd history picker
author | Zeger Van de Vannet <zeger@vandevan.net> |
---|---|
date | Sat, 04 May 2024 11:47:05 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1044:fb4670b7526a | 1045:7db5c9c8016f |
---|---|
1 function fzf_cdhist-d 'cd to one of the previously visited locations' | |
2 # Clear non-existent folders from cdhist. | |
3 set -l buf | |
4 for i in (seq 1 (count $dirprev)) | |
5 set -l dir $dirprev[$i] | |
6 if test -d $dir | |
7 set buf $buf $dir | |
8 end | |
9 end | |
10 set dirprev $buf | |
11 string join \n $dirprev | tac | sed 1d | eval (__fzfcmd) +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CDHIST_OPTS | read -l result | |
12 [ "$result" ]; and cd $result | |
13 commandline -f repaint | |
14 end |