zsh-workers
 help / color / mirror / code / Atom feed
a9dc859f16f1768e87df09e77c95516ec8b283ce blob 1057 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
#autoload

# Completes current directories of other zsh processes
# this is intended to be used via _generic bound to a
# different key. Note that pattern matching is enabled.

local -a expl
local -au dirs

# undo work _main_complete did to remove the tilde
PREFIX="$IPREFIX$PREFIX"
IPREFIX=
SUFFIX="$SUFFIX$ISUFFIX"
ISUFFIX=

[[ -o magicequalsubst ]] && compset -P '*='

case $OSTYPE in
  solaris*)
    dirs=(
      ${(M)${${(f)"$(pgrep -U $UID -x zsh|xargs pwdx 2>/dev/null)"}:#$$:*}%%/*}
    )
  ;;
  linux*)
    dirs=( /proc/${^$(pidof -- -zsh zsh):#$$}/cwd(N:P) )
    dirs=( $^dirs(N^@) )
  ;;
  freebsd*)
    dirs=( $(pgrep -U $UID -x zsh) )
    dirs=( $(procstat -h -f $dirs|awk '{if ($3 == "cwd") print $NF}') )
  ;;
  *)
    if (( $+commands[lsof] )); then
      dirs=( ${${${(M)${(f)"$(lsof -a -u $EUID -c zsh -p \^$$ -d cwd -F n -w
          2>/dev/null)"}:#n*}#?}%% \(*} )
    fi
  ;;
esac
dirs=( ${(D)dirs} )

compstate[pattern_match]='*'
_wanted directories expl 'current directory from other shell' \
    compadd -M "r:|/=* r:|=*" -f -a dirs
debug log:

solving a9dc859 ...
found a9dc859 in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).