diff options
-rw-r--r-- | runtime/autoload/dist/vimindent.vim | 38 | ||||
-rw-r--r-- | runtime/doc/builtin.txt | 31 | ||||
-rw-r--r-- | runtime/doc/diff.txt | 2 | ||||
-rw-r--r-- | runtime/doc/fold.txt | 7 | ||||
-rw-r--r-- | runtime/doc/insert.txt | 15 | ||||
-rw-r--r-- | runtime/doc/options.txt | 10 | ||||
-rw-r--r-- | runtime/doc/os_vms.txt | 8 | ||||
-rw-r--r-- | runtime/doc/print.txt | 2 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 2 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 11 | ||||
-rw-r--r-- | runtime/doc/tags | 11 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 61 | ||||
-rw-r--r-- | runtime/doc/vim9.txt | 14 | ||||
-rw-r--r-- | runtime/ftplugin/erlang.vim | 24 | ||||
-rw-r--r-- | runtime/ftplugin/man.vim | 7 | ||||
-rw-r--r-- | runtime/indent/erlang.vim | 143 | ||||
-rw-r--r-- | runtime/indent/testdir/vim.in | 12 | ||||
-rw-r--r-- | runtime/indent/testdir/vim.ok | 12 | ||||
-rw-r--r-- | runtime/optwin.vim | 2 | ||||
-rw-r--r-- | runtime/plugin/manpager.vim | 7 | ||||
-rw-r--r-- | runtime/syntax/erlang.vim | 17 | ||||
-rw-r--r-- | runtime/syntax/vim.vim | 32 |
22 files changed, 281 insertions, 187 deletions
diff --git a/runtime/autoload/dist/vimindent.vim b/runtime/autoload/dist/vimindent.vim index 572fc7c6cb..00977dc3d8 100644 --- a/runtime/autoload/dist/vimindent.vim +++ b/runtime/autoload/dist/vimindent.vim @@ -4,6 +4,11 @@ vim9script # Maintainer: github user lacygoill # Last Change: 2022 Sep 24 +# NOTE: Whenever you change the code, make sure the tests are still passing: +# +# $ cd runtime/indent/ +# $ make clean; make test || vimdiff testdir/vim.{fail,ok} + # Config {{{1 const TIMEOUT: number = get(g:, 'vim_indent', {}) @@ -293,7 +298,7 @@ const START_MIDDLE_END: dict<list<string>> = { # EOL {{{2 # OPENING_BRACKET_AT_EOL {{{3 -const OPENING_BRACKET_AT_EOL: string = $'{OPENING_BRACKET}{END_OF_VIM9_LINE}' +const OPENING_BRACKET_AT_EOL: string = OPENING_BRACKET .. END_OF_VIM9_LINE # COMMA_AT_EOL {{{3 @@ -404,16 +409,15 @@ export def Expr(lnum: number): number # {{{2 line_A->CacheBracketBlock() endif if line_A.lnum->IsInside('BracketBlock') - && !b:vimindent.block_stack[0].is_curly_block for block: dict<any> in b:vimindent.block_stack - # Can't call `BracketBlockIndent()` before we're indenting a line *after* the start of the block.{{{ - # - # That's because it might need the correct indentation of the start - # of the block. But if we're still *on* the start, we haven't yet - # computed that indentation. - #}}} - if line_A.lnum > block.startlnum - && !block.is_curly_block + if line_A.lnum <= block.startlnum + continue + endif + if !block->has_key('startindent') + block.startindent = Indent(block.startlnum) + endif + if !block.is_curly_block + && !b:vimindent.block_stack[0].is_curly_block return BracketBlockIndent(line_A, block) endif endfor @@ -481,7 +485,7 @@ export def Expr(lnum: number): number # {{{2 cursor(line_A.lnum, 1) var [start: string, middle: string, end: string] = START_MIDDLE_END[kwd] - var block_start = SearchPairStart(start, middle, end) + var block_start: number = SearchPairStart(start, middle, end) if block_start > 0 return Indent(block_start) else @@ -535,10 +539,10 @@ def Offset( # {{{2 # Indent twice for a line continuation in the block header itself, so that # we can easily distinguish the end of the block header from the start of # the block body. - elseif line_B->EndsWithLineContinuation() - && !line_A.isfirst - || line_A.text =~ LINE_CONTINUATION_AT_SOL - && line_A.text !~ PLUS_MINUS_COMMAND + elseif (line_B->EndsWithLineContinuation() + && !line_A.isfirst) + || (line_A.text =~ LINE_CONTINUATION_AT_SOL + && line_A.text !~ PLUS_MINUS_COMMAND) || line_A.text->Is_IN_KeywordForLoop(line_B.text) return 2 * shiftwidth() else @@ -646,10 +650,6 @@ def CommentIndent(): number # {{{2 enddef def BracketBlockIndent(line_A: dict<any>, block: dict<any>): number # {{{2 - if !block->has_key('startindent') - block.startindent = block.startlnum->Indent() - endif - var ind: number = block.startindent if line_A.text =~ CLOSING_BRACKET_AT_SOL diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index e5740a587a..686cc84cca 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.0. Last change: 2022 Sep 17 +*builtin.txt* For Vim version 9.0. Last change: 2022 Sep 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6,9 +6,10 @@ Builtin functions *builtin-functions* -Note: Expression evaluation can be disabled at compile time. If this has been -done, the builtin functions are not available. See |+eval| and -|no-eval-feature|. +Note: Expression evaluation can be disabled at compile time, the builtin +functions are not available then. See |+eval| and |no-eval-feature|. + +For functions grouped by what they are used for see |function-list|. 1. Overview |builtin-function-list| 2. Details |builtin-function-details| @@ -7035,13 +7036,19 @@ reg_recording() *reg_recording()* Returns the single letter name of the register being recorded. Returns an empty string when not recording. See |q|. -reltime([{start} [, {end}]]) *reltime()* +reltime() +reltime({start}) +reltime({start}, {end}) *reltime()* Return an item that represents a time value. The item is a list with items that depend on the system. In Vim 9 script list<any> can be used. The item can be passed to |reltimestr()| to convert it to a - string or |reltimefloat()| to convert to a Float. - + string or |reltimefloat()| to convert to a Float. For + example, to see the time spent in function Work(): > + var startTime = reltime() + Work() + echo startTime->reltime()->reltimestr() +< Without an argument reltime() returns the current time (the representation is system-dependent, it can not be used as the wall-clock time, see |localtime()| for that). @@ -7162,8 +7169,8 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()* This function is not available in the |sandbox|. {only available when compiled with the |+clientserver| feature} Examples: > - :let repl = "" - :echo "PEEK: " .. remote_peek(id, "repl") .. ": " .. repl + :let repl = "" + :echo "PEEK: " .. remote_peek(id, "repl") .. ": " .. repl < Can also be used as a |method|: > ServerId()->remote_peek() @@ -7223,7 +7230,8 @@ remote_startserver({name}) < {only available when compiled with the |+clientserver| feature} -remove({list}, {idx} [, {end}]) *remove()* +remove({list}, {idx}) +remove({list}, {idx}, {end}) *remove()* Without {end}: Remove the item at {idx} from |List| {list} and return the item. With {end}: Remove items from {idx} to {end} (inclusive) and @@ -7241,7 +7249,8 @@ remove({list}, {idx} [, {end}]) *remove()* Can also be used as a |method|: > mylist->remove(idx) -remove({blob}, {idx} [, {end}]) +remove({blob}, {idx}) +remove({blob}, {idx}, {end}) Without {end}: Remove the byte at {idx} from |Blob| {blob} and return the byte. With {end}: Remove bytes from {idx} to {end} (inclusive) and diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index e5321c586d..1c93de4d78 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 9.0. Last change: 2022 Jan 22 +*diff.txt* For Vim version 9.0. Last change: 2022 Oct 01 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index f11ca0812d..7c702ff2d4 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -1,4 +1,4 @@ -*fold.txt* For Vim version 9.0. Last change: 2022 Jan 22 +*fold.txt* For Vim version 9.0. Last change: 2022 Oct 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -503,7 +503,7 @@ is evaluated to obtain the text displayed for a closed fold. Example: > This shows the first line of the fold, with "/*", "*/" and "{{{" removed. Note the use of backslashes to avoid some characters to be interpreted by the -":set" command. It's simpler to define a function and call that: > +":set" command. It is much simpler to define a function and call it: > :set foldtext=MyFoldText() :function MyFoldText() @@ -512,6 +512,9 @@ Note the use of backslashes to avoid some characters to be interpreted by the : return v:folddashes .. sub :endfunction +The advantage of using a function call without arguments is that it is faster, +see |expr-option-function|. + Evaluating 'foldtext' is done in the |sandbox|. The current window is set to the window that displays the line. The context is set to the script where the option was last set. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 51cfa46975..9e87626963 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 9.0. Last change: 2022 Apr 06 +*insert.txt* For Vim version 9.0. Last change: 2022 Sep 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -667,7 +667,7 @@ When the popup menu is displayed there are a few more special keys, see |popupmenu-keys|. Note: The keys that are valid in CTRL-X mode are not mapped. This allows for -":map ^F ^X^F" to work (where ^F is CTRL-F and ^X is CTRL-X). The key that +`:map <C-F> <C-X><C-F>` to work (assuming "<" is not in 'cpo'). The key that ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is mapped. Also, when doing completion with 'complete' mappings apply as usual. @@ -677,11 +677,12 @@ buffer text cannot be changed. Mappings that somehow invoke ":normal i.." will generate an E565 error. The following mappings are suggested to make typing the completion commands -a bit easier (although they will hide other commands): > - :inoremap ^] ^X^] - :inoremap ^F ^X^F - :inoremap ^D ^X^D - :inoremap ^L ^X^L +a bit easier (although they will hide other commands; this requires "<" is not +in 'cpo'): > + :inoremap <C-]> <C-X><C-]> + :inoremap <C-F> <C-X><C-F> + :inoremap <C-D> <C-X><C-D> + :inoremap <C-L> <C-X><C-L> As a special case, typing CTRL-R to perform register insertion (see |i_CTRL-R|) will not exit CTRL-X mode. This is primarily to allow the use of diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 069a0f173f..a0098a7bdd 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.0. Last change: 2022 Sep 27 +*options.txt* For Vim version 9.0. Last change: 2022 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2942,7 +2942,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'display' 'dy' string (default "", set to "truncate" in |defaults.vim|) global - Change the way text is displayed. This is comma-separated list of + Change the way text is displayed. This is a comma-separated list of flags: lastline When included, as much as possible of the last line in a window will be displayed. "@@@" is put in the @@ -7307,8 +7307,10 @@ A jump table for the options with a short description can be found at |Q_op|. local to window Scrolling works with screen lines. When 'wrap' is set and the first line in the window wraps part of it may not be visible, as if it is - above the window. - NOTE: only partly implemented, works with CTRL-E and CTRL-Y. + above the window. "<<<" is displayed at the start of the first line, + highlighted with |hl-NonText|. + NOTE: only partly implemented, currently works with CTRL-E, CTRL-Y + and scrolling with the mouse. *'softtabstop'* *'sts'* 'softtabstop' 'sts' number (default 0) diff --git a/runtime/doc/os_vms.txt b/runtime/doc/os_vms.txt index c55b0e68e4..b2a159018c 100644 --- a/runtime/doc/os_vms.txt +++ b/runtime/doc/os_vms.txt @@ -1,4 +1,4 @@ -*os_vms.txt* For Vim version 9.0. Last change: 2021 Jan 04 +*os_vms.txt* For Vim version 9.0. Last change: 2022 Sep 30 VIM REFERENCE MANUAL @@ -331,10 +331,10 @@ features, it is worth to choose non GUI executables. 8.1 Backspace/delete There are backspace/delete key inconsistencies with VMS. -:fixdel doesn't do the trick, but the solution is: > +:fixdel doesn't do the trick, but the solution is (without "<" in 'cpo'): > - :inoremap ^? ^H " for terminal mode - :inoremap <Del> ^H " for gui mode + :inoremap <C-?> <C-H> " for terminal mode + :inoremap <Del> <C-H> " for gui mode Read more in ch: 8.6 (Terminal problems). (Bruce Hunsaker <BNHunsaker@chq.byu.edu> Vim 5.3) diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 9f8bb20879..53f17e1545 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -1,4 +1,4 @@ -*print.txt* For Vim version 9.0. Last change: 2022 Jan 23 +*print.txt* For Vim version 9.0. Last change: 2022 Oct 01 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 4d13a47887..fab98302fd 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 9.0. Last change: 2022 Sep 14 +*quickref.txt* For Vim version 9.0. Last change: 2022 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1587df5e7c..1775af73b3 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.0. Last change: 2022 Sep 26 +*syntax.txt* For Vim version 9.0. Last change: 2022 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5376,10 +5376,11 @@ ModeMsg 'showmode' message (e.g., "-- INSERT --"). *hl-MoreMsg* MoreMsg |more-prompt| *hl-NonText* -NonText '@' at the end of the window, characters from 'showbreak' - and other characters that do not really exist in the text - (e.g., ">" displayed when a double-wide character doesn't - fit at the end of the line). +NonText '@' at the end of the window, "<<<" at the start of the window + for 'smoothscroll', characters from 'showbreak' and other + characters that do not really exist in the text, such as the + ">" displayed when a double-wide character doesn't fit at the + end of the line. *hl-Normal* Normal Normal text. *hl-Pmenu* diff --git a/runtime/doc/tags b/runtime/doc/tags index 2c4a550dee..639938f6f0 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -714,14 +714,14 @@ $quote eval.txt /*$quote* 'nosmartindent' options.txt /*'nosmartindent'* 'nosmarttab' options.txt /*'nosmarttab'* 'nosmd' options.txt /*'nosmd'* +'nosmoothscroll' options.txt /*'nosmoothscroll'* +'nosms' options.txt /*'nosms'* 'nosn' options.txt /*'nosn'* 'nosol' options.txt /*'nosol'* 'nospell' options.txt /*'nospell'* 'nosplitbelow' options.txt /*'nosplitbelow'* 'nosplitright' options.txt /*'nosplitright'* -'nosplitscroll' options.txt /*'nosplitscroll'* 'nospr' options.txt /*'nospr'* -'nospsc' options.txt /*'nospsc'* 'nosr' options.txt /*'nosr'* 'nossl' options.txt /*'nossl'* 'nosta' options.txt /*'nosta'* @@ -938,6 +938,8 @@ $quote eval.txt /*$quote* 'smarttab' options.txt /*'smarttab'* 'smc' options.txt /*'smc'* 'smd' options.txt /*'smd'* +'smoothscroll' options.txt /*'smoothscroll'* +'sms' options.txt /*'sms'* 'sn' options.txt /*'sn'* 'so' options.txt /*'so'* 'softtabstop' options.txt /*'softtabstop'* @@ -954,12 +956,11 @@ $quote eval.txt /*$quote* 'spf' options.txt /*'spf'* 'spl' options.txt /*'spl'* 'splitbelow' options.txt /*'splitbelow'* +'splitkeep' options.txt /*'splitkeep'* 'splitright' options.txt /*'splitright'* -'splitscroll' options.txt /*'splitscroll'* 'spo' options.txt /*'spo'* 'spr' options.txt /*'spr'* 'sps' options.txt /*'sps'* -'spsc' options.txt /*'spsc'* 'sr' options.txt /*'sr'* 'srr' options.txt /*'srr'* 'ss' options.txt /*'ss'* @@ -4345,6 +4346,7 @@ E1303 map.txt /*E1303* E1304 vim9.txt /*E1304* E1305 textprop.txt /*E1305* E1306 vim9.txt /*E1306* +E1307 vim9.txt /*E1307* E131 userfunc.txt /*E131* E132 userfunc.txt /*E132* E133 userfunc.txt /*E133* @@ -6777,6 +6779,7 @@ expr-lambda eval.txt /*expr-lambda* expr-nesting eval.txt /*expr-nesting* expr-number eval.txt /*expr-number* expr-option eval.txt /*expr-option* +expr-option-function vim9.txt /*expr-option-function* expr-quote eval.txt /*expr-quote* expr-register eval.txt /*expr-register* expr-star eval.txt /*expr-star* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 75aef3101b..0e125204c6 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 9.0. Last change: 2022 Sep 27 +*todo.txt* For Vim version 9.0. Last change: 2022 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,55 +38,40 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -From test_global - Found errors in Test_interrupt_global(): - Run 1, 02:16:22 - 02:16:27: - command line..script /home/mool/vim/vim90/src/testdir/runtest.vim[469]..function RunTheTest[44]..Test_interrupt_global[13]..WaitForAssert[2]..<SNR>7_WaitForCommon[11]..<lambda>20 line 1: Pattern 'Interrupted' does not match 'Type :qa! and press...l changes and exit Vim 1,1 All' - command line..script /home/mool/vim/vim90/src/testdir/runtest.vim[469]..function RunTheTest[44]..Test_interrupt_global[20]..WaitForAssert[2]..<SNR>7_WaitForCommon[11]..<lambda>21 line 1: Pattern 'Interrupted' does not match 'Entering Ex mode. Type "visual" to go to Normal mode.' +'smoothscroll': +- computing 'scrolloff' position row use w_skipcol + +Add a string to the 'display' option ("smoothscroll" ?) to make CTRL-E and +CTRL-Y scroll one screen line, also if this means the first line doesn't start +with the first character (like what happens with a last line that doesn't +fit). Display "<<<" at the start of the first visible line (like "@@@" is +displayed in the last line). (Arseny Nasokin, #5154) +Neovim PR: https://github.com/neovim/neovim/pull/11014 Use :defer command: - Use "D" flag of writefile() and mkdir() in tests. - (testdir/test_e*.vim done) + (testdir/test_p*.vim done) + +Fix for powershell: #11257 + +Change boolean 'splitscroll' into string 'splitkeep'. #11258 -New Vim indent script: #11079 OK? Further Vim9 improvements, possibly after launch: -- For map(), reduce() and filter() use a specific implementation if the second - argument is a compiled function. #11163 - Use Vim9 for more runtime files. -- Check performance with callgrind and kcachegrind. - getline()/substitute()/setline() in #5632 -- Better implementation for partial and tests for that. -- when using "const" mark the variable type as const with TTFLAG_CONST, so - that an error is given at compile time when trying to change it. E.g. for a - const list and trying to call add(). -- Compile options that are an expression, e.g. "expr:" in 'spellsuggest', - '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 - implement :enum - implement :class and :interface: See |vim9-classes| -- For range: make table of first ASCII character with flag to quickly check if - it can be a Vim9 command. E.g. "+" can, but "." can't. - Inline call to map() and filter(), better type checking. -- Make accessing varargs faster: arg[expr] - EVAL expr - LOADVARARG (varargs idx) - When evaluating constants for script variables, some functions could work: has(featureName), len(someString) - Implement as part of an expression: ++expr, --expr, expr++, expr--. Popup windows: -- Preview popup not properly updated when it overlaps with completion menu. - (Yegappan Lakshmanan, 2021 May 22) -- Scrollbar thumb sometimes not visible #10492 - Add a function to redraw a specific popup window. Esp. to be used when editing the command line, when screen updating doesn't happen. (Shougo) + #10210 Probably need to update all popup windows (they may overlap) + If the display is scrolled need to redraw everything later. - Add a flag to make a popup window focusable? CTRL-W P cycle over any preview window or focusable popup, end up back in current window. @@ -113,8 +98,6 @@ Popup windows: - put popup menu also in popup_mask? - Match does not have right BG color if line length equals popup width. (#5658) -- Any other commands to disable in a popup window? - Use ERROR_IF_POPUP_WINDOW for these. - Figure out the size and position better if wrapping inserts indent 'incsearch' with :s: @@ -203,13 +186,6 @@ Add BufDeletePost. #11041 Test property disappears when using CR twice in a row. OK when some text was entered. (#11151) -Add a string to the 'display' option ("smoothscroll" ?) to make CTRL-E and -CTRL-Y scroll one screen line, also if this means the first line doesn't start -with the first character (like what happens with a last line that doesn't -fit). Display "<<<" at the start of the first visible line (like "@@@" is -displayed in the last line). (Arseny Nasokin, #5154) -Neovim PR: https://github.com/neovim/neovim/pull/11014 - NFA regexp does not handle composing characters well: #10286 [ɔ̃] matches both ɔ and ɔ̃ \(ɔ\|ɔ̃\) matches ɔ and not ɔ̃ @@ -681,9 +657,6 @@ when possible. (Dylan Lloyd, #3973) Make ":interactive !cmd" stop termcap mode, also when used in an autocommand. (#3692) -matchaddpos() gets slow with many matches. Proposal by Rick Howe, 2018 Jul -19. - Add something like 'fillchars' local to window, but allow for specifying a highlight name. Esp. for the statusline. And "extends" and "precedes" are also useful without 'list' set. Also in diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 15e9a702bc..f3a2ab6ee3 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 9.0. Last change: 2022 Sep 19 +*vim9.txt* For Vim version 9.0. Last change: 2022 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -502,7 +502,7 @@ How constants work varies between languages. Some consider a variable that can't be assigned another value a constant. JavaScript is an example. Others also make the value immutable, thus when a constant uses a list, the list cannot be changed. In Vim9 we can use both. - *E1021* + *E1021* *E1307* `:const` is used for making both the variable and the value a constant. Use this for composite structures that you want to make sure will not be modified. Example: > @@ -1413,11 +1413,11 @@ to a Vim9 function: Calling a function in an expr option ~ *expr-option-function* -A few options, such as 'foldexpr', are an expresison that is evaluated to get -a value. The evaluation can have quite a bit of overhead. One way to -minimize the overhead, and also to keep the option value very simple, is to -defined a compiled function and set the option to call it without arguments. -Example: > +The value of a few options, such as 'foldexpr', is an expression that is +evaluated to get a value. The evaluation can have quite a bit of overhead. +One way to minimize the overhead, and also to keep the option value very +simple, is to define a compiled function and set the option to call it +without arguments. Example: > vim9script def MyFoldFunc(): any ... compute fold level for line v:lnum diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim index c775247f51..31fa0c3213 100644 --- a/runtime/ftplugin/erlang.vim +++ b/runtime/ftplugin/erlang.vim @@ -5,7 +5,7 @@ " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " Eduardo Lopez (http://github.com/tapichu) " Arvid Bjurklint (http://github.com/slarwise) -" Last Update: 2021-Jan-08 +" Last Update: 2021-Nov-22 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -30,6 +30,28 @@ setlocal commentstring=%%s setlocal formatoptions+=ro +if get(g:, 'erlang_extend_path', 1) + " typical erlang.mk paths + let &l:path = join([ + \ 'deps/*/include', + \ 'deps/*/src', + \ 'deps/*/test', + \ 'deps/*/apps/*/include', + \ 'deps/*/apps/*/src', + \ &g:path], ',') + " typical rebar3 paths + let &l:path = join([ + \ 'apps/*/include', + \ 'apps/*/src', + \ '_build/default/lib/*/src', + \ '_build/default/*/include', + \ &l:path], ',') + " typical erlang paths + let &l:path = join(['include', 'src', 'test', &l:path], ',') + + set wildignore+=*/.erlang.mk/*,*.beam +endif + setlocal suffixesadd=.erl,.hrl let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 0f6d36c2d2..7d59eab4c4 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -3,7 +3,7 @@ " Maintainer: Jason Franklin <vim@justemail.net> " Maintainer: SungHyun Nam <goweol@gmail.com> " Autoload Split: Bram Moolenaar -" Last Change: 2022 Jun 18 +" Last Change: 2022 Sep 30 " To make the ":Man" command available before editing a manual page, source " this script from your startup vimrc file. @@ -23,8 +23,9 @@ let s:cpo_save = &cpo set cpo-=C if &filetype == "man" - " allow dot and dash in manual page name. - setlocal iskeyword+=\.,- + " Allow hyphen, plus, colon, dot, and commercial at in manual page name. + " Allow parentheses for references. + setlocal iskeyword=48-57,_,a-z,A-Z,-,+,:,.,@-@,(,) let b:undo_ftplugin = "setlocal iskeyword<" " Add mappings, unless the user didn't want this. diff --git a/runtime/indent/erlang.vim b/runtime/indent/erlang.vim index 4e7bf4ef4d..7aa38587a6 100644 --- a/runtime/indent/erlang.vim +++ b/runtime/indent/erlang.vim @@ -4,7 +4,7 @@ " Contributors: Edwin Fine <efine145_nospam01 at usa dot net> " Pawel 'kTT' Salata <rockplayer.pl@gmail.com> " Ricardo Catalinas Jiménez <jimenezrick@gmail.com> -" Last Update: 2020-Jun-11 +" Last Update: 2022-Sep-06 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -30,7 +30,9 @@ else endif setlocal indentexpr=ErlangIndent() -setlocal indentkeys+=0=end,0=of,0=catch,0=after,0=when,0=),0=],0=},0=>> +setlocal indentkeys+=0=end,0=of,0=catch,0=after,0=else,0=when,0=),0=],0=},0=>> + +let b:undo_indent = "setl inde< indk<" " Only define the functions once if exists("*ErlangIndent") @@ -235,8 +237,8 @@ function! s:GetTokensFromLine(line, string_continuation, atom_continuation, " Two-character tokens elseif i + 1 < linelen && - \ index(['->', '<<', '>>', '||', '==', '/=', '=<', '>=', '++', '--', - \ '::'], + \ index(['->', '<<', '>>', '||', '==', '/=', '=<', '>=', '?=', '++', + \ '--', '::'], \ a:line[i : i + 1]) != -1 call add(indtokens, [a:line[i : i + 1], vcol, i]) let next_i = i + 2 @@ -558,8 +560,8 @@ function! s:IsCatchStandalone(lnum, i) let is_standalone = 0 elseif prev_token =~# '[a-z]' if index(['after', 'and', 'andalso', 'band', 'begin', 'bnot', 'bor', 'bsl', - \ 'bsr', 'bxor', 'case', 'catch', 'div', 'not', 'or', 'orelse', - \ 'rem', 'try', 'xor'], prev_token) != -1 + \ 'bsr', 'bxor', 'case', 'catch', 'div', 'maybe', 'not', 'or', + \ 'orelse', 'rem', 'try', 'xor'], prev_token) != -1 " If catch is after these keywords, it is standalone let is_standalone = 1 else @@ -568,7 +570,7 @@ function! s:IsCatchStandalone(lnum, i) " " Keywords: " - may precede 'catch': end - " - may not precede 'catch': fun if of receive when + " - may not precede 'catch': else fun if of receive when " - unused: cond let query let is_standalone = 0 endif @@ -577,7 +579,7 @@ function! s:IsCatchStandalone(lnum, i) let is_standalone = 0 else " This 'else' branch includes the following tokens: - " -> == /= =< < >= > =:= =/= + - * / ++ -- :: < > ; ( [ { ? = ! . | + " -> == /= =< < >= > ?= =:= =/= + - * / ++ -- :: < > ; ( [ { ? = ! . | let is_standalone = 1 endif @@ -590,6 +592,7 @@ endfunction " Purpose: " This function is called when a begin-type element ('begin', 'case', " '[', '<<', etc.) is found. It asks the caller to return if the stack +" if already empty. " Parameters: " stack: [token] " token: string @@ -758,7 +761,7 @@ endfunction function! s:SearchEndPair(lnum, curr_col) return s:SearchPair( \ a:lnum, a:curr_col, - \ '\C\<\%(case\|try\|begin\|receive\|if\)\>\|' . + \ '\C\<\%(case\|try\|begin\|receive\|if\|maybe\)\>\|' . \ '\<fun\>\%(\s\|\n\|%.*$\|[A-Z_@][a-zA-Z_@]*\)*(', \ '', \ '\<end\>') @@ -847,6 +850,7 @@ function! s:ErlangCalcIndent2(lnum, stack) if ret | return res | endif " case EXPR of BRANCHES end + " if BRANCHES end " try EXPR catch BRANCHES end " try EXPR after BODY end " try EXPR catch BRANCHES after BODY end @@ -855,15 +859,17 @@ function! s:ErlangCalcIndent2(lnum, stack) " try EXPR of BRANCHES catch BRANCHES after BODY end " receive BRANCHES end " receive BRANCHES after BRANCHES end + " maybe EXPR end + " maybe EXPR else BRANCHES end " This branch is not Emacs-compatible - elseif (index(['of', 'receive', 'after', 'if'], token) != -1 || + elseif (index(['of', 'receive', 'after', 'if', 'else'], token) != -1 || \ (token ==# 'catch' && !s:IsCatchStandalone(lnum, i))) && \ !last_token_of_line && \ (empty(stack) || stack ==# ['when'] || stack ==# ['->'] || \ stack ==# ['->', ';']) - " If we are after of/receive, but these are not the last + " If we are after of/receive/etc, but these are not the last " tokens of the line, we want to indent like this: " " % stack == [] @@ -889,21 +895,21 @@ function! s:ErlangCalcIndent2(lnum, stack) " stack = ['when'] => LTI is a guard if empty(stack) || stack == ['->', ';'] call s:Log(' LTI is in a condition after ' . - \'"of/receive/after/if/catch" -> return') + \'"of/receive/after/if/else/catch" -> return') return stored_vcol elseif stack == ['->'] call s:Log(' LTI is in a branch after ' . - \'"of/receive/after/if/catch" -> return') + \'"of/receive/after/if/else/catch" -> return') return stored_vcol + shiftwidth() elseif stack == ['when'] call s:Log(' LTI is in a guard after ' . - \'"of/receive/after/if/catch" -> return') + \'"of/receive/after/if/else/catch" -> return') return stored_vcol + shiftwidth() else return s:UnexpectedToken(token, stack) endif - elseif index(['case', 'if', 'try', 'receive'], token) != -1 + elseif index(['case', 'if', 'try', 'receive', 'maybe'], token) != -1 " stack = [] => LTI is a condition " stack = ['->'] => LTI is a branch @@ -913,45 +919,47 @@ function! s:ErlangCalcIndent2(lnum, stack) " pass elseif (token ==# 'case' && stack[0] ==# 'of') || \ (token ==# 'if') || + \ (token ==# 'maybe' && stack[0] ==# 'else') || \ (token ==# 'try' && (stack[0] ==# 'of' || \ stack[0] ==# 'catch' || \ stack[0] ==# 'after')) || \ (token ==# 'receive') " From the indentation point of view, the keyword - " (of/catch/after/end) before the LTI is what counts, so + " (of/catch/after/else/end) before the LTI is what counts, so< |