about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2018-05-03 12:26:18 +0200
committerDaniel Hahler <git@thequod.de>2018-06-27 15:38:59 +0200
commit3964c63d02638b60d337fdb119212c29ede19084 (patch)
tree64f9cbcfbe96551855a8351513bad0ccea73eaa2
parent968cf17b2bb4d1dbed435fd57437ef8a8cb15841 (diff)
downloadzsh-3964c63d02638b60d337fdb119212c29ede19084.tar.gz
zsh-3964c63d02638b60d337fdb119212c29ede19084.tar.xz
zsh-3964c63d02638b60d337fdb119212c29ede19084.zip
42746: _vim: handle special values for -u/-U
This is based on state=verbosity from the same file.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_vim21
2 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 30369f08e..26f0d882e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-27  Daniel Hahler  <zsh@thequod.de>
+
+	* 42746: Completion/Unix/Command/_vim: _vim: handle special values for
+	-u/-U.
+
 2018-06-27  Eric Cook  <llua@gmx.com>
 
 	* 43096: Eitan: Completion/Unix/Command/_vim, remove duplicate flag
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 9f2eacb1f..8853fac30 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -41,7 +41,7 @@ arguments=(
   '-T[set terminal type]:::_terminals'
   '--not-a-term[skip warning for input/output not being a terminal]'
   '--ttyfail[exit if input or output is not a terminal]'
-  '-u[use given vimrc file instead of default .vimrc]::rc file:_files'
+  '-u[use given vimrc file instead of default .vimrc]:config:->config'
   "--noplugin[don't load plugin scripts]"
   '-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: '
@@ -89,7 +89,7 @@ arguments=(
   '--role[set unique role to identify main window]:role'
   '--socketid[open vim inside another GTK widget]:xid'
   '--echo-wid[echo window ID on stdout]'
-  '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
+  '-U[use given gvimrc file instead of default .gvimrc]:gui config:->configgui'
 )
 
 _arguments -C -S $arguments && ret=0
@@ -119,6 +119,23 @@ elif [[ $state = verbosity ]]; then
     fi
     (( ret )) || break
   done
+elif [[ "$state" = config* ]]; then
+  _tags special files
+  local names=(
+      "NONE:'skip initialization from files and environment variables'"
+      "NORC:'same as NONE, but load plugins'"
+  )
+  # gvim only supports -U NONE to skip GUI initialization.
+  [[ $state != configgui || $service != *g* ]] && names+=(
+      "DEFAULTS:'same as NONE, but loads defaults.vim'"
+  )
+  while _tags; do
+    _requested special && _describe -V 'special' "(${(F)names})" && ret=0
+    if _requested files expl 'rc file'; then
+      _files "$expl[@]" && ret=0
+    fi
+    (( ret )) || break
+  done
 fi
 
 return ret