Remove vim and add nvim config
This commit is contained in:
parent
92b6c017d1
commit
e06ce1a49a
26 changed files with 665 additions and 66 deletions
46
nvim/lua/plugins/lspconfig.lua
Normal file
46
nvim/lua/plugins/lspconfig.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
keys = {
|
||||
{ "<space>e", vim.diagnostic.open_float },
|
||||
{ "[d", vim.diagnostic.goto_prev },
|
||||
{ "]d", vim.diagnostic.goto_next },
|
||||
{ "<space>q", vim.diagnostic.setloclist },
|
||||
{ "gD", vim.lsp.buf.declaration },
|
||||
{ "gd", vim.lsp.buf.definition },
|
||||
{ "K", vim.lsp.buf.hover },
|
||||
{ "gi", vim.lsp.buf.implementation },
|
||||
{ "<C-k>", vim.lsp.buf.signature_help },
|
||||
{ "<space>D", vim.lsp.buf.type_definition },
|
||||
{ "<space>rn", vim.lsp.buf.rename },
|
||||
{ "<space>ca", vim.lsp.buf.code_action },
|
||||
{ "gr", vim.lsp.buf.references },
|
||||
{
|
||||
"<space>f",
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
local protocol = require("vim.lsp.protocol")
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Format", { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue