mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Apply signs to correct buffer when using Neovim async
This commit is contained in:
committed by
Andy Stewart
parent
d5806ea44c
commit
a4e75dd074
@@ -9,12 +9,14 @@ endfunction
|
|||||||
|
|
||||||
function! gitgutter#async#execute(cmd)
|
function! gitgutter#async#execute(cmd)
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
|
let bufnr = gitgutter#utility#bufnr()
|
||||||
let job_id = jobstart([&shell, &shellcmdflag, a:cmd], {
|
let job_id = jobstart([&shell, &shellcmdflag, a:cmd], {
|
||||||
|
\ 'buffer': bufnr,
|
||||||
\ 'on_stdout': function('gitgutter#async#handle_diff_job_nvim'),
|
\ 'on_stdout': function('gitgutter#async#handle_diff_job_nvim'),
|
||||||
\ 'on_stderr': function('gitgutter#async#handle_diff_job_nvim'),
|
\ 'on_stderr': function('gitgutter#async#handle_diff_job_nvim'),
|
||||||
\ 'on_exit': function('gitgutter#async#handle_diff_job_nvim')
|
\ 'on_exit': function('gitgutter#async#handle_diff_job_nvim')
|
||||||
\ })
|
\ })
|
||||||
call gitgutter#debug#log('[nvim job: '.job_id.'] '.a:cmd)
|
call gitgutter#debug#log('[nvim job: '.job_id.', buffer: '.bufnr.'] '.a:cmd)
|
||||||
if job_id < 1
|
if job_id < 1
|
||||||
throw 'diff failed'
|
throw 'diff failed'
|
||||||
endif
|
endif
|
||||||
@@ -38,7 +40,10 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event)
|
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event)
|
||||||
call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event)
|
call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event.', buffer: '.self.buffer)
|
||||||
|
|
||||||
|
let current_buffer = gitgutter#utility#bufnr()
|
||||||
|
call gitgutter#utility#set_buffer(self.buffer)
|
||||||
|
|
||||||
if a:event == 'stdout'
|
if a:event == 'stdout'
|
||||||
" a:data is a list
|
" a:data is a list
|
||||||
@@ -58,6 +63,8 @@ function! gitgutter#async#handle_diff_job_nvim(job_id, data, event)
|
|||||||
call s:job_finished(a:job_id)
|
call s:job_finished(a:job_id)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call gitgutter#utility#set_buffer(current_buffer)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user