Skip to content

Commit dec04ee

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents b15a5a5 + 49a613f commit dec04ee

29 files changed

+785
-318
lines changed

runtime/doc/cmdline.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ Also see |`=|.
830830
Note: these are typed literally, they are not special keys!
831831
<cword> is replaced with the word under the cursor (like |star|)
832832
<cWORD> is replaced with the WORD under the cursor (see |WORD|)
833+
<cexpr> is replaced with the word under the cursor, including more
834+
to form a C expression. E.g., when the cursor is on "arg"
835+
of "ptr->arg" then the result is "ptr->arg"; when the
836+
cursor is on "]" of "list[idx]" then the result is
837+
"list[idx]". This is used for |v:beval_text|.
833838
<cfile> is replaced with the path name under the cursor (like what
834839
|gf| uses)
835840
<afile> When executing autocommands, is replaced with the file name

runtime/doc/eval.txt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.0. Last change: 2017 Aug 13
1+
*eval.txt* For Vim version 8.0. Last change: 2017 Sep 11
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1449,7 +1449,7 @@ v:beval_text The text under or after the mouse pointer. Usually a word as
14491449
but a dot and "->" before the position is included. When on a
14501450
']' the text before it is used, including the matching '[' and
14511451
word before it. When on a Visual area within one line the
1452-
highlighted text is used.
1452+
highlighted text is used. Also see |<cexpr>|.
14531453
Only valid while evaluating the 'balloonexpr' option.
14541454

14551455
*v:beval_winnr* *beval_winnr-variable*
@@ -3301,7 +3301,7 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()*
33013301
When {ic} is given and it's |TRUE| then case is ignored.
33023302

33033303
When {comp} is a string then the number of not overlapping
3304-
occurences of {expr} is returned.
3304+
occurrences of {expr} is returned.
33053305

33063306

33073307
*cscope_connection()*
@@ -3467,7 +3467,7 @@ escape({string}, {chars}) *escape()*
34673467
:echo escape('c:\program files\vim', ' \')
34683468
< results in: >
34693469
c:\\program\ files\\vim
3470-
< Also see |shellescape()|.
3470+
< Also see |shellescape()| and |fnameescape()|.
34713471

34723472
*eval()*
34733473
eval({string}) Evaluate {string} and return the result. Especially useful to
@@ -3887,7 +3887,7 @@ float2nr({expr}) *float2nr()*
38873887
When the value of {expr} is out of range for a |Number| the
38883888
result is truncated to 0x7fffffff or -0x7fffffff (or when
38893889
64-bit Number support is enabled, 0x7fffffffffffffff or
3890-
-0x7fffffffffffffff. NaN results in -0x80000000 (or when
3890+
-0x7fffffffffffffff). NaN results in -0x80000000 (or when
38913891
64-bit Number support is enabled, -0x8000000000000000).
38923892
Examples: >
38933893
echo float2nr(3.95)
@@ -4657,12 +4657,12 @@ getqflist([{what}]) *getqflist()*
46574657
If "nr" is not present then the current quickfix list is used.
46584658
If both "nr" and a non-zero "id" are specified, then the list
46594659
specified by "id" is used.
4660-
To get the number of lists in the quickfix stack, set 'nr' to
4661-
'$' in {what}. The 'nr' value in the returned dictionary
4660+
To get the number of lists in the quickfix stack, set "nr" to
4661+
"$" in {what}. The "nr" value in the returned dictionary
46624662
contains the quickfix stack size.
4663-
When 'text' is specified, all the other items are ignored. The
4664-
returned dictionary contains the entry 'items' with the list
4665-
of entries.
4663+
When "lines" is specified, all the other items except "efm"
4664+
are ignored. The returned dictionary contains the entry
4665+
"items" with the list of entries.
46664666
In case of error processing {what}, an empty dictionary is
46674667
returned.
46684668

@@ -6967,6 +6967,7 @@ setline({lnum}, {text}) *setline()*
69676967
:for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']]
69686968
: call setline(n, l)
69696969
:endfor
6970+
69706971
< Note: The '[ and '] marks are not set.
69716972

69726973
setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()*
@@ -7164,16 +7165,17 @@ setreg({regname}, {value} [, {options}])
71647165
:call setreg('a', "1\n2\n3", 'b5')
71657166
71667167
< This example shows using the functions to save and restore a
7167-
register (note: you may not reliably restore register value
7168-
without using the third argument to |getreg()| as without it
7169-
newlines are represented as newlines AND Nul bytes are
7170-
represented as newlines as well, see |NL-used-for-Nul|). >
7168+
register: >
71717169
:let var_a = getreg('a', 1, 1)
71727170
:let var_amode = getregtype('a')
71737171
....
71747172
:call setreg('a', var_a, var_amode)
7173+
< Note: you may not reliably restore register value
7174+
without using the third argument to |getreg()| as without it
7175+
newlines are represented as newlines AND Nul bytes are
7176+
represented as newlines as well, see |NL-used-for-Nul|.
71757177

7176-
< You can also change the type of a register by appending
7178+
You can also change the type of a register by appending
71777179
nothing: >
71787180
:call setreg('a', '', 'al')
71797181
@@ -8145,7 +8147,7 @@ term_start({cmd}, {options}) *term_start()*
81458147
are supported:
81468148
all timeout options
81478149
"stoponexit"
8148-
"out_cb", "err_cb"
8150+
"callback", "out_cb", "err_cb"
81498151
"exit_cb", "close_cb"
81508152
"in_io", "in_top", "in_bot", "in_name", "in_buf"
81518153
"out_io", "out_name", "out_buf", "out_modifiable", "out_msg"
@@ -8165,6 +8167,7 @@ term_start({cmd}, {options}) *term_start()*
81658167
"curwin" use the current window, do not split the
81668168
window; fails if the current buffer
81678169
cannot be |abandon|ed
8170+
"hidden" do not open a window
81688171
"term_finish" What to do when the job is finished:
81698172
"close": close any windows
81708173
"open": open window if needed
@@ -8562,7 +8565,7 @@ win_getid([{win} [, {tab}]]) *win_getid()*
85628565
Get the |window-ID| for the specified window.
85638566
When {win} is missing use the current window.
85648567
With {win} this is the window number. The top window has
8565-
number 1.
8568+
number 1. Use `win_getid(winnr())` for the current window.
85668569
Without {tab} use the current tab, otherwise the tab with
85678570
number {tab}. The first tab has number one.
85688571
Return zero if the window cannot be found.

runtime/doc/map.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,8 @@ The valid escape sequences are
14151415
<line1> The starting line of the command range.
14161416
*<line2>*
14171417
<line2> The final line of the command range.
1418+
*<range>*
1419+
<range> The number of items in the command range: 0, 1 or 2
14181420
*<count>*
14191421
<count> Any count supplied (as described for the '-range'
14201422
and '-count' attributes).

runtime/doc/quickfix.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ From inside Vim an easy way to run a command and handle the output is with the
4444
The 'errorformat' option should be set to match the error messages from your
4545
compiler (see |errorformat| below).
4646

47+
*quickfix-ID*
48+
Each quickfix list has a unique identifier called the quickfix ID and this
49+
number will not change within a Vim session. The getqflist() function can be
50+
used to get the identifier assigned to a list.
51+
52+
*quickfix-ID*
53+
Each quickfix list has a unique identifier called the quickfix ID and this
54+
number will not change within a Vim session. The getqflist() function can be
55+
used to get the identifier assigned to a list. There is also a quickfix list
56+
number which may change whenever more than ten lists are added to a quickfix
57+
stack.
58+
4759
*location-list* *E776*
4860
A location list is a window-local quickfix list. You get one after commands
4961
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a

runtime/doc/terminal.txt

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*terminal.txt* For Vim version 8.0. Last change: 2017 Aug 29
1+
*terminal.txt* For Vim version 8.0. Last change: 2017 Sep 10
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,11 +30,11 @@ This feature is for running a terminal emulator in a Vim window. A job can be
3030
started connected to the terminal emulator. For example, to run a shell: >
3131
:term bash
3232
33-
Or to run a debugger: >
34-
:term gdb vim
33+
Or to run build command: >
34+
:term make myprogram
3535
3636
The job runs asynchronously from Vim, the window will be updated to show
37-
output from the job, also while editing in any other window.
37+
output from the job, also while editing in another window.
3838

3939

4040
Typing ~
@@ -109,7 +109,8 @@ Syntax ~
109109

110110
If [range] is given the specified lines are used as
111111
input for the job. It will not be possible to type
112-
keys in the terminal window.
112+
keys in the terminal window. For MS-Windows see the
113+
++eof argument below.
113114

114115
Two comma separated numbers are used as "rows,cols".
115116
E.g. `:24,80gdb` opens a terminal with 24 rows and 80
@@ -133,14 +134,15 @@ Syntax ~
133134
height.
134135
++cols={width} Use {width} for the terminal window
135136
width.
136-
++eof={text} when using [range], text to send after
137-
the last line was written. The default
138-
is to send CTRL-D. A CR is appended.
137+
++eof={text} when using [range]: text to send after
138+
the last line was written. Cannot
139+
contain white space. A CR is
140+
appended. For MS-Windows the default
141+
is to send CTRL-D.
139142
E.g. for a shell use "++eof=exit" and
140143
for Python "++eof=exit()". Special
141144
codes can be used like with `:map`,
142145
e.g. "<C-Z>" for CTRL-Z.
143-
{only on MS-Windows}
144146

145147
If you want to use more options use the |term_start()|
146148
function.
@@ -303,33 +305,104 @@ term_scrape() inspect terminal screen
303305
3. Debugging *terminal-debug*
304306

305307
The Terminal debugging plugin can be used to debug a program with gdb and view
306-
the source code in a Vim window.
308+
the source code in a Vim window. Since this is completely contained inside
309+
Vim this also works remotely over an ssh connection.
310+
311+
312+
Starting ~
307313

308314
Load the plugin with this command: >
309315
packadd termdebug
310-
316+
< *:Termdebug*
311317
To start debugging use `:TermDebug` folowed by the command name, for example: >
312318
:TermDebug vim
313319
314320
This opens two windows:
315-
- A terminal window in which "gdb vim" is executed. Here you can directly
316-
interact with gdb.
317-
- A terminal window for the executed program. When "run" is used in gdb the
318-
program I/O will happen in this window, so that it does not interfere with
319-
controlling gdb.
320-
The current window is used to show the source code. When gdb jumps to a
321-
source file location this window will display the code, if possible. Values
322-
of variables can be inspected, breakpoints set and cleared, etc.
321+
gdb window A terminal window in which "gdb vim" is executed. Here you
322+
can directly interact with gdb. The buffer name is "!gdb".
323+
program window A terminal window for the executed program. When "run" is
324+
used in gdb the program I/O will happen in this window, so
325+
that it does not interfere with controlling gdb. The buffer
326+
name is "gdb program".
327+
328+
The current window is used to show the source code. When gdb pauses the
329+
source file location will be displayed, if possible. A sign is used to
330+
highlight the current position (using highlight group debugPC).
331+
332+
If the buffer in the current window is modified, another window will be opened
333+
to display the current gdb position.
334+
335+
Focus the terminal of the executed program to interact with it. This works
336+
the same as any command running in a terminal window.
337+
338+
When the debugger ends, typically by typing "quit" in the gdb window, the two
339+
opened windows are closed.
340+
341+
342+
Stepping through code ~
343+
344+
Put focus on the gdb window to type commands there. Some common ones are:
345+
- CTRL-C interrupt the program
346+
- next execute the current line and stop at the next line
347+
- step execute the current line and stop at the next statement, entering
348+
functions
349+
- finish execute until leaving the current function
350+
- where show the stack
351+
- frame N go to the Nth stack frame
352+
- continue continue execution
353+
354+
In the window showing the source code some commands can used to control gdb:
355+
:Break set a breakpoint at the current line; a sign will be displayed
356+
:Delete delete a breakpoint at the current line
357+
:Step execute the gdb "step" command
358+
:Over execute the gdb "next" command (:Next is a Vim command)
359+
:Finish execute the gdb "finish" command
360+
:Continue execute the gdb "continue" command
323361

324-
When the debugger ends the two opened windows are closed.
362+
363+
Inspecting variables ~
364+
365+
:Evaluate evaluate the expression under the cursor
366+
K same
367+
:Evaluate {expr} evaluate {expr}
368+
:'<,'>Evaluate evaluate the Visually selected text
369+
370+
This is similar to using "print" in the gdb window.
371+
372+
373+
Other commands ~
374+
375+
:Gdb jump to the gdb window
376+
:Program jump to the window with the running program
377+
378+
379+
Communication ~
380+
381+
There is another, hidden, buffer, which is used for Vim to communicate with
382+
gdb. The buffer name is "gdb communication". Do not delete this buffer, it
383+
will break the debugger.
325384

326385

327386
Customizing ~
328387

329-
g:debugger The debugger command. Default "gdb".
388+
To change the name of the gdb command, set the "termdebugger" variable before
389+
invoking `:Termdebug`: >
390+
let termdebugger = "mygdb"
391+
Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI
392+
interface.
393+
394+
The color of the signs can be adjusted with these highlight groups:
395+
- debugPC the current position
396+
- debugBreakpoint a breakpoint
397+
398+
The defaults are, when 'background' is "light":
399+
hi debugPC term=reverse ctermbg=lightblue guibg=lightblue
400+
hi debugBreakpoint term=reverse ctermbg=red guibg=red
330401

402+
When 'background' is "dark":
403+
hi debugPC term=reverse ctermbg=darkblue guibg=darkblue
404+
hi debugBreakpoint term=reverse ctermbg=red guibg=red
331405

332-
TODO
333406

334407

335408
vim:tw=78:ts=8:ft=help:norl:

0 commit comments

Comments
 (0)