]> git.rmz.io Git - dotfiles.git/commitdiff
vim: use Termdebug in new tab and close when finished
authorSamir Benmendil <me@rmz.io>
Sat, 10 Aug 2019 16:20:38 +0000 (17:20 +0100)
committerSamir Benmendil <me@rmz.io>
Sat, 10 Aug 2019 16:20:38 +0000 (17:20 +0100)
vim/ftplugin/cpp.vim
vim/vimrc

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\]
 
+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 ';'
index 99952966f56f8552ccd02a7897e15c01a182e79e..6192c9f67fd3c9ed8fc5c596563df37a37066061 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -333,9 +333,6 @@ augroup terminal
   au!
   au TerminalOpen * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
 augroup END
-" vertical split TermDebug
-let g:termdebug_wide = 1
-command! -nargs=* -bang -complete=file Debug tabedit % | Termdebug<bang> <args>
 
 " bindings {{{1