2016-04-15 01:37:19 +00:00
|
|
|
function dirh --description "Print the current directory history (the prev and next lists)"
|
2020-03-09 18:36:12 +00:00
|
|
|
set -l options h/help
|
2017-07-13 18:50:57 +00:00
|
|
|
argparse -n dirh --max-args=0 $options -- $argv
|
|
|
|
or return
|
|
|
|
|
|
|
|
if set -q _flag_help
|
|
|
|
__fish_print_help dirh
|
|
|
|
return 0
|
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
|
|
|
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
|
2019-01-03 23:00:34 +00:00
|
|
|
set -l dirnext_rev $dirnext[-1..1]
|
2016-04-15 01:37:19 +00:00
|
|
|
for i in (seq $dirc)
|
2019-01-03 23:00:34 +00:00
|
|
|
printf '%2d) %s\n' $i $dirnext_rev[$i]
|
2012-05-05 01:37:24 +00:00
|
|
|
end
|
|
|
|
end
|
2016-04-15 01:37:19 +00:00
|
|
|
echo
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|