about summary refs log tree commit diff
path: root/Completion/Zsh/Context/_tilde
blob: 7d7bf5aea8f38a5af4680b8ebf4040847b2a6616 (plain) (blame)
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
#compdef -tilde-

# We use all named directories and user names here. If this is too slow
# for you or if there are too many of them, you may want to use
# `compadd -qS/ -a friends' or something like that.

[[ -n "$compstate[quote]" ]] && return 1

local expl suf dirs list lines revlines i ret disp nm="$compstate[nmatches]"

if [[ "$SUFFIX" = */* ]]; then
  ISUFFIX="/${SUFFIX#*/}$ISUFFIX"
  SUFFIX="${SUFFIX%%/*}"
  suf=(-S '')
else
  suf=(-qS/)
fi

_tags users named-directories directory-stack

while _tags; do
  _requested users && _users "$suf[@]" "$@" && ret=0

  _requested named-directories expl 'named directory' \
      compadd "$suf[@]" "$@" -k nameddirs

  _requested directory-stack && _directory_stack "$suf[@]" && ret=0

  (( ret )) || return 0
done