Here's a patch to use wildignore when completing files. (This way log files / other outputs wont clutter the completion menu).
diff --git a/lua/cmp_path/init.lua b/lua/cmp_path/init.lua
index 4e63d27..62f1e5e 100644
--- a/lua/cmp_path/init.lua
+++ b/lua/cmp_path/init.lua
@@ -121,11 +121,26 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
local items = {}
+ -- 2023-12-12 gi1242: Partially convert glob patters to lua patterns
+ local wildignore = {}
+ for k, v in pairs( vim.opt.wildignore:get() ) do
+ wildignore[k] = v:gsub( '\\.', '\\.' ):gsub( '*', '.*' )
+ end
+ vim.print(wildignore)
+
+
local function create_item(name, fs_type)
if not (include_hidden or string.sub(name, 1, 1) ~= '.') then
return
end
+ -- 2023-12-12 gi1242: Ignore paths matching wildignore
+ for k, v in pairs( wildignore ) do
+ if name:find(v) then
+ return
+ end
+ end
+
local path = dirname .. '/' .. name
local stat = vim.loop.fs_stat(path)
local lstat = nil
Here's a patch to use
wildignore
when completing files. (This way log files / other outputs wont clutter the completion menu).