>_EXECUTIVE SUMMARY
emacs-viml is the Emacs major mode for VimL (Vimscript), targeting the vimlrs standalone interpreter — a Rust port of Neovim's eval engine on fusevm. vimlrs-mode derives from prog-mode and provides font-lock, a syntax table, block-keyword-aware indentation, filetype detection, a buffer runner (vimlrs FILE via compile), eldoc + completion for builtin functions, and an LSP client that launches vimlrs --lsp.
Design principle: the highlighted surface is VimL's actual surface as the interpreter accepts it — statement keywords, ex commands, scope-namespaced variables, special v: variables, built-in functions, and function definitions. Because vimlrs ports a fixed finite builtin set (unlike the sibling stryke with its ~10,450 generated builtins), the lists are plain regexp-opt alternations in vimlrs-mode.el; no generated hash-table stdlib is required. The mode is named vimlrs-mode so it never clashes with Emacs' built-in vimrc-mode.
~WHY NO GENERATED STDLIB
The sibling emacs-stryke generates a 170 KB stryke-stdlib.el of hash tables because a single regexp-opt over stryke's ~10,450 builtins overflows Emacs' regexp compiler (invalid-regexp "Regular expression too big"). VimL as ported by vimlrs has no such problem: its surface is fixed — 34 statement keywords, 29 ex commands, 18 special v: variables, and 94 built-in functions — comfortably within the regexp-size limit. So vimlrs-mode.el uses plain regexp-opt alternations, and vimlrs-stdlib.el holds only the hand-authored builtin-function signatures used for eldoc and completion-at-point. The command-position " comment (which the in-expression double-quoted string must not be mistaken for) is resolved with a syntax-propertize rule that only fires at line start or after a | bar.
| Component | Detail |
|---|---|
vimlrs-mode.el | Major mode — syntax table ("/' strings, : in scope symbols, command-position " comments), font-lock keyword lists, "-comment syntax-propertize, vimlrs-indent-line, vimlrs-run-buffer (C-c C-c), eldoc + completion, eglot + lsp-mode registration, auto-mode-alist + interpreter-mode-alist. |
vimlrs-stdlib.el | Hand-authored builtin-function signatures (the subset of Vim's funcs.c that vimlrs ports) for eldoc and completion. Byte-compiles cleanly; loads instantly. |
scripts/face-test.el | Fontify a sample buffer and assert the face at each probe token. |
vimlrs --lsp | Launched with only --lsp; an appended --stdio is rejected by the binary, so neither client adds one. |
$VERIFICATION
CI byte-compiles the package with byte-compile-error-on-warn (warnings are errors) and runs the batch face test. Each probe asserts the actual face text-property after font-lock-ensure.
| Sample token | Asserted face |
|---|---|
set / let / function / for / if / return / echo / call / augroup / autocmd | font-lock-keyword-face |
g:plugin_loaded / s:total | vimlrs-scope-var-face |
v:true / v:count | vimlrs-special-var-face |
has_key | font-lock-builtin-face |
Summarize (user function name) | font-lock-function-name-face |
| single-quoted string | font-lock-string-face |
command-position " comment | font-lock-comment-face |