Mercurial > vim
annotate runtime/doc/terminal.txt @ 32250:b1ea62e14b3c v9.0.1456
patch 9.0.1456: shortmess test depends on order of test execution
Commit: https://github.com/vim/vim/commit/657b31fa3bda2089fef18c30fc706abe5d57e865
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Apr 15 21:28:02 2023 +0100
patch 9.0.1456: shortmess test depends on order of test execution
Problem: Shortmess test depends on order of test execution.
Solution: Clear messages. (closes https://github.com/vim/vim/issues/12264)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Apr 2023 22:30:03 +0200 |
parents | a9b5ffbc0428 |
children | 635de73eeb4c |
rev | line source |
---|---|
31139 | 1 *terminal.txt* For Vim version 9.0. Last change: 2022 Nov 10 |
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 |
13963 | 7 Terminal window support *terminal* *terminal-window* |
11621
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 |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
10 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
|
11 echo has('terminal') |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
12 If the result is "1" you have it. |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
13 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
15 1. Basic use |terminal-use| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
16 Typing |terminal-typing| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
17 Size and color |terminal-size-color| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
18 Command syntax |:terminal| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
19 Resizing |terminal-resizing| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
20 Terminal Modes |Terminal-mode| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
21 Cursor style |terminal-cursor-style| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
22 Session |terminal-session| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
23 Special keys |terminal-special-keys| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
24 Unix |terminal-unix| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
25 MS-Windows |terminal-ms-windows| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
26 2. Terminal functions |terminal-function-details| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
27 3. Terminal communication |terminal-communication| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
28 Vim to job: term_sendkeys() |terminal-to-job| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
29 Job to Vim: JSON API |terminal-api| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
30 Using the client-server feature |terminal-client-server| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
31 4. Remote testing |terminal-testing| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
32 5. Diffing screen dumps |terminal-diff| |
32004 | 33 Writing a screen dump test for Vim |terminal-dumptest| |
34 Creating a screen dump |terminal-screendump| | |
35 Comparing screen dumps |terminal-diffscreendump| | |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
36 6. Debugging |terminal-debug| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
37 Starting |termdebug-starting| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
38 Example session |termdebug-example| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
39 Stepping through code |termdebug-stepping| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
40 Inspecting variables |termdebug-variables| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
41 Other commands |termdebug-commands| |
27036 | 42 Events |termdebug-events| |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
43 Prompt mode |termdebug-prompt| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
44 Communication |termdebug-communication| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
45 Customizing |termdebug-customizing| |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 |
12254 | 47 {only available when compiled with the |+terminal| feature} |
15878 | 48 The terminal feature requires the |+job| and |+channel| features. |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 ============================================================================== |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 1. Basic use *terminal-use* |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 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
|
54 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
|
55 :term bash |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
57 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
|
58 :term make myprogram |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 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
|
61 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
|
62 |
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
|
63 |
11814
d3d0db111d17
patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents:
11774
diff
changeset
|
64 Typing ~ |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
65 *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
|
66 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
|
67 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
|
68 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
|
69 |
16023 | 70 *t_CTRL-W_CTRL-W* *t_CTRL-W_:* |
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
|
71 CTRL-W can be used to navigate between windows and other CTRL-W commands, e.g.: |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
72 CTRL-W CTRL-W move focus to the next window |
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
|
73 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
|
74 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
|
75 |
18831 | 76 Special in the terminal window: *t_CTRL-W_.* *t_CTRL-W_N* |
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
|
77 CTRL-W . send a CTRL-W to the job in the terminal |
13668
6a84e3d2b810
patch 8.0.1706: cannot sent CTRL- to a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13626
diff
changeset
|
78 CTRL-W CTRL-\ send a CTRL-\ 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
|
79 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
|
80 CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode| |
16023 | 81 CTRL-W " {reg} paste register {reg} *t_CTRL-W_quote* |
11914 | 82 Also works with the = register to insert the result of |
83 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
|
84 CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| |
16023 | 85 CTRL-W gt go to next tabpage, same as `gt` *t_CTRL-W_gt* |
86 CTRL-W gT go to previous tabpage, same as `gT` *t_CTRL-W_gT* | |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
13735 | 88 See option 'termwinkey' for specifying another key instead of CTRL-W that |
89 will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey' | |
90 to the job. For example: | |
91 'termwinkey' CTRL-W move focus to the next window | |
92 'termwinkey' : enter an Ex command | |
93 'termwinkey' 'termwinkey' send 'termwinkey' to the job in the terminal | |
14109
279465096a16
patch 8.1.0072: use of 'termwinkey' is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
94 'termwinkey' . send 'termwinkey' to the job in the terminal |
279465096a16
patch 8.1.0072: use of 'termwinkey' is inconsistent
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
95 'termwinkey' CTRL-\ send a CTRL-\ to the job in the terminal |
13735 | 96 'termwinkey' N go to terminal Normal mode, see below |
16023 | 97 'termwinkey' CTRL-N same as CTRL-W N |t_CTRL-W_N| |
98 'termwinkey' CTRL-C same as CTRL-W CTRL-C |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
|
99 *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
|
100 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
|
101 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
|
102 *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
|
103 CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a |
29104 | 104 CTRL-Break will also kill the job. |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
105 |
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
106 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
|
107 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
|
108 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
|
109 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
|
110 |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
111 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
|
112 These are defined like any mapping, but apply only when typing keys that are |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
113 sent to the job running in the terminal. For example, to make F1 switch |
12559 | 114 to Terminal-Normal mode: > |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
115 tnoremap <F1> <C-W>N |
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
116 You can use Esc, but you need to make sure it won't cause other keys to |
20753 | 117 break (cursor keys start with an Esc, so they may break), this probably only |
118 works in the GUI: > | |
12559 | 119 tnoremap <Esc> <C-W>N |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
120 set notimeout ttimeout timeoutlen=100 |
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
121 |
14952
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14695
diff
changeset
|
122 You can also create menus similar to terminal mode mappings, but you have to |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14695
diff
changeset
|
123 use |:tlmenu| instead of |:tmenu|. |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14695
diff
changeset
|
124 |
20241 | 125 *options-in-terminal* |
12559 | 126 After opening the terminal window and setting 'buftype' to "terminal" the |
23047 | 127 |TerminalWinOpen| autocommand event is triggered. This makes it possible to set |
128 options specifically for the terminal window and buffer. Example: > | |
129 au TerminalWinOpen * setlocal bufhidden=hide | |
23931 | 130 This only works properly if the terminal is not hidden. |
23047 | 131 |
23931 | 132 For both hidden and non-hidden terminals this works, both for buffer-local and |
133 window-local options: > | |
134 au TerminalWinOpen,BufWinEnter * if &buftype == 'terminal' | |
135 \ | setlocal bufhidden=hide colorcolumn=123 | |
136 \ | endif | |
137 Note that for a hidden terminal the options are not set until the terminal is | |
138 no longer hidden. | |
139 | |
140 There is also the |TerminalOpen| event. Keep in mind this may be triggered | |
141 for a hidden terminal, then the current window and buffer are not that of the | |
142 new terminal. | |
23047 | 143 You need to use <abuf>, which is set to the terminal buffer. Example: > |
23931 | 144 au TerminalOpen * call setbufvar(expand('<abuf>')->str2nr(), |
145 \ '&termwinscroll', 1000) | |
146 For a window-local option, you need to delay setting the option until the | |
147 terminal window has been created (this only works for a hidden terminal): > | |
148 au TerminalOpen * exe printf( | |
149 \ 'au BufWinEnter <buffer=%d> ++once setlocal colorcolumn=%d', | |
150 \ expand('<abuf>')->str2nr(), 123) | |
151 For a non-hidden terminal use |TerminalWinOpen|. | |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
152 |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
153 Mouse events (click and drag) are passed to the terminal. Mouse move events |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
154 are only passed when Vim itself is receiving them. For a terminal that is |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
155 when 'balloonevalterm' is enabled. |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
156 |
11814
d3d0db111d17
patch 8.0.0787: cannot send CTRL-W command to terminal job
Christian Brabandt <cb@256bit.org>
parents:
11774
diff
changeset
|
157 |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
158 Size and color ~ |
12826 | 159 *terminal-size-color* |
13735 | 160 See option 'termwinsize' for controlling the size of the terminal window. |
11659
49c12c93abf3
Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
161 (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
|
162 |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
163 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
|
164 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
|
165 |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
166 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
|
167 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
|
168 |
13100
656ab57d1ddc
update a few runtime files
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
169 To use a different color the Terminal highlight group can be used, for |
656ab57d1ddc
update a few runtime files
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
170 example: > |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
171 hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19303
diff
changeset
|
172 Instead of Terminal another group can be specified with the "term_highlight" |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19303
diff
changeset
|
173 option for `term_start()`. |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19303
diff
changeset
|
174 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
175 *g:terminal_ansi_colors* |
13735 | 176 In GUI mode or with 'termguicolors', the 16 ANSI colors used by default in new |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
177 terminal windows may be configured using the variable |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
178 `g:terminal_ansi_colors`, which should be a list of 16 color names or |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
179 hexadecimal color codes, similar to those accepted by |highlight-guifg|. When |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
180 not using GUI colors, the terminal window always uses the 16 ANSI colors of |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
181 the underlying terminal. |
20552 | 182 When using `term_start()` the colors can be set with the "ansi_colors" option. |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
183 The |term_setansicolors()| function can be used to change the colors, and |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
184 |term_getansicolors()| to get the currently used colors. |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
185 |
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
|
186 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
187 Command syntax ~ |
11774
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
188 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
189 :[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
|
190 Open a new terminal window. |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 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
|
193 the input and output to the terminal. |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 If [command] is not given the 'shell' option is used. |
12254 | 195 if [command] is NONE no job is started, the pty of the |
196 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
|
197 |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
198 If [command] is missing the default behavior is to |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
199 close the terminal when the shell exits. This can be |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
200 changed with the ++noclose argument. |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
201 If [command] is present the default behavior is to |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
202 keep the terminal open in Terminal-Normal mode. This |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
203 can be changed with the ++close argument. |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
204 |
20241 | 205 No Vim command can follow, any | is included in |
206 [command]. Use `:execute` if you must have a Vim | |
207 command following in the same line. | |
208 | |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 A new buffer will be created, using [command] or |
11914 | 210 'shell' as the name, prefixed with a "!". If a buffer |
211 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
|
212 parentheses. E.g. if "gdb" exists the second terminal |
11914 | 213 buffer will use "!gdb (1)". |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12160
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 ++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
|
219 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
220 *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
|
221 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
|
222 ++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
|
223 automatically when the job terminates. |
18402
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
224 |terminal-close| |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
225 ++noclose The terminal window will NOT close |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
226 automatically when the job terminates. |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
227 ++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
|
228 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
|
229 Note that this can be interruptive. |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
230 The last of ++close, ++noclose and ++open |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
231 matters and rules out earlier arguments. |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
232 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
233 ++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
|
234 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
|
235 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
|
236 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
|
237 ++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
|
238 no window will be used. |
13437 | 239 ++norestore Do not include this terminal window |
240 in a session file. | |
18514
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
241 ++shell Instead of executing {command} |
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
242 directly, use a shell, like with |
32004 | 243 `:!command` *E279* |
26148 | 244 {only works on Unix and MS-Windows} |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
245 ++kill={how} When trying to close the terminal |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
246 window kill the job with {how}. See |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
247 |term_setkill()| for the values. |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12160
diff
changeset
|
248 ++rows={height} Use {height} for the terminal window |
13125 | 249 height. If the terminal uses the full |
250 Vim height (no window above or below | |
14006 | 251 the terminal window) the command line |
13125 | 252 height will be reduced as needed. |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12160
diff
changeset
|
253 ++cols={width} Use {width} for the terminal window |
13125 | 254 width. If the terminal uses the full |
255 Vim width (no window left or right of | |
256 the terminal window) this value is | |
257 ignored. | |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
258 ++eof={text} When using [range]: text to send after |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 e.g. "<C-Z>" for CTRL-Z. |
15746
c017195b121b
patch 8.1.0880: MS-Windows: inconsistent selection of winpty/conpty
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
267 ++type={pty} (MS-Windows only): Use {pty} as the |
c017195b121b
patch 8.1.0880: MS-Windows: inconsistent selection of winpty/conpty
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
268 virtual console. See 'termwintype' |
c017195b121b
patch 8.1.0880: MS-Windows: inconsistent selection of winpty/conpty
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
269 for the values. |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
270 ++api={expr} Permit the function name starting with |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
271 {expr} to be called as |terminal-api| |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
272 function. If {expr} is empty then no |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
273 function can be called. |
15746
c017195b121b
patch 8.1.0880: MS-Windows: inconsistent selection of winpty/conpty
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
274 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
275 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
|
276 function. |
14637 | 277 If you want to split the window vertically, use: > |
278 :vertical terminal | |
279 < Or short: > | |
280 :vert ter | |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
281 |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
282 When the buffer associated with the terminal is forcibly unloaded or wiped out |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
283 the job is killed, similar to calling `job_stop(job, "kill")` . |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
284 Closing the window normally results in |E947|. When a kill method was set |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
285 with "++kill={how}" or |term_setkill()| then closing the window will use that |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
286 way to kill or interrupt the job. For example: > |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13437
diff
changeset
|
287 :term ++kill=term tail -f /tmp/log |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
288 |
12267
e3bde71afff0
patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
289 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
|
290 buffer. Trying to close the window with `CTRL-W :quit` fails. When using |
30751
9889ff80547e
patch 9.0.0710: quitting/unloading/hiding a terminal does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
29840
diff
changeset
|
291 `CTRL-W :quit!` the job is ended. The text in the window is lost, the buffer |
9889ff80547e
patch 9.0.0710: quitting/unloading/hiding a terminal does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
29840
diff
changeset
|
292 is deleted. With `CTRL-W :bunload!` the buffer remains but will be empty. |
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
|
293 |
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
|
294 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
|
295 `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
|
296 |
e3bde71afff0
patch 8.0.1013: terminal window behaves different from a buffer with changes
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
297 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
|
298 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
|
299 current window into a terminal window. If there are unsaved changes this |
14006 | 300 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
|
301 |
18402
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
302 *terminal-close* |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
303 When the terminal window is closed, e.g. when the shell exits and "++close" |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
304 argument was used, and this is the last normal Vim window, then Vim will exit. |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
305 This is like using |:quit| in a normal window. Help and preview windows are |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
306 not counted. |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
307 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
308 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
|
309 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
|
310 :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
|
311 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
|
312 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
|
313 |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
314 *E947* *E948* |
11967
12833414cc02
patch 8.0.0864: cannot specify the name of a terminal
Christian Brabandt <cb@256bit.org>
parents:
11965
diff
changeset
|
315 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
|
316 cannot be quit easily, see |abandon|. |
11914 | 317 |
318 When the job has finished and no changes were made to the buffer: closing the | |
319 window will wipe out the buffer. | |
320 | |
321 Before changes can be made to a terminal buffer, the 'modifiable' option must | |
322 be set. This is only possible when the job has finished. At the first change | |
323 the buffer will become a normal buffer and the highlighting is removed. | |
324 You may want to change the buffer name with |:file| to be able to write, since | |
325 the buffer name will still be set to the command. | |
326 | |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
327 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 Resizing ~ |
12826 | 329 *terminal-resizing* |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 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
|
331 |
13735 | 332 1. The 'termwinsize' option is empty: The terminal size follows the window |
333 size. The minimal size is 2 screen lines with 10 cells. | |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 |
13735 | 335 2. The 'termwinsize' option is "rows*cols", where "rows" is the minimal number |
336 of 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
|
337 |
13735 | 338 3. The 'termwinsize' option is "rowsXcols" (where the x is upper or lower |
339 case). The terminal size is fixed to the specified number of screen lines | |
340 and cells. If the window is bigger there will be unused empty space. | |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 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
|
343 be seen (the lower-left part). |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 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
|
346 terminal. |term_setsize()| can be used only when in the first or second mode, |
13735 | 347 not when 'termwinsize' is "rowsXcols". |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
349 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
350 Terminal-Job and Terminal-Normal mode ~ |
13680
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
351 *Terminal-mode* *Terminal-Job* |
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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 |
13735 | 357 Use CTRL-W N (or 'termwinkey' N) to switch to Terminal-Normal mode. Now 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
|
358 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
|
359 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
|
360 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12457
diff
changeset
|
361 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
|
362 |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
|
363 |
13680
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
364 It is not possible to enter Insert mode from Terminal-Job mode. |
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
365 |
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
366 *Terminal-Normal* *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
|
367 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
|
368 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
|
369 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
|
370 '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
|
371 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
|
372 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
11967
diff
changeset
|
373 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
|
374 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
|
375 "(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
|
376 |
13680
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
377 When the job outputs lines in the terminal, such that the contents scrolls off |
c32e9628dc30
patch 8.0.1712: terminal scrollback is not limited
Christian Brabandt <cb@256bit.org>
parents:
13668
diff
changeset
|
378 the top, those lines are remembered and can be seen in Terminal-Normal mode. |
13735 | 379 The number of lines is limited by the 'termwinscroll' option. When going over |
13912 | 380 this limit, the first 10% of the scrolled lines are deleted and are lost. |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
381 |
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
|
382 |
12254 | 383 Cursor style ~ |
12826 | 384 *terminal-cursor-style* |
12254 | 385 By default the cursor in the terminal window uses a not blinking block. The |
386 normal xterm escape sequences can be used to change the blinking state and the | |
387 shape. Once focus leaves the terminal window Vim will restore the original | |
388 cursor. | |
389 | |
390 An exception is when xterm is started with the "-bc" argument, or another way | |
391 that causes the cursor to blink. This actually means that the blinking flag | |
392 is inverted. Since Vim cannot detect this, the terminal window cursor | |
393 blinking will also be inverted. | |
394 | |
395 | |
13437 | 396 Session ~ |
397 *terminal-session* | |
398 A terminal window will be restored when using a session file, if possible and | |
399 wanted. | |
400 | |
401 If "terminal" was removed from 'sessionoptions' then no terminal windows will | |
402 be restored. | |
403 | |
404 If the job in the terminal was finished the window will not be restored. | |
405 | |
406 If the terminal can be restored, the command that was used to open it will be | |
407 used again. To change this use the |term_setrestore()| function. This can | |
408 also be used to not restore a specific terminal by setting the command to | |
409 "NONE". | |
410 | |
411 | |
12826 | 412 Special keys ~ |
413 *terminal-special-keys* | |
414 Since the terminal emulator simulates an xterm, only escape sequences that | |
415 both Vim and xterm recognize will be available in the terminal window. If you | |
416 want to pass on other escape sequences to the job running in the terminal you | |
417 need to set up forwarding. Example: > | |
418 tmap <expr> <Esc>]b SendToTerm("\<Esc>]b") | |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
419 func SendToTerm(what) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
420 call term_sendkeys('', a:what) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
421 return '' |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
422 endfunc |
12826 | 423 |
424 | |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
425 Unix ~ |
12826 | 426 *terminal-unix* |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
427 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
|
428 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
|
429 |
11914 | 430 Environment variables are used to pass information to the running job: |
13585
03224283bafc
patch 8.0.1665: when running a terminal from the GUI 'term' is not useful
Christian Brabandt <cb@256bit.org>
parents:
13575
diff
changeset
|
431 TERM the name of the terminal, from the 'term' option or |
03224283bafc
patch 8.0.1665: when running a terminal from the GUI 'term' is not useful
Christian Brabandt <cb@256bit.org>
parents:
13575
diff
changeset
|
432 $TERM in the GUI; falls back to "xterm" if it does not |
03224283bafc
patch 8.0.1665: when running a terminal from the GUI 'term' is not useful
Christian Brabandt <cb@256bit.org>
parents:
13575
diff
changeset
|
433 start with "xterm" |
11914 | 434 ROWS number of rows in the terminal initially |
435 LINES same as ROWS | |
436 COLUMNS number of columns in the terminal initially | |
437 COLORS number of colors, 't_Co' (256*256*256 in the GUI) | |
438 VIM_SERVERNAME v:servername | |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14006
diff
changeset
|
439 VIM_TERMINAL v:version |
11914 | 440 |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
441 |
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
442 MS-Windows ~ |
12826 | 443 *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
|
444 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
|
445 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
|
446 window. |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
447 |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
448 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
|
449 |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
450 winpty.dll |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
451 winpty-agent.exe |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
452 |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
453 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
|
454 |
edf1a2a247fa
patch 8.0.0769: build problems with terminal on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11763
diff
changeset
|
455 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
|
456 |
12160
b80c0172d1a8
patch 8.0.0960: job in terminal does not get CTRL-C
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
457 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
|
458 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
|
459 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
|
460 build. |
15844
63e71d195cee
patch 8.1.0929: no error when requesting ConPTY but it's not available
Bram Moolenaar <Bram@vim.org>
parents:
15746
diff
changeset
|
461 *ConPTY* *E982* |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15131
diff
changeset
|
462 On more recent versions of MS-Windows 10 (beginning with the "October 2018 |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15131
diff
changeset
|
463 Update"), winpty is no longer required. On those versions, |:terminal| will use |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15131
diff
changeset
|
464 Windows' built-in support for hosting terminal applications, "ConPTY". When |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15131
diff
changeset
|
465 ConPTY is in use, there may be rendering artifacts regarding ambiguous-width |
15844
63e71d195cee
patch 8.1.0929: no error when requesting ConPTY but it's not available
Bram Moolenaar <Bram@vim.org>
parents:
15746
diff
changeset
|
466 characters. If you encounter any such issues, install "winpty". Until the |
63e71d195cee
patch 8.1.0929: no error when requesting ConPTY but it's not available
Bram Moolenaar <Bram@vim.org>
parents:
15746
diff
changeset
|
467 ConPTY problems have been fixed "winpty" will be preferred. |
11763
21f3930dfe6e
Documentation updates.
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
468 |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
469 Environment variables are used to pass information to the running job: |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
470 VIM_SERVERNAME v:servername |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
471 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
472 ============================================================================== |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
473 2. Terminal functions *terminal-function-details* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
474 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
475 *term_dumpdiff()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
476 term_dumpdiff({filename}, {filename} [, {options}]) |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
477 Open a new window displaying the difference between the two |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
478 files. The files must have been created with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
479 |term_dumpwrite()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
480 Returns the buffer number or zero when the diff fails. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
481 Also see |terminal-diff|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
482 NOTE: this does not work with double-width characters yet. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
483 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
484 The top part of the buffer contains the contents of the first |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
485 file, the bottom part of the buffer contains the contents of |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
486 the second file. The middle part shows the differences. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
487 The parts are separated by a line of equals. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
488 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
489 If the {options} argument is present, it must be a Dict with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
490 these possible members: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
491 "term_name" name to use for the buffer name, instead |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
492 of the first file name. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
493 "term_rows" vertical size to use for the terminal, |
22171 | 494 instead of using 'termwinsize', but |
495 respecting the minimal size | |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
496 "term_cols" horizontal size to use for the terminal, |
22171 | 497 instead of using 'termwinsize', but |
498 respecting the minimal size | |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
499 "vertical" split the window vertically |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
500 "curwin" use the current window, do not split the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
501 window; fails if the current buffer |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
502 cannot be |abandon|ed |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
503 "bufnr" do not create a new buffer, use the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
504 existing buffer "bufnr". This buffer |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
505 must have been previously created with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
506 term_dumpdiff() or term_dumpload() and |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
507 visible in a window. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
508 "norestore" do not add the terminal window to a |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
509 session file |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
510 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
511 Each character in the middle part indicates a difference. If |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
512 there are multiple differences only the first in this list is |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
513 used: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
514 X different character |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
515 w different width |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
516 f different foreground color |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
517 b different background color |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
518 a different attribute |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
519 + missing position in first file |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
520 - missing position in second file |
22958 | 521 > cursor position in first file, not in second |
23047 | 522 < cursor position in second file, not in first |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
523 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
524 Using the "s" key the top and bottom parts are swapped. This |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
525 makes it easy to spot a difference. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
526 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
527 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
528 GetFilename()->term_dumpdiff(otherfile) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
529 < |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
530 *term_dumpload()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
531 term_dumpload({filename} [, {options}]) |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
532 Open a new window displaying the contents of {filename} |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
533 The file must have been created with |term_dumpwrite()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
534 Returns the buffer number or zero when it fails. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
535 Also see |terminal-diff|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
536 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
537 For {options} see |term_dumpdiff()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
538 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
539 Can also be used as a |method|: > |
18343 | 540 GetFilename()->term_dumpload() |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
541 < |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
542 *term_dumpwrite()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
543 term_dumpwrite({buf}, {filename} [, {options}]) |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
544 Dump the contents of the terminal screen of {buf} in the file |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
545 {filename}. This uses a format that can be used with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
546 |term_dumpload()| and |term_dumpdiff()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
547 If the job in the terminal already finished an error is given: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
548 *E958* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
549 If {filename} already exists an error is given: *E953* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
550 Also see |terminal-diff|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
551 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
552 {options} is a dictionary with these optional entries: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
553 "rows" maximum number of rows to dump |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
554 "columns" maximum number of columns to dump |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
555 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
556 Can also be used as a |method|, the base is used for the file |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
557 name: > |
18343 | 558 GetFilename()->term_dumpwrite(bufnr) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
559 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
560 term_getaltscreen({buf}) *term_getaltscreen()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
561 Returns 1 if the terminal of {buf} is using the alternate |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
562 screen. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
563 {buf} is used as with |term_getsize()|. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
564 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
565 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
566 GetBufnr()->term_getaltscreen() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
567 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
568 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
569 term_getansicolors({buf}) *term_getansicolors()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
570 Get the ANSI color palette in use by terminal {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
571 Returns a List of length 16 where each element is a String |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
572 representing a color in hexadecimal "#rrggbb" format. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
573 Also see |term_setansicolors()| and |g:terminal_ansi_colors|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
574 If neither was used returns the default colors. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
575 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
576 {buf} is used as with |term_getsize()|. If the buffer does not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
577 exist or is not a terminal window, an empty list is returned. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
578 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
579 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
580 GetBufnr()->term_getansicolors() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
581 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
582 < {only available when compiled with GUI enabled and/or the |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
583 |+termguicolors| feature} |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
584 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
585 term_getattr({attr}, {what}) *term_getattr()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
586 Given {attr}, a value returned by term_scrape() in the "attr" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
587 item, return whether {what} is on. {what} can be one of: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
588 bold |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
589 italic |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
590 underline |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
591 strike |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
592 reverse |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
593 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
594 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
595 GetAttr()->term_getattr() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
596 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
597 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
598 term_getcursor({buf}) *term_getcursor()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
599 Get the cursor position of terminal {buf}. Returns a list with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
600 two numbers and a dictionary: [row, col, dict]. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
601 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
602 "row" and "col" are one based, the first screen cell is row |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
603 1, column 1. This is the cursor position of the terminal |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
604 itself, not of the Vim window. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
605 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
606 "dict" can have these members: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
607 "visible" one when the cursor is visible, zero when it |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
608 is hidden. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
609 "blink" one when the cursor is blinking, zero when it |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
610 is not blinking. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
611 "shape" 1 for a block cursor, 2 for underline and 3 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
612 for a vertical bar. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
613 "color" color of the cursor, e.g. "green" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
614 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
615 {buf} must be the buffer number of a terminal window. If the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
616 buffer does not exist or is not a terminal window, an empty |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
617 list is returned. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
618 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
619 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
620 GetBufnr()->term_getcursor() |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
621 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
622 term_getjob({buf}) *term_getjob()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
623 Get the Job associated with terminal window {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
624 {buf} is used as with |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
625 Returns |v:null| when there is no job. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
626 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
627 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
628 GetBufnr()->term_getjob() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
629 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
630 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
631 term_getline({buf}, {row}) *term_getline()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
632 Get a line of text from the terminal window of {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
633 {buf} is used as with |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
634 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
635 The first line has {row} one. When {row} is "." the cursor |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
636 line is used. When {row} is invalid an empty string is |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
637 returned. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
638 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
639 To get attributes of each character use |term_scrape()|. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
640 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
641 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
642 GetBufnr()->term_getline(row) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
643 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
644 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
645 term_getscrolled({buf}) *term_getscrolled()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
646 Return the number of lines that scrolled to above the top of |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
647 terminal {buf}. This is the offset between the row number |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
648 used for |term_getline()| and |getline()|, so that: > |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
649 term_getline(buf, N) |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
650 < is equal to: > |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
651 getline(N + term_getscrolled(buf)) |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
652 < (if that line exists). |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
653 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
654 {buf} is used as with |term_getsize()|. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
655 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
656 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
657 GetBufnr()->term_getscrolled() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
658 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
659 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
660 term_getsize({buf}) *term_getsize()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
661 Get the size of terminal {buf}. Returns a list with two |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
662 numbers: [rows, cols]. This is the size of the terminal, not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
663 the window containing the terminal. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
664 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
665 {buf} must be the buffer number of a terminal window. Use an |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
666 empty string for the current buffer. If the buffer does not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
667 exist or is not a terminal window, an empty list is returned. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
668 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
669 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
670 GetBufnr()->term_getsize() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
671 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
672 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
673 term_getstatus({buf}) *term_getstatus()* |
19099 | 674 Get the status of terminal {buf}. This returns a String with |
28379 | 675 a comma-separated list of these items: |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
676 running job is running |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
677 finished job has finished |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
678 normal in Terminal-Normal mode |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
679 One of "running" or "finished" is always present. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
680 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
681 {buf} must be the buffer number of a terminal window. If the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
682 buffer does not exist or is not a terminal window, an empty |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
683 string is returned. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
684 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
685 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
686 GetBufnr()->term_getstatus() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
687 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
688 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
689 term_gettitle({buf}) *term_gettitle()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
690 Get the title of terminal {buf}. This is the title that the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
691 job in the terminal has set. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
692 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
693 {buf} must be the buffer number of a terminal window. If the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
694 buffer does not exist or is not a terminal window, an empty |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
695 string is returned. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
696 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
697 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
698 GetBufnr()->term_gettitle() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
699 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
700 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
701 term_gettty({buf} [, {input}]) *term_gettty()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
702 Get the name of the controlling terminal associated with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
703 terminal window {buf}. {buf} is used as with |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
704 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
705 When {input} is omitted or 0, return the name for writing |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
706 (stdout). When {input} is 1 return the name for reading |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
707 (stdin). On UNIX, both return same name. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
708 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
709 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
710 GetBufnr()->term_gettty() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
711 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
712 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
713 term_list() *term_list()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
714 Return a list with the buffer numbers of all buffers for |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
715 terminal windows. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
716 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
717 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
718 term_scrape({buf}, {row}) *term_scrape()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
719 Get the contents of {row} of terminal screen of {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
720 For {buf} see |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
721 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
722 The first line has {row} one. When {row} is "." the cursor |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
723 line is used. When {row} is invalid an empty string is |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
724 returned. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
725 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
726 Return a List containing a Dict for each screen cell: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
727 "chars" character(s) at the cell |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
728 "fg" foreground color as #rrggbb |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
729 "bg" background color as #rrggbb |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
730 "attr" attributes of the cell, use |term_getattr()| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
731 to get the individual flags |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
732 "width" cell width: 1 or 2 |
23931 | 733 For a double-width cell there is one item, thus the list can |
734 be shorter than the width of the terminal. | |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
735 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
736 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
737 GetBufnr()->term_scrape(row) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
738 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
739 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
740 term_sendkeys({buf}, {keys}) *term_sendkeys()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
741 Send keystrokes {keys} to terminal {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
742 {buf} is used as with |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
743 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
744 {keys} are translated as key sequences. For example, "\<c-x>" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
745 means the character CTRL-X. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
746 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
747 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
748 GetBufnr()->term_sendkeys(keys) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
749 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
750 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
751 term_setansicolors({buf}, {colors}) *term_setansicolors()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
752 Set the ANSI color palette used by terminal {buf}. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
753 {colors} must be a List of 16 valid color names or hexadecimal |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
754 color codes, like those accepted by |highlight-guifg|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
755 Also see |term_getansicolors()| and |g:terminal_ansi_colors|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
756 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
757 The colors normally are: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
758 0 black |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
759 1 dark red |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
760 2 dark green |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
761 3 brown |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
762 4 dark blue |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
763 5 dark magenta |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
764 6 dark cyan |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
765 7 light grey |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
766 8 dark grey |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
767 9 red |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
768 10 green |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
769 11 yellow |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
770 12 blue |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
771 13 magenta |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
772 14 cyan |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
773 15 white |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
774 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
775 These colors are used in the GUI and in the terminal when |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
776 'termguicolors' is set. When not using GUI colors (GUI mode |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
777 or 'termguicolors'), the terminal window always uses the 16 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
778 ANSI colors of the underlying terminal. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
779 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
780 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
781 GetBufnr()->term_setansicolors(colors) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
782 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
783 < {only available with GUI enabled and/or the |+termguicolors| |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
784 feature} |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
785 |
25700 | 786 |
787 term_setapi({buf}, {expr}) *term_setapi()* | |
788 Set the function name prefix to be used for the |terminal-api| | |
789 function in terminal {buf}. For example: > | |
790 :call term_setapi(buf, "Myapi_") | |
791 :call term_setapi(buf, "") | |
792 < | |
793 The default is "Tapi_". When {expr} is an empty string then | |
794 no |terminal-api| function can be used for {buf}. | |
795 | |
796 When used as a method the base is used for {buf}: > | |
797 GetBufnr()->term_setapi({expr}) | |
798 | |
799 | |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
800 term_setkill({buf}, {how}) *term_setkill()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
801 When exiting Vim or trying to close the terminal window in |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
802 another way, {how} defines whether the job in the terminal can |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
803 be stopped. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
804 When {how} is empty (the default), the job will not be |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
805 stopped, trying to exit will result in |E947|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
806 Otherwise, {how} specifies what signal to send to the job. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
807 See |job_stop()| for the values. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
808 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
809 After sending the signal Vim will wait for up to a second to |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
810 check that the job actually stopped. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
811 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
812 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
813 GetBufnr()->term_setkill(how) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
814 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
815 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
816 term_setrestore({buf}, {command}) *term_setrestore()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
817 Set the command to write in a session file to restore the job |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
818 in this terminal. The line written in the session file is: > |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
819 terminal ++curwin ++cols=%d ++rows=%d {command} |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
820 < Make sure to escape the command properly. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
821 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
822 Use an empty {command} to run 'shell'. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
823 Use "NONE" to not restore this window. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
824 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
825 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
826 GetBufnr()->term_setrestore(command) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
827 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
828 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
829 term_setsize({buf}, {rows}, {cols}) *term_setsize()* *E955* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
830 Set the size of terminal {buf}. The size of the window |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
831 containing the terminal will also be adjusted, if possible. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
832 If {rows} or {cols} is zero or negative, that dimension is not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
833 changed. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
834 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
835 {buf} must be the buffer number of a terminal window. Use an |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
836 empty string for the current buffer. If the buffer does not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
837 exist or is not a terminal window, an error is given. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
838 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
839 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
840 GetBufnr()->term_setsize(rows, cols) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
841 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
842 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
843 term_start({cmd} [, {options}]) *term_start()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
844 Open a terminal window and run {cmd} in it. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
845 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
846 {cmd} can be a string or a List, like with |job_start()|. The |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
847 string "NONE" can be used to open a terminal window without |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
848 starting a job, the pty of the terminal can be used by a |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
849 command like gdb. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
850 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
851 Returns the buffer number of the terminal window. If {cmd} |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
852 cannot be executed the window does open and shows an error |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
853 message. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
854 If opening the window fails zero is returned. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
855 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
856 {options} are similar to what is used for |job_start()|, see |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
857 |job-options|. However, not all options can be used. These |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
858 are supported: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
859 all timeout options |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
860 "stoponexit", "cwd", "env" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
861 "callback", "out_cb", "err_cb", "exit_cb", "close_cb" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
862 "in_io", "in_top", "in_bot", "in_name", "in_buf" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
863 "out_io", "out_name", "out_buf", "out_modifiable", "out_msg" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
864 "err_io", "err_name", "err_buf", "err_modifiable", "err_msg" |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
865 However, at least one of stdin, stdout or stderr must be |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
866 connected to the terminal. When I/O is connected to the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
867 terminal then the callback function for that part is not used. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
868 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
869 There are extra options: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
870 "term_name" name to use for the buffer name, instead |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
871 of the command name. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
872 "term_rows" vertical size to use for the terminal, |
26113
c421c9599d83
patch 8.2.3589: failure when "term_rows" of term_start() is an unusual value
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
873 instead of using 'termwinsize'; valid |
c421c9599d83
patch 8.2.3589: failure when "term_rows" of term_start() is an unusual value
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
874 range is from zero to 1000 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
875 "term_cols" horizontal size to use for the terminal, |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
876 instead of using 'termwinsize' |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
877 "vertical" split the window vertically; note that |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
878 other window position can be defined with |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
879 command modifiers, such as |:belowright|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
880 "curwin" use the current window, do not split the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
881 window; fails if the current buffer |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
882 cannot be |abandon|ed |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
883 "hidden" do not open a window |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
884 "norestore" do not add the terminal window to a |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
885 session file |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
886 "term_kill" what to do when trying to close the |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
887 terminal window, see |term_setkill()| |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
888 "term_finish" What to do when the job is finished: |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
889 "close": close any windows |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
890 "open": open window if needed |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
891 Note that "open" can be interruptive. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
892 See |term++close| and |term++open|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
893 "term_opencmd" command to use for opening the window when |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
894 "open" is used for "term_finish"; must |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
895 have "%d" where the buffer number goes, |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
896 e.g. "10split|buffer %d"; when not |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
897 specified "botright sbuf %d" is used |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19303
diff
changeset
|
898 "term_highlight" highlight group to use instead of |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19303
diff
changeset
|
899 "Terminal" |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
900 "eof_chars" Text to send after all buffer lines were |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
901 written to the terminal. When not set |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
902 CTRL-D is used on MS-Windows. For Python |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
903 use CTRL-Z or "exit()". For a shell use |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
904 "exit". A CR is always added. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
905 "ansi_colors" A list of 16 color names or hex codes |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
906 defining the ANSI palette used in GUI |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
907 color modes. See |g:terminal_ansi_colors|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
908 "tty_type" (MS-Windows only): Specify which pty to |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
909 use. See 'termwintype' for the values. |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
910 "term_api" function name prefix for the |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
911 |terminal-api| function. See |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
912 |term_setapi()|. |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
913 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
914 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
915 GetCommand()->term_start() |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
916 |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
917 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
918 term_wait({buf} [, {time}]) *term_wait()* |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
919 Wait for pending updates of {buf} to be handled. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
920 {buf} is used as with |term_getsize()|. |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
921 {time} is how long to wait for updates to arrive in msec. If |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
922 not set then 10 msec will be used. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
923 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
924 Can also be used as a |method|: > |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17259
diff
changeset
|
925 GetBufnr()->term_wait() |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
926 |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
927 ============================================================================== |
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
928 3. Terminal communication *terminal-communication* |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
929 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
930 There are several ways to communicate with the job running in a terminal: |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
931 - Use |term_sendkeys()| to send text and escape sequences from Vim to the job. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
932 - Use the JSON API to send encoded commands from the job to Vim. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
933 - Use the |client-server| mechanism. This works on machines with an X server |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
934 and on MS-Windows. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
935 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
936 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
937 Vim to job: term_sendkeys() ~ |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
938 *terminal-to-job* |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
939 This allows for remote controlling the job running in the terminal. It is a |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
940 one-way mechanism. The job can update the display to signal back to Vim. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
941 For example, if a shell is running in a terminal, you can do: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
942 call term_sendkeys(buf, "ls *.java\<CR>") |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
943 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
944 This requires for the job to be in the right state where it will do the right |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
945 thing when receiving the keys. For the above example, the shell must be |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
946 waiting for a command to be typed. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
947 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
948 For a job that was written for the purpose, you can use the JSON API escape |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
949 sequence in the other direction. E.g.: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
950 call term_sendkeys(buf, "\<Esc>]51;["response"]\x07") |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
951 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
952 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
953 Job to Vim: JSON API ~ |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
954 *terminal-api* |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
955 The job can send JSON to Vim, using a special escape sequence. The JSON |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
956 encodes a command that Vim understands. Example of such a message: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
957 <Esc>]51;["drop", "README.md"]<07> |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
958 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
959 The body is always a list, making it easy to find the end: ]<07>. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
960 The <Esc>]51;msg<07> sequence is reserved by xterm for "Emacs shell", which is |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
961 similar to what we are doing here. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
962 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
963 Currently supported commands: |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
964 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
965 call {funcname} {argument} |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
966 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
967 Call a user defined function with {argument}. |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
968 The function is called with two arguments: the buffer number |
18831 | 969 of the terminal and {argument}, the decoded JSON argument. |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
970 By default, the function name must start with "Tapi_" to avoid |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
971 accidentally calling a function not meant to be used for the |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18130
diff
changeset
|
972 terminal API. This can be changed with |term_setapi()|. |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
973 The user function should sanity check the argument. |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
974 The function can use |term_sendkeys()| to send back a reply. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
975 Example in JSON: > |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
976 ["call", "Tapi_Impression", ["play", 14]] |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
977 < Calls a function defined like this: > |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
978 function Tapi_Impression(bufnum, arglist) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
979 if len(a:arglist) == 2 |
27903 | 980 echomsg "impression " .. a:arglist[0] |
981 echomsg "count " .. a:arglist[1] | |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
982 endif |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
983 endfunc |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
984 < Output from `:echo` may be erased by a redraw, use `:echomsg` |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
985 to be able to see it with `:messages`. |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
986 |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
987 drop {filename} [options] |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
988 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
989 Let Vim open a file, like the `:drop` command. If {filename} |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
990 is already open in a window, switch to that window. Otherwise |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
991 open a new window to edit {filename}. |
13857 | 992 Note that both the job and Vim may change the current |
993 directory, thus it's best to use the full path. | |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
994 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
995 [options] is only used when opening a new window. If present, |
19968 | 996 it must be a Dict. Similarly to |++opt|, these entries are |
16808 | 997 recognized: |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
998 "ff" file format: "dos", "mac" or "unix" |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
999 "fileformat" idem |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1000 "enc" overrides 'fileencoding' |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1001 "encoding" idem |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1002 "bin" sets 'binary' |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1003 "binary" idem |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1004 "nobin" resets 'binary' |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1005 "nobinary" idem |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1006 "bad" specifies behavior for bad characters, see |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1007 |++bad| |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13563
diff
changeset
|
1008 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1009 Example in JSON: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1010 ["drop", "path/file.txt", {"ff": "dos"}] |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1011 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1012 A trick to have Vim send this escape sequence: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1013 exe "set t_ts=\<Esc>]51; t_fs=\x07" |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
1014 let &titlestring = '["call","Tapi_TryThis",["hello",123]]' |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1015 redraw |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1016 set t_ts& t_fs& |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1017 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1018 Rationale: Why not allow for any command or expression? Because that might |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1019 create a security problem. |
29659 | 1020 *terminal-autoshelldir* |
1021 This can be used to pass the current directory from a shell to Vim. | |
1022 Put this in your .vimrc: > | |
29840 | 1023 def g:Tapi_lcd(_, path: string) |
1024 if isdirectory(path) | |
1025 execute 'silent lcd ' .. fnameescape(path) | |
1026 endif | |
29659 | 1027 enddef |
1028 < | |
1029 And, in a bash init file: > | |
1030 if [[ -n "$VIM_TERMINAL" ]]; then | |
1031 PROMPT_COMMAND='_vim_sync_PWD' | |
1032 function _vim_sync_PWD() { | |
1033 printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD" | |
1034 } | |
1035 fi | |
1036 < | |
1037 Or, for zsh: > | |
1038 if [[ -n "$VIM_TERMINAL" ]]; then | |
1039 autoload -Uz add-zsh-hook | |
1040 add-zsh-hook -Uz chpwd _vim_sync_PWD | |
1041 function _vim_sync_PWD() { | |
1042 printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD" | |
1043 } | |
1044 fi | |
1045 < | |
1046 Or, for fish: > | |
1047 if test -n "$VIM_TERMINAL" | |
1048 function _vim_sync_PWD --on-variable=PWD | |
1049 printf '\033]51;["call", "Tapi_lcd", "%s"]\007' "$PWD" | |
1050 end | |
1051 end | |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1052 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1053 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1054 Using the client-server feature ~ |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1055 *terminal-client-server* |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1056 This only works when v:servername is not empty. If needed you can set it, |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1057 before opening the terminal, with: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1058 call remote_startserver('vim-server') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1059 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1060 $VIM_SERVERNAME is set in the terminal to pass on the server name. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1061 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1062 In the job you can then do something like: > |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1063 vim --servername $VIM_SERVERNAME --remote +123 some_file.c |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1064 This will open the file "some_file.c" and put the cursor on line 123. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1065 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13482
diff
changeset
|
1066 ============================================================================== |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
1067 4. Remote testing *terminal-testing* |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1069 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
|
1070 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
|
1071 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
|
1072 inspects the resulting screen state. |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1073 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 Functions ~ |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1076 |term_sendkeys()| send keystrokes to a terminal (not subject to tmap) |
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1077 |term_wait()| wait for screen to be updated |
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1078 |term_scrape()| inspect terminal screen |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1080 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1081 ============================================================================== |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
1082 5. Diffing screen dumps *terminal-diff* |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1083 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1084 In some cases it can be bothersome to test that Vim displays the right |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1085 characters on the screen. E.g. with syntax highlighting. To make this |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1086 simpler it is possible to take a screen dump of a terminal and compare it to |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1087 an expected screen dump. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1088 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1089 Vim uses the window size, text, color and other attributes as displayed. The |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1090 Vim screen size, font and other properties do not matter. Therefore this |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1091 mechanism is portable across systems. A conventional screenshot would reflect |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1092 all differences, including font size and family. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1093 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1094 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1095 Writing a screen dump test for Vim ~ |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1096 *terminal-dumptest* |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1097 For an example see the Test_syntax_c() function in |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1098 src/testdir/test_syntax.vim. The main parts are: |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1099 - Write a file you want to test with. This is useful for testing syntax |
19303 | 1100 highlighting. You can also start Vim with an empty buffer. |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1101 - Run Vim in a terminal with a specific size. The default is 20 lines of 75 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1102 characters. This makes sure the dump is always this size. The function |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1103 RunVimInTerminal() takes care of this. Pass it the arguments for the Vim |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1104 command. |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1105 - Send any commands to Vim using |term_sendkeys()|. For example: > |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1106 call term_sendkeys(buf, ":echo &lines &columns\<CR>") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1107 - Check that the screen is now in the expected state, using |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1108 VerifyScreenDump(). This expects the reference screen dump to be in the |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1109 src/testdir/dumps/ directory. Pass the name without ".dump". It is |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1110 recommended to use the name of the test function and a sequence number, so |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1111 that we know what test is using the file. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1112 - Repeat sending commands and checking the state. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1113 - Finally stop Vim by calling StopVimInTerminal(). |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1114 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1115 The first time you do this you won't have a screen dump yet. Create an empty |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1116 file for now, e.g.: > |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1117 touch src/testdir/dumps/Test_function_name_01.dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1118 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1119 The test will then fail, giving you the command to compare the reference dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1120 and the failed dump, e.g.: > |
18719 | 1121 call term_dumpdiff("failed/Test_func.dump", "dumps/Test_func.dump") |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1122 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1123 Use this command in Vim, with the current directory set to src/testdir. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1124 Once you are satisfied with the test, move the failed dump in place of the |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1125 reference: > |
18719 | 1126 :!mv failed/Test_func.dump dumps/Test_func.dump |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1127 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1128 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1129 Creating a screen dump ~ |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1130 *terminal-screendump* |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1131 To create the screen dump, run Vim (or any other program) in a terminal and |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1132 make it show the desired state. Then use the |term_dumpwrite()| function to |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1133 create a screen dump file. For example: > |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1134 :call term_dumpwrite(77, "mysyntax.dump") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1135 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1136 Here "77" is the buffer number of the terminal. Use `:ls!` to see it. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1137 |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1138 You can view the screen dump with |term_dumpload()|: > |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1139 :call term_dumpload("mysyntax.dump") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1140 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1141 To verify that Vim still shows exactly the same screen, run Vim again with |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1142 exactly the same way to show the desired state. Then create a screen dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1143 again, using a different file name: > |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1144 :call term_dumpwrite(88, "test.dump") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1145 |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1146 To assert that the files are exactly the same use |assert_equalfile()|: > |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1147 call assert_equalfile("mysyntax.dump", "test.dump") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1148 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1149 If there are differences then v:errors will contain the error message. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1150 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1151 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1152 Comparing screen dumps ~ |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1153 *terminal-diffscreendump* |
14249
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1154 |assert_equalfile()| does not make it easy to see what is different. |
4543777545a3
Updated runtime and language files.
Christian Brabandt <cb@256bit.org>
parents:
14126
diff
changeset
|
1155 To spot the problem use |term_dumpdiff()|: > |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1156 call term_dumpdiff("mysyntax.dump", "test.dump") |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1157 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1158 This will open a window consisting of three parts: |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1159 1. The contents of the first dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1160 2. The difference between the first and second dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1161 3. The contents of the second dump |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1162 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1163 You can usually see what differs in the second part. Use the 'ruler' to |
14695 | 1164 relate it to the position in the first or second dump. Letters indicate the |
1165 kind of difference: | |
1166 X different character | |
1167 > cursor in first but not in second | |
1168 < cursor in second but not in first | |
1169 w character width differs (single vs double width) | |
1170 f foreground color differs | |
1171 b background color differs | |
1172 a attribute differs (bold, underline, reverse, etc.) | |
1173 ? character missing in both | |
1174 + character missing in first | |
1175 - character missing in second | |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1176 |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1177 Alternatively, press "s" to swap the first and second dump. Do this several |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1178 times so that you can spot the difference in the context of the text. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1179 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
13125
diff
changeset
|
1180 ============================================================================== |
17259
6dbb9b3c53e2
patch 8.1.1629: terminal function help is in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
1181 6. Debugging *terminal-debug* *terminal-debugger* |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1182 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1183 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
|
1184 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
|
1185 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
|
1186 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1187 When the |+terminal| feature is missing, the plugin will use the "prompt" |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1188 buffer type, if possible. The running program will then use a newly opened |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1189 terminal window. See |termdebug-prompt| below for details. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1190 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1191 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1192 Starting ~ |
12826 | 1193 *termdebug-starting* |
12254 | 1194 Load the plugin with this command: > |
1195 packadd termdebug | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1196 < *:Termdebug* |
14519 | 1197 To start debugging use `:Termdebug` or `:TermdebugCommand` followed by the |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1198 command name, for example: > |
12559 | 1199 :Termdebug vim |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1200 |
12254 | 1201 This opens two windows: |
13051 | 1202 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1203 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
|
1204 can directly interact with gdb. The buffer name is "!gdb". |
13051 | 1205 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1206 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
|
1207 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
|
1208 that it does not interfere with controlling gdb. The buffer |
27321 | 1209 name is "debugged program". |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1210 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1211 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
|
1212 source file location will be displayed, if possible. A sign is used to |
18831 | 1213 highlight the current position, using highlight group debugPC. |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1214 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1215 If the buffer in the current window is modified, another window will be opened |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1216 to display the current gdb position. You can use `:Winbar` to add a window |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1217 toolbar there. |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1218 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1219 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
|
1220 the same as any command running in a terminal window. |
12254 | 1221 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1222 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
|
1223 opened windows are closed. |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1225 Only one debugger can be active at a time. |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1226 *:TermdebugCommand* |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1227 If you want to give specific commands to the command being debugged, you can |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1228 use the `:TermdebugCommand` command followed by the command name and |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1229 additional parameters. > |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1230 :TermdebugCommand vim --clean -c ':set nu' |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1231 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1232 Both the `:Termdebug` and `:TermdebugCommand` support an optional "!" bang |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1233 argument to start the command right away, without pausing at the gdb window |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1234 (and cursor will be in the debugged window). For example: > |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1235 :TermdebugCommand! vim --clean |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1236 |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1237 To attach gdb to an already running executable or use a core file, pass extra |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1238 arguments. E.g.: > |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1239 :Termdebug vim core |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1240 :Termdebug vim 98343 |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13680
diff
changeset
|
1241 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1242 If no argument is given, you'll end up in a gdb window, in which you need to |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1243 specify which command to run using e.g. the gdb `file` command. |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1244 |
12254 | 1245 |
12559 | 1246 Example session ~ |
12826 | 1247 *termdebug-example* |
12559 | 1248 Start in the Vim "src" directory and build Vim: > |
1249 % make | |
18489 | 1250 Make sure that debug symbols are present, usually that means that $CFLAGS |
1251 includes "-g". | |
1252 | |
12559 | 1253 Start Vim: > |
1254 % ./vim | |
18489 | 1255 |
12559 | 1256 Load the termdebug plugin and start debugging Vim: > |
1257 :packadd termdebug | |
1258 :Termdebug vim | |
1259 You should now have three windows: | |
1260 source - where you started, has a window toolbar with buttons | |
1261 gdb - you can type gdb commands here | |
1262 program - the executed program will use this window | |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1263 |
12559 | 1264 You can use CTRL-W CTRL-W or the mouse to move focus between windows. |
1265 Put focus on the gdb window and type: > | |
1266 break ex_help | |
1267 run | |
1268 Vim will start running in the program window. Put focus there and type: > | |
1269 :help gui | |
18831 | 1270 Gdb will run into the ex_help breakpoint. The source window now shows the |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1271 ex_cmds.c file. A red "1 " marker will appear in the signcolumn where the |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1272 breakpoint was set. The line where the debugger stopped is highlighted. You |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1273 can now step through the program. Let's use the mouse: click on the "Next" |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1274 button in the window toolbar. You will see the highlighting move as the |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1275 debugger executes a line of source code. |
12559 | 1276 |
1277 Click "Next" a few times until the for loop is highlighted. Put the cursor on | |
1278 the end of "eap->arg", then click "Eval" in the toolbar. You will see this | |
1279 displayed: | |
1280 "eap->arg": 0x555555e68855 "gui" ~ | |
1281 This way you can inspect the value of local variables. You can also focus the | |
1282 gdb window and use a "print" command, e.g.: > | |
1283 print *eap | |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1284 If mouse pointer movements are working, Vim will also show a balloon when the |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1285 mouse rests on text that can be evaluated by gdb. |
12559 | 1286 |
1287 Now go back to the source window and put the cursor on the first line after | |
1288 the for loop, then type: > | |
1289 :Break | |
1290 You will see a ">>" marker appear, this indicates the new breakpoint. Now | |
1291 click "Cont" in the toolbar and the code until the breakpoint will be | |
1292 executed. | |
1293 | |
1294 You can type more advanced commands in the gdb window. For example, type: > | |
1295 watch curbuf | |
1296 Now click "Cont" in the toolbar (or type "cont" in the gdb window). Execution | |
1297 will now continue until the value of "curbuf" changes, which is in do_ecmd(). | |
1298 To remove this watchpoint again type in the gdb window: > | |
1299 delete 3 | |
1300 | |
1301 You can see the stack by typing in the gdb window: > | |
1302 where | |
1303 Move through the stack frames, e.g. with: > | |
1304 frame 3 | |
1305 The source window will show the code, at the point where the call was made to | |
1306 a deeper level. | |
1307 | |
1308 | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1309 Stepping through code ~ |
12826 | 1310 *termdebug-stepping* |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1311 Put focus on the gdb window to type commands there. Some common ones are: |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1312 - CTRL-C interrupt the program |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1313 - next execute the current line and stop at the next line |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1314 - step execute the current line and stop at the next statement, |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1315 entering functions |
28517 | 1316 - until execute until past the current cursor line or past a specified |
1317 position or the current stack frame returns | |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1318 - finish execute until leaving the current function |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1319 - where show the stack |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1320 - frame N go to the Nth stack frame |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1321 - continue continue execution |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1322 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1323 *:Run* *:Arguments* |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1324 In the window showing the source code these commands can be used to control |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1325 gdb: |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1326 `:Run` [args] run the program with [args] or the previous arguments |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1327 `:Arguments` {args} set arguments for the next `:Run` |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1328 |
18130 | 1329 *:Break* set a breakpoint at the cursor position |
1330 :Break {position} | |
18343 | 1331 set a breakpoint at the specified position |
18130 | 1332 *:Clear* delete the breakpoint at the cursor position |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
1333 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1334 *:Step* execute the gdb "step" command |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1335 *:Over* execute the gdb "next" command (`:Next` is a Vim command) |
28517 | 1336 *:Until* execute the gdb "until" command |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1337 *:Finish* execute the gdb "finish" command |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1338 *:Continue* execute the gdb "continue" command |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1339 *:Stop* interrupt the program |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1340 |
13051 | 1341 If 'mouse' is set the plugin adds a window toolbar with these entries: |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1342 Step `:Step` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1343 Next `:Over` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1344 Finish `:Finish` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1345 Cont `:Continue` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1346 Stop `:Stop` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1347 Eval `:Evaluate` |
13051 | 1348 This way you can use the mouse to perform the most common commands. You need |
1349 to have the 'mouse' option set to enable mouse clicks. | |
31139 | 1350 See |termdebug_winbar| for configuring this toolbar. |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1351 *:Winbar* |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1352 You can add the window toolbar in other windows you open with: > |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1353 :Winbar |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1354 |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1355 If gdb stops at a source line and there is no window currently showing the |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1356 source code, a new window will be created for the source code. This also |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1357 happens if the buffer in the source code window has been modified and can't be |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1358 abandoned. |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1359 |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1360 Gdb gives each breakpoint a number. In Vim the number shows up in the sign |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1361 column, with a red background. You can use these gdb commands: |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1362 - info break list breakpoints |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1363 - delete N delete breakpoint N |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1364 You can also use the `:Clear` command if the cursor is in the line with the |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1365 breakpoint, or use the "Clear breakpoint" right-click menu entry. |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1366 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1367 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1368 Inspecting variables ~ |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1369 *termdebug-variables* *:Evaluate* |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1370 `:Evaluate` evaluate the expression under the cursor |
20552 | 1371 `K` same (see |termdebug_map_K| to disable) |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1372 `:Evaluate` {expr} evaluate {expr} |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1373 `:'<,'>Evaluate` evaluate the Visually selected text |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1374 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1375 This is similar to using "print" in the gdb window. |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1376 You can usually shorten `:Evaluate` to `:Ev`. |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1377 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1378 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
1379 Other commands ~ |
12826 | 1380 *termdebug-commands* |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1381 *:Gdb* jump to the gdb window |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1382 *:Program* jump to the window with the running program |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
1383 *:Source* jump to the window with the source code, create it if there |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13589
diff
changeset
|
1384 isn't one |
23573 | 1385 *:Asm* jump to the window with the disassembly, create it if there |
1386 isn't one | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1387 |
25619 | 1388 Events ~ |
1389 *termdebug-events* | |
1390 Four autocommands can be used: > | |
1391 au User TermdebugStartPre echomsg 'debugging starting' | |
1392 au User TermdebugStartPost echomsg 'debugging started' | |
1393 au User TermdebugStopPre echomsg 'debugging stopping' | |
1394 au User TermdebugStopPost echomsg 'debugging stopped' | |
1395 < | |
1396 *TermdebugStartPre* | |
1397 TermdebugStartPre Before starting debugging. | |
1398 Not triggered if the debugger is already | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1399 running or the debugger command cannot be |
25619 | 1400 executed. |
1401 *TermdebugStartPost* | |
1402 TermdebugStartPost After debugging has initialized. | |
1403 If a "!" bang is passed to `:Termdebug` or | |
1404 `:TermdebugCommand` the event is triggered | |
1405 before running the provided command in gdb. | |
1406 *TermdebugStopPre* | |
1407 TermdebugStopPre Before debugging ends, when gdb is terminated, | |
1408 most likely after issuing a "quit" command in | |
1409 the gdb window. | |
1410 *TermdebugStopPost* | |
1411 TermdebugStopPost After debugging has ended, gdb-related windows | |
1412 are closed, debug buffers wiped out and | |
1413 the state before the debugging was restored. | |
1414 | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1415 |
31139 | 1416 Customizing ~ |
1417 *termdebug-customizing* *g:termdebug_config* | |
1418 In the past several global variables were used for configuration. These are | |
1419 deprecated and using the g:termdebug_config dictionary is preferred. When | |
1420 g:termdebug_config exists the other global variables will NOT be used. | |
1421 The recommended way is to start with an empty dictionary: > | |
1422 let g:termdebug_config = {} | |
1423 | |
1424 Then you can add entries to the dictionary as mentioned below. The | |
1425 deprecated global variable names are mentioned for completeness. If you are | |
1426 switching over to using g:termdebug_config you can find the old variable name | |
1427 and take over the value, then delete the deprecated variable. | |
1428 | |
1429 | |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1430 Prompt mode ~ |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1431 *termdebug-prompt* |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1432 When the |+terminal| feature is not supported and on MS-Windows, gdb will run |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1433 in a buffer with 'buftype' set to "prompt". This works slightly differently: |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1434 - The gdb window will be in Insert mode while typing commands. Go to Normal |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1435 mode with <Esc>, then you can move around in the buffer, copy/paste, etc. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1436 Go back to editing the gdb command with any command that starts Insert mode, |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1437 such as `a` or `i`. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1438 - The program being debugged will run in a separate window. On MS-Windows |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1439 this is a new console window. On Unix, if the |+terminal| feature is |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1440 available a Terminal window will be opened to run the debugged program in. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1441 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1442 *termdebug_use_prompt* |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1443 Prompt mode can be used even when the |+terminal| feature is present with: > |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1444 let g:termdebug_config['use_prompt'] = 1 |
31139 | 1445 If there is no g:termdebug_config you can use: > |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1446 let g:termdebug_use_prompt = 1 |
20552 | 1447 < |
1448 *termdebug_map_K* | |
1449 The K key is normally mapped to :Evaluate. If you do not want this use: > | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1450 let g:termdebug_config['map_K'] = 0 |
31139 | 1451 If there is no g:termdebug_config you can use: > |
20552 | 1452 let g:termdebug_map_K = 0 |
23573 | 1453 < |
1454 *termdebug_disasm_window* | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1455 If you want the Asm window shown by default, set the flag to 1. |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1456 the "disasm_window_height" entry can be used to set the window height: > |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1457 let g:termdebug_config['disasm_window'] = 1 |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1458 let g:termdebug_config['disasm_window_height'] = 15 |
31139 | 1459 If there is no g:termdebug_config you can use: > |
23573 | 1460 let g:termdebug_disasm_window = 15 |
29290 | 1461 Any value greater than 1 will set the Asm window height to that value. |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1462 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1463 Communication ~ |
12826 | 1464 *termdebug-communication* |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1465 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
|
1466 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
|
1467 will break the debugger. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1468 |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1469 Gdb has some weird behavior, the plugin does its best to work around that. |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1470 For example, after typing "continue" in the gdb window a CTRL-C can be used to |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1471 interrupt the running program. But after using the MI command |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1472 "-exec-continue" pressing CTRL-C does not interrupt. Therefore you will see |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1473 "continue" being used for the `:Continue` command, instead of using the |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1474 communication channel. |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14123
diff
changeset
|
1475 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1476 |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1477 GDB command ~ |
25619 | 1478 *g:termdebugger* |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1479 To change the name of the gdb command, set "debugger" entry in |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1480 g:termdebug_config or the "g:termdebugger" variable before invoking |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1481 `:Termdebug`: > |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1482 let g:termdebug_config['command'] = "mygdb" |
31139 | 1483 If there is no g:termdebug_config you can use: > |
25619 | 1484 let g:termdebugger = "mygdb" |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1485 |
26708 | 1486 If the command needs an argument use a List: > |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1487 let g:termdebug_config['command'] = ['rr', 'replay', '--'] |
31139 | 1488 If there is no g:termdebug_config you can use: > |
26708 | 1489 let g:termdebugger = ['rr', 'replay', '--'] |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1490 |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1491 Several arguments will be added to make gdb work well for the debugger. |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1492 If you want to modify them, add a function to filter the argument list: > |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1493 let g:termdebug_config['command_filter'] = MyDebugFilter |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1494 |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1495 If you do not want the arguments to be added, but you do need to set the |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1496 "pty", use a function to add the necessary arguments: > |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1497 let g:termdebug_config['command_add_args'] = MyAddArguments |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1498 The function will be called with the list of arguments so far, and a second |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1499 argument that is the name of the pty. |
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1500 *gdb-version* |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1501 Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI |
13482
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1502 interface. The "new-ui" command requires gdb version 7.12 or later. if you |
9eebe457eb3c
Update runtime files. Convert a couple of help files to utf-8.
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1503 get this error: |
12756
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
12559
diff
changeset
|
1504 Undefined command: "new-ui". Try "help".~ |
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
12559
diff
changeset
|
1505 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
|
1506 |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1507 |
29290 | 1508 Colors ~ |
31139 | 1509 *hl-debugPC* *hl-debugBreakpoint* |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1510 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
|
1511 - debugPC the current position |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1512 - debugBreakpoint a breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1513 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1514 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
|
1515 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
|
1516 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
|
1517 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1518 When 'background' is "dark": |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12311
diff
changeset
|
1519 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
|
1520 hi debugBreakpoint term=reverse ctermbg=red guibg=red |
12254 | 1521 |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1522 |
29290 | 1523 Shortcuts ~ |
1524 *termdebug_shortcuts* | |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1525 You can define your own shortcuts (mappings) to control gdb, that can work in |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1526 any window, using the TermDebugSendCommand() function. Example: > |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1527 map ,w :call TermDebugSendCommand('where')<CR> |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1528 The argument is the gdb command. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1529 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1530 |
29290 | 1531 Popup menu ~ |
1532 *termdebug_popup* | |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1533 By default the Termdebug plugin sets 'mousemodel' to "popup_setpos" and adds |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1534 these entries to the popup menu: |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1535 Set breakpoint `:Break` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1536 Clear breakpoint `:Clear` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1537 Evaluate `:Evaluate` |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1538 If you don't want this then disable it with: > |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1539 let g:termdebug_config['popup'] = 0 |
31139 | 1540 If there is no g:termdebug_config you can use: > |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1541 let g:termdebug_popup = 0 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1542 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13304
diff
changeset
|
1543 |
31139 | 1544 Window toolbar ~ |
1545 *termdebug_winbar* | |
1546 By default the Termdebug plugin creates a window toolbar if the mouse is | |
1547 enabled (see |:Winbar|). If you don't want this then disable it with: > | |
1548 let g:termdebug_config['winbar'] = 0 | |
1549 | |
1550 | |
29290 | 1551 Vim window width ~ |
1552 *termdebug_wide* | |
22958 | 1553 To change the width of the Vim window when debugging starts and use a vertical |
1554 split: > | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1555 let g:termdebug_config['wide'] = 163 |
31139 | 1556 If there is no g:termdebug_config you can use: > |
22958 | 1557 let g:termdebug_wide = 163 |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
1558 |
22958 | 1559 This will set 'columns' to 163 when `:Termdebug` is used. The value is |
1560 restored when quitting the debugger. | |
1561 | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1562 If the wide value is set and 'columns' is already a greater value, then a |
22958 | 1563 vertical split will be used without modifying 'columns'. |
1564 | |
28976
ad63d6a8ed21
patch 8.2.5010: the terminal debugger uses various global variables
Bram Moolenaar <Bram@vim.org>
parents:
28517
diff
changeset
|
1565 Set the wide value to 1 to use a vertical split without ever changing |
22958 | 1566 'columns'. This is useful when the terminal can't be resized by Vim. |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1567 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1568 |
14421 | 1569 vim:tw=78:ts=8:noet:ft=help:norl: |