From 992096a2a085bbdd9cfb603ec46867206c1f1380 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 14 Sep 2018 16:17:09 +0100 Subject: [PATCH] Add :Debug command The :Debug command quickly starts a new debugging sessions. * adds the `termdebug` package * invokes `TermdebugCommand` with the given arguments --- autoload/do.vim | 10 ++++++++++ plugin/commands.vim | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/autoload/do.vim b/autoload/do.vim index 380c5d2..5cbcc64 100644 --- a/autoload/do.vim +++ b/autoload/do.vim @@ -68,3 +68,13 @@ function! do#rename_include_guard(old) " Jump back to the set mark normal 'r endfunction + +" Setup and start a debugging command. +function! do#debug(...) + packadd termdebug + let l:command = 'TermdebugCommand' + for l:arg in a:000 + let l:command = l:command.' '.l:arg + endfor + exec l:command +endfunction diff --git a/plugin/commands.vim b/plugin/commands.vim index ff0fb28..43ca3ba 100644 --- a/plugin/commands.vim +++ b/plugin/commands.vim @@ -14,4 +14,7 @@ command! -nargs=1 TabWidth call do#set_tab_width() command! ToggleCheckbox call do#toggle_checkbox() " Show highlight groups under the cursor -command! CursorHighlightGroups :call do#cursor_highlight_groups() +command! CursorHighlightGroups call do#cursor_highlight_groups() + +" Setup and invoke a :TermdebugCommand +command! -nargs=+ -complete=file Debug call do#debug()