From a99b211b3bec43ebe3cdfa1899cba227d1d569a4 Mon Sep 17 00:00:00 2001 From: Ibrahim Muftee Date: Thu, 11 Apr 2024 23:20:57 -0500 Subject: Initial commit --- dot_config/nvim/lua/plugins/lsp-lines.lua | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 dot_config/nvim/lua/plugins/lsp-lines.lua (limited to 'dot_config/nvim/lua/plugins/lsp-lines.lua') diff --git a/dot_config/nvim/lua/plugins/lsp-lines.lua b/dot_config/nvim/lua/plugins/lsp-lines.lua new file mode 100644 index 0000000..41c6ece --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp-lines.lua @@ -0,0 +1,41 @@ +-- lsp_lines +-- +-- A neat little plugin that shows diagnostics as separate lines instead of +-- virtual text at the end of each line. This makes it easier to read. + +return { + url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + event = { "BufReadPre", "BufNewFile" }, + cond = not vim.g.vscode, + keys = { + -- The keys table here supports anything in the opts table for + -- vim.keymap.set, but be careful not to nest it in another table + -- like you would for that function. + -- { "di", desc = "Toggle [d]iagnostic [i]nline" }, + "di", + }, + opts = { + enabled = { + virtual_lines = true, + virtual_text = false, + }, + disabled = { + virtual_lines = false, + virtual_text = { spacing = 4, prefix = "●" }, + }, + }, + config = function(_, opts) + require("lsp_lines").setup() + local is_enabled = true + vim.diagnostic.config(opts.enabled) + + vim.keymap.set("n", "di", function() + is_enabled = not is_enabled + if is_enabled then + vim.diagnostic.config(opts.enabled) + else + vim.diagnostic.config(opts.disabled) + end + end, { desc = "Toggle [d]iagnostics [i]nline" }) + end, +} -- cgit v1.2.3