nvim: only list unique entries in mini.projects

This commit is contained in:
Daniel Lundin 2025-01-26 20:34:25 +01:00
parent 444539ac08
commit 666736f87f
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI

View file

@ -58,7 +58,7 @@ end
require('mini.pick').setup({
mappings = {
move_down = '<tab>',
move_up = '<S-tab>',
move_up = '<S-tab>',
toggle_info = '<C-k>',
toggle_preview = '<C-p>',
},
@ -84,14 +84,18 @@ MiniPick.registry.projects = function(local_opts)
local postprocess = function(paths)
local result = {}
local seen = {}
for _, path in ipairs(paths) do
path = path:gsub("%/.jj/repo/store/type$", "")
path = path:gsub("%/.git/HEAD$", "")
local item = {
path = path,
text = path:gsub("%" .. root .. "/", ""),
}
table.insert(result, item)
if not seen[path] then
local item = {
path = path,
text = path:gsub("%" .. root .. "/", ""),
}
table.insert(result, item)
seen[path] = true
end
end
return result
end