From 5896c87155f9346a2926786c6d578d0a5696d712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 26 May 2018 19:31:17 +0200 Subject: [PATCH] shrink-path: match only the beginning of the directory (#6862) Fixes #6317 --- plugins/shrink-path/shrink-path.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index e7eed170..29e6f0de 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -88,10 +88,10 @@ 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}) ( if [[ $tree[1] == \~* ]] {