-
Notifications
You must be signed in to change notification settings - Fork 452
feat(fff-nvim): support user-defined picker input mappings #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -462,6 +462,13 @@ function M.setup_keymaps() | |
| set_keymap('n', keymaps.send_to_quickfix, P.send_to_quickfix, preview_opts) | ||
| end | ||
|
|
||
| -- Applied last so a user mapping wins over the built-in on the same lhs. | ||
| for mode, maps in pairs(S.config.mappings or {}) do | ||
| for lhs, rhs in pairs(maps) do | ||
| set_keymap(mode, lhs, rhs, input_opts) | ||
|
Comment on lines
+466
to
+468
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Validate user mappings before iterating.
As per coding guidelines, use 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| end | ||
| end | ||
|
|
||
| vim.api.nvim_buf_attach(S.input_buf, false, { | ||
| on_lines = function() | ||
| vim.schedule(function() P.on_input_change() end) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: dmtrKovalenko/fff
Length of output: 50375
🏁 Script executed:
Repository: dmtrKovalenko/fff
Length of output: 23176
🌐 Web query:
Neovim vim.keymap.set invalid mode accepted error supported modes documentation💡 Result:
In Neovim,
vim.keymap.setaccepts the same mode "short-name" strings asvim.api.nvim_set_keymap[1][2]. If you encounter an error regarding an invalid mode, it is typically because the string provided does not match the valid single-character identifiers or their recognized combinations [2][3]. The supported mode short-names are [2][4][3]: - n: Normal mode - i: Insert mode - v: Visual mode (includes Select mode) - x: Visual mode (Visual-only) - s: Select mode - o: Operator-pending mode - c: Command-line mode - t: Terminal mode -!: Insert and Command-line mode (equivalent to:map!) You can pass a single mode string (e.g., 'n') or a list/table of multiple modes (e.g., {'n', 'v'}) to define a mapping for several modes at once [1][2][5]. Note thatvim.keymap.setdoes not support the empty string ('') to represent "all modes" (nvo) in the same way the legacy:mapcommand does [6]. If you need to map across multiple modes, explicitly provide the list of modes in a table [2][5]. If you are receiving a validation error, ensure: 1. You are passing a string or a table of strings [1]. 2. You are not using deprecated or unsupported shorthand abbreviations that might be interpreted as invalid mode characters [1][3]. 3. For abbreviations (like 'ia', 'ca', or '!a'), refer to:help nvim_set_keymapto confirm the specific support for your Neovim version, as these are distinct from standard key mappings [4][3]. For comprehensive information on mapping modes, you can consult Neovim's built-in help by running:help map-modesor:help nvim_set_keymapwithin your Neovim instance [4][3].Citations:
vim.keymap.setlacks an equivalent to:map(nvo modes) neovim/neovim#17138Reject unsupported mapping modes.
sanitize_mappingsaccepts any string mode, andset_keymappasses it directly tovim.keymap.set. Invalid modes such asbogusabort picker creation. Restrict modes to those supported by Neovim.🤖 Prompt for AI Agents