diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 17fcaa1..89deb89 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -35,6 +35,7 @@ with final.pkgs.lib; let # nvim-cmp (autocompletion) and extensions nvim-cmp # https://github.com/hrsh7th/nvim-cmp + actions-preview-nvim # LSP code actions | https://github.com/aznhe21/actions-preview.nvim nvim-autopairs # Automatically create closing brackets | https://github.com/windwp/nvim-autopairs cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/ lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/ diff --git a/nvim/plugin/autocommands.lua b/nvim/plugin/autocommands.lua index ede9b77..b3a3e58 100644 --- a/nvim/plugin/autocommands.lua +++ b/nvim/plugin/autocommands.lua @@ -84,39 +84,12 @@ vim.api.nvim_create_autocmd('LspAttach', { keymap.set('n', '', vim.lsp.buf.code_action, { desc = '[lsp] code action' }) keymap.set('n', '', vim.lsp.codelens.run, { desc = '[lsp] run code lens' }) keymap.set('n', 'gr', vim.lsp.buf.references, { desc = 'lsp [g]et [r]eferences' }) - --[[ wk.register({ - l = { - name = "[l]sp", - g = { - name = "[g]o to", - t = { "vim.lsp.buf.type_definition", '[l]sp [g]o to [t]ype definition' }, - }, - p = { - name = "[p]eek", - d = { peek_definition, '[l]sp [p]eek [d]efinition' }, - t = { peek_type_definition, '[l]sp [p]eek [t]ype definition' }, - }, - - w = { - name = "[w]orkspace", - a = { "vim.lsp.buf.add_workspace_folder", '[l]sp add [w]orksp[a]ce folder' }, - r = { "vim.lsp.buf.remove_workspace_folder", '[l]sp [w]orkspace folder [r]emove' }, - l = { function() vim.print(vim.lsp.buf.list_workspace_folders()) end, '[l]sp [w]orkspace folders [l]ist' }, - q = { "vim.lsp.buf.workspace_symbol", '[l]sp [w]orkspace symbol [q]' }, - }, - - r = { "vim.lsp.buf.rename", '[l]sp [r]ename' }, - d = { "vim.lsp.buf.document_symbol", '[l]sp [d]ocument symbol' }, - R = { "vim.lsp.codelens.refresh", '[l]sp code lenses [R]efresh' }, - f = { function() vim.lsp.buf.format { async = true } end, '[l]sp [f]ormat buffer' }, - }, - }, { prefix = "" }) ]] wk.add({ { "l", group = "[l]sp" }, { "lR", "vim.lsp.codelens.refresh", desc = "[l]sp code lenses [R]efresh" }, { "ld", "vim.lsp.buf.document_symbol", desc = "[l]sp [d]ocument symbol" }, - { "lf", function() vim.lsp.buf.format { async = true } end, desc = "[l]sp [f]ormat buffer" }, + { "lF", function() vim.lsp.buf.format { async = true } end, desc = "[l]sp [F]ormat buffer" }, { "lg", group = "[g]o to" }, { "lgt", "vim.lsp.buf.type_definition", desc = "[l]sp [g]o to [t]ype definition" }, { "lp", group = "[p]eek" }, diff --git a/nvim/plugin/keymaps.lua b/nvim/plugin/keymaps.lua index 16e3724..91840cf 100644 --- a/nvim/plugin/keymaps.lua +++ b/nvim/plugin/keymaps.lua @@ -35,6 +35,8 @@ local function toggle_qf_list() end keymap.set('n', '', toggle_qf_list, { desc = 'toggle quickfix list' }) +keymap.set({ "v", "n" }, "gf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'}) +keymap.set({ "v", "n" }, "lf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'}) local function try_fallback_notify(opts) local success, _ = pcall(opts.try)