commit 535c2f8658c4ace04807c578bebf741597dcb467
parent 3e3775961fd231ab7cf1e8c67bb28249f720333c
Author: Matthieu Coudron <886074+teto@users.noreply.github.com>
Date: Sun, 16 Mar 2025 18:15:00 +0100
build(contrib): add zsh completion (#32617)
* build(contrib): add zsh completion
this is not part of the build system yet, so packager managers are
supposed to install the file by themselves.
bash doesn't seem to provide shell completion, zsh embeds its own
completion that is bundled with vim's.
Instead of copying zsh's completion, this generated one via
https://github.com/RobSis/zsh-completion-generator
---------
Co-authored-by: Eisuke Kawashima <e.kawaschima+github@gmail.com>
Diffstat:
1 file changed, 36 insertions(+), 0 deletions(-)
diff --git a/contrib/zsh-completion.zsh b/contrib/zsh-completion.zsh
@@ -0,0 +1,36 @@
+#compdef nvim
+
+# zsh completions for 'nvim'
+# automatically generated with http://github.com/RobSis/zsh-completion-generator
+local arguments
+
+arguments=(
+ '*--cmd[execute <cmd> before any config]:command'
+ '*-c[Execute <cmd> after config and first file]:command'
+ '-l[Execute Lua <script> (with optional args)]:script:_files -g "*.lua"' # TODO: remaining args are passed to <script> and not opened by nvim for edit
+ '-S[source <session> after loading the first file]::session:_files'
+ '-s[read Normal mode commands from <scriptin>]:file:_files'
+ '-u[use this config file]:config'
+ '-d[diff mode]'
+ {-es,-Es}'[silent (batch) mode]'
+ '(- *)'{-h,--help}'[print this help message]'
+ '-i[use this shada file]:shada:_files -g "*.shada"'
+ '-n[no swap file, use memory only]'
+ '-o-[open N windows (default: one per file)]::N'
+ '-O-[open N vertical windows (default: one per file)]::N'
+ '-p-[open N tab pages (default: one per file)]::N'
+ '-R[read-only (view) mode]'
+ '(- *)'{-v,--version}'[print version information]'
+ '-V[verbose \[level\]\[file\]]'
+ '(- *)--api-info[write msgpack-encoded API metadata to stdout]'
+ '--clean["Factory defaults" (skip user config and plugins, shada)]'
+ '--embed[use stdin/stdout as a msgpack-rpc channel]'
+ '--headless[dont start a user interface]'
+ '--listen[serve RPC API from this address]:address'
+ '--remote[\[-subcommand\] Execute commands remotely on a server]'
+ '--server[connect to this Nvim server]:address'
+ '--startuptime[write startup timing messages to <file>]:file:_files'
+ '*:filename:_files'
+)
+
+_arguments -s $arguments