summaryrefslogtreecommitdiff
path: root/plugins/shrink-path
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2019-05-08 20:40:36 +0200
committerGitHub <noreply@github.com>2019-05-08 20:40:36 +0200
commit0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534 (patch)
tree946d9f8b758ebdd63da96152ca56b154c99068da /plugins/shrink-path
parentafb028763cf40fc339e49011b2cba124dc108fcb (diff)
parentebc700be9b2fa7ae770a644093a5c46a8e323726 (diff)
downloadzsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.tar.gz
zsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.tar.bz2
zsh-0232ac4bb1cb64b5bfaa7e5fc979d6f7ab23e534.zip
Merge branch 'master' into master
Diffstat (limited to 'plugins/shrink-path')
-rw-r--r--plugins/shrink-path/README.md6
-rw-r--r--plugins/shrink-path/shrink-path.plugin.zsh17
2 files changed, 11 insertions, 12 deletions
diff --git a/plugins/shrink-path/README.md b/plugins/shrink-path/README.md
index 51fa8a051..b990aea91 100644
--- a/plugins/shrink-path/README.md
+++ b/plugins/shrink-path/README.md
@@ -57,10 +57,10 @@ supported.
Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
-License: WTFPL <http://sam.zoy.org/wtfpl>
+License: WTFPL <http://www.wtfpl.net>
-Ref: http://www.zsh.org/mla/workers/2009/msg00415.html
- http://www.zsh.org/mla/workers/2009/msg00419.html
+Ref: https://www.zsh.org/mla/workers/2009/msg00415.html
+ https://www.zsh.org/mla/workers/2009/msg00419.html
## Misc
diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh
index f111962a5..86102e651 100644
--- a/plugins/shrink-path/shrink-path.plugin.zsh
+++ b/plugins/shrink-path/shrink-path.plugin.zsh
@@ -24,10 +24,10 @@
# Keywords: prompt directory truncate shrink collapse fish
#
# Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
-# License: WTFPL <http://sam.zoy.org/wtfpl>
+# License: WTFPL <http://www.wtfpl.net>
#
-# Ref: http://www.zsh.org/mla/workers/2009/msg00415.html
-# http://www.zsh.org/mla/workers/2009/msg00419.html
+# Ref: https://www.zsh.org/mla/workers/2009/msg00415.html
+# https://www.zsh.org/mla/workers/2009/msg00419.html
shrink_path () {
setopt localoptions
@@ -88,19 +88,18 @@ shrink_path () {
if (( named )) {
for part in ${(k)nameddirs}; {
- [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part}
+ [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part}
}
}
- (( tilde )) && dir=${dir/$HOME/\~}
+ (( tilde )) && dir=${dir/#$HOME/\~}
tree=(${(s:/:)dir})
(
- unfunction chpwd 2> /dev/null
if [[ $tree[1] == \~* ]] {
- cd ${~tree[1]}
+ cd -q ${~tree[1]}
result=$tree[1]
shift tree
} else {
- cd /
+ cd -q /
}
for dir in $tree; {
if (( lastfull && $#tree == 1 )) {
@@ -117,7 +116,7 @@ shrink_path () {
(( short )) && break
done
result+="/$part"
- cd $dir
+ cd -q $dir
shift tree
}
echo ${result:-/}