fix(cmdatom): <Cmd> mappings #41347

Problem:
`<cmd>` mappings do not emit `CmdAtom.text`.
`<cmd>` and Lua-callback mappings that edit the buffer apply only at the
primary cursor, not cascaded (multicursor).

Solution:
Capture the `<cmd>` command in getcmdkeycmd().
Add kKeyOpaque ("no capturable keys"); narrow kKeySynthetic ("not
a keystroke") to K_EVENT/K_IGNORE, so an opaque mapping's edit still
sets `map_edit` and cascades via LHS-replay.
This commit is contained in:
Justin M. Keyes
2026-08-16 18:00:55 -04:00
committed by GitHub
parent 0e436350a5
commit 581ce0b3da
5 changed files with 55 additions and 19 deletions

View File

@@ -471,7 +471,7 @@ CmdAtom After a user action (an input "atom"): any
|nvim_feedkeys()| (mode "n") to replay. Use
|keytrans()| to key-notation. Empty for
a mapping whose commands have no replayable
keys (|<Cmd>|/Lua commands).
keys (Lua callbacks).
- lhs: LHS (user input). Raw bytes, like `keys`.
- motionforce |forced-motion|: "v", "V", or
"<C-V>" (|key-notation|).
@@ -486,6 +486,7 @@ CmdAtom After a user action (an input "atom"): any
Literal text, not key encoding. Examples:
- typed "iab<Esc>" → text="ab"
- typed ":cnext<CR>" → text="cnext"
- typed "<Cmd>cnext<CR>" → text="cnext"
- typed "iab<Left>c<Esc>" → text="c"
- type: "command", "ex", "insert", "jump",
"mapping", "motion", "mouse", "operator",