diff options
Diffstat (limited to 'plugins/shrink-path/shrink-path.plugin.zsh')
-rw-r--r-- | plugins/shrink-path/shrink-path.plugin.zsh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index f0ed65138..373fd5b05 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -45,6 +45,7 @@ shrink_path () { typeset -i length=1 typeset ellipsis="" typeset -i quote=0 + typeset -i expand=0 if zstyle -t ':prompt:shrink_path' fish; then lastfull=1 @@ -60,6 +61,7 @@ shrink_path () { zstyle -t ':prompt:shrink_path' tilde && tilde=1 zstyle -t ':prompt:shrink_path' glob && ellipsis='*' zstyle -t ':prompt:shrink_path' quote && quote=1 + zstyle -t ':prompt:shrink_path' expand && expand=1 while [[ $1 == -* ]]; do case $1 in @@ -85,6 +87,8 @@ shrink_path () { print ' ellipsis character(s) (defaulting to 1).' print ' -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.' print ' -q, --quote Quote special characters in the shrunk path' + print ' -x, --expand Print the full path. This takes precedence over the other options' + print '' print 'The long options can also be set via zstyle, like' print ' zstyle :prompt:shrink_path fish yes' return 0 @@ -109,6 +113,9 @@ shrink_path () { -q|--quote) quote=1 ;; + -x|--expand) + expand=1 + ;; esac shift done @@ -120,6 +127,11 @@ shrink_path () { [[ -d $dir ]] || return 0 + if (( expand )) { + echo "$dir" + return 0 + } + if (( named )) { for part in ${(k)nameddirs}; { [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part} |