summary refs log tree commit diff
path: root/Completion/Unix/Command/_vim
diff options
context:
space:
mode:
authorDoug Kearns <dkearns@users.sourceforge.net>2011-06-16 06:23:32 +0000
committerDoug Kearns <dkearns@users.sourceforge.net>2011-06-16 06:23:32 +0000
commit65f7cbeaed28ff4287bf49627985ae11d4f78d15 (patch)
tree002ab0fe2d6df69e0dc07fc72c3b7acdfe688d28 /Completion/Unix/Command/_vim
parent98b29d02ca17068779f4b8fa2d43c9753386478f (diff)
downloadzsh-65f7cbeaed28ff4287bf49627985ae11d4f78d15.tar.gz
zsh-65f7cbeaed28ff4287bf49627985ae11d4f78d15.tar.xz
zsh-65f7cbeaed28ff4287bf49627985ae11d4f78d15.zip
29483: add --servername completion to _vim
Diffstat (limited to 'Completion/Unix/Command/_vim')
-rw-r--r--Completion/Unix/Command/_vim23
1 files changed, 17 insertions, 6 deletions
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