From aeb15800cccc7fd0abb60a8fe21c658984436719 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sun, 27 Nov 2016 17:57:47 +0530 Subject: [PATCH] fzf: Purge cdhist when running the cdhist widget --- .config/fish/fzf.fish | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.config/fish/fzf.fish b/.config/fish/fzf.fish index ce7ab334..ac354dda 100644 --- a/.config/fish/fzf.fish +++ b/.config/fish/fzf.fish @@ -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