From eaba08ca7ab2819a874ccc3d81bc6cb4cccbe379 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 16 Nov 2008 20:03:31 +0100 Subject: rtab function: Allow configuration via zstyle --- etc/functions/chpwd | 2 +- etc/functions/rtab | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'etc/functions') diff --git a/etc/functions/chpwd b/etc/functions/chpwd index 11510b4..40070b2 100644 --- a/etc/functions/chpwd +++ b/etc/functions/chpwd @@ -3,4 +3,4 @@ ## This all belongs into the prompt, but since it only changes ## when changing directories, it's more efficient to do it here psvar[1]=$(dirinfo) -psvar[2]=$(rtab -f) +psvar[2]=$(rtab) diff --git a/etc/functions/rtab b/etc/functions/rtab index b543493..ff4245e 100644 --- a/etc/functions/rtab +++ b/etc/functions/rtab @@ -13,6 +13,15 @@ typeset lastfull=0 typeset short=0 typeset tilde=0 +if zstyle -t ':prompt:rtab' fish; then + lastfull=1 + short=1 + tilde=1 +fi +zstyle -t ':prompt:rtab' last && lastfull=1 +zstyle -t ':prompt:rtab' short && short=1 +zstyle -t ':prompt:rtab' tilde && tilde=1 + while [[ $1 == -* ]]; do case $1 in -f|--fish) @@ -26,6 +35,8 @@ while [[ $1 == -* ]]; do print ' -l, --last Print the last directory''s full name' print ' -s, --short Truncate directory names to the first character' print ' -t, --tilde Print ~ for the home directory' + print 'The long options can also bu set via zstyle, like' + print ' zstyle :prompt:rtab fish yes' return 0 ;; -l|--last) lastfull=1 ;; -- cgit v1.2.3