update lsp config in neovim_unstable
This commit is contained in:
parent
4751ecc2ef
commit
ca0aea0b9e
1 changed files with 19 additions and 2 deletions
|
|
@ -50,7 +50,6 @@ opt.splitbelow = true -- Put new windows below current
|
|||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.timeoutlen = 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
|
|
@ -157,5 +156,23 @@ vim.lsp.enable({
|
|||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = { current_line = true }
|
||||
virtual_lines = { current_line = true },
|
||||
on_attach = function(_, bufnr)
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n" .. msg)
|
||||
end, { buffer = bufnr, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue