Add some :commands for basic usages
This commit is contained in:
parent
04bb03da0a
commit
7456c26c2a
5 changed files with 67 additions and 21 deletions
|
|
@ -96,6 +96,11 @@ function! vimspector#AddWatchPrompt( expr ) abort
|
||||||
call vimspector#AddWatch( a:expr )
|
call vimspector#AddWatch( a:expr )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#Evaluate( expr ) abort
|
||||||
|
py3 _vimspector_session.ShowOutput( 'Console' )
|
||||||
|
py3 _vimspector_session.EvaluateConsole( vim.eval( 'a:expr' ) )
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vimspector#EvaluateConsole( expr ) abort
|
function! vimspector#EvaluateConsole( expr ) abort
|
||||||
stopinsert
|
stopinsert
|
||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
|
|
@ -110,6 +115,14 @@ function! vimspector#ListBreakpoints() abort
|
||||||
py3 _vimspector_session.ListBreakpoints()
|
py3 _vimspector_session.ListBreakpoints()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#CompleteOutput( ArgLead, CmdLine, CursorPos ) abort
|
||||||
|
return py3eval( '_vimspector_session.GetOutputBuffers()' )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#CompleteExpr( ArgLead, CmdLine, CursorPos ) abort
|
||||||
|
return []
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Boilerplate {{{
|
" Boilerplate {{{
|
||||||
let &cpoptions=s:save_cpo
|
let &cpoptions=s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@ function! vimspector#internal#neojob#StartCommandWithLog( cmd, category ) abort
|
||||||
let s:commands[ a:category ] = {}
|
let s:commands[ a:category ] = {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let stdout_buf = bufnr( '_vimspector_log_' . a:category . '_out', 1 )
|
let stdout_buf = bufnr( '_vimspector_log_' . a:category . '_out', v:true )
|
||||||
let stderr_buf = bufnr( '_vimspector_log_' . a:category . '_err', 1 )
|
let stderr_buf = bufnr( '_vimspector_log_' . a:category . '_err', v:true )
|
||||||
|
|
||||||
let id = jobstart(a:cmd,
|
let id = jobstart(a:cmd,
|
||||||
\ {
|
\ {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ if exists( 'g:loaded_vimpector' )
|
||||||
call s:restore_cpo()
|
call s:restore_cpo()
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
" TODO:
|
" TODO:
|
||||||
" - Check Vim version (for jobs)
|
" - Check Vim version (for jobs)
|
||||||
|
|
@ -36,28 +37,54 @@ let g:loaded_vimpector = 1
|
||||||
|
|
||||||
let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
|
let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
|
||||||
|
|
||||||
|
nnoremap <Plug>VimspectorContinue :<c-u>call vimspector#Continue()<CR>
|
||||||
|
nnoremap <Plug>VimspectorStop :<c-u>call vimspector#Stop()<CR>
|
||||||
|
nnoremap <Plug>VimspectorRestart :<c-u>call vimspector#Restart()<CR>
|
||||||
|
nnoremap <Plug>VimspectorPause :<c-u>call vimspector#Pause()<CR>
|
||||||
|
nnoremap <Plug>VimspectorToggleBreakpoint
|
||||||
|
\ :<c-u>call vimspector#ToggleBreakpoint()<CR>
|
||||||
|
nnoremap <Plug>VimspectorAddFunctionBreakpoint
|
||||||
|
\ :<c-u>call vimspector#AddFunctionBreakpoint( expand( '<cexpr>' ) )<CR>
|
||||||
|
nnoremap <Plug>VimspectorStopOver :<c-u>call vimspector#StepOver()<CR>
|
||||||
|
nnoremap <Plug>VimspectorStepInto :<c-u>call vimspector#StepInto()<CR>
|
||||||
|
nnoremap <Plug>VimspectorStepOut :<c-u>call vimspector#StepOut()<CR>
|
||||||
|
|
||||||
if s:mappings ==# 'VISUAL_STUDIO'
|
if s:mappings ==# 'VISUAL_STUDIO'
|
||||||
nnoremap <F5> :call vimspector#Continue()<CR>
|
nmap <F5> <Plug>VimspectorContinue
|
||||||
nnoremap <S-F5> :call vimspector#Stop()<CR>
|
nmap <S-F5> <Plug>VimspectorStop
|
||||||
nnoremap <C-S-F5> :call vimspector#Restart()<CR>
|
nmap <C-S-F5> <Plug>VimspectorRestart
|
||||||
nnoremap <F6> :call vimspector#Pause()<CR>
|
nmap <F6> <Plug>VimspectorPause
|
||||||
nnoremap <F9> :call vimspector#ToggleBreakpoint()<CR>
|
nmap <F9> <Plug>VimspectorToggleBreakpoint
|
||||||
nnoremap <S-F9> :call vimspector#AddFunctionBreakpoint( expand( '<cexpr>' ) )<CR>
|
nmap <S-F9> <Plug>VimspectorAddFunctionBreakpoint
|
||||||
nnoremap <F10> :call vimspector#StepOver()<CR>
|
nmap <F10> <Plug>VimspectorStepOver
|
||||||
nnoremap <F11> :call vimspector#StepInto()<CR>
|
nmap <F11> <Plug>VimspectorStepInto
|
||||||
nnoremap <S-F11> :call vimspector#StepOut()<CR>
|
nmap <S-F11> <Plug>VimspectorStepOut
|
||||||
elseif s:mappings ==# 'HUMAN'
|
elseif s:mappings ==# 'HUMAN'
|
||||||
nnoremap <F5> :call vimspector#Continue()<CR>
|
nmap <F5> <Plug>VimspectorContinue
|
||||||
nnoremap <F3> :call vimspector#Stop()<CR>
|
nmap <F3> <Plug>VimspectorStop
|
||||||
nnoremap <F4> :call vimspector#Restart()<CR>
|
nmap <F4> <Plug>VimspectorRestart
|
||||||
nnoremap <F6> :call vimspector#Pause()<CR>
|
nmap <F6> <Plug>VimspectorPause
|
||||||
nnoremap <F9> :call vimspector#ToggleBreakpoint()<CR>
|
nmap <F9> <Plug>VimspectorToggleBreakpoint
|
||||||
nnoremap <F8> :call vimspector#AddFunctionBreakpoint( expand( '<cexpr>' ) )<CR>
|
nmap <F8> <Plug>VimspectorAddFunctionBreakpoint
|
||||||
nnoremap <F10> :call vimspector#StepOver()<CR>
|
nmap <F10> <Plug>VimspectorStepOver
|
||||||
nnoremap <F11> :call vimspector#StepInto()<CR>
|
nmap <F11> <Plug>VimspectorStepInto
|
||||||
nnoremap <F12> :call vimspector#StepOut()<CR>
|
nmap <F12> <Plug>VimspectorStepOut
|
||||||
endif
|
endif
|
||||||
"}}}
|
|
||||||
|
|
||||||
|
command! -bar -nargs=1 -complete=customlist,vimspector#CompleteExpr
|
||||||
|
\ VimspectorWatch
|
||||||
|
\ call vimspector#AddWatch( <f-args> )
|
||||||
|
command! -bar -nargs=1 -complete=customlist,vimspector#CompleteOutput
|
||||||
|
\ VimspectorShowOutput
|
||||||
|
\ call vimspector#ShowOutput( <f-args> )
|
||||||
|
command! -bar -nargs=1 -complete=customlist,vimspector#CompleteExpr
|
||||||
|
\ VimspectorEval
|
||||||
|
\ call vimspector#Evaluate( <f-args> )
|
||||||
|
command! -bar
|
||||||
|
\ VimspectorReset
|
||||||
|
\ call vimspector#Reset()
|
||||||
|
|
||||||
|
" boilerplate {{{
|
||||||
call s:restore_cpo()
|
call s:restore_cpo()
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,9 @@ class DebugSession( object ):
|
||||||
def ShowOutput( self, category ):
|
def ShowOutput( self, category ):
|
||||||
self._outputView.ShowOutput( category )
|
self._outputView.ShowOutput( category )
|
||||||
|
|
||||||
|
def GetOutputBuffers( self ):
|
||||||
|
return self._outputView.GetCategories()
|
||||||
|
|
||||||
def _SetUpUI( self ):
|
def _SetUpUI( self ):
|
||||||
vim.command( 'tabnew' )
|
vim.command( 'tabnew' )
|
||||||
self._uiTab = vim.current.tabpage
|
self._uiTab = vim.current.tabpage
|
||||||
|
|
|
||||||
|
|
@ -206,3 +206,6 @@ class OutputView( object ):
|
||||||
tab_buffer.index,
|
tab_buffer.index,
|
||||||
utils.Escape( category ),
|
utils.Escape( category ),
|
||||||
'*' if tab_buffer.flag else '' ) )
|
'*' if tab_buffer.flag else '' ) )
|
||||||
|
|
||||||
|
def GetCategories( self ):
|
||||||
|
return [ category for category in self._buffers.keys() ]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue