From 0b4999a4b514de568a3aa089d5ed0f6298e5bfbb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 23 Oct 2025 09:26:48 +0200 Subject: [PATCH] docs: added LSP keymap specs to CONTRIBUTING.md --- CONTRIBUTING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d08a3622..cf3e1616 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,3 +29,21 @@ - Every language extra requires a `recommended` section as part of the extra. Check lspconfig server configurations for the proper filetypes and root directories. Refer to other extras for creating the `recommended` section. + +### Language-Specific Keymaps + +- Use `` for language-specific keymaps (follows Vim/Neovim convention for filetype-specific mappings). +- For LSP servers, define keymaps in the server's `keys` field, not in `on_attach`: + ```lua + servers = { + rust_analyzer = { + keys = { + { "e", function() vim.cmd.RustLsp("expandMacro") end, desc = "Expand Macro" }, + } + } + } + ``` +- LazyVim's LSP system will automatically resolve and apply these keymaps (see `lua/lazyvim/plugins/lsp/keymaps.lua`). +- Don't override standard LSP keymaps (like `K` for hover, `gd` for definition) unless absolutely necessary. +- Use standard `c*` keymaps where they make sense (e.g., `co` for organize imports). +- Refer to the R and Haskell extras for examples of proper `` usage.