Neovim support
This commit is contained in:
parent
05bbafd60c
commit
cd5ca37ce1
2 changed files with 66 additions and 55 deletions
|
|
@ -147,11 +147,10 @@ function! vimspector#internal#job#Reset() abort
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:_OnCommandExit( category, ch, code ) abort
|
function! s:_OnCommandExit( category, ch, code ) abort
|
||||||
py3 << EOF
|
py3 __import__( "vimspector",
|
||||||
from vimspector import utils as vimspector_utils
|
\ fromlist = [ "utils" ] ).utils.OnCommandWithLogComplete(
|
||||||
vimspector_utils.OnCommandWithLogComplete( vim.eval( 'a:category' ),
|
\ vim.eval( 'a:category' ),
|
||||||
int( vim.eval( 'a:code' ) ) )
|
\ int( vim.eval( 'a:code' ) ) )
|
||||||
EOF
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort
|
function! vimspector#internal#job#StartCommandWithLog( cmd, category ) abort
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if a:event ==# 'stdout' || a:event ==# 'stderr'
|
||||||
if a:data == ['']
|
if a:data == ['']
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
@ -164,11 +165,17 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
|
||||||
let cw = winnr()
|
let cw = winnr()
|
||||||
try
|
try
|
||||||
execute w . 'wincmd w'
|
execute w . 'wincmd w'
|
||||||
normal! Gz.
|
normal! Gz-
|
||||||
finally
|
finally
|
||||||
execute cw . 'wincmd w'
|
execute cw . 'wincmd w'
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
|
elseif a:event ==# 'exit'
|
||||||
|
py3 __import__( "vimspector",
|
||||||
|
\ fromlist = [ "utils" ] ).utils.OnCommandWithLogComplete(
|
||||||
|
\ vim.eval( 'a:category' ),
|
||||||
|
\ int( vim.eval( 'a:data' ) ) )
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SetUpHiddenBuffer( buffer ) abort
|
function! s:SetUpHiddenBuffer( buffer ) abort
|
||||||
|
|
@ -210,7 +217,9 @@ function! vimspector#internal#neojob#StartCommandWithLog( cmd, category ) abort
|
||||||
\ 'on_stdout': funcref( 's:_OnCommandEvent',
|
\ 'on_stdout': funcref( 's:_OnCommandEvent',
|
||||||
\ [ a:category ] ),
|
\ [ a:category ] ),
|
||||||
\ 'on_stderr': funcref( 's:_OnCommandEvent',
|
\ 'on_stderr': funcref( 's:_OnCommandEvent',
|
||||||
\ [ a:category ] )
|
\ [ a:category ] ),
|
||||||
|
\ 'on_exit': funcref( 's:_OnCommandEvent',
|
||||||
|
\ [ a:category ] ),
|
||||||
\ } )
|
\ } )
|
||||||
|
|
||||||
let s:commands[ a:category ][ id ] = {
|
let s:commands[ a:category ][ id ] = {
|
||||||
|
|
@ -227,8 +236,11 @@ function! vimspector#internal#neojob#CleanUpCommand( category ) abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for id in keys( s:commands[ a:category ] )
|
for id in keys( s:commands[ a:category ] )
|
||||||
call jobstop( str2nr( id ) )
|
let id = str2nr( id )
|
||||||
call jobwait( [ str2nr( id ) ] )
|
if jobwait( [ id ], 0 )[ 0 ] == -1
|
||||||
|
call jobstop( id )
|
||||||
|
endif
|
||||||
|
call jobwait( [ id ], -1 )
|
||||||
endfor
|
endfor
|
||||||
unlet! s:commands[ a:category ]
|
unlet! s:commands[ a:category ]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue