# HG changeset patch # User Bram Moolenaar # Date 1628969404 -7200 # Node ID 29ec2c198c8d3540c365f5adbb42bdc62a9d621f # Parent b5765575dc5aafc7731c4beeaaf81ad9e7fb8ef9 Update runtime files Commit: https://github.com/vim/vim/commit/6aa57295cfbe8f21c15f0671e45fd53cf990d404 Author: Bram Moolenaar Date: Sat Aug 14 21:25:52 2021 +0200 Update runtime files diff --git a/runtime/compiler/scdoc.vim b/runtime/compiler/scdoc.vim new file mode 100644 --- /dev/null +++ b/runtime/compiler/scdoc.vim @@ -0,0 +1,16 @@ +" scdoc compiler for Vim +" Compiler: scdoc +" Maintainer: Greg Anders +" Last Updated: 2019-10-24 + +if exists('current_compiler') + finish +endif +let current_compiler = 'scdoc' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=scdoc\ <\ %\ 2>&1 +CompilerSet errorformat=Error\ at\ %l:%c:\ %m,%-G%.%# diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.2. Last change: 2021 Jul 27 +*autocmd.txt* For Vim version 8.2. Last change: 2021 Aug 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -76,7 +76,7 @@ and in a `:def` function) then {cmd} wil script. Thus this depends on where the autocmd is defined, not where it is triggered. -{cmd} can use a block, like with `:command`, see |:command-repl|. Example: > +{cmd} can be a block, like with `:command`, see |:command-repl|. Example: > au BufReadPost *.xml { setlocal matchpairs+=<:> /ch_evalraw(rawstring) ch_getbufnr({handle}, {what}) *ch_getbufnr()* - Get the buffer number that {handle} is using for {what}. + Get the buffer number that {handle} is using for String {what}. {handle} can be a Channel or a Job that has a Channel. {what} can be "err" for stderr, "out" for stdout or empty for socket output. @@ -586,8 +586,8 @@ ch_info({handle}) *ch_info()* ch_log({msg} [, {handle}]) *ch_log()* - Write {msg} in the channel log file, if it was opened with - |ch_logfile()|. + Write String {msg} in the channel log file, if it was opened + with |ch_logfile()|. When {handle} is passed the channel number is used for the message. {handle} can be a Channel or a Job that has a Channel. The @@ -625,7 +625,7 @@ ch_open({address} [, {options}]) *ch_ Open a channel to {address}. See |channel|. Returns a Channel. Use |ch_status()| to check for failure. - {address} has the form "hostname:port", e.g., + {address} is a String and has the form "hostname:port", e.g., "localhost:8765". When using an IPv6 address, enclose it within square brackets. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 8.2. Last change: 2021 May 30 +*cmdline.txt* For Vim version 8.2. Last change: 2021 Aug 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -170,7 +170,12 @@ CTRL-R {register} *c_CTRL-R* *c_ + =setcmdpos(2)[-1] +< See |registers| about registers. Implementation detail: When using the |expression| register and invoking setcmdpos(), this sets the position before inserting the resulting string. Use CTRL-R CTRL-R to set the diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Jul 28 +*eval.txt* For Vim version 8.2. Last change: 2021 Aug 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -55,7 +55,6 @@ Float A floating point number. |floatin {only when compiled with the |+float| feature} Examples: 123.456 1.15e-6 -1.1e3 - *E928* String A NUL terminated string of 8-bit unsigned characters (bytes). |expr-string| Examples: "ab\txx\"--" 'x-z''a,c' @@ -121,7 +120,7 @@ base, use |str2nr()|. *TRUE* *FALSE* *Boolean* For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. -You can also use |v:false| and |v:true|. In Vim9 script |false| and |true|. +You can also use |v:false| and |v:true|, in Vim9 script |false| and |true|. When TRUE is returned from a function it is the Number one, FALSE is the number zero. @@ -1348,7 +1347,8 @@ Floating point numbers can be written in [-+]{N}.{M}[eE][-+]{exp} {N} and {M} are numbers. Both {N} and {M} must be present and can only -contain digits. +contain digits, except that in |Vim9| script in {N} single quotes between +digits are ignored. [-+] means there is an optional plus or minus sign. {exp} is the exponent, power of 10. Only a decimal point is accepted, not a comma. No matter what the current @@ -2543,8 +2543,8 @@ cursor({list}) Number move cursor to p debugbreak({pid}) Number interrupt process being debugged deepcopy({expr} [, {noref}]) any make a full copy of {expr} delete({fname} [, {flags}]) Number delete the file or directory {fname} -deletebufline({expr}, {first} [, {last}]) - Number delete lines from buffer {expr} +deletebufline({buf}, {first} [, {last}]) + Number delete lines from buffer {buf} did_filetype() Number |TRUE| if FileType autocmd event used diff_filler({lnum}) Number diff filler lines about {lnum} diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} @@ -2604,12 +2604,12 @@ garbagecollect([{atexit}]) none free mem get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} get({func}, {what}) any get property of funcref/partial {func} -getbufinfo([{expr}]) List information about buffers -getbufline({expr}, {lnum} [, {end}]) - List lines {lnum} to {end} of buffer {expr} -getbufvar({expr}, {varname} [, {def}]) - any variable {varname} in buffer {expr} -getchangelist([{expr}]) List list of change list items +getbufinfo([{buf}]) List information about buffers +getbufline({buf}, {lnum} [, {end}]) + List lines {lnum} to {end} of buffer {buf} +getbufvar({buf}, {varname} [, {def}]) + any variable {varname} in buffer {buf} +getchangelist([{buf}]) List list of change list items getchar([expr]) Number or String get one character from the user getcharmod() Number modifiers for the last typed character @@ -2638,7 +2638,7 @@ getline({lnum}) String line {lnum} of getline({lnum}, {end}) List lines {lnum} to {end} of current buffer getloclist({nr}) List list of location list items getloclist({nr}, {what}) Dict get specific location list properties -getmarklist([{expr}]) List list of global/local marks +getmarklist([{buf}]) List list of global/local marks getmatches([{win}]) List list of current matches getmousepos() Dict last known mouse position getpid() Number process ID of Vim @@ -2884,8 +2884,8 @@ serverlist() String get a list of avai setbufline({expr}, {lnum}, {text}) Number set line {lnum} to {text} in buffer {expr} -setbufvar({expr}, {varname}, {val}) - none set {varname} in buffer {expr} to {val} +setbufvar({buf}, {varname}, {val}) + none set {varname} in buffer {buf} to {val} setcellwidths({list}) none set character cell width overrides setcharpos({expr}, {list}) Number set the {expr} position to {list} setcharsearch({dict}) Dict set character search from {dict} @@ -2919,11 +2919,11 @@ shiftwidth([{col}]) Number effective va sign_define({name} [, {dict}]) Number define or update a sign sign_define({list}) List define or update a list of signs sign_getdefined([{name}]) List get a list of defined signs -sign_getplaced([{expr} [, {dict}]]) +sign_getplaced([{buf} [, {dict}]]) List get a list of placed signs -sign_jump({id}, {group}, {expr}) +sign_jump({id}, {group}, {buf}) Number jump to a sign -sign_place({id}, {group}, {name}, {expr} [, {dict}]) +sign_place({id}, {group}, {name}, {buf} [, {dict}]) Number place a sign sign_placelist({list}) List place a list of signs sign_undefine([{name}]) Number undefine a sign @@ -2953,7 +2953,7 @@ split({expr} [, {pat} [, {keepempty}]]) sqrt({expr}) Float square root of {expr} srand([{expr}]) List get seed for |rand()| state([{what}]) String current state of Vim -str2float({expr}) Float convert String to Float +str2float({expr} [, {quoted}]) Float convert String to Float str2list({expr} [, {utf8}]) List convert each character of {expr} to ASCII/UTF8 value str2nr({expr} [, {base} [, {quoted}]]) @@ -2984,7 +2984,7 @@ submatch({nr} [, {list}]) String or List substitute({expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} swapinfo({fname}) Dict information about swap file {fname} -swapname({expr}) String swap file of buffer {expr} +swapname({buf}) String swap file of buffer {buf} synID({lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} synIDattr({synID}, {what} [, {mode}]) String attribute {what} of syntax ID {synID} @@ -3189,13 +3189,13 @@ append({lnum}, {text}) *append()* mylist->append(lnum) -appendbufline({expr}, {lnum}, {text}) *appendbufline()* - Like |append()| but append the text in buffer {expr}. +appendbufline({buf}, {lnum}, {text}) *appendbufline()* + Like |append()| but append the text in buffer {buf}. This function works only for loaded buffers. First call |bufload()| if needed. - For the use of {expr}, see |bufname()|. + For the use of {buf}, see |bufname()|. {lnum} is used like with |append()|. Note that using |line()| would use the current buffer, not the one appending to. @@ -3203,7 +3203,7 @@ appendbufline({expr}, {lnum}, {text}) On success 0 is returned, on failure 1 is returned. - If {expr} is not a valid buffer or {lnum} is not valid, an + If {buf} is not a valid buffer or {lnum} is not valid, an error message is given. Example: > :let failed = appendbufline(13, 0, "# THE START") < @@ -3303,7 +3303,7 @@ atan2({expr1}, {expr2}) *atan2()* < 2.356194 Can also be used as a |method|: > - Compute()->atan(1) + Compute()->atan2(1) < {only available when compiled with the |+float| feature} @@ -3343,9 +3343,9 @@ balloon_show({expr}) *balloon_show() |+balloon_eval_term| feature} balloon_split({msg}) *balloon_split()* - Split {msg} into lines to be displayed in a balloon. The - splits are made for the current window size and optimize to - show debugger output. + Split String {msg} into lines to be displayed in a balloon. + The splits are made for the current window size and optimize + to show debugger output. Returns a |List| with the split lines. Can also be used as a |method|: > GetText()->balloon_split()->balloon_show() @@ -3379,7 +3379,7 @@ browsedir({title}, {initdir}) browsing is not possible, an empty string is returned. bufadd({name}) *bufadd()* - Add a buffer to the buffer list with {name}. + Add a buffer to the buffer list with String {name}. If a buffer for file {name} already exists, return that buffer number. Otherwise return the buffer number of the newly created buffer. When {name} is an empty string then a new @@ -3392,13 +3392,13 @@ bufadd({name}) *bufadd()* < Can also be used as a |method|: > let bufnr = 'somename'->bufadd() -bufexists({expr}) *bufexists()* +bufexists({buf}) *bufexists()* The result is a Number, which is |TRUE| if a buffer called - {expr} exists. - If the {expr} argument is a number, buffer numbers are used. + {buf} exists. + If the {buf} argument is a number, buffer numbers are used. Number zero is the alternate buffer for the current window. - If the {expr} argument is a string it must match a buffer name + If the {buf} argument is a string it must match a buffer name exactly. The name can be: - Relative to the current directory. - A full path. @@ -3419,42 +3419,42 @@ bufexists({expr}) *bufexists()* < Obsolete name: buffer_exists(). *buffer_exists()* -buflisted({expr}) *buflisted()* +buflisted({buf}) *buflisted()* The result is a Number, which is |TRUE| if a buffer called - {expr} exists and is listed (has the 'buflisted' option set). - The {expr} argument is used like with |bufexists()|. + {buf} exists and is listed (has the 'buflisted' option set). + The {buf} argument is used like with |bufexists()|. Can also be used as a |method|: > let listed = 'somename'->buflisted() -bufload({expr}) *bufload()* - Ensure the buffer {expr} is loaded. When the buffer name +bufload({buf}) *bufload()* + Ensure the buffer {buf} is loaded. When the buffer name refers to an existing file then the file is read. Otherwise the buffer will be empty. If the buffer was already loaded then there is no change. If there is an existing swap file for the file of the buffer, there will be no dialog, the buffer will be loaded anyway. - The {expr} argument is used like with |bufexists()|. + The {buf} argument is used like with |bufexists()|. Can also be used as a |method|: > eval 'somename'->bufload() -bufloaded({expr}) *bufloaded()* +bufloaded({buf}) *bufloaded()* The result is a Number, which is |TRUE| if a buffer called - {expr} exists and is loaded (shown in a window or hidden). - The {expr} argument is used like with |bufexists()|. + {buf} exists and is loaded (shown in a window or hidden). + The {buf} argument is used like with |bufexists()|. Can also be used as a |method|: > let loaded = 'somename'->bufloaded() -bufname([{expr}]) *bufname()* +bufname([{buf}]) *bufname()* The result is the name of a buffer. Mostly as it is displayed by the `:ls` command, but not using special names such as "[No Name]". - If {expr} is omitted the current buffer is used. - If {expr} is a Number, that buffer number's name is given. + If {buf} is omitted the current buffer is used. + If {buf} is a Number, that buffer number's name is given. Number zero is the alternate buffer for the current window. - If {expr} is a String, it is used as a |file-pattern| to match + If {buf} is a String, it is used as a |file-pattern| to match with the buffer names. This is always done like 'magic' is set and 'cpoptions' is empty. When there is more than one match an empty string is returned. @@ -3467,7 +3467,7 @@ bufname([{expr}]) *bufname()* Listed buffers are found first. If there is a single match with a listed buffer, that one is returned. Next unlisted buffers are searched for. - If the {expr} is a String, but you want to use it as a buffer + If the {buf} is a String, but you want to use it as a buffer number, force it to be a Number by adding zero to it: > :echo bufname("3" + 0) < Can also be used as a |method|: > @@ -3483,9 +3483,9 @@ bufname([{expr}]) *bufname()* Obsolete name: buffer_name(). *bufnr()* -bufnr([{expr} [, {create}]]) +bufnr([{buf} [, {create}]]) The result is the number of a buffer, as it is displayed by - the `:ls` command. For the use of {expr}, see |bufname()| + the `:ls` command. For the use of {buf}, see |bufname()| above. If the buffer doesn't exist, -1 is returned. Or, if the @@ -3509,10 +3509,10 @@ bufnr([{expr} [, {create}]]) *last_buffer_nr()* Obsolete name for bufnr("$"): last_buffer_nr(). -bufwinid({expr}) *bufwinid()* +bufwinid({buf}) *bufwinid()* The result is a Number, which is the |window-ID| of the first - window associated with buffer {expr}. For the use of {expr}, - see |bufname()| above. If buffer {expr} doesn't exist or + window associated with buffer {buf}. For the use of {buf}, + see |bufname()| above. If buffer {buf} doesn't exist or there is no such window, -1 is returned. Example: > echo "A window containing buffer 1 is " . (bufwinid(1)) @@ -3522,10 +3522,10 @@ bufwinid({expr}) *bufwinid()* Can also be used as a |method|: > FindBuffer()->bufwinid() -bufwinnr({expr}) *bufwinnr()* +bufwinnr({buf}) *bufwinnr()* Like |bufwinid()| but return the window number instead of the |window-ID|. - If buffer {expr} 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: > echo "A window containing buffer 1 is " . (bufwinnr(1)) @@ -3551,7 +3551,7 @@ byte2line({byte}) *byte2line()* feature} byteidx({expr}, {nr}) *byteidx()* - Return byte index of the {nr}'th character in the string + Return byte index of the {nr}'th character in the String {expr}. Use zero for the first character, it then returns zero. If there are no multibyte characters the returned value is @@ -3632,8 +3632,9 @@ changenr() *changenr()* redo it is the number of the redone change. After undo it is one less than the number of the undone change. -char2nr({expr} [, {utf8}]) *char2nr()* - Return number value of the first char in {expr}. Examples: > +char2nr({string} [, {utf8}]) *char2nr()* + Return number value of the first char in {string}. + Examples: > char2nr(" ") returns 32 char2nr("ABC") returns 65 < When {utf8} is omitted or zero, the current 'encoding' is used. @@ -3662,8 +3663,9 @@ charclass({string}) *charclass()* other specific Unicode class The class is used in patterns and word motions. - *charcol()* -charcol({expr}) Same as |col()| but returns the character index of the column + +charcol({expr}) *charcol()* + Same as |col()| but returns the character index of the column position given with {expr} instead of the byte position. Example: @@ -3799,6 +3801,7 @@ complete({startcol}, {matches}) *compl match. {matches} must be a |List|. Each |List| item is one match. See |complete-items| for the kind of items that are possible. + "longest" in 'completeopt' is ignored. Note that the after calling this function you need to avoid inserting anything that would cause completion to stop. The match can be selected with CTRL-N and CTRL-P as usual with @@ -3840,8 +3843,8 @@ complete_check() *complete_check()* Only to be used by the function specified with the 'completefunc' option. - *complete_info()* -complete_info([{what}]) + +complete_info([{what}]) *complete_info()* Returns a |Dictionary| with information about Insert mode completion. See |ins-completion|. The items are: @@ -3927,11 +3930,12 @@ confirm({msg} [, {choices} [, {default} choice the default one. Use 0 to not set a default. If {default} is omitted, 1 is used. - The optional {type} argument gives the type of dialog. This - is only used for the icon of the GTK, Mac, Motif and Win32 - GUI. It can be one of these values: "Error", "Question", - "Info", "Warning" or "Generic". Only the first character is - relevant. When {type} is omitted, "Generic" is used. + The optional {type} String argument gives the type of dialog. + This is only used for the icon of the GTK, Mac, Motif and + Win32 GUI. It can be one of these values: "Error", + "Question", "Info", "Warning" or "Generic". Only the first + character is relevant. When {type} is omitted, "Generic" is + used. If the user aborts the dialog by pressing , CTRL-C, or another valid interrupt key, confirm() returns 0. @@ -4125,7 +4129,7 @@ deepcopy({expr} [, {noref}]) *deepcop Can also be used as a |method|: > GetObject()->deepcopy() -delete({fname} [, {flags}]) *delete()* +delete({fname} [, {flags}]) *delete()* Without {flags} or with {flags} empty: Deletes the file by the name {fname}. This also works when {fname} is a symbolic link. @@ -4150,19 +4154,19 @@ delete({fname} [, {flags}]) *delete( Can also be used as a |method|: > GetName()->delete() -deletebufline({expr}, {first} [, {last}]) *deletebufline()* - Delete lines {first} to {last} (inclusive) from buffer {expr}. +deletebufline({buf}, {first} [, {last}]) *deletebufline()* + Delete lines {first} to {last} (inclusive) from buffer {buf}. If {last} is omitted then delete line {first} only. On success 0 is returned, on failure 1 is returned. This function works only for loaded buffers. First call |bufload()| if needed. - For the use of {expr}, see |bufname()| above. + For the use of {buf}, see |bufname()| above. {first} and {last} are used like with |getline()|. Note that when using |line()| this refers to the current buffer. Use "$" - to refer to the last line in buffer {expr}. + to refer to the last line in buffer {buf}. Can also be used as a |method|: > GetBuffer()->deletebufline(1) @@ -4307,10 +4311,10 @@ digraph_setlist({digraphlist}) *digra display an error message. -echoraw({expr}) *echoraw()* - Output {expr} as-is, including unprintable characters. This - can be used to output a terminal code. For example, to disable - modifyOtherKeys: > +echoraw({string}) *echoraw()* + Output {string} as-is, including unprintable characters. + This can be used to output a terminal code. For example, to + disable modifyOtherKeys: > call echoraw(&t_TE) < and to enable it again: > call echoraw(&t_TI) @@ -4551,6 +4555,7 @@ exists_compiled({expr}) *exists_comp {expr} must be a literal string. *E1232* Can only be used in a |:def| function. *E1233* + This does not work to check for arguments or local variables. exp({expr}) *exp()* @@ -4569,9 +4574,9 @@ exp({expr}) *exp()* {only available when compiled with the |+float| feature} -expand({expr} [, {nosuf} [, {list}]]) *expand()* - Expand wildcards and the following special keywords in {expr}. - 'wildignorecase' applies. +expand({string} [, {nosuf} [, {list}]]) *expand()* + Expand wildcards and the following special keywords in + {string}. 'wildignorecase' applies. If {list} is given and it is |TRUE|, a List will be returned. Otherwise the result is a String and when there are several @@ -4580,12 +4585,12 @@ expand({expr} [, {nosuf} [, {list}]]) file name contains a space] If the expansion fails, the result is an empty string. A name - for a non-existing file is not included, unless {expr} does + for a non-existing file is not included, unless {string} does not start with '%', '#' or '<', see below. - When {expr} starts with '%', '#' or '<', the expansion is done - like for the |cmdline-special| variables with their associated - modifiers. Here is a short overview: + When {string} starts with '%', '#' or '<', the expansion is + done like for the |cmdline-special| variables with their + associated modifiers. Here is a short overview: % current file name # alternate file name @@ -4636,7 +4641,7 @@ expand({expr} [, {nosuf} [, {list}]]) buffer with no name, results in the current directory, with a '/' added. - When {expr} does not start with '%', '#' or '<', it is + When {string} does not start with '%', '#' or '<', it is expanded like a file name is expanded on the command line. 'suffixes' and 'wildignore' are used, unless the optional {nosuf} argument is given and it is |TRUE|. @@ -4660,11 +4665,12 @@ expand({expr} [, {nosuf} [, {list}]]) Can also be used as a |method|: > Getpattern()->expand() -expandcmd({expr}) *expandcmd()* - Expand special items in {expr} like what is done for an Ex - command such as `:edit`. This expands special keywords, like - with |expand()|, and environment variables, anywhere in - {expr}. "~user" and "~/path" are only expanded at the start. +expandcmd({string}) *expandcmd()* + Expand special items in String {string} like what is done for + an Ex command such as `:edit`. This expands special keywords, + like with |expand()|, and environment variables, anywhere in + {string}. "~user" and "~/path" are only expanded at the + start. Returns the expanded string. Example: > :echo expandcmd('make %<.o') @@ -5083,8 +5089,8 @@ fullcommand({name}) *fullcommand()* Get the full command name from a short abbreviated command name; see |20.2| for details on command abbreviations. - {name} may start with a `:` and can include a [range], these - are skipped and not returned. + The string argument {name} may start with a `:` and can + include a [range], these are skipped and not returned. Returns an empty string if a command doesn't exist or if it's ambiguous (for user-defined functions). @@ -5240,7 +5246,7 @@ get({func}, {what}) myfunc->get(what) < *getbufinfo()* -getbufinfo([{expr}]) +getbufinfo([{buf}]) getbufinfo([{dict}]) Get information about buffers as a List of Dictionaries. @@ -5254,8 +5260,8 @@ getbufinfo([{dict}]) bufloaded include only loaded buffers. bufmodified include only modified buffers. - Otherwise, {expr} specifies a particular buffer to return - information for. For the use of {expr}, see |bufname()| + Otherwise, {buf} specifies a particular buffer to return + information for. For the use of {buf}, see |bufname()| above. If the buffer is found the returned List has one item. Otherwise the result is an empty list. @@ -5314,12 +5320,12 @@ getbufinfo([{dict}]) < *getbufline()* -getbufline({expr}, {lnum} [, {end}]) +getbufline({buf}, {lnum} [, {end}]) Return a |List| with the lines starting from {lnum} to {end} - (inclusive) in the buffer {expr}. If {end} is omitted, a + (inclusive) in the buffer {buf}. If {end} is omitted, a |List| with only the line {lnum} is returned. - For the use of {expr}, see |bufname()| above. + For the use of {buf}, see |bufname()| above. For {lnum} and {end} "$" can be used for the last line of the buffer. Otherwise a number must be used. @@ -5341,10 +5347,11 @@ getbufline({expr}, {lnum} [, {end}]) < Can also be used as a |method|: > GetBufnr()->getbufline(lnum) -getbufvar({expr}, {varname} [, {def}]) *getbufvar()* +getbufvar({buf}, {varname} [, {def}]) *getbufvar()* The result is the value of option or local buffer variable - {varname} in buffer {expr}. Note that the name without "b:" + {varname} in buffer {buf}. Note that the name without "b:" must be used. + The {varname} argument is a string. When {varname} is empty returns a |Dictionary| with all the buffer-local variables. When {varname} is equal to "&" returns a |Dictionary| with all @@ -5354,7 +5361,7 @@ getbufvar({expr}, {varname} [, {def}]) This also works for a global or buffer-local option, but it doesn't work for a global variable, window-local variable or window-local option. - For the use of {expr}, see |bufname()| above. + For the use of {buf}, see |bufname()| above. When the buffer or variable doesn't exist {def} or an empty string is returned, there is no error message. Examples: > @@ -5364,9 +5371,9 @@ getbufvar({expr}, {varname} [, {def}]) < Can also be used as a |method|: > GetBufnr()->getbufvar(varname) < -getchangelist([{expr}]) *getchangelist()* - Returns the |changelist| for the buffer {expr}. For the use - of {expr}, see |bufname()| above. If buffer {expr} doesn't +getchangelist([{buf}]) *getchangelist()* + Returns the |changelist| for the buffer {buf}. For the use + of {buf}, see |bufname()| above. If buffer {buf} doesn't exist, an empty list is returned. The returned list contains two entries: a list with the change @@ -5376,7 +5383,7 @@ getchangelist([{expr}]) *getchangeli col column number coladd column offset for 'virtualedit' lnum line number - If buffer {expr} is the current buffer, then the current + If buffer {buf} is the current buffer, then the current position refers to the position in the list. For other buffers, it is set to the length of the list. @@ -5481,9 +5488,9 @@ getcharmod() *getcharmod()* *getcharpos()* getcharpos({expr}) - Get the position for {expr}. Same as |getpos()| but the column - number in the returned List is a character index instead of - a byte index. + Get the position for String {expr}. Same as |getpos()| but the + column number in the returned List is a character index + instead of a byte index. If |getpos()| returns a very large column number, such as 2147483647, then getcharpos() will return the character index of the last character. @@ -5569,9 +5576,9 @@ getcmdwintype() *getcmdwintype()* when not in the command-line window. getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* - Return a list of command-line completion matches. {type} - specifies what for. The following completion types are - supported: + Return a list of command-line completion matches. The String + {type} argument specifies what for. The following completion + types are supported: arglist file names in argument list augroup autocmd groups @@ -5708,8 +5715,11 @@ getcwd([{winnr} [, {tabnr}]]) GetWinnr()->getcwd() getenv({name}) *getenv()* - Return the value of environment variable {name}. - When the variable does not exist |v:null| is returned. That + Return the value of environment variable {name}. The {name} + argument is a string, without a leading '$'. Example: > + myHome = getenv('HOME') + +< When the variable does not exist |v:null| is returned. That is different from a variable set to an empty string, although some systems interpret the empty value as the variable being deleted. See also |expr-env|. @@ -5721,8 +5731,8 @@ getfontname([{name}]) *getfontname() Without an argument returns the name of the normal font being used. Like what is used for the Normal highlight group |hl-Normal|. - With an argument a check is done whether {name} is a valid - font name. If not then an empty string is returned. + With an argument a check is done whether String {name} is a + valid font name. If not then an empty string is returned. Otherwise the actual font name is returned, or {name} if the GUI does not support obtaining the real name. Only works when the GUI is running, thus not in your vimrc or @@ -5883,12 +5893,12 @@ getloclist({nr} [, {what}]) *getlocli :echo getloclist(5, {'filewinid': 0}) -getmarklist([{expr}]) *getmarklist()* - Without the {expr} argument returns a |List| with information +getmarklist([{buf}]) *getmarklist()* + Without the {buf} argument returns a |List| with information about all the global marks. |mark| - If the optional {expr} argument is specified, returns the - local marks defined in buffer {expr}. For the use of {expr}, + If the optional {buf} argument is specified, returns the + local marks defined in buffer {buf}. For the use of {buf}, see |bufname()|. Each item in the returned List is a |Dict| with the following: @@ -5962,8 +5972,8 @@ getpid() Return a Number which is the pr exits. *getpos()* -getpos({expr}) Get the position for {expr}. For possible values of {expr} - see |line()|. For getting the cursor position see +getpos({expr}) Get the position for String {expr}. For possible values of + {expr} see |line()|. For getting the cursor position see |getcurpos()|. The result is a |List| with four numbers: [bufnum, lnum, col, off] @@ -6097,6 +6107,7 @@ getreg([{regname} [, 1 [, {list}]]]) * {regname}. Example: > :let cliptext = getreg('*') < When {regname} was not set the result is an empty string. + The {regname} argument is a string. getreg('=') returns the last evaluated value of the expression register. (For use in maps.) @@ -6136,8 +6147,8 @@ getreginfo([{regname}]) *getreginfo( which is the register that got the deleted text. - If {regname} is invalid or not set, an empty Dictionary - will be returned. + The {regname} argument is a string. If {regname} is invalid + or not set, an empty Dictionary will be returned. If {regname} is not specified, |v:register| is used. The returned Dictionary can be passed to |setreg()|. In |Vim9-script| {regname} must be one character. @@ -6153,7 +6164,8 @@ getregtype([{regname}]) *getregtype( "{width}" for |blockwise-visual| text "" for an empty or unknown register is one character with value 0x16. - If {regname} is not specified, |v:register| is used. + The {regname} argument is a string. If {regname} is not + specified, |v:register| is used. In |Vim9-script| {regname} must be one character. Can also be used as a |method|: > @@ -6179,8 +6191,8 @@ gettabvar({tabnr}, {varname} [, {def}]) Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| Tabs are numbered starting with one. - When {varname} is empty a dictionary with all tab-local - variables is returned. + The {varname} argument is a string. When {varname} is empty a + dictionary with all tab-local variables is returned. Note that the name without "t:" must be used. When the tab or variable doesn't exist {def} or an empty string is returned, there is no error message. @@ -6191,8 +6203,8 @@ gettabvar({tabnr}, {varname} [, {def}]) gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. - When {varname} is empty a dictionary with all window-local - variables is returned. + The {varname} argument is a string. When {varname} is empty a + dictionary with all window-local variables is returned. When {varname} is equal to "&" get the values of all window-local options in a |Dictionary|. Otherwise, when {varname} starts with "&" get the value of a @@ -6250,7 +6262,7 @@ gettagstack([{winnr}]) *gettagstack( gettext({text}) *gettext()* - Translate {text} if possible. + Translate String {text} if possible. This is mainly for use in the distributed Vim scripts. When generating message translations the {text} is extracted by xgettext, the translator can add the translated message in the @@ -6383,14 +6395,14 @@ glob({expr} [, {nosuf} [, {list} [, {all Can also be used as a |method|: > GetExpr()->glob() -glob2regpat({expr}) *glob2regpat()* +glob2regpat({string}) *glob2regpat()* Convert a file pattern, as used by glob(), into a search pattern. The result can be used to match with a string that is a file name. E.g. > if filename =~ glob2regpat('Make*.mak') < This is equivalent to: > if filename =~ '^Make.*\.mak$' -< When {expr} is an empty string the result is "^$", match an +< When {string} is an empty string the result is "^$", match an empty string. Note that the result depends on the system. On MS-Windows a backslash usually means a path separator. @@ -6399,8 +6411,8 @@ glob2regpat({expr}) *glob2regpat()* GetExpr()->glob2regpat() < *globpath()* globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) - Perform glob() for {expr} on all directories in {path} and - concatenate the results. Example: > + Perform glob() for String {expr} on all directories in {path} + and concatenate the results. Example: > :echo globpath(&rtp, "syntax/c.vim") < {path} is a comma-separated list of directory names. Each @@ -6467,7 +6479,8 @@ has({feature} [, {check}]) has_key({dict}, {key}) *has_key()* The result is a Number, which is TRUE if |Dictionary| {dict} - has an entry with key {key}. FALSE otherwise. + has an entry with key {key}. FALSE otherwise. The {key} + argument is a string. Can also be used as a |method|: > mydict->has_key(key) @@ -6514,6 +6527,7 @@ hasmapto({what} [, {mode} [, {abbr}]]) that contains {what} in somewhere in the rhs (what it is mapped to) and this mapping exists in one of the modes indicated by {mode}. + The arguments {what} and {mode} are strings. When {abbr} is there and it is |TRUE| use abbreviations instead of mappings. Don't forget to specify Insert and/or Command-line mode. @@ -6662,8 +6676,8 @@ hostname() *hostname()* which Vim is currently running. Machine names greater than 256 characters long are truncated. -iconv({expr}, {from}, {to}) *iconv()* - The result is a String, which is the text {expr} converted +iconv({string}, {from}, {to}) *iconv()* + The result is a String, which is the text {string} converted from encoding {from} to encoding {to}. When the conversion completely fails an empty string is returned. When some characters could not be converted they @@ -6894,8 +6908,9 @@ isinf({expr}) *isinf()* islocked({expr}) *islocked()* *E786* The result is a Number, which is |TRUE| when {expr} is the name of a locked variable. - {expr} must be the name of a variable, |List| item or - |Dictionary| entry, not the variable itself! Example: > + The string argument {expr} must be the name of a variable, + |List| item or |Dictionary| entry, not the variable itself! + Example: > :let alist = [0, ['a', 'b'], 2, 3] :lockvar 1 alist :echo islocked('alist') " 1 @@ -7128,7 +7143,8 @@ libcallnr({libname}, {funcname}, {argume line({expr} [, {winid}]) *line()* The result is a Number, which is the line number of the file - position given with {expr}. The accepted positions are: + position given with {expr}. The {expr} argument is a string. + The accepted positions are: . the cursor position $ the last line in the current buffer 'x position of mark x (if the mark is not set, 0 is @@ -8106,8 +8122,8 @@ or({expr}, {expr}) *or()* :let bits = bits->or(0x80) -pathshorten({expr} [, {len}]) *pathshorten()* - Shorten directory names in the path {expr} and return the +pathshorten({path} [, {len}]) *pathshorten()* + Shorten directory names in the path {path} and return the result. The tail, the file name, is kept as-is. The other components in the path are reduced to {len} letters in length. If {len} is omitted or smaller than 1 then 1 is used (single @@ -8829,6 +8845,7 @@ remote_expr({server}, {string} [, {idvar remote_foreground({server}) *remote_foreground()* Move the Vim server with the name {server} to the foreground. + The {server} argument is a string. This works like: > remote_expr({server}, "foreground()") < Except that on Win32 systems the client does the work, to work @@ -9512,8 +9529,8 @@ serverlist() *serverlist()* Example: > :echo serverlist() < -setbufline({expr}, {lnum}, {text}) *setbufline()* - Set line {lnum} to {text} in buffer {expr}. This works like +setbufline({buf}, {lnum}, {text}) *setbufline()* + Set line {lnum} to {text} in buffer {buf}. This works like |setline()| for the specified buffer. This function works only for loaded buffers. First call @@ -9526,13 +9543,13 @@ setbufline({expr}, {lnum}, {text}) *se to set multiple lines. If the list extends below the last line then those lines are added. - For the use of {expr}, see |bufname()| above. + For the use of {buf}, see |bufname()| above. {lnum} is used like with |setline()|. When {lnum} is just below the last line the {text} will be added below the last line. - When {expr} is not a valid buffer, the buffer is not loaded or + When {buf} is not a valid buffer, the buffer is not loaded or {lnum} is not valid then 1 is returned. On success 0 is returned. @@ -9540,13 +9557,14 @@ setbufline({expr}, {lnum}, {text}) *se third argument: > GetText()->setbufline(buf, lnum) -setbufvar({expr}, {varname}, {val}) *setbufvar()* - Set option or local variable {varname} in buffer {expr} to +setbufvar({buf}, {varname}, {val}) *setbufvar()* + Set option or local variable {varname} in buffer {buf} to {val}. This also works for a global or local window option, but it doesn't work for a global or local window variable. For a local window option the global value is unchanged. - For the use of {expr}, see |bufname()| above. + For the use of {buf}, see |bufname()| above. + The {varname} argument is a string. Note that the variable name without "b:" must be used. Examples: > :call setbufvar(1, "&mod", 1) @@ -9653,8 +9671,10 @@ setcursorcharpos({list}) setenv({name}, {val}) *setenv()* - Set environment variable {name} to {val}. - When {val} is |v:null| the environment variable is deleted. + Set environment variable {name} to {val}. Example: > + call setenv('HOME', '/home/myhome') + +< When {val} is |v:null| the environment variable is deleted. See also |expr-env|. Can also be used as a |method|, the base is passed as the @@ -9746,7 +9766,7 @@ setmatches({list} [, {win}]) *setmatc < *setpos()* setpos({expr}, {list}) - Set the position for {expr}. Possible values: + Set the position for String {expr}. Possible values: . the cursor 'x mark x @@ -9914,7 +9934,8 @@ setqflist({list} [, {action} [, {what}]] setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. If {regname} is "" or "@", the unnamed register '"' is used. - In |Vim9-script| {regname} must be one character. + The {regname} argument is a string. In |Vim9-script| + {regname} must be one character. {value} may be any value returned by |getreg()| or |getreginfo()|, including a |List| or |Dict|. @@ -9972,6 +9993,7 @@ setreg({regname}, {value} [, {options}]) settabvar({tabnr}, {varname}, {val}) *settabvar()* Set tab-local variable {varname} to {val} in tab page {tabnr}. |t:var| + The {varname} argument is a string. Note that autocommands are blocked, side effects may not be triggered, e.g. when setting 'filetype'. Note that the variable name without "t:" must be used. @@ -10244,12 +10266,14 @@ sort({list} [, {func} [, {dict}]]) *so func MyCompare(i1, i2) return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1 endfunc - let sortedlist = sort(mylist, "MyCompare") + eval mylist->sort("MyCompare") < A shorter compare version for this specific simple case, which ignores overflow: > func MyCompare(i1, i2) return a:i1 - a:i2 endfunc +< For a simple expression you can use a lambda: > + eval mylist->sort({i1, i2 -> i1 - i2}) < sound_clear() *sound_clear()* Stop playing all sounds. @@ -10378,8 +10402,8 @@ spellsuggest({word} [, {max} [, {capital Can also be used as a |method|: > GetWord()->spellsuggest() -split({expr} [, {pattern} [, {keepempty}]]) *split()* - Make a |List| out of {expr}. When {pattern} is omitted or +split({string} [, {pattern} [, {keepempty}]]) *split()* + Make a |List| out of {string}. When {pattern} is omitted or empty each white-separated sequence of characters becomes an item. Otherwise the string is split where {pattern} matches, @@ -10472,13 +10496,16 @@ state([{what}]) *state()* recursiveness up to "ccc") s screen has scrolled for messages -str2float({expr}) *str2float()* - Convert String {expr} to a Float. This mostly works the same - as when using a floating point number in an expression, see - |floating-point-format|. But it's a bit more permissive. +str2float({string} [, {quoted}]) *str2float()* + Convert String {string} to a Float. This mostly works the + same as when using a floating point number in an expression, + see |floating-point-format|. But it's a bit more permissive. E.g., "1e40" is accepted, while in an expression you need to write "1.0e40". The hexadecimal form "0x123" is also accepted, but not others, like binary or octal. + When {quoted} is present and non-zero then embedded single + quotes before the dot are ignored, thus "1'000.0" is a + thousand. Text after the number is silently ignored. The decimal point is always '.', no matter what the locale is set to. A comma ends the number: "12,345.67" is converted to @@ -10491,9 +10518,9 @@ str2float({expr}) *str2float()* < {only available when compiled with the |+float| feature} -str2list({expr} [, {utf8}]) *str2list()* +str2list({string} [, {utf8}]) *str2list()* Return a list containing the number values which represent - each character in String {expr}. Examples: > + each character in String {string}. Examples: > str2list(" ") returns [32] str2list("ABC") returns [65, 66, 67] < |list2str()| does the opposite. @@ -10508,8 +10535,8 @@ str2list({expr} [, {utf8}]) *str2list GetString()->str2list() -str2nr({expr} [, {base} [, {quoted}]]) *str2nr()* - Convert string {expr} to a number. +str2nr({string} [, {base} [, {quoted}]]) *str2nr()* + Convert string {string} to a number. {base} is the conversion base, it can be 2, 8, 10 or 16. When {quoted} is present and non-zero then embedded single quotes are ignored, thus "1'000'000" is a million. @@ -10529,9 +10556,9 @@ str2nr({expr} [, {base} [, {quoted}]]) GetText()->str2nr() -strcharlen({expr}) *strcharlen()* +strcharlen({string}) *strcharlen()* The result is a Number, which is the number of characters - in String {expr}. Composing characters are ignored. + in String {string}. Composing characters are ignored. |strchars()| can count the number of characters, counting composing characters separately. @@ -10558,9 +10585,9 @@ strcharpart({src}, {start} [, {len} [, { GetText()->strcharpart(5) -strchars({expr} [, {skipcc}]) *strchars()* +strchars({string} [, {skipcc}]) *strchars()* The result is a Number, which is the number of characters - in String {expr}. + in String {string}. When {skipcc} is omitted or zero, composing characters are counted separately. When {skipcc} set to 1, Composing characters are ignored. @@ -10587,16 +10614,16 @@ strchars({expr} [, {skipcc}]) *strch Can also be used as a |method|: > GetText()->strchars() -strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* +strdisplaywidth({string} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells - String {expr} occupies on the screen when it starts at {col} + String {string} occupies on the screen when it starts at {col} (first column is zero). When {col} is omitted zero is used. Otherwise it is the screen column where to start. This matters for Tab characters. The option settings of the current window are used. This matters for anything that's displayed differently, such as 'tabstop' and 'display'. - When {expr} contains characters with East Asian Width Class + When {string} contains characters with East Asian Width Class Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strwidth()| and |strchars()|. @@ -10678,9 +10705,10 @@ string({expr}) Return {expr} converted t < Also see |strtrans()|. - *strlen()* -strlen({expr}) The result is a Number, which is the length of the String - {expr} in bytes. + +strlen({string}) *strlen()* + The result is a Number, which is the length of the String + {string} in bytes. If the argument is a Number it is first converted to a String. For other types an error is given. If you want to count the number of multibyte characters use @@ -10765,8 +10793,8 @@ strridx({haystack}, {needle} [, {start}] Can also be used as a |method|: > GetHaystack()->strridx(needle) -strtrans({expr}) *strtrans()* - The result is a String, which is {expr} with all unprintable +strtrans({string}) *strtrans()* + The result is a String, which is {string} with all unprintable characters translated into printable characters |'isprint'|. Like they are shown in a window. Example: > echo strtrans(@a) @@ -10776,11 +10804,11 @@ strtrans({expr}) *strtrans()* Can also be used as a |method|: > GetString()->strtrans() -strwidth({expr}) *strwidth()* +strwidth({string}) *strwidth()* The result is a Number, which is the number of display cells - String {expr} occupies. A Tab character is counted as one + String {string} occupies. A Tab character is counted as one cell, alternatively use |strdisplaywidth()|. - When {expr} contains characters with East Asian Width Class + When {string} contains characters with East Asian Width Class Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strdisplaywidth()| and |strchars()|. @@ -10816,10 +10844,10 @@ submatch({nr} [, {list}]) *submatch()* Can also be used as a |method|: > GetNr()->submatch() -substitute({expr}, {pat}, {sub}, {flags}) *substitute()* - The result is a String, which is a copy of {expr}, in which +substitute({string}, {pat}, {sub}, {flags}) *substitute()* + The result is a String, which is a copy of {string}, in which the first match of {pat} is replaced with {sub}. - When {flags} is "g", all matches of {pat} in {expr} are + When {flags} is "g", all matches of {pat} in {string} are replaced. Otherwise {flags} should be "". This works like the ":substitute" command (without any flags). @@ -10835,7 +10863,7 @@ substitute({expr}, {pat}, {sub}, {flags} |sub-replace-special|. For example, to replace something with "\n" (two characters), use "\\\\n" or '\\n'. - When {pat} does not match in {expr}, {expr} is returned + When {pat} does not match in {string}, {string} is returned unmodified. Example: > @@ -10882,12 +10910,12 @@ swapinfo({fname}) *swapinfo()* Can also be used as a |method|: > GetFilename()->swapinfo() -swapname({expr}) *swapname()* +swapname({buf}) *swapname()* The result is the swap file path of the buffer {expr}. - For the use of {expr}, see |bufname()| above. - If buffer {expr} is the current buffer, the result is equal to + For the use of {buf}, see |bufname()| above. + If buffer {buf} is the current buffer, the result is equal to |:swapname| (unless there is no swap file). - If buffer {expr} has no swap file, returns an empty string. + If buffer {buf} has no swap file, returns an empty string. Can also be used as a |method|: > GetBufname()->swapname() diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,4 +1,4 @@ -*if_lua.txt* For Vim version 8.2. Last change: 2021 Apr 07 +*if_lua.txt* For Vim version 8.2. Last change: 2021 Aug 06 VIM REFERENCE MANUAL by Luis Carvalho diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.2. Last change: 2021 Jul 05 +*insert.txt* For Vim version 8.2. Last change: 2021 Jul 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1194,7 +1194,7 @@ match to the total list. These matches list! Call |complete_check()| now and then to allow the user to press a key while still searching for matches. Stop searching when it returns non-zero. - *E839* *E840* + *E840* The function is allowed to move the cursor, it is restored afterwards. The function is not allowed to move to another window or delete text. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2021 Aug 01 +*map.txt* For Vim version 8.2. Last change: 2021 Aug 05 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 8.2. Last change: 2020 Dec 29 +*message.txt* For Vim version 8.2. Last change: 2021 Jul 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -774,6 +774,14 @@ a user-defined command. This can only happen when changing the source code, when adding a command in src/ex_cmds.h. The lookup table then needs to be updated, by running: > make cmdidxs +< + *E928* *E889* *E839* > + E928: String required + E889: Number required + E839: Bool required + +These happen when a value or expression is used that does not have the +expected type. ============================================================================== 3. Messages *messages* diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -1,4 +1,4 @@ -*popup.txt* For Vim version 8.2. Last change: 2021 Feb 21 +*popup.txt* For Vim version 8.2. Last change: 2021 Aug 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -904,6 +904,8 @@ Some recommended key actions: cursor keys select another entry Tab accept current suggestion +When CTRL-C is pressed the popup is closed, the filter will not be invoked. + A mouse click arrives as . The coordinates can be obtained with |getmousepos()|. diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -451,13 +451,13 @@ sign_getdefined([{name}]) *sign_getde Can also be used as a |method|: > GetSignList()->sign_getdefined() -sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* +sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()* Return a list of signs placed in a buffer or all the buffers. This is similar to the |:sign-place-list| command. - If the optional buffer name {expr} is specified, then only the + If the optional buffer name {buf} is specified, then only the list of signs placed in that buffer is returned. For the use - of {expr}, see |bufname()|. The optional {dict} can contain + of {buf}, see |bufname()|. The optional {dict} can contain the following entries: group select only signs in this group id select sign with this identifier @@ -515,12 +515,12 @@ sign_getplaced([{expr} [, {dict}]]) *s GetBufname()->sign_getplaced() < *sign_jump()* -sign_jump({id}, {group}, {expr}) - Open the buffer {expr} or jump to the window that contains - {expr} and position the cursor at sign {id} in group {group}. +sign_jump({id}, {group}, {buf}) + Open the buffer {buf} or jump to the window that contains + {buf} and position the cursor at sign {id} in group {group}. This is similar to the |:sign-jump| command. - For the use of {expr}, see |bufname()|. + For the use of {buf}, see |bufname()|. Returns the line number of the sign. Returns -1 if the arguments are invalid. @@ -533,9 +533,9 @@ sign_jump({id}, {group}, {expr}) GetSignid()->sign_jump() < *sign_place()* -sign_place({id}, {group}, {name}, {expr} [, {dict}]) +sign_place({id}, {group}, {name}, {buf} [, {dict}]) Place the sign defined as {name} at line {lnum} in file or - buffer {expr} and assign {id} and {group} to sign. This is + buffer {buf} and assign {id} and {group} to sign. This is similar to the |:sign-place| command. If the sign identifier {id} is zero, then a new identifier is @@ -546,12 +546,12 @@ sign_place({id}, {group}, {name}, {expr} and |sign-group| for more information. {name} refers to a defined sign. - {expr} refers to a buffer name or number. For the accepted + {buf} refers to a buffer name or number. For the accepted values, see |bufname()|. The optional {dict} argument supports the following entries: lnum line number in the file or buffer - {expr} where the sign is to be placed. + {buf} where the sign is to be placed. For the accepted values, see |line()|. priority priority of the sign. See |sign-priority| for more information. diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2307,6 +2307,7 @@ 90.5 usr_90.txt /*90.5* :command-nargs map.txt /*:command-nargs* :command-range map.txt /*:command-range* :command-register map.txt /*:command-register* +:command-repl map.txt /*:command-repl* :command-verbose map.txt /*:command-verbose* :comment cmdline.txt /*:comment* :comp quickfix.txt /*:comp* @@ -3983,6 +3984,9 @@ E121 eval.txt /*E121* E1214 eval.txt /*E1214* E122 eval.txt /*E122* E123 eval.txt /*E123* +E1231 map.txt /*E1231* +E1232 eval.txt /*E1232* +E1233 eval.txt /*E1233* E124 eval.txt /*E124* E125 eval.txt /*E125* E126 eval.txt /*E126* @@ -4740,7 +4744,7 @@ E835 options.txt /*E835* E836 if_pyth.txt /*E836* E837 if_pyth.txt /*E837* E838 netbeans.txt /*E838* -E839 insert.txt /*E839* +E839 message.txt /*E839* E84 windows.txt /*E84* E840 insert.txt /*E840* E841 map.txt /*E841* @@ -4793,6 +4797,7 @@ E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* E888 pattern.txt /*E888* +E889 message.txt /*E889* E89 message.txt /*E89* E890 syntax.txt /*E890* E891 eval.txt /*E891* @@ -4835,7 +4840,7 @@ E924 quickfix.txt /*E924* E925 quickfix.txt /*E925* E926 quickfix.txt /*E926* E927 eval.txt /*E927* -E928 eval.txt /*E928* +E928 message.txt /*E928* E929 starting.txt /*E929* E93 windows.txt /*E93* E930 eval.txt /*E930* @@ -5165,6 +5170,10 @@ TabNew autocmd.txt /*TabNew* Tcl if_tcl.txt /*Tcl* TermChanged autocmd.txt /*TermChanged* TermResponse autocmd.txt /*TermResponse* +TermdebugStartPost terminal.txt /*TermdebugStartPost* +TermdebugStartPre terminal.txt /*TermdebugStartPre* +TermdebugStopPost terminal.txt /*TermdebugStopPost* +TermdebugStopPre terminal.txt /*TermdebugStopPre* Terminal-Job terminal.txt /*Terminal-Job* Terminal-Normal terminal.txt /*Terminal-Normal* Terminal-mode terminal.txt /*Terminal-mode* @@ -6312,6 +6321,7 @@ execute-menus gui.txt /*execute-menus* exepath() eval.txt /*exepath()* exim starting.txt /*exim* exists() eval.txt /*exists()* +exists_compiled() eval.txt /*exists_compiled()* exiting starting.txt /*exiting* exiting-variable eval.txt /*exiting-variable* exp() eval.txt /*exp()* @@ -6942,6 +6952,7 @@ g:tar_nomax pi_tar.txt /*g:tar_nomax* g:tar_readoptions pi_tar.txt /*g:tar_readoptions* g:tar_secure pi_tar.txt /*g:tar_secure* g:tar_writeoptions pi_tar.txt /*g:tar_writeoptions* +g:termdebugger terminal.txt /*g:termdebugger* g:terminal_ansi_colors terminal.txt /*g:terminal_ansi_colors* g:tex_comment_nospell syntax.txt /*g:tex_comment_nospell* g:tex_conceal syntax.txt /*g:tex_conceal* @@ -7770,6 +7781,7 @@ lua-funcref if_lua.txt /*lua-funcref* lua-list if_lua.txt /*lua-list* lua-luaeval if_lua.txt /*lua-luaeval* lua-vim if_lua.txt /*lua-vim* +lua-vim-variables if_lua.txt /*lua-vim-variables* lua-window if_lua.txt /*lua-window* lua.vim syntax.txt /*lua.vim* luaeval() eval.txt /*luaeval()* @@ -9646,6 +9658,7 @@ termcap-title term.txt /*termcap-title* termdebug-commands terminal.txt /*termdebug-commands* termdebug-communication terminal.txt /*termdebug-communication* termdebug-customizing terminal.txt /*termdebug-customizing* +termdebug-events terminal.txt /*termdebug-events* termdebug-example terminal.txt /*termdebug-example* termdebug-prompt terminal.txt /*termdebug-prompt* termdebug-starting terminal.txt /*termdebug-starting* @@ -10176,7 +10189,12 @@ vim-raku ft_raku.txt /*vim-raku* vim-script-intro usr_41.txt /*vim-script-intro* vim-use intro.txt /*vim-use* vim-variable eval.txt /*vim-variable* +vim.b if_lua.txt /*vim.b* +vim.g if_lua.txt /*vim.g* +vim.t if_lua.txt /*vim.t* +vim.v if_lua.txt /*vim.v* vim.vim syntax.txt /*vim.vim* +vim.w if_lua.txt /*vim.w* vim7 version7.txt /*vim7* vim8 version8.txt /*vim8* vim9 vim9.txt /*vim9* @@ -10189,6 +10207,7 @@ vim9-declarations usr_46.txt /*vim9-decl vim9-differences vim9.txt /*vim9-differences* vim9-export vim9.txt /*vim9-export* vim9-final vim9.txt /*vim9-final* +vim9-function-defined-later vim9.txt /*vim9-function-defined-later* vim9-gotchas vim9.txt /*vim9-gotchas* vim9-ignored-argument vim9.txt /*vim9-ignored-argument* vim9-import vim9.txt /*vim9-import* diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 8.2. Last change: 2021 Feb 13 +*terminal.txt* For Vim version 8.2. Last change: 2021 Aug 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1352,6 +1352,33 @@ Other commands ~ *:Asm* jump to the window with the disassembly, create it if there isn't one +Events ~ + *termdebug-events* +Four autocommands can be used: > + au User TermdebugStartPre echomsg 'debugging starting' + au User TermdebugStartPost echomsg 'debugging started' + au User TermdebugStopPre echomsg 'debugging stopping' + au User TermdebugStopPost echomsg 'debugging stopped' +< + *TermdebugStartPre* +TermdebugStartPre Before starting debugging. + Not triggered if the debugger is already + running or |g:termdebugger| cannot be + executed. + *TermdebugStartPost* +TermdebugStartPost After debugging has initialized. + If a "!" bang is passed to `:Termdebug` or + `:TermdebugCommand` the event is triggered + before running the provided command in gdb. + *TermdebugStopPre* +TermdebugStopPre Before debugging ends, when gdb is terminated, + most likely after issuing a "quit" command in + the gdb window. + *TermdebugStopPost* +TermdebugStopPost After debugging has ended, gdb-related windows + are closed, debug buffers wiped out and + the state before the debugging was restored. + Prompt mode ~ *termdebug-prompt* @@ -1396,11 +1423,11 @@ communication channel. Customizing ~ -GDB command *termdebug-customizing* - -To change the name of the gdb command, set the "termdebugger" variable before +GDB command *termdebug-customizing* + *g:termdebugger* +To change the name of the gdb command, set the "g:termdebugger" variable before invoking `:Termdebug`: > - let termdebugger = "mygdb" + let g:termdebugger = "mygdb" < *gdb-version* Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI interface. The "new-ui" command requires gdb version 7.12 or later. if you diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -446,7 +446,7 @@ assert_notmatch({pattern}, {actual} [, { assert_report({msg}) *assert_report()* - Report a test failure directly, using {msg}. + Report a test failure directly, using String {msg}. Always returns one. Can also be used as a |method|: > diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Jul 26 +*todo.txt* For Vim version 8.2. Last change: 2021 Aug 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,14 +38,9 @@ browser use: https://github.com/vim/vim/ *known-bugs* -------------------- Known bugs and current work ----------------------- -Try out callgrind with kcachegrind. - Vim9 - Make everything work: +- use CheckLegacyAndVim9Success(lines) in many more places - Check TODO items in vim9compile.c and vim9execute.c -- use CheckLegacyAndVim9Success(lines) in many more places - This doesn't work - Test_list_assign(): - var l = [0] - l[:] = [1, 2] - For builtin functions using tv_get_string*() use check_for_string() to be more strict about the argument type (not a bool). done: balloon_() @@ -60,6 +55,7 @@ Vim9 - Make everything work: defined. - Unexpected error message when using "var x: any | x.key = 9", because "x" is given the type number. Can we use VAR_ANY? +- Check performance with callgrind and kcachegrind. Once Vim9 is stable: - Add the "vim9script" feature, can use has('vim9script') @@ -75,6 +71,8 @@ Further Vim9 improvements, possibly afte 'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert', 'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'. Give an error if compilation fails. (#7625) + Alternatively: Detect a compiled function call and skip the expression + evaluation. Use the location where the option was set for deciding whether it's to be evaluated in Vim9 script context. - implement :type, "import type" @@ -235,7 +233,6 @@ Valgrind reports overlapping memcpy in test_normal test_popupwin.35 et al. test_search_stat -Using uninitialized value in test_crypt (can't explain why). Memory leak in test_debugger Memory leak in test_paste, using XtOpenDisplay several times OLD: @@ -291,8 +288,6 @@ Scroll doesn't work correctly, why? glob() and globfile() do not always honor 'wildignorecase'. #8350 globpath() does not use 'wildignorecase' at all? -":find" incorrectly searches parent directory of path (#8533) - Add 'termguiattr' option, use "gui=" attributes in the terminal? Would work with 'termguicolors'. #1740 @@ -305,9 +300,6 @@ Missing filetype test for bashrc, PKGBUI Add an option to not fetch terminal codes in xterm, to avoid flicker when t_Co changes. -MS-Windows: instead of "edit with multiple Vims" use "Edit with Vim in -multiple tabs". #8404 - When using ":bwipe!" also get rid of references to be buffer, e.g. in the jumplist and alternate file. @@ -724,9 +716,6 @@ tab page. (Ingo Karkat, #4324) This modeline throws unexpected errors: (#4165) vim: syn=nosyntax -":doau SomeEvent" gives "No matching autocommands". This message doesn't give -a hint about how to fix it. (#4300) - Make balloon_show() work outside of 'balloonexpr'? Users expect it to work: #2948. (related to #1512?) Also see #2352, want better control over balloon, perhaps set the position. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.2. Last change: 2021 Jul 19 +*usr_41.txt* For Vim version 8.2. Last change: 2021 Aug 08 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 8.2. Last change: 2021 Jul 28 +*vim9.txt* For Vim version 8.2. Last change: 2021 Aug 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -324,19 +324,19 @@ used: > This is especially useful in a user command: > command -range Rename { - | var save = @a - | @a = 'some expression' - | echo 'do something with ' .. @a - | @a = save - |} + var save = @a + @a = 'some expression' + echo 'do something with ' .. @a + @a = save + } And with autocommands: > au BufWritePre *.go { - | var save = winsaveview() - | silent! exe ':%! some formatting command' - | winrestview(save) - |} + var save = winsaveview() + silent! exe ':%! some formatting command' + winrestview(save) + } Although using a :def function probably works better. @@ -351,8 +351,8 @@ with `:unlet`. `:lockvar` does not work on local variables. Use `:const` and `:final` instead. -The `exists()` function does not work on local variables or arguments. These -are visible at compile time only, not at runtime. +The `exists()` and `exists_compiled()` functions do not work on local variables +or arguments. Variables, functions and function arguments cannot shadow previously defined or imported variables and functions in the same script file. @@ -373,6 +373,32 @@ called without "g:". > echo GlobalFunc() The "g:" prefix is not needed for auto-load functions. + *vim9-function-defined-later* +Although global functions can be called without the "g:" prefix, they must +exist when compiled. By adding the "g:" prefix the function can be defined +later. Example: > + def CallPluginFunc() + if exists('g:loaded_plugin') + g:PluginFunc() + endif + enddef + +If you would do it like this you get an error at compile time that +"PluginFunc" does not exist, even when "g:loaded_plugin" does not exist: > + def CallPluginFunc() + if exists('g:loaded_plugin') + PluginFunc() # Error - function not found + endif + enddef + +You can use exists_compiled() to avoid the error, but then the function would +not be called, even when "g:loaded_plugin" is defined later: > + def CallPluginFunc() + if exists_compiled('g:loaded_plugin') + PluginFunc() # Function may never be called + endif + enddef + Since `&opt = value` is now assigning a value to option "opt", ":&" cannot be used to repeat a `:substitute` command. *vim9-unpack-ignore* @@ -940,7 +966,8 @@ evaluates to false: > use-feature endif enddef -< *vim9-user-command* +The `exists_compiled()` function can also be used for this. + *vim9-user-command* Another side effect of compiling a function is that the presence of a user command is checked at compile time. If the user command is defined later an error will result. This works: > @@ -1407,8 +1434,7 @@ The script name after `import` can be: - A path not being relative or absolute. This will be found in the "import" subdirectories of 'runtimepath' entries. The name will usually be longer and unique, to avoid loading the wrong file. - Note that "after/import" is not used, unless it is explicitly added in - 'runtimepath'. + Note that "after/import" is not used. Once a vim9 script file has been imported, the result is cached and used the next time the same script is imported. It will not be read again. diff --git a/runtime/ftplugin/chicken.vim b/runtime/ftplugin/chicken.vim --- a/runtime/ftplugin/chicken.vim +++ b/runtime/ftplugin/chicken.vim @@ -2,6 +2,7 @@ " Last Change: 2018-03-05 " Author: Evan Hanson " Maintainer: Evan Hanson +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/ftplugin/chicken.vim " Notes: These are supplemental settings, to be loaded after the core " Scheme ftplugin file (ftplugin/scheme.vim). Enable it by setting diff --git a/runtime/ftplugin/julia.vim b/runtime/ftplugin/julia.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/julia.vim @@ -0,0 +1,92 @@ +" Vim filetype plugin file +" Language: Julia +" Maintainer: Carlo Baldassi +" Homepage: https://github.com/JuliaEditorSupport/julia-vim +" Last Change: 2021 Aug 04 +" adapted from upstream 2021 Aug 4 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo-=C + +setlocal include=^\\s*\\%(reload\\\|include\\)\\> +setlocal suffixesadd=.jl +setlocal comments=:# +setlocal commentstring=#\ %s +setlocal cinoptions+=#1 +setlocal define=^\\s*macro\\> +setlocal fo-=t fo+=croql + +let b:julia_vim_loaded = 1 + +let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" + \ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< completefunc<" + \ . " | unlet! b:julia_vim_loaded" + +" MatchIt plugin support +if exists("loaded_matchit") + let b:match_ignorecase = 0 + + " note: begin_keywords must contain all blocks, in order + " for nested-structures-skipping to work properly + " note: 'mutable struct' and 'struct' are defined separately because + " using \? puts the cursor on 'struct' instead of 'mutable' for some reason + let b:julia_begin_keywords = '\%(\.\s*\|@\)\@' + " note: the following regex not only recognizes macros, but also local/global keywords. + " the purpose is recognizing things like `@inline myfunction()` + " or `global myfunction(...)` etc, for matchit and block movement functionality + let s:macro_regex = '\%(@\%([#(]\@!\S\)\+\|\<\%(local\|global\)\)\s\+' + let s:nomacro = '\%(' . s:macro_regex . '\)\@' + + " note: this function relies heavily on the syntax file + function! JuliaGetMatchWords() + let [l,c] = [line('.'),col('.')] + let attr = synIDattr(synID(l, c, 1),"name") + let c1 = c + while attr == 'juliaMacro' || expand('') =~# '\<\%(global\|local\)\>' + normal! W + if line('.') > l || col('.') == c1 + call cursor(l, c) + return '' + endif + let attr = synIDattr(synID(l, col('.'), 1),"name") + let c1 = col('.') + endwhile + call cursor(l, c) + if attr == 'juliaConditional' + return b:julia_begin_keywordsm . ':\<\%(elseif\|else\)\>:' . b:julia_end_keywords + elseif attr =~# '\<\%(juliaRepeat\|juliaRepKeyword\)\>' + return b:julia_begin_keywordsm . ':\<\%(break\|continue\)\>:' . b:julia_end_keywords + elseif attr == 'juliaBlKeyword' + return b:julia_begin_keywordsm . ':' . b:julia_end_keywords + elseif attr == 'juliaException' + return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords + endif + return '\<\>:\<\>' + endfunction + + let b:match_words = 'JuliaGetMatchWords()' + + " we need to skip everything within comments, strings and + " the 'begin' and 'end' keywords when they are used as a range rather than as + " the delimiter of a block + let b:match_skip = 'synIDattr(synID(line("."),col("."),0),"name") =~# ' + \ . '"\\"' + + let b:undo_ftplugin = b:undo_ftplugin + \ . " | unlet! b:match_words b:match_skip b:match_ignorecase" + \ . " | unlet! b:julia_begin_keywords b:julia_end_keywords" + \ . " | delfunction JuliaGetMatchWords" + +endif + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/scdoc.vim b/runtime/ftplugin/scdoc.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/scdoc.vim @@ -0,0 +1,26 @@ +" scdoc filetype plugin +" Maintainer: Gregory Anders +" Last Updated: 2021-08-04 + +" Only do this when not done yet for this buffer +if exists('b:did_ftplugin') + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +setlocal comments=b:; +setlocal commentstring=;%s +setlocal formatoptions+=t +setlocal noexpandtab +setlocal shiftwidth=0 +setlocal softtabstop=0 +setlocal textwidth=80 + +let b:undo_ftplugin = 'setl com< cms< fo< et< sw< sts< tw<' + +if has('conceal') + setlocal conceallevel=2 + let b:undo_ftplugin .= ' cole<' +endif diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim --- a/runtime/ftplugin/scheme.vim +++ b/runtime/ftplugin/scheme.vim @@ -1,9 +1,10 @@ " Vim filetype plugin file " Language: Scheme (R7RS) -" Last Change: 2019 Nov 18 +" Last Change: 2019-11-19 " Author: Evan Hanson " Maintainer: Evan Hanson " Previous Maintainer: Sergey Khorev +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/ftplugin/scheme.vim if exists('b:did_ftplugin') @@ -48,7 +49,7 @@ let b:undo_ftplugin = b:undo_ftplugin . let b:did_scheme_ftplugin = 1 if exists('b:is_chicken') || exists('g:is_chicken') - exe 'ru! ftplugin/chicken.vim' + runtime! ftplugin/chicken.vim endif unlet b:did_scheme_ftplugin diff --git a/runtime/gvim.desktop b/runtime/gvim.desktop --- a/runtime/gvim.desktop +++ b/runtime/gvim.desktop @@ -111,12 +111,6 @@ Keywords[sr]=Текст;едитор; Keywords[tr]=Metin;düzenleyici; Keywords=Text;editor; # Translators: This is the Icon file name. Do NOT translate -Icon[de]=gvim -Icon[eo]=gvim -Icon[fr]=gvim -Icon[it]=gvim -Icon[ru]=gvim -Icon[sr]=gvim Icon=gvim Categories=Utility;TextEditor; StartupNotify=true diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim new file mode 100644 --- /dev/null +++ b/runtime/indent/julia.vim @@ -0,0 +1,491 @@ +" Vim indent file +" Language: Julia +" Maintainer: Carlo Baldassi +" Homepage: https://github.com/JuliaEditorSupport/julia-vim +" Last Change: 2016 jun 16 +" Notes: originally based on Bram Molenaar's indent file for vim + +setlocal autoindent + +setlocal indentexpr=GetJuliaIndent() +setlocal indentkeys+==end,=else,=catch,=finally,),],} +setlocal indentkeys-=0# +setlocal indentkeys-=: +setlocal indentkeys-=0{ +setlocal indentkeys-=0} +setlocal nosmartindent + +" Only define the function once. +if exists("*GetJuliaIndent") + finish +endif + +let s:skipPatternsBasic = '\' +let s:skipPatterns = '\' + +function JuliaMatch(lnum, str, regex, st, ...) + let s = a:st + let e = a:0 > 0 ? a:1 : -1 + let basic_skip = a:0 > 1 ? a:2 : 'all' + let skip = basic_skip ==# 'basic' ? s:skipPatternsBasic : s:skipPatterns + while 1 + let f = match(a:str, '\C' . a:regex, s) + if e >= 0 && f >= e + return -1 + endif + if f >= 0 + let attr = synIDattr(synID(a:lnum,f+1,1),"name") + let attrT = synIDattr(synID(a:lnum,f+1,0),"name") + if attr =~# skip || attrT =~# skip + let s = f+1 + continue + endif + endif + break + endwhile + return f +endfunction + +function GetJuliaNestingStruct(lnum, ...) + " Auxiliary function to inspect the block structure of a line + let line = getline(a:lnum) + let s = a:0 > 0 ? a:1 : 0 + let e = a:0 > 1 ? a:2 : -1 + let blocks_stack = [] + let num_closed_blocks = 0 + while 1 + let fb = JuliaMatch(a:lnum, line, '\<\%(if\|else\%(if\)\?\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@', s, e) + let fe = JuliaMatch(a:lnum, line, '\', s, e) + + if fb < 0 && fe < 0 + " No blocks found + break + end + + if fb >= 0 && (fb < fe || fe < 0) + " The first occurrence is an opening block keyword + " Note: some keywords (elseif,else,catch,finally) are both + " closing blocks and opening new ones + + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + call add(blocks_stack, 'if') + continue + endif + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + if len(blocks_stack) > 0 && blocks_stack[-1] == 'if' + let blocks_stack[-1] = 'elseif' + elseif (len(blocks_stack) > 0 && blocks_stack[-1] != 'elseif') || len(blocks_stack) == 0 + call add(blocks_stack, 'elseif') + let num_closed_blocks += 1 + endif + continue + endif + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(else\)\=if\>' + let blocks_stack[-1] = 'else' + else + call add(blocks_stack, 'else') + let num_closed_blocks += 1 + endif + continue + endif + + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + call add(blocks_stack, 'try') + continue + endif + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + if len(blocks_stack) > 0 && blocks_stack[-1] == 'try' + let blocks_stack[-1] = 'catch' + else + call add(blocks_stack, 'catch') + let num_closed_blocks += 1 + endif + continue + endif + let i = JuliaMatch(a:lnum, line, '\', s) + if i >= 0 && i == fb + let s = i+1 + if len(blocks_stack) > 0 && (blocks_stack[-1] == 'try' || blocks_stack[-1] == 'catch') + let blocks_stack[-1] = 'finally' + else + call add(blocks_stack, 'finally') + let num_closed_blocks += 1 + endif + continue + endif + + let i = JuliaMatch(a:lnum, line, '\<\%(bare\)\?module\>', s) + if i >= 0 && i == fb + let s = i+1 + if i == 0 + call add(blocks_stack, 'col1module') + else + call add(blocks_stack, 'other') + endif + continue + endif + + let i = JuliaMatch(a:lnum, line, '\<\%(while\|for\|function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\|let\|quote\|do\)\>', s) + if i >= 0 && i == fb + if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1 + let s = i+11 + else + let s = i+1 + endif + call add(blocks_stack, 'other') + continue + endif + + " Note: it should be impossible to get here + break + + else + " The first occurrence is an 'end' + + let s = fe+1 + if len(blocks_stack) == 0 + let num_closed_blocks += 1 + else + call remove(blocks_stack, -1) + endif + continue + + endif + + " Note: it should be impossible to get here + break + endwhile + let num_open_blocks = len(blocks_stack) - count(blocks_stack, 'col1module') + return [num_open_blocks, num_closed_blocks] +endfunction + +function GetJuliaNestingBrackets(lnum, c) + " Auxiliary function to inspect the brackets structure of a line + let line = getline(a:lnum)[0 : (a:c - 1)] + let s = 0 + let brackets_stack = [] + let last_closed_bracket = -1 + while 1 + let fb = JuliaMatch(a:lnum, line, '[([{]', s) + let fe = JuliaMatch(a:lnum, line, '[])}]', s) + + if fb < 0 && fe < 0 + " No brackets found + break + end + + if fb >= 0 && (fb < fe || fe < 0) + " The first occurrence is an opening bracket + + let i = JuliaMatch(a:lnum, line, '(', s) + if i >= 0 && i == fb + let s = i+1 + call add(brackets_stack, ['par',i]) + continue + endif + + let i = JuliaMatch(a:lnum, line, '\[', s) + if i >= 0 && i == fb + let s = i+1 + call add(brackets_stack, ['sqbra',i]) + continue + endif + + let i = JuliaMatch(a:lnum, line, '{', s) + if i >= 0 && i == fb + let s = i+1 + call add(brackets_stack, ['curbra',i]) + continue + endif + + " Note: it should be impossible to get here + break + + else + " The first occurrence is a closing bracket + + let i = JuliaMatch(a:lnum, line, ')', s) + if i >= 0 && i == fe + let s = i+1 + if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'par' + call remove(brackets_stack, -1) + else + let last_closed_bracket = i + 1 + endif + continue + endif + + let i = JuliaMatch(a:lnum, line, ']', s) + if i >= 0 && i == fe + let s = i+1 + if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'sqbra' + call remove(brackets_stack, -1) + else + let last_closed_bracket = i + 1 + endif + continue + endif + + let i = JuliaMatch(a:lnum, line, '}', s) + if i >= 0 && i == fe + let s = i+1 + if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'curbra' + call remove(brackets_stack, -1) + else + let last_closed_bracket = i + 1 + endif + continue + endif + + " Note: it should be impossible to get here + break + + endif + + " Note: it should be impossible to get here + break + endwhile + let first_open_bracket = -1 + let last_open_bracket = -1 + let infuncargs = 0 + if len(brackets_stack) > 0 + let first_open_bracket = brackets_stack[0][1] + let last_open_bracket = brackets_stack[-1][1] + if brackets_stack[-1][0] == 'par' && IsFunctionArgPar(a:lnum, last_open_bracket+1) + let infuncargs = 1 + endif + endif + return [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs] +endfunction + +let s:bracketBlocks = '\' + +function IsInBrackets(lnum, c) + let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")') + call filter(stack, 'v:val =~# s:bracketBlocks') + return len(stack) > 0 +endfunction + +function IsInDocString(lnum) + let stack = map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")') + call filter(stack, 'v:val =~# "\\"') + return len(stack) > 0 +endfunction + +function IsInContinuationImportLine(lnum) + let stack = map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")') + call filter(stack, 'v:val =~# "\\"') + if len(stack) == 0 + return 0 + endif + return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\)\>', indent(a:lnum)) == -1 +endfunction + +function IsFunctionArgPar(lnum, c) + if a:c == 0 + return 0 + endif + let stack = map(synstack(a:lnum, a:c-1), 'synIDattr(v:val, "name")') + return len(stack) >= 2 && stack[-2] ==# 'juliaFunctionDef' +endfunction + +function JumpToMatch(lnum, last_closed_bracket) + " we use the % command to skip back (tries to ues matchit if possible, + " otherwise resorts to vim's default, which is buggy but better than + " nothing) + call cursor(a:lnum, a:last_closed_bracket) + let percmap = maparg("%", "n") + if exists("g:loaded_matchit") && percmap =~# 'Match\%(it\|_wrapper\)' + normal % + else + normal! % + end +endfunction + +" Auxiliary function to find a line which does not start in the middle of a +" multiline bracketed expression, to be used as reference for block +" indentation. +function LastBlockIndent(lnum) + let lnum = a:lnum + let ind = 0 + while lnum > 0 + let ind = indent(lnum) + if ind == 0 + return [lnum, 0] + endif + if !IsInBrackets(lnum, 1) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return [max([lnum,1]), ind] +endfunction + +function GetJuliaIndent() + " Do not alter doctrings indentation + if IsInDocString(v:lnum) + return -1 + endif + + " Find a non-blank line above the current line. + let lnum = prevnonblank(v:lnum - 1) + + " At the start of the file use zero indent. + if lnum == 0 + return 0 + endif + + let ind = -1 + let st = -1 + let lim = -1 + + " Multiline bracketed expressions take precedence + let align_brackets = get(g:, "julia_indent_align_brackets", 1) + let align_funcargs = get(g:, "julia_indent_align_funcargs", 0) + let c = len(getline(lnum)) + 1 + while IsInBrackets(lnum, c) + let [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs] = GetJuliaNestingBrackets(lnum, c) + + " First scenario: the previous line has a hanging open bracket: + " set the indentation to match the opening bracket (plus an extra space) + " unless we're in a function arguments list or alignment is disabled, in + " which case we just add an extra indent + if last_open_bracket != -1 + if (!infuncargs && align_brackets) || (infuncargs && align_funcargs) + let st = last_open_bracket + let ind = virtcol([lnum, st + 1]) + else + let ind = indent(lnum) + shiftwidth() + endif + + " Second scenario: some multiline bracketed expression was closed in the + " previous line. But since we know we are still in a bracketed expression, + " we need to find the line where the bracket was opened + elseif last_closed_bracket != -1 + call JumpToMatch(lnum, last_closed_bracket) + if line(".") == lnum + " something wrong here, give up + let ind = indent(lnum) + else + let lnum = line(".") + let c = col(".") - 1 + if c == 0 + " uhm, give up + let ind = 0 + else + " we skipped a bracket set, keep searching for an opening bracket + let lim = c + continue + endif + endif + + " Third scenario: nothing special: keep the indentation + else + let ind = indent(lnum) + endif + + " Does the current line start with a closing bracket? Then depending on + " the situation we align it with the opening one, or we let the rest of + " the code figure it out (the case in which we're closing a function + " argument list is special-cased) + if JuliaMatch(v:lnum, getline(v:lnum), '[])}]', indent(v:lnum)) == indent(v:lnum) && ind > 0 + if !align_brackets && !align_funcargs + call JumpToMatch(v:lnum, indent(v:lnum)) + return indent(line(".")) + elseif (align_brackets && getline(v:lnum)[indent(v:lnum)] != ')') || align_funcargs + return ind - 1 + else " must be a ')' and align_brackets==1 and align_funcargs==0 + call JumpToMatch(v:lnum, indent(v:lnum)) + if IsFunctionArgPar(line("."), col(".")) + let ind = -1 + else + return ind - 1 + endif + endif + endif + + break + endwhile + + if ind == -1 + " We are not in a multiline bracketed expression. Thus we look for a + " previous line to use as a reference + let [lnum,ind] = LastBlockIndent(lnum) + let c = len(getline(lnum)) + 1 + if IsInBrackets(lnum, c) + let [first_open_bracket, last_open_bracket, last_closed_bracket, infuncargs] = GetJuliaNestingBrackets(lnum, c) + let lim = first_open_bracket + endif + end + + " Analyse the reference line + let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim) + " Increase indentation for each newly opened block in the reference line + let ind += shiftwidth() * num_open_blocks + + " Analyse the current line + let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum) + " Decrease indentation for each closed block in the current line + let ind -= shiftwidth() * num_closed_blocks + + " Additional special case: multiline import/using/export statements + + let prevline = getline(lnum) + " Are we in a multiline import/using/export statement, right below the + " opening line? + if IsInContinuationImportLine(v:lnum) && !IsInContinuationImportLine(lnum) + if get(g:, 'julia_indent_align_import', 1) + " if the opening line has a colon followed by non-comments, use it as + " reference point + let cind = JuliaMatch(lnum, prevline, ':', indent(lnum), lim) + if cind >= 0 + let nonwhiteind = JuliaMatch(lnum, prevline, '\S', cind+1, -1, 'basic') + if nonwhiteind >= 0 + " return match(prevline, '\S', cind+1) " a bit overkill... + return cind + 2 + endif + else + " if the opening line is not a naked import/using/export statement, use + " it as reference + let iind = JuliaMatch(lnum, prevline, '\', indent(lnum), lim) + if iind >= 0 + " assuming whitespace after using... so no `using(XYZ)` please! + let nonwhiteind = JuliaMatch(lnum, prevline, '\S', iind+6, -1, 'basic') + if nonwhiteind >= 0 + return match(prevline, '\S', iind+6) + endif + endif + endif + endif + let ind += shiftwidth() + + " Or did we just close a multiline import/using/export statement? + elseif !IsInContinuationImportLine(v:lnum) && IsInContinuationImportLine(lnum) + " find the starting line of the statement + let ilnum = 0 + for iln in range(lnum-1, 1, -1) + if !IsInContinuationImportLine(iln) + let ilnum = iln + break + endif + endfor + if ilnum == 0 + " something went horribly wrong, give up + let ind = indent(lnum) + endif + let ind = indent(ilnum) + endif + + return ind +endfunction diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -2,7 +2,7 @@ " Language: YAML " Maintainer: Nikolai Pavlov " Last Update: Lukas Reineke -" Last Change: 2021 Jan 19 +" Last Change: 2021 Aug 13 " Only load this indent file when no other was loaded. if exists('b:did_indent') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -2,7 +2,7 @@ " " Author: Bram Moolenaar " Copyright: Vim license applies, see ":help license" -" Last Change: 2021 May 18 +" Last Change: 2021 Aug 06 " " WORK IN PROGRESS - Only the basics work " Note: On MS-Windows you need a recent version of gdb. The one included with @@ -121,6 +121,10 @@ func s:StartDebug_internal(dict) let s:pid = 0 let s:asmwin = 0 + if exists('#User#TermdebugStartPre') + doauto User TermdebugStartPre + endif + " Uncomment this line to write logging in "debuglog". " call ch_logfile('debuglog', 'w') @@ -167,6 +171,10 @@ func s:StartDebug_internal(dict) call win_gotoid(curwinid) endif endif + + if exists('#User#TermdebugStartPost') + doauto User TermdebugStartPost + endif endfunc " Use when debugger didn't start or ended. @@ -596,7 +604,12 @@ func s:GetAsmAddr(msg) let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', '')) return addr endfunc + func s:EndTermDebug(job, status) + if exists('#User#TermdebugStopPre') + doauto User TermdebugStopPre + endif + exe 'bwipe! ' . s:commbuf unlet s:gdbwin @@ -642,10 +655,18 @@ func s:EndDebugCommon() endif endif + if exists('#User#TermdebugStopPost') + doauto User TermdebugStopPost + endif + au! TermDebug endfunc func s:EndPromptDebug(job, status) + if exists('#User#TermdebugStopPre') + doauto User TermdebugStopPre + endif + let curwinid = win_getid(winnr()) call win_gotoid(s:gdbwin) set nomodified diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim --- a/runtime/plugin/manpager.vim +++ b/runtime/plugin/manpager.vim @@ -1,6 +1,6 @@ " Vim plugin for using Vim as manpager. " Maintainer: Enno Nagel -" Last Change: 2018 Feb 04 +" Last Change: 2020 Aug 05 command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER @@ -16,7 +16,10 @@ function! s:ManPager() setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable " Emulate 'col -b' - silent keepj keepp %s/\v(.)\b\ze\1?//ge + silent! keepj keepp %s/\v(.)\b\ze\1?//ge + + " Remove ansi sequences + silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge " Remove empty lines above the header call cursor(1, 1) diff --git a/runtime/syntax/chicken.vim b/runtime/syntax/chicken.vim --- a/runtime/syntax/chicken.vim +++ b/runtime/syntax/chicken.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: Scheme (CHICKEN) -" Last Change: 2018-02-05 +" Last Change: 2021 Jul 30 " Author: Evan Hanson " Maintainer: Evan Hanson +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/syntax/chicken.vim " Notes: This is supplemental syntax, to be loaded after the core Scheme " syntax file (syntax/scheme.vim). Enable it by setting b:is_chicken=1 @@ -36,9 +37,23 @@ if len(s:c) syn region c matchgroup=schemeComment start=/#>/ end=/<#/ contains=@c endif +# SRFI 26 +syn match schemeSyntax /\(([ \t\n]*\)\@<=\(cut\|cute\)\>/ + +syn keyword schemeSyntax and-let* syn keyword schemeSyntax define-record +syn keyword schemeSyntax set!-values +syn keyword schemeSyntax fluid-let +syn keyword schemeSyntax let-optionals +syn keyword schemeSyntax let-optionals* +syn keyword schemeSyntax letrec-values +syn keyword schemeSyntax nth-value +syn keyword schemeSyntax receive syn keyword schemeLibrarySyntax declare +syn keyword schemeLibrarySyntax define-interface +syn keyword schemeLibrarySyntax functor +syn keyword schemeLibrarySyntax include-relative syn keyword schemeLibrarySyntax module syn keyword schemeLibrarySyntax reexport syn keyword schemeLibrarySyntax require-library @@ -52,10 +67,12 @@ syn keyword schemeTypeSyntax define-spec syn keyword schemeTypeSyntax define-type syn keyword schemeTypeSyntax the -syn keyword schemeExtraSyntax and-let* syn keyword schemeExtraSyntax match syn keyword schemeExtraSyntax match-lambda syn keyword schemeExtraSyntax match-lambda* +syn keyword schemeExtraSyntax match-let +syn keyword schemeExtraSyntax match-let* +syn keyword schemeExtraSyntax match-letrec syn keyword schemeSpecialSyntax define-compiler-syntax syn keyword schemeSpecialSyntax define-constant diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2020 Nov 28 +" Last Change: 2021 Aug 03 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -24,7 +24,7 @@ let s:supported = [ \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'trixie', 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'groovy', 'hirsute', 'devel' + \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'devel' \ ] let s:unsupported = [ \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', @@ -34,7 +34,7 @@ let s:unsupported = [ \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan' + \ 'disco', 'eoan', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2020 Nov 28 +" Last Change: 2021 Aug 03 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -26,7 +26,7 @@ let s:supported = [ \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'trixie', 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'groovy', 'hirsute', 'devel' + \ 'trusty', 'xenial', 'bionic', 'focal', 'hirsute', 'impish', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', @@ -36,7 +36,7 @@ let s:unsupported = [ \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan' + \ 'disco', 'eoan', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/julia.vim b/runtime/syntax/julia.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/julia.vim @@ -0,0 +1,550 @@ +" Vim syntax file +" Language: julia +" Maintainer: Carlo Baldassi +" Homepage: https://github.com/JuliaEditorSupport/julia-vim +" Last Change: 2021 Aug 04 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +if version < 704 + " this is used to disable regex syntax like `\@3<=' + " on older vim versions + function! s:d(x) + return '' + endfunction +else + function! s:d(x) + return string(a:x) + endfunction +endif + +scriptencoding utf-8 + +let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0) +let s:julia_spellcheck_docstrings = get(g:, "julia_spellcheck_docstrings", 1) +let s:julia_spellcheck_comments = get(g:, "julia_spellcheck_comments", 1) + +let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1) + +" List of characters, up to \UFF, which cannot be used in identifiers. +" (It includes operator characters; we don't consider them identifiers.) +" This is used mostly in lookbehinds with `\@<=`, e.g. when we need to check +" that that we're not in the middle of an identifier. +" It doesn't include a few characters (spaces and all closing parentheses) +" because those may or may not be valid in the lookbehind on a case-by-case +" basis. +let s:nonid_chars = '\U00-\U08' . '\U0A-\U1F' + \ . '\U21-\U28' . '\U2A-\U2F' . '\U3A-\U40' . '\U5B-\U5E' . '\U60' . '\U7B\U7C' + \ . '\U7E-\UA1' . '\UA7\UA8' . '\UAB-\UAD' . '\UAF\UB1\UB4' . '\UB6-\UB8' . '\UBB\UBF' . '\UD7\UF7' + +" The complete list +let s:nonidS_chars = '[:space:])\U5D}' . s:nonid_chars + + +" List of all valid operator chars up to \UFF (NOTE: they must all be included +" in s:nonidS_chars, so that if we include that, then this is redundant) +" It does not include '!' since it can be used in an identifier. +" The list contains the following characters: '%&*+-/<=>\\^|~¬±×÷' +let s:op_chars = '\U25\U26\U2A\U2B\U2D\U2F\U3C-\U3E\U5C\U5E\U7C\U7E\UAC\UB1\UD7\UF7' + +" List of all valid operator chars above \UFF +" Written with ranges for performance reasons +" The list contains the following characters: '…⁝⅋←↑→↓↔↚↛↜↝↞↠↢↣↤↦↩↪↫↬↮↶↷↺↻↼↽⇀⇁⇄⇆⇇⇉⇋⇌⇍⇎⇏⇐⇒⇔⇚⇛⇜⇝⇠⇢⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿∈∉∊∋∌∍∓∔∗∘∙√∛∜∝∤∥∦∧∨∩∪∷∸∺∻∽∾≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋⊍⊎⊏⊐⊑⊒⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊞⊟⊠⊡⊢⊣⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⊻⊼⊽⋄⋅⋆⋇⋉⋊⋋⋌⋍⋎⋏⋐⋑⋒⋓⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌿▷⟂⟈⟉⟑⟒⟕⟖⟗⟰⟱⟵⟶⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩⥪⥫⥬⥭⥮⥯⥰⦷⦸⦼⦾⦿⧀⧁⧡⧣⧤⧥⧴⧶⧷⧺⧻⨇⨈⨝⨟⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨰⨱⨲⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⩀⩁⩂⩃⩄⩅⩊⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖⩗⩘⩚⩛⩜⩝⩞⩟⩠⩡⩢⩣⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫛⫷⫸⫹⫺⬰⬱⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←↑→↓' +let s:op_chars_wc = '\U2026\U205D\U214B\U2190-\U2194\U219A-\U219E\U21A0\U21A2-\U21A4\U21A6\U21A9-\U21AC\U21AE\U21B6\U21B7\U21BA-\U21BD\U21C0\U21C1\U21C4\U21C6\U21C7\U21C9\U21CB-\U21D0\U21D2\U21D4\U21DA-\U21DD\U21E0\U21E2\U21F4-\U21FF\U2208-\U220D\U2213\U2214\U2217-\U221D\U2224-\U222A\U2237\U2238\U223A\U223B\U223D\U223E\U2240-\U228B\U228D-\U229C\U229E-\U22A3\U22A9\U22AC\U22AE\U22B0-\U22B7\U22BB-\U22BD\U22C4-\U22C7\U22C9-\U22D3\U22D5-\U22FF\U233F\U25B7\U27C2\U27C8\U27C9\U27D1\U27D2\U27D5-\U27D7\U27F0\U27F1\U27F5-\U27F7\U27F9-\U27FF\U2900-\U2918\U291D-\U2920\U2944-\U2970\U29B7\U29B8\U29BC\U29BE-\U29C1\U29E1\U29E3-\U29E5\U29F4\U29F6\U29F7\U29FA\U29FB\U2A07\U2A08\U2A1D\U2A1F\U2A22-\U2A2E\U2A30-\U2A3D\U2A40-\U2A45\U2A4A-\U2A58\U2A5A-\U2A63\U2A66\U2A67\U2A6A-\U2AD9\U2ADB\U2AF7-\U2AFA\U2B30-\U2B44\U2B47-\U2B4C\UFFE9-\UFFEC' + +" Full operators regex +let s:operators = '\%(' . '\.\%([-+*/^÷%|&⊻]\|//\|\\\|>>\|>>>\?\)\?=' . + \ '\|' . '[:<>]=\|||\|&&\||>\|<|\|[<>:]:\|<<\|>>>\?\|//\|[-=]>\|\.\.\.\?' . + \ '\|' . '\.\?[!' . s:op_chars . s:op_chars_wc . ']' . + \ '\)' + + +" Characters that can be used to start an identifier. Above \UBF we don't +" bother checking. (If a UTF8 operator is used, it will take precedence anyway.) +let s:id_charsH = '\%([A-Za-z_\UA2-\UA6\UA9\UAA\UAE\UB0\UB5\UBA]\|[^\U00-\UBF]\)' +" Characters that can appear in an identifier, starting in 2nd position. Above +" \UBF we check for operators since we need to stop the identifier if one +" appears. We don't check for invalid characters though. +let s:id_charsW = '\%([0-9A-Za-z_!\UA2-\UA6\UA9\UAA\UAE-\UB0\UB2-\UB5\UB8-\UBA\UBC-\UBE]\|[^\U00-\UBF]\@=[^' . s:op_chars_wc . ']\)' + +" A valid julia identifier, more or less +let s:idregex = '\%(' . s:id_charsH . s:id_charsW . '*\)' + + + +syn case match + +syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems,@juliaSyntaxRegions +syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems +syntax cluster juliaExprsNodot contains=@juliaParItems,@juliaStringItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaCommentItems,juliaIdSymbol + +syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraIdxBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar +syntax cluster juliaKeywordItems contains=juliaKeyword,juliaWhereKeyword,juliaImportLine,juliaInfixKeyword,juliaRepKeyword +syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock +syntax cluster juliaTypesItems contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther + +syntax cluster juliaConstItems contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric,juliaConstIO,juliaPossibleEuler + +syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra +syntax cluster juliaSymbolItems contains=juliaPossibleSymbol +syntax cluster juliaNumberItems contains=juliaNumbers +syntax cluster juliaStringItems contains=juliaChar,juliaString,juliabString,juliasString,juliaShellString,juliaDocString,juliaRegEx +syntax cluster juliaPrintfItems contains=juliaPrintfParBlock,juliaPrintfString +syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juliaCTransOperator,juliaTernaryRegion,juliaColon,juliaSemicolon,juliaComma +syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM +syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally + +syntax cluster juliaSyntaxRegions contains=juliaIdSymbol,juliaTypeOperatorR2,juliaTypeOperatorR3,juliaWhereR,juliaDotted + +syntax cluster juliaSpellcheckStrings contains=@spell +syntax cluster juliaSpellcheckDocStrings contains=@spell +syntax cluster juliaSpellcheckComments contains=@spell + +if !s:julia_spellcheck_docstrings + syntax cluster juliaSpellcheckDocStrings remove=@spell +endif +if !s:julia_spellcheck_strings + syntax cluster juliaSpellcheckStrings remove=@spell +endif +if !s:julia_spellcheck_comments + syntax cluster juliaSpellcheckComments remove=@spell +endif + +syntax match juliaSemicolon display ";" +syntax match juliaComma display "," +syntax match juliaColon display ":" + +" A dot can introduce a sort of 'environment' such that words after it are not +" recognized as keywords. This has low precedence so that it can be overridden +" by operators +syntax match juliaDotted transparent "\.\s*[^])}.]" contains=@juliaExprsNodot +syntax match juliaDottedT contained transparent "\.\s*[^])}.]" contains=@juliaExprsNodot,juliaType + +syntax match juliaErrorPar display "[])}]" +syntax match juliaErrorEnd display "\" +syntax match juliaErrorElse display "\<\%(else\|elseif\)\>" +syntax match juliaErrorCatch display "\" +syntax match juliaErrorFinally display "\" +syntax match juliaErrorSemicol display contained ";" + +syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor +syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="(" end=")" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor +syntax region juliaSqBraIdxBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS +exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS' +syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=juliaType,juliaDottedT,@juliaExpressions + +exec 'syntax match juliaType contained "\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"' + +" This is a generic identifier followed by some symbol, either a type +" operator (<: or >:), or an open parenthesis, or an open curly bracket. +" It's used to recognize one of the contained regions looking for identifiers +" only once. Once recognized, those regions no longer need to use the +" expensive s:idregex. +exec 'syntax match juliaIdSymbol transparent "' . s:idregex . '\%(\s*[<>]:\|\.\?(\|{\|\"\)\@=" contains=juliaFunctionCall,juliaParamType,juliaStringPrefixed,juliaTypeOperatorR1' + +syntax match juliaFunctionCall contained "[^{([:space:]<>\"]\+(\@=" nextgroup=juliaParBlock + +exec 'syntax match juliaFunctionDef contained transparent "\%(\<\%(function\|macro\)\)\@'.s:d(8).'<=\s\+\zs' . s:idregex . '\%(\.' . s:idregex . '\)*\ze\s*\%((\|\send\>\|$\)" contains=juliaFunctionName' +exec 'syntax match juliaFunctionName contained "\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"' + +exec 'syntax match juliaStructR contained transparent "\%(\<\%(\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*' . s:idregex . '\>\(\s*(\)\@!" contains=juliaType' + +syntax match juliaKeyword display "\<\%(return\|local\|global\|const\)\>" +syntax match juliaInfixKeyword display "\%(=\s*\)\@\S\@!\%(\s*=\)\@!" + +" The import/export/using keywords introduce a sort of special parsing +" environment with its own rules +exec 'syntax region juliaImportLine matchgroup=juliaKeyword excludenl start="\<\%(import\|using\|export\)\>" skip="\%(\%(\<\%(import\|using\|export\)\>\)\|^\)\@'.s:d(6).'<=$" end="$" end="\%([])}]\)\@=" contains=@juliaExpressions,juliaAsKeyword,@juliaContinuationItems,juliaMacroName' +syntax match juliaAsKeyword display contained "\" + +syntax match juliaRepKeyword display "\<\%(break\|continue\)\>" +syntax region juliaConditionalBlock matchgroup=juliaConditional start="\" end="\" contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock fold +syntax region juliaConditionalEIBlock matchgroup=juliaConditional transparent contained start="\" end="\<\%(end\|else\|elseif\)\>"me=s-1 contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock +syntax region juliaConditionalEBlock matchgroup=juliaConditional transparent contained start="\" end="\"me=s-1 contains=@juliaExpressions +syntax region juliaWhileBlock matchgroup=juliaRepeat start="\" end="\" contains=@juliaExpressions fold +syntax region juliaForBlock matchgroup=juliaRepeat start="\" end="\" contains=@juliaExpressions,juliaOuter fold +syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions fold +syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions,juliaFunctionDef fold +syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions,juliaFunctionDef fold +syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions fold +syntax region juliaStructBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions,juliaStructR fold +syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions,juliaStructR fold +syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions fold +syntax region juliaDoBlock matchgroup=juliaBlKeyword start="\" end="\" contains=@juliaExpressions fold +syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\<\%(bare\)\?module\>" end="\" contains=@juliaExpressions fold +syntax region juliaExceptionBlock matchgroup=juliaException start="\" end="\" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold +syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="\" end="\"me=s-1 contains=@juliaExpressions,juliaFinallyBlock +syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="\" end="\"me=s-1 contains=@juliaExpressions +syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="\" end="\" fold contains=@juliaExpressions,juliaStructR +syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="\" end="\" fold contains=@juliaExpressions,juliaStructR + +exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor' +syntax match juliaComprehensionIf contained "\" + +exec 'syntax match juliaOuter contained "\"' + +syntax match juliaRangeKeyword contained "\<\%(begin\|end\)\>" + +syntax match juliaBaseTypeBasic display "\<\%(\%(N\|Named\)\?Tuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\|Nothing\|Some\|Missing\)\>" +syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|\%(Abstract\)\?Irrational\|Enum\|BigInt\|BigFloat\|MathConst\|ComplexF\%(16\|32\|64\)\)\>" +syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\|void\)\)\>" +syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|ReadOnlyMemory\|StringIndex\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Missing\|\%(Process\|Task\)Failed\)Exception\|DimensionMismatch\|SegmentationFault\)\>" +syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\|CartesianIndices\)\>" +syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\|Substitution\)\?String\>" +syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|\%(Sparse\|Row\)Vector\|VecElement\|Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|Broadcasted\|Adjoint\|Transpose\|LinearIndices\)\>" +syntax match juliaBaseTypeDict display "\<\%(WeakKey\|Id\|Abstract\)\?Dict\>" +syntax match juliaBaseTypeSet display "\<\%(\%(Abstract\|Bit\)\?Set\)\>" +syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\|GenericIOBuffer\)\>" +syntax match juliaBaseTypeProcess display "\<\%(Pipe\|Cmd\|PipeBuffer\)\>" +syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Abstract\|Lin\|Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\|ExponentialBackOff\|StepRangeLen\)\>" +syntax match juliaBaseTypeRegex display "\" +syntax match juliaBaseTypeFact display "\<\%(Factorization\|BunchKaufman\|\%(Cholesky\|QR\)\%(Pivoted\)\?\|\%(Generalized\)\?\%(Eigen\|SVD\|Schur\)\|Hessenberg\|LDLt\|LQ\|LU\)\>" +syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>" +syntax match juliaBaseTypeRound display "\" +syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>" +syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>" +syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|\%(Abstract\)\?Display\|MIME\|HTML\)\>" +syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\|DateFormat\)\>" +syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>" + +syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)" +" Note: recognition of ℯ, which Vim does not consider a valid identifier, is +" complicated. We detect possible uses by just looking for the character (for +" performance) and then check that it's actually used by its own. +" (This also tries to detect preceding number constants; it does so in a crude +" way.) +syntax match juliaPossibleEuler "ℯ" contains=juliaEuler +exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . s:op_chars_wc . ']\)\%(.\?[0-9][.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=ℯ\ze[' . s:nonidS_chars . s:op_chars_wc . ']"' +syntax match juliaConstBool display "\<\%(true\|false\)\>" +syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|PROGRAM_FILE\|DEPOT_PATH\)\>" +syntax match juliaConstIO display "\<\%(std\%(out\|in\|err\)\|devnull\)\>" +syntax match juliaConstC display "\<\%(C_NULL\)\>" +syntax match juliaConstGeneric display "\<\%(nothing\|Main\|undef\|missing\)\>" + +syntax match juliaParamType contained "[^{([:space:]<>\"]\+\ze{" nextgroup=juliaCurBraBlock + +syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro,juliaDocMacro,juliaDocMacroPre + +exec 'syntax match juliaMacro contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"' +syntax match juliaMacro contained "@[!.~$%^*/\\|<>+-]\ze[^0-9]" +exec 'syntax region juliaMacroCall contained transparent start="\(@' . s:idregex . '\%(\.' . s:idregex . '\)*\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\\|\\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS' +exec 'syntax region juliaMacroCall contained transparent start="\(@.\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\\|\\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS' +exec 'syntax region juliaMacroCallP contained transparent start="@' . s:idregex . '\%(\.' . s:idregex . '\)*(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock' +exec 'syntax region juliaMacroCallP contained transparent start="@.(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock' + +exec 'syntax match juliaNumbers transparent "\%(^\|[' . s:nonidS_chars . s:op_chars_wc . ']\)\@'.s:d(1).'<=\d\|\.\d\|im\>" contains=juliaNumber,juliaFloat,juliaComplexUnit' + +"integer regexes +let s:dec_regex = '\d\%(_\?\d\)*\%(\>\|im\>\|\ze\D\)' +let s:hex_regex = '0x\x\%(_\?\x\)*\%(\>\|im\>\|\ze\X\)' +let s:bin_regex = '0b[01]\%(_\?[01]\)*\%(\>\|im\>\|\ze[^01]\)' +let s:oct_regex = '0o\o\%(_\?\o\)*\%(\>\|im\>\|\ze\O\)' + +let s:int_regex = '\%(' . s:hex_regex . + \ '\|' . s:bin_regex . + \ '\|' . s:oct_regex . + \ '\|' . s:dec_regex . + \ '\)' + +"floating point regexes +" starting with a dot, optional exponent +let s:float_regex1 = '\.\d\%(_\?\d\)*\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)' +" with dot, optional exponent +let s:float_regex2 = '\d\%(_\?\d\)*\.\%(\d\%(_\?\d\)*\)\?\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)' +" without dot, with exponent +let s:float_regex3 = '\d\%(_\?\d\)*[eEf][-+]\?\d\+\%(\>\|im\>\|\ze\D\)' + +"hex floating point numbers +" starting with a dot +let s:hexfloat_regex1 = '0x\.\%\(\x\%(_\?\x\)*\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)' +" starting with a digit +let s:hexfloat_regex2 = '0x\x\%(_\?\x\)*\%\(\.\%\(\x\%(_\?\x\)*\)\?\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)' + +let s:float_regex = '\%(' . s:float_regex3 . + \ '\|' . s:float_regex2 . + \ '\|' . s:float_regex1 . + \ '\|' . s:hexfloat_regex2 . + \ '\|' . s:hexfloat_regex1 . + \ '\)' + +exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaComplexUnit' +exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit' +syntax match juliaComplexUnit display contained "\" + +syntax match juliaRangeOperator display ":" +exec 'syntax match juliaOperator "' . s:operators . '"' + +exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol' + +let s:interp_dollar = '\([' . s:nonidS_chars . s:op_chars_wc . '!]\|^\)\@'.s:d(1).'<=\$' + +exec 'syntax match juliaDollarVar display contained "' . s:interp_dollar . s:idregex . '"' +exec 'syntax region juliaDollarPar matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '(" end=")" contains=@juliaExpressions' +exec 'syntax region juliaDollarSqBra matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS' + +syntax match juliaChar "'\\\?.'" contains=juliaSpecialChar +syntax match juliaChar display "'\\\o\{3\}'" contains=juliaOctalEscapeChar +syntax match juliaChar display "'\\x\x\{2\}'" contains=juliaHexEscapeChar +syntax match juliaChar display "'\\u\x\{1,4\}'" contains=juliaUniCharSmall +syntax match juliaChar display "'\\U\x\{1,8\}'" contains=juliaUniCharLarge + +exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:op_chars_wc . '!]\@'.s:d(1).'"]\+\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw +syntax region juliabString matchgroup=juliaStringDelim start=+\\"]\+\%(\s*[<>]:\)\@=" + +" force precedence over Symbols +syntax match juliaTypeOperator contained "[<>:]:" +exec 'syntax match juliaTypeOperatorR2 transparent "[<>:]:\s*\%(' . s:idregex . '\.\)*' . s:idregex . '" contains=juliaTypeOperator,juliaType,juliaDottedT,@juliaExpressions nextgroup=juliaTypeOperator' +syntax match juliaIsaKeyword contained "\" +exec 'syntax match juliaTypeOperatorR3 transparent "\" +exec 'syntax match juliaWhereR transparent "\ -" Last Change: 2013 April 17 +" Last Change: 2021 Jul 28 " Original Author: Axel Castellane " Source: http://openlib.org/acmes/root/docu/redif_1.html " File Extension: rdf @@ -932,7 +932,7 @@ highlight redifFieldDeprecated term=unde " Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which " fields can follow. Thus sync must search backwards for it. " -" I would like to simply ask VIM to search backward for the first occurence of +" I would like to simply ask VIM to search backward for the first occurrence of " /^Template-Type:/, but it does not seem to be possible, so I have to start " from the beginning of the file... This might slow down a lot for files that " contain a lot of Template-Type statements. diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim --- a/runtime/syntax/scala.vim +++ b/runtime/syntax/scala.vim @@ -3,7 +3,8 @@ " Maintainer: Derek Wyatt " URL: https://github.com/derekwyatt/vim-scala " License: Same as Vim -" Last Change: 20 May 2016 +" Last Change: 2021 Aug 11 +" by Jesse Atkinson, PR #8746 " ---------------------------------------------------------------------------- if !exists('main_syntax') @@ -66,7 +67,7 @@ syn match scalaChar /'\\u[A-Fa-f0-9]\{4} syn match scalaEscapedChar /\\[\\"'ntbrf]/ syn match scalaUnicodeChar /\\u[A-Fa-f0-9]\{4}/ hi link scalaChar Character -hi link scalaEscapedChar Function +hi link scalaEscapedChar Special hi link scalaUnicodeChar Special syn match scalaOperator "||" diff --git a/runtime/syntax/scdoc.vim b/runtime/syntax/scdoc.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/scdoc.vim @@ -0,0 +1,52 @@ +" Syntax file for scdoc files +" Maintainer: Gregory Anders +" Last Updated: 2021-08-04 + +if exists('b:current_syntax') + finish +endif +let b:current_syntax = 'scdoc' + +syntax match scdocFirstLineError "\%^.*$" +syntax match scdocFirstLineValid "\%^\S\+(\d[0-9A-Za-z]*)\%(\s\+\"[^"]*\"\%(\s\+\"[^"]*\"\)\=\)\=$" + +syntax region scdocCommentError start="^;\S" end="$" keepend +syntax region scdocComment start="^; " end="$" keepend + +syntax region scdocHeaderError start="^#\{3,}" end="$" keepend +syntax region scdocHeader start="^#\{1,2}" end="$" keepend + +syntax match scdocIndentError "^[ ]\+" + +syntax match scdocLineBreak "++$" + +syntax match scdocOrderedListMarker "^\s*\.\%(\s\+\S\)\@=" +syntax match scdocListMarker "^\s*-\%(\s\+\S\)\@=" + +syntax match scdocTableStartMarker "^[\[|\]][\[\-\]]" +syntax match scdocTableMarker "^[|:][\[\-\] ]" + +syntax region scdocBold concealends matchgroup=scdocBoldDelimiter start="\\\@" +syntax region scdocPre matchgroup=scdocPreDelimiter start="^\t*```" end="^\t*```" + +hi link scdocFirstLineValid Comment +hi link scdocComment Comment +hi link scdocHeader Title +hi link scdocOrderedListMarker Statement +hi link scdocListMarker scdocOrderedListMarker +hi link scdocLineBreak Special +hi link scdocTableMarker Statement +hi link scdocTableStartMarker scdocTableMarker + +hi link scdocFirstLineError Error +hi link scdocCommentError Error +hi link scdocHeaderError Error +hi link scdocIndentError Error + +hi link scdocPreDelimiter Delimiter + +hi scdocBold term=bold cterm=bold gui=bold +hi scdocUnderline term=underline cterm=underline gui=underline +hi link scdocBoldDelimiter scdocBold +hi link scdocUnderlineDelimiter scdocUnderline diff --git a/runtime/syntax/scheme.vim b/runtime/syntax/scheme.vim --- a/runtime/syntax/scheme.vim +++ b/runtime/syntax/scheme.vim @@ -1,10 +1,11 @@ " Vim syntax file " Language: Scheme (R7RS) -" Last Change: 2018-01-06 +" Last Change: 2021-01-03 " Author: Evan Hanson " Maintainer: Evan Hanson " Previous Author: Dirk van Deun " Previous Maintainer: Sergey Khorev +" Repository: https://git.foldling.org/vim-scheme.git " URL: https://foldling.org/vim/syntax/scheme.vim if exists('b:current_syntax') @@ -14,6 +15,8 @@ endif let s:cpo = &cpo set cpo&vim +syn spell notoplevel + syn match schemeParentheses "[^ '`\t\n()\[\]";]\+" syn match schemeParentheses "[)\]]" @@ -35,7 +38,7 @@ syn region schemeUnquote matchgroup=sche syn region schemeQuoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster syn region schemeQuasiquoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -syn region schemeString start=/\(\\\)\@/ @@ -47,9 +50,9 @@ syn match schemeBoolean /#f\(alse\)\?/ syn match schemeCharacter /#\\.[^ `'\t\n\[\]()]*/ syn match schemeCharacter /#\\x[0-9a-fA-F]\+/ -syn match schemeComment /;.*$/ +syn match schemeComment /;.*$/ contains=@Spell -syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment +syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment,@Spell syn region schemeForm matchgroup=schemeParentheses start="(" end=")" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster syn region schemeForm matchgroup=schemeParentheses start="\[" end="\]" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster @@ -63,7 +66,7 @@ else syn region schemeImport matchgroup=schemeImport start="\(([ \t\n]*\)\@<=\(import\)\>" end=")"me=e-1 contained contains=schemeImportForm,schemeIdentifier,schemeComment,schemeDatumComment endif -syn match schemeImportKeyword "\(([ \t\n]*\)\@<=\(except\|only\|prefix\|rename\|srfi\)\>" +syn match schemeImportKeyword "\(([ \t\n]*\)\@<=\(except\|only\|prefix\|rename\)\>" syn region schemeImportForm matchgroup=schemeParentheses start="(" end=")" contained contains=schemeIdentifier,schemeComment,schemeDatumComment,@schemeImportCluster syn cluster schemeImportCluster contains=schemeImportForm,schemeImportKeyword diff --git a/runtime/vim.desktop b/runtime/vim.desktop --- a/runtime/vim.desktop +++ b/runtime/vim.desktop @@ -111,12 +111,6 @@ Keywords[sr]=Текст;едитор; Keywords[tr]=Metin;düzenleyici; Keywords=Text;editor; # Translators: This is the Icon file name. Do NOT translate -Icon[de]=gvim -Icon[eo]=gvim -Icon[fr]=gvim -Icon[it]=gvim -Icon[ru]=gvim -Icon[sr]=gvim Icon=gvim Categories=Utility;TextEditor; StartupNotify=false