@@ -623,7 +623,8 @@ Starting ~
623623Load the plugin with this command: >
624624 packadd termdebug
625625< *:Termdebug*
626- To start debugging use `:Termdebug ` followed by the command name, for example: >
626+ To start debugging use `:Termdebug ` or `:TermdebugCommand ` ` followed by the
627+ command name, for example: >
627628 :Termdebug vim
628629
629630 This opens two windows:
@@ -641,7 +642,8 @@ source file location will be displayed, if possible. A sign is used to
641642highlight the current position, using highlight group debugPC.
642643
643644If the buffer in the current window is modified, another window will be opened
644- to display the current gdb position.
645+ to display the current gdb position. You can use `:Winbar ` to add a window
646+ toolbar there.
645647
646648Focus the terminal of the executed program to interact with it. This works
647649the same as any command running in a terminal window.
@@ -650,12 +652,25 @@ When the debugger ends, typically by typing "quit" in the gdb window, the two
650652opened windows are closed.
651653
652654Only one debugger can be active at a time.
653-
654- To attach gdb to an already running executable, or use a core file, pass extra
655+ *:TermdebugCommand*
656+ If you want to give specific commands to the command being debugged, you can
657+ use the `:TermdebugCommand ` command followed by the command name and
658+ additional parameters. >
659+ :TermdebugCommand vim --clean -c ':set nu'
660+
661+ Both the `:Termdebug ` and `:TermdebugCommand ` support an optional "!" bang
662+ argument to start the command right away, without pausing at the gdb window
663+ (and cursor will be in the debugged window). For example: >
664+ :TermdebugCommand! vim --clean
665+
666+ To attach gdb to an already running executable or use a core file, pass extra
655667arguments. E.g.: >
656668 :Termdebug vim core
657669 :Termdebug vim 98343
658670
671+ If no argument is given, you'll end up in a gdb window, in which you need to
672+ specify which command to run using e.g. the gdb `file ` command.
673+
659674
660675Example session ~
661676 *termdebug-example*
@@ -728,18 +743,20 @@ Put focus on the gdb window to type commands there. Some common ones are:
728743- frame N go to the N th stack frame
729744- continue continue execution
730745
731- In the window showing the source code these commands can be used to control gdb:
746+ *:Run* *:Arguments*
747+ In the window showing the source code these commands can be used to control
748+ gdb:
732749 `:Run ` [args] run the program with [args] or the previous arguments
733750 `:Arguments ` {args} set arguments for the next `:Run `
734751
735- ` :Break ` set a breakpoint at the current line; a sign will be displayed
736- ` :Clear ` delete the breakpoint at the current line
752+ * :Break* set a breakpoint at the current line; a sign will be displayed
753+ * :Clear* delete the breakpoint at the current line
737754
738- ` :Step ` execute the gdb "step" command
739- ` :Over ` execute the gdb "next" command (`:Next ` is a Vim command)
740- ` :Finish ` execute the gdb "finish" command
741- ` :Continue ` execute the gdb "continue" command
742- ` :Stop ` interrupt the program
755+ * :Step* execute the gdb "step" command
756+ * :Over* execute the gdb "next" command (`:Next ` is a Vim command)
757+ * :Finish* execute the gdb "finish" command
758+ * :Continue* execute the gdb "continue" command
759+ * :Stop* interrupt the program
743760
744761If 'mouse' is set the plugin adds a window toolbar with these entries:
745762 Step `:Step `
@@ -750,7 +767,7 @@ If 'mouse' is set the plugin adds a window toolbar with these entries:
750767 Eval `:Evaluate `
751768This way you can use the mouse to perform the most common commands. You need
752769to have the 'mouse' option set to enable mouse clicks.
753-
770+ *:Winbar*
754771You can add the window toolbar in other windows you open with: >
755772 :Winbar
756773
@@ -761,7 +778,7 @@ abandoned.
761778
762779
763780Inspecting variables ~
764- *termdebug-variables*
781+ *termdebug-variables* *:Evaluate *
765782 `:Evaluate ` evaluate the expression under the cursor
766783 `K` same
767784 `:Evaluate ` {expr} evaluate {expr}
@@ -773,9 +790,9 @@ You can usually shorten `:Evaluate` to `:Ev`.
773790
774791Other commands ~
775792 *termdebug-commands*
776- :Gdb jump to the gdb window
777- :Program jump to the window with the running program
778- :Source jump to the window with the source code, create it if there
793+ * :Gdb* jump to the gdb window
794+ * :Program* jump to the window with the running program
795+ * :Source* jump to the window with the source code, create it if there
779796 isn't one
780797
781798
0 commit comments