From 96202638952e4c180f3c64c3fbbf2e3eafe440e3 Mon Sep 17 00:00:00 2001 From: Julian Vetter Date: Thu, 30 Jul 2015 15:28:11 +0200 Subject: [PATCH] * Updated term_tab to support systems without procfs --- plugins/term_tab/term_tab.plugin.zsh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/plugins/term_tab/term_tab.plugin.zsh b/plugins/term_tab/term_tab.plugin.zsh index abded90e..1b612df6 100644 --- a/plugins/term_tab/term_tab.plugin.zsh +++ b/plugins/term_tab/term_tab.plugin.zsh @@ -15,15 +15,27 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA function _term_list(){ - local -a w + local -a expl + local -au dirs - for SESSION in $(pidof zsh); do - w+=${(D)$(readlink -n /proc/${SESSION}/cwd)} - done + PREFIX="$IPREFIX$PREFIX" + IPREFIX= + SUFFIX="$SUFFIX$ISUFFIX" + ISUFFIX= - compadd -aQS '' w + [[ -o magicequalsubst ]] && compset -P '*=' + + case $OSTYPE in + solaris*) dirs=( ${(M)${${(f)"$(pgrep -U $UID -x zsh|xargs pwdx)"}:#$$:*}%%/*} ) ;; + linux*) dirs=( /proc/${^$(pidof zsh):#$$}/cwd(N:A) ) ;; + esac + dirs=( ${(D)dirs} ) + + compstate[pattern_match]='*' + _wanted directories expl 'current directory from other shell' \ + compadd -Q -M "r:|/=* r:|=*" -f -a dirs } zle -C term_list menu-complete _generic bindkey "^v" term_list -zstyle ':completion:term_list:*' completer _term_list +zstyle ':completion:term_list::::' completer _term_list