summaryrefslogtreecommitdiffstats
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_grep4
-rw-r--r--Completion/Unix/Command/_sudo38
-rw-r--r--Completion/Unix/Command/_vim1
-rw-r--r--Completion/Unix/Command/_webbrowser2
-rw-r--r--Completion/Unix/Type/_urls2
5 files changed, 27 insertions, 20 deletions
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 0f1e712fd..120d1feea 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -68,7 +68,9 @@ arguments+=(
'(-)--help[display help information]'
)
-_pick_variant -r variant -c "$command" gnu=gnu gpl2=2.5.1 unix --version
+_pick_variant -r variant -c "$command" \
+ gnu=gnu gpl2='(2.5.1|GNU compatible)' unix --version
+
case $variant:$OSTYPE in
(gnu:*|gpl2:freebsd*))
[[ $service != (|g|z|gz|bz)[ef]grep ]] && arguments+=(
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 33a9d6c0c..e3b3565ef 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -1,7 +1,7 @@
#compdef sudo sudoedit
local curcontext="$curcontext" environ e cmd cpp ret=1
-local -a context state line args _comp_priv_prefix
+local -a context state state_descr line args _comp_priv_prefix
local -A opt_args
zstyle -a ":completion:${curcontext}:" environ environ
@@ -41,7 +41,8 @@ args=(
#
# TODO: use _arguments' $opt_args to detect the cases '-u jrandom -e' and '-Ae'
if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] )) ; then
- args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' )
+ args+=( '!(-V --version -h --help)-e' '*: :_files' )
+ _arguments -s -S -A '-?*' : $args && ret=0
else
cmd="$words[1]"
args+=(
@@ -53,38 +54,41 @@ else
'(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \
'(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \
'(-P --preserve-groups -i --login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \
- '*:: :->normal'
+ '*: :->normal'
)
+ # sudo allows environment-variable assignments to be interspersed with
+ # options. this pattern represents the lax method it uses to determine whether
+ # an arg is an assignment
+ _arguments -s -S -A '(-?*|[^/=]*=*)' : $args && ret=0
fi
-_arguments -s -S $args && ret=0
-
if [[ $state = normal ]]; then
_comp_priv_prefix=(
$cmd -n
${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]}
)
+
+ # there's no special handling for assignments with -l. they're parsed as
+ # normal, just ignored. we'll ignore them too
if (( $+opt_args[-l] || $+opt_args[--list] )); then
+ CURRENT=$#line words=( "${(@)line}" )
_normal -p $service
return
fi
- while [[ $words[1] = *=* ]]; do
- if (( CURRENT == 1 )); then
- compstate[parameter]="${PREFIX%%\=*}"
- compset -P 1 '*='
- _value && ret=0
- return ret
- fi
- shift words
- (( CURRENT-- ))
- done
- if (( CURRENT == 1 )); then
+
+ # $line excludes words that match the -A pattern, except when it's the current
+ # word. so if $#line == 1 we haven't seen a command yet
+ if (( $#line == 1 )) && [[ $PREFIX == *=* ]]; then
+ compstate[parameter]="${PREFIX%%\=*}"
+ compset -P 1 '*='
+ _value && ret=0
+ elif (( $#line == 1 )); then
curcontext="${curcontext%:*:*}:-command-:"
_alternative \
'commands:: _command_names -e' \
- 'options:option:(-s --shell -l --login)' \
'parameters: :_parameters -g "*export*~*readonly*" -qS=' && ret=0
else
+ CURRENT=$#line words=( "${(@)line}" )
_normal && ret=0
fi
fi
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 5a805b9f6..2e7c70064 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -91,6 +91,7 @@ else
'(- *)--serverlist[list available vim servers and exit]'
'--servername[name of vim server to send to or name of server to become]:server name:->server'
'--socketid[run GVIM in another window]'
+ '--log[start logging to given file]:log file:_files'
'-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files'
)
fi
diff --git a/Completion/Unix/Command/_webbrowser b/Completion/Unix/Command/_webbrowser
index e4f5fe092..17a98669a 100644
--- a/Completion/Unix/Command/_webbrowser
+++ b/Completion/Unix/Command/_webbrowser
@@ -1,3 +1,3 @@
-#compdef amaya arena chimera dillo dwb express galeon grail gzilla hotjava konqueror light mmm Mosaic netrik opera opera-next retawq skipstone www xmosaic zen
+#compdef dillo eolie epiphany falkon konqueror ladybird netrik
_alternative 'files: :_files' 'urls: :_urls'
diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls
index f9cdd58cd..75b6dfbd2 100644
--- a/Completion/Unix/Type/_urls
+++ b/Completion/Unix/Type/_urls
@@ -37,7 +37,7 @@
# E.g.:
# zstyle ':completion:*:urls' local www /usr/local/apache/htdocs public_html
-local ipre scheme host user uhosts ret=1 expl match glob suf
+local ipre scheme host user uhosts urls ret=1 expl match glob suf
local localhttp
zstyle -a ":completion:${curcontext}:urls" local localhttp
local localhttp_servername="$localhttp[1]"