[audit] fix: use "buf" instead of deprecated "buffer" key in keymap opts - #331
Conversation
vim.keymap.set.Opts renamed "buffer" to "buf" (runtime/doc/deprecated.txt). lsp.lua's BUF constant still used the old name for the two buffer-local LspAttach keymaps (gd, <leader>la). No behavior change, just drops the deprecation warning ahead of it becoming a hard error.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9382861798
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| local blink_ok = pcall(require, "blink.cmp") | ||
| local BUF = "buffer" | ||
| local BUF = "buf" |
There was a problem hiding this comment.
Preserve keymap compatibility with pre-0.12 Neovim
On the pre-0.12 distro installations that this module explicitly supports, vim.keymap.set recognizes only opts.buffer; it forwards the unknown buf option to nvim_set_keymap, which rejects it. Consequently, every LspAttach callback errors before installing the gd and <leader>la mappings or setting formatexpr. Keep buffer until old-version support is dropped, or select the option name based on the Neovim version.
Useful? React with 👍 / 👎.
What
runtime/doc/deprecated.txt(deprecated-0.12section) renames the"buffer"key accepted byvim.keymap.set.Opts/vim.keymap.del.Optsto"buf".lua/config/lsp.lua:8defineslocal BUF = "buffer", which is used as the buffer-local option key for the twoLspAttachkeymaps (gd,<leader>la) at lines 136-137. That's the old, deprecated spelling.Where
lua/config/lsp.lua:8(and its two use sites at:136and:137, unchanged — only the constant's value changes).Why it matters
Confirmed via
runtime/doc/deprecated.txtonneovim/neovimmaster:This is the only place in the repo using the old key —
plugin_config.lua's"buffer"string is an unrelated blink.cmp completion source name, not a keymap opts key (verified via repo-wide grep). Left as-is, this keeps emitting a deprecation warning today and will break once Neovim removes the old key outright, same pattern as the other option/API renames already tracked in #283.Fix
One-line rename of the
BUFconstant from"buffer"to"buf". No behavior change — both spellings currently work identically, this just uses the current name.Generated by Claude Code