fzf: Purge cdhist when running the cdhist widget

master
Pierre Neidhardt 2016-11-27 17:57:47 +05:30
parent 111e71c765
commit aeb15800cc
1 changed files with 9 additions and 0 deletions

View File

@ -107,6 +107,15 @@ end
bind \e\cL __fzf-bcd-widget
function __fzf-cdhist-widget -d 'cd to one of the previously visited location'
## 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
## TODO: (fish upsteam bug) Cannot use eval here.
# string join \n $dirprev | tac | sed 1d | eval (__fzfcmd) +m $FZF_CDHIST_OPTS | read -l result
string join \n $dirprev | tac | sed 1d | fzf +m --preview='preview {}' | read -l result