Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: add --servername completion to _vim



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