Update runtime files.

This commit is contained in:
Bram Moolenaar
2022-02-26 12:25:45 +00:00
parent e41c1dd889
commit c51cf03298
44 changed files with 27082 additions and 8728 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 8.2. Last change: 2022 Feb 18
*builtin.txt* For Vim version 8.2. Last change: 2022 Feb 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -854,7 +854,7 @@ argv([{nr} [, {winid}]])
:let i = 0
:while i < argc()
: let f = escape(fnameescape(argv(i)), '.')
: exe 'amenu Arg.' . f . ' :e ' . f . '<CR>'
: exe 'amenu Arg.' .. f .. ' :e ' .. f .. '<CR>'
: let i = i + 1
:endwhile
< Without the {nr} argument, or when {nr} is -1, a |List| with
@ -1134,7 +1134,7 @@ bufwinid({buf}) *bufwinid()*
see |bufname()| above. If buffer {buf} doesn't exist or
there is no such window, -1 is returned. Example: >
echo "A window containing buffer 1 is " . (bufwinid(1))
echo "A window containing buffer 1 is " .. (bufwinid(1))
<
Only deals with the current tab page.
@ -1147,7 +1147,7 @@ bufwinnr({buf}) *bufwinnr()*
If buffer {buf} doesn't exist or there is no such window, -1
is returned. Example: >
echo "A window containing buffer 1 is " . (bufwinnr(1))
echo "A window containing buffer 1 is " .. (bufwinnr(1))
< The number can be used with |CTRL-W_w| and ":wincmd w"
|:wincmd|.
@ -1197,7 +1197,7 @@ byteidx({expr}, {nr}) *byteidx()*
byteidxcomp({expr}, {nr}) *byteidxcomp()*
Like byteidx(), except that a composing character is counted
as a separate character. Example: >
let s = 'e' . nr2char(0x301)
let s = 'e' .. nr2char(0x301)
echo byteidx(s, 1)
echo byteidxcomp(s, 1)
echo byteidxcomp(s, 2)
@ -1392,7 +1392,7 @@ col({expr}) The result is a Number, which is the byte index of the column
col(".") column of cursor
col("$") length of cursor line plus one
col("'t") column of mark t
col("'" . markname) column of mark markname
col("'" .. markname) column of mark markname
< The first column is 1. 0 is returned for an error.
For an uppercase mark the column may actually be in another
buffer.
@ -1401,7 +1401,7 @@ col({expr}) The result is a Number, which is the byte index of the column
line. This can be used to obtain the column in Insert mode: >
:imap <F2> <C-O>:let save_ve = &ve<CR>
\<C-O>:set ve=all<CR>
\<C-O>:echo col(".") . "\n" <Bar>
\<C-O>:echo col(".") .. "\n" <Bar>
\let &ve = save_ve<CR>
< Can also be used as a |method|: >
@ -2247,12 +2247,12 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
:e extension only
Example: >
:let &tags = expand("%:p:h") . "/tags"
:let &tags = expand("%:p:h") .. "/tags"
< Note that when expanding a string that starts with '%', '#' or
'<', any following text is ignored. This does NOT work: >
:let doesntwork = expand("%:h.bak")
< Use this: >
:let doeswork = expand("%:h") . ".bak"
:let doeswork = expand("%:h") .. ".bak"
< Also note that expanding "<cfile>" and others only returns the
referenced file name without further expansion. If "<cfile>"
is "~/.cshrc", you need to do another expand() to have the
@ -2633,7 +2633,7 @@ fnameescape({string}) *fnameescape()*
and |:write|). And a "-" by itself (special after |:cd|).
Example: >
:let fname = '+some str%nge|name'
:exe "edit " . fnameescape(fname)
:exe "edit " .. fnameescape(fname)
< results in executing: >
edit \+some\ str\%nge\|name
<
@ -2814,7 +2814,7 @@ function({name} [, {arglist}] [, {dict}])
< The Dictionary is only useful when calling a "dict" function.
In that case the {dict} is passed in as "self". Example: >
function Callback() dict
echo "called for " . self.name
echo "called for " .. self.name
endfunction
...
let context = {"name": "example"}
@ -3013,7 +3013,7 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
string is returned, there is no error message.
Examples: >
:let bufmodified = getbufvar(1, "&mod")
:echo "todo myvar = " . getbufvar("todo", "myvar")
:echo "todo myvar = " .. getbufvar("todo", "myvar")
< Can also be used as a |method|: >
GetBufnr()->getbufvar(varname)
@ -3074,9 +3074,9 @@ getchar([expr]) *getchar()*
This example positions the mouse as it would normally happen: >
let c = getchar()
if c == "\<LeftMouse>" && v:mouse_win > 0
exe v:mouse_win . "wincmd w"
exe v:mouse_win .. "wincmd w"
exe v:mouse_lnum
exe "normal " . v:mouse_col . "|"
exe "normal " .. v:mouse_col .. "|"
endif
<
When using bracketed paste only the first character is
@ -3873,7 +3873,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
empty string is returned, there is no error message.
Examples: >
:let list_is_on = gettabwinvar(1, 2, '&list')
:echo "myvar = " . gettabwinvar(3, 1, 'myvar')
:echo "myvar = " .. gettabwinvar(3, 1, 'myvar')
<
To obtain all window-local variables use: >
gettabwinvar({tabnr}, {winnr}, '&')
@ -4006,7 +4006,7 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
Like |gettabwinvar()| for the current tabpage.
Examples: >
:let list_is_on = getwinvar(2, '&list')
:echo "myvar = " . getwinvar(1, 'myvar')
:echo "myvar = " .. getwinvar(1, 'myvar')
< Can also be used as a |method|: >
GetWinnr()->getwinvar(varname)
@ -4261,7 +4261,7 @@ histdel({history} [, {item}]) *histdel()*
The following three are equivalent: >
:call histdel("search", histnr("search"))
:call histdel("search", -1)
:call histdel("search", '^'.histget("search", -1).'$')
:call histdel("search", '^' .. histget("search", -1) .. '$')
<
To delete the last search pattern and use the last-but-one for
the "n" command and 'hlsearch': >
@ -4280,7 +4280,7 @@ histget({history} [, {index}]) *histget()*
Examples:
Redo the second last search from history. >
:execute '/' . histget("search", -2)
:execute '/' .. histget("search", -2)
< Define an Ex command ":H {num}" that supports re-execution of
the {num}th entry from the output of |:history|. >
@ -4526,7 +4526,7 @@ input({prompt} [, {text} [, {completion}]]) *input()*
|:execute| or |:normal|.
Example with a mapping: >
:nmap \x :call GetFoo()<CR>:exe "/" . Foo<CR>
:nmap \x :call GetFoo()<CR>:exe "/" .. Foo<CR>
:function GetFoo()
: call inputsave()
: let g:Foo = input("enter search pattern: ")
@ -4700,7 +4700,7 @@ items({dict}) *items()*
order. Also see |keys()| and |values()|.
Example: >
for [key, value] in items(mydict)
echo key . ': ' . value
echo key .. ': ' .. value
endfor
< Can also be used as a |method|: >
@ -4715,7 +4715,7 @@ join({list} [, {sep}]) *join()*
{sep} is omitted a single space is used.
Note that {sep} is not added at the end. You might want to
add it there too: >
let lines = join(mylist, "\n") . "\n"
let lines = join(mylist, "\n") .. "\n"
< String items are used as-is. |Lists| and |Dictionaries| are
converted into a string like with |string()|.
The opposite function is |split()|.
@ -4927,7 +4927,7 @@ line({expr} [, {winid}]) *line()*
line(".") line number of the cursor
line(".", winid) idem, in window "winid"
line("'t") line number of mark t
line("'" . marker) line number of mark marker
line("'" .. marker) line number of mark marker
<
To jump to the last known position when opening a file see
|last-position-jump|.
@ -5161,7 +5161,7 @@ map({expr1}, {expr2}) *map()*
current byte. For a |String| |v:key| has the index of the
current character.
Example: >
:call map(mylist, '"> " . v:val . " <"')
:call map(mylist, '"> " .. v:val .. " <"')
< This puts "> " before and " <" after each item in "mylist".
Note that {expr2} is the result of an expression and is then
@ -5175,19 +5175,19 @@ map({expr1}, {expr2}) *map()*
The function must return the new value of the item. Example
that changes each value by "key-value": >
func KeyValue(key, val)
return a:key . '-' . a:val
return a:key .. '-' .. a:val
endfunc
call map(myDict, function('KeyValue'))
< It is shorter when using a |lambda|: >
call map(myDict, {key, val -> key . '-' . val})
call map(myDict, {key, val -> key .. '-' .. val})
< If you do not use "val" you can leave it out: >
call map(myDict, {key -> 'item: ' . key})
call map(myDict, {key -> 'item: ' .. key})
< If you do not use "key" you can use a short name: >
call map(myDict, {_, val -> 'item: ' . val})
call map(myDict, {_, val -> 'item: ' .. val})
<
The operation is done in-place for a |List| and |Dictionary|.
If you want it to remain unmodified make a copy first: >
:let tlist = map(copy(mylist), ' v:val . "\t"')
:let tlist = map(copy(mylist), ' v:val .. "\t"')
< Returns {expr1}, the |List| or |Dictionary| that was filtered,
or a new |Blob| or |String|.
@ -5263,7 +5263,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
then the global mappings.
This function can be used to map a key even when it's already
mapped, and have it do the original mapping too. Sketch: >
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
< Can also be used as a |method|: >
GetKey()->maparg('n')
@ -5786,7 +5786,7 @@ mkdir({name} [, {path} [, {prot}]])
{name}. Thus if you create /tmp/foo/bar then /tmp/foo will be
created with 0o755.
Example: >
:call mkdir($HOME . "/tmp/foo/bar", "p", 0o700)
:call mkdir($HOME .. "/tmp/foo/bar", "p", 0o700)
< This function is not available in the |sandbox|.
@ -6227,7 +6227,7 @@ prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
stopinsert
close
else
call append(line('$') - 1, 'Entered: "' . a:text . '"')
call append(line('$') - 1, 'Entered: "' .. a:text .. '"')
" Reset 'modified' to allow the buffer to be closed.
set nomodified
endif
@ -6424,7 +6424,7 @@ readdir({directory} [, {expr} [, {dict}]]) *readdir()*
function! s:tree(dir)
return {a:dir : map(readdir(a:dir),
\ {_, x -> isdirectory(x) ?
\ {x : s:tree(a:dir . '/' . x)} : x})}
\ {x : s:tree(a:dir .. '/' .. x)} : x})}
endfunction
echo s:tree(".")
<
@ -6686,7 +6686,7 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()*
{only available when compiled with the |+clientserver| feature}
Examples: >
:let repl = ""
:echo "PEEK: ".remote_peek(id, "repl").": ".repl
:echo "PEEK: " .. remote_peek(id, "repl") .. ": " .. repl
< Can also be used as a |method|: >
ServerId()->remote_peek()
@ -6724,12 +6724,12 @@ remote_send({server}, {string} [, {idvar}])
Note: Any errors will be reported in the server and may mess
up the display.
Examples: >
:echo remote_send("gvim", ":DropAndReply ".file, "serverid").
:echo remote_send("gvim", ":DropAndReply " .. file, "serverid") ..
\ remote_read(serverid)
:autocmd NONE RemoteReply *
\ echo remote_read(expand("<amatch>"))
:echo remote_send("gvim", ":sleep 10 | echo ".
:echo remote_send("gvim", ":sleep 10 | echo " ..
\ 'server2client(expand("<client>"), "HELLO")<CR>')
<
Can also be used as a |method|: >
@ -6754,7 +6754,7 @@ remove({list}, {idx} [, {end}]) *remove()*
points to an item before {idx} this is an error.
See |list-index| for possible values of {idx} and {end}.
Example: >
:echo "last item: " . remove(mylist, -1)
:echo "last item: " .. remove(mylist, -1)
:call remove(mylist, 0, 9)
<
Use |delete()| to remove a file.
@ -6770,13 +6770,13 @@ remove({blob}, {idx} [, {end}])
byte as {end} a |Blob| with one byte is returned. When {end}
points to a byte before {idx} this is an error.
Example: >
:echo "last byte: " . remove(myblob, -1)
:echo "last byte: " .. remove(myblob, -1)
:call remove(mylist, 0, 9)
remove({dict}, {key})
Remove the entry from {dict} with key {key} and return it.
Example: >
:echo "removed " . remove(dict, "one")
:echo "removed " .. remove(dict, "one")
< If there is no {key} in {dict} this is an error.
rename({from}, {to}) *rename()*
@ -6907,7 +6907,7 @@ screencol() *screencol()*
column inside the command line, which is 1 when the command is
executed. To get the cursor position in the file use one of
the following mappings: >
nnoremap <expr> GG ":echom ".screencol()."\n"
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
nnoremap <silent> GG :echom screencol()<CR>
nnoremap GG <Cmd>echom screencol()<CR>
<
@ -7031,7 +7031,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
Example (goes over all files in the argument list): >
:let n = 1
:while n <= argc() " loop over all files in arglist
: exe "argument " . n
: exe "argument " .. n
: " start at the last char in the file and wrap for the
: " first search to find match at start of file
: normal G$
@ -7115,11 +7115,11 @@ searchcount([{options}]) *searchcount()*
return printf(' /%s [%d/%d]', @/,
\ result.current, result.total)
endfunction
let &statusline .= '%{LastSearchCount()}'
let &statusline ..= '%{LastSearchCount()}'
" Or if you want to show the count only when
" 'hlsearch' was on
" let &statusline .=
" let &statusline ..=
" \ '%{v:hlsearch ? LastSearchCount() : ""}'
<
You can also update the search count, which can be useful in a
@ -7943,10 +7943,10 @@ shellescape({string} [, {special}]) *shellescape()*
character inside single quotes.
Example of use with a |:!| command: >
:exe '!dir ' . shellescape(expand('<cfile>'), 1)
:exe '!dir ' .. shellescape(expand('<cfile>'), 1)
< This results in a directory listing for the file under the
cursor. Example of use with |system()|: >
:call system("chmod +w -- " . shellescape(expand("%")))
:call system("chmod +w -- " .. shellescape(expand("%")))
< See also |::S|.
Can also be used as a |method|: >
@ -8719,7 +8719,7 @@ substitute({string}, {pat}, {sub}, {flags}) *substitute()*
When {sub} starts with "\=", the remainder is interpreted as
an expression. See |sub-replace-expression|. Example: >
:echo substitute(s, '%\(\x\x\)',
\ '\=nr2char("0x" . submatch(1))', 'g')
\ '\=nr2char("0x" .. submatch(1))', 'g')
< When {sub} is a Funcref that function is called, with one
optional argument. Example: >
@ -8727,7 +8727,7 @@ substitute({string}, {pat}, {sub}, {flags}) *substitute()*
< The optional argument is a list which contains the whole
matched string and up to nine submatches, like what
|submatch()| returns. Example: >
:echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g')
:echo substitute(s, '%\(\x\x\)', {m -> '0x' .. m[1]}, 'g')
< Can also be used as a |method|: >
GetString()->substitute(pat, sub, flags)
@ -8916,8 +8916,8 @@ system({expr} [, {input}]) *system()* *E677*
This is not to be used for interactive commands.
The result is a String. Example: >
:let files = system("ls " . shellescape(expand('%:h')))
:let files = system('ls ' . expand('%:h:S'))
:let files = system('ls ' .. shellescape(expand('%:h')))
:let files = system('ls ' .. expand('%:h:S'))
< To make the result more system-independent, the shell output
is filtered to replace <CR> with <NL> for Macintosh, and
@ -9098,7 +9098,7 @@ tempname() *tempname()* *temp-file-name*
doesn't exist. It can be used for a temporary file. The name
is different for at least 26 consecutive calls. Example: >
:let tmpfile = tempname()
:exe "redir > " . tmpfile
:exe "redir > " .. tmpfile
< For Unix, the file will be in a private directory |tempfile|.
For MS-Windows forward slashes are used when the 'shellslash'
option is set, or when 'shellcmdflag' starts with '-' and
@ -9295,7 +9295,7 @@ trim({text} [, {mask} [, {dir}]]) *trim()*
Examples: >
echo trim(" some text ")
< returns "some text" >
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") .. "_TAIL"
< returns "RESERVE_TAIL" >
echo trim("rm<Xrm<>X>rrm", "rm<>")
< returns "Xrm<>X" (characters in the middle are not removed) >
@ -9486,7 +9486,7 @@ visualmode([{expr}]) *visualmode()*
character-wise, line-wise, or block-wise Visual mode
respectively.
Example: >
:exe "normal " . visualmode()
:exe "normal " .. visualmode()
< This enters the same Visual mode as before. It is also useful
in scripts if you wish to act differently depending on the
Visual mode that was used.
@ -9690,7 +9690,7 @@ winheight({nr}) *winheight()*
An existing window always has a height of zero or more.
This excludes any window toolbar line.
Examples: >
:echo "The current window has " . winheight(0) . " lines."
:echo "The current window has " .. winheight(0) .. " lines."
< Can also be used as a |method|: >
GetWinid()->winheight()
@ -9831,7 +9831,7 @@ winwidth({nr}) *winwidth()*
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a width of zero or more.
Examples: >
:echo "The current window has " . winwidth(0) . " columns."
:echo "The current window has " .. winwidth(0) .. " columns."
:if winwidth(0) <= 50
: 50 wincmd |
:endif