1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

fix(git): complete tags only after -d opt

This commit is contained in:
Eric Wong 2024-12-22 15:15:14 +08:00
parent 0d66e31934
commit 71c3ac19e0
3 changed files with 15 additions and 1 deletions

View File

@ -5,6 +5,12 @@
" >
" :Git tag --list
" <
"
" @subsection Command line completion
"
" complete git tag options after `Git tag -<cursor>`,
"
" complete git tags after `-d` option.
if has('nvim-0.9.0')
function! git#tag#complete(ArgLead, CmdLine, CursorPos) abort

View File

@ -121,6 +121,12 @@ This commands is to run `git tag` commands.
:Git tag --list
<
COMMAND LINE COMPLETION
complete git tag options after `Git tag -<cursor>`,
complete git tags after `-d` option.
==============================================================================
FUNCTIONS *git-functions*

View File

@ -80,8 +80,10 @@ function M.complete(ArgLead, CmdLine, CursorPos)
local str = string.sub(CmdLine, 1, CursorPos)
if vim.regex([[^Git\s\+tag\s\+-\+$]]):match_str(str) then
return table.concat({'--list', '-l', '-m', '-a', '-d'}, '\n')
else
elseif vim.regex([[^Git\s\+tag\s\+.*-d\s\+[^ -]*$]]):match_str(str) then
return table.concat(get_all_tags(), '\n')
else
return ''
end
end