Turning off default nvf keymaps #1043
Replies: 5 comments 4 replies
-
|
Would be nice if, at the very least, lsp used the default bindings introduced in (0.11? 0.10?). I think nvf should be as default as possible |
Beta Was this translation helpful? Give feedback.
-
|
I have also been annoyed by the dual occurrences of key binds in nix-repl> lib.nvim.lua.toLuaObject { something = null; }
"{}"and in the pluginRC.lsp-setup = ''
local attach_keymaps = function(client, bufnr)
${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration"}
${mkBinding mappings.goToDefinition "vim.lsp.buf.definition"}
${mkBinding mappings.goToType "vim.lsp.buf.type_definition"}
${mkBinding mappings.listImplementations "vim.lsp.buf.implementation"}
${mkBinding mappings.listReferences "vim.lsp.buf.references"}
${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next"}
${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev"}
${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float"}
${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight"}
${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol"}
${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder"}
${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder"}
${mkBinding mappings.listWorkspaceFolders "function() vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders())) end"}
${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol"}
${mkBinding mappings.hover "vim.lsp.buf.hover"}
${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help"}
${mkBinding mappings.renameSymbol "vim.lsp.buf.rename"}
${mkBinding mappings.codeAction "vim.lsp.buf.code_action"}
${mkBinding mappings.format "vim.lsp.buf.format"}
${mkBinding mappings.toggleFormatOnSave "function() vim.b.disableFormatSave = not vim.b.disableFormatSave end"}
end
'';and these key binds, unless you know to look for them, are the ones that appear seemingly out of nowhere just via enabling plugins. I think that is the source of most of the unexpected keybindings. anywayyyyyssss I promise I didn't just reply here to complain XD I am willing to write a PR to start working on improving and organizing this keybindings issue, and maybe implement a better mechanism or a different way of handling plugin keybinds if we come up with anything like that. But I basically wanted to reply here to start a conversation ab this and maybe figure out what direction to take and get some ideas going because on my own starting a PR for this seems daunting not in difficulty of the problem but in terms of knowing that my personal ideal solution is probably not what works best for all users of nvf or also the maintainers and so I guess I want to get some clarity before I go making drastic changes. @NotAShelf I hope it isn't considered a faux pas to ping u like this but I know you would have some thoughts and I definitely want your opinion before I attempt anything like this. or if it's even something I should attempt at all since maybe someone else or yourself is working on something to a similar end or whatever it may be. <3 |
Beta Was this translation helpful? Give feedback.
-
|
Also as a temporary workaround, you can use this to easily set them all to null for a given vim.lsp.mappings = lib.mapAttrs (_: _: null) config.vim.lsp.mappings;this is what I am doing in the instance that I ran into this problem in my own config. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry for the late response, it's one of those times that I formulate a reply in my mind, fool myself by thinking I sent it, and then forget about the reply amidst the chaos of everything going on. The LSP related keybinds are a relic from an earlier version of nvf, which is when it was closer to the project it was forked from. In v0.6 the keybind system was improved, but some things were left over. Although I would love for a keybind system that doesn't suck, it is currently one of the weak links that I am hoping to change. It is just that the current release focuses on the API changes in 0.8 and better structuring the language module system that was yet another weak link.
This is one of the ways you can do it, but it's a workaround and a hack rather than a real solution. A PR was opened but we agreed to continue at a later with a more robust solution. Due to time constraints, it was postponed for the time being.
A PR would be very welcome. We're currently in a tight position for the v0.8 release (alongside similar release windows for other projects that I maintain) so most of my free time goes to ensuring the active releases go smoothly. If you would like to propose a system, I'm sure we can discuss it altogether with maintainers and users previously annoyed by the current mechanism.
You are welcome to ping me any time. You are invited even, because I sometimes don't get notified of incoming issues/PRs at all or I tend to forget. In short please feel free to ping me. |
Beta Was this translation helpful? Give feedback.
-
|
+1 to this. I personally really struggle with configuring my bindings in nvf, due to there being so many things registered under In my old configs, I always had one lua table for all my bindings under having it full of so many things I don't want, really is a lot of extra config work, especially as even with: vim.lsp.mappings = lib.mapAttrs (_: _: null) config.vim.lsp.mappings;I would still need to find for all the plugins and everything where their mapping is configured. now that I'm writing this, I guess I could just do that with some custom startup lua, but that of course would also bee less in the spirit of nvf and nix in general. I personally think a big problem of the current approach is, that the key map is not 100% centralized. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The README says:
And, yet, this is the third time that I'm annoyed by defaults :D.
The first was #746.
Then with
blink-cmp.And now, after
vim.lsp.enable = trueand[user@hostname:~]$ nvf-print-config, I find that there are a bunch of LSP-related default keymaps that I don't want:How can I easily turn them all off? That way I would not be annoyed by turning each and every single one of them off :D.
Beta Was this translation helpful? Give feedback.
All reactions