From f5431f2b47fe3955a22f47dc8eb384cd87d25b64 Mon Sep 17 00:00:00 2001 From: Benjamin Kyd Date: Sat, 20 May 2023 22:13:22 +0100 Subject: [PATCH] better diagnostics --- common/.config/nvim/lua/lsp-general.lua | 4 ++++ common/.config/nvim/lua/plugins.lua | 31 +++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/common/.config/nvim/lua/lsp-general.lua b/common/.config/nvim/lua/lsp-general.lua index 3e7162a..3d581fb 100644 --- a/common/.config/nvim/lua/lsp-general.lua +++ b/common/.config/nvim/lua/lsp-general.lua @@ -57,6 +57,10 @@ lsp.on_attach(function(_, bufnr) vim.keymap.set('n', 'gT', 'lua vim.lsp.buf.type_definition()', opts) vim.keymap.set('n', 'gR', 'lua vim.lsp.buf.references()', opts) + -- diagnostics + vim.keymap.set('n', 'gn', 'lua vim.diagnostic.goto_next()', opts) + vim.keymap.set('n', 'gp', 'lua vim.diagnostic.goto_prev()', opts) + -- action & rename vim.keymap.set('n', '', 'Lspsaga code_action', opts) vim.keymap.set('n', 'gr', 'Lspsaga rename', opts) diff --git a/common/.config/nvim/lua/plugins.lua b/common/.config/nvim/lua/plugins.lua index b5e34b7..dadec92 100644 --- a/common/.config/nvim/lua/plugins.lua +++ b/common/.config/nvim/lua/plugins.lua @@ -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("", "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