aboutsummaryrefslogtreecommitdiffstats
path: root/fish/functions/fzf-cdhist-widget.fish
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--fish/functions/fzf-cdhist-widget.fish14
1 files changed, 14 insertions, 0 deletions
diff --git a/fish/functions/fzf-cdhist-widget.fish b/fish/functions/fzf-cdhist-widget.fish
new file mode 100644
index 0000000..1477699
--- /dev/null
+++ b/fish/functions/fzf-cdhist-widget.fish
@@ -0,0 +1,14 @@
+function fzf-cdhist-widget --description '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 $FZF_CDHIST_OPTS | read -l result
+ [ "$result" ]; and cd $result
+ commandline -f repaint
+end