]> git.rmz.io Git - dotfiles.git/blobdiff - vim/ftplugin/cpp.vim
vim: use Termdebug in new tab and close when finished
[dotfiles.git] / vim / ftplugin / cpp.vim
index 06d4861b1616776af28f00c2b7ca7053bd6b42e7..a8c9a51b7bd6ce71a6fa022930e72143236cdd7e 100644 (file)
@@ -63,6 +63,16 @@ setlocal errorformat+=%X%*\\a:\ Leaving\ directory\ [`']%f'
 setlocal errorformat+=%*[^[]\[%tRROR\]%m\ \[%f:%l\]
 setlocal errorformat+=%*[^[]\[%tARNING\]%m\ \[%f:%l\]
 
 setlocal errorformat+=%*[^[]\[%tRROR\]%m\ \[%f:%l\]
 setlocal errorformat+=%*[^[]\[%tARNING\]%m\ \[%f:%l\]
 
+packadd termdebug
+let g:termdebug_wide = 1
+function! s:Debug(...)
+    tabedit %
+    let t:debug_tab=1
+    au BufDelete !gdb ++once if exists('t:debug_tab') | tabclose | endif
+endfunction
+command! -nargs=* -complete=file -bang Debug call <SID>Debug() | Termdebug<bang> <args>
+command! -nargs=+ -complete=file -bang DebugCommand call <SID>Debug() | TermdebugCommand<bang> <args>
+
 setlocal foldmethod=syntax
 " set foldlevel according to number of matches of 'namespace' and 'class' not
 " containing ';'
 setlocal foldmethod=syntax
 " set foldlevel according to number of matches of 'namespace' and 'class' not
 " containing ';'