2016-04-15 01:37:19 +00: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 09:20:05 +00:00
|
|
|
|
2016-04-15 01:37:19 +00:00
|
|
|
set -l dirc (count $dirprev)
|
2016-09-12 04:30:39 +00: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 01:37:19 +00:00
|
|
|
end
|
2006-02-08 09:20:05 +00:00
|
|
|
|
2016-04-15 01:37:19 +00:00
|
|
|
echo (set_color $fish_color_history_current)' ' $PWD(set_color normal)
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2016-04-15 01:37:19 +00: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 01:37:24 +00:00
|
|
|
end
|
|
|
|
end
|
2006-02-08 09:20:05 +00:00
|
|
|
|
2016-04-15 01:37:19 +00:00
|
|
|
echo
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|