Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " vimspector
- let g:vimspector_enable_mappings = ''
- packadd! vimspector
- nmap <F5> <Plug>VimspectorContinue
- nmap <F9> <Plug>VimspectorToggleBreakpoint
- nmap <S-F9> <Plug>VimspectorAddFunctionBreakpoint
- " all input should be surrounded by quotes
- nmap <leader><F9> :<c-u>call vimspector#ToggleBreakpoint(
- \ { 'condition': input( 'Enter condition expression: ' ),
- \ 'hitCondition': input( 'Enter hit count expression: ' ) }
- \ )<CR>
- sign define vimspectorBP text==> texthl=WarningMsg
- sign define vimspectorBPCond text=?> texthl=WarningMsg
- sign define vimspectorBPDisabled text=x> texthl=LineNr
- sign define vimspectorPC text=-> texthl=MatchParen
- sign define vimspectorPCBP text==» texthl=MatchParen
- let g:vimspector_sign_priority = {
- \ 'vimspectorBP': 33,
- \ 'vimspectorBPCond': 32,
- \ 'vimspectorBPDisabled': 31,
- \ 'vimspectorPC': 999,
- \ 'vimspectorPCBP': 999,
- \ }
- let g:vimspector_sidebar_width = 75
- let g:vimspector_mappings = {
- \ 'stack_trace': {},
- \ 'variables': {
- \ 'set_value': [ '<Tab>', '<C-CR>', '<leader><CR>', 'C' ],
- \ }
- \ }
- let g:vimspector_runtime_mappings = {}
- function! SpectorOnJumpToFrame() abort
- if has_key( g:vimspector_runtime_mappings, string( bufnr() ) )
- return
- endif
- " nmap <silent> <buffer> <leader>dn <Plug>VimspectorStepOver
- " nmap <silent> <buffer> <leader>ds <Plug>VimspectorStepInto
- " nmap <silent> <buffer> <leader>df <Plug>VimspectorStepOut
- " nmap <silent> <buffer> <leader>dc <Plug>VimspectorContinue
- nmap <silent> <buffer> <leader>di <Plug>VimspectorBalloonEval
- xmap <silent> <buffer> <leader>di <Plug>VimspectorBalloonEval
- nmap <silent> <S-F5> <Plug>VimspectorStop
- nmap <silent> <C-S-F5> <Plug>VimspectorRestart
- nmap <silent> <F6> <Plug>VimspectorPause
- nmap <silent> <F10> <Plug>VimspectorStepOver
- " windows terminal F11 is mapped for full screen
- " so you should disable it in windows terminal setting
- nmap <silent> <F11> <Plug>VimspectorStepInto
- nmap <silent> <S-F11> <Plug>VimspectorStepOut
- nmap <silent> <F8> :VimspectorReset<CR>
- let g:vimspector_runtime_mappings[ string( bufnr() ) ] = { 'modifiable': &modifiable }
- setlocal nomodifiable
- " if enable shoosewin overlay will cause bug when first time
- " run :execute "normal \<Plug>(choosewin)"
- " more details about <Plug> https://stackoverflow.com/a/18547013/6074780
- let g:choosewin_overlay_enable = 0
- endfunction
- function! SpectorOnDebugEnd() abort
- let original_buf = bufnr()
- let hidden = &hidden
- try
- set hidden
- for bufnr in keys( g:vimspector_runtime_mappings )
- try
- execute 'noautocmd buffer' bufnr
- " silent! nunmap <buffer> <leader>dn
- " silent! nunmap <buffer> <leader>ds
- " silent! nunmap <buffer> <leader>df
- " silent! nunmap <buffer> <leader>dc
- silent! nunmap <buffer> <leader>di
- silent! xunmap <buffer> <leader>di
- silent! nunmap <S-F5>
- silent! nunmap <C-S-F5>
- silent! nunmap <F6>
- silent! nunmap <F10>
- silent! nunmap <F11>
- silent! nunmap <S-F11>
- silent! nunmap <F8>
- let &l:modifiable = g:vimspector_runtime_mappings[ bufnr ][ 'modifiable' ]
- let g:choosewin_overlay_enable = 1
- endtry
- endfor
- finally
- execute 'noautocmd buffer' original_buf
- let &hidden = hidden
- endtry
- let g:vimspector_runtime_mappings = {}
- endfunction
- augroup TestCustomMappings
- au!
- autocmd User VimspectorJumpedToFrame call SpectorOnJumpToFrame()
- autocmd User VimspectorDebugEnded call SpectorOnDebugEnd()
- augroup END
- function! s:CustomiseWinBar()
- call win_gotoid( g:vimspector_session_windows.code)
- aunmenu WinBar
- nnoremenu WinBar.▷\ ᶠ⁵ :call vimspector#Continue()<CR>
- nnoremenu WinBar.↷\ ᶠ¹⁰ :call vimspector#StepOver()<CR>
- nnoremenu WinBar.↓\ ᶠ¹¹ :call vimspector#StepInto()<CR>
- nnoremenu WinBar.↑\ ˢᶠ¹¹ :call vimspector#StepOut()<CR>
- nnoremenu WinBar.❘❘\ ᶠ⁶ :call vimspector#Pause()<CR>
- nnoremenu WinBar.□\ ˢᶠ⁵ :call vimspector#Stop()<CR>
- nnoremenu WinBar.⟲\ ᶜˢᶠ⁵ :call vimspector#Restart()<CR>
- nnoremenu WinBar.✕\ ᶠ⁸ :call vimspector#Reset()<CR>
- endfunction
- augroup MyVimspectorUICustomistaion
- autocmd!
- " autocmd User VimspectorUICreated call s:CustomiseUI()
- " autocmd User VimspectorTerminalOpened call s:SetUpTerminal()
- autocmd User VimspectorUICreated call s:CustomiseWinBar()
- augroup END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement