diff options
Diffstat (limited to 'Completion/Builtins')
-rw-r--r-- | Completion/Builtins/_pids | 6 | ||||
-rw-r--r-- | Completion/Builtins/_popd | 4 | ||||
-rw-r--r-- | Completion/Builtins/_sched | 2 | ||||
-rw-r--r-- | Completion/Builtins/_signals | 4 | ||||
-rw-r--r-- | Completion/Builtins/_stat | 2 | ||||
-rw-r--r-- | Completion/Builtins/_zftp | 19 | ||||
-rw-r--r-- | Completion/Builtins/_zstyle | 20 |
7 files changed, 35 insertions, 22 deletions
diff --git a/Completion/Builtins/_pids b/Completion/Builtins/_pids index 8b5d27bc5..b00e811bb 100644 --- a/Completion/Builtins/_pids +++ b/Completion/Builtins/_pids @@ -12,12 +12,12 @@ if [[ "$1" = -m ]]; then shift 2 fi -zstyle -a ":completion${curcontext}:ps" arguments args +zstyle -a ":completion:${curcontext}:ps" arguments args out="$(command ps $args 2>/dev/null)" -if zstyle -t ":completion${curcontext}:processes" verbose; then - zstyle -a ":completion${curcontext}:ps" list-arguments listargs +if zstyle -t ":completion:${curcontext}:processes" verbose; then + zstyle -a ":completion:${curcontext}:ps" list-arguments listargs (( $#listargs )) || listargs=( "$args[@]" ) if [[ "$listargs" = "$args" ]]; then list=("${(@Mr:COLUMNS-1:)${(f@)out}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${~match}}") diff --git a/Completion/Builtins/_popd b/Completion/Builtins/_popd index 8c5b1208d..586018952 100644 --- a/Completion/Builtins/_popd +++ b/Completion/Builtins/_popd @@ -11,10 +11,10 @@ local expl list lines revlines disp _wanted -V directory-stack expl 'directory stack' || return 1 -! zstyle -t ":completion${curcontext}:directory-stack" prefix-needed || +! zstyle -t ":completion:${curcontext}:directory-stack" prefix-needed || [[ $PREFIX = [-+]* ]] || return 1 -if zstyle -t ":completion${curcontext}:directory-stack" verbose; then +if zstyle -t ":completion:${curcontext}:directory-stack" verbose; then # get the list of directories with their canonical number # and turn the lines into an array, removing the current directory lines=("${dirstack[@]}") diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched index ea11eeb65..851659033 100644 --- a/Completion/Builtins/_sched +++ b/Completion/Builtins/_sched @@ -7,7 +7,7 @@ if [[ CURRENT -eq 2 ]]; then _wanted -C - jobs expl 'scheduled jobs' || return 1 lines=(${(f)"$(sched)"}) - if zstyle -t ":completion${curcontext}:jobs" verbose; then + if zstyle -t ":completion:${curcontext}:jobs" verbose; then disp=( -ld lines ) else disp=() diff --git a/Completion/Builtins/_signals b/Completion/Builtins/_signals index 545d83924..ad1f0131b 100644 --- a/Completion/Builtins/_signals +++ b/Completion/Builtins/_signals @@ -22,11 +22,11 @@ done if _wanted signals expl signal && { [[ -z "$minus" ]] || - ! zstyle -t ":completion${curcontext}:signals" prefix-needed || + ! zstyle -t ":completion:${curcontext}:signals" prefix-needed || [[ "$PREFIX" = -* ]] } ; then local disp tmp - if zstyle -t ":completion${curcontext}:signals" prefix-hidden; then + if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then tmp=( "${(@)signals[1,last]}" ) disp=(-d tmp) else diff --git a/Completion/Builtins/_stat b/Completion/Builtins/_stat index ca7d2900d..ae884066f 100644 --- a/Completion/Builtins/_stat +++ b/Completion/Builtins/_stat @@ -10,7 +10,7 @@ else while _tags; do _requested files && _files && ret=0 _requested options expl 'inode element' && - { ! zstyle -t ":completion${curcontext}:options" prefix-needed || + { ! zstyle -t ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX[1]" = + || ret -eq 1 ]] } && compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \ +size +atime +mtime +ctime +blksize +block +link diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp index 8407de30e..6246015ec 100644 --- a/Completion/Builtins/_zftp +++ b/Completion/Builtins/_zftp @@ -9,7 +9,7 @@ # Don't try any more completion after this. _compskip=all -local subcom expl +local subcom expl curcontext="${curcontext}" if [[ $words[1] = zftp ]]; then if [[ $CURRENT -eq 2 ]]; then @@ -20,6 +20,7 @@ if [[ $words[1] = zftp ]]; then return fi subcom=$words[2] + curcontext="${curcontext/:zftp:/:zftp-${words[2]}:}" else subcom=$words[1] fi @@ -27,27 +28,27 @@ fi case $subcom in *(cd|ls|dir)) # complete remote directories - _tags -C "$subcom" directories && zfcd_match $PREFIX $SUFFIX + _tags directories && zfcd_match $PREFIX $SUFFIX ;; *(get(|at)|gcp|delete|remote)) # complete remote files - _tags -C "$subcom" files && zfget_match $PREFIX $SUFFIX + _tags files && zfget_match $PREFIX $SUFFIX ;; *(put(|at)|pcp)) # complete local files - _tags -C "$subcom" files && _files + _tags files && _files ;; *(open|anon|params)) # complete hosts: should do cleverer stuff with user names - _tags -C "$subcom" hosts && _hosts + _tags hosts && _hosts ;; *(goto|mark)) # complete bookmarks. First decide if ncftp mode is go. - _wanted -C "$subcom" bookmarks expl bookmark || return 1 + _wanted bookmarks expl bookmark || return 1 if [[ $words[2] = -*n* ]]; then if [[ -f ~/.ncftp/bookmarks ]]; then compadd "$expl[@]" - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks) @@ -61,7 +62,7 @@ case $subcom in *session) # complete sessions, excluding the current one. - _wanted -C "$subcom" sessions expl 'another FTP session' && + _wanted sessions expl 'another FTP session' && compadd "$expl[@]" - ${$(zftp session):#$ZFTP_SESSION} ;; @@ -69,7 +70,7 @@ case $subcom in # complete arguments like sess1:file1 sess2:file2 if [[ $PREFIX = *:* ]]; then # complete file in the given session - _tags -C "$subcom" files || return 1 + _tags files || return 1 local sess=${PREFIX%%:*} oldsess=$ZFTP_SESSION compset -p $(( $#sess + 1 )) [[ -n $sess ]] && zftp session $sess @@ -77,7 +78,7 @@ case $subcom in [[ -n $sess && -n $oldsess ]] && zftp session $oldsess else # note here we can complete the current session - _wanted -C "$subcom" sessions expl 'FTP session' && + _wanted sessions expl 'FTP session' && compadd "$expl[@]" -S : - $(zftp session) fi ;; diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 4629344cc..5b99eacdf 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -1,7 +1,7 @@ #compdef zstyle local curcontext="$curcontext" state context ostate line expl ctop -local nm=$compstate[nmatches] +local nm=$compstate[nmatches] mesg typeset -A opt_args typeset -A styles @@ -17,6 +17,7 @@ styles=( condition c: cursor c:bool disable-stat c:bool + domains c: expand c: file-patterns c: format c: @@ -87,9 +88,20 @@ while [[ -n $state ]]; do case "$ostate" in contexts) - if [[ $PREFIX != :*: ]]; then - _wanted contexts expl context && - compadd -P : -S : "$expl[@]" completion zftp + if _wanted contexts expl context; then + if [[ $PREFIX != :*: ]]; then + compadd -P : -S : "$expl[@]" completion zftp + elif [[ $PREFIX = :completion:* ]]; then + mesg='' + case "$PREFIX" in + :completion:[^:]#) mesg=function ;; + :completion:[^:]#:[^:]#) mesg=completer ;; + :completion:[^:]#:[^:]#:[^:]#) mesg='command or context' ;; + :completion:[^:]#:[^:]#:[^:]#:[^:]#) mesg=argument ;; + :completion:[^:]#:[^:]#:[^:]#:[^:]#:[^:]#) mesg=tag ;; + esac + [[ -n "$mesg" ]] && _message "$mesg" + fi fi ;; |