mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 01:23:43 -05:00
Add navigation widgets bcd and cdhist
@@ -1,6 +1,33 @@
|
|||||||
Examples for fish shell
|
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
|
### 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
|
lpass ls | fzf | string replace -r -a '.+\[id: (\d+)\]' '$1' | xargs lpass show -c --password
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user