Skip to content

Commit b3307b5

Browse files
committed
patch 8.1.0071: terminal debugger only works with the terminal feature
Problem: Terminal debugger only works with the terminal feature. Solution: Make it also work with a prompt buffer. Makes it possible to use on MS-Windows. Various other improvements. (closes #3012)
1 parent 222cd20 commit b3307b5

3 files changed

Lines changed: 353 additions & 42 deletions

File tree

runtime/doc/terminal.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ If the result is "1" you have it.
3838
Stepping through code |termdebug-stepping|
3939
Inspecting variables |termdebug-variables|
4040
Other commands |termdebug-commands|
41+
Prompt mode |termdebug-prompt|
4142
Communication |termdebug-communication|
4243
Customizing |termdebug-customizing|
4344

@@ -620,6 +621,10 @@ The Terminal debugging plugin can be used to debug a program with gdb and view
620621
the source code in a Vim window. Since this is completely contained inside
621622
Vim this also works remotely over an ssh connection.
622623

624+
When the |+terminal| feature is missing, the plugin will use the "prompt"
625+
buffer type, if possible. The running program will then use a newly opened
626+
terminal window. See |termdebug-prompt| below for details.
627+
623628

624629
Starting ~
625630
*termdebug-starting*
@@ -799,6 +804,23 @@ Other commands ~
799804
isn't one
800805

801806

807+
Prompt mode ~
808+
*termdebug-prompt*
809+
When the |+terminal| feature is not supported and on MS-Windows, gdb will run
810+
in a buffer with 'buftype' set to "prompt". This works slightly differently:
811+
- The gdb window will be in Insert mode while typing commands. Go to Normal
812+
mode with <Esc>, then you can move around in the buffer, copy/paste, etc.
813+
Go back to editing the gdb command with any command that starts Insert mode,
814+
such as `a` or `i`.
815+
- The program being debugged will run in a separate window. On MS-Windows
816+
this is a new console window. On Unix, if the |+terminal| feature is
817+
available a Terminal window will be opened to run the debugged program in.
818+
819+
*termdebug_use_prompt*
820+
Prompt mode can be used even when the |+terminal| feature is present with: >
821+
let g:termdebug_use_prompt = 1
822+
823+
802824
Communication ~
803825
*termdebug-communication*
804826
There is another, hidden, buffer, which is used for Vim to communicate with
@@ -836,6 +858,14 @@ When 'background' is "dark":
836858
hi debugBreakpoint term=reverse ctermbg=red guibg=red
837859

838860

861+
Shorcuts *termdebug_shortcuts*
862+
863+
You can define your own shortcuts (mappings) to control gdb, that can work in
864+
any window, using the TermDebugSendCommand() function. Example: >
865+
map ,w :call TermDebugSendCommand('where')<CR>
866+
The argument is the gdb command.
867+
868+
839869
Popup menu *termdebug_popup*
840870

841871
By default the Termdebug plugin sets 'mousemodel' to "popup_setpos" and adds

0 commit comments

Comments
 (0)