mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 00:00:04 +08:00
feat(git): complete :Git branch
This commit is contained in:
parent
18f2edc395
commit
cbc3f5e50c
@ -24,6 +24,10 @@ if has('nvim-0.9.0')
|
||||
function! git#branch#detect() abort
|
||||
lua require('git.command.branch').detect()
|
||||
endfunction
|
||||
|
||||
function! git#branch#complete(ArgLead, CmdLine, CursorPos) abort
|
||||
return luaeval('require("git.command.branch").complete(vim.api.nvim_eval("a:ArgLead"), vim.api.nvim_eval("a:CmdLine"), vim.api.nvim_eval("a:CursorPos"))')
|
||||
endfunction
|
||||
else
|
||||
|
||||
let s:JOB = SpaceVim#api#import('job')
|
||||
|
@ -1,5 +1,5 @@
|
||||
*git.txt* Git support in vim
|
||||
Wang Shidong *git*
|
||||
Wang Shidong & Mattes Groeger *git*
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *git-contents*
|
||||
|
@ -146,4 +146,11 @@ function M.run(argv)
|
||||
end
|
||||
end
|
||||
|
||||
function M.complete(arglead, cmdline, cursorpos)
|
||||
if vim.startswith(arglead, '-') then
|
||||
return table.concat({'-d', '-D'}, '\n')
|
||||
end
|
||||
return table.concat(vim.fn.map(vim.fn.systemlist('git branch --no-merged'), 'trim(v:val)'), '\n')
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user