summaryrefslogtreecommitdiff
path: root/Completion/Base
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Completer/_user_expand13
-rw-r--r--Completion/Base/Utility/.distfiles2
-rw-r--r--Completion/Base/Utility/_remote_files77
3 files changed, 8 insertions, 84 deletions
diff --git a/Completion/Base/Completer/_user_expand b/Completion/Base/Completer/_user_expand
index 049cc31ef..cf3d172f0 100644
--- a/Completion/Base/Completer/_user_expand
+++ b/Completion/Base/Completer/_user_expand
@@ -12,7 +12,7 @@ setopt localoptions nonomatch
[[ _matcher_num -gt 1 ]] && return 1
-local exp word sort expr expl subd suf=" " asp tmp spec
+local exp word sort expr expl subd suf=" " asp tmp spec REPLY
local -a specs reply
if [[ "$funcstack[2]" = _prefix ]]; then
@@ -30,6 +30,7 @@ exp=("$word")
zstyle -a ":completion:${curcontext}" user-expand specs || return 1
for spec in $specs; do
+ REPLY=
case $spec in
('$'[[:IDENT:]]##)
# Spec is an associative array with explicit keys.
@@ -85,9 +86,9 @@ fi
if [[ -z "$compstate[insert]" ]] ;then
if [[ "$sort" = menu ]]; then
- _description expansions expl expansions "o:$word"
+ _description expansions expl "expansions${REPLY:+: $REPLY}" "o:$word"
else
- _description -V expansions expl expansions "o:$word"
+ _description -V expansions expl "expansions${REPLY:+: $REPLY}" "o:$word"
fi
compadd "$expl[@]" -UQ -qS "$suf" -a exp
@@ -98,9 +99,9 @@ else
local i j normal space dir
if [[ "$sort" = menu ]]; then
- _description expansions expl expansions "o:$word"
+ _description expansions expl "expansions${REPLY:+: $REPLY}" "o:$word"
else
- _description -V expansions expl expansions "o:$word"
+ _description -V expansions expl "expansions${REPLY:+: $REPLY}" "o:$word"
fi
normal=()
space=()
@@ -120,7 +121,7 @@ else
(( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space
(( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal
fi
- if _requested all-expansions expl 'all expansions'; then
+ if _requested all-expansions expl "all expansions${REPLY:+: $REPLY}"; then
local disp dstr
if [[ "${#${exp}}" -ge COLUMNS ]]; then
diff --git a/Completion/Base/Utility/.distfiles b/Completion/Base/Utility/.distfiles
index d5e359ae7..97d86bdbf 100644
--- a/Completion/Base/Utility/.distfiles
+++ b/Completion/Base/Utility/.distfiles
@@ -5,5 +5,5 @@ _arg_compile _combination _regex_arguments _values
_arguments _set_command _retrieve_cache _guard
_cache_invalid _describe _sep_parts _pick_variant
_call_function _multi_parts _store_cache _regex_words
-_complete_help_generic _remote_files
+_complete_help_generic
'
diff --git a/Completion/Base/Utility/_remote_files b/Completion/Base/Utility/_remote_files
deleted file mode 100644
index c35e3d3fa..000000000
--- a/Completion/Base/Utility/_remote_files
+++ /dev/null
@@ -1,77 +0,0 @@
-#autoload
-
-# Complete files on remote systems using SSH (and other programs). Needs
-# key-based authentication with no passwords or a running ssh-agent to work.
-#
-# Usage:
-# _remote_files [--no-files] [--no-dirs] -- <cmd> [<cmd options>]
-#
-# Options:
-# - --no-files: don't complete remote files
-# - --no-dirs: don't complete remote directories
-#
-# Commands:
-# - ssh: Additional options for non-interactive use are automatically added
-# (see below).
-# - All other commands are used unaltered.
-#
-# Examples:
-# - _remote_files -- ssh
-# Use ssh to retrieve the remote paths. The "--" is not optional!
-# - _remote_files --no-files -- ssh -2 -p 42
-# Use ssh with the option -2 and -p 42 to retrieve the remote paths and
-# complete only directories.
-# - _remote_files -- rsh
-# Use rsh to retrieve the remote paths.
-
-
-# There should be coloring based on all the different ls -F classifiers.
-local expl rempat remfiles remdispf remdispd args cmd cmd_args suf ret=1
-
-if zstyle -T ":completion:${curcontext}:files" remote-access; then
-
- # Parse options to _remote_files. Stops at the first "--".
- zparseopts -D -E -a args -no-files -no-dirs
- shift
-
- # Command to run on the remote system.
- cmd="$1"
- shift
-
- # Handle arguments to ssh.
- if [[ $cmd == ssh ]]; then
- zparseopts -D -E -a cmd_args p: 1 2 4 6 F:
- cmd_args="-o BatchMode=yes $cmd_args -a -x"
- else
- cmd_args="$@"
- fi
-
- if [[ -z $QIPREFIX ]]
- then rempat="${PREFIX%%[^./][^/]#}\*"
- else rempat="${(q)PREFIX%%[^./][^/]#}\*"
- fi
-
- remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
-
- compset -P '*/'
- compset -S '/*' || suf='remote file'
-
- remdispf=(${remfiles:#*/})
- remdispd=(${(M)remfiles:#*/})
-
- _tags files
- while _tags; do
- while _next_label files expl ${suf:-remote directory}; do
- [[ ${args[(I)--no-files]} -eq 0 ]] && \
- [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
- ${(q)remdispf%[*=@|]} && ret=0
- [[ ${args[(I)--no-dirs]} -eq 0 ]] && \
- compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
- ${(q)remdispd%/} && ret=0
- done
- (( ret )) || return 0
- done
- return ret
-else
- _message -e remote-files 'remote file'
-fi