1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:30:04 +08:00

perf(git): use notify api && redrawstatus

This commit is contained in:
wsdjeg 2023-07-10 22:06:57 +08:00
parent e532c6e06b
commit cd2b5d3a36
2 changed files with 7 additions and 2 deletions

View File

@ -109,6 +109,10 @@ function! s:on_exit_show_branch(id, data, event) abort
\ 'last_update_done' : localtime(), \ 'last_update_done' : localtime(),
\ }) \ })
endif endif
" when the pwd is same as current directory, redraw statueline
if pwd == getcwd()
redrawstatus
endif
endfunction endfunction
"" ""
" return the current branch info. this function can be used in statusline. " return the current branch info. this function can be used in statusline.

View File

@ -1,4 +1,5 @@
let s:JOB = SpaceVim#api#import('job') let s:JOB = SpaceVim#api#import('job')
let s:NOTI = SpaceVim#api#import('notify')
function! git#checkout#run(args) function! git#checkout#run(args)
@ -16,10 +17,10 @@ function! s:on_exit(id, data, event) abort
call git#logger#debug('git-checkout exit data:' . string(a:data)) call git#logger#debug('git-checkout exit data:' . string(a:data))
if a:data ==# 0 if a:data ==# 0
silent! checktime silent! checktime
echo 'checkout done' call s:NOTI.notify('checkout done.')
call git#branch#detect() call git#branch#detect()
else else
echo 'failed!' call s:NOTI.notify('checkout failed.', 'WarningMsg')
endif endif
endfunction endfunction