From 32a180d2d9ce65bca5e463d42c3e6d6ab918b8b7 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Sat, 10 Aug 2019 17:20:38 +0100 Subject: [PATCH] vim: use Termdebug in new tab and close when finished --- vim/ftplugin/cpp.vim | 10 ++++++++++ vim/vimrc | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim index 06d4861..a8c9a51 100644 --- a/vim/ftplugin/cpp.vim +++ b/vim/ftplugin/cpp.vim @@ -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 Debug() | Termdebug +command! -nargs=+ -complete=file -bang DebugCommand call Debug() | TermdebugCommand + setlocal foldmethod=syntax " set foldlevel according to number of matches of 'namespace' and 'class' not " containing ';' diff --git a/vim/vimrc b/vim/vimrc index 9995296..6192c9f 100644 --- 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 " bindings {{{1 -- 2.48.1