// VIM-ZSH — ENGINEERING REPORT

Vim / Neovim support for zshrs · standalone zshrs grammar (generated; 137 builtins, 113 extensions, 245 special vars) · zsh files + dotfiles + shebang detection · ALE lint via zshrs -n · vim-lsp / coc via zshrs --lsp

>_EXECUTIVE SUMMARY

vim-zsh is the Vim / Neovim editor support for zshrs — the Rust rewrite of zsh, the first compiled Unix shell. It ships as a standard Vim runtime tree (ftdetect/, syntax/, indent/, ftplugin/, plugin/, doc/), so pathogen / vim-plug / native packages add it to runtimepath with no special handling.

Design principle: the syntax file is a standalone zshrs grammar, not a reskin of Vim's bundled zsh / perl syntax. It is generated (scripts/gen_syntax.sh) directly from the zshrs binary's own reflection tables (zshrs --dump-reflection) — .builtins, .extensions, and .special_vars — so it carries the complete shell surface and never drifts. The filetype is zshrs (not zsh), so Vim's bundled zsh highlighter is never clobbered. Regenerate after a zshrs upgrade.

137
Builtins
113
zshrs extensions
245
Special vars
24+10
Keywords (control + decl)
6
Runtime files
3
Integrations (ALE / vim-lsp / coc)
2
Detection paths (ext + shebang)
0
Config required

~RUNTIME LAYOUT

Standard Vim runtime directories. Each file is loaded automatically when the plugin is on runtimepath; no entry point or sourcing call is required.

FileResponsibility
ftdetect/zshrs.vimSets filetype=zshrs for zsh files (*.zsh …), dotfiles (.zshrc …), and any file whose first line is a zsh / zshrs shebang (e.g. #!/usr/bin/env zsh).
syntax/zshrs.vimStandalone zshrs grammar (generated) — comments / shebang, numbers, sigil variables, strings / here-docs / command substitution, 137 builtins + 113 extensions + 245 special vars + keywords, linked to standard highlight groups.
indent/zshrs.vimStandalone indentexpr (GetZshrsIndent()) — indents after a line opening a block / paren / bracket or a do / then / in, dedents done / fi / esac / closing delimiters.
ftplugin/zshrs.vimBuffer-local options: commentstring=# %s, comments=:#, comment-continuation formatoptions, with a matching b:undo_ftplugin.
plugin/zshrs.vimGlobal wiring: ALE linter definition, vim-lsp server registration, coc snippet (commented), and the g:vim_zsh_no_ale / g:vim_zsh_no_lsp opt-outs, behind a load guard.
doc/zshrs.txtVim help (:help vim-zsh) with tagged sections for install, detection, syntax, linting, LSP, and options.

$SYNTAX COVERAGE

Token categories taken from the zshrs binary's own reflection tables (zshrs --dump-reflection). Builtins exclude the extension and keyword names so the zshrs extensions — the additions that don't exist in upstream zsh — get their own highlight group.

GroupTokens (sample)Highlight link
Declarations (10)declare export float integer let local readonly set shift typesetStorageClass
Control flow (24)if elif else fi for foreach while until do done case esac function select repeat returnStatement
Builtins (137)bindkey cd echo print read setopt unsetopt zmodload zle zstyle autoload bg fg jobsFunction
Extensions (112)async await barrier arch base64 fold — zshrs-specificPreProc
Special variables (245)PATH HOME PWD ZSH_VERSION RANDOM LINENO SECONDS HISTFILEIdentifier
Literals & varssigils ($name / ${...}), positional / punctuation specials ($1 $# $@ $? $! $$ $*), strings, here-docs, $(...) / backtick command substitution, numbersString / Number / Identifier

#TOOLING INTEGRATION

All three integrations degrade gracefully: each is guarded so the plugin loads cleanly whether or not ALE / vim-lsp / coc is installed. CLI flags verified against zshrs --help (v0.12.1).

IntegrationMechanism
ALERegisters a linter via ale#linter#Define running zshrs -n over the buffer (stdin); the handler parses zsh: <reason> / zsh: parse error near … stderr lines into error items. Skipped if ALE is absent or g:vim_zsh_no_ale is set.
vim-lspRegisters a server (lsp#register_server) running zshrs --lsp, allowlisted for the zshrs and zsh filetypes. Skipped if vim-lsp is absent or g:vim_zsh_no_lsp is set.
coc.nvimA ready-to-paste languageserver block for coc-settings.json using zshrs --lsp, documented in the plugin source and README.

@COMPATIBILITY

TargetStatus
Vim 8+Filetype, syntax, indent, ftplugin, doc
NeovimSame runtime files (no Lua required)
pathogen / vim-plug / native packagesStandard runtime layout — no plugin-manager-specific handling
ALEzshrs -n linter
vim-lspzshrs --lsp server
coc.nvimlanguageserver config provided