diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-02 17:19:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-02 17:19:11 +0200 |
commit | 4c295027a426986566cd7a76c47a6d3a529727e7 (patch) | |
tree | fd90535889a3a7d05ebd9406bcb91dfcf8a17ded | |
parent | 5f628a12e5c7ebd1145ae1c089d1be1751b700c1 (diff) |
Update runtime files
-rw-r--r-- | .github/CODEOWNERS | 4 | ||||
-rw-r--r-- | nsis/lang/english.nsi | 2 | ||||
-rw-r--r-- | runtime/autoload/syntaxcomplete.vim | 148 | ||||
-rw-r--r-- | runtime/doc/autocmd.txt | 11 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 7 | ||||
-rw-r--r-- | runtime/doc/gui.txt | 7 | ||||
-rw-r--r-- | runtime/doc/index.txt | 2 | ||||
-rw-r--r-- | runtime/doc/map.txt | 11 | ||||
-rw-r--r-- | runtime/doc/options.txt | 5 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 25 | ||||
-rw-r--r-- | runtime/doc/tags | 4 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 51 | ||||
-rw-r--r-- | runtime/doc/usr_02.txt | 4 | ||||
-rw-r--r-- | runtime/doc/vim9.txt | 93 | ||||
-rw-r--r-- | runtime/ftplugin/fpcmake.vim | 25 | ||||
-rw-r--r-- | runtime/ftplugin/pascal.vim | 52 | ||||
-rw-r--r-- | runtime/indent/make.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/conf.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/fpcmake.vim | 58 | ||||
-rw-r--r-- | runtime/syntax/pascal.vim | 104 |
20 files changed, 425 insertions, 198 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 94491d5657..e4b0aa9fd7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -78,6 +78,7 @@ runtime/ftplugin/css.vim @dkearns runtime/ftplugin/cucumber.vim @tpope runtime/ftplugin/eiffel.vim @dkearns runtime/ftplugin/eruby.vim @tpope @dkearns +runtime/ftplugin/fpcmake.vim @dkearns runtime/ftplugin/freebasic.vim @dkearns runtime/ftplugin/git.vim @tpope runtime/ftplugin/gitcommit.vim @tpope @@ -98,6 +99,7 @@ runtime/ftplugin/matlab.vim @cecamp runtime/ftplugin/modula3.vim @dkearns runtime/ftplugin/nroff.vim @a-vrma runtime/ftplugin/nsis.vim @k-takata +runtime/ftplugin/pascal.vim @dkearns runtime/ftplugin/pdf.vim @tpope runtime/ftplugin/ps1.vim @heaths runtime/ftplugin/ps1xml.vim @heaths @@ -157,6 +159,7 @@ runtime/syntax/dtd.vim @chrisbra runtime/syntax/elmfilt.vim @cecamp runtime/syntax/eruby.vim @tpope @dkearns runtime/syntax/exports.vim @cecamp +runtime/syntax/fpcmake.vim @dkearns runtime/syntax/git.vim @tpope runtime/syntax/gitcommit.vim @tpope runtime/syntax/gitconfig.vim @tpope @@ -181,6 +184,7 @@ runtime/syntax/modula3.vim @dkearns runtime/syntax/netrw.vim @cecamp runtime/syntax/nroff.vim @jmarshall runtime/syntax/nsis.vim @k-takata +runtime/syntax/pascal.vim @dkearns runtime/syntax/pdf.vim @tpope runtime/syntax/php.vim @TysonAndre runtime/syntax/privoxy.vim @dkearns diff --git a/nsis/lang/english.nsi b/nsis/lang/english.nsi index 6b7aa28304..218c70a47c 100644 --- a/nsis/lang/english.nsi +++ b/nsis/lang/english.nsi @@ -24,7 +24,7 @@ LangString ^UninstallCaption ${LANG_ENGLISH} \ # "Destination Folder (Must end with $\"vim$\")" LangString str_show_readme ${LANG_ENGLISH} \ - "Show README after installation finish" + "Show README after installation finished" # Install types: LangString str_type_typical ${LANG_ENGLISH} \ diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim index 6ba262b9aa..396193d8b0 100644 --- a/runtime/autoload/syntaxcomplete.vim +++ b/runtime/autoload/syntaxcomplete.vim @@ -1,12 +1,16 @@ " Vim completion script " Language: All languages, uses existing syntax highlighting rules " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Version: 14.0 -" Last Change: 2020 Dec 30 +" Version: 15.0 +" Last Change: 2021 Apr 27 " Usage: For detailed help, ":help ft-syntax-omni" " History " +" Version 15.0 +" - SyntaxComplete ignored all buffer specific overrides, always used global +" https://github.com/vim/vim/issues/8153 +" " Version 14.0 " - Fixed issue with single quotes and is_keyword " https://github.com/vim/vim/issues/7463 @@ -42,7 +46,7 @@ " let g:omni_syntax_use_single_byte = 1 " - This by default will only allow single byte ASCII " characters to be added and an additional check to ensure -" the charater is printable (see documentation for isprint). +" the character is printable (see documentation for isprint). " " Version 9.0 " - Add the check for cpo. @@ -90,7 +94,7 @@ endif if exists('g:loaded_syntax_completion') finish endif -let g:loaded_syntax_completion = 130 +let g:loaded_syntax_completion = 150 " Turn on support for line continuations when creating the script let s:cpo_save = &cpo @@ -145,14 +149,10 @@ let s:prepended = '' " This function is used for the 'omnifunc' option. function! syntaxcomplete#Complete(findstart, base) - " Only display items in the completion window that are at least - " this many characters in length - if !exists('b:omni_syntax_ignorecase') - if exists('g:omni_syntax_ignorecase') - let b:omni_syntax_ignorecase = g:omni_syntax_ignorecase - else - let b:omni_syntax_ignorecase = &ignorecase - endif + " Allow user to override ignorecase per buffer + let l:omni_syntax_ignorecase = g:omni_syntax_ignorecase + if exists('b:omni_syntax_ignorecase') + let l:omni_syntax_ignorecase = b:omni_syntax_ignorecase endif if a:findstart @@ -183,7 +183,6 @@ function! syntaxcomplete#Complete(findstart, base) endif " let base = s:prepended . a:base - " let base = s:prepended let base = substitute(s:prepended, "'", "''", 'g') let filetype = substitute(&filetype, '\.', '_', 'g') @@ -200,13 +199,13 @@ function! syntaxcomplete#Complete(findstart, base) if base != '' " let compstr = join(compl_list, ' ') - " let expr = (b:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*' + " let expr = (l:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*' " let compstr = substitute(compstr, expr, '', 'g') " let compl_list = split(compstr, '\s\+') " Filter the list based on the first few characters the user " entered - let expr = 'v:val '.(g:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'" + let expr = 'v:val '.(l:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'" let compl_list = filter(deepcopy(compl_list), expr) endif @@ -227,6 +226,26 @@ function! syntaxcomplete#OmniSyntaxList(...) endif endfunc +function! syntaxcomplete#OmniSyntaxClearCache() + let s:cache_name = [] + let s:cache_list = [] +endfunction + +" To retrieve all syntax items regardless of syntax group: +" echo OmniSyntaxList( [] ) +" +" To retrieve only the syntax items for the sqlOperator syntax group: +" echo OmniSyntaxList( ['sqlOperator'] ) +" +" To retrieve all syntax items for both the sqlOperator and sqlType groups: +" echo OmniSyntaxList( ['sqlOperator', 'sqlType'] ) +" +" A regular expression can also be used: +" echo OmniSyntaxList( ['sql\w\+'] ) +" +" From within a plugin, you would typically assign the output to a List: > +" let myKeywords = [] +" let myKeywords = OmniSyntaxList( ['sqlKeyword'] ) function! OmniSyntaxList(...) let list_parms = [] if a:0 > 0 @@ -244,37 +263,25 @@ function! OmniSyntaxList(...) " let use_dictionary = a:1 " endif - " Only display items in the completion window that are at least - " this many characters in length - if !exists('b:omni_syntax_use_iskeyword') - if exists('g:omni_syntax_use_iskeyword') - let b:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword - else - let b:omni_syntax_use_iskeyword = 1 - endif - endif - - " Only display items in the completion window that are at least - " this many characters in length - if !exists('b:omni_syntax_minimum_length') - if exists('g:omni_syntax_minimum_length') - let b:omni_syntax_minimum_length = g:omni_syntax_minimum_length - else - let b:omni_syntax_minimum_length = 0 - endif - endif - let saveL = @l let filetype = substitute(&filetype, '\.', '_', 'g') if empty(list_parms) + " Allow user to override per buffer + if exists('g:omni_syntax_group_include_'.filetype) + let l:omni_syntax_group_include_{filetype} = g:omni_syntax_group_include_{filetype} + endif + if exists('b:omni_syntax_group_include_'.filetype) + let l:omni_syntax_group_include_{filetype} = b:omni_syntax_group_include_{filetype} + endif + " Default the include group to include the requested syntax group let syntax_group_include_{filetype} = '' " Check if there are any overrides specified for this filetype - if exists('g:omni_syntax_group_include_'.filetype) + if exists('l:omni_syntax_group_include_'.filetype) let syntax_group_include_{filetype} = - \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') - let list_parms = split(g:omni_syntax_group_include_{filetype}, ',') + \ substitute( l:omni_syntax_group_include_{filetype},'\s\+','','g') + let list_parms = split(l:omni_syntax_group_include_{filetype}, ',') if syntax_group_include_{filetype} =~ '\w' let syntax_group_include_{filetype} = \ substitute( syntax_group_include_{filetype}, @@ -329,11 +336,20 @@ function! OmniSyntaxList(...) else " Default the exclude group to nothing let syntax_group_exclude_{filetype} = '' - " Check if there are any overrides specified for this filetype + + " Allow user to override per buffer if exists('g:omni_syntax_group_exclude_'.filetype) + let l:omni_syntax_group_exclude_{filetype} = g:omni_syntax_group_exclude_{filetype} + endif + if exists('b:omni_syntax_group_exclude_'.filetype) + let l:omni_syntax_group_exclude_{filetype} = b:omni_syntax_group_exclude_{filetype} + endif + + " Check if there are any overrides specified for this filetype + if exists('l:omni_syntax_group_exclude_'.filetype) let syntax_group_exclude_{filetype} = - \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') - let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',') + \ substitute( l:omni_syntax_group_exclude_{filetype},'\s\+','','g') + let list_exclude_groups = split(l:omni_syntax_group_exclude_{filetype}, ',') if syntax_group_exclude_{filetype} =~ '\w' let syntax_group_exclude_{filetype} = \ substitute( syntax_group_exclude_{filetype}, @@ -529,6 +545,30 @@ endfunction function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) + " Allow user to override iskeyword per buffer + let l:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword + if exists('b:omni_syntax_use_iskeyword') + let l:omni_syntax_use_iskeyword = b:omni_syntax_use_iskeyword + endif + + " Allow user to override iskeyword_numeric per buffer + let l:omni_syntax_use_iskeyword_numeric = g:omni_syntax_use_iskeyword_numeric + if exists('b:omni_syntax_use_iskeyword_numeric') + let l:omni_syntax_use_iskeyword_numeric = b:omni_syntax_use_iskeyword_numeric + endif + + " Allow user to override iskeyword_numeric per buffer + let l:omni_syntax_use_single_byte = g:omni_syntax_use_single_byte + if exists('b:omni_syntax_use_single_byte') + let l:omni_syntax_use_single_byte = b:omni_syntax_use_single_byte + endif + + " Allow user to override minimum_length per buffer + let l:omni_syntax_minimum_length = g:omni_syntax_minimum_length + if exists('b:omni_syntax_minimum_length') + let l:omni_syntax_minimum_length = b:omni_syntax_minimum_length + endif + let syn_list = "" " From the full syntax listing, strip out the portion for the @@ -647,14 +687,23 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) \ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)' \ , "", 'g' \ ) - - if b:omni_syntax_use_iskeyword == 0 + + if l:omni_syntax_use_iskeyword == 0 " There are a number of items which have non-word characters in " them, *'T_F1'*. vim.vim is one such file. " This will replace non-word characters with spaces. + " setlocal filetype=forth + " let g:omni_syntax_use_iskeyword = 1 + " let g:omni_syntax_use_iskeyword_numeric = 1 + " You will see entries like + " #>> + " (.local) + " These were found doing a grep in vim82\syntax + " grep iskeyword * + " forth.vim:setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' ) else - if g:omni_syntax_use_iskeyword_numeric == 1 + if l:omni_syntax_use_iskeyword_numeric == 1 " iskeyword can contain value like this " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 " Numeric values convert to their ASCII equivalent using the @@ -674,7 +723,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " cycle through each character within the range let [b:start, b:end] = split(item, '-') for range_item in range( b:start, b:end ) - if range_item <= 127 || g:omni_syntax_use_single_byte == 0 + if range_item <= 127 || l:omni_syntax_use_single_byte == 0 if nr2char(range_item) =~ '\p' let accepted_chars = accepted_chars . nr2char(range_item) endif @@ -682,13 +731,13 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) endfor elseif item =~ '^\d\+$' " Only numeric, translate to a character - if item < 127 || g:omni_syntax_use_single_byte == 0 + if item < 127 || l:omni_syntax_use_single_byte == 0 if nr2char(item) =~ '\p' let accepted_chars = accepted_chars . nr2char(item) endif endif else - if char2nr(item) < 127 || g:omni_syntax_use_single_byte == 0 + if char2nr(item) < 127 || l:omni_syntax_use_single_byte == 0 if item =~ '\p' let accepted_chars = accepted_chars . item endif @@ -724,9 +773,9 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) endif endif - if b:omni_syntax_minimum_length > 0 + if l:omni_syntax_minimum_length > 0 " If the user specified a minimum length, enforce it - let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.b:omni_syntax_minimum_length.'}\ze ', ' ', 'g') + let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.l:omni_syntax_minimum_length.'}\ze ', ' ', 'g') endif else let syn_list = '' @@ -756,5 +805,6 @@ function! OmniSyntaxShowChars(spec) endfor return join(map(result, 'nr2char(v:val)'), ', ') endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 328d6ff6a5..ee2dc562b2 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.2. Last change: 2021 Mar 13 +*autocmd.txt* For Vim version 8.2. Last change: 2021 Apr 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1522,7 +1522,14 @@ option will not cause any commands to be executed. loaded buffer. The current buffer is done last. Note that [fname] is used to select the autocommands, - not the buffers to which they are applied. + not the buffers to which they are applied. Example: > + augroup mine + autocmd! + autocmd FileType * echo expand('<amatch>') + augroup END + doautoall mine FileType Loaded-Buffer +< Sourcing this script, you'll see as many + "Loaded-Buffer" echoed as there are loaded buffers. Careful: Don't use this for autocommands that delete a buffer, change to another buffer or change the diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 798f58da54..920ee10b22 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Apr 07 +*eval.txt* For Vim version 8.2. Last change: 2021 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1962,6 +1962,9 @@ v:fcs_choice What should happen after a |FileChangedShell| event was The default is empty. If another (invalid) value is used then Vim behaves like it is empty, there is no warning message. + *v:fname* *fname-variable* +v:fname The file name set by 'includeexpr'. Empty otherwise. + *v:fname_in* *fname_in-variable* v:fname_in The name of the input file. Valid while evaluating: option used for ~ @@ -5775,7 +5778,6 @@ getmousepos() *getmousepos()* If the mouse is over a popup window then that window is used. - When using |getchar()| the Vim variables |v:mouse_lnum|, |v:mouse_col| and |v:mouse_winid| also provide these values. @@ -6721,6 +6723,7 @@ islocked({expr}) *islocked()* *E786* < When {expr} is a variable that does not exist you get an error message. Use |exists()| to check for existence. + In Vim9 script it does not work for local variables. Can also be used as a |method|: > GetName()->islocked() diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index ac8febebee..c93a050480 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 8.2. Last change: 2020 Sep 28 +*gui.txt* For Vim version 8.2. Last change: 2021 May 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -620,6 +620,11 @@ expression register: > :amenu Insert.foobar "='foobar'<CR>P +The special text <Cmd> begins a "command menu", it executes the command +directly without changing modes. Where you might use ":...<CR>" you can +instead use "<Cmd>...<CR>". See |<Cmd>| for more info. Example: > + anoremenu File.Next <Cmd>next<CR> + Note that the '<' and 'k' flags in 'cpoptions' also apply here (when included they make the <> form and raw key codes not being recognized). diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index f0e8f30fae..57493097b1 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.2. Last change: 2021 Mar 22 +*index.txt* For Vim version 8.2. Last change: 2021 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 47e706bc22..13b2c2efca 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2021 Mar 17 +*map.txt* For Vim version 8.2. Last change: 2021 Apr 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -244,9 +244,12 @@ have a look at |maparg()|. If the first argument to one of these commands is "<expr>" and it is used to define a new mapping or abbreviation, the argument is an expression. The expression is evaluated to obtain the {rhs} that is used. Example: > - :inoremap <expr> . InsertDot() -The result of the InsertDot() function will be inserted. It could check the + :inoremap <expr> . <SID>InsertDot() +The result of the s:InsertDot() function will be inserted. It could check the text before the cursor and start omni completion when some condition is met. +Using a script-local function is preferred, to avoid polluting the global +namespace. Use <SID> in the RHS so that the script that the mapping was +defined in can be found. For abbreviations |v:char| is set to the character that was typed to trigger the abbreviation. You can use this to decide how to expand the {lhs}. You @@ -261,7 +264,7 @@ input. Example: > call popup_create(... arguments ...) return "\<Ignore>" endfunc - nnoremap <expr> <F3> <Sid>OpenPopup() + nnoremap <expr> <F3> <SID>OpenPopup() Also, keep in mind that the expression may be evaluated when looking for typeahead, before the previous command has been executed. For example: > diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 266ab46e3f..84969b23f6 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Apr 17 +*options.txt* For Vim version 8.2. Last change: 2021 Apr 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4564,7 +4564,8 @@ A jump table for the options with a short description can be found at |Q_op|. Keywords are used in searching and recognizing with many commands: "w", "*", "[i", etc. It is also used for "\k" in a |pattern|. See 'isfname' for a description of the format of this option. For '@' - characters above 255 check the "word" character class. + characters above 255 check the "word" character class (any character + that is not white space or punctuation). For C programs you could use "a-z,A-Z,48-57,_,.,-,>". For a help file it is set to all non-blank printable characters except '*', '"' and '|' (so that CTRL-] on a command finds the help for that diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index ae29987940..fcade001ae 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.2. Last change: 2021 Feb 05 +*quickfix.txt* For Vim version 8.2. Last change: 2021 Apr 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1013,8 +1013,6 @@ commands can be combined to create a NewGrep command: > the error list to the matches. Files matching 'wildignore' are ignored; files in 'suffixes' are searched last. - Without the 'g' flag each line is added only once. - With 'g' every match is added. {pattern} is a Vim search pattern. Instead of enclosing it in / any non-ID character (see @@ -1026,6 +1024,22 @@ commands can be combined to create a NewGrep command: > If {pattern} is empty (e.g. // is specified), the last used search pattern is used. |last-pattern| + Flags: + 'g' Without the 'g' flag each line is added only + once. With 'g' every match is added. + + 'j' Without the 'j' flag Vim jumps to the first + match. With 'j' only the quickfix list is + updated. With the [!] any changes in the current + buffer are abandoned. + + 'f' When the 'f' flag is specified, fuzzy string + matching is used to find matching lines. In this + case, {pattern} is treated as a literal string + instead of a regular expression. See + |matchfuzzy()| for more info about fuzzy + matching. + |QuickFixCmdPre| and |QuickFixCmdPost| are triggered. A file that is opened for matching may use a buffer number, but it is reused if possible to avoid @@ -1038,11 +1052,6 @@ commands can be combined to create a NewGrep command: > Useful if you only want to check if there is a match and quit quickly when it's found. - Without the 'j' flag Vim jumps to the first match. - With 'j' only the quickfix list is updated. - With the [!] any changes in the current buffer are - abandoned. - Every second or so the searched file name is displayed to give you an idea of the progress made. Examples: > diff --git a/runtime/doc/tags b/runtime/doc/tags index 2af7217cc1..cdaa66417a 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2630,6 +2630,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :left change.txt /*:left* :lefta windows.txt /*:lefta* :leftabove windows.txt /*:leftabove* +:leg vim9.txt /*:leg* +:legacy vim9.txt /*:legacy* :let eval.txt /*:let* :let%= eval.txt /*:let%=* :let+= eval.txt /*:let+=* @@ -6439,6 +6441,7 @@ floating-point-format eval.txt /*floating-point-format* floating-point-precision eval.txt /*floating-point-precision* floor() eval.txt /*floor()* fmod() eval.txt /*fmod()* +fname-variable eval.txt /*fname-variable* fname_diff-variable eval.txt /*fname_diff-variable* fname_in-variable eval.txt /*fname_in-variable* fname_new-variable eval.txt /*fname_new-variable* @@ -9875,6 +9878,7 @@ v:exiting eval.txt /*v:exiting* v:false eval.txt /*v:false* v:fcs_choice eval.txt /*v:fcs_choice* v:fcs_reason eval.txt /*v:fcs_reason* +v:fname eval.txt /*v:fname* v:fname_diff eval.txt /*v:fname_diff* v:fname_in eval.txt /*v:fname_in* v:fname_new eval.txt /*v:fname_new* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 612e28c89e..955c3f6d9a 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Apr 21 +*todo.txt* For Vim version 8.2. Last change: 2021 Apr 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -39,13 +39,6 @@ browser use: https://github.com/vim/vim/issues/1234 -------------------- Known bugs and current work ----------------------- Vim9 - Make everything work: -- Compile builtin functions that access local variables: - islocked() -- When evaluating constants for script variables, some functions could work: - has('asdf'), len('string') - eval_variable(). Should pass the ".xxx" that follows and return that. -- Make "++nr" work. "++g:count" doesn't work, thinks it is a range. -- Reload: How to make sure type of script function hasn't changed? - expandcmd() with `=expr` in filename uses legacy expression. - eval_expr() in ex_cexpr() - eval_expr() call in dbg_parsearg() and debuggy_find() @@ -64,6 +57,17 @@ Vim9 - Make everything work: the type of the list or dict member. (#8092) - Allow for using an autoload function name without quotes. It is then loaded (and compiled) right away. #8124 +- Test more expressions in legacy and Vim9 script, using + CheckLegacyAndVim9Success() +- Test try/catch and throw better, also nested. + Test that return inside try/finally jumps to finally and then returns. +- Test that a function defined inside a :def function is local to that + function, g: functions can be defined and script-local functions cannot be + defined. +- Make debugging work - at least per function. Need to recompile a function + to step through it line-by-line? Evaluate the stack and variables on the + stack? +- Reserve command for future use: :type, :class, :enum Once Vim9 is stable: - Change the help to prefer Vim9 syntax where appropriate @@ -73,34 +77,17 @@ Once Vim9 is stable: - Use Vim9 for runtime files. PR #7497 for autoload/ccomplete.vim -Also for Vim9: +Further Vim9 improvements, possibly after launch: - better implementation for partial and tests for that. -- Make "g:imported = Export.exported" work in Vim9 script. -- Make Foo.Bar() work to call the dict function. (#5676) -- Error in any command in "vim9script" aborts sourcing. -- Find a way to test expressions in legacy and Vim9 script without duplication -- Test try/catch and throw better, also nested. - Test that return inside try/finally jumps to finally and then returns. -- Test that a function defined inside a :def function is local to that - function, g: functions can be defined and script-local functions cannot be - defined. -- compile options that are an expression, e.g. "expr:" in 'spellsuggest', +- 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) Use the location where the option was set for deciding whether it's to be evaluated in Vim9 script context. -- implement :type; import type declaration. -- implement enum; import enum. +- implement :type, import type declaration. +- implement enum, import enum. - Future work: See |vim9-classes| - Define the keywords and commands to make sure it will be backwards - compatible. -- Make debugging work - at least per function. Need to recompile a function - to step through it line-by-line? Evaluate the stack and variables on the - stack? -- List commands when 'verbose' is set or :verbose is used. - -Further Vim9 improvements, possibly after launch: - 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. - compile get_lambda_tv() in popup_add_timeout() @@ -108,6 +95,9 @@ Further Vim9 improvements, possibly after launch: - 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: @@ -1404,9 +1394,6 @@ Patch to make tests pass with EBCDIC. (Owen Leibman, 2016 Apr 10) Add ":read :command", to insert the output of an Ex command? Can already do it with ":$put =execute('command')". -When repeating the 'confirm' dialog one needs to press Enter. (ds26gte, 2016 -Apr 17) #762 - exists(":tearoff") does not tell you if the command is implemented. (Tony Mechelynck) Perhaps use exists("::tearoff") to check? diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 53d6cb5485..be77da7848 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 8.2. Last change: 2019 Nov 21 +*usr_02.txt* For Vim version 8.2. Last change: 2021 Apr 24 VIM USER MANUAL - by Bram Moolenaar @@ -532,7 +532,7 @@ Summary: *help-summary* > < for the corresponding flag of the 'cpoptions' settings, substitute <letter> by a specific flag, e.g.: > :help cpo-; -< And for the guioption flags: > +< And for the 'guioptions' flags: > :help go-<letter> 4) Normal mode commands do not have a prefix. To go to the help page for the diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 0a2ea62952..a368af0a5e 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 8.2. Last change: 2021 Apr 11 +*vim9.txt* For Vim version 8.2. Last change: 2021 Apr 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -157,6 +157,11 @@ Compilation is done when any of these is encountered: *E1091* If compilation fails it is not tried again on the next call, instead this error is given: "E1091: Function is not compiled: {name}". +Compilation will fail when encountering a user command that has not been +created yet. In this case you can call `execute()` to invoke it at runtime. > + def MyFunc() + execute('DefinedLater') + enddef `:def` has no options like `:function` does: "range", "abort", "dict" or "closure". A `:def` function always aborts on an error (unless `:silent!` was @@ -605,6 +610,44 @@ Notes: echo [1, 2] [3, 4] + +White space ~ + +Vim9 script enforces proper use of white space. This is no longer allowed: > + var name=234 # Error! + var name= 234 # Error! + var name =234 # Error! +There must be white space before and after the "=": > + var name = 234 # OK +White space must also be put before the # that starts a comment after a +command: > + var name = 234# Error! + var name = 234 # OK + +White space is required around most operators. + +White space is required in a sublist (list slice) around the ":", except at +the start and end: > + otherlist = mylist[v : count] # v:count has a different meaning + otherlist = mylist[:] # make a copy of the List + otherlist = mylist[v :] + otherlist = mylist[: v] + +White space is not allowed: +- Between a function name and the "(": > + Func (arg) # Error! + Func + \ (arg) # Error! + Func + (arg) # Error! + Func(arg) # OK + Func( + arg) # OK + Func( + arg # OK + ) + + No curly braces expansion ~ |curly-braces-names| cannot be used. @@ -656,6 +699,17 @@ Comparators ~ The 'ignorecase' option is not used for comparators that use strings. +Abort after error ~ + +In legacy script, when an error is encountered, Vim continues to execute +following lines. This can lead to a long sequence of errors and need to type +CTRL-C to stop it. In Vim9 script execution of commands stops at the first +error. Example: > + vim9script + var x = does-not-exist + echo 'not executed' + + For loop ~ Legacy Vim script has some tricks to make a for loop over a list handle @@ -679,43 +733,6 @@ Generally, you should not change the |