aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/dirh.fish
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-17 20:13:39 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-17 20:13:39 +1000
commit343cafef346543282b5b6e825bc8f9dd10028a48 (patch)
tree1bcf221ecb525c7aeadc8325e7b780d3656e544b /share/functions/dirh.fish
parent95a01f3c8f15034433ffce368d8f2d13d925139c (diff)
Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
Diffstat (limited to 'share/functions/dirh.fish')
-rw-r--r--share/functions/dirh.fish26
1 files changed, 26 insertions, 0 deletions
diff --git a/share/functions/dirh.fish b/share/functions/dirh.fish
new file mode 100644
index 00000000..8be46c81
--- /dev/null
+++ b/share/functions/dirh.fish
@@ -0,0 +1,26 @@
+
+function dirh -d (_ "Print the current directory history (the back- and fwd- lists)")
+ # Avoid set comment
+ set -l current (command pwd)
+ set -l separator " "
+ set -l line_len (echo (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) | bc)
+ 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
+