better diagnostics

This commit is contained in:
Benjamin Kyd
2023-05-20 22:13:22 +01:00
parent 0cedfcce29
commit f5431f2b47
2 changed files with 25 additions and 10 deletions

View File

@@ -57,6 +57,10 @@ lsp.on_attach(function(_, bufnr)
vim.keymap.set('n', 'gT', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.keymap.set('n', 'gR', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- diagnostics
vim.keymap.set('n', 'gn', '<Cmd>lua vim.diagnostic.goto_next()<CR>', opts)
vim.keymap.set('n', 'gp', '<Cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
-- action & rename
vim.keymap.set('n', '<A-CR>', '<Cmd>Lspsaga code_action<CR>', opts)
vim.keymap.set('n', '<Leader>gr', '<Cmd>Lspsaga rename<CR>', opts)

View File

@@ -84,7 +84,7 @@ local packer = require('packer').startup(function(use)
end
}
-- zen mode
-- zen m
use {
'folke/zen-mode.nvim',
config = function()
@@ -105,15 +105,7 @@ local packer = require('packer').startup(function(use)
-- nerd commenter
use 'scrooloose/nerdcommenter'
-- nice diagnostic pane on the bottom
use {
'folke/trouble.nvim',
config = function ()
require('plugin-config/lsp-trouble')
end
}
-- vscode like LSP code previews
-- LSP code previews
use {
"glepnir/lspsaga.nvim",
opt = true,
@@ -255,6 +247,25 @@ local packer = require('packer').startup(function(use)
end
}
use({
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
vim.keymap.set("", "<leader>x", function()
local config = vim.diagnostic.config()
vim.diagnostic.config({
virtual_text = not config.virtual_text,
virtual_lines = not config.virtual_lines,
})
end, { desc = "Toggle Line Diagnostics" })
vim.diagnostic.config({
virtual_text = true,
virtual_lines = false,
})
end,
})
-- this will automatically install listed dependencies
-- only the first time NeoVim is opened, because that's when Packer gets installed
if packerBootstrap then