fish: Fix dirprev resizing
parent
d29ec42312
commit
38efb2d440
|
@ -11,7 +11,7 @@ set -g fish_cdhist_max 128
|
||||||
## Go back to last cdhist folder. Run this before the SHELL_FILEBROWSER hook.
|
## Go back to last cdhist folder. Run this before the SHELL_FILEBROWSER hook.
|
||||||
if grep -q . $fish_cdhist_path ^ /dev/null
|
if grep -q . $fish_cdhist_path ^ /dev/null
|
||||||
set dirprev (cat $fish_cdhist_path)
|
set dirprev (cat $fish_cdhist_path)
|
||||||
set -q dirprev[$fish_cdhist_max]; and set dirprev $dirprev[-$fish_cdhist_max..-1]
|
set -q dirprev[$fish_cdhist_max]; and set dirprev $dirprev[(math - $fish_cdhist_max)..-1]
|
||||||
cd $dirprev[(count $dirprev)] ^ /dev/null
|
cd $dirprev[(count $dirprev)] ^ /dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ function cd --description "Change directory"
|
||||||
if set -q dirprev
|
if set -q dirprev
|
||||||
## Remove duplicates.
|
## Remove duplicates.
|
||||||
set -g dirprev (string match -v $PWD $dirprev) $PWD
|
set -g dirprev (string match -v $PWD $dirprev) $PWD
|
||||||
set -q dirprev[$fish_cdhist_max]; and set dirprev $dirprev[-$fish_cdhist_max..-1]
|
## Keep last '$fish_cdhist_max' elements only.
|
||||||
|
set -q dirprev[$fish_cdhist_max]; and set dirprev $dirprev[(math - $fish_cdhist_max)..-1]
|
||||||
## Save history.
|
## Save history.
|
||||||
string join \n $dirprev > $fish_cdhist_path
|
string join \n $dirprev > $fish_cdhist_path
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue