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

@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection # Vim functions for file type detection
# #
# Maintainer: Bram Moolenaar <Bram@vim.org> # Maintainer: Bram Moolenaar <Bram@vim.org>
# Last Change: 2022 Feb 05 # Last Change: 2022 Feb 22
# These functions are moved here from runtime/filetype.vim to make startup # These functions are moved here from runtime/filetype.vim to make startup
# faster. # faster.

View File

@ -153,6 +153,7 @@ DOCS = \
version6.txt \ version6.txt \
version7.txt \ version7.txt \
version8.txt \ version8.txt \
version9.txt \
vi_diff.txt \ vi_diff.txt \
vim9.txt \ vim9.txt \
visual.txt \ visual.txt \
@ -298,6 +299,7 @@ HTMLS = \
version6.html \ version6.html \
version7.html \ version7.html \
version8.html \ version8.html \
version9.html \
vi_diff.html \ vi_diff.html \
vimindex.html \ vimindex.html \
vim9.html \ vim9.html \

View File

@ -1639,7 +1639,7 @@ Examples for reading and writing compressed files: >
: autocmd BufReadPre,FileReadPre *.gz set bin : autocmd BufReadPre,FileReadPre *.gz set bin
: autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip : autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
: autocmd BufReadPost,FileReadPost *.gz set nobin : autocmd BufReadPost,FileReadPost *.gz set nobin
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") : autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " .. expand("%:r")
: autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r : autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
: autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r : autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
@ -1738,7 +1738,7 @@ To insert the current date and time in a *.html file when writing it: >
: else : else
: let l = line("$") : let l = line("$")
: endif : endif
: exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " . : exe "1," .. l .. "g/Last modified: /s/Last modified: .*/Last modified: " ..
: \ strftime("%Y %b %d") : \ strftime("%Y %b %d")
:endfun :endfun

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

View File

@ -946,7 +946,7 @@ Consider using a character like "@" or ":". There is no problem if the result
of the expression contains the separation character. of the expression contains the separation character.
Examples: > Examples: >
:s@\n@\="\r" . expand("$HOME") . "\r"@ :s@\n@\="\r" .. expand("$HOME") .. "\r"@
This replaces an end-of-line with a new line containing the value of $HOME. > This replaces an end-of-line with a new line containing the value of $HOME. >
s/E/\="\<Char-0x20ac>"/g s/E/\="\<Char-0x20ac>"/g
@ -1123,7 +1123,7 @@ inside of strings can change! Also see 'softtabstop' option. >
the command. You need to escape the '|' and '"' the command. You need to escape the '|' and '"'
characters to prevent them from terminating the characters to prevent them from terminating the
command. Example: > command. Example: >
:put ='path' . \",/test\" :put ='path' .. \",/test\"
< If there is no expression after '=', Vim uses the < If there is no expression after '=', Vim uses the
previous expression. You can see it with ":dis =". previous expression. You can see it with ":dis =".

View File

@ -91,7 +91,7 @@ And you should see the message in Vim. You can move the cursor a word forward:
To handle asynchronous communication a callback needs to be used: > To handle asynchronous communication a callback needs to be used: >
func MyHandler(channel, msg) func MyHandler(channel, msg)
echo "from the handler: " . a:msg echo "from the handler: " .. a:msg
endfunc endfunc
call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"}) call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"})
Vim will not wait for a response. Now the server can send the response later Vim will not wait for a response. Now the server can send the response later
@ -136,7 +136,7 @@ When using an IPv6 address, enclose it within square brackets. E.g.,
gets two arguments: the channel and the received message. gets two arguments: the channel and the received message.
Example: > Example: >
func Handle(channel, msg) func Handle(channel, msg)
echo 'Received: ' . a:msg echo 'Received: ' .. a:msg
endfunc endfunc
let channel = ch_open("localhost:8765", {"callback": "Handle"}) let channel = ch_open("localhost:8765", {"callback": "Handle"})
< <
@ -1296,7 +1296,7 @@ prompt. >
" Function handling output from the shell: Added above the prompt. " Function handling output from the shell: Added above the prompt.
func GotOutput(channel, msg) func GotOutput(channel, msg)
call append(line("$") - 1, "- " . a:msg) call append(line("$") - 1, "- " .. a:msg)
endfunc endfunc
" Function handling the shell exist: close the window. " Function handling the shell exist: close the window.

View File

@ -227,7 +227,7 @@ CTRL-\ e {expr} *c_CTRL-\_e*
Example: > Example: >
:cmap <F7> <C-\>eAppendSome()<CR> :cmap <F7> <C-\>eAppendSome()<CR>
:func AppendSome() :func AppendSome()
:let cmd = getcmdline() . " Some()" :let cmd = getcmdline() .. " Some()"
:" place the cursor on the ) :" place the cursor on the )
:call setcmdpos(strlen(cmd)) :call setcmdpos(strlen(cmd))
:return cmd :return cmd

View File

@ -382,13 +382,13 @@ Example (this does almost the same as 'diffexpr' being empty): >
function MyDiff() function MyDiff()
let opt = "" let opt = ""
if &diffopt =~ "icase" if &diffopt =~ "icase"
let opt = opt . "-i " let opt = opt .. "-i "
endif endif
if &diffopt =~ "iwhite" if &diffopt =~ "iwhite"
let opt = opt . "-b " let opt = opt .. "-b "
endif endif
silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new . silent execute "!diff -a --binary " .. opt .. v:fname_in .. " " .. v:fname_new ..
\ " > " . v:fname_out \ " > " .. v:fname_out
redraw! redraw!
endfunction endfunction
@ -445,8 +445,8 @@ Example (this does the same as 'patchexpr' being empty): >
set patchexpr=MyPatch() set patchexpr=MyPatch()
function MyPatch() function MyPatch()
:call system("patch -o " . v:fname_out . " " . v:fname_in . :call system("patch -o " .. v:fname_out .. " " .. v:fname_in ..
\ " < " . v:fname_diff) \ " < " .. v:fname_diff)
endfunction endfunction
Make sure that using the "patch" program doesn't have unwanted side effects. Make sure that using the "patch" program doesn't have unwanted side effects.

View File

@ -444,9 +444,9 @@ does apply like to other wildcards.
Environment variables in the expression are expanded when evaluating the Environment variables in the expression are expanded when evaluating the
expression, thus this works: > expression, thus this works: >
:e `=$HOME . '/.vimrc'` :e `=$HOME .. '/.vimrc'`
This does not work, $HOME is inside a string and used literally: > This does not work, $HOME is inside a string and used literally: >
:e `='$HOME' . '/.vimrc'` :e `='$HOME' .. '/.vimrc'`
If the expression returns a string then names are to be separated with line If the expression returns a string then names are to be separated with line
breaks. When the result is a |List| then each item is used as a name. Line breaks. When the result is a |List| then each item is used as a name. Line

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2022 Feb 20 *eval.txt* For Vim version 8.2. Last change: 2022 Feb 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -470,7 +470,7 @@ It is also possible to put remaining items in a List variable: >
:for [i, j; rest] in listlist :for [i, j; rest] in listlist
: call Doit(i, j) : call Doit(i, j)
: if !empty(rest) : if !empty(rest)
: echo "remainder: " . string(rest) : echo "remainder: " .. string(rest)
: endif : endif
:endfor :endfor
@ -498,11 +498,11 @@ Functions that are useful with a List: >
:let list = split("a b c") " create list from items in a string :let list = split("a b c") " create list from items in a string
:let string = join(list, ', ') " create string from list items :let string = join(list, ', ') " create string from list items
:let s = string(list) " String representation of list :let s = string(list) " String representation of list
:call map(list, '">> " . v:val') " prepend ">> " to each item :call map(list, '">> " .. v:val') " prepend ">> " to each item
Don't forget that a combination of features can make things simple. For Don't forget that a combination of features can make things simple. For
example, to add up all the numbers in a list: > example, to add up all the numbers in a list: >
:exe 'let sum = ' . join(nrlist, '+') :exe 'let sum = ' .. join(nrlist, '+')
1.4 Dictionaries ~ 1.4 Dictionaries ~
@ -568,7 +568,7 @@ turn the Dictionary into a List and pass it to |:for|.
Most often you want to loop over the keys, using the |keys()| function: > Most often you want to loop over the keys, using the |keys()| function: >
:for key in keys(mydict) :for key in keys(mydict)
: echo key . ': ' . mydict[key] : echo key .. ': ' .. mydict[key]
:endfor :endfor
The List of keys is unsorted. You may want to sort them first: > The List of keys is unsorted. You may want to sort them first: >
@ -576,13 +576,13 @@ The List of keys is unsorted. You may want to sort them first: >
To loop over the values use the |values()| function: > To loop over the values use the |values()| function: >
:for v in values(mydict) :for v in values(mydict)
: echo "value: " . v : echo "value: " .. v
:endfor :endfor
If you want both the key and the value use the |items()| function. It returns If you want both the key and the value use the |items()| function. It returns
a List in which each item is a List with two items, the key and the value: > a List in which each item is a List with two items, the key and the value: >
:for [key, value] in items(mydict) :for [key, value] in items(mydict)
: echo key . ': ' . value : echo key .. ': ' .. value
:endfor :endfor
@ -677,7 +677,7 @@ Functions that can be used with a Dictionary: >
:let small = min(dict) " minimum value in dict :let small = min(dict) " minimum value in dict
:let xs = count(dict, 'x') " count nr of times 'x' appears in dict :let xs = count(dict, 'x') " count nr of times 'x' appears in dict
:let s = string(dict) " String representation of dict :let s = string(dict) " String representation of dict
:call map(dict, '">> " . v:val') " prepend ">> " to each item :call map(dict, '">> " .. v:val') " prepend ">> " to each item
1.5 Blobs ~ 1.5 Blobs ~
@ -921,13 +921,13 @@ Expression nesting is limited to 1000 levels deep (300 when build with MSVC)
to avoid running out of stack and crashing. *E1169* to avoid running out of stack and crashing. *E1169*
expr1 *expr1* *trinary* *falsy-operator* *??* *E109* expr1 *expr1* *ternary* *falsy-operator* *??* *E109*
----- -----
The trinary operator: expr2 ? expr1 : expr1 The ternary operator: expr2 ? expr1 : expr1
The falsy operator: expr2 ?? expr1 The falsy operator: expr2 ?? expr1
Trinary operator ~ Ternary operator ~
In legacy script the expression before the '?' is evaluated to a number. If In legacy script the expression before the '?' is evaluated to a number. If
it evaluates to |TRUE|, the result is the value of the expression between the it evaluates to |TRUE|, the result is the value of the expression between the
@ -1530,7 +1530,7 @@ option *expr-option* *E112* *E113*
&l:option local option value &l:option local option value
Examples: > Examples: >
echo "tabstop is " . &tabstop echo "tabstop is " .. &tabstop
if &insertmode if &insertmode
Any option name can be used here. See |options|. When using the local value Any option name can be used here. See |options|. When using the local value
@ -1820,7 +1820,7 @@ maintain a counter: >
echo "script executed for the first time" echo "script executed for the first time"
else else
let s:counter = s:counter + 1 let s:counter = s:counter + 1
echo "script executed " . s:counter . " times now" echo "script executed " .. s:counter .. " times now"
endif endif
Note that this means that filetype plugins don't get a different set of script Note that this means that filetype plugins don't get a different set of script
@ -1955,7 +1955,7 @@ v:completed_item
*v:count* *count-variable* *v:count* *count-variable*
v:count The count given for the last Normal mode command. Can be used v:count The count given for the last Normal mode command. Can be used
to get the count before a mapping. Read-only. Example: > to get the count before a mapping. Read-only. Example: >
:map _x :<C-U>echo "the count is " . v:count<CR> :map _x :<C-U>echo "the count is " .. v:count<CR>
< Note: The <C-U> is required to remove the line range that you < Note: The <C-U> is required to remove the line range that you
get when typing ':' after a count. get when typing ':' after a count.
When there are two counts, as in "3d2w", they are multiplied, When there are two counts, as in "3d2w", they are multiplied,
@ -2829,9 +2829,9 @@ Example: >
: echohl Title : echohl Title
: echo a:title : echo a:title
: echohl None : echohl None
: echo a:0 . " items:" : echo a:0 .. " items:"
: for s in a:000 : for s in a:000
: echon ' ' . s : echon ' ' .. s
: endfor : endfor
:endfunction :endfunction
@ -2874,7 +2874,7 @@ This function can then be called with: >
this works: this works:
*function-range-example* > *function-range-example* >
:function Mynumber(arg) :function Mynumber(arg)
: echo line(".") . " " . a:arg : echo line(".") .. " " .. a:arg
:endfunction :endfunction
:1,5call Mynumber(getline(".")) :1,5call Mynumber(getline("."))
< <
@ -2885,7 +2885,7 @@ This function can then be called with: >
Example of a function that handles the range itself: > Example of a function that handles the range itself: >
:function Cont() range :function Cont() range
: execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ ' : execute (a:firstline + 1) .. "," .. a:lastline .. 's/^/\t\\ '
:endfunction :endfunction
:4,8call Cont() :4,8call Cont()
< <
@ -3077,7 +3077,7 @@ declarations and assignments do not use a command. |vim9-declaration|
This cannot be used to add an item to a |List|. This cannot be used to add an item to a |List|.
This cannot be used to set a byte in a String. You This cannot be used to set a byte in a String. You
can do that like this: > can do that like this: >
:let var = var[0:2] . 'X' . var[4:] :let var = var[0:2] .. 'X' .. var[4:]
< When {var-name} is a |Blob| then {idx} can be the < When {var-name} is a |Blob| then {idx} can be the
length of the blob, in which case one byte is length of the blob, in which case one byte is
appended. appended.
@ -3147,7 +3147,7 @@ declarations and assignments do not use a command. |vim9-declaration|
is just like using the |:set| command: both the local is just like using the |:set| command: both the local
value and the global value are changed. value and the global value are changed.
Example: > Example: >
:let &path = &path . ',/usr/local/include' :let &path = &path .. ',/usr/local/include'
< This also works for terminal codes in the form t_xx. < This also works for terminal codes in the form t_xx.
But only for alphanumerical names. Example: > But only for alphanumerical names. Example: >
:let &t_k1 = "\<Esc>[234;" :let &t_k1 = "\<Esc>[234;"
@ -3425,6 +3425,8 @@ text...
:if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580* :if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580*
:en[dif] Execute the commands until the next matching ":else" :en[dif] Execute the commands until the next matching ":else"
or ":endif" if {expr1} evaluates to non-zero. or ":endif" if {expr1} evaluates to non-zero.
Although the short forms work, it is recommended to
always use `:endif` to avoid confusion.
From Vim version 4.5 until 5.0, every Ex command in From Vim version 4.5 until 5.0, every Ex command in
between the ":if" and ":endif" is ignored. These two between the ":if" and ":endif" is ignored. These two
@ -4028,7 +4030,7 @@ exception most recently caught as long it is not finished.
:function! Caught() :function! Caught()
: if v:exception != "" : if v:exception != ""
: echo 'Caught "' . v:exception . '" in ' . v:throwpoint : echo 'Caught "' . v:exception .. '" in ' .. v:throwpoint
: else : else
: echo 'Nothing caught' : echo 'Nothing caught'
: endif : endif
@ -4431,8 +4433,8 @@ a script in order to catch unexpected things.
:catch /^Vim:Interrupt$/ :catch /^Vim:Interrupt$/
: echo "Script interrupted" : echo "Script interrupted"
:catch /.*/ :catch /.*/
: echo "Internal error (" . v:exception . ")" : echo "Internal error (" .. v:exception .. ")"
: echo " - occurred at " . v:throwpoint : echo " - occurred at " .. v:throwpoint
:endtry :endtry
:" end of script :" end of script
@ -4628,7 +4630,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
:function! CheckRange(a, func) :function! CheckRange(a, func)
: if a:a < 0 : if a:a < 0
: throw "EXCEPT:MATHERR:RANGE(" . a:func . ")" : throw "EXCEPT:MATHERR:RANGE(" .. a:func .. ")"
: endif : endif
:endfunction :endfunction
: :
@ -4655,7 +4657,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
: try : try
: execute "write" fnameescape(a:file) : execute "write" fnameescape(a:file)
: catch /^Vim(write):/ : catch /^Vim(write):/
: throw "EXCEPT:IO(" . getcwd() . ", " . a:file . "):WRITEERR" : throw "EXCEPT:IO(" .. getcwd() .. ", " .. a:file .. "):WRITEERR"
: endtry : endtry
:endfunction :endfunction
: :
@ -4674,9 +4676,9 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
: let dir = substitute(v:exception, '.*(\(.\+\),\s*.\+).*', '\1', "") : let dir = substitute(v:exception, '.*(\(.\+\),\s*.\+).*', '\1', "")
: let file = substitute(v:exception, '.*(.\+,\s*\(.\+\)).*', '\1', "") : let file = substitute(v:exception, '.*(.\+,\s*\(.\+\)).*', '\1', "")
: if file !~ '^/' : if file !~ '^/'
: let file = dir . "/" . file : let file = dir .. "/" .. file
: endif : endif
: echo 'I/O error for "' . file . '"' : echo 'I/O error for "' .. file .. '"'
: :
:catch /^EXCEPT/ :catch /^EXCEPT/
: echo "Unspecified error" : echo "Unspecified error"
@ -4744,7 +4746,7 @@ clauses, however, is executed.
: echo "inner finally" : echo "inner finally"
: endtry : endtry
:catch :catch
: echo 'outer catch-all caught "' . v:exception . '"' : echo 'outer catch-all caught "' .. v:exception .. '"'
: finally : finally
: echo "outer finally" : echo "outer finally"
:endtry :endtry
@ -4806,7 +4808,7 @@ Printing in Binary ~
: let n = a:nr : let n = a:nr
: let r = "" : let r = ""
: while n : while n
: let r = '01'[n % 2] . r : let r = '01'[n % 2] .. r
: let n = n / 2 : let n = n / 2
: endwhile : endwhile
: return r : return r
@ -4817,7 +4819,7 @@ Printing in Binary ~
:func String2Bin(str) :func String2Bin(str)
: let out = '' : let out = ''
: for ix in range(strlen(a:str)) : for ix in range(strlen(a:str))
: let out = out . '-' . Nr2Bin(char2nr(a:str[ix])) : let out = out .. '-' .. Nr2Bin(char2nr(a:str[ix]))
: endfor : endfor
: return out[1:] : return out[1:]
:endfunc :endfunc

