From 65f7cbeaed28ff4287bf49627985ae11d4f78d15 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 16 Jun 2011 06:23:32 +0000 Subject: 29483: add --servername completion to _vim --- Completion/Unix/Command/_vim | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Completion/Unix/Command/_vim') diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index af5afd347..7aec1ecf7 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -12,6 +12,9 @@ _vim_files () { esac } +local curcontext="$curcontext" state line expl +typeset -A opt_args + local arguments arguments=( @@ -46,7 +49,7 @@ arguments=( {-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 @@ arguments=( '-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 @@ arguments=( '--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 -- cgit 1.4.1