From 732243fe57d75ed621a79e1b77cf803d8180afd4 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 29 Jul 2025 10:08:02 +0200 Subject: [PATCH] Replace matcha error when nothing found with message --- vim/plugin/matcha.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vim/plugin/matcha.lua b/vim/plugin/matcha.lua index fbd1520..938cedd 100644 --- a/vim/plugin/matcha.lua +++ b/vim/plugin/matcha.lua @@ -70,13 +70,17 @@ local function findLocations(args) end vim.api.nvim_create_user_command("Matcha", function(params) - vim.fn.setqflist(findLocations(unquote(params.fargs))) + local locations = findLocations(unquote(params.fargs)) + if not locations[1] then return print("Nothing found") end + vim.fn.setqflist(locations) vim.cmd("copen") vim.cmd("crewind") end, {nargs="+"}) vim.api.nvim_create_user_command("MatchaLocal", function(params) - vim.fn.setloclist(0, findLocations(unquote(params.fargs))) + local locations = findLocations(unquote(params.fargs)) + if not locations[1] then return print("Nothing found") end + vim.fn.setloclist(0, locations) vim.cmd("lopen") vim.cmd("lrewind") end, {nargs="+"})