From e612a0a76a5c990220113e76ec6a07fe49c28618 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 27 Apr 2021 21:48:38 -0400 Subject: [PATCH] vim-patch:d1caa941d876 Update runtime files https://github.com/vim/vim/commit/d1caa941d876181aae0ebebc6ea954045bf0da24 Cherry-pick error E452 from patch v8.2.0486. --- runtime/autoload/ccomplete.vim | 4 +++- runtime/autoload/dist/ft.vim | 4 ++-- runtime/doc/change.txt | 2 +- runtime/doc/eval.txt | 32 +++++++++++++------------------- runtime/doc/help.txt | 4 ++-- runtime/doc/insert.txt | 8 ++++++++ runtime/doc/tagsrch.txt | 23 +++++++++++++++++++++++ runtime/doc/usr_22.txt | 4 ++-- runtime/doc/vim_diff.txt | 1 + runtime/ftplugin/rst.vim | 4 ++-- runtime/indent/rst.vim | 21 ++++++++++++++++++--- runtime/syntax/rst.vim | 24 ++++++++++++++++++------ runtime/syntax/vhdl.vim | 26 +++++++++++++------------- src/nvim/eval.c | 2 +- 14 files changed, 107 insertions(+), 52 deletions(-) diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim index 156b3af025..971e7367ce 100644 --- a/runtime/autoload/ccomplete.vim +++ b/runtime/autoload/ccomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2018 Aug 20 +" Last Change: 2020 Apr 08 let s:cpo_save = &cpo set cpo&vim @@ -635,3 +635,5 @@ endfunc let &cpo = s:cpo_save unlet s:cpo_save + +" vim: noet sw=2 sts=2 diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index d9632ffdc7..91f9585669 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -1,7 +1,7 @@ " Vim functions for file type detection " " Maintainer: Bram Moolenaar -" Last Change: 2020 Jan 02 +" Last Change: 2020 Mar 30 " These functions are moved here from runtime/filetype.vim to make startup " faster. @@ -325,7 +325,7 @@ endfunc func dist#ft#FTmm() let n = 1 - while n < 10 + while n < 20 let line = getline(n) if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)' setf objcpp diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 0f2ffa487c..5671a29356 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1402,7 +1402,7 @@ text. Put it in your autoload directory, e.g. ~/.vim/autoload/format.vim: > func! format#Format() " only reformat on explicit gq command if mode() != 'n' - " fall back to Vims internal reformatting + " fall back to Vim's internal reformatting return 1 endif let lines = getline(v:lnum, v:lnum + v:count - 1) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8558493520..c14af9001c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4446,10 +4446,11 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but - includes an extra item in the list: - [bufnum, lnum, col, off, curswant] ~ - The "curswant" number is the preferred column when moving the + includes an extra "curswant" in the list: + [0, lnum, col, off, curswant] ~ + The "curswant" number is the preferred column when moving the cursor vertically. Also see |getpos()|. + The first "bufnum" item is always zero. This can be used to save and restore the cursor position: > let save_cursor = getcurpos() @@ -7790,18 +7791,10 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()* Returns zero for success, -1 for failure. - Examples: - Set current index of the tag stack to 4: > - call settagstack(1005, {'curidx' : 4}) - -< Empty the tag stack of window 3: > + Examples (for more examples see |tagstack-examples||): + Empty the tag stack of window 3: > call settagstack(3, {'items' : []}) -< Push a new item onto the tag stack: > - let pos = [bufnr('myfile.txt'), 10, 1, 0] - let newtag = [{'tagname' : 'mytag', 'from' : pos}] - call settagstack(2, {'items' : newtag}, 'a') - < Save and restore the tag stack: > let stack = gettagstack(1003) " do something else @@ -9581,8 +9574,8 @@ It is allowed to define another function inside a function body. You can provide default values for positional named arguments. This makes them optional for function calls. When a positional argument is not specified at a call, the default expression is used to initialize it. -This only works for functions declared with |function|, not for lambda -expressions |expr-lambda|. +This only works for functions declared with |function|, not for +lambda expressions |expr-lambda|. Example: > function Something(key, value = 10) @@ -9611,9 +9604,10 @@ Example that does NOT work: > :function NoGood(first = a:second, second = 10) :endfunction < -When not using "...", the number of arguments in a function call must be equal -to the number of mandatory named arguments. When using "...", the number of -arguments may be larger. +When not using "...", the number of arguments in a function call must be at +least equal to the number of mandatory named arguments. When using "...", the +number of arguments may be larger than the total of mandatory and optional +arguments. *local-variables* Inside a function local variables can be used. These will disappear when the @@ -9943,7 +9937,7 @@ This does NOT work: > Like above, but append/add/subtract the value for each |List| item. -:let [{name}, ..., ; {lastname}] = {expr1} +:let [{name}, ..., ; {lastname}] = {expr1} *E452* Like |:let-unpack| above, but the |List| may have more items than there are names. A list of the remaining items is assigned to {lastname}. If there are no diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 52a66c9df5..e3ddb5f687 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -30,7 +30,7 @@ Get specific help: It is possible to go directly to whatever you want help help entries for "word". Or use ":helpgrep word". |:helpgrep| - Getting started: Do the Vim tutor, a 20 minute interactive training for the + Getting started: Do the Vim tutor, a 30-minute interactive course for the basic commands, see |vimtutor|. Read the user manual from start to end: |usr_01.txt| @@ -40,7 +40,7 @@ through the help of many others. See |credits|. *doc-file-list* *Q_ct* BASIC: |quickref| Overview of the most common commands you will use -|tutor| 20 minutes training course for beginners +|tutor| 30-minute interactive course for beginners |copying| About copyrights |iccf| Helping poor children in Uganda |sponsor| Sponsor Vim development, become a registered Vim user diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 60807821c7..006d5a933d 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -143,6 +143,8 @@ CTRL-R CTRL-R {register} *i_CTRL-R_CTRL-R* you also want to avoid these, use CTRL-R CTRL-O, see below. The '.' register (last inserted text) is still inserted as typed. + After this command, the '.' register contains the text from + the register as if it was inserted by typing it. CTRL-R CTRL-O {register} *i_CTRL-R_CTRL-O* Insert the contents of a register literally and don't @@ -152,6 +154,9 @@ CTRL-R CTRL-O {register} *i_CTRL-R_CTRL-O* Does not replace characters! The '.' register (last inserted text) is still inserted as typed. + After this command, the '.' register contains the command + typed and not the text. I.e., the literals "^R^O" and not the + text from the register. CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P* Insert the contents of a register literally and fix the @@ -159,6 +164,9 @@ CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P* Does not replace characters! The '.' register (last inserted text) is still inserted as typed. + After this command, the '.' register contains the command + typed and not the text. I.e., the literals "^R^P" and not the + text from the register. *i_CTRL-T* CTRL-T Insert one shiftwidth of indent at the start of the current diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 240765fa2d..859c68cd36 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -179,6 +179,29 @@ commands explained above the tag stack will look like this: The |gettagstack()| function returns the tag stack of a specified window. The |settagstack()| function modifies the tag stack of a window. + *tagstack-examples* +Write to the tag stack just like `:tag` but with a user-defined +jumper#jump_to_tag function: > + " Store where we're jumping from before we jump. + let tag = expand('') + let pos = [bufnr()] + getcurpos()[1:] + let item = {'bufnr': pos[0], 'from': pos, 'tagname': tag} + if jumper#jump_to_tag(tag) + " Jump was successful, write previous location to tag stack. + let winid = win_getid() + let stack = gettagstack(winid) + let stack['items'] = [item] + call settagstack(winid, stack, 't') + endif +< +Set current index of the tag stack to 4: > + call settagstack(1005, {'curidx' : 4}) +< +Push a new item onto the tag stack: > + let pos = [bufnr('myfile.txt'), 10, 1, 0] + let newtag = [{'tagname' : 'mytag', 'from' : pos}] + call settagstack(2, {'items' : newtag}, 'a') +< *E73* When you try to use the tag stack while it doesn't contain anything you will get an error message. diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt index 7c78146056..56fe5ada2b 100644 --- a/runtime/doc/usr_22.txt +++ b/runtime/doc/usr_22.txt @@ -84,7 +84,7 @@ browser. This is what you get: > a................Hiding Files or Directories................|netrw-a| mb...............Bookmarking a Directory....................|netrw-mb| gb...............Changing to a Bookmarked Directory.........|netrw-gb| - c................Make Browsing Directory The Current Dir....|netrw-c| + cd...............Make Browsing Directory The Current Dir....|netrw-c| d................Make A New Directory.......................|netrw-d| D................Deleting Files or Directories..............|netrw-D| ............Edit File/Directory Hiding List............|netrw-ctrl-h| @@ -121,7 +121,7 @@ The following normal-mode commands may be used to control the browser display: As a sampling of extra normal-mode commands: - c Change Vim's notion of the current directory to be + cd Change Vim's notion of the current directory to be the same as the browser directory. (see |g:netrw_keepdir| to control this, too) R Rename the file or directory under the cursor; a diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 90953a4721..2c39fdb53c 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -505,6 +505,7 @@ Test functions: test_null_blob() test_null_channel() test_null_dict() + test_null_function() test_null_job() test_null_list() test_null_partial() diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index f0646e9f36..ff7a402d10 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -3,7 +3,7 @@ " Maintainer: Marshall Ward " Original Maintainer: Nikolai Weibull " Website: https://github.com/marshallward/vim-restructuredtext -" Latest Revision: 2018-12-29 +" Latest Revision: 2020-03-31 if exists("b:did_ftplugin") finish @@ -34,7 +34,7 @@ if exists("g:rst_style") && g:rst_style != 0 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 endif -if has('patch-7.3.867') " Introduced the TextChanged event. +if g:rst_fold_enabled != 0 && has('patch-7.3.867') " Introduced the TextChanged event. setlocal foldmethod=expr setlocal foldexpr=RstFold#GetRstFold() setlocal foldtext=RstFold#GetRstFoldText() diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim index c1ef8c9957..a31ad8e080 100644 --- a/runtime/indent/rst.vim +++ b/runtime/indent/rst.vim @@ -1,7 +1,9 @@ " Vim indent file -" Language: reStructuredText Documentation Format -" Previous Maintainer: Nikolai Weibull -" Latest Revision: 2011-08-03 +" Vim reST indent file +" Language: reStructuredText Documentation Format +" Maintainer: Marshall Ward +" Previous Maintainer: Nikolai Weibull +" Latest Revision: 2020-03-31 if exists("b:did_indent") finish @@ -18,6 +20,12 @@ endif let s:itemization_pattern = '^\s*[-*+]\s' let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+' +let s:note_pattern = '^\.\. ' + +function! s:get_paragraph_start() + let paragraph_mark_start = getpos("'{")[1] + return getline(paragraph_mark_start) =~ '\S' ? paragraph_mark_start : paragraph_mark_start + 1 +endfunction function GetRSTIndent() let lnum = prevnonblank(v:lnum - 1) @@ -28,6 +36,13 @@ function GetRSTIndent() let ind = indent(lnum) let line = getline(lnum) + let psnum = s:get_paragraph_start() + if psnum != 0 + if getline(psnum) =~ s:note_pattern + let ind = 3 + endif + endif + if line =~ s:itemization_pattern let ind += 2 elseif line =~ s:enumeration_pattern diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index c865cf6905..a90c90be21 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -1,9 +1,9 @@ -" Vim syntax file +" Vim reST syntax file " Language: reStructuredText documentation format " Maintainer: Marshall Ward " Previous Maintainer: Nikolai Weibull " Website: https://github.com/marshallward/vim-restructuredtext -" Latest Revision: 2018-12-29 +" Latest Revision: 2020-03-31 if exists("b:current_syntax") finish @@ -21,7 +21,7 @@ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, \ rstInlineInternalTargets,rstFootnoteReference,rstHyperlinkReference syn region rstLiteralBlock matchgroup=rstDelimiter - \ start='::\_s*\n\ze\z(\s\+\)' skip='^$' end='^\z1\@!' + \ start='\(^\z(\s*\).*\)\@<=::\n\s*\n' skip='^\s*$' end='^\(\z1\s\+\)\@!' \ contains=@NoSpell syn region rstQuotedLiteralBlock matchgroup=rstDelimiter @@ -90,16 +90,28 @@ execute 'syn match rstSubstitutionDefinition contained' . \ ' /|.*|\_s\+/ nextgroup=@rstDirectives' function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_right) + " Only escape the first char of a multichar delimiter (e.g. \* inside **) + if a:start[0] == '\' + let first = a:start[0:1] + else + let first = a:start[0] + endif + + execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained' + execute 'syn region rst' . a:name . \ ' start=+' . a:char_left . '\zs' . a:start . \ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' . \ a:middle . - \ ' end=+\S' . a:end . '\ze\%($\|\s\|[''"’)\]}>/:.,;!?\\-]\)+' + \ ' end=+' . a:end . '\ze\%($\|\s\|[''"’)\]}>/:.,;!?\\-]\)+' . + \ ' contains=rstEscape' . a:name + + execute 'hi def link rstEscape'.a:name.' Special' endfunction function! s:DefineInlineMarkup(name, start, middle, end) let middle = a:middle != "" ? - \ (' skip=+\\\\\|\\' . a:middle . '+') : + \ (' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+') : \ "" call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'") @@ -161,7 +173,7 @@ syn match rstStandaloneHyperlink contains=@NoSpell \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" syn region rstCodeBlock contained matchgroup=rstDirective - \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s\+.*\_s*\n\ze\z(\s\+\)+ + \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s*\(\S*\)\?\s*\n\%(\s*:.*:\s*.*\s*\n\)*\n\ze\z(\s\+\)+ \ skip=+^$+ \ end=+^\z1\@!+ \ contains=@NoSpell diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim index b40b096525..06fc2e795e 100644 --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -3,7 +3,7 @@ " Maintainer: Daniel Kho " Previous Maintainer: Czo " Credits: Stephan Hegel -" Last Changed: 2020 Mar 09 by Daniel Kho +" Last Changed: 2020 Apr 04 by Daniel Kho " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -16,10 +16,10 @@ set cpo&vim " case is not significant syn case ignore -" VHDL keywords -syn keyword vhdlStatement access after alias all assert +" VHDL 1076-2019 keywords +syn keyword vhdlStatement access after alias all syn keyword vhdlStatement architecture array attribute -syn keyword vhdlStatement assume assume_guarantee +syn keyword vhdlStatement assert assume syn keyword vhdlStatement begin block body buffer bus syn keyword vhdlStatement case component configuration constant syn keyword vhdlStatement context cover @@ -34,20 +34,19 @@ syn keyword vhdlStatement map syn keyword vhdlStatement new next null syn keyword vhdlStatement of on open others out syn keyword vhdlStatement package port postponed procedure process pure -syn keyword vhdlStatement parameter property protected +syn keyword vhdlStatement parameter property protected private syn keyword vhdlStatement range record register reject report return -syn keyword vhdlStatement release restrict restrict_guarantee -syn keyword vhdlStatement select severity signal shared -syn keyword vhdlStatement subtype +syn keyword vhdlStatement release restrict +syn keyword vhdlStatement select severity signal shared subtype syn keyword vhdlStatement sequence strong syn keyword vhdlStatement then to transport type syn keyword vhdlStatement unaffected units until use -syn keyword vhdlStatement variable -" VHDL-2019 interface -syn keyword vhdlStatement view -syn keyword vhdlStatement vmode vprop vunit +syn keyword vhdlStatement variable view +syn keyword vhdlStatement vpkg vmode vprop vunit syn keyword vhdlStatement wait when while with -syn keyword vhdlStatement note warning error failure + +" VHDL predefined severity levels +syn keyword vhdlAttribute note warning error failure " Linting of conditionals. syn match vhdlStatement "\<\(if\|else\)\>" @@ -265,4 +264,5 @@ let b:current_syntax = "vhdl" let &cpo = s:cpo_save unlet s:cpo_save + " vim: ts=8 diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 2c21f82aeb..079c0dc3c0 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1575,7 +1575,7 @@ static const char_u *skip_var_list(const char_u *arg, int *var_count, break; else if (*p == ';') { if (*semicolon == 1) { - EMSG(_("Double ; in list of variables")); + EMSG(_("E452: Double ; in list of variables")); return NULL; } *semicolon = 1;