1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 10:20:06 +08:00

perf(git): use normal highlight for non-errors

This commit is contained in:
wsdjeg 2022-10-27 00:35:21 +08:00
parent 91fd3ad573
commit f9c0889a3b

View File

@ -14,8 +14,7 @@ function! git#push#run(...) abort
if len(a:1) > 0
let cmd += a:1
endif
call s:JOB.start(cmd,
\ {
call s:JOB.start(cmd, {
\ 'on_stdout' : function('s:on_stdout'),
\ 'on_stderr' : function('s:on_stderr'),
\ 'on_exit' : function('s:on_exit'),
@ -27,9 +26,13 @@ endfunction
function! s:on_exit(...) abort
let data = get(a:000, 2)
if data != 0
call s:NOTI.notify('Git push failed!', 'WarningMsg')
for line in s:std_data.stderr
call s:NOTI.notify(line, 'WarningMsg')
endfor
else
call s:NOTI.notify('Git push done!')
for line in s:std_data.stderr
call s:NOTI.notify(line)
endfor
endif
endfunction
@ -40,10 +43,17 @@ function! s:on_stdout(id, data, event) abort
endfor
endfunction
" https://stackoverflow.com/questions/57016157/how-to-stop-git-from-writing-non-errors-to-stderr
"
" why git push normal info to stderr
let s:std_data = {
\ 'stderr' : [],
\ 'stdout' : [],
\ }
function! s:on_stderr(id, data, event) abort
for line in filter(a:data, '!empty(v:val)')
call s:NOTI.notify(line, 'WarningMsg')
endfor
call extend(s:std_data.stderr, a:data)
endfunction
function! s:options() abort