View File

@ -507,7 +507,7 @@ Note the use of backslashes to avoid some characters to be interpreted by the
:function MyFoldText() :function MyFoldText()
: let line = getline(v:foldstart) : let line = getline(v:foldstart)
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g') : let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
: return v:folddashes . sub : return v:folddashes .. sub
:endfunction :endfunction
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to Evaluating 'foldtext' is done in the |sandbox|. The current window is set to

View File

@ -47,20 +47,20 @@ Numbers, subscripts and superscripts are available with 's' and 'S':
But some don't come defined by default. Those are digraph definitions you can But some don't come defined by default. Those are digraph definitions you can
add in your ~/.vimrc file. > add in your ~/.vimrc file. >
exec 'digraph \\ '.char2nr('') exec 'digraph \\ ' .. char2nr('')
exec 'digraph \< '.char2nr('≼') exec 'digraph \< ' .. char2nr('≼')
exec 'digraph \> '.char2nr('≽') exec 'digraph \> ' .. char2nr('≽')
exec 'digraph (L '.char2nr('⊈') exec 'digraph (L ' .. char2nr('⊈')
exec 'digraph )L '.char2nr('⊉') exec 'digraph )L ' .. char2nr('⊉')
exec 'digraph (/ '.char2nr('⊄') exec 'digraph (/ ' .. char2nr('⊄')
exec 'digraph )/ '.char2nr('⊅') exec 'digraph )/ ' .. char2nr('⊅')
exec 'digraph )/ '.char2nr('⊅') exec 'digraph )/ ' .. char2nr('⊅')
exec 'digraph U+ '.char2nr('⊎') exec 'digraph U+ ' .. char2nr('⊎')
exec 'digraph 0- '.char2nr('⊖') exec 'digraph 0- ' .. char2nr('⊖')
" Euler's constant " Euler's constant
exec 'digraph ne '.char2nr('𝑒') exec 'digraph ne ' .. char2nr('𝑒')
" Raku's atomic operations marker " Raku's atomic operations marker
exec 'digraph @@ '.char2nr('⚛') exec 'digraph @@ ' .. char2nr('⚛')
Alternatively, you can write Insert mode abbreviations that convert ASCII- Alternatively, you can write Insert mode abbreviations that convert ASCII-
based operators into their single-character Unicode equivalent. > based operators into their single-character Unicode equivalent. >

View File

@ -26,7 +26,7 @@ behavior of the plugin.
g:rustc_path~ g:rustc_path~
Set this option to the path to rustc for use in the |:RustRun| and Set this option to the path to rustc for use in the |:RustRun| and
|:RustExpand| commands. If unset, "rustc" will be located in $PATH: > |:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
let g:rustc_path = $HOME."/bin/rustc" let g:rustc_path = $HOME .. "/bin/rustc"
< <
*g:rustc_makeprg_no_percent* *g:rustc_makeprg_no_percent*
@ -87,7 +87,7 @@ g:rust_bang_comment_leader~
g:ftplugin_rust_source_path~ g:ftplugin_rust_source_path~
Set this option to a path that should be prepended to 'path' for Rust Set this option to a path that should be prepended to 'path' for Rust
source files: > source files: >
let g:ftplugin_rust_source_path = $HOME.'/dev/rust' let g:ftplugin_rust_source_path = $HOME .. '/dev/rust'
< <
*g:rustfmt_command* *g:rustfmt_command*

View File

@ -109,8 +109,8 @@ must be configurable. The filetype plugin attempts to define many of the
standard objects, plus many additional ones. In order to make this as standard objects, plus many additional ones. In order to make this as
flexible as possible, you can override the list of objects from within your flexible as possible, you can override the list of objects from within your
|vimrc| with the following: > |vimrc| with the following: >
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' . let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' ..
\ ',schema,service,publication,database,datatype,domain' . \ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable' \ ',index,subscription,synchronization,view,variable'
The following |Normal| mode and |Visual| mode maps have been created which use The following |Normal| mode and |Visual| mode maps have been created which use
@ -131,10 +131,10 @@ Repeatedly pressing ]} will cycle through each of these create statements: >
create index i1 on t1 (c1); create index i1 on t1 (c1);
The default setting for g:ftplugin_sql_objects is: > The default setting for g:ftplugin_sql_objects is: >
let g:ftplugin_sql_objects = 'function,procedure,event,' . let g:ftplugin_sql_objects = 'function,procedure,event,' ..
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' . \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' ..
\ 'table,trigger' . \ 'table,trigger' ..
\ ',schema,service,publication,database,datatype,domain' . \ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable' \ ',index,subscription,synchronization,view,variable'
The above will also handle these cases: > The above will also handle these cases: >

View File

@ -155,8 +155,8 @@ If you are running the X Window System, you can get information about the
window Vim is running in with these commands: > window Vim is running in with these commands: >
:!xwininfo -id $WINDOWID :!xwininfo -id $WINDOWID
:!xprop -id $WINDOWID :!xprop -id $WINDOWID
:execute '!xwininfo -id ' . v:windowid :execute '!xwininfo -id ' .. v:windowid
:execute '!xprop -id ' . v:windowid :execute '!xprop -id ' .. v:windowid
< <
*gui-IME* *iBus* *gui-IME* *iBus*
Input methods for international characters in X that rely on the XIM Input methods for international characters in X that rely on the XIM

View File

@ -1,4 +1,4 @@
*help.txt* For Vim version 8.2. Last change: 2021 Dec 27 *help.txt* For Vim version 8.2. Last change: 2022 Feb 26
VIM - main help file VIM - main help file
k k
@ -197,6 +197,7 @@ Versions ~
|version6.txt| Differences between Vim version 5.7 and 6.x |version6.txt| Differences between Vim version 5.7 and 6.x
|version7.txt| Differences between Vim version 6.4 and 7.x |version7.txt| Differences between Vim version 6.4 and 7.x
|version8.txt| Differences between Vim version 7.4 and 8.x |version8.txt| Differences between Vim version 7.4 and 8.x
|version9.txt| Differences between Vim version 8.2 and 9.0
*sys-file-list* *sys-file-list*
Remarks about specific systems ~ Remarks about specific systems ~
|os_390.txt| OS/390 Unix |os_390.txt| OS/390 Unix

View File

@ -1,4 +1,4 @@
*if_pyth.txt* For Vim version 8.2. Last change: 2022 Feb 07 *if_pyth.txt* For Vim version 8.2. Last change: 2022 Feb 22
VIM REFERENCE MANUAL by Paul Moore VIM REFERENCE MANUAL by Paul Moore
@ -25,6 +25,10 @@ The Python 3 interface is available only when Vim was compiled with the
|+python3| feature. |+python3| feature.
Both can be available at the same time, but read |python-2-and-3|. Both can be available at the same time, but read |python-2-and-3|.
NOTE: Python 2 is old and no longer being developed. Using Python 3 is highly
recommended. Python 2 support will be dropped when it does not work properly
anymore.
============================================================================== ==============================================================================
1. Commands *python-commands* 1. Commands *python-commands*
@ -923,7 +927,7 @@ The `:pyxdo` command works similar to `:pydo`.
*has-pythonx* *has-pythonx*
You can test if pyx* commands are available with: > You can test if pyx* commands are available with: >
if has('pythonx') if has('pythonx')
echo 'pyx* commands are available. (Python ' . &pyx . ')' echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
endif endif
When compiled with only one of |+python| or |+python3|, the has() returns 1. When compiled with only one of |+python| or |+python3|, the has() returns 1.

View File

