From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7060 invoked by alias); 16 Jun 2011 06:17:11 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29483 Received: (qmail 42 invoked from network); 16 Jun 2011 06:17:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.210.171 as permitted sender) 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= Date: Thu, 16 Jun 2011 16:16:30 +1000 From: Doug Kearns To: zsh-workers@zsh.org Subject: PATCH: add --servername completion to _vim Message-ID: <20110616061624.GA11582@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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