diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-16 20:03:31 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-16 20:03:31 +0100 |
commit | eaba08ca7ab2819a874ccc3d81bc6cb4cccbe379 (patch) | |
tree | e277c803145ae12204ffc4469f3cb2741cdbb8c0 | |
parent | 9e910dec14c0f8ac3d0cdef4220046c3c570b40c (diff) |
rtab function: Allow configuration via zstyle
-rw-r--r-- | etc/function | 1 | ||||
-rw-r--r-- | etc/functions/chpwd | 2 | ||||
-rw-r--r-- | etc/functions/rtab | 11 | ||||
-rw-r--r-- | etc/prompt | 2 | ||||
-rw-r--r-- | etc/rc | 1 |
5 files changed, 15 insertions, 2 deletions
diff --git a/etc/function b/etc/function index 19e5ebd..80319bd 100644 --- a/etc/function +++ b/etc/function @@ -12,7 +12,6 @@ autoload check_com chpwd dirinfo extr git-hook gtd-move \ world-readable xexport xsource youtube-watch colors -chpwd # from https://git.tabularazor.org/~mikael/etc/tree/zsh/functions for action in Start Stop Restart Reload; { 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 ;; @@ -18,3 +18,5 @@ RPS1="${ps_yellow}[${ps_info}%1v${ps_yellow}%T]${ps_reset}" unset user at host unset dir ps_sign sign screen + +zstyle ':prompt:rtab' fish yes @@ -35,6 +35,7 @@ bindkey -e check_com -c dircolors && eval $(dircolors -b $HOME/packages/zsh/etc/dircolors) mesg n umask 077 +chpwd ## cleanup unalias 'linux:' |