Skip to content

Commit

Permalink
neovim: Move rest of lsp shortcuts to global
Browse files Browse the repository at this point in the history
K is already defined by default by neovim.
  • Loading branch information
juanibiapina committed Dec 20, 2024
1 parent 70174d4 commit 0fc300d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
17 changes: 0 additions & 17 deletions dotfiles/nvim/.config/nvim/conf/auto/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
-- Status updates for LSP
require("fidget").setup({})

-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end

vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end

-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
end

-- configure the LSP servers
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local servers = {
Expand All @@ -34,13 +19,11 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
for _, server in ipairs(servers) do
require('lspconfig')[server].setup {
capabilities = capabilities,
on_attach = on_attach,
}
end

require('lspconfig')["rust_analyzer"].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
files = {
Expand Down
1 change: 1 addition & 0 deletions dotfiles/nvim/.config/nvim/lua/shortcuts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ map('<Leader>lD', ':lua vim.lsp.buf.declaration()', 'LSP: Goto declaration')
map('<Leader>lf', ':lua vim.lsp.buf.format()', 'LSP: Format buffer')
map('<Leader>li', ':lua vim.lsp.buf.implementation()', 'LSP: Goto immplementation')
map('<Leader>lr', ':lua vim.lsp.buf.references()', 'LSP: List references')
map('<Leader>ls', ':lua vim.lsp.buf.signature_help()', 'LSP: Signature help')
map('<Leader>lt', ':lua vim.lsp.buf.type_definition()', 'LSP: Goto type definition')
map('<Leader>lla', ':lua vim.lsp.buf.code_action()', 'LSP: Code action')
map('<Leader>llr', ':lua vim.lsp.buf.rename()', 'LSP: Rename symbol')
Expand Down

0 comments on commit 0fc300d

Please sign in to comment.