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/diagnostics.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'nvim/lua/plugins/diagnostics.lua') 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)", -- cgit v1.2.3