Skip to content

Commit fd41a38

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents af031d8 + a09bee3 commit fd41a38

68 files changed

Lines changed: 1142 additions & 264 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README_VIM9.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,18 @@ thing I have been thinking of is assignments without ":let". I often
159159
make that mistake (after writing JavaScript especially). I think it is
160160
possible, if we make local variables shadow commands. That should be OK,
161161
if you shadow a command you want to use, just rename the variable.
162-
Using "let" and "const" to declare a variable, like in JavaScript and
162+
Using "var" and "const" to declare a variable, like in JavaScript and
163163
TypeScript, can work:
164164

165165

166166
``` vim
167167
def MyFunction(arg: number): number
168-
let local = 1
169-
let todo = arg
168+
var local = 1
169+
var todo = arg
170170
const ADD = 88
171171
while todo > 0
172172
local += ADD
173-
--todo
173+
todo -= 1
174174
endwhile
175175
return local
176176
enddef
@@ -192,7 +192,7 @@ function and export it:
192192
``` vim
193193
vim9script " Vim9 script syntax used here
194194
195-
let local = 'local variable is not exported, script-local'
195+
var local = 'local variable is not exported, script-local'
196196
197197
export def MyFunction() " exported function
198198
...
@@ -248,10 +248,10 @@ END
248248
return luaeval('sum')
249249
endfunc
250250
251-
def VimNew()
252-
let sum = 0
251+
def VimNew(): number
252+
var sum = 0
253253
for i in range(1, 2999999)
254-
let sum += i
254+
sum += i
255255
endfor
256256
return sum
257257
enddef
@@ -277,7 +277,7 @@ echo 'Vim new: ' .. reltimestr(reltime(start))
277277

278278
``` vim
279279
def VimNew(): number
280-
let totallen = 0
280+
var totallen = 0
281281
for i in range(1, 100000)
282282
setline(i, ' ' .. getline(i))
283283
totallen += len(getline(i))

runtime/autoload/ccomplete.vim

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
" Vim completion script
22
" Language: C
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last Change: 2020 Apr 08
4+
" Last Change: 2020 Nov 14
55

66
let s:cpo_save = &cpo
77
set cpo&vim
88

99
" This function is used for the 'omnifunc' option.
10-
function! ccomplete#Complete(findstart, base)
10+
func ccomplete#Complete(findstart, base)
1111
if a:findstart
1212
" Locate the start of the item, including ".", "->" and "[...]".
1313
let line = getline('.')
@@ -244,7 +244,7 @@ function! ccomplete#Complete(findstart, base)
244244
return map(res, 's:Tagline2item(v:val, brackets)')
245245
endfunc
246246

247-
function! s:GetAddition(line, match, memarg, bracket)
247+
func s:GetAddition(line, match, memarg, bracket)
248248
" Guess if the item is an array.
249249
if a:bracket && match(a:line, a:match . '\s*\[') > 0
250250
return '['
@@ -260,13 +260,13 @@ function! s:GetAddition(line, match, memarg, bracket)
260260
endif
261261
endif
262262
return ''
263-
endfunction
263+
endfunc
264264

265265
" Turn the tag info "val" into an item for completion.
266266
" "val" is is an item in the list returned by taglist().
267267
" If it is a variable we may add "." or "->". Don't do it for other types,
268268
" such as a typedef, by not including the info that s:GetAddition() uses.
269-
function! s:Tag2item(val)
269+
func s:Tag2item(val)
270270
let res = {'match': a:val['name']}
271271

272272
let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
@@ -289,10 +289,10 @@ function! s:Tag2item(val)
289289
endif
290290

291291
return res
292-
endfunction
292+
endfunc
293293

294294
" Use all the items in dictionary for the "info" entry.
295-
function! s:Dict2info(dict)
295+
func s:Dict2info(dict)
296296
let info = ''
297297
for k in sort(keys(a:dict))
298298
let info .= k . repeat(' ', 10 - len(k))
@@ -307,7 +307,7 @@ function! s:Dict2info(dict)
307307
endfunc
308308

309309
" Parse a tag line and return a dictionary with items like taglist()
310-
function! s:ParseTagline(line)
310+
func s:ParseTagline(line)
311311
let l = split(a:line, "\t")
312312
let d = {}
313313
if len(l) >= 3
@@ -334,12 +334,12 @@ function! s:ParseTagline(line)
334334
endif
335335

336336
return d
337-
endfunction
337+
endfunc
338338

339339
" Turn a match item "val" into an item for completion.
340340
" "val['match']" is the matching item.
341341
" "val['tagline']" is the tagline in which the last part was found.
342-
function! s:Tagline2item(val, brackets)
342+
func s:Tagline2item(val, brackets)
343343
let line = a:val['tagline']
344344
let add = s:GetAddition(line, a:val['match'], [a:val], a:brackets == '')
345345
let res = {'word': a:val['match'] . a:brackets . add }
@@ -377,10 +377,10 @@ function! s:Tagline2item(val, brackets)
377377
let res['menu'] = s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t'))
378378
endif
379379
return res
380-
endfunction
380+
endfunc
381381

382382
" Turn a command from a tag line to something that is useful in the menu
383-
function! s:Tagcmd2extra(cmd, name, fname)
383+
func s:Tagcmd2extra(cmd, name, fname)
384384
if a:cmd =~ '^/^'
385385
" The command is a search command, useful to see what it is.
386386
let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/')
@@ -395,13 +395,13 @@ function! s:Tagcmd2extra(cmd, name, fname)
395395
let x = a:cmd . ' - ' . a:fname
396396
endif
397397
return x
398-
endfunction
398+
endfunc
399399

400400
" Find composing type in "lead" and match items[0] with it.
401401
" Repeat this recursively for items[1], if it's there.
402402
" When resolving typedefs "depth" is used to avoid infinite recursion.
403403
" Return the list of matches.
404-
function! s:Nextitem(lead, items, depth, all)
404+
func s:Nextitem(lead, items, depth, all)
405405

406406
" Use the text up to the variable name and split it in tokens.
407407
let tokens = split(a:lead, '\s\+\|\<')
@@ -485,15 +485,15 @@ function! s:Nextitem(lead, items, depth, all)
485485
endfor
486486

487487
return res
488-
endfunction
488+
endfunc
489489

490490

491491
" Search for members of structure "typename" in tags files.
492492
" Return a list with resulting matches.
493493
" Each match is a dictionary with "match" and "tagline" entries.
494494
" When "all" is non-zero find all, otherwise just return 1 if there is any
495495
" member.
496-
function! s:StructMembers(typename, items, all)
496+
func s:StructMembers(typename, items, all)
497497
" Todo: What about local structures?
498498
let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")'))
499499
if fnames == ''
@@ -586,12 +586,12 @@ function! s:StructMembers(typename, items, all)
586586

587587
" Failed to find anything.
588588
return []
589-
endfunction
589+
endfunc
590590

591591
" For matching members, find matches for following items.
592592
" When "all" is non-zero find all, otherwise just return 1 if there is any
593593
" member.
594-
function! s:SearchMembers(matches, items, all)
594+
func s:SearchMembers(matches, items, all)
595595
let res = []
596596
for i in range(len(a:matches))
597597
let typename = ''

runtime/doc/autocmd.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*autocmd.txt* For Vim version 8.2. Last change: 2020 Oct 26
1+
*autocmd.txt* For Vim version 8.2. Last change: 2020 Nov 12
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -70,6 +70,10 @@ effects. Be careful not to destroy your text.
7070
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
7171
See |autocmd-buflocal|.
7272

73+
If the `:autocmd` is in Vim9 script then {cmd} will be executed as in Vim9
74+
script. Thus this depends on where the autocmd is defined, not where it is
75+
triggered.
76+
7377
Note: The ":autocmd" command can only be followed by another command when the
7478
'|' appears before {cmd}. This works: >
7579
:augroup mine | au! BufRead | augroup END

runtime/doc/change.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*change.txt* For Vim version 8.2. Last change: 2020 Nov 03
1+
*change.txt* For Vim version 8.2. Last change: 2020 Nov 21
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1852,6 +1852,8 @@ found here: |sort()|, |uniq()|.
18521852
When /{pattern}/ is specified and there is no [r] flag
18531853
the text matched with {pattern} is skipped, so that
18541854
you sort on what comes after the match.
1855+
'ignorecase' applies to the pattern, but 'smartcase'
1856+
is not used.
18551857
Instead of the slash any non-letter can be used.
18561858
For example, to sort on the second comma-separated
18571859
field: >

runtime/doc/eval.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.2. Last change: 2020 Nov 04
1+
*eval.txt* For Vim version 8.2. Last change: 2020 Nov 11
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3485,8 +3485,8 @@ byteidx({expr}, {nr}) *byteidx()*
34853485
Return byte index of the {nr}'th character in the string
34863486
{expr}. Use zero for the first character, it then returns
34873487
zero.
3488-
This function is only useful when there are multibyte
3489-
characters, otherwise the returned value is equal to {nr}.
3488+
If there are no multibyte characters the returned value is
3489+
equal to {nr}.
34903490
Composing characters are not counted separately, their byte
34913491
length is added to the preceding base character. See
34923492
|byteidxcomp()| below for counting composing characters
@@ -7445,7 +7445,9 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
74457445
matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
74467446
Same as |matchfuzzy()|, but returns the list of matched
74477447
strings and the list of character positions where characters
7448-
in {str} matches.
7448+
in {str} matches. You can use |byteidx()|to convert a
7449+
character position to a byte position.
7450+
74497451

74507452
If {str} matches multiple times in a string, then only the
74517453
positions for the best match is returned.
@@ -8740,11 +8742,16 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
87408742

87418743
'ignorecase', 'smartcase' and 'magic' are used.
87428744

8743-
When the 'z' flag is not given, searching always starts in
8744-
column zero and then matches before the cursor are skipped.
8745-
When the 'c' flag is present in 'cpo' the next search starts
8746-
after the match. Without the 'c' flag the next search starts
8747-
one column further.
8745+
When the 'z' flag is not given, forward searching always
8746+
starts in column zero and then matches before the cursor are
8747+
skipped. When the 'c' flag is present in 'cpo' the next
8748+
search starts after the match. Without the 'c' flag the next
8749+
search starts one column further. This matters for
8750+
overlapping matches.
8751+
When searching backwards and the 'z' flag is given then the
8752+
search starts in column zero, thus no match in the current
8753+
line will be found (unless wrapping around the end of the
8754+
file).
87488755

87498756
When the {stopline} argument is given then the search stops
87508757
after searching this line. This is useful to restrict the

runtime/doc/map.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim version 8.2. Last change: 2020 Nov 12
1+
*map.txt* For Vim version 8.2. Last change: 2020 Nov 21
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -319,13 +319,16 @@ Example of using <Cmd> halfway Insert mode: >
319319
nnoremap <F3> aText <Cmd>echo mode(1)<CR> Added<Esc>
320320
321321
Unlike <expr> mappings, there are no special restrictions on the <Cmd>
322-
command: it is executed as if an (unrestricted) |autocmd| was invoked.
322+
command: it is executed as if an (unrestricted) |autocommand| was invoked.
323323

324324
Note:
325325
- Because <Cmd> avoids mode-changes it does not trigger |CmdlineEnter| and
326326
|CmdlineLeave| events, because no user interaction is expected.
327327
- For the same reason, |keycodes| like <C-R><C-W> are interpreted as plain,
328328
unmapped keys.
329+
- The command is not echo'ed, no need for <silent>.
330+
- In Visual mode you can use `line('v')` and `col('v')` to get one end of the
331+
Visual area, the cursor is at the other end.
329332
- In Select mode, |:map| and |:vmap| command mappings are executed in
330333
Visual mode. Use |:smap| to handle Select mode differently.
331334

@@ -1238,9 +1241,9 @@ Otherwise, using "<SID>" outside of a script context is an error.
12381241

12391242
If you need to get the script number to use in a complicated script, you can
12401243
use this function: >
1241-
function s:SID()
1242-
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
1243-
endfun
1244+
func s:ScriptNumber()
1245+
return matchstr(expand('<SID>'), '<SNR>\zs\d\+\ze_')
1246+
endfunc
12441247
12451248
The "<SNR>" will be shown when listing functions and mappings. This is useful
12461249
to find out what they are defined to.

runtime/doc/popup.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*popup.txt* For Vim version 8.2. Last change: 2020 Oct 17
1+
*popup.txt* For Vim version 8.2. Last change: 2020 Nov 07
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -101,7 +101,7 @@ CLOSING THE POPUP WINDOW *popup-close*
101101

102102
Normally the plugin that created the popup window is also in charge of closing
103103
it. If somehow a popup hangs around, you can close all of them with: >
104-
call popup_clear()
104+
call popup_clear(1)
105105
Some popups, such as notifications, close after a specified time. This can be
106106
set with the "time" property on `popup_create()`.
107107
Otherwise, a popup can be closed by clicking on the X in the top-right corner

runtime/doc/syntax.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3006,7 +3006,7 @@ vimrc file: >
30063006
(Adapted from the html.vim help text by Claudio Fleiner <[email protected]>)
30073007

30083008

3009-
*ft-posix-synax* *ft-dash-syntax*
3009+
*ft-posix-syntax* *ft-dash-syntax*
30103010
SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax*
30113011

30123012
This covers syntax highlighting for the older Unix (Bourne) sh, and newer

runtime/doc/tags

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
21482148
:bad windows.txt /*:bad*
21492149
:badd windows.txt /*:badd*
21502150
:ball windows.txt /*:ball*
2151+
:balt windows.txt /*:balt*
21512152
:bar cmdline.txt /*:bar*
21522153
:bd windows.txt /*:bd*
21532154
:bdel windows.txt /*:bdel*
@@ -2751,6 +2752,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
27512752
:map-<unique> map.txt /*:map-<unique>*
27522753
:map-alt-keys map.txt /*:map-alt-keys*
27532754
:map-arguments map.txt /*:map-arguments*
2755+
:map-cmd map.txt /*:map-cmd*
27542756
:map-commands map.txt /*:map-commands*
27552757
:map-expression map.txt /*:map-expression*
27562758
:map-local map.txt /*:map-local*
@@ -3533,6 +3535,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
35333535
<CSI> intro.txt /*<CSI>*
35343536
<Char-> map.txt /*<Char->*
35353537
<Char> map.txt /*<Char>*
3538+
<Cmd> map.txt /*<Cmd>*
35363539
<CursorHold> autocmd.txt /*<CursorHold>*
35373540
<D- intro.txt /*<D-*
35383541
<D-.> gui_mac.txt /*<D-.>*
@@ -3977,6 +3980,9 @@ E1112 eval.txt /*E1112*
39773980
E1113 eval.txt /*E1113*
39783981
E112 eval.txt /*E112*
39793982
E113 eval.txt /*E113*
3983+
E1135 map.txt /*E1135*
3984+
E1136 map.txt /*E1136*
3985+
E1137 map.txt /*E1137*
39803986
E114 eval.txt /*E114*
39813987
E115 eval.txt /*E115*
39823988
E116 eval.txt /*E116*
@@ -6635,7 +6641,7 @@ ft-php-syntax syntax.txt /*ft-php-syntax*
66356641
ft-php3-syntax syntax.txt /*ft-php3-syntax*
66366642
ft-phtml-syntax syntax.txt /*ft-phtml-syntax*
66376643
ft-plaintex-syntax syntax.txt /*ft-plaintex-syntax*
6638-
ft-posix-synax syntax.txt /*ft-posix-synax*
6644+
ft-posix-syntax syntax.txt /*ft-posix-syntax*
66396645
ft-postscr-syntax syntax.txt /*ft-postscr-syntax*
66406646
ft-ppwiz-syntax syntax.txt /*ft-ppwiz-syntax*
66416647
ft-printcap-syntax syntax.txt /*ft-printcap-syntax*
@@ -7881,6 +7887,7 @@ mapmode-s map.txt /*mapmode-s*
78817887
mapmode-t map.txt /*mapmode-t*
78827888
mapmode-v map.txt /*mapmode-v*
78837889
mapmode-x map.txt /*mapmode-x*
7890+
mapnew() eval.txt /*mapnew()*
78847891
mapping map.txt /*mapping*
78857892
mapping-functions usr_41.txt /*mapping-functions*
78867893
mapset() eval.txt /*mapset()*

0 commit comments

Comments
 (0)