Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: add --servername completion to _vim
- X-seq: zsh-workers 29483
- From: Doug Kearns <dougkearns@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: add --servername completion to _vim
- Date: Thu, 16 Jun 2011 16:16:30 +1000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=Na9bZ0fQWbfy2KinCw8lPr9eksPe8PahaSQ0let39io=; b=VxaGZmSEeSWaier5b7dnfK5/JqlE2TPld0aXpyaiBKn0o8kaB2GB6pFvUXznPyhPmW vMvtGK12QGqZZ7+/Tu3mTdevJT+QgfPAJ05ONrc0QnsUwKrJOc04ePU15bdWQx6a8JLZ mm1aPTjcAwiVPWvxI50hqhF2eAZUm9/cu2aDc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=eMJZiweRG2OA0XH74iAVkWQYU96jCKyAsRa+NiWML+q2nIDJJ87LsRyMDQ8C40UaVD 2I1Kl0iFBeB43WhRd/p1zkZGtNmV1DhBqbaHudeuTu09edOVkLZqo9cPPvvMwsnAtFDU d5B8HhXtzfb6sMi5HEMPX6TtzWc1Y2UmZwLJ0=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Index: Completion/Unix/Command/_vim
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_vim,v
retrieving revision 1.9
diff -u -r1.9 _vim
--- Completion/Unix/Command/_vim 29 Mar 2011 10:08:52 -0000 1.9
+++ Completion/Unix/Command/_vim 16 Jun 2011 05:56:54 -0000
@@ -12,6 +12,9 @@
esac
}
+local curcontext="$curcontext" state line expl
+typeset -A opt_args
+
local arguments
arguments=(
@@ -46,7 +49,7 @@
{-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g \*.sw\?'
'( -H -F)-A[start in Arabic mode]'
'(-A -F)-H[start in Hebrew mode]'
- '(-A -H )-H[start in Farsi mode]'
+ '(-A -H )-F[start in Farsi mode]'
'-T[set terminal type]:::_terminals'
'-u[use given vimrc file instead of default .vimrc]::rc file:_files'
'-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
@@ -54,7 +57,7 @@
'-o-[number of windows to open (default: one for each file)]::window count: '
'-O-[number of windows to vertically split open (default is one for each file)]::window count: '
'-p-[number of tabs to open (default: one for each file)]::tab count: '
- '-q-[quickfix file]:*:file:_vim_files'
+ '(* -t)-q-[quickfix file]:*:file:_vim_files'
'*--cmd[execute given command before loading any RC files]:command: '
'-c[execute given command after loading the first file]:command: '
'-S[source a session file after loading the first file]:session file:_files'
@@ -76,14 +79,22 @@
'--echo-wid[echo window ID on STDOUT, GUI version only]'
'--literal[do not expand wildcards in arguments (this is useless with ZSH)]'
'(- *)--serverlist[list available vim servers and exit]'
- '--servername[name of vim server to send to or name of server to become]:server name: '
+ '--servername[name of vim server to send to or name of server to become]:server name:->server'
'--startuptime[write startup timing messages to given file]:log file:_files'
'--socketid[run GVIM in another window]'
'-i[use given viminfo file instead of default .viminfo]:viminfo file:_files'
'(- *)'{-h,--help}'[print help and exit]'
'(- *)--version[print version information and exit]'
- '(*)-t[edit file where tag is defined]:tag:_complete_tag'
- '(-t)*:file:_vim_files'
+ '(* -q)-t[edit file where tag is defined]:tag:_complete_tag'
+ '(-t -q)*:file:_vim_files'
)
-_arguments -S $arguments
+_arguments -C -S $arguments && return
+
+if [[ "$state" = server ]]; then
+ local -a servers
+ servers=( ${(f)"$(_call_program servers $words[1] --serverlist 2>/dev/null)"} )
+ _wanted servers expl server compadd -M 'm:{a-z}={A-Z}' -a servers && return
+fi
+
+return 1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author