diff --git a/candy/lua/marshmallow/lsp.lua b/candy/lua/marshmallow/lsp.lua index c7b0998..d91d5d9 100644 --- a/candy/lua/marshmallow/lsp.lua +++ b/candy/lua/marshmallow/lsp.lua @@ -10,20 +10,6 @@ vim.api.nvim_create_autocmd("LspAttach", { vim.lsp.inlay_hint.enable(true, { bufnr = bufnr, }) - - local opts = { noremap = true, silent = true } - vim.keymap.set("n", "E", vim.diagnostic.open_float, opts) - vim.keymap.set( - "n", - "q", - vim.diagnostic.setloclist, - { noremap = true, silent = true, desc = "Add diagnostics to list" } - ) - - local bufopts = { noremap = true, silent = true, buffer = bufnr } - - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) end, }) diff --git a/candy/lua/marshmallow/remap.lua b/candy/lua/marshmallow/remap.lua index b7684f9..133d393 100644 --- a/candy/lua/marshmallow/remap.lua +++ b/candy/lua/marshmallow/remap.lua @@ -1,3 +1,5 @@ +local GROUP = vim.api.nvim_create_augroup("marsh-keymap", {}) + -- require("which-key").setup({}) local miniclue = require("mini.clue") miniclue.setup({ @@ -215,3 +217,25 @@ _G.cr_action = function() end vim.keymap.set("i", "", "v:lua._G.cr_action()", { expr = true }) + +-- Lsp -- +vim.api.nvim_create_autocmd("LspAttach", { + group = GROUP, + callback = function(ev) + local bufnr = ev.buf + + local opts = { noremap = true, silent = true } + vim.keymap.set("n", "E", vim.diagnostic.open_float, opts) + vim.keymap.set( + "n", + "q", + vim.diagnostic.setloclist, + { noremap = true, silent = true, desc = "Add diagnostics to list" } + ) + + local bufopts = { noremap = true, silent = true, buffer = bufnr } + + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) + end, +})