diff --git a/Examples-(fish).md b/Examples-(fish).md index 02264bc..abde7db 100644 --- a/Examples-(fish).md +++ b/Examples-(fish).md @@ -1,6 +1,33 @@ Examples for fish shell ----------------------- +### Navigation + +``` +function fzf-bcd-widget -d 'cd backwards' + pwd | awk -v RS=/ '/\n/ {exit} {p=p $0 "/"; print p}' | tac | eval (__fzfcmd) +m --select-1 --exit-0 $FZF_BCD_OPTS | read -l result + [ "$result" ]; and cd $result + commandline -f repaint +end +``` + +``` +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 + string join \n $dirprev | tac | sed 1d | eval (__fzfcmd) +m $FZF_CDHIST_OPTS | read -l result + [ "$result" ]; and cd $result + commandline -f repaint +end +``` + ### Git ``` @@ -40,4 +67,4 @@ function fpass -d "Fuzzy-find a Lastpass entry and copy the password" lpass ls | fzf | string replace -r -a '.+\[id: (\d+)\]' '$1' | xargs lpass show -c --password end -``` \ No newline at end of file +```