1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:30:07 +08:00
SpaceVim/bundle/git.vim/autoload/git/reset.vim
2021-01-02 18:15:08 +08:00

38 lines
857 B
VimL

let s:JOB = SpaceVim#api#import('job')
function! git#reset#run(args)
if len(a:args) == 1 && a:args[0] ==# '%'
let cmd = ['git', 'reset', 'HEAD', expand('%')]
else
let cmd = ['git', 'reset'] + a:args
endif
call git#logger#info('git-reset cmd:' . string(cmd))
call s:JOB.start(cmd,
\ {
\ 'on_exit' : function('s:on_exit'),
\ }
\ )
endfunction
function! s:on_exit(id, data, event) abort
call git#logger#info('git-reset exit data:' . string(a:data))
if a:data ==# 0
if exists(':GitGutter')
GitGutter
endif
echo 'done!'
else
echo 'failed!'
endif
endfunction
function! git#reset#complete(ArgLead, CmdLine, CursorPos)
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
endfunction