You've already forked dotfiles
fix: Moving the LSP configs out of the Mason file, using the new vim.lsp.config way of configuring LSPs, adding the 'after' config directory for LSP specific configs that override/extend those in the 'lsp' dir and fit with the new configuration way of NVIM 0.11+, moving shortcuts to lspconfig instead of Mason, removing the rename custom function in telescope and using the LSP based function.
This commit is contained in:
@@ -1,4 +1,47 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
lazy = false,
|
||||
-- lazy = false,
|
||||
config = function ()
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- All functions and keymaps contained here are universal to LSPs
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Keyboard Mappings
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', '<C-[>', vim.diagnostic.goto_prev, bufopts)
|
||||
vim.keymap.set('n', '<C-]>', vim.diagnostic.goto_next, bufopts)
|
||||
-- vim.keymap.set('n', 'gl', vim.diagnostic.open_float, bufopts)
|
||||
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
end
|
||||
|
||||
-- Kick the logging to debug level
|
||||
-- vim.lsp.set_log_level("debug")
|
||||
|
||||
vim.diagnostic.config ({
|
||||
virtual_text = {
|
||||
source = 'always',
|
||||
},
|
||||
severity_sort = true,
|
||||
float = {
|
||||
source = 'always'
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.config('*', {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user