From c840e6608751f1e15a2cd6347924186b27fbe842 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sat, 17 Aug 2024 03:30:07 -0400 Subject: improved Trouble.nvim config, ensure Go treesitter parser --- nvim/lua/plugins/colorscheme.lua | 1 + nvim/lua/plugins/diagnostics.lua | 17 ++++++++++++----- nvim/lua/plugins/treesitter.lua | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'nvim') diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua index fb5815e..df87e12 100644 --- a/nvim/lua/plugins/colorscheme.lua +++ b/nvim/lua/plugins/colorscheme.lua @@ -35,6 +35,7 @@ local colorschemes = { transparent_background_level = 2 }) vim.cmd[[highlight! link TroubleNormal Normal]] + vim.cmd[[highlight! link TroubleNormalNC Normal]] vim.cmd[[colorscheme everforest"]] end }, diff --git a/nvim/lua/plugins/diagnostics.lua b/nvim/lua/plugins/diagnostics.lua index 78c3f02..7865470 100644 --- a/nvim/lua/plugins/diagnostics.lua +++ b/nvim/lua/plugins/diagnostics.lua @@ -13,7 +13,11 @@ return { follow = false } if trouble.is_open(opts) then - trouble.close(opts) + if vim.o.ft == "trouble" then + trouble.close(opts) + else + trouble.focus() + end else trouble.open(opts) end @@ -30,11 +34,14 @@ return { follow = false, filter = { buf = 0 } } - if not trouble.is_open(opts) then - trouble.open(opts) - trouble.focus(opts) + if trouble.is_open(opts) then + if vim.o.ft == "trouble" then + trouble.close(opts) + else + trouble.focus() + end else - trouble.close(opts) + trouble.open(opts) end end, desc = "Buffer Diagnostics (Trouble)", diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 88e47ca..4062d14 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -2,7 +2,7 @@ return { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { "help", "lua", "python", "java", "javascript", "typescript", "c", "latex", "vim" }, + ensure_installed = { "help", "lua", "python", "java", "javascript", "typescript", "c", "latex", "vim", "go" }, auto_install = true, highlight = { enable = true, -- cgit v1.2.3