2017-09-17 23:03:31 +02:00
|
|
|
*terminal.txt* For Vim version 8.0. Last change: 2017 Sep 17
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
|
|
|
|
|
|
|
|
Terminal window support *terminal*
|
|
|
|
|
|
|
|
|
|
|
|
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
|
|
|
|
|
2017-07-23 22:12:20 +02:00
|
|
|
The terminal feature is optional, use this to check if your Vim has it: >
|
|
|
|
echo has('terminal')
|
|
|
|
If the result is "1" you have it.
|
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
1. Basic use |terminal-use|
|
|
|
|
2. Remote testing |terminal-testing|
|
|
|
|
3. Debugging |terminal-debug|
|
|
|
|
|
|
|
|
{Vi does not have any of these commands}
|
2017-08-27 16:52:01 +02:00
|
|
|
{only available when compiled with the |+terminal| feature}
|
|
|
|
|
|
|
|
The terminal feature requires the |+multi_byte|, |+job| and |+channel| features.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
1. Basic use *terminal-use*
|
|
|
|
|
|
|
|
This feature is for running a terminal emulator in a Vim window. A job can be
|
|
|
|
started connected to the terminal emulator. For example, to run a shell: >
|
|
|
|
:term bash
|
|
|
|
|
2017-09-09 22:19:47 +02:00
|
|
|
Or to run build command: >
|
|
|
|
:term make myprogram
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
The job runs asynchronously from Vim, the window will be updated to show
|
2017-09-09 22:19:47 +02:00
|
|
|
output from the job, also while editing in another window.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-07-30 16:52:24 +02:00
|
|
|
|
2017-07-28 13:48:34 +02:00
|
|
|
Typing ~
|
2017-09-14 20:37:57 +02:00
|
|
|
*terminal-typing*
|
2017-08-10 23:15:19 +02:00
|
|
|
When the keyboard focus is in the terminal window, typed keys will be sent to
|
2017-07-28 13:48:34 +02:00
|
|
|
the job. This uses a pty when possible. You can click outside of the
|
|
|
|
terminal window to move keyboard focus elsewhere.
|
|
|
|
|
2017-07-30 16:52:24 +02:00
|
|
|
CTRL-W can be used to navigate between windows and other CTRL-W commands, e.g.:
|
|
|
|
CTRL-W CTRL-W move focus to the next window
|
|
|
|
CTRL-W : enter an Ex command
|
|
|
|
See |CTRL-W| for more commands.
|
|
|
|
|
|
|
|
Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
|
|
|
|
CTRL-W . send a CTRL-W to the job in the terminal
|
2017-08-10 23:15:19 +02:00
|
|
|
CTRL-W N go to Terminal-Normal mode, see |Terminal-mode|
|
|
|
|
CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode|
|
2017-08-01 20:44:53 +02:00
|
|
|
CTRL-W " {reg} paste register {reg} *CTRL-W_quote*
|
|
|
|
Also works with the = register to insert the result of
|
|
|
|
evaluating an expression.
|
2017-08-18 22:57:06 +02:00
|
|
|
CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C|
|
2017-07-30 16:52:24 +02:00
|
|
|
|
|
|
|
See option 'termkey' for specifying another key instead of CTRL-W that
|
|
|
|
will work like CTRL-W. However, typing 'termkey' twice sends 'termkey' to
|
|
|
|
the job. For example:
|
|
|
|
'termkey' CTRL-W move focus to the next window
|
|
|
|
'termkey' : enter an Ex command
|
|
|
|
'termkey' 'termkey' send 'termkey' to the job in the terminal
|
|
|
|
'termkey' . send a CTRL-W to the job in the terminal
|
|
|
|
'termkey' N go to terminal Normal mode, see below
|
|
|
|
'termkey' CTRL-N same as CTRL-W N
|
2017-08-18 22:57:06 +02:00
|
|
|
'termkey' CTRL-C same as |t_CTRL-W_CTRL-C|
|
2017-08-05 14:10:48 +02:00
|
|
|
*t_CTRL-\_CTRL-N*
|
2017-08-10 23:15:19 +02:00
|
|
|
The special key combination CTRL-\ CTRL-N can be used to switch to Normal
|
|
|
|
mode, just like this works in any other mode.
|
2017-08-18 22:57:06 +02:00
|
|
|
*t_CTRL-W_CTRL-C*
|
|
|
|
CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a
|
|
|
|
CTRL-BREAK will also kill the job.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
If you type CTRL-C the effect depends on what the pty has been configured to
|
|
|
|
do. For simple commands this causes a SIGINT to be sent to the job, which
|
|
|
|
would end it. Other commands may ignore the SIGINT or handle the CTRL-C
|
|
|
|
themselves (like Vim does).
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-09-14 20:37:57 +02:00
|
|
|
To change the keys you type use terminal mode mappings, see |:tmap|.
|
|
|
|
These are defined like any mapping, but apply only when typing keys that are
|
|
|
|
sent to the job running in the terminal.
|
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
|
|
|
|
Size and color ~
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-07-15 13:53:23 +02:00
|
|
|
See option 'termsize' for controlling the size of the terminal window.
|
|
|
|
(TODO: scrolling when the terminal is larger than the window)
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-09-14 16:10:38 +02:00
|
|
|
The job running in the terminal can change the colors. The default foreground
|
|
|
|
and background colors are taken from Vim, the Normal highlight group.
|
|
|
|
|
|
|
|
For a color terminal the 'background' option is used to decide whether the
|
|
|
|
terminal window will start with a white or black background.
|
|
|
|
|
|
|
|
To use a different color the Terminal highlight group can be used: >
|
|
|
|
hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue
|
2017-08-18 22:57:06 +02:00
|
|
|
|
2017-07-30 16:52:24 +02:00
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
Syntax ~
|
2017-07-24 22:29:21 +02:00
|
|
|
|
2017-08-10 23:15:19 +02:00
|
|
|
:[range]ter[minal] [options] [command] *:ter* *:terminal*
|
2017-07-24 22:29:21 +02:00
|
|
|
Open a new terminal window.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
If [command] is provided run it as a job and connect
|
|
|
|
the input and output to the terminal.
|
|
|
|
If [command] is not given the 'shell' option is used.
|
2017-08-27 16:52:01 +02:00
|
|
|
if [command] is NONE no job is started, the pty of the
|
|
|
|
terminal can be used by a command like gdb.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
A new buffer will be created, using [command] or
|
2017-08-01 20:44:53 +02:00
|
|
|
'shell' as the name, prefixed with a "!". If a buffer
|
|
|
|
by this name already exists a number is added in
|
2017-08-10 23:15:19 +02:00
|
|
|
parentheses. E.g. if "gdb" exists the second terminal
|
2017-08-01 20:44:53 +02:00
|
|
|
buffer will use "!gdb (1)".
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-08-20 18:09:14 +02:00
|
|
|
If [range] is given the specified lines are used as
|
|
|
|
input for the job. It will not be possible to type
|
2017-09-09 22:19:47 +02:00
|
|
|
keys in the terminal window. For MS-Windows see the
|
|
|
|
++eof argument below.
|
2017-08-10 23:15:19 +02:00
|
|
|
|
|
|
|
Two comma separated numbers are used as "rows,cols".
|
|
|
|
E.g. `:24,80gdb` opens a terminal with 24 rows and 80
|
|
|
|
columns. However, if the terminal window spans the
|
|
|
|
Vim window with, there is no vertical split, the Vim
|
|
|
|
window width is used.
|
|
|
|
*term++close* *term++open*
|
|
|
|
Supported [options] are:
|
|
|
|
++close The terminal window will close
|
|
|
|
automatically when the job terminates.
|
|
|
|
++open When the job terminates and no window
|
2017-08-12 14:32:32 +02:00
|
|
|
shows it, a window will be opened.
|
2017-08-10 23:15:19 +02:00
|
|
|
Note that this can be interruptive.
|
2017-08-12 14:32:32 +02:00
|
|
|
++curwin Open the terminal in the current
|
|
|
|
window, do not split the current
|
|
|
|
window. Fails if the current buffer
|
|
|
|
cannot be |abandon|ed.
|
|
|
|
++hidden Open the terminal in a hidden buffer,
|
|
|
|
no window will be used.
|
2017-08-20 18:09:14 +02:00
|
|
|
++rows={height} Use {height} for the terminal window
|
|
|
|
height.
|
|
|
|
++cols={width} Use {width} for the terminal window
|
|
|
|
width.
|
2017-09-09 22:19:47 +02:00
|
|
|
++eof={text} when using [range]: text to send after
|
|
|
|
the last line was written. Cannot
|
|
|
|
contain white space. A CR is
|
|
|
|
appended. For MS-Windows the default
|
|
|
|
is to send CTRL-D.
|
2017-09-02 16:28:36 +02:00
|
|
|
E.g. for a shell use "++eof=exit" and
|
|
|
|
for Python "++eof=exit()". Special
|
|
|
|
codes can be used like with `:map`,
|
|
|
|
e.g. "<C-Z>" for CTRL-Z.
|
2017-08-12 14:32:32 +02:00
|
|
|
|
|
|
|
If you want to use more options use the |term_start()|
|
|
|
|
function.
|
2017-08-10 23:15:19 +02:00
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
When the buffer associated with the terminal is unloaded or wiped out the job
|
|
|
|
is killed, similar to calling `job_stop(job, "kill")`
|
2017-07-23 22:12:20 +02:00
|
|
|
|
2017-08-29 22:44:59 +02:00
|
|
|
So long as the job is running the window behaves like it contains a modified
|
2017-09-02 16:28:36 +02:00
|
|
|
buffer. Trying to close the window with `CTRL-W :quit` fails. When using
|
|
|
|
`CTRL-W :quit!` the job is ended. The text in the window is lost. The buffer
|
|
|
|
still exists, but getting it in a window with `:buffer` will show an empty
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
Trying to close the window with `CTRL-W :close` also fails. Using
|
|
|
|
`CTRL-W :close!` will close the window and make the buffer hidden.
|
2017-08-29 22:44:59 +02:00
|
|
|
|
|
|
|
You can use `CTRL-W :hide` to close the terminal window and make the buffer
|
|
|
|
hidden, the job keeps running. The `:buffer` command can be used to turn the
|
|
|
|
current window into a terminal window. If there are unsaved changes this
|
|
|
|
fails, use ! to force, as usual.
|
2017-08-12 14:32:32 +02:00
|
|
|
|
|
|
|
To have a background job run without a window, and open the window when it's
|
|
|
|
done, use options like this: >
|
|
|
|
:term ++hidden ++open make
|
|
|
|
Note that the window will open at an unexpected moment, this will interrupt
|
|
|
|
what you are doing.
|
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
*E947* *E948*
|
2017-08-05 14:50:12 +02:00
|
|
|
So long as the job is running, the buffer is considered modified and Vim
|
|
|
|
cannot be quit easily, see |abandon|.
|
2017-08-01 20:44:53 +02:00
|
|
|
|
|
|
|
When the job has finished and no changes were made to the buffer: closing the
|
|
|
|
window will wipe out the buffer.
|
|
|
|
|
|
|
|
Before changes can be made to a terminal buffer, the 'modifiable' option must
|
|
|
|
be set. This is only possible when the job has finished. At the first change
|
|
|
|
the buffer will become a normal buffer and the highlighting is removed.
|
|
|
|
You may want to change the buffer name with |:file| to be able to write, since
|
|
|
|
the buffer name will still be set to the command.
|
|
|
|
|
2017-07-23 22:12:20 +02:00
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
Resizing ~
|
|
|
|
|
|
|
|
The size of the terminal can be in one of three modes:
|
|
|
|
|
|
|
|
1. The 'termsize' option is empty: The terminal size follows the window size.
|
|
|
|
The minimal size is 2 screen lines with 10 cells.
|
|
|
|
|
|
|
|
2. The 'termsize' option is "rows*cols", where "rows" is the minimal number of
|
2017-07-24 22:29:21 +02:00
|
|
|
screen rows and "cols" is the minimal number of cells.
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
3. The 'termsize' option is "rowsXcols" (where the x is upper or lower case).
|
|
|
|
The terminal size is fixed to the specified number of screen lines and
|
|
|
|
cells. If the window is bigger there will be unused empty space.
|
|
|
|
|
|
|
|
If the window is smaller than the terminal size, only part of the terminal can
|
|
|
|
be seen (the lower-left part).
|
|
|
|
|
|
|
|
The |term_getsize()| function can be used to get the current size of the
|
|
|
|
terminal. |term_setsize()| can be used only when in the first or second mode,
|
|
|
|
not when 'termsize' is "rowsXcols".
|
|
|
|
|
2017-07-23 22:12:20 +02:00
|
|
|
|
2017-08-10 23:15:19 +02:00
|
|
|
Terminal-Job and Terminal-Normal mode ~
|
2017-07-30 16:52:24 +02:00
|
|
|
*Terminal-mode*
|
|
|
|
When the job is running the contents of the terminal is under control of the
|
2017-08-10 23:15:19 +02:00
|
|
|
job. That includes the cursor position. Typed keys are sent to the job.
|
|
|
|
The terminal contents can change at any time. This is called Terminal-Job
|
|
|
|
mode.
|
2017-07-30 16:52:24 +02:00
|
|
|
|
2017-08-10 23:15:19 +02:00
|
|
|
Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the
|
|
|
|
contents of the terminal window is under control of Vim, the job output is
|
|
|
|
suspended. CTRL-\ CTRL-N does the same.
|
2017-09-14 20:37:57 +02:00
|
|
|
|
2017-09-17 23:03:31 +02:00
|
|
|
Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by
|
2017-09-14 20:37:57 +02:00
|
|
|
|term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are.
|
|
|
|
|
2017-07-30 16:52:24 +02:00
|
|
|
*E946*
|
2017-08-10 23:15:19 +02:00
|
|
|
In Terminal-Normal mode you can move the cursor around with the usual Vim
|
|
|
|
commands, Visually mark text, yank text, etc. But you cannot change the
|
|
|
|
contents of the buffer. The commands that would start insert mode, such as
|
|
|
|
'i' and 'a', return to Terminal-Job mode. The window will be updated to show
|
2017-09-17 23:03:31 +02:00
|
|
|
the contents of the terminal. |:startinsert| is ineffective.
|
2017-08-10 23:15:19 +02:00
|
|
|
|
|
|
|
In Terminal-Normal mode the statusline and window title show "(Terminal)". If
|
|
|
|
the job ends while in Terminal-Normal mode this changes to
|
|
|
|
"(Terminal-finished)".
|
2017-07-30 16:52:24 +02:00
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
It is not possible to enter Insert mode from Terminal-Job mode.
|
|
|
|
|
2017-07-30 16:52:24 +02:00
|
|
|
|
2017-08-27 16:52:01 +02:00
|
|
|
Cursor style ~
|
|
|
|
|
|
|
|
By default the cursor in the terminal window uses a not blinking block. The
|
|
|
|
normal xterm escape sequences can be used to change the blinking state and the
|
|
|
|
shape. Once focus leaves the terminal window Vim will restore the original
|
|
|
|
cursor.
|
|
|
|
|
|
|
|
An exception is when xterm is started with the "-bc" argument, or another way
|
|
|
|
that causes the cursor to blink. This actually means that the blinking flag
|
|
|
|
is inverted. Since Vim cannot detect this, the terminal window cursor
|
|
|
|
blinking will also be inverted.
|
|
|
|
|
|
|
|
|
2017-07-23 22:12:20 +02:00
|
|
|
Unix ~
|
|
|
|
|
|
|
|
On Unix a pty is used to make it possible to run all kinds of commands. You
|
|
|
|
can even run Vim in the terminal! That's used for debugging, see below.
|
|
|
|
|
2017-08-01 20:44:53 +02:00
|
|
|
Environment variables are used to pass information to the running job:
|
|
|
|
TERM name of the terminal, 'term'
|
|
|
|
ROWS number of rows in the terminal initially
|
|
|
|
LINES same as ROWS
|
|
|
|
COLUMNS number of columns in the terminal initially
|
|
|
|
COLORS number of colors, 't_Co' (256*256*256 in the GUI)
|
|
|
|
VIM_SERVERNAME v:servername
|
|
|
|
|
|
|
|
The |client-server| feature can be used to communicate with the Vim instance
|
|
|
|
where the job was started. This only works when v:servername is not empty.
|
|
|
|
If needed you can set it with: >
|
|
|
|
call remote_startserver('vim-server')
|
|
|
|
|
|
|
|
In the job you can then do something like: >
|
|
|
|
vim --servername $VIM_SERVERNAME --remote +123 some_file.c
|
|
|
|
This will open the file "some_file.c" and put the cursor on line 123.
|
|
|
|
|
2017-07-23 22:12:20 +02:00
|
|
|
|
|
|
|
MS-Windows ~
|
|
|
|
|
2017-07-24 22:29:21 +02:00
|
|
|
On MS-Windows winpty is used to make it possible to run all kind of commands.
|
|
|
|
Obviously, they must be commands that run in a terminal, not open their own
|
|
|
|
window.
|
|
|
|
|
|
|
|
You need the following two files from winpty:
|
|
|
|
|
|
|
|
winpty.dll
|
|
|
|
winpty-agent.exe
|
|
|
|
|
|
|
|
You can download them from the following page:
|
|
|
|
|
|
|
|
https://github.com/rprichard/winpty
|
|
|
|
|
2017-08-18 22:57:06 +02:00
|
|
|
Just put the files somewhere in your PATH. You can set the 'winptydll' option
|
|
|
|
to point to the right file, if needed. If you have both the 32-bit and 64-bit
|
|
|
|
version, rename to winpty32.dll and winpty64.dll to match the way Vim was
|
|
|
|
build.
|
2017-07-23 22:12:20 +02:00
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
==============================================================================
|
|
|
|
2. Remote testing *terminal-testing*
|
|
|
|
|
|
|
|
Most Vim tests execute a script inside Vim. For some tests this does not
|
|
|
|
work, running the test interferes with the code being tested. To avoid this
|
|
|
|
Vim is executed in a terminal window. The test sends keystrokes to it and
|
|
|
|
inspects the resulting screen state.
|
|
|
|
|
|
|
|
Functions ~
|
|
|
|
|
2017-09-14 20:37:57 +02:00
|
|
|
term_sendkeys() send keystrokes to a terminal (not subject to tmap)
|
2017-07-07 11:54:15 +02:00
|
|
|
term_wait() wait for screen to be updated
|
|
|
|
term_scrape() inspect terminal screen
|
|
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
3. Debugging *terminal-debug*
|
|
|
|
|
|
|
|
The Terminal debugging plugin can be used to debug a program with gdb and view
|
2017-09-09 22:19:47 +02:00
|
|
|
the source code in a Vim window. Since this is completely contained inside
|
|
|
|
Vim this also works remotely over an ssh connection.
|
|
|
|
|
|
|
|
|
|
|
|
Starting ~
|
2017-07-07 11:54:15 +02:00
|
|
|
|
2017-08-27 16:52:01 +02:00
|
|
|
Load the plugin with this command: >
|
|
|
|
packadd termdebug
|
2017-09-09 22:19:47 +02:00
|
|
|
< *:Termdebug*
|
2017-08-27 16:52:01 +02:00
|
|
|
To start debugging use `:TermDebug` folowed by the command name, for example: >
|
2017-07-07 11:54:15 +02:00
|
|
|
:TermDebug vim
|
|
|
|
|
2017-08-27 16:52:01 +02:00
|
|
|
This opens two windows:
|
2017-09-10 19:14:31 +02:00
|
|
|
gdb window A terminal window in which "gdb vim" is executed. Here you
|
|
|
|
can directly interact with gdb. The buffer name is "!gdb".
|
|
|
|
program window A terminal window for the executed program. When "run" is
|
|
|
|
used in gdb the program I/O will happen in this window, so
|
|
|
|
that it does not interfere with controlling gdb. The buffer
|
|
|
|
name is "gdb program".
|
2017-09-09 22:19:47 +02:00
|
|
|
|
|
|
|
The current window is used to show the source code. When gdb pauses the
|
|
|
|
source file location will be displayed, if possible. A sign is used to
|
|
|
|
highlight the current position (using highlight group debugPC).
|
|
|
|
|
|
|
|
If the buffer in the current window is modified, another window will be opened
|
|
|
|
to display the current gdb position.
|
|
|
|
|
|
|
|
Focus the terminal of the executed program to interact with it. This works
|
|
|
|
the same as any command running in a terminal window.
|
2017-08-27 16:52:01 +02:00
|
|
|
|
2017-09-10 19:14:31 +02:00
|
|
|
When the debugger ends, typically by typing "quit" in the gdb window, the two
|
|
|
|
opened windows are closed.
|
2017-08-27 16:52:01 +02:00
|
|
|
|
|
|
|
|
2017-09-09 22:19:47 +02:00
|
|
|
Stepping through code ~
|
|
|
|
|
|
|
|
Put focus on the gdb window to type commands there. Some common ones are:
|
|
|
|
- CTRL-C interrupt the program
|
|
|
|
- next execute the current line and stop at the next line
|
|
|
|
- step execute the current line and stop at the next statement, entering
|
|
|
|
functions
|
|
|
|
- finish execute until leaving the current function
|
|
|
|
- where show the stack
|
|
|
|
- frame N go to the Nth stack frame
|
|
|
|
- continue continue execution
|
|
|
|
|
2017-09-10 19:14:31 +02:00
|
|
|
In the window showing the source code some commands can used to control gdb:
|
|
|
|
:Break set a breakpoint at the current line; a sign will be displayed
|
|
|
|
:Delete delete a breakpoint at the current line
|
|
|
|
:Step execute the gdb "step" command
|
|
|
|
:Over execute the gdb "next" command (:Next is a Vim command)
|
|
|
|
:Finish execute the gdb "finish" command
|
|
|
|
:Continue execute the gdb "continue" command
|
|
|
|
|
2017-09-17 23:03:31 +02:00
|
|
|
The plugin adds a window toolbar with these entries:
|
|
|
|
Step :Step
|
|
|
|
Next :Over
|
|
|
|
Finish :Finish
|
|
|
|
Cont :Continue
|
|
|
|
Eval :Evaluate
|
|
|
|
This way you can use the mouse to perform the most common commands.
|
|
|
|
|
2017-09-10 19:14:31 +02:00
|
|
|
|
|
|
|
Inspecting variables ~
|
|
|
|
|
|
|
|
:Evaluate evaluate the expression under the cursor
|
|
|
|
K same
|
|
|
|
:Evaluate {expr} evaluate {expr}
|
|
|
|
:'<,'>Evaluate evaluate the Visually selected text
|
|
|
|
|
|
|
|
This is similar to using "print" in the gdb window.
|
|
|
|
|
|
|
|
|
|
|
|
Other commands ~
|
|
|
|
|
|
|
|
:Gdb jump to the gdb window
|
|
|
|
:Program jump to the window with the running program
|
2017-09-09 22:19:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
Communication ~
|
|
|
|
|
|
|
|
There is another, hidden, buffer, which is used for Vim to communicate with
|
|
|
|
gdb. The buffer name is "gdb communication". Do not delete this buffer, it
|
|
|
|
will break the debugger.
|
|
|
|
|
|
|
|
|
2017-08-27 16:52:01 +02:00
|
|
|
Customizing ~
|
|
|
|
|
2017-09-09 22:19:47 +02:00
|
|
|
To change the name of the gdb command, set the "termdebugger" variable before
|
|
|
|
invoking `:Termdebug`: >
|
|
|
|
let termdebugger = "mygdb"
|
|
|
|
Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI
|
|
|
|
interface.
|
|
|
|
|
|
|
|
The color of the signs can be adjusted with these highlight groups:
|
|
|
|
- debugPC the current position
|
|
|
|
- debugBreakpoint a breakpoint
|
|
|
|
|
|
|
|
The defaults are, when 'background' is "light":
|
|
|
|
hi debugPC term=reverse ctermbg=lightblue guibg=lightblue
|
|
|
|
hi debugBreakpoint term=reverse ctermbg=red guibg=red
|
|
|
|
|
|
|
|
When 'background' is "dark":
|
|
|
|
hi debugPC term=reverse ctermbg=darkblue guibg=darkblue
|
|
|
|
hi debugBreakpoint term=reverse ctermbg=red guibg=red
|
|
|
|
|
2017-09-14 16:10:38 +02:00
|
|
|
To change the width of the Vim window when debugging starts, and use a
|
|
|
|
vertical split: >
|
|
|
|
let g:termdebug_wide = 163
|
|
|
|
This will set &columns to 163 when :Termdebug is used. The value is restored
|
|
|
|
when quitting the debugger.
|
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
vim:tw=78:ts=8:ft=help:norl:
|