From 1d59aa1fdfb191d9872ff87eb94652acd374b293 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 19 Sep 2020 18:50:13 +0200 Subject: Update runtime files. --- runtime/doc/cmdline.txt | 25 +++++--- runtime/doc/eval.txt | 6 +- runtime/doc/insert.txt | 4 +- runtime/doc/map.txt | 4 +- runtime/doc/options.txt | 11 ++-- runtime/doc/pi_netrw.txt | 80 ++++++++++++++++++++----- runtime/doc/popup.txt | 8 ++- runtime/doc/tags | 9 ++- runtime/doc/todo.txt | 59 +++++++++--------- runtime/doc/version8.txt | 4 +- runtime/doc/vim9.txt | 153 +++++++++++++++++++++++++++++++++++------------ 11 files changed, 257 insertions(+), 106 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 91aab3b261..e536dac717 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 8.2. Last change: 2020 Aug 09 +*cmdline.txt* For Vim version 8.2. Last change: 2020 Sep 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -797,7 +797,7 @@ three lines: > < Visual Mode and Range *v_:* - + *:star-visual-range* {Visual}: Starts a command-line with the Visual selected lines as a range. The code `:'<,'>` is used for this range, which makes it possible to select a similar line from the command-line @@ -873,34 +873,37 @@ it, no matter how many backslashes. \\# \# Also see |`=|. - *:* ** *:* ** - *:* ** *:* ** - *:* ** *:* ** - *:* ** *:* ** - *:* ** *:* ** - *:* ** *E499* *E500* + *E499* *E500* Note: these are typed literally, they are not special keys! + *:* ** is replaced with the word under the cursor (like |star|) + *:* ** is replaced with the WORD under the cursor (see |WORD|) + *:* ** is replaced with the word under the cursor, including more to form a C expression. E.g., when the cursor is on "arg" of "ptr->arg" then the result is "ptr->arg"; when the cursor is on "]" of "list[idx]" then the result is "list[idx]". This is used for |v:beval_text|. + *:* ** is replaced with the path name under the cursor (like what |gf| uses) + *:* ** When executing autocommands, is replaced with the file name of the buffer being manipulated, or the file for a read or write. *E495* + *:* ** When executing autocommands, is replaced with the currently effective buffer number (for ":r file" and ":so file" it is the current buffer, the file being read/sourced is not in a buffer). *E496* + *:* ** When executing autocommands, is replaced with the match for which this autocommand was executed. *E497* It differs from only when the file name isn't used to match with (for FileType, Syntax and SpellFileMissing events). + *:* ** When executing a ":source" command, is replaced with the file name of the sourced file. *E498* When executing a function, is replaced with the call stack, @@ -908,18 +911,24 @@ Note: these are typed literally, they are not special keys! is preferred). Note that filename-modifiers are useless when is not used inside a script. + *:* ** is replaced with the call stack, using "function {function-name}[{lnum}]" for a function line and "script {file-name}[{lnum}]" for a script line, and ".." in between items. E.g.: "function {function-name1}[{lnum}]..{function-name2}[{lnum}]" + *:* ** When executing a ":source" command, is replaced with the line number. *E842* When executing a function it's the line number relative to the start of the function. + *:* ** When executing a script, is replaced with the line number. It differs from in that is replaced with the script line number in any situation. *E961* + *:* ** + is replaced with the {clinetid} of the last received + message in |server2client()| *filename-modifiers* *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7dbf7772aa..82b81fbb32 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2020 Sep 06 +*eval.txt* For Vim version 8.2. Last change: 2020 Sep 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4302,6 +4302,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* autocmd file name autocmd buffer number (as a String!) autocmd matched name + C expression under the cursor sourced script file or function name sourced script line number or function line number @@ -4309,6 +4310,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* a function "123_" where "123" is the current script ID || + call stack word under the cursor WORD under the cursor the {clientid} of the last received @@ -5489,7 +5491,7 @@ getmarklist([{expr}]) *getmarklist()* local marks defined in buffer {expr}. For the use of {expr}, see |bufname()|. - Each item in the retuned List is a |Dict| with the following: + Each item in the returned List is a |Dict| with the following: name - name of the mark prefixed by "'" pos - a |List| with the position of the mark: [bufnum, lnum, col, off] diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index fed81e5db4..b202a939a8 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.2. Last change: 2020 Apr 30 +*insert.txt* For Vim version 8.2. Last change: 2020 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1843,6 +1843,7 @@ a Append text after the cursor [count] times. If the *A* A Append text at the end of the line [count] times. + For using "A" in Visual block mode see |v_b_A|. or *i* *insert* ** i Insert text before the cursor [count] times. @@ -1855,6 +1856,7 @@ I Insert text before the first non-blank in the line When the 'H' flag is present in 'cpoptions' and the line only contains blanks, insert start just before the last blank. + For using "I" in Visual block mode see |v_b_I|. *gI* gI Insert text in column 1 [count] times. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 8900026a1f..df96bde941 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2020 Sep 06 +*map.txt* For Vim version 8.2. Last change: 2020 Sep 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1506,7 +1506,7 @@ The valid escape sequences are (See the '-bang' attribute) Expands to a ! if the command was executed with a ! modifier, otherwise expands to nothing. - ** *:command-modifiers* + ** ** *:command-modifiers* The command modifiers, if specified. Otherwise, expands to nothing. Supported modifiers are |:aboveleft|, |:belowright|, |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|, diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 85a0296e0b..713f3ba3e5 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2020 Sep 06 +*options.txt* For Vim version 8.2. Last change: 2020 Sep 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2806,7 +2806,10 @@ A jump table for the options with a short description can be found at |Q_op|. 'emoji' 'emo' boolean (default: on) global When on all Unicode emoji characters are considered to be full width. - + This excludes "text emoji" characters, which are normally displayed as + single width. Unfortunately there is no good specification for this + and it has been determined on trial-and-error basis. Use the + |setcellwidths()| function to change the behavior. *'encoding'* *'enc'* *E543* 'encoding' 'enc' string (default: "latin1" or value from $LANG) @@ -7288,8 +7291,8 @@ A jump table for the options with a short description can be found at |Q_op|. N N Printer page number. (Only works in the 'printheader' option.) l N Line number. L N Number of lines in buffer. - c N Column number. - v N Virtual column number. + c N Column number (byte index). + v N Virtual column number (screen column). V N Virtual column number as -{num}. Not displayed if equal to 'c'. p N Percentage through file in lines as in |CTRL-G|. P S Percentage through file of displayed window. This is like the diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index d5dfd37fab..b293d9b15f 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Aug 15 +*pi_netrw.txt* For Vim version 8.2. Last change: 2020 Sep 19 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -437,9 +437,13 @@ settings are described below, in |netrw-browser-options|, and in *g:netrw_silent* =0 : transfers done normally =1 : transfers done silently - *g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one + *g:netrw_use_errorwindow* =2: messages from netrw will use a popup window + Move the mouse and pause to remove the popup window. + (default value if popup windows are availble) + =1 : messages from netrw will use a separate one line window. This window provides reliable - delivery of messages. (default) + delivery of messages. + (default value if popup windows are not availble) =0 : messages from netrw will use echoerr ; messages don't always seem to show up this way, but one doesn't have to quit the window. @@ -725,6 +729,8 @@ just as easily as if they were local files! > See |netrw-activate| for more on how to encourage your vim to use plugins such as netrw. +For password-free use of scp:, see |netrw-ssh-hack|. + ============================================================================== 7. Ex Commands *netrw-ex* {{{1 @@ -1063,7 +1069,7 @@ QUICK HELP *netrw-quickhelp* {{{2 Reverse sorting order.........................|netrw-r| - *netrw-quickmap* *netrw-quickmaps* + *netrw-quickmap* *netrw-quickmaps* QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 > --- ----------------- ---- @@ -1080,7 +1086,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 a Cycles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) and showing (display only files which match g:netrw_list_hide) - c Make browsing directory the current directory |netrw-c| + cd Make browsing directory the current directory |netrw-cd| C Setting the editing window |netrw-C| d Make a directory |netrw-d| D Attempt to remove the file(s)/directory(ies) |netrw-D| @@ -2098,7 +2104,7 @@ the two directories the same, use the "cd" map (type cd). That map will set Vim's notion of the current directory to netrw's current browsing directory. -*netrw-c* : This map's name has been changed from "c" to cd (see |netrw-cd|). +|netrw-cd|: This map's name was changed from "c" to cd (see |netrw-cd|). This change was done to allow for |netrw-cb| and |netrw-cB| maps. Associated setting variable: |g:netrw_keepdir| @@ -2753,7 +2759,7 @@ your browsing preferences. (see also: |netrw-settings|) =0 keep the current directory the same as the browsing directory. The current browsing directory is contained in - b:netrw_curdir (also see |netrw-c|) + b:netrw_curdir (also see |netrw-cd|) *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the |:jumps| table unaffected. @@ -3054,7 +3060,7 @@ your browsing preferences. (see also: |netrw-settings|) (see |netrw-c-tab|). *g:netrw_xstrlen* Controls how netrw computes string lengths, - including multibyte characters' string + including multi-byte characters' string length. (thanks to N Weibull, T Mechelynck) =0: uses Vim's built-in strlen() =1: number of codepoints (Latin a + combining @@ -3124,7 +3130,8 @@ a file using the local browser (by putting the cursor on it) and pressing Related topics: * To see what the current directory is, use |:pwd| - * To make the currently browsed directory the current directory, see |netrw-c| + * To make the currently browsed directory the current directory, see + |netrw-cd| * To automatically make the currently browsed directory the current directory, see |g:netrw_keepdir|. @@ -3799,9 +3806,15 @@ netrw: or http://vim.sourceforge.net/scripts/script.php?script_id=120 - Decho.vim is provided as a "vimball"; see |vimball-intro|. + Decho.vim is provided as a "vimball"; see |vimball-intro|. You + should edit the Decho.vba.gz file and source it in: > - 2. Edit the file by typing: > + vim Decho.vba.gz + :so % + :q +< + 2. To turn on debug tracing in netrw, then edit the + file by typing: > vim netrw.vim :DechoOn @@ -3823,14 +3836,34 @@ netrw: read/write your file over the network in a separate tab or server vim window. - To save the file, use > + Change the netrw.vimrc file to include the Decho plugin: > + + set nocp + so $HOME/.vim/plugin/Decho.vim + so $HOME/.vim/plugin/netrwPlugin.vim +< + You should continue to run vim with > + + vim -u netrw.vimrc --noplugins -i NONE [some path here] +< + to avoid entanglements with options and other plugins. + + To save the file: under linux, the output will be in a separate + remote server window; in it, just save the file with > + + :w! DBG + +< Under a vim that doesn't support clientserver, your debugging + output will appear in another tab: > :tabnext :set bt= :w! DBG +< + Furthermore, it'd be helpful if you would type > -< Furthermore, it'd be helpful if you would type > :Dsep + < where is the command you're about to type next, thereby making it easier to associate which part of the debugging trace is due to which command. @@ -3838,17 +3871,34 @@ netrw: Please send that information to 's maintainer along with the o/s you're using and the vim version that you're using (see |:version|) (remove the embedded NOSPAM first) > + NcampObell@SdrPchip.AorgM-NOSPAM < ============================================================================== 12. History *netrw-history* {{{1 + v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree + would not hide with the ^\..* pattern + correctly. + * (Marcin Szamotulski) NetrwOptionRestore + did not restore options correctly that + had a single quote in the option string. + Apr 13, 2020 * implemented error handling via popup + windows (see |popup_beval()|) + Apr 30, 2020 * (reported by Manatsu Takahashi) while + using Lexplore, a modified file could + be overwritten. Sol'n: will not overwrite, + but will emit an |E37| (although one cannot + add an ! to override) + Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking + :Lexplore and quitting it left unused + hidden buffers. Netrw will now set netrw + buffers created by :Lexplore to |bh|=wipe. v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x (|netrw-x|) would throw an error when attempting to open a local directory. v168: Dec 12, 2019 * scp timeout error message not reported, hopefully now fixed (Shane Xb Qian) - v167: Nov 29, 2019 * netrw does a save&restore on @* and @+. That causes problems with the clipboard. Now restores occurs only if @* or @+ have @@ -4306,4 +4356,4 @@ netrw: ============================================================================== Modelines: {{{1 - vim:tw=78:ts=8:noet:ft=help:norl:fdm=marker +vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt index 8a0f2ba518..856132dad8 100644 --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -1,4 +1,4 @@ -*popup.txt* For Vim version 8.2. Last change: 2020 Jul 27 +*popup.txt* For Vim version 8.2. Last change: 2020 Sep 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -915,6 +915,12 @@ but since many keys start with an Esc character, there may be a delay before Vim recognizes the Esc key. If you do use Esc, it is recommended to set the 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. + *popup-filter-errors* +If the filter function can't be called, e.g. because the name is wrong, then +the popup is closed. If the filter causes an error then it is assumed to +return zero. If this happens three times in a row the popup is closed. If +the popup gives errors fewer than 10% of the calls then it won't be closed. + POPUP CALLBACK *popup-callback* diff --git a/runtime/doc/tags b/runtime/doc/tags index d3202727a0..b9d7e03c29 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1975,6 +1975,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* : cmdline.txt /*:* : cmdline.txt /*:* : cmdline.txt /*:* +: cmdline.txt /*:* : cmdline.txt /*:* : cmdline.txt /*:* : cmdline.txt /*:* @@ -3160,6 +3161,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :sta windows.txt /*:sta* :stag windows.txt /*:stag* :star repeat.txt /*:star* +:star-visual-range cmdline.txt /*:star-visual-range* :start insert.txt /*:start* :startgreplace insert.txt /*:startgreplace* :startinsert insert.txt /*:startinsert* @@ -3614,6 +3616,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* cmdline.txt /** cmdline.txt /** intro.txt /** + cmdline.txt /** map.txt /** cmdline.txt /** map.txt /** @@ -3643,6 +3646,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* map.txt /** autocmd.txt /** map.txt /** + map.txt /** map.txt /** map.txt /** map.txt /** @@ -7751,6 +7755,7 @@ matchaddpos() eval.txt /*matchaddpos()* matcharg() eval.txt /*matcharg()* matchdelete() eval.txt /*matchdelete()* matchend() eval.txt /*matchend()* +matchfuzzy() eval.txt /*matchfuzzy()* matchit-install usr_05.txt /*matchit-install* matchlist() eval.txt /*matchlist()* matchparen pi_paren.txt /*matchparen* @@ -7929,7 +7934,6 @@ netrw-browser-options pi_netrw.txt /*netrw-browser-options* netrw-browser-settings pi_netrw.txt /*netrw-browser-settings* netrw-browser-var pi_netrw.txt /*netrw-browser-var* netrw-browsing pi_netrw.txt /*netrw-browsing* -netrw-c pi_netrw.txt /*netrw-c* netrw-c-tab pi_netrw.txt /*netrw-c-tab* netrw-cB pi_netrw.txt /*netrw-cB* netrw-cadaver pi_netrw.txt /*netrw-cadaver* @@ -8392,6 +8396,7 @@ popup-callback popup.txt /*popup-callback* popup-close popup.txt /*popup-close* popup-examples popup.txt /*popup-examples* popup-filter popup.txt /*popup-filter* +popup-filter-errors popup.txt /*popup-filter-errors* popup-filter-mode popup.txt /*popup-filter-mode* popup-function-details popup.txt /*popup-function-details* popup-functions popup.txt /*popup-functions* @@ -10029,6 +10034,8 @@ vim.vim syntax.txt /*vim.vim* vim7 version7.txt /*vim7* vim8 version8.txt /*vim8* vim9 vim9.txt /*vim9* +vim9-classes vim9.txt /*vim9-classes* +vim9-const vim9.txt /*vim9-const* vim9-declaration vim9.txt /*vim9-declaration* vim9-declarations usr_46.txt /*vim9-declarations* vim9-differences vim9.txt /*vim9-differences* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index bd05ecf624..03c9fcea40 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2020 Sep 07 +*todo.txt* For Vim version 8.2. Last change: 2020 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -40,24 +40,13 @@ browser use: https://github.com/vim/vim/issues/1234 Why does Test_invalid_sid() not work in the GUI? -Making everything work: -- Should :const work the same as in legacy script? - Or should it work like in Typescript: only the variable is fixed, not the - value itself. - Then use ":const!" to also fix/lock the value? - Typescript uses "as const", which is weird. - Alternative: const var = value - looks quite strange quite verbose - But can be used in several places: - SomeFunc([1, 2, 3]) - In Vim this basically means "lock this value". - How about: - SomeFunc([[1], [2], [3]]) # are sub-lists immutable? - SomeFunc(myList) # is myList mutable afterwards? +Add matchfuzzy() and matchfuzzypos() Yegappan, #6947 + should be ready now -- Run the same tests in :def and Vim9 script, like in Test_expr7_not() -- :put with a "=" register argument doesn't work, need to find the expression - and compile it. (#6397) +Making everything work: +- Fix memory leak in test_vim9_func (through compile_nested_function and + get_lambda_tv()) +- Fix memory leaks in test_vim9_script - At the Vim9 script level, keep script variables local to the block they are declared in, like in Javascript (using :let). -> Need to remember what variables were declared and delete them when @@ -80,6 +69,7 @@ Making everything work: assertfail unknown endassertfail E99:.*unknown +- Run the same tests in :def and Vim9 script, like in Test_expr7_not() - In autocmd: use legacy syntax, not whatever the current script uses? - need to check type when a declaration specifies a type: #6507 let nr: number = 'asdf' @@ -87,6 +77,9 @@ Making everything work: the script-local function, not a global one. - Make sure that where a callback is expected a function can be used (without quotes). E.g. sort() and map(). Also at the script level. +- assignment to more complex lval: list[1][2][3] = 8 +- ":put" with ISN_PUT does not handle range correctly, e.g. ":$-2put". + Add command to parse range at runtime? - Make map() give an error if the resulting type is wrong. Add mapnew() to create a new List/Dict for the result, which can have a different value type. @@ -108,6 +101,9 @@ Making everything work: - 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. +- Does this work already: can use func as reference: + def SomeFunc() ... + map(list, SomeFunc) - Support passing v:none to use the default argument value. (#6504) - make 0 == 'string' fail on the script level, like inside :def. - Check that when using a user function name without prefix, it does not find @@ -123,10 +119,6 @@ Making everything work: - Compile redir to local variable: var_redir_start(). - Compile builtin functions that access local variables: islocked() -- possible memory leak in test_vim9_func through compile_nested_function. -- memory leaks in test_vim9_expr -- memory leaks in test_vim9_script -- memory leaks in test_vim9_cmd - When evaluating constants for script variables, some functions could work: has('asdf'), len('string') - Implement "as Name" in "import Item as Name from ..." @@ -151,24 +143,23 @@ Also: - 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 -- Fix memory leaks for test_vim9_disassemble, test_vim9_expr, test_vim9_script - Test each level of expressions properly, with type checking - Test try/catch and throw better, also nested. Test return inside try/finally jumps to finally and then returns. -- can use func as reference: - def SomeFunc() ... - map(list, SomeFunc) - Test: Function declared inside a :def function is local, disappears at the end of the function. Unless g: is used, just like with variables. - implement :type - import type declaration? -- implement class -- implement interface -- predefined class: Promise +- Future work: See |vim9-classes| - implement enum - Make accessing varargs faster: arg[expr] EVAL expr LOADVARARG (varags idx) +- 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? +- Make profiling work - Add ISN_PROFILE instructions after every line? +- List commands when 'verbose' is set or :verbose is used. Further improvements: - compile options that are an expression, e.g. "expr:" in 'spellsuggest', 'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert', @@ -292,7 +283,7 @@ Terminal emulator window: Error numbers available: E653 Patch to implement the vimtutor with a plugin: #6414 -Was originally writtten by Felipe Morales. +Was originally written by Felipe Morales. Remove SPACE_IN_FILENAME ? It is only used for completion. @@ -303,6 +294,9 @@ with 'termguicolors'. #1740 Patch for blockwise paste reporting changes: #6660. +Expanding should put the tab number from cmdmod.tab before "tab". +Any way to convert "$" back by using a special value? (#6901) + Can we detect true color support? https://gist.github.com/XVilka/8346728 Try setting a color then request the current color, like using t_u7. @@ -397,6 +391,9 @@ When 'fileignorecase' is set ":e testfile.c" works to edit TestFile.c, but ":find testfile.c" does not ignore case. Might be related to #6088. +Error for reverse range when using :vimgrep in file "[id-01] file.txt". +(#6919) + When changing the crypt key the buffer should be considered modified. Like when changing 'fileformat'. Save the old key in save_file_ff(). (Ninu-Ciprian Marginean) @@ -514,7 +511,7 @@ Better: use the "z" prefix. or ]t) and [t(. Modeless selection doesn't work in gvim. (#4783) Caused by patch 8.1.1534. -Visual highlight not removed when 'dipslay' is "lastline" and line doesn't +Visual highlight not removed when 'display' is "lastline" and line doesn't fit. (Kevin Lawler, #4457) Current position in the changelist should be local to the buffer. (#2173) diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt index fe2fa776ce..6192c237ed 100644 --- a/runtime/doc/version8.txt +++ b/runtime/doc/version8.txt @@ -42445,7 +42445,7 @@ Files: src/filepath.c, src/testdir/test_fnamemodify.vim Patch 8.2.0216 Problem: Several Vim9 instructions are not tested. -Solution: Add more tests. Fix :disassamble output. Make catch with pattern +Solution: Add more tests. Fix :disassemble output. Make catch with pattern work. Files: src/testdir/test_vim9_script.vim, src/vim9execute.c, src/vim9compile.c @@ -42665,7 +42665,7 @@ Solution: Change to int. (Mike Williams) Files: src/vim9compile.c Patch 8.2.0253 -Problem: Crash when using :disassamble without argument. (Dhiraj Mishra) +Problem: Crash when using :disassemble without argument. (Dhiraj Mishra) Solution: Check for missing argument. (Dominique Pellé, closes #5635, closes #5637) Files: src/vim9execute.c, src/testdir/test_vim9_disassemble.vim, diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 71c454ae94..576479b35b 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 8.2. Last change: 2020 Sep 13 +*vim9.txt* For Vim version 8.2. Last change: 2020 Sep 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,6 +19,7 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE 3. New style functions |fast-functions| 4. Types |vim9-types| 5. Namespace, Import and Export |vim9script| +6. Future work: classes |vim9-classes| 9. Rationale |vim9-rationale| @@ -49,13 +50,14 @@ errors are handled. The Vim9 script syntax and semantics are used in: - a function defined with the `:def` command - a script file where the first command is `vim9script` -- an autocommand defined in the context of these +- an autocommand defined in the context of the above When using `:function` in a Vim9 script file the legacy syntax is used. However, this can be confusing and is therefore discouraged. Vim9 script and legacy Vim script can be mixed. There is no requirement to -rewrite old scripts, they keep working as before. +rewrite old scripts, they keep working as before. You may want to use a few +`:def` functions for code that needs to be fast. ============================================================================== @@ -834,6 +836,8 @@ In case the name is ambiguous, another name can be specified: > To import all exported items under a specific identifier: > import * as That from 'thatscript.vim' +{not implemented yet: using "This as That"} + Then you can use "That.EXPORTED_CONST", "That.someValue", etc. You are free to choose the name "That", but it is highly recommended to use the name of the script file to avoid confusion. @@ -900,6 +904,37 @@ If an `import` statement is used in legacy Vim script, the script-local "s:" namespace will be used for the imported item, even when "s:" is not specified. +============================================================================== + +6. Future work: classes *vim9-classes* + +Above "class" was mentioned a few times, but it has not been implemented yet. +Most of Vim9 script can be created without this funcionality, and since +implementing classes is going to be a lot of work, it is left for the future. +For now we'll just make sure classes can be added later. + +Thoughts: +- `class` / `endclass`, everything in one file +- Class names are always CamelCase +- Single constructor +- Single inheritance with `class ThisClass extends BaseClass` +- `abstract class` +- `interface` (Abstract class without any implementation) +- `class SomeClass implements SomeInterface` +- Generics for class: `class ` +- Generics for function: `def GetLast(key: Tkey)` + +Again, much of this is from TypeScript. + +Some things that look like good additions: +- Use a class as an interface (like Dart) +- Extend a class with methods, using an import (like Dart) + +An important class that will be provided is "Promise". Since Vim is single +threaded, connecting asynchronous operations is a natural way of allowing +plugins to do their work without blocking the user. It's a uniform way to +invoke callbacks and handle timeouts and errors. + ============================================================================== 9. Rationale *vim9-rationale* @@ -933,36 +968,37 @@ instruction, at execution time the instruction would have to inspect the type of the arguments and decide what kind of addition to do. And when the type is dictionary throw an error. If the types are known to be numbers then an "add number" instruction can be used, which is faster. The error can be -given at compile time, no error handling is needed at runtime. +given at compile time, no error handling is needed at runtime, adding two +numbers cannot fail. The syntax for types is similar to Java, since it is easy to understand and widely used. The type names are what were used in Vim before, with some additions such as "void" and "bool". -Compiling functions early ~ +Removing clutter and weirdness ~ -Functions are compiled when called or when `:defcompile` is used. Why not -compile them early, so that syntax and type errors are reported early? +Once decided that `:def` functions have different syntax than legacy functions, +we are free to add improvements to make the code more familiar for users who +know popular programming languages. In other words: remove weird things that +only Vim uses. -The functions can't be compiled right away when encountered, because there may -be forward references to functions defined later. Consider defining functions -A, B and C, where A calls B, B calls C, and C calls A again. It's impossible -to reorder the functions to avoid forward references. +We can also remove clutter, mainly things that were done to make Vim script +backwards compatible with good old Vi commands. -An alternative would be to first scan through the file to locate items and -figure out their type, so that forward references are found, and only then -execute the script and compile the functions. This means the script has to be -parsed twice, which is slower, and some conditions at the script level, such -as checking if a feature is supported, are hard to use. An attempt was made -to see if it works, but it turned out to be impossible to make work nicely. +Examples: +- Drop `:call` for calling a function and `:eval` for manipulating data. +- Drop using a leading backslash for line continuation, automatically figure + out where an expression ends. -It would be possible to compile all the functions at the end of the script. -The drawback is that if a function never gets called, the overhead of -compiling it counts anyway. Since startup speed is very important, in most -cases it's better to do it later and accept that syntax and type errors are -only reported then. In case these errors should be found early, e.g. when -testing, the `:defcompile` command will help out. +However, this does require that some things need to change: +- Comments start with # instead of ", to avoid confusing them with strings. +- Ex command ranges need to be prefixed with a colon, to avoid confusion with + expressions (single quote can be a string or a mark, "/" can be divide or a + search command, etc.). + +Goal is to limit the differences. A good criteria is that when the old syntax +is used you are very likely to get an error message. TypeScript syntax and semantics ~ @@ -992,16 +1028,23 @@ Vim9 script works like JavaScript/TypeScript, keep the value: > ... let result = value || 0 # result == 44 +Another reason why TypeScript can be used as an example for Vim9 script is the +mix of static typing (a variable always has a known value type) and dynamic +typing (a variable can have different types, this hanges at runtime). Since +legacy Vim script is dynamically typed and a lot of existing functionality +(esp. builtin functions) depends on that, while static typing allows for much +faster execution, we need to have this mix in Vim9 script. + There is no intention to completely match TypeScript syntax and semantics. We just want to take those parts that we can use for Vim and we expect Vim users -will be happy with. TypeScript is a complex language with its own advantages -and disadvantages. To get an idea of the disadvantages read the book: -"JavaScript: The Good Parts". Or find the article "TypeScript: the good +will be happy with. TypeScript is a complex language with its own history, +advantages and disadvantages. To get an idea of the disadvantages read the +book: "JavaScript: The Good Parts". Or find the article "TypeScript: the good parts" and read the "Things to avoid" section. -People used to other languages (Java, Python, etc.) will also find things in -TypeScript that they do not like or do not understand. We'll try to avoid -those things. +People familiar with other languages (Java, Python, etc.) will also find +things in TypeScript that they do not like or do not understand. We'll try to +avoid those things. Specific items from TypeScript we avoid: - Overloading "+", using it both for addition and string concatenation. This @@ -1054,24 +1097,56 @@ globally can be used, not the exported items. Alternatives considered: Note that you can also use `:import` in legacy Vim script, see above. -Classes ~ +Compiling functions early ~ + +Functions are compiled when called or when `:defcompile` is used. Why not +compile them early, so that syntax and type errors are reported early? + +The functions can't be compiled right away when encountered, because there may +be forward references to functions defined later. Consider defining functions +A, B and C, where A calls B, B calls C, and C calls A again. It's impossible +to reorder the functions to avoid forward references. + +An alternative would be to first scan through the file to locate items and +figure out their type, so that forward references are found, and only then +execute the script and compile the functions. This means the script has to be +parsed twice, which is slower, and some conditions at the script level, such +as checking if a feature is supported, are hard to use. An attempt was made +to see if it works, but it turned out to be impossible to make work nicely. + +It would be possible to compile all the functions at the end of the script. +The drawback is that if a function never gets called, the overhead of +compiling it counts anyway. Since startup speed is very important, in most +cases it's better to do it later and accept that syntax and type errors are +only reported then. In case these errors should be found early, e.g. when +testing, the `:defcompile` command will help out. + + +Why not use an embeded language? ~ Vim supports interfaces to Perl, Python, Lua, Tcl and a few others. But -these interfaces have never become widespread. When Vim 9 was designed a -decision was made to phase out these interfaces and concentrate on Vim script, -while encouraging plugin authors to write code in any language and run it as -an external tool, using jobs and channels. +these interfaces have never become widely used, for various reasons. When +Vim9 was designed a decision was made to make these interfaces lower priority +and concentrate on Vim script. + +Still, plugin writers may find other languages more familiar, want to use +existing libraries or see a performance benefit. We encourage plugin authors +to write code in any language and run it as an external tool, using jobs and +channels. We can try to make this easier somehow. -Still, using an external tool has disadvantages. An alternative is to convert +Using an external tool also has disadvantages. An alternative is to convert the tool into Vim script. For that to be possible without too much translation, and keeping the code fast at the same time, the constructs of the tool need to be supported. Since most languages support classes the lack of support for classes in Vim is then a problem. -Previously Vim supported a kind-of object oriented programming by adding -methods to a dictionary. With some care this could be made to work, but it -does not look like real classes. On top of that, it's very slow, because of -the use of dictionaries. + +Classes ~ + +Vim supports a kind-of object oriented programming by adding methods to a +dictionary. With some care this can be made to work, but it does not look +like real classes. On top of that, it's quite slow, because of the use of +dictionaries. The support of classes in Vim9 script is a "minimal common functionality" of class support in most languages. It works much like Java, which is the most -- cgit v1.2.3