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

PATCH: update completion for vim 8.0



Actually vim 8 doesn't seem to change much in terms of command-line
arguments. Just --not-a-term. Most of this patch is applicable to 7.4:
-V can also take a filename for the verbose output. Also updated is
completion for xxd which typically comes with vim. xxd -v has reported
an unchanged version number for a long time but there are a few
new options since _xxd was last updated.

Oliver

diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index dbc946c..9fd2d63 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -13,7 +13,7 @@ _vim_files () {
   esac
 }
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
 local arguments
@@ -30,16 +30,7 @@ arguments=(
   '-C[start in compatible mode]'
   '-N[start in incompatible mode]'
   '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]'
-  '-V-[verbosity level]::verbosity:((0\:"do not display any messages"
-                                     1\:"display when viminfo file is read or written"
-                                     2\:"display sourced files"
-                                     5\:"display every searched tag-file"
-                                     8\:"display files that trigger autocommands"
-                                     9\:"display every triggered autocommand (default)"
-                                    12\:"display every executed function"
-                                    13\:"report every thrown, caught, finished, or discarded exception"
-                                    14\:"display anything pending in a \:finally clause"
-                                    15\:"display every executed ex-command"))'
+  '-V-[verbosity level]::verbosity [10]:->verbosity'
   '-D[debugging mode]'
   '-n[no swap file (memory only)]'
   '-nb[start as NetBean server]'
@@ -48,8 +39,9 @@ arguments=(
   '(-A    -F)-H[start in Hebrew mode]'
   '(-A -H   )-F[start in Farsi mode]'
   '-T[set terminal type]:::_terminals'
+  '--not-a-term[skip warning for input/output not being a terminal]'
   '-u[use given vimrc file instead of default .vimrc]::rc file:_files'
-  '--noplugin[do not load plugin scripts]'
+  "--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: '
   '-p-[number of tabs to open (default: one for each file)]::tab count: '
@@ -77,7 +69,7 @@ arguments=(
   '--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'
+  '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files'
   '(- *)'{-h,--help}'[print help and exit]'
   '(- *)--version[print version information and exit]'
   '(* -q)-t[edit file where tag is defined]:tag:_complete_tag'
@@ -98,12 +90,33 @@ arguments=(
   '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
 )
 
-_arguments -C -S $arguments && return
+_arguments -C -S $arguments && ret=0
 
 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
+  _wanted servers expl server compadd -M 'm:{a-z}={A-Z}' -a servers && ret=0
+elif [[ $state = verbosity ]]; then
+  _tags numbers files
+  while _tags; do
+    _requested numbers && _describe 'verbosity [10]' "(
+      0:don\'t' display any messages'
+      1:'display when viminfo file is read or written'
+      2:'display sourced files'
+      5:'display every searched tag-file'
+      8:'display files that trigger autocommands'
+      9:'display every triggered autocommand'
+      12:'display every executed function'
+      13:'report every thrown, caught, finished, or discarded exception'
+      14:'display anything pending in a :finally clause'
+      15:'display every executed ex-command'
+    )" && ret=0
+    if _requested files expl 'file for verbose output'; then
+      compset -P '[0-9]#'
+      _files "$expl[@]" && ret=0
+    fi
+    (( ret )) || break
+  done
 fi
 
-return 1
+return ret
diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd
index 1a82255..1b1613a 100644
--- a/Completion/Unix/Command/_xxd
+++ b/Completion/Unix/Command/_xxd
@@ -22,21 +22,23 @@ local arguments
 
 arguments=(
   # output options
-  '(-b -bits            -i -include -p -postscript -plain -ps -r -reverse -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]'
-  '(         -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse              )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]'
-  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse              )'{-i,-include}'[output in C include file style]'
-  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps                          )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]'
+  '(-b -bits            -i -include -p -postscript -plain -ps -r -revert -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]'
+  '(         -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert              )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]'
+  '(-i -include -p -postscript -plain -ps -r -revert)'{-e,-endian}'[little-endian dump]'
+  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert              )'{-i,-include}'[output in C include file style]'
+  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps                         )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]'
 
-  '(-b -bits -E -EBCDIC -i -include                           -r -reverse -u -uppercase)'{-r,-reverse}'[reverse mode\: read a hex dump and output binary data]'
-  '(-b -bits                                                  -r -reverse -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]'
+  '(-b -bits -E -EBCDIC -i -include                           -r -revert -u -uppercase)'{-r,-revert}'[reverse mode\: read a hex dump and output binary data]'
+  '(-b -bits                                                  -r -revert -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]'
 
-  {-h,-help}'[display usage message]'
-  {-v,-version}'[show program version]'
+  '(- :)'{-h,-help}'[display usage message]'
+  '(- :)'{-v,-version}'[show program version]'
   '*'{-a,-autoskip}"[a single '*' replaces runs of NUL (toggleable)]"
 
   {-c+,-cols}'[specify number of octets per line]: :_guard "[0-9a-fA-Fx]#" "number of octets per line"'
   {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"'
   {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"'
+  {-o+,-offset}'[add specified offset to displayed file position]:offset'
   {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"'
 
   ':files:_files'



Messages sorted by: Reverse Date, Date, Thread, Author