Added
vim.vnamespace — Neovim-compatible predefined variables — read-only metatable proxy exposingvim.v.count,vim.v.count1,vim.v.register,vim.v.operator(Tier 1),vim.v.searchforward(read/write),vim.v.insertmode,vim.v.numbermax/numbermin/numbersize,vim.v.true/false/null(Tier 2), andvim.v.foldstart/foldend/foldlevel/folddashes,vim.v.lnum/relnum/virtnum,vim.v.char,vim.v.hlsearch,vim.v.event(Tier 3 — context-dependent). Context is set fromactionArgsbefore each keymap callback invocation and cleared after.vim.v.eventis populated during autocmd dispatch with the event data table.vim.v.hlsearchqueries the fork's search overlay state viagetSearchState(cm).getOverlay().- Plugin:
src/lua/api.ts(VimVContext,setVimVContext,clearVimVContext, vim.v metatable, autocmd vim.v.event wiring),src/lua/loader.ts(getVimApi,getSearchForward,setSearchForward,getHlSearchcallbacks),src/types/vim-api.d.ts(ActionArgsextended,feedKeysandgetOverlayadded toVimApi),src/lua/engine.ts(EXPR_INSTRUCTION_LIMIT)
- Plugin:
{ expr = true }keymap support —vim.keymap.setnow accepts{ expr = true }for function callbacks. The callback must return a string that is fed as keystrokes via the fork's newfeedKeysAPI. Sync-only — async APIs cannot be used in expr callbacks. String expr (Vimscript evaluation) is not supported with a helpful error guiding users to the function form. Recursion guard (200 depth, matching Neovim) prevents infinite expr → feedKeys → expr loops.- Fork:
~/Repos/codemirror-vim/src/vim.js(feedKeysmethod on VimApi — delegates todoKeyToKeywith noremap flag and recursion protection) - Plugin:
src/lua/api.ts(expr callback path withlua_pcall(state, 0, 1, 0), return value capture,feedKeysinvocation)
- Fork:
Tests
- 55 unit tests in
test/unit/lua/vim-v.test.ts: Tier 1 defaults and context (count, count1, register, operator), read-only enforcement, Tier 2 constants (numbermax/min/size, true/false/null), searchforward (callback read/write), insertmode, Tier 3 fold/statuscolumn/event/char variables, hlsearch callback (read from getHlSearch, fallback to context), vim.v.event in autocmd context (multi-field, nested data), expr mapping registration, unknown keys - 8 e2e tests in
test/specs/lua-vim-v.e2e.ts:vim.v.countandvim.v.count1with and without typed counts,vim.v.eventpopulated during InsertEnter/InsertLeave autocmds,vim.v.hlsearchreturns 1 after/search and 0 after:nohlsearch - 7 e2e tests in
test/specs/lua-expr-mapping.e2e.ts: expr returns executed keys, expr with count, nil/empty return, error handling, string expr error, special keys
Documentation
CHANGELOG.mdKNOWN_LIMITATIONS.md: Added expr mapping limitations (string expr, async expr, operator-pending, count forwarding) and vim.v limitations (async callback reliability, outside-callback behavior)docs/configuration/lua-config.md: Addedvim.vsection with all variable tables, expr mapping examples, and updatedvim.keymap.setoptions table withexprdocumentationREADME.md: Updated Lua configuration feature description withvim.vand expr mappingsCONTRIBUTING.md: Updatedapi.tsdescription with vim.v namespace and expr mapping supportAGENTS.md: Updated codemirror-vim fork description withfeedKeysAPI, updated Lua API list withvim.v(20 variables including event/hlsearch)
Full Changelog: 0.78.0...0.79.0