diff --git a/data/nvim/init.lua b/data/nvim/init.lua index 157299b..6dab440 100644 --- a/data/nvim/init.lua +++ b/data/nvim/init.lua @@ -578,19 +578,10 @@ require("lazy").setup({ local opts = { buffer = ev.buf } vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) vim.keymap.set("n", "", vim.lsp.buf.rename, opts) - vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - end, - }) - - -- Custom - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - pattern = "*.go", - callback = function() - -- Format without async then code action - -- https://github.com/neovim/neovim/issues/24168 - vim.lsp.buf.format() - vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" } }, apply = true }) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "ci", function() + vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" } }, apply = true }) + end, opts) end, }) end,