nvim: only list unique entries in mini.projects
This commit is contained in:
parent
444539ac08
commit
666736f87f
1 changed files with 10 additions and 6 deletions
|
@ -58,7 +58,7 @@ end
|
||||||
require('mini.pick').setup({
|
require('mini.pick').setup({
|
||||||
mappings = {
|
mappings = {
|
||||||
move_down = '<tab>',
|
move_down = '<tab>',
|
||||||
move_up = '<S-tab>',
|
move_up = '<S-tab>',
|
||||||
toggle_info = '<C-k>',
|
toggle_info = '<C-k>',
|
||||||
toggle_preview = '<C-p>',
|
toggle_preview = '<C-p>',
|
||||||
},
|
},
|
||||||
|
@ -84,14 +84,18 @@ MiniPick.registry.projects = function(local_opts)
|
||||||
|
|
||||||
local postprocess = function(paths)
|
local postprocess = function(paths)
|
||||||
local result = {}
|
local result = {}
|
||||||
|
local seen = {}
|
||||||
for _, path in ipairs(paths) do
|
for _, path in ipairs(paths) do
|
||||||
path = path:gsub("%/.jj/repo/store/type$", "")
|
path = path:gsub("%/.jj/repo/store/type$", "")
|
||||||
path = path:gsub("%/.git/HEAD$", "")
|
path = path:gsub("%/.git/HEAD$", "")
|
||||||
local item = {
|
if not seen[path] then
|
||||||
path = path,
|
local item = {
|
||||||
text = path:gsub("%" .. root .. "/", " "),
|
path = path,
|
||||||
}
|
text = path:gsub("%" .. root .. "/", " "),
|
||||||
table.insert(result, item)
|
}
|
||||||
|
table.insert(result, item)
|
||||||
|
seen[path] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue