mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
* Updated term_tab to support systems without procfs
This commit is contained in:
parent
14d4deaba3
commit
9620263895
1 changed files with 18 additions and 6 deletions
|
|
@ -15,15 +15,27 @@
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
function _term_list(){
|
function _term_list(){
|
||||||
local -a w
|
local -a expl
|
||||||
|
local -au dirs
|
||||||
|
|
||||||
for SESSION in $(pidof zsh); do
|
PREFIX="$IPREFIX$PREFIX"
|
||||||
w+=${(D)$(readlink -n /proc/${SESSION}/cwd)}
|
IPREFIX=
|
||||||
done
|
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
|
zle -C term_list menu-complete _generic
|
||||||
bindkey "^v" term_list
|
bindkey "^v" term_list
|
||||||
zstyle ':completion:term_list:*' completer _term_list
|
zstyle ':completion:term_list::::' completer _term_list
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue