add code action menu and remap to Alt+Enter

This commit is contained in:
Vladan Popovic 2023-07-27 17:40:14 +02:00
parent c16858ffc7
commit 9570523e75
2 changed files with 8 additions and 2 deletions

View file

@ -33,7 +33,8 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<leader>llw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<leader>llw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<leader>lt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap('n', '<leader>lt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<leader>lrn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<leader>lrn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<leader>lca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) buf_set_keymap('n', '<M-CR>', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
if client.server_capabilities.document_formatting then if client.server_capabilities.document_formatting then
@ -140,6 +141,9 @@ nvim_lsp.rust_analyzer.setup({
procMacro = { procMacro = {
enable = true enable = true
}, },
checkOnSave = {
command = "clippy",
},
} }
} }
}) })

View file

@ -3,6 +3,8 @@ return require('packer').startup(function()
-- Packer can manage itself as an optional plugin -- Packer can manage itself as an optional plugin
use {'wbthomason/packer.nvim', opt = true } use {'wbthomason/packer.nvim', opt = true }
use { 'weilbith/nvim-code-action-menu', cmd = 'CodeActionMenu' }
-- Fuzzy finder -- Fuzzy finder
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',