@ -879,9 +879,9 @@ Groß): >
endif endif
let res = [] let res = []
let h = '' let h = ''
for l in systemlist('aiksaurus '.shellescape(a:base)) for l in systemlist('aiksaurus ' .. shellescape(a:base))
if l[:3] == '=== ' if l[:3] == '=== '
let h = '('.substitute(l[4:], ' =*$', ')', '') let h = '(' .. substitute(l[4:], ' =*$', ')', '')
elseif l ==# 'Alphabetically similar known words are: ' elseif l ==# 'Alphabetically similar known words are: '
let h = "\U0001f52e" let h = "\U0001f52e"
elseif l[0] =~ '\a' || (h ==# "\U0001f52e" && l[0] ==# "\t") elseif l[0] =~ '\a' || (h ==# "\U0001f52e" && l[0] ==# "\t")
@ -1266,7 +1266,7 @@ An example that completes the names of the months: >
" find months matching with "a:base" " find months matching with "a:base"
let res = [] let res = []
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
if m =~ '^' . a:base if m =~ '^' .. a:base
call add(res, m) call add(res, m)
endif endif
endfor endfor
@ -1288,7 +1288,7 @@ The same, but now pretending searching for matches is slow: >
else else
" find months matching with "a:base" " find months matching with "a:base"
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
if m =~ '^' . a:base if m =~ '^' .. a:base
call complete_add(m) call complete_add(m)
endif endif
sleep 300m " simulate searching for next match sleep 300m " simulate searching for next match

View File

@ -314,7 +314,7 @@ Here is an example that inserts a list number that increases: >
func ListItem() func ListItem()
let g:counter += 1 let g:counter += 1
return g:counter . '. ' return g:counter .. '. '
endfunc endfunc
func ListReset() func ListReset()
@ -1697,12 +1697,12 @@ The valid escape sequences are
Examples: > Examples: >
command! -nargs=+ -complete=file MyEdit command! -nargs=+ -complete=file MyEdit
\ for f in expand(<q-args>, 0, 1) | \ for f in expand(<q-args>, 0, 1) |
\ exe '<mods> split ' . f | \ exe '<mods> split ' .. f |
\ endfor \ endfor
function! SpecialEdit(files, mods) function! SpecialEdit(files, mods)
for f in expand(a:files, 0, 1) for f in expand(a:files, 0, 1)
exe a:mods . ' split ' . f exe a:mods .. ' split ' .. f
endfor endfor
endfunction endfunction
command! -nargs=+ -complete=file Sedit command! -nargs=+ -complete=file Sedit
@ -1778,7 +1778,7 @@ This will invoke: >
: let i = 0 : let i = 0
: while i < argc() : while i < argc()
: if filereadable(argv(i)) : if filereadable(argv(i))
: execute "e " . argv(i) : execute "e " .. argv(i)
: execute a:command : execute a:command
: endif : endif
: let i = i + 1 : let i = i + 1

View File

@ -1019,7 +1019,7 @@ These commands are not marks themselves, but jump to a mark:
:let lnum = line(".") :let lnum = line(".")
:keepjumps normal gg :keepjumps normal gg
:call SetLastChange() :call SetLastChange()
:keepjumps exe "normal " . lnum . "G" :keepjumps exe "normal " .. lnum .. "G"
< <
Note that ":keepjumps" must be used for every command. Note that ":keepjumps" must be used for every command.
When invoking a function the commands in that function When invoking a function the commands in that function

View File

@ -1142,7 +1142,7 @@ A jump table for the options with a short description can be found at |Q_op|.
If you like to keep a lot of backups, you could use a BufWritePre If you like to keep a lot of backups, you could use a BufWritePre
autocommand to change 'backupext' just before writing the file to autocommand to change 'backupext' just before writing the file to
include a timestamp. > include a timestamp. >
:au BufWritePre * let &bex = '-' . strftime("%Y%b%d%X") . '~' :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
< Use 'backupdir' to put the backup in a different directory. < Use 'backupdir' to put the backup in a different directory.
*'backupskip'* *'bsk'* *'backupskip'* *'bsk'*
@ -1167,7 +1167,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that environment variables are not expanded. If you want to use Note that environment variables are not expanded. If you want to use
$HOME you must expand it explicitly, e.g.: > $HOME you must expand it explicitly, e.g.: >
:let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*' :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
< Note that the default also makes sure that "crontab -e" works (when a < Note that the default also makes sure that "crontab -e" works (when a
backup would be made by renaming the original file crontab won't see backup would be made by renaming the original file crontab won't see
@ -1218,10 +1218,10 @@ A jump table for the options with a short description can be found at |Q_op|.
The evaluation of the expression must not have side effects! The evaluation of the expression must not have side effects!
Example: > Example: >
function MyBalloonExpr() function MyBalloonExpr()
return 'Cursor is at line ' . v:beval_lnum . return 'Cursor is at line ' .. v:beval_lnum ..
\', column ' . v:beval_col . \ ', column ' .. v:beval_col ..
\ ' of file ' . bufname(v:beval_bufnr) . \ ' of file ' .. bufname(v:beval_bufnr) ..
\ ' on word "' . v:beval_text . '"' \ ' on word "' .. v:beval_text .. '"'
endfunction endfunction
set bexpr=MyBalloonExpr() set bexpr=MyBalloonExpr()
set ballooneval set ballooneval
@ -1537,7 +1537,7 @@ A jump table for the options with a short description can be found at |Q_op|.
If the default value taken from $CDPATH is not what you want, include If the default value taken from $CDPATH is not what you want, include
a modified version of the following command in your vimrc file to a modified version of the following command in your vimrc file to
override it: > override it: >
:let &cdpath = ',' . substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
< This option cannot be set from a |modeline| or in the |sandbox|, for < This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons. security reasons.
(parts of 'cdpath' can be passed to the shell to expand file names). (parts of 'cdpath' can be passed to the shell to expand file names).
@ -1582,8 +1582,8 @@ A jump table for the options with a short description can be found at |Q_op|.
set charconvert=CharConvert() set charconvert=CharConvert()
fun CharConvert() fun CharConvert()
system("recode " system("recode "
\ . v:charconvert_from . ".." . v:charconvert_to \ .. v:charconvert_from .. ".." .. v:charconvert_to
\ . " <" . v:fname_in . " >" v:fname_out) \ .. " <" .. v:fname_in .. " >" .. v:fname_out)
return v:shell_error return v:shell_error
endfun endfun
< The related Vim variables are: < The related Vim variables are:
@ -4887,7 +4887,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|+multi_lang| features} |+multi_lang| features}
Language to use for menu translation. Tells which file is loaded Language to use for menu translation. Tells which file is loaded
from the "lang" directory in 'runtimepath': > from the "lang" directory in 'runtimepath': >
"lang/menu_" . &langmenu . ".vim" "lang/menu_" .. &langmenu .. ".vim"
< (without the spaces). For example, to always use the Dutch menus, no < (without the spaces). For example, to always use the Dutch menus, no
matter what $LANG is set to: > matter what $LANG is set to: >
:set langmenu=nl_NL.ISO_8859-1 :set langmenu=nl_NL.ISO_8859-1
@ -5901,7 +5901,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< To use an environment variable, you probably need to replace the < To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory separator. Here is an example to append $INCL, in which directory
names are separated with a semi-colon: > names are separated with a semi-colon: >
:let &path = &path . "," . substitute($INCL, ';', ',', 'g') :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
< Replace the ';' with a ':' or whatever separator is used. Note that < Replace the ';' with a ':' or whatever separator is used. Note that
this doesn't work when $INCL contains a comma or white space. this doesn't work when $INCL contains a comma or white space.
@ -8318,7 +8318,7 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set in a modeline when 'modelineexpr' is off. This option cannot be set in a modeline when 'modelineexpr' is off.
Example: > Example: >
:auto BufEnter * let &titlestring = hostname() . "/" . expand("%:p") :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
:set title titlestring=%<%F%=%l/%L-%P titlelen=70 :set title titlestring=%<%F%=%l/%L-%P titlelen=70
< The value of 'titlelen' is used to align items in the middle or right < The value of 'titlelen' is used to align items in the middle or right
of the available space. of the available space.

View File

@ -603,13 +603,13 @@ program to the new diff on VMS. Add this to your .vimrc file: >
function MyDiff() function MyDiff()
let opt = "" let opt = ""
if &diffopt =~ "icase" if &diffopt =~ "icase"
let opt = opt . "-i " let opt = opt .. "-i "
endif endif
if &diffopt =~ "iwhite" if &diffopt =~ "iwhite"
let opt = opt . "-b " let opt = opt .. "-b "
endif endif
silent execute "!mc GNU:diff.exe -a " . opt . v:fname_in . " " . v:fname_new . silent execute "!mc GNU:diff.exe -a " .. opt .. v:fname_in .. " " .. v:fname_new ..
\ " > " . v:fname_out \ " > " .. v:fname_out
endfunction endfunction
endif endif

View File

@ -963,7 +963,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
the cursor moves the display isn't updated for this change. An update the cursor moves the display isn't updated for this change. An update
is done when using the |CTRL-L| command (the whole screen is updated). is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight the column where the cursor currently is: > Example, to highlight the column where the cursor currently is: >
:exe '/\%' . col(".") . 'c' :exe '/\%' .. col(".") .. 'c'
< Alternatively use: > < Alternatively use: >
/\%.c /\%.c
< When 'hlsearch' is set and you move the cursor around and make changes < When 'hlsearch' is set and you move the cursor around and make changes

View File

@ -968,7 +968,7 @@ itself:
fun! NetReadFixup(method, line1, line2) fun! NetReadFixup(method, line1, line2)
if method == 3 " ftp (no <.netrc>) if method == 3 " ftp (no <.netrc>)
let fourblanklines= line2 - 3 let fourblanklines= line2 - 3
silent fourblanklines.",".line2."g/^\s*/d" silent fourblanklines .. "," .. line2 .. "g/^\s*/d"
endif endif
endfunction endfunction
endif endif
@ -1975,7 +1975,7 @@ To use this function, simply assign its output to |g:netrw_list_hide| option. >
Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file') Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
Function can take additional files with git-ignore patterns. Function can take additional files with git-ignore patterns.
Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$' Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Combining 'netrw_gitignore#Hide' with custom patterns. Combining 'netrw_gitignore#Hide' with custom patterns.
< <
@ -2825,7 +2825,7 @@ your browsing preferences. (see also: |netrw-settings|)
Examples: Examples:
let g:netrw_list_hide= '.*\.swp$' let g:netrw_list_hide= '.*\.swp$'
let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
default: "" default: ""
*g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin

View File

@ -139,28 +139,28 @@ If there is no error, return zero or an empty string.
The default for non MS-Windows or VMS systems is to simply use "lpr" to print The default for non MS-Windows or VMS systems is to simply use "lpr" to print
the file: > the file: >
system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) system('lpr' .. (&printdevice == '' ? '' : ' -P' .. &printdevice)
. ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error .. ' ' .. v:fname_in) .. delete(v:fname_in) + v:shell_error
On MS-Windows machines the default is to copy the file to the currently On MS-Windows machines the default is to copy the file to the currently
specified printdevice: > specified printdevice: >
system('copy' . ' ' . v:fname_in . (&printdevice == '' system('copy' .. ' ' .. v:fname_in .. (&printdevice == ''
? ' LPT1:' : (' \"' . &printdevice . '\"'))) ? ' LPT1:' : (' \"' .. &printdevice .. '\"')))
. delete(v:fname_in) .. delete(v:fname_in)
On VMS machines the default is to send the file to either the default or On VMS machines the default is to send the file to either the default or
currently specified printdevice: > currently specified printdevice: >
system('print' . (&printdevice == '' ? '' : ' /queue=' . system('print' .. (&printdevice == '' ? '' : ' /queue=' ..
&printdevice) . ' ' . v:fname_in) . delete(v:fname_in) &printdevice) .. ' ' .. v:fname_in) .. delete(v:fname_in)
If you change this option, using a function is an easy way to avoid having to If you change this option, using a function is an easy way to avoid having to
escape all the spaces. Example: > escape all the spaces. Example: >
:set printexpr=PrintFile(v:fname_in) :set printexpr=PrintFile(v:fname_in)
:function PrintFile(fname) :function PrintFile(fname)
: call system("ghostview " . a:fname) : call system("ghostview " .. a:fname)
: call delete(a:fname) : call delete(a:fname)
: return v:shell_error : return v:shell_error
:endfunc :endfunc

View File

@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 8.2. Last change: 2022 Feb 08 *quickfix.txt* For Vim version 8.2. Last change: 2022 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -353,7 +353,7 @@ processing a quickfix or location list command, it will be aborted.
cursor position will not be changed. See |:cexpr| for cursor position will not be changed. See |:cexpr| for
more information. more information.
Example: > Example: >
:g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".") :g/mypattern/caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")
< <
*:lad* *:addd* *:laddexpr* *:lad* *:addd* *:laddexpr*
:lad[dexpr] {expr} Same as ":caddexpr", except the location list for the :lad[dexpr] {expr} Same as ":caddexpr", except the location list for the
@ -654,6 +654,24 @@ quickfix window. If there already is a window for that file, it is used
instead. If the buffer in the used window has changed, and the error is in instead. If the buffer in the used window has changed, and the error is in
another file, jumping to the error will fail. You will first have to make another file, jumping to the error will fail. You will first have to make
sure the window contains a buffer which can be abandoned. sure the window contains a buffer which can be abandoned.
The following steps are used to find a window to open the file selected from
the quickfix window:
1. If 'switchbuf' contains "usetab", then find a window in any tabpage
(starting with the first tabpage) that has the selected file and jump to
it.
2. Otherwise find a window displaying the selected file in the current tab
page (starting with the window before the quickfix window) and use it.
3. Otherwise find a window displaying a normal buffer ('buftype' is empty)
starting with the window before the quickfix window. If a window is found,
open the file in that window.
4. If a usable window is not found and 'switchbuf' contains "uselast", then
open the file in the last used window.
5. Otherwise open the file in the window before the quickfix window. If there
is no previous window, then open the file in the next window.
6. If a usable window is not found in the above steps, then create a new
horizontally split window above the quickfix window and open the file.
*CTRL-W_<Enter>* *CTRL-W_<CR>* *CTRL-W_<Enter>* *CTRL-W_<CR>*
You can use CTRL-W <Enter> to open a new window and jump to the error there. You can use CTRL-W <Enter> to open a new window and jump to the error there.
@ -663,7 +681,7 @@ FileType event (also see |qf.vim|). Then the BufReadPost event is triggered,
using "quickfix" for the buffer name. This can be used to perform some action using "quickfix" for the buffer name. This can be used to perform some action
on the listed errors. Example: > on the listed errors. Example: >
au BufReadPost quickfix setlocal modifiable au BufReadPost quickfix setlocal modifiable
\ | silent exe 'g/^/s//\=line(".")." "/' \ | silent exe 'g/^/s//\=line(".") .. " "/'
\ | setlocal nomodifiable \ | setlocal nomodifiable
This prepends the line number to each line. Note the use of "\=" in the This prepends the line number to each line. Note the use of "\=" in the
substitute string of the ":s" command, which is used to evaluate an substitute string of the ":s" command, which is used to evaluate an

View File

@ -101,7 +101,7 @@ precedence, otherwise the 'cursorline' highlighting.
Here is an example that places a sign "piet", displayed with the text ">>", in Here is an example that places a sign "piet", displayed with the text ">>", in
line 23 of the current file: > line 23 of the current file: >
:sign define piet text=>> texthl=Search :sign define piet text=>> texthl=Search
:exe ":sign place 2 line=23 name=piet file=" . expand("%:p") :exe ":sign place 2 line=23 name=piet file=" .. expand("%:p")
And here is the command to delete it again: > And here is the command to delete it again: >
:sign unplace 2 :sign unplace 2

View File

@ -131,8 +131,8 @@ zuG Undo |zW| and |zG|, remove the word from the internal
rare as this is a fairly uncommon command and all rare as this is a fairly uncommon command and all
intuitive commands for this are already taken. If you intuitive commands for this are already taken. If you
want you can add mappings with e.g.: > want you can add mappings with e.g.: >
nnoremap z? :exe ':spellrare ' . expand('<cWORD>')<CR> nnoremap z? :exe ':spellrare ' .. expand('<cWORD>')<CR>
nnoremap z/ :exe ':spellrare! ' . expand('<cWORD>')<CR> nnoremap z/ :exe ':spellrare! ' .. expand('<cWORD>')<CR>
< |:spellundo|, |zuw|, or |zuW| can be used to undo this. < |:spellundo|, |zuw|, or |zuW| can be used to undo this.
:spellr[rare]! {word} Add {word} as a rare word to the internal word :spellr[rare]! {word} Add {word} as a rare word to the internal word

View File

@ -1378,7 +1378,7 @@ resulting file, when executed with a ":source" command:
After restoring the Session, the full filename of your current Session is After restoring the Session, the full filename of your current Session is
available in the internal variable "v:this_session" |this_session-variable|. available in the internal variable "v:this_session" |this_session-variable|.
An example mapping: > An example mapping: >
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/ :nmap <F2> :wa<Bar>exe "mksession! " .. v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another. This saves the current Session, and starts off the command to load another.
A session includes all tab pages, unless "tabpages" was removed from A session includes all tab pages, unless "tabpages" was removed from

View File

@ -653,7 +653,7 @@ evaluate to get a unique string to append to each ID used in a given document,
so that the full IDs will be unique even when combined with other content in a so that the full IDs will be unique even when combined with other content in a
larger HTML document. Example, to append _ and the buffer number to each ID: > larger HTML document. Example, to append _ and the buffer number to each ID: >
:let g:html_id_expr = '"_".bufnr("%")' :let g:html_id_expr = '"_" .. bufnr("%")'
< <
To append a string "_mystring" to the end of each ID: > To append a string "_mystring" to the end of each ID: >
@ -3607,8 +3607,8 @@ Do you want to draw with the mouse? Try the following: >
:function! GetPixel() :function! GetPixel()
: let c = getline(".")[col(".") - 1] : let c = getline(".")[col(".") - 1]
: echo c : echo c
: exe "noremap <LeftMouse> <LeftMouse>r".c : exe "noremap <LeftMouse> <LeftMouse>r" .. c
: exe "noremap <LeftDrag> <LeftMouse>r".c : exe "noremap <LeftDrag> <LeftMouse>r" .. c
:endfunction :endfunction
:noremap <RightMouse> <LeftMouse>:call GetPixel()<CR> :noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
:set guicursor=n:hor20 " to see the color beneath the cursor :set guicursor=n:hor20 " to see the color beneath the cursor
@ -5567,9 +5567,9 @@ types.vim: *.[ch]
And put these lines in your .vimrc: > And put these lines in your .vimrc: >
" load the types.vim highlighting file, if it exists " load the types.vim highlighting file, if it exists
autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim' autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') .. '/types.vim'
autocmd BufRead,BufNewFile *.[ch] if filereadable(fname) autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname autocmd BufRead,BufNewFile *.[ch] exe 'so ' .. fname
autocmd BufRead,BufNewFile *.[ch] endif autocmd BufRead,BufNewFile *.[ch] endif
============================================================================== ==============================================================================

View File

@ -381,24 +381,24 @@ pages and define labels for them. Then get the label for each tab page. >
for i in range(tabpagenr('$')) for i in range(tabpagenr('$'))
" select the highlighting " select the highlighting
if i + 1 == tabpagenr() if i + 1 == tabpagenr()
let s .= '%#TabLineSel#' let s ..= '%#TabLineSel#'
else else
let s .= '%#TabLine#' let s ..= '%#TabLine#'
endif endif
" set the tab page number (for mouse clicks) " set the tab page number (for mouse clicks)
let s .= '%' . (i + 1) . 'T' let s ..= '%' .. (i + 1) .. 'T'
" the label is made by MyTabLabel() " the label is made by MyTabLabel()
let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' let s ..= ' %{MyTabLabel(' .. (i + 1) .. ')} '
endfor endfor
" after the last tab fill with TabLineFill and reset tab page nr " after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T' let s ..= '%#TabLineFill#%T'
" right-align the label to close the current tab page " right-align the label to close the current tab page
if tabpagenr('$') > 1 if tabpagenr('$') > 1
let s .= '%=%#TabLine#%999Xclose' let s ..= '%=%#TabLine#%999Xclose'
endif endif
return s return s
@ -461,14 +461,14 @@ windows in the tab page and a '+' if there is a modified buffer: >
" Append the number of windows in the tab page if more than one " Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$') let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1 if wincount > 1
let label .= wincount let label ..= wincount
endif endif
if label != '' if label != ''
let label .= ' ' let label ..= ' '
endif endif
" Append the buffer name " Append the buffer name
return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) return label .. bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
endfunction endfunction
set guitablabel=%{GuiTabLabel()} set guitablabel=%{GuiTabLabel()}

View File

@ -1355,6 +1355,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
+mouse various.txt /*+mouse* +mouse various.txt /*+mouse*
+mouse_dec various.txt /*+mouse_dec* +mouse_dec various.txt /*+mouse_dec*
+mouse_gpm various.txt /*+mouse_gpm* +mouse_gpm various.txt /*+mouse_gpm*
+mouse_gpm/dyn various.txt /*+mouse_gpm\/dyn*
+mouse_jsbterm various.txt /*+mouse_jsbterm* +mouse_jsbterm various.txt /*+mouse_jsbterm*
+mouse_netterm various.txt /*+mouse_netterm* +mouse_netterm various.txt /*+mouse_netterm*
+mouse_pterm various.txt /*+mouse_pterm* +mouse_pterm various.txt /*+mouse_pterm*
@ -5861,6 +5862,7 @@ bug-fixes-5 version5.txt /*bug-fixes-5*
bug-fixes-6 version6.txt /*bug-fixes-6* bug-fixes-6 version6.txt /*bug-fixes-6*
bug-fixes-7 version7.txt /*bug-fixes-7* bug-fixes-7 version7.txt /*bug-fixes-7*
bug-fixes-8 version8.txt /*bug-fixes-8* bug-fixes-8 version8.txt /*bug-fixes-8*
bug-fixes-9 version9.txt /*bug-fixes-9*
bug-reports intro.txt /*bug-reports* bug-reports intro.txt /*bug-reports*
bugreport.vim intro.txt /*bugreport.vim* bugreport.vim intro.txt /*bugreport.vim*
bugs intro.txt /*bugs* bugs intro.txt /*bugs*
@ -6171,6 +6173,7 @@ compile-changes-5 version5.txt /*compile-changes-5*
compile-changes-6 version6.txt /*compile-changes-6* compile-changes-6 version6.txt /*compile-changes-6*
compile-changes-7 version7.txt /*compile-changes-7* compile-changes-7 version7.txt /*compile-changes-7*
compile-changes-8 version8.txt /*compile-changes-8* compile-changes-8 version8.txt /*compile-changes-8*
compile-changes-9 version9.txt /*compile-changes-9*
compiler-compaqada ft_ada.txt /*compiler-compaqada* compiler-compaqada ft_ada.txt /*compiler-compaqada*
compiler-decada ft_ada.txt /*compiler-decada* compiler-decada ft_ada.txt /*compiler-decada*
compiler-gcc quickfix.txt /*compiler-gcc* compiler-gcc quickfix.txt /*compiler-gcc*
@ -7820,6 +7823,7 @@ improvements-5 version5.txt /*improvements-5*
improvements-6 version6.txt /*improvements-6* improvements-6 version6.txt /*improvements-6*
improvements-7 version7.txt /*improvements-7* improvements-7 version7.txt /*improvements-7*
improvements-8 version8.txt /*improvements-8* improvements-8 version8.txt /*improvements-8*
improvements-9 version9.txt /*improvements-9*
in_bot channel.txt /*in_bot* in_bot channel.txt /*in_bot*
in_buf channel.txt /*in_buf* in_buf channel.txt /*in_buf*
in_io-buffer channel.txt /*in_io-buffer* in_io-buffer channel.txt /*in_io-buffer*
@ -7835,6 +7839,7 @@ incompatible-5 version5.txt /*incompatible-5*
incompatible-6 version6.txt /*incompatible-6* incompatible-6 version6.txt /*incompatible-6*
incompatible-7 version7.txt /*incompatible-7* incompatible-7 version7.txt /*incompatible-7*
incompatible-8 version8.txt /*incompatible-8* incompatible-8 version8.txt /*incompatible-8*
incompatible-9 version9.txt /*incompatible-9*
indent() builtin.txt /*indent()* indent() builtin.txt /*indent()*
indent-expression indent.txt /*indent-expression* indent-expression indent.txt /*indent-expression*
indent.txt indent.txt /*indent.txt* indent.txt indent.txt /*indent.txt*
@ -8543,6 +8548,7 @@ new-5 version5.txt /*new-5*
new-6 version6.txt /*new-6* new-6 version6.txt /*new-6*
new-7 version7.txt /*new-7* new-7 version7.txt /*new-7*
new-8 version8.txt /*new-8* new-8 version8.txt /*new-8*
new-9 version9.txt /*new-9*
new-GTK-GUI version5.txt /*new-GTK-GUI* new-GTK-GUI version5.txt /*new-GTK-GUI*
new-MzScheme version7.txt /*new-MzScheme* new-MzScheme version7.txt /*new-MzScheme*
new-Select-mode version5.txt /*new-Select-mode* new-Select-mode version5.txt /*new-Select-mode*
@ -8576,6 +8582,7 @@ new-indent-flex version6.txt /*new-indent-flex*
new-items-6 version6.txt /*new-items-6* new-items-6 version6.txt /*new-items-6*
new-items-7 version7.txt /*new-items-7* new-items-7 version7.txt /*new-items-7*
new-items-8 version8.txt /*new-items-8* new-items-8 version8.txt /*new-items-8*
new-items-9 version9.txt /*new-items-9*
new-line-continuation version5.txt /*new-line-continuation* new-line-continuation version5.txt /*new-line-continuation*
new-location-list version7.txt /*new-location-list* new-location-list version7.txt /*new-location-list*
new-lua version7.txt /*new-lua* new-lua version7.txt /*new-lua*
@ -8625,6 +8632,7 @@ new-utf-8 version6.txt /*new-utf-8*
new-vertsplit version6.txt /*new-vertsplit* new-vertsplit version6.txt /*new-vertsplit*
new-vim-script version7.txt /*new-vim-script* new-vim-script version7.txt /*new-vim-script*
new-vim-script-8 version8.txt /*new-vim-script-8* new-vim-script-8 version8.txt /*new-vim-script-8*
new-vim-script-9 version9.txt /*new-vim-script-9*
new-vim-server version6.txt /*new-vim-server* new-vim-server version6.txt /*new-vim-server*
new-vimgrep version7.txt /*new-vimgrep* new-vimgrep version7.txt /*new-vimgrep*
new-vimscript-8.2 version8.txt /*new-vimscript-8.2* new-vimscript-8.2 version8.txt /*new-vimscript-8.2*
@ -8743,7 +8751,8 @@ pascal.vim syntax.txt /*pascal.vim*
patches-8 version8.txt /*patches-8* patches-8 version8.txt /*patches-8*
patches-8.1 version8.txt /*patches-8.1* patches-8.1 version8.txt /*patches-8.1*
patches-8.2 version8.txt /*patches-8.2* patches-8.2 version8.txt /*patches-8.2*
patches-after-8.2 version8.txt /*patches-after-8.2* patches-9 version9.txt /*patches-9*
patches-after-8.2 version9.txt /*patches-after-8.2*
pathshorten() builtin.txt /*pathshorten()* pathshorten() builtin.txt /*pathshorten()*
pattern pattern.txt /*pattern* pattern pattern.txt /*pattern*
pattern-atoms pattern.txt /*pattern-atoms* pattern-atoms pattern.txt /*pattern-atoms*
@ -10011,6 +10020,7 @@ terminal.txt terminal.txt /*terminal.txt*
terminalprops() builtin.txt /*terminalprops()* terminalprops() builtin.txt /*terminalprops()*
terminfo term.txt /*terminfo* terminfo term.txt /*terminfo*
termresponse-variable eval.txt /*termresponse-variable* termresponse-variable eval.txt /*termresponse-variable*
ternary eval.txt /*ternary*
test-functions usr_41.txt /*test-functions* test-functions usr_41.txt /*test-functions*
test-functions-details testing.txt /*test-functions-details* test-functions-details testing.txt /*test-functions-details*
test_alloc_fail() testing.txt /*test_alloc_fail()* test_alloc_fail() testing.txt /*test_alloc_fail()*
@ -10102,7 +10112,6 @@ tooltips gui.txt /*tooltips*
toupper() builtin.txt /*toupper()* toupper() builtin.txt /*toupper()*
tr() builtin.txt /*tr()* tr() builtin.txt /*tr()*
trim() builtin.txt /*trim()* trim() builtin.txt /*trim()*
trinary eval.txt /*trinary*
trojan-horse starting.txt /*trojan-horse* trojan-horse starting.txt /*trojan-horse*
true vim9.txt /*true* true vim9.txt /*true*
true-variable eval.txt /*true-variable* true-variable eval.txt /*true-variable*
@ -10457,6 +10466,7 @@ version-7.4 version7.txt /*version-7.4*
version-8.0 version8.txt /*version-8.0* version-8.0 version8.txt /*version-8.0*
version-8.1 version8.txt /*version-8.1* version-8.1 version8.txt /*version-8.1*
version-8.2 version8.txt /*version-8.2* version-8.2 version8.txt /*version-8.2*
version-9.0 version9.txt /*version-9.0*
version-variable eval.txt /*version-variable* version-variable eval.txt /*version-variable*
version4.txt version4.txt /*version4.txt* version4.txt version4.txt /*version4.txt*
version5.txt version5.txt /*version5.txt* version5.txt version5.txt /*version5.txt*
@ -10471,6 +10481,8 @@ version8.0 version8.txt /*version8.0*
version8.1 version8.txt /*version8.1* version8.1 version8.txt /*version8.1*
version8.2 version8.txt /*version8.2* version8.2 version8.txt /*version8.2*
version8.txt version8.txt /*version8.txt* version8.txt version8.txt /*version8.txt*
version9.0 version9.txt /*version9.0*
version9.txt version9.txt /*version9.txt*
versionlong-variable eval.txt /*versionlong-variable* versionlong-variable eval.txt /*versionlong-variable*
vi intro.txt /*vi* vi intro.txt /*vi*
vi-differences vi_diff.txt /*vi-differences* vi-differences vi_diff.txt /*vi-differences*
@ -10486,6 +10498,8 @@ vim-7.4 version7.txt /*vim-7.4*
vim-8 version8.txt /*vim-8* vim-8 version8.txt /*vim-8*
vim-8.1 version8.txt /*vim-8.1* vim-8.1 version8.txt /*vim-8.1*
vim-8.2 version8.txt /*vim-8.2* vim-8.2 version8.txt /*vim-8.2*
vim-9 version9.txt /*vim-9*
vim-9.0 version9.txt /*vim-9.0*
vim-additions vi_diff.txt /*vim-additions* vim-additions vi_diff.txt /*vim-additions*
vim-announce intro.txt /*vim-announce* vim-announce intro.txt /*vim-announce*
vim-arguments starting.txt /*vim-arguments* vim-arguments starting.txt /*vim-arguments*

View File

@ -724,7 +724,7 @@ matches the pattern "^# *define" it is not considered to be a comment.
If you want to list matches, and then select one to jump to, you could use a If you want to list matches, and then select one to jump to, you could use a
mapping to do that for you. Here is an example: > mapping to do that for you. Here is an example: >
:map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR> :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " .. nr .. "[\t"<CR>
< <
*[i* *[i*
[i Display the first line that contains the keyword [i Display the first line that contains the keyword

View File

@ -984,7 +984,7 @@ an #if/#else/#endif block, the selection becomes linewise.
For MS-Windows and xterm the time for double clicking can be set with the For MS-Windows and xterm the time for double clicking can be set with the
'mousetime' option. For the other systems this time is defined outside of Vim. 'mousetime' option. For the other systems this time is defined outside of Vim.
An example, for using a double click to jump to the tag under the cursor: > An example, for using a double click to jump to the tag under the cursor: >
:map <2-LeftMouse> :exe "tag ". expand("<cword>")<CR> :map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>
Dragging the mouse with a double click (button-down, button-up, button-down Dragging the mouse with a double click (button-down, button-up, button-down
and then drag) will result in whole words to be selected. This continues and then drag) will result in whole words to be selected. This continues

View File

@ -979,8 +979,8 @@ Currently supported commands:
< Calls a function defined like this: > < Calls a function defined like this: >
function Tapi_Impression(bufnum, arglist) function Tapi_Impression(bufnum, arglist)
if len(a:arglist) == 2 if len(a:arglist) == 2
echomsg "impression " . a:arglist[0] echomsg "impression " .. a:arglist[0]
echomsg "count " . a:arglist[1] echomsg "count " .. a:arglist[1]
endif endif
endfunc endfunc
< Output from `:echo` may be erased by a redraw, use `:echomsg` < Output from `:echo` may be erased by a redraw, use `:echomsg`

View File

@ -101,14 +101,14 @@ What you need:
create it with the shell command "mkid file1 file2 ..". create it with the shell command "mkid file1 file2 ..".
Put this in your .vimrc: > Put this in your .vimrc: >
map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR> map _u :call ID_search()<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR> map _n :n<Bar>execute "/\\<" .. g:word .. "\\>"<CR>
function! ID_search() function! ID_search()
let g:word = expand("<cword>") let g:word = expand("<cword>")
let x = system("lid --key=none ". g:word) let x = system("lid --key=none " .. g:word)
let x = substitute(x, "\n", " ", "g") let x = substitute(x, "\n", " ", "g")
execute "next " . x execute "next " .. x
endfun endfun
To use it, place the cursor on a word, type "_u" and vim will load the file To use it, place the cursor on a word, type "_u" and vim will load the file
@ -357,12 +357,12 @@ line above and below each list entry. The expression commands are used to
be able to give comments to the parts of the mapping. > be able to give comments to the parts of the mapping. >
:let m = ":map _f :set ai<CR>" " need 'autoindent' set :let m = ":map _f :set ai<CR>" " need 'autoindent' set
:let m = m . "{O<Esc>" " add empty line above item :let m ..= "{O<Esc>" " add empty line above item
:let m = m . "}{)^W" " move to text after bullet :let m ..= "}{)^W" " move to text after bullet
:let m = m . "i <CR> <Esc>" " add space for indent :let m ..= "i <CR> <Esc>" " add space for indent
:let m = m . "gq}" " format text after the bullet :let m ..= "gq}" " format text after the bullet
:let m = m . "{dd" " remove the empty line :let m ..= "{dd" " remove the empty line
:let m = m . "5lDJ" " put text after bullet :let m ..= "5lDJ" " put text after bullet
:execute m |" define the mapping :execute m |" define the mapping
(<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not (<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not
@ -514,15 +514,15 @@ A slightly more advanced version is used in the |matchparen| plugin.
let c = '\[' let c = '\['
let c2 = '\]' let c2 = '\]'
endif endif
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' ..
\ '=~? "string\\|comment"' \ '=~? "string\\|comment"'
execute 'if' s_skip '| let s_skip = 0 | endif' execute 'if' s_skip '| let s_skip = 0 | endif'
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip) let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip)
if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$') if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col . exe 'match Search /\(\%' .. c_lnum .. 'l\%' .. c_col ..
\ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' \ 'c\)\|\(\%' .. m_lnum .. 'l\%' .. m_col .. 'c\)/'
let s:paren_hl_on = 1 let s:paren_hl_on = 1
endif endif
endfunction endfunction

View File

@ -286,12 +286,12 @@ history file. E.g.: >
au BufReadPost * call ReadUndo() au BufReadPost * call ReadUndo()
au BufWritePost * call WriteUndo() au BufWritePost * call WriteUndo()
func ReadUndo() func ReadUndo()
if filereadable(expand('%:h'). '/UNDO/' . expand('%:t')) if filereadable(expand('%:h') .. '/UNDO/' .. expand('%:t'))
rundo %:h/UNDO/%:t rundo %:h/UNDO/%:t
endif endif
endfunc endfunc
func WriteUndo() func WriteUndo()
let dirname = expand('%:h') . '/UNDO' let dirname = expand('%:h') .. '/UNDO'
if !isdirectory(dirname) if !isdirectory(dirname)
call mkdir(dirname) call mkdir(dirname)
endif endif

View File

@ -270,7 +270,7 @@ line break. Revert with ":iunmap <C-U>".
Enable using the mouse if available. See 'mouse'. Enable using the mouse if available. See 'mouse'.
> >
vnoremap _g y:exe "grep /" . escape(@", '\\/') . "/ *.c *.h"<CR> vnoremap _g y:exe "grep /" .. escape(@", '\\/') .. "/ *.c *.h"<CR>
This mapping yanks the visually selected text and searches for it in C files. This mapping yanks the visually selected text and searches for it in C files.
You can see that a mapping can be used to do quite complicated things. Still, You can see that a mapping can be used to do quite complicated things. Still,

View File

@ -267,7 +267,7 @@ g8 Print the hex values of the bytes used in the
name does not contain a single quote: > name does not contain a single quote: >
:!ls '%' :!ls '%'
< This should always work, but it's more typing: > < This should always work, but it's more typing: >
:exe "!ls " . shellescape(expand("%")) :exe "!ls " .. shellescape(expand("%"))
< To get a literal "%" or "#" prepend it with a < To get a literal "%" or "#" prepend it with a
backslash. For example, to list all files starting backslash. For example, to list all files starting
with "%": > with "%": >
@ -650,7 +650,7 @@ N *+X11* Unix only: can restore window title |X11|
used. In this example |:silent| is used to avoid the used. In this example |:silent| is used to avoid the
message about reading the file and |:unsilent| to be message about reading the file and |:unsilent| to be
able to list the first line of each file. > able to list the first line of each file. >
:silent argdo unsilent echo expand('%') . ": " . getline(1) :silent argdo unsilent echo expand('%') .. ": " .. getline(1)
< <
*:verb* *:verbose* *:verb* *:verbose*

File diff suppressed because it is too large Load Diff

26799
runtime/doc/version9.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2022 Feb 22 *vim9.txt* For Vim version 8.2. Last change: 2022 Feb 23
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -229,8 +229,17 @@ script "export" needs to be used. >
< *E1058* *E1075* < *E1058* *E1075*
When using `:function` or `:def` to specify a nested function inside a `:def` When using `:function` or `:def` to specify a nested function inside a `:def`
function and no namespace was given, this nested function is local to the code function and no namespace was given, this nested function is local to the code
block it is defined in. It is not possible to define a script-local function. block it is defined in. It cannot be used in `function()` with a string
It is possible to define a global function by using the "g:" prefix. argument, pass the function reference itself: >
def Outer()
def Inner()
echo 'inner'
enddef
var Fok = function(Inner) # OK
var Fbad = function('Inner') # does not work
It is not possible to define a script-local function. It is possible to
define a global function by using the "g:" prefix.
When referring to a function and no "s:" or "g:" prefix is used, Vim will When referring to a function and no "s:" or "g:" prefix is used, Vim will
search for the function: search for the function:

View File

@ -473,7 +473,7 @@ These commands can also be executed with ":wincmd":
the |CursorHold| autocommand event). Or when a Normal mode the |CursorHold| autocommand event). Or when a Normal mode
command is inconvenient. command is inconvenient.
The count can also be a window number. Example: > The count can also be a window number. Example: >
:exe nr . "wincmd w" :exe nr .. "wincmd w"
< This goes to window "nr". < This goes to window "nr".
============================================================================== ==============================================================================
@ -964,12 +964,12 @@ CTRL-W g } *CTRL-W_g}*
cursor. This is less clever than using |:ptag|, but you don't cursor. This is less clever than using |:ptag|, but you don't
need a tags file and it will also find matches in system need a tags file and it will also find matches in system
include files. Example: > include files. Example: >
:au! CursorHold *.[ch] ++nested exe "silent! psearch " . expand("<cword>") :au! CursorHold *.[ch] ++nested exe "silent! psearch " .. expand("<cword>")
< Warning: This can be slow. < Warning: This can be slow.
Example *CursorHold-example* > Example *CursorHold-example* >
:au! CursorHold *.[ch] ++nested exe "silent! ptag " . expand("<cword>") :au! CursorHold *.[ch] ++nested exe "silent! ptag " .. expand("<cword>")
This will cause a ":ptag" to be executed for the keyword under the cursor, This will cause a ":ptag" to be executed for the keyword under the cursor,
when the cursor hasn't moved for the time set with 'updatetime'. The "nested" when the cursor hasn't moved for the time set with 'updatetime'. The "nested"
@ -999,7 +999,7 @@ is no word under the cursor, and a few other things: >
: :
: " Try displaying a matching tag for the word under the cursor : " Try displaying a matching tag for the word under the cursor
: try : try
: exe "ptag " . w : exe "ptag " .. w
: catch : catch
: return : return
: endtry : endtry
@ -1011,10 +1011,10 @@ is no word under the cursor, and a few other things: >
: endif : endif
: call search("$", "b") " to end of previous line : call search("$", "b") " to end of previous line
: let w = substitute(w, '\\', '\\\\', "") : let w = substitute(w, '\\', '\\\\', "")
: call search('\<\V' . w . '\>') " position cursor on match : call search('\<\V' .. w .. '\>') " position cursor on match
: " Add a match highlight to the word at this position : " Add a match highlight to the word at this position
: hi previewWord term=bold ctermbg=green guibg=green : hi previewWord term=bold ctermbg=green guibg=green
: exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' : exe 'match previewWord "\%' .. line(".") .. 'l\%' .. col(".") .. 'c\k*"'
: wincmd p " back to old window : wincmd p " back to old window
: endif : endif
: endif : endif

View File

@ -1,7 +1,7 @@
" Vim indent file " Vim indent file
" Language: Vim script " Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Nov 27 " Last Change: 2022 Feb 23
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists("b:did_indent") if exists("b:did_indent")
@ -10,7 +10,7 @@ endif
let b:did_indent = 1 let b:did_indent = 1
setlocal indentexpr=GetVimIndent() setlocal indentexpr=GetVimIndent()
setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\ setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=},=else,=cat,=finall,=END,0\\,0=\"\\\
setlocal indentkeys-=0# setlocal indentkeys-=0#
setlocal indentkeys-=: setlocal indentkeys-=:
@ -103,8 +103,9 @@ function GetVimIndentIntern()
" A line starting with :au does not increment/decrement indent. " A line starting with :au does not increment/decrement indent.
" A { may start a block or a dict. Assume that when a } follows it's a " A { may start a block or a dict. Assume that when a } follows it's a
" terminated dict. " terminated dict.
" ":function" starts a block but "function(" doesn't.
if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}' if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}'
let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)') let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|def\|el\%[seif]\)\>\|fu\%[nction]\s\)')
if i >= 0 if i >= 0
let ind += shiftwidth() let ind += shiftwidth()
if strpart(prev_text, i, 1) == '|' && has('syntax_items') if strpart(prev_text, i, 1) == '|' && has('syntax_items')
@ -170,10 +171,15 @@ function GetVimIndentIntern()
let ind = ind + shiftwidth() let ind = ind + shiftwidth()
endif endif
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " Subtract a 'shiftwidth' on a :endif, :endwhile, :endfor, :catch, :finally,
" :endfun, :enddef, :else and :augroup END. " :endtry, :endfun, :enddef, :else and :augroup END.
if cur_text =~ '^\s*\(ene\@!\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' " Although ":en" would be enough only match short command names as in
" 'indentkeys'.
if cur_text =~ '^\s*\(endif\|endwh\|endfor\|endtry\|endfu\|enddef\|cat\|finall\|else\|aug\%[roup]\s\+[eE][nN][dD]\)'
let ind = ind - shiftwidth() let ind = ind - shiftwidth()
if ind < 0
let ind = 0
endif
endif endif
return ind return ind