-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimspectorrc.vim
56 lines (49 loc) · 1.64 KB
/
vimspectorrc.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
let g:vimspector_install_gadgets = [
\ 'debugpy',
\ 'vscode-cpptools',
\ 'CodeLLDB',
\ 'vscode-bash-debug'
\ ]
" Quit Vimspector
nnoremap <LocalLeader>q :call vimspector#Reset( { 'interactive': v:false } )<CR>
" Watches
nnoremap <LocalLeader>wa :call AddToWatch()<CR>
" Move up/down in the current call stack
nnoremap <S-F11> <Plug>VimspectorUpFrame
nnoremap <S-F12> <Plug>VimspectorDownFrame
" Open breakpoint or disassembly windows
nnoremap <LocalLeader>B <Plug>VimspectorBreakpoints
nnoremap <LocalLeader>D <Plug>VimspectorDisassemble
" Evaluate under cursor
nnoremap <LocalLeader>K <Plug>VimspectorBalloonEval
xnoremap <LocalLeader>K <Plug>VimspectorBalloonEval
" Run make and start debugger
nnoremap <S-F5>> :RebuildAndDebug<CR>
let g:vimspector_enable_mappings = 'HUMAN'
autocmd User VimspectorJumpedToFrame normal zz
func! AddToWatch()
let word = expand("<cexpr>")
call vimspector#AddWatch(word)
endfunction
let g:vimspector_sign_priority = {
\ 'vimspectorBP': 101,
\ 'vimspectorBPCond': 102,
\ 'vimspectorBPLog': 103,
\ 'vimspectorBPDisabled': 104,
\ 'vimspectorPC': 105,
\ }
" Creates a function to run :Make
function! RebuildAndDebug()
Make
cclose
autocmd QuickFixCmdPost make ++once call RunVimspectorIfBuilt()
endfunction
" Catch the status value of :Make to no launch when building was unsuccessful
function! RunVimspectorIfBuilt()
let status = +readfile(dispatch#request().file . '.complete', 1)[0]
if status == 0
call vimspector#Launch()
endif
endfunction
" Finally, create a :RebuildAndDebug command to run all the above
command! RebuildAndDebug call RebuildAndDebug()