-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
[BUG] keymaps: mapping telescope's undo extension breaks custom keymaps #1493
Comments
I can't see how the keymap code could lead to one keymap effecting others... nixvim/plugins/telescope/default.nix Lines 76 to 90 in 40598fc
So this is a bit of a head scratchier 🤔 Is there anything suspicious in the generated Using nix repl, is there anything suspicious when you inspect the resolved config options All the telescope keymaps should get added to the "main" keymaps options, with their |
Here are the generated files: generated-inits.zip. Here's the result of running $ diff generated-broken-init.lua generated-working-init.lua
57,62d56
< {
< ["action"] = require("telescope.builtin").fdsafsda,
< ["key"] = "<leader>fu",
< ["mode"] = "n",
< ["options"] = { ["desc"] = "Telescope Undo" },
< }, The only difference between the inputs is that the problematic line is uncommented. It turns out it doesn't matter what the action it gets bound to. Here, I'm binding it to It might also be worth noting the error that is generated by neovim when the MRE is loaded with the problematic line uncommented. Error detected while processing /nix/store/fqx9ngcpbvz390804l1nav113iwql4xf-init.lua:
E5113: Error while calling lua chunk: vim/keymap.lua:0: rhs: expected string|function, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/keymap.lua: in function 'set'
/nix/store/fqx9ngcpbvz390804l1nav113iwql4xf-init.lua:68: in main chunk |
That's saying the keymap's "right hand side" (action) should be a string or a lua function. Instead it was That's the expected result for Undo is not a telescope built-in (it's a 3rd party extension), so it won't be present in The extension's readme suggests it can be involved as follows: " Directly by calling it through Telescope's extension interface:
" using lua
:lua require("telescope").extensions.undo.undo()
" using custom options for just this call
:lua require("telescope").extensions.undo.undo({ side_by_side = true })
" using legacy Vim script
:Telescope undo
" Using the optional mapping:
" using lua
:lua vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>")
" using legacy Vim script
:nmap <leader>u <cmd>Telescope undo<cr> So, in this case the action should be "<leader>fu" = {
action.__raw = "require("telescope").extensions.undo.undo";
options.desc = "Telescope Undo";
}; @GaetanLepage should we be using |
Thanks @MattSturgeon for the precise troubleshooting on this.
Hmm, are the "builtin" actions also part of |
Not sure, but even if they are it appears the actual functions are nested in the table; e.g. I think |
telescope
63c3a29ca82437c87573e4c6919b09a24ea61b0f
9036fe9ef8e15a819fa76f47a8b1f287903fb848
Description
Binding a key to Telescope's
undo
plugin causes custom keymaps to stop working.Minimal, Reproducible Example
Steps to reproduce
gh
,yu
,<leader>g
)<leader>ff
and the othertelescope.keymaps
options work (as they should)telescope.keymaps
options still workit took me 2 days to find this 😭
The text was updated successfully, but these errors were encountered: