From 96499d0d67906de475e484129552247e9bf6a1f3 Mon Sep 17 00:00:00 2001 From: Matthew Leong Date: Fri, 30 Dec 2022 13:00:04 -0800 Subject: [PATCH] feat: disable lsp_lines by default --- lazy-lock.json | 2 +- lua/cosmic/core/user.lua | 2 +- lua/cosmic/plugins/lsp-lines/init.lua | 51 ++++++++++++++------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index be8d2f2..e4b47bc 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -17,7 +17,7 @@ "lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "aa25b4153d2f2636c3b3a8c8360349d2b29e7ae3" }, "mason.nvim": { "branch": "main", "commit": "1592493e3406c271e9128b4d424731e25f1ff2a1" }, - "noice.nvim": { "branch": "main", "commit": "7816fcd8a43a9de84d7f4695b0688b4f54b25570" }, + "noice.nvim": { "branch": "main", "commit": "6aa6585da8cf9ffa44575b320b4d64d50f3c13a2" }, "nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" }, "null-ls.nvim": { "branch": "main", "commit": "647a1eeeefc43ce15d941972642210637c370471" }, "nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" }, diff --git a/lua/cosmic/core/user.lua b/lua/cosmic/core/user.lua index 016cc8a..14ee6da 100644 --- a/lua/cosmic/core/user.lua +++ b/lua/cosmic/core/user.lua @@ -11,7 +11,7 @@ local default_config = { -- true - loads plugin and is enabled at start -- false - loads plugin but is not enabled at start -- you may use ld to toggle - enable_on_start = true, + enable_on_start = false, }, }, lsp = { diff --git a/lua/cosmic/plugins/lsp-lines/init.lua b/lua/cosmic/plugins/lsp-lines/init.lua index 909a3d6..6ec6036 100644 --- a/lua/cosmic/plugins/lsp-lines/init.lua +++ b/lua/cosmic/plugins/lsp-lines/init.lua @@ -1,33 +1,36 @@ +local u = require('cosmic.utils') local user_config = require('cosmic.core.user') -return { - event = 'VeryLazy', - url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', - config = function() - local u = require('cosmic.utils') - local map = require('cosmic.utils').map - local vt_config = require('cosmic.lsp.diagnostics.config') - local is_plugin_enabled = user_config.plugins.lsp_lines.enable_on_start +local vt_config = require('cosmic.lsp.diagnostics.config') +local map = require('cosmic.utils').map +local is_plugin_enabled = user_config.plugins.lsp_lines.enable_on_start +local function toggle() + if is_plugin_enabled then + vim.diagnostic.config(u.merge(vt_config, { + virtual_text = false, + virtual_lines = true, + })) + else + vim.diagnostic.config(u.merge(vt_config, { + virtual_lines = false, + })) + end + is_plugin_enabled = not is_plugin_enabled +end +return { + url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', + keys = { + { + 'ld', + toggle, + desc = 'Enable lsp_lines', + }, + }, + config = function() -- init lsp_lines require('lsp_lines').setup() - - local function toggle() - if is_plugin_enabled then - vim.diagnostic.config(u.merge(vt_config, { - virtual_text = false, - virtual_lines = true, - })) - else - vim.diagnostic.config(u.merge(vt_config, { - virtual_lines = false, - })) - end - is_plugin_enabled = not is_plugin_enabled - end - -- run once to properly show/hide based on user config toggle() - -- map for toggling lines map('n', 'ld', '', { callback = toggle,