annotate runtime/doc/terminal.txt @ 12826:f690da1b3c04

Update runtime files. commit https://github.com/vim/vim/commit/7f2e9d7c9cdfc5201a899b7b610edf64bf80c45f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 11 20:58:53 2017 +0100 Update runtime files.
author Christian Brabandt <cb@256bit.org>
date Sat, 11 Nov 2017 21:00:05 +0100
parents 3b26420fc639
children db9ffed7e1fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
1 *terminal.txt* For Vim version 8.0. Last change: 2017 Nov 09
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 Terminal window support *terminal*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
12 The terminal feature is optional, use this to check if your Vim has it: >
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
13 echo has('terminal')
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
14 If the result is "1" you have it.
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
15
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
17 1. Basic use |terminal-use|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
18 Typing |terminal-typing|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
19 Size and color |terminal-size-color|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
20 Syntax |:terminal|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
21 Resizing |terminal-resizing|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
22 Terminal Modes |Terminal-mode|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
23 Cursor style |terminal-cursor-style|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
24 Special keys |terminal-special-keys|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
25 Unix |terminal-unix|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
26 MS-Windows |terminal-ms-windows|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
27 2. Remote testing |terminal-testing|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
28 3. Debugging |terminal-debug|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
29 Starting |termdebug-starting|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
30 Example session |termdebug-example|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
31 Stepping through code |termdebug-stepping|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
32 Inspecting variables |termdebug-variables|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
33 Other commands |termdebug-commands|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
34 Communication |termdebug-communication|
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
35 Customizing |termdebug-customizing|
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 {Vi does not have any of these commands}
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
38 {only available when compiled with the |+terminal| feature}
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
39
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
40 The terminal feature requires the |+multi_byte|, |+job| and |+channel| features.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 ==============================================================================
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 1. Basic use *terminal-use*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 This feature is for running a terminal emulator in a Vim window. A job can be
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 started connected to the terminal emulator. For example, to run a shell: >
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 :term bash
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
49 Or to run build command: >
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
50 :term make myprogram
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 The job runs asynchronously from Vim, the window will be updated to show
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
53 output from the job, also while editing in another window.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
55
11814
d3d0db111d17 patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents: 11774
diff changeset
56 Typing ~
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
57 *terminal-typing*
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
58 When the keyboard focus is in the terminal window, typed keys will be sent to
11814
d3d0db111d17 patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents: 11774
diff changeset
59 the job. This uses a pty when possible. You can click outside of the
d3d0db111d17 patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents: 11774
diff changeset
60 terminal window to move keyboard focus elsewhere.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
62 CTRL-W can be used to navigate between windows and other CTRL-W commands, e.g.:
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
63 CTRL-W CTRL-W move focus to the next window
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
64 CTRL-W : enter an Ex command
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
65 See |CTRL-W| for more commands.
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
66
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
67 Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
68 CTRL-W . send a CTRL-W to the job in the terminal
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
69 CTRL-W N go to Terminal-Normal mode, see |Terminal-mode|
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
70 CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode|
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
71 CTRL-W " {reg} paste register {reg} *CTRL-W_quote*
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
72 Also works with the = register to insert the result of
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
73 evaluating an expression.
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
74 CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C|
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
76 See option 'termkey' for specifying another key instead of CTRL-W that
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
77 will work like CTRL-W. However, typing 'termkey' twice sends 'termkey' to
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
78 the job. For example:
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
79 'termkey' CTRL-W move focus to the next window
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
80 'termkey' : enter an Ex command
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
81 'termkey' 'termkey' send 'termkey' to the job in the terminal
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
82 'termkey' . send a CTRL-W to the job in the terminal
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
83 'termkey' N go to terminal Normal mode, see below
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
84 'termkey' CTRL-N same as CTRL-W N
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
85 'termkey' CTRL-C same as |t_CTRL-W_CTRL-C|
11965
a932d3da41c8 patch 8.0.0863: a remote command does not work in the terminal window
Christian Brabandt <cb@256bit.org>
parents: 11914
diff changeset
86 *t_CTRL-\_CTRL-N*
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
87 The special key combination CTRL-\ CTRL-N can be used to switch to Normal
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
88 mode, just like this works in any other mode.
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
89 *t_CTRL-W_CTRL-C*
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
90 CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
91 CTRL-BREAK will also kill the job.
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
92
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
93 If you type CTRL-C the effect depends on what the pty has been configured to
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
94 do. For simple commands this causes a SIGINT to be sent to the job, which
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
95 would end it. Other commands may ignore the SIGINT or handle the CTRL-C
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
96 themselves (like Vim does).
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
97
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
98 To change the keys you type use terminal mode mappings, see |:tmap|.
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
99 These are defined like any mapping, but apply only when typing keys that are
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
100 sent to the job running in the terminal. For example, to make Escape switch
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
101 to Terminal-Normal mode: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
102 tnoremap <Esc> <C-W>N
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 12559
diff changeset
103 < *options-in-terminal*
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
104 After opening the terminal window and setting 'buftype' to "terminal" the
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
105 BufWinEnter autocommand event is triggered. This makes it possible to set
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
106 options specifically for the window and buffer. Example: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
107 au BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
108
11814
d3d0db111d17 patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents: 11774
diff changeset
109
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
110 Size and color ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
111 *terminal-size-color*
11659
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
112 See option 'termsize' for controlling the size of the terminal window.
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
113 (TODO: scrolling when the terminal is larger than the window)
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114
12455
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
115 The job running in the terminal can change the colors. The default foreground
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
116 and background colors are taken from Vim, the Normal highlight group.
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
117
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
118 For a color terminal the 'background' option is used to decide whether the
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
119 terminal window will start with a white or black background.
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
120
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
121 To use a different color the Terminal highlight group can be used: >
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
122 hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
123
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
124
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 Syntax ~
11774
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
126
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
127 :[range]ter[minal] [options] [command] *:ter* *:terminal*
11774
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
128 Open a new terminal window.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 If [command] is provided run it as a job and connect
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 the input and output to the terminal.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 If [command] is not given the 'shell' option is used.
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
133 if [command] is NONE no job is started, the pty of the
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
134 terminal can be used by a command like gdb.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 A new buffer will be created, using [command] or
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
137 'shell' as the name, prefixed with a "!". If a buffer
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
138 by this name already exists a number is added in
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
139 parentheses. E.g. if "gdb" exists the second terminal
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
140 buffer will use "!gdb (1)".
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141
12192
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
142 If [range] is given the specified lines are used as
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
143 input for the job. It will not be possible to type
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
144 keys in the terminal window. For MS-Windows see the
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
145 ++eof argument below.
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
146
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
147 Two comma separated numbers are used as "rows,cols".
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
148 E.g. `:24,80gdb` opens a terminal with 24 rows and 80
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
149 columns. However, if the terminal window spans the
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
150 Vim window with, there is no vertical split, the Vim
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
151 window width is used.
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
152 *term++close* *term++open*
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
153 Supported [options] are:
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
154 ++close The terminal window will close
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
155 automatically when the job terminates.
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
156 ++open When the job terminates and no window
12064
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
157 shows it, a window will be opened.
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
158 Note that this can be interruptive.
12064
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
159 ++curwin Open the terminal in the current
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
160 window, do not split the current
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
161 window. Fails if the current buffer
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
162 cannot be |abandon|ed.
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
163 ++hidden Open the terminal in a hidden buffer,
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
164 no window will be used.
12192
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
165 ++rows={height} Use {height} for the terminal window
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
166 height.
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
167 ++cols={width} Use {width} for the terminal window
6947d5bcf57f patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents: 12160
diff changeset
168 width.
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
169 ++eof={text} when using [range]: text to send after
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
170 the last line was written. Cannot
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
171 contain white space. A CR is
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
172 appended. For MS-Windows the default
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
173 is to send CTRL-D.
12311
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
174 E.g. for a shell use "++eof=exit" and
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
175 for Python "++eof=exit()". Special
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
176 codes can be used like with `:map`,
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
177 e.g. "<C-Z>" for CTRL-Z.
12064
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
178
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
179 If you want to use more options use the |term_start()|
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
180 function.
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
181
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
182 When the buffer associated with the terminal is unloaded or wiped out the job
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
183 is killed, similar to calling `job_stop(job, "kill")`
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
184
12267
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
185 So long as the job is running the window behaves like it contains a modified
12311
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
186 buffer. Trying to close the window with `CTRL-W :quit` fails. When using
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
187 `CTRL-W :quit!` the job is ended. The text in the window is lost. The buffer
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
188 still exists, but getting it in a window with `:buffer` will show an empty
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
189 buffer.
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
190
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
191 Trying to close the window with `CTRL-W :close` also fails. Using
66fa8eabbd6e patch 8.0.1035: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 12267
diff changeset
192 `CTRL-W :close!` will close the window and make the buffer hidden.
12267
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
193
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
194 You can use `CTRL-W :hide` to close the terminal window and make the buffer
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
195 hidden, the job keeps running. The `:buffer` command can be used to turn the
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
196 current window into a terminal window. If there are unsaved changes this
e3bde71afff0 patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
197 fails, use ! to force, as usual.
12064
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
198
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
199 To have a background job run without a window, and open the window when it's
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
200 done, use options like this: >
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
201 :term ++hidden ++open make
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
202 Note that the window will open at an unexpected moment, this will interrupt
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
203 what you are doing.
407a475c67fd patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents: 12031
diff changeset
204
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
205 *E947* *E948*
11967
12833414cc02 patch 8.0.0864: cannot specify the name of a terminal
Christian Brabandt <cb@256bit.org>
parents: 11965
diff changeset
206 So long as the job is running, the buffer is considered modified and Vim
12833414cc02 patch 8.0.0864: cannot specify the name of a terminal
Christian Brabandt <cb@256bit.org>
parents: 11965
diff changeset
207 cannot be quit easily, see |abandon|.
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
208
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
209 When the job has finished and no changes were made to the buffer: closing the
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
210 window will wipe out the buffer.
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
211
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
212 Before changes can be made to a terminal buffer, the 'modifiable' option must
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
213 be set. This is only possible when the job has finished. At the first change
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
214 the buffer will become a normal buffer and the highlighting is removed.
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
215 You may want to change the buffer name with |:file| to be able to write, since
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
216 the buffer name will still be set to the command.
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
217
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
218
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 Resizing ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
220 *terminal-resizing*
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 The size of the terminal can be in one of three modes:
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 1. The 'termsize' option is empty: The terminal size follows the window size.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 The minimal size is 2 screen lines with 10 cells.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 2. The 'termsize' option is "rows*cols", where "rows" is the minimal number of
11774
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
227 screen rows and "cols" is the minimal number of cells.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 3. The 'termsize' option is "rowsXcols" (where the x is upper or lower case).
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 The terminal size is fixed to the specified number of screen lines and
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 cells. If the window is bigger there will be unused empty space.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 If the window is smaller than the terminal size, only part of the terminal can
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 be seen (the lower-left part).
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 The |term_getsize()| function can be used to get the current size of the
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 terminal. |term_setsize()| can be used only when in the first or second mode,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 not when 'termsize' is "rowsXcols".
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
240
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
241 Terminal-Job and Terminal-Normal mode ~
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
242 *Terminal-mode*
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
243 When the job is running the contents of the terminal is under control of the
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
244 job. That includes the cursor position. Typed keys are sent to the job.
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
245 The terminal contents can change at any time. This is called Terminal-Job
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
246 mode.
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
247
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
248 Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
249 contents of the terminal window is under control of Vim, the job output is
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
250 suspended. CTRL-\ CTRL-N does the same.
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
251
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
252 Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
253 |term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are.
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
254
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
255 *E946*
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
256 In Terminal-Normal mode you can move the cursor around with the usual Vim
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
257 commands, Visually mark text, yank text, etc. But you cannot change the
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
258 contents of the buffer. The commands that would start insert mode, such as
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
259 'i' and 'a', return to Terminal-Job mode. The window will be updated to show
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
260 the contents of the terminal. |:startinsert| is ineffective.
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
261
12031
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
262 In Terminal-Normal mode the statusline and window title show "(Terminal)". If
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
263 the job ends while in Terminal-Normal mode this changes to
9897241c08b5 patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents: 11967
diff changeset
264 "(Terminal-finished)".
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
265
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
266 It is not possible to enter Insert mode from Terminal-Job mode.
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
267
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
268
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
269 Cursor style ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
270 *terminal-cursor-style*
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
271 By default the cursor in the terminal window uses a not blinking block. The
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
272 normal xterm escape sequences can be used to change the blinking state and the
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
273 shape. Once focus leaves the terminal window Vim will restore the original
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
274 cursor.
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
275
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
276 An exception is when xterm is started with the "-bc" argument, or another way
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
277 that causes the cursor to blink. This actually means that the blinking flag
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
278 is inverted. Since Vim cannot detect this, the terminal window cursor
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
279 blinking will also be inverted.
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
280
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
281
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
282 Special keys ~
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
283 *terminal-special-keys*
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
284 Since the terminal emulator simulates an xterm, only escape sequences that
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
285 both Vim and xterm recognize will be available in the terminal window. If you
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
286 want to pass on other escape sequences to the job running in the terminal you
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
287 need to set up forwarding. Example: >
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
288 tmap <expr> <Esc>]b SendToTerm("\<Esc>]b")
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
289 func SendToTerm(what)
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
290 call term_sendkeys('', a:what)
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
291 return ''
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
292 endfunc
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
293
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
294
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
295 Unix ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
296 *terminal-unix*
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
297 On Unix a pty is used to make it possible to run all kinds of commands. You
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
298 can even run Vim in the terminal! That's used for debugging, see below.
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
299
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
300 Environment variables are used to pass information to the running job:
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
301 TERM name of the terminal, 'term'
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
302 ROWS number of rows in the terminal initially
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
303 LINES same as ROWS
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
304 COLUMNS number of columns in the terminal initially
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
305 COLORS number of colors, 't_Co' (256*256*256 in the GUI)
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
306 VIM_SERVERNAME v:servername
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
307
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
308 The |client-server| feature can be used to communicate with the Vim instance
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
309 where the job was started. This only works when v:servername is not empty.
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
310 If needed you can set it with: >
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
311 call remote_startserver('vim-server')
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
312
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
313 In the job you can then do something like: >
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
314 vim --servername $VIM_SERVERNAME --remote +123 some_file.c
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
315 This will open the file "some_file.c" and put the cursor on line 123.
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 11866
diff changeset
316
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
317
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
318 MS-Windows ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
319 *terminal-ms-windows*
11774
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
320 On MS-Windows winpty is used to make it possible to run all kind of commands.
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
321 Obviously, they must be commands that run in a terminal, not open their own
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
322 window.
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
323
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
324 You need the following two files from winpty:
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
325
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
326 winpty.dll
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
327 winpty-agent.exe
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
328
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
329 You can download them from the following page:
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
330
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
331 https://github.com/rprichard/winpty
edf1a2a247fa patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11763
diff changeset
332
12160
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
333 Just put the files somewhere in your PATH. You can set the 'winptydll' option
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
334 to point to the right file, if needed. If you have both the 32-bit and 64-bit
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
335 version, rename to winpty32.dll and winpty64.dll to match the way Vim was
b80c0172d1a8 patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents: 12064
diff changeset
336 build.
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
337
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 ==============================================================================
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339 2. Remote testing *terminal-testing*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 Most Vim tests execute a script inside Vim. For some tests this does not
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 work, running the test interferes with the code being tested. To avoid this
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 Vim is executed in a terminal window. The test sends keystrokes to it and
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 inspects the resulting screen state.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 Functions ~
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347
12457
dfb8254aa735 patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
348 term_sendkeys() send keystrokes to a terminal (not subject to tmap)
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 term_wait() wait for screen to be updated
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 term_scrape() inspect terminal screen
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 ==============================================================================
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 3. Debugging *terminal-debug*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 The Terminal debugging plugin can be used to debug a program with gdb and view
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
357 the source code in a Vim window. Since this is completely contained inside
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
358 Vim this also works remotely over an ssh connection.
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
359
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
360
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
361 Starting ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
362 *termdebug-starting*
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
363 Load the plugin with this command: >
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
364 packadd termdebug
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
365 < *:Termdebug*
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
366 To start debugging use `:TermDebug` folowed by the command name, for example: >
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
367 :Termdebug vim
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
369 This opens two windows:
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
370 gdb window A terminal window in which "gdb vim" is executed. Here you
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
371 can directly interact with gdb. The buffer name is "!gdb".
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
372 program window A terminal window for the executed program. When "run" is
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
373 used in gdb the program I/O will happen in this window, so
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
374 that it does not interfere with controlling gdb. The buffer
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
375 name is "gdb program".
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
376
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
377 The current window is used to show the source code. When gdb pauses the
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
378 source file location will be displayed, if possible. A sign is used to
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
379 highlight the current position (using highlight group debugPC).
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
380
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
381 If the buffer in the current window is modified, another window will be opened
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
382 to display the current gdb position.
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
383
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
384 Focus the terminal of the executed program to interact with it. This works
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
385 the same as any command running in a terminal window.
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
386
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
387 When the debugger ends, typically by typing "quit" in the gdb window, the two
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
388 opened windows are closed.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
390
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
391 Example session ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
392 *termdebug-example*
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
393 Start in the Vim "src" directory and build Vim: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
394 % make
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
395 Start Vim: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
396 % ./vim
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
397 Load the termdebug plugin and start debugging Vim: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
398 :packadd termdebug
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
399 :Termdebug vim
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
400 You should now have three windows:
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
401 source - where you started, has a window toolbar with buttons
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
402 gdb - you can type gdb commands here
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
403 program - the executed program will use this window
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
404 You can use CTRL-W CTRL-W or the mouse to move focus between windows.
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
405 Put focus on the gdb window and type: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
406 break ex_help
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
407 run
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
408 Vim will start running in the program window. Put focus there and type: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
409 :help gui
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
410 Gdb will run into the ex_help breakpoint. The source window now shows the
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
411 ex_cmds.c file. A ">>" marker will appear where the breakpoint was set. The
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
412 line where the debugger stopped is highlighted. You can now step through the
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
413 program. Let's use the mouse: click on the "Next" button in the window
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
414 toolbar. You will see the highlighting move as the debugger executes a line
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
415 of source code.
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
416
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
417 Click "Next" a few times until the for loop is highlighted. Put the cursor on
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
418 the end of "eap->arg", then click "Eval" in the toolbar. You will see this
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
419 displayed:
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
420 "eap->arg": 0x555555e68855 "gui" ~
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
421 This way you can inspect the value of local variables. You can also focus the
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
422 gdb window and use a "print" command, e.g.: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
423 print *eap
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
424
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
425 Now go back to the source window and put the cursor on the first line after
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
426 the for loop, then type: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
427 :Break
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
428 You will see a ">>" marker appear, this indicates the new breakpoint. Now
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
429 click "Cont" in the toolbar and the code until the breakpoint will be
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
430 executed.
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
431
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
432 You can type more advanced commands in the gdb window. For example, type: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
433 watch curbuf
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
434 Now click "Cont" in the toolbar (or type "cont" in the gdb window). Execution
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
435 will now continue until the value of "curbuf" changes, which is in do_ecmd().
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
436 To remove this watchpoint again type in the gdb window: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
437 delete 3
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
438
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
439 You can see the stack by typing in the gdb window: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
440 where
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
441 Move through the stack frames, e.g. with: >
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
442 frame 3
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
443 The source window will show the code, at the point where the call was made to
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
444 a deeper level.
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
445
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
446
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
447 Stepping through code ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
448 *termdebug-stepping*
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
449 Put focus on the gdb window to type commands there. Some common ones are:
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
450 - CTRL-C interrupt the program
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
451 - next execute the current line and stop at the next line
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
452 - step execute the current line and stop at the next statement, entering
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
453 functions
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
454 - finish execute until leaving the current function
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
455 - where show the stack
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
456 - frame N go to the Nth stack frame
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
457 - continue continue execution
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
458
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
459 In the window showing the source code some commands can used to control gdb:
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
460 :Break set a breakpoint at the current line; a sign will be displayed
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
461 :Delete delete a breakpoint at the current line
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
462 :Step execute the gdb "step" command
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
463 :Over execute the gdb "next" command (:Next is a Vim command)
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
464 :Finish execute the gdb "finish" command
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
465 :Continue execute the gdb "continue" command
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
466
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
467 The plugin adds a window toolbar with these entries:
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
468 Step :Step
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
469 Next :Over
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
470 Finish :Finish
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
471 Cont :Continue
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
472 Eval :Evaluate
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
473 This way you can use the mouse to perform the most common commands.
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12457
diff changeset
474
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
475
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
476 Inspecting variables ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
477 *termdebug-variables*
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
478 :Evaluate evaluate the expression under the cursor
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
479 K same
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
480 :Evaluate {expr} evaluate {expr}
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
481 :'<,'>Evaluate evaluate the Visually selected text
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
482
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
483 This is similar to using "print" in the gdb window.
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
484
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
485
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
486 Other commands ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
487 *termdebug-commands*
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
488 :Gdb jump to the gdb window
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
489 :Program jump to the window with the running program
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
490
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
491
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
492 Communication ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
493 *termdebug-communication*
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
494 There is another, hidden, buffer, which is used for Vim to communicate with
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
495 gdb. The buffer name is "gdb communication". Do not delete this buffer, it
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
496 will break the debugger.
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
497
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
498
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
499 Customizing ~
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
500 *termdebug-customizing*
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
501 To change the name of the gdb command, set the "termdebugger" variable before
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
502 invoking `:Termdebug`: >
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
503 let termdebugger = "mygdb"
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 12559
diff changeset
504 < *gdb-version*
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
505 Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 12559
diff changeset
506 interface. This probably requires gdb version 7.12. if you get this error:
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 12559
diff changeset
507 Undefined command: "new-ui". Try "help".~
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 12559
diff changeset
508 Then your gdb is too old.
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
509
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
510 The color of the signs can be adjusted with these highlight groups:
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
511 - debugPC the current position
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
512 - debugBreakpoint a breakpoint
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
513
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
514 The defaults are, when 'background' is "light":
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
515 hi debugPC term=reverse ctermbg=lightblue guibg=lightblue
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
516 hi debugBreakpoint term=reverse ctermbg=red guibg=red
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
517
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
518 When 'background' is "dark":
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
519 hi debugPC term=reverse ctermbg=darkblue guibg=darkblue
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12311
diff changeset
520 hi debugBreakpoint term=reverse ctermbg=red guibg=red
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12192
diff changeset
521
12455
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
522 To change the width of the Vim window when debugging starts, and use a
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
523 vertical split: >
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
524 let g:termdebug_wide = 163
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
525 This will set &columns to 163 when :Termdebug is used. The value is restored
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
526 when quitting the debugger.
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
527 If g:termdebug_wide is set and &Columns is already larger than
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
528 g:termdebug_wide then a vertical split will be used without changing &columns.
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
529 Set it to 1 to get a vertical split without every changing &columns (useful
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
530 for when the terminal can't be resized by Vim).
12455
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
531
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 vim:tw=78:ts=8:ft=help:norl: