From 448d502947a3e8a81a2ed1f117f72f2e5361082f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 8 Jun 2023 07:53:16 +0200 Subject: [PATCH] fix(qf): better error message. Fixes #892 --- lua/lazyvim/plugins/editor.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 073e0781..541942aa 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -367,7 +367,10 @@ return { if require("trouble").is_open() then require("trouble").previous({ skip_groups = true, jump = true }) else - vim.cmd.cprev() + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end end end, desc = "Previous trouble/quickfix item", @@ -378,7 +381,10 @@ return { if require("trouble").is_open() then require("trouble").next({ skip_groups = true, jump = true }) else - vim.cmd.cnext() + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end end end, desc = "Next trouble/quickfix item",