1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 11:20:06 +08:00

feat(git): update git-tag completion

This commit is contained in:
Eric Wong 2024-12-21 19:53:38 +08:00
parent 9584d22101
commit 0d66e31934

View File

@ -72,12 +72,16 @@ function M.run(argv)
end end
end end
local function get_all_tags()
return vim.fn.systemlist('git tag')
end
function M.complete(ArgLead, CmdLine, CursorPos) function M.complete(ArgLead, CmdLine, CursorPos)
local str = string.sub(CmdLine, 1, CursorPos) local str = string.sub(CmdLine, 1, CursorPos)
if vim.regex([[^Git\s\+tag\s\+-\+$]]):match_str(str) then if vim.regex([[^Git\s\+tag\s\+-\+$]]):match_str(str) then
return table.concat({'--list'}, '\n') return table.concat({'--list', '-l', '-m', '-a', '-d'}, '\n')
else else
return '' return table.concat(get_all_tags(), '\n')
end end
end end