Skip to content

[audit] Fix DescribeKey clobbering @a register#260

Merged
stanfish06 merged 1 commit into
masterfrom
claude/festive-goodall-91cirg
Jul 6, 2026
Merged

[audit] Fix DescribeKey clobbering @a register#260
stanfish06 merged 1 commit into
masterfrom
claude/festive-goodall-91cirg

Conversation

@stanfish06

Copy link
Copy Markdown
Owner

What

DescribeKey (options.lua:149–151) dumps the output of :map into register @a via redir, then yanks it into a new buffer. Any text previously in @a (e.g. a word yanked with yiw) is silently destroyed.

Where

lua/config/options.lua:150

-- before
vim.cmd("redir @a | silent map | redir END | new | put a")

-- after
local output = vim.fn.execute("map")
vim.cmd("new")
vim.api.nvim_buf_set_lines(0, 0, -1, false, vim.split(output, "\n"))

Why it matters

vim.fn.execute() captures command output as a Lua string without touching any register. The resulting buffer is populated via nvim_buf_set_lines, which is equivalent to the old put a but register-safe. No behavioral change to the user-visible result.

Recommended action

Already applied in this PR. No other changes.


Generated by Claude Code

Use vim.fn.execute() to capture :map output into a string instead of
redirecting to register @A, which would silently overwrite whatever the
user had yanked there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAkUW53kMHdfTNifKknKuZ
@stanfish06 stanfish06 merged commit b047810 into master Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants