mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 01:17:45 +00:00
fd11f294bc
darcs-hash:20061212171118-ac50b-a40709edf008f3d725e3755d5282ae5a84818c88.gz
35 lines
726 B
Fish
35 lines
726 B
Fish
|
|
function dirh -d (N_ "Print the current directory history (the back- and fwd- lists)")
|
|
|
|
if count $argv >/dev/null
|
|
switch $argv[1]
|
|
case -h --h --he --hel --help
|
|
__fish_print_help dirh
|
|
return 0
|
|
end
|
|
end
|
|
|
|
# Avoid set comment
|
|
set -l current (command pwd)
|
|
set -l separator " "
|
|
set -l line_len (math (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) )
|
|
if test $line_len -gt $COLUMNS
|
|
# Print one entry per line if history is long
|
|
set separator "\n"
|
|
end
|
|
|
|
for i in $dirprev
|
|
echo -n -e $i$separator
|
|
end
|
|
|
|
set_color $fish_color_history_current
|
|
echo -n -e $current$separator
|
|
set_color normal
|
|
|
|
for i in (seq (echo (count $dirnext)) -1 1)
|
|
echo -n -e $dirnext[$i]$separator
|
|
end
|
|
|
|
echo
|
|
end
|
|
|