1- *terminal.txt* For Vim version 8.0. Last change: 2017 Aug 05
1+ *terminal.txt* For Vim version 8.0. Last change: 2017 Aug 10
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -36,7 +36,7 @@ output from the job, also while editing in any other window.
3636
3737Typing ~
3838
39- When the keyboard focus is in the terminal window, typed keys will be send to
39+ When the keyboard focus is in the terminal window, typed keys will be sent to
4040the job. This uses a pty when possible. You can click outside of the
4141terminal window to move keyboard focus elsewhere.
4242
@@ -47,7 +47,8 @@ See |CTRL-W| for more commands.
4747
4848Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
4949 CTRL-W . send a CTRL-W to the job in the terminal
50- CTRL-W N go to Terminal Normal mode, see | Terminal-mode |
50+ CTRL-W N go to Terminal-Normal mode, see | Terminal-mode |
51+ CTRL-\ CTRL-N go to Terminal-Normal mode, see | Terminal-mode |
5152 CTRL-W " {reg} paste register {reg} *CTRL-W_quote*
5253 Also works with the = register to insert the result of
5354 evaluating an expression.
@@ -62,10 +63,8 @@ the job. For example:
6263 'termkey' N go to terminal Normal mode, see below
6364 'termkey' CTRL-N same as CTRL-W N
6465 *t_CTRL-\_CTRL-N*
65- The special key combination CTRL-\ CTRL-N can be used to prefix one Normal
66- mode command. This is especially useful for remote commands, when you don't
67- know whether Vim currently has focus in a terminal window. Note that only one
68- Normal mode command can be used.
66+ The special key combination CTRL-\ CTRL-N can be used to switch to Normal
67+ mode, just like this works in any other mode.
6968
7069
7170Size ~
@@ -76,7 +75,7 @@ See option 'termsize' for controlling the size of the terminal window.
7675
7776Syntax ~
7877
79- :ter[minal] [command] *:ter* *:terminal*
78+ :[range] ter[minal] [options] [ command] *:ter* *:terminal*
8079 Open a new terminal window.
8180
8281 If [command] is provided run it as a job and connect
@@ -86,9 +85,27 @@ Syntax ~
8685 A new buffer will be created, using [command] or
8786 'shell' as the name, prefixed with a "!". If a buffer
8887 by this name already exists a number is added in
89- parenthesis . E.g. if "gdb" exists the second terminal
88+ parentheses . E.g. if "gdb" exists the second terminal
9089 buffer will use "!gdb (1)".
9190
91+ If [range] is given it is used for the terminal size.
92+ One number specifies the number of rows. Unless the
93+ "vertical" modifier is used, then it is the number of
94+ columns.
95+
96+ Two comma separated numbers are used as "rows,cols".
97+ E.g. `:24 ,80 gdb` opens a terminal with 24 rows and 80
98+ columns. However, if the terminal window spans the
99+ Vim window with, there is no vertical split, the Vim
100+ window width is used.
101+ *term++close* *term++open*
102+ Supported [options] are:
103+ ++close The terminal window will close
104+ automatically when the job terminates.
105+ ++open When the job terminates and no window
106+ show it, a window will be opened.
107+ Note that this can be interruptive.
108+
92109When the buffer associated with the terminal is wiped out the job is killed,
93110similar to calling `job_stop(job, "kill")`
94111
@@ -133,23 +150,26 @@ terminal. |term_setsize()| can be used only when in the first or second mode,
133150not when 'termsize' is "rowsXcols".
134151
135152
136- Terminal Normal mode ~
153+ Terminal-Job and Terminal- Normal mode ~
137154 *Terminal-mode*
138155When the job is running the contents of the terminal is under control of the
139- job. That includes the cursor position. The terminal contents can change at
140- any time.
156+ job. That includes the cursor position. Typed keys are sent to the job.
157+ The terminal contents can change at any time. This is called Terminal-Job
158+ mode.
141159
142- Use CTRL-W N (or 'termkey' N) to go to Terminal Normal mode. Now the contents
143- of the terminal window is under control of Vim, the job output is suspended.
160+ Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the
161+ contents of the terminal window is under control of Vim, the job output is
162+ suspended. CTRL-\ CTRL-N does the same.
144163 *E946*
145- In this mode you can move the cursor around with the usual Vim commands,
146- Visually mark text, yank text, etc. But you cannot change the contents of the
147- buffer. The commands that would start insert mode, such as 'i' and 'a',
148- return control of the window to the job. Any pending output will now be
149- displayed.
150-
151- In Terminal mode the statusline and window title show "(Terminal)". If the
152- job ends while in Terminal mode this changes to "(Terminal-finished)".
164+ In Terminal-Normal mode you can move the cursor around with the usual Vim
165+ commands, Visually mark text, yank text, etc. But you cannot change the
166+ contents of the buffer. The commands that would start insert mode, such as
167+ 'i' and 'a', return to Terminal-Job mode. The window will be updated to show
168+ the contents of the terminal.
169+
170+ In Terminal-Normal mode the statusline and window title show "(Terminal)". If
171+ the job ends while in Terminal-Normal mode this changes to
172+ "(Terminal-finished)".
153173
154174
155175Unix ~
0 commit comments