diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2021-06-06 14:40:38 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2021-06-06 14:40:38 -0600 |
commit | 0144641b7d8e4e6ff6ce153039b5a827f5347904 (patch) | |
tree | 88ffb476ef9c1eb84b22006afe8a729fb27dc3c4 /plugins/shrink-path/shrink-path.plugin.zsh | |
parent | ffdc4bfe1204f911d71b136dbd95784176a44eb6 (diff) | |
parent | 706b2f3765d41bee2853b17724888d1a3f6f00d9 (diff) | |
download | zsh-0144641b7d8e4e6ff6ce153039b5a827f5347904.tar.gz zsh-0144641b7d8e4e6ff6ce153039b5a827f5347904.tar.bz2 zsh-0144641b7d8e4e6ff6ce153039b5a827f5347904.zip |
Merge remote-tracking branch 'origin/master'
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} |