From 6411ab0897f19dad9f902dfee29e101a9a767357 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 21 Jul 2024 17:20:29 +0200 Subject: [PATCH] fix(grug-far): only prefill files filter when file has an extension. Closes #4130 --- lua/lazyvim/plugins/editor.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 1f96f8a2..2e6444a1 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -139,9 +139,11 @@ return { if is_visual then -- needed to make visual selection work vim.cmd([[normal! v]]) end - local grug = require("grug-far"); + local grug = require("grug-far") + local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") + local filesFilter = ext and ext ~= "" and "*." .. ext or nil; (is_visual and grug.with_visual_selection or grug.grug_far)({ - prefills = { filesFilter = "*." .. vim.fn.expand("%:e") }, + prefills = { filesFilter = filesFilter }, }) end, mode = { "n", "v" },