2016-04-15 09:37:19 +08:00
|
|
|
function dirh --description "Print the current directory history (the prev and next lists)"
|
|
|
|
if set -q argv[1]
|
|
|
|
switch $argv[1]
|
|
|
|
case -h --h --he --hel --help
|
|
|
|
__fish_print_help dirh
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2016-04-15 09:37:19 +08:00
|
|
|
set -l dirc (count $dirprev)
|
2016-09-12 12:30:39 +08:00
|
|
|
if test $dirc -gt 0
|
|
|
|
set -l dirprev_rev $dirprev[-1..1]
|
|
|
|
# This can't be (seq $dirc -1 1) because of BSD.
|
|
|
|
set -l dirnum (seq 1 $dirc)
|
|
|
|
for i in $dirnum[-1..1]
|
|
|
|
printf '%2d) %s\n' $i $dirprev_rev[$i]
|
|
|
|
end
|
2016-04-15 09:37:19 +08:00
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2016-04-15 09:37:19 +08:00
|
|
|
echo (set_color $fish_color_history_current)' ' $PWD(set_color normal)
|
2012-11-18 18:23:22 +08:00
|
|
|
|
2016-04-15 09:37:19 +08:00
|
|
|
set -l dirc (count $dirnext)
|
|
|
|
if test $dirc -gt 0
|
|
|
|
for i in (seq $dirc)
|
|
|
|
printf '%2d) %s\n' $i $dirnext[$i]
|
2012-05-05 09:37:24 +08:00
|
|
|
end
|
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2016-04-15 09:37:19 +08:00
|
|
|
echo
|
2006-02-08 17:20:05 +08:00
|
|
|
end
|