Integrate neovim config into home-manager, separate external configs under config/
This commit is contained in:
46
config/nvim/lua/eliaskohout-old/after/plugin/lspattach.lua
Executable file
46
config/nvim/lua/eliaskohout-old/after/plugin/lspattach.lua
Executable file
@@ -0,0 +1,46 @@
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
desc = 'LSP actions',
|
||||
callback = function()
|
||||
local bufmap = function(mode, lhs, rhs)
|
||||
local opts = {buffer = true}
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
-- Displays hover information about the symbol under the cursor
|
||||
bufmap('n', 'K', vim.lsp.buf.hover)
|
||||
|
||||
-- Jump to the definition
|
||||
bufmap('n', 'gd', vim.lsp.buf.definition)
|
||||
|
||||
-- Jump to declaration
|
||||
bufmap('n', 'gD', vim.lsp.buf.declaration)
|
||||
|
||||
-- Lists all the implementations for the symbol under the cursor
|
||||
bufmap('n', 'gi', vim.lsp.buf.implementation)
|
||||
|
||||
-- Jumps to the definition of the type symbol
|
||||
bufmap('n', 'go', vim.lsp.buf.type_definition)
|
||||
|
||||
-- Lists all the references
|
||||
bufmap('n', 'gr', vim.lsp.buf.references)
|
||||
|
||||
-- Displays a function's signature information
|
||||
bufmap('n', 'gs', vim.lsp.buf.signature_help)
|
||||
|
||||
-- Renames all references to the symbol under the cursor
|
||||
bufmap('n', '<F2>', vim.lsp.buf.rename)
|
||||
|
||||
-- Selects a code action available at the current cursor position
|
||||
bufmap('n', '<F4>', vim.lsp.buf.code_action)
|
||||
|
||||
-- Show diagnostics in a floating window
|
||||
bufmap('n', 'gl', vim.diagnostic.open_float)
|
||||
|
||||
-- Move to the previous diagnostic
|
||||
bufmap('n', '[d', vim.diagnostic.goto_prev)
|
||||
|
||||
-- Move to the next diagnostic
|
||||
bufmap('n', ']d', vim.diagnostic.goto_next)
|
||||
end
|
||||
})
|
||||
Reference in New Issue
Block a user