summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/compiler/eslint.vim16
-rw-r--r--runtime/compiler/standard.vim16
-rw-r--r--runtime/doc/eval.txt11
-rw-r--r--runtime/doc/if_lua.txt2
-rw-r--r--runtime/doc/index.txt11
-rw-r--r--runtime/doc/makehtml.awk2
-rw-r--r--runtime/doc/os_haiku.txt5
-rw-r--r--runtime/doc/popup.txt2
-rw-r--r--runtime/doc/repeat.txt9
-rw-r--r--runtime/doc/tags7
-rw-r--r--runtime/doc/terminal.txt9
-rw-r--r--runtime/doc/todo.txt76
-rw-r--r--runtime/doc/vim9.txt89
-rw-r--r--runtime/ftplugin/vim.vim20
-rw-r--r--runtime/indent/sshconfig.vim34
-rw-r--r--runtime/indent/testdir/sshconfig.in53
-rw-r--r--runtime/indent/testdir/sshconfig.ok53
-rw-r--r--runtime/indent/tex.vim22
-rw-r--r--runtime/macros/less.vim6
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim13
-rw-r--r--runtime/syntax/groovy.vim10
-rw-r--r--runtime/syntax/javascript.vim8
-rw-r--r--runtime/syntax/spec.vim5
-rw-r--r--runtime/syntax/tex.vim5
-rw-r--r--runtime/syntax/vim.vim13
25 files changed, 349 insertions, 148 deletions
diff --git a/runtime/compiler/eslint.vim b/runtime/compiler/eslint.vim
new file mode 100644
index 0000000000..1e7af2b182
--- /dev/null
+++ b/runtime/compiler/eslint.vim
@@ -0,0 +1,16 @@
+" Vim compiler file
+" Compiler: ESLint for JavaScript
+" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
+" Last Change: 2020 May 17
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "eslint"
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=eslint\ --format\ compact
+CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%#
diff --git a/runtime/compiler/standard.vim b/runtime/compiler/standard.vim
new file mode 100644
index 0000000000..b6bcf1f6b0
--- /dev/null
+++ b/runtime/compiler/standard.vim
@@ -0,0 +1,16 @@
+" Vim compiler file
+" Compiler: Standard for JavaScript
+" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
+" Last Change: 2020 May 17
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "standard"
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=standard
+CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%#
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 1e0760fea2..89f011b8cf 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 Apr 19
+*eval.txt* For Vim version 8.2. Last change: 2020 May 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -584,6 +584,8 @@ adict.
Weeding out entries from a Dictionary can be done with |filter()|: >
:call filter(dict, 'v:val =~ "x"')
This removes all entries from "dict" with a value not matching 'x'.
+This can also be used to remove all entries: >
+ call filter(dict, 0)
Dictionary function ~
@@ -1485,7 +1487,7 @@ the function returns: >
:echo Bar(6)
< 5
-Note that the variables must exist in the outer scope before the lamba is
+Note that the variables must exist in the outer scope before the lambda is
defined for this to work. See also |:func-closure|.
Lambda and closure support can be checked with: >
@@ -2916,6 +2918,7 @@ win_splitmove({nr}, {target} [, {options}])
Number move window {nr} to split of {target}
winbufnr({nr}) Number buffer number of window {nr}
wincol() Number window column of the cursor
+windowsversion() String MS-Windows OS version
winheight({nr}) Number height of window {nr}
winlayout([{tabnr}]) List layout of windows in tab {tabnr}
winline() Number window line of the cursor
@@ -10221,7 +10224,7 @@ tr({src}, {fromstr}, {tostr}) *tr()*
trim({text} [, {mask}]) *trim()*
Return {text} as a String where any character in {mask} is
- removed from the beginning and end of {text}.
+ removed from the beginning and end of {text}.
If {mask} is not given, {mask} is all characters up to 0x20,
which includes Tab, space, NL and CR, plus the non-breaking
space character 0xa0.
@@ -11144,6 +11147,8 @@ See |:verbose-cmd| for more information.
NOTE: Use ! wisely. If used without care it can cause
an existing function to be replaced unexpectedly,
which is hard to debug.
+ NOTE: In Vim9 script script-local functions cannot be
+ deleted or redefined.
For the {arguments} see |function-argument|.
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt
index ff108eebb6..63e227d303 100644
--- a/runtime/doc/if_lua.txt
+++ b/runtime/doc/if_lua.txt
@@ -1,4 +1,4 @@
-*if_lua.txt* For Vim version 8.2. Last change: 2019 Jul 21
+*if_lua.txt* For Vim version 8.2. Last change: 2020 May 17
VIM REFERENCE MANUAL by Luis Carvalho
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 78d557f51e..0d47cc2938 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 8.2. Last change: 2020 May 10
+*index.txt* For Vim version 8.2. Last change: 2020 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -828,7 +828,7 @@ tag char note action in Normal mode ~
|zD| zD delete folds recursively
|zE| zE eliminate all folds
|zF| zF create a fold for N lines
-|zG| zG mark word as good spelled word
+|zG| zG temporarily mark word as good spelled word
|zH| zH when 'wrap' off scroll half a screenwidth
to the right
|zL| zL when 'wrap' off scroll half a screenwidth
@@ -837,7 +837,7 @@ tag char note action in Normal mode ~
|zN| zN set 'foldenable'
|zO| zO open folds recursively
|zR| zR set 'foldlevel' to the deepest fold
-|zW| zW mark word as wrong (bad) spelled word
+|zW| zW temporarily mark word as bad spelled word
|zX| zX re-apply 'foldlevel'
|z^| z^ cursor on line N (default line above
window), otherwise like "z-"
@@ -849,7 +849,7 @@ tag char note action in Normal mode ~
position the cursor at the end (right side)
of the screen
|zf| zf{motion} create a fold for Nmove text
-|zg| zg mark word as good spelled word
+|zg| zg permanently mark word as good spelled word
|zh| zh when 'wrap' off scroll screen N characters
to the right
|zi| zi toggle 'foldenable'
@@ -870,7 +870,7 @@ tag char note action in Normal mode ~
|zuW| zuW undo |zW|
|zuG| zuG undo |zG|
|zv| zv open enough folds to view the cursor line
-|zw| zw mark word as wrong (bad) spelled word
+|zw| zw permanently mark word as bad spelled word
|zx| zx re-apply 'foldlevel' and do "zv"
|zz| zz redraw, cursor line at center of window
|z<Left>| z<Left> same as "zh"
@@ -1262,6 +1262,7 @@ tag command action ~
|:debug| :deb[ug] run a command in debugging mode
|:debuggreedy| :debugg[reedy] read debug mode commands from normal input
|:def| :def define a Vim9 user function
+|:defcompile| :defc[ompile] compile Vim9 user functions in current script
|:delcommand| :delc[ommand] delete user-defined command
|:delfunction| :delf[unction] delete a user function
|:delmarks| :delm[arks] delete marks
diff --git a/runtime/doc/makehtml.awk b/runtime/doc/makehtml.awk
index 5e40069391..40154b063b 100644
--- a/runtime/doc/makehtml.awk
+++ b/runtime/doc/makehtml.awk
@@ -58,7 +58,7 @@ substr($0,length($0),1) == "~" { print "<B><FONT COLOR=\"PURPLE\">" substr($0,1,
#
#ad hoc code
#
-/^"\|\& / {gsub(/\|/,"\\&#124;"); }
+/^"\|& / {gsub(/\|/,"\\&#124;"); }
/ = b / {gsub(/ b /," \\&#98; "); }
#
# one letter tag
diff --git a/runtime/doc/os_haiku.txt b/runtime/doc/os_haiku.txt
index 6eff91c275..5c520b0683 100644
--- a/runtime/doc/os_haiku.txt
+++ b/runtime/doc/os_haiku.txt
@@ -1,4 +1,4 @@
-*os_haiku.txt* For Vim version 8.2. Last change: 2020 Apr 30
+*os_haiku.txt* For Vim version 8.2. Last change: 2020 May 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -84,9 +84,6 @@ Stuff that does not work yet:
in when the window is activated or deactivated (so it works best with focus-
follows-mouse turned on).
- The cursor does not flash.
-- Built-in terminal is not available in GUI, and does not work reliably on
- console version as well; e.g. it is not possible to exit using the 'exit'
- command. If you need to use it, enable at your own risk.
4. The $VIM directory *haiku-vimdir*
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index fdf28a5e7a..ff99fce9ab 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 May 12
+*popup.txt* For Vim version 8.2. Last change: 2020 May 18
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 365f6da1e9..29cdd73bb3 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -1,4 +1,4 @@
-*repeat.txt* For Vim version 8.2. Last change: 2020 Apr 26
+*repeat.txt* For Vim version 8.2. Last change: 2020 May 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -126,6 +126,11 @@ q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
recorded macro and the yank will overwrite the
recorded macro.
+ Note: The recording happens while you type, replaying
+ the register happens as if the keys come from a
+ mapping. This matters, for example, for undo, which
+ only syncs when commands were typed.
+
q Stops recording. (Implementation note: The 'q' that
stops recording is not stored in the register, unless
it was the result of a mapping)
@@ -137,7 +142,7 @@ q Stops recording. (Implementation note: The 'q' that
used.
The register is executed like a mapping, that means
that the difference between 'wildchar' and 'wildcharm'
- applies.
+ applies, and undo might not be synced in the same way.
For "@=" you are prompted to enter an expression. The
result of the expression is then executed.
See also |@:|.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 18e88f5708..601b95fa59 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -2317,6 +2317,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:debugg repeat.txt /*:debugg*
:debuggreedy repeat.txt /*:debuggreedy*
:def vim9.txt /*:def*
+:defc vim9.txt /*:defc*
+:defcompile vim9.txt /*:defcompile*
:del change.txt /*:del*
:delc map.txt /*:delc*
:delcommand map.txt /*:delcommand*
@@ -4253,6 +4255,7 @@ E457 print.txt /*E457*
E458 message.txt /*E458*
E459 message.txt /*E459*
E46 message.txt /*E46*
+E460 eval.txt /*E460*
E461 eval.txt /*E461*
E462 editing.txt /*E462*
E463 netbeans.txt /*E463*
@@ -4678,6 +4681,7 @@ E855 autocmd.txt /*E855*
E858 eval.txt /*E858*
E859 eval.txt /*E859*
E86 windows.txt /*E86*
+E861 popup.txt /*E861*
E862 eval.txt /*E862*
E863 popup.txt /*E863*
E864 pattern.txt /*E864*
@@ -7700,6 +7704,7 @@ mapmode-v map.txt /*mapmode-v*
mapmode-x map.txt /*mapmode-x*
mapping map.txt /*mapping*
mapping-functions usr_41.txt /*mapping-functions*
+mapset() eval.txt /*mapset()*
mark motion.txt /*mark*
mark-functions usr_41.txt /*mark-functions*
mark-motions motion.txt /*mark-motions*
@@ -8383,6 +8388,7 @@ popup_findpreview() popup.txt /*popup_findpreview()*
popup_getoptions() popup.txt /*popup_getoptions()*
popup_getpos() popup.txt /*popup_getpos()*
popup_hide() popup.txt /*popup_hide()*
+popup_list() popup.txt /*popup_list()*
popup_locate() popup.txt /*popup_locate()*
popup_menu() popup.txt /*popup_menu()*
popup_menu-shortcut-example popup.txt /*popup_menu-shortcut-example*
@@ -9460,6 +9466,7 @@ termdebug-prompt terminal.txt /*termdebug-prompt*
termdebug-starting terminal.txt /*termdebug-starting*
termdebug-stepping terminal.txt /*termdebug-stepping*
termdebug-variables terminal.txt /*termdebug-variables*
+termdebug_map_K terminal.txt /*termdebug_map_K*
termdebug_popup terminal.txt /*termdebug_popup*
termdebug_shortcuts terminal.txt /*termdebug_shortcuts*
termdebug_use_prompt terminal.txt /*termdebug_use_prompt*
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index ddc0906a15..1a3cabbad9 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 8.2. Last change: 2020 Apr 23
+*terminal.txt* For Vim version 8.2. Last change: 2020 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -161,6 +161,7 @@ terminal windows may be configured using the variable
hexadecimal color codes, similar to those accepted by |highlight-guifg|. When
not using GUI colors, the terminal window always uses the 16 ANSI colors of
the underlying terminal.
+When using `term_start()` the colors can be set with the "ansi_colors" option.
The |term_setansicolors()| function can be used to change the colors, and
|term_getansicolors()| to get the currently used colors.
@@ -1305,7 +1306,7 @@ breakpoint, or use the "Clear breakpoint" right-click menu entry.
Inspecting variables ~
*termdebug-variables* *:Evaluate*
`:Evaluate` evaluate the expression under the cursor
- `K` same
+ `K` same (see |termdebug_map_K| to disable)
`:Evaluate` {expr} evaluate {expr}
`:'<,'>Evaluate` evaluate the Visually selected text
@@ -1336,6 +1337,10 @@ in a buffer with 'buftype' set to "prompt". This works slightly differently:
*termdebug_use_prompt*
Prompt mode can be used even when the |+terminal| feature is present with: >
let g:termdebug_use_prompt = 1
+<
+ *termdebug_map_K*
+The K key is normally mapped to :Evaluate. If you do not want this use: >
+ let g:termdebug_map_K = 0
Communication ~
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index acc55fe337..abdd346adf 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 May 11
+*todo.txt* For Vim version 8.2. Last change: 2020 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,27 +38,19 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
-Patch to test TERM signal. (Dominique, #6055)
-
-Include src/po/vim.pot
+Include src/po/vim.pot ?
Vim9 script:
-Make closures work:
- - call closure from not compiled context
- - Create closure in a loop. Need to make a list of them.
-Forward declarations:
- - Cleanup when sourcing a script again: all script-local variables, imports
- and functions are deleted.
- - make sure only constants in declarations are executed, no function calls.
- - Declare a variable at script level without an assignment.
- let var: string
- Error without a type or assignment
- let var # error!
Making everything work:
+- possible memory leak in test_vim9_func through compile_nested_function.
+- memory leaks in test_vim9_expr
+- memory leaks in test_vim9_script
- Test that a script-local function in Vim9 script cannot be deleted.
+- Make "true" and "false" work in vim9script
- 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 0 == 'string' fail on the script level, like inside :def.
- Check that when using a user function name without prefix, it does not find
a global function. Prefixing g: is required.
- Compile: let [var, var] = expr
@@ -75,16 +67,21 @@ Making everything work:
- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
- Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd
- Expand `=expr` in :mkspell
+- When evaluating constants for script variables, some functions could work:
+ has('asdf'), len('string')
- Support type for ":let"/":const" at script level for Vim9 script.
(Ben Jackson, #5671)
Can we share the code from ex_let_const() between direct execution and
compiling?
- Disallow unlet for local/script/imported vars
- Make "++nr" work.
+- Make closures work:
+ - Create closure in a loop. Need to make a list of them.
- expandcmd() with `=expr` in filename uses legacy expression.
- eval_expr() in ex_cexpr()
- eval_expr() call in dbg_parsearg() and debuggy_find()
-- Make "true" and "false" work in vim9script
+- has() is compiled as a constant, but some checks are dynamic.
+ Check for dynamic values, such as "gui_running".
New syntax and functionality:
Improve error checking:
- "echo Func()" is an error if Func() does not return anything.
@@ -113,6 +110,7 @@ Also:
- implement class
- implement interface
- predefined class: Promise<T>
+- implement enum
- Make accessing varargs faster: arg[expr]
EVAL expr
LOADVARARG (varags idx)
@@ -125,10 +123,12 @@ Further improvements:
body
enddef
- compile get_lambda_tv() in popup_add_timeout()
+- inline call to map() and filter()
- compile "skip" argument of searchpair()
- compile "expr" and "call" expression of a channel in channel_exe_cmd()?
Popup windows:
+- Can put focus in another window using API and "drop". (#6077)
- With some sequence get get hidden finished terminal buffer. (#5768)
Cannot close popup terminal (#5744)
Buffer can't be wiped, gets status "aF". (#5764)
@@ -201,8 +201,12 @@ Terminal emulator window:
background process, the window remains open, because the channel still
exists (and output still shows). Perhaps close the window when an explicit
++close was used? (#5931)
+- Using "CTRL-W :confirm quite" and selecting "yes" should work like ":quit!".
+ (Harm te Hennepe, #6129)
- When the job in the terminal doesn't use mouse events, let the scroll wheel
scroll the scrollback, like a terminal does at the shell prompt. #2490
+ A bit like using CTRL-W N first.
+ Jump back like with "a" when any key is typed.
And use modeless selection. #2962
- Use CTRL-W CTRL-K to enter a digraph? #5371
- When Vim runs in the terminal and changes the title, the statusline needs to
@@ -232,8 +236,10 @@ Terminal emulator window:
conversions.
Error numbers available:
-E453, E454, E460, E489, E491, E610, E611, E653,
-E856, E857, E861, E900
+E453, E454, E489, E610, E611, E653, E856, E857, E861, E900
+
+Patch to fix that typval related code is spread out. (Yegappan Lakshmanan,
+#6093)
Buffer autocommands are a bit inconsistent. Add a separate set of
autocommands for the buffer lifecycle:
@@ -254,6 +260,10 @@ Patch to explain use of "%" in :!. (David Briscoe, #5591)
Patch to improve Windows terminal support. (Nobuhiro Takasaki, #5546)
Ready to include.
+Patch to improve use of Lua path. (Prabir Shrestha, #6098)
+
+Patch to make exepath() work better on MS-Windows. (#6115)
+
Patch to add "-d" to xxd. (#5616)
Patch for the Haiku port: #5961
@@ -271,12 +281,17 @@ Patch to support different color for undercurl in cterm.
Patch to support cindent option to handle pragmas differently.
(Max Rumpf, #5468)
+Patch to add ":syn foldlevel" to use fold level further down the line.
+(Brad King, 2016 Oct 19, update 2017 Jan 30, now in #6087)
+
File marks merging has duplicates since 7.4.1925. (Ingo Karkat, #5733)
-Running test_gui and test_gui_init with Motif sometimes kills the window
-manager. Problem with Motif? Now test_gui crashes in submenu_change().
+"make test_gui" crashed in submenu_change(). Fix and remove workaround in
+add_pixmap_args().
Athena is OK.
Motif: Build on Ubuntu can't enter any text in dialog text fields.
+Running test_gui and test_gui_init with Motif sometimes kills the window
+manager. Problem with Motif?
:map output does not clear the reset of the command line.
(#5623, also see #5962)
@@ -287,6 +302,9 @@ Flag in 'formatoptions' is not used in the tests.
Patch to add 'vtp' option. (#5344)
Needs better docs. Is there a better name?
+Patch to add argument to trim() to only trim start or end of a string.
+(Yegappan, #6126)
+
undo result wrong: Masato Nishihata, #4798
Patch for Template string: #4491. New pull: #4634
@@ -300,6 +318,14 @@ Patch to delete BeOS code. (#5817) Anyone who wants to keep it?
With bash ":make" does not set v:shell_error. Possible solution: set
'shellpipe' to "2>&1| tee %s; exit ${PIPESTATUS[0]}" #5994
+Using mode() when "/pat" is used in Visual mode returns "v" instead of "c",
+which is not useful. Return "c/v" instead. And "c/o" when using "d/pat".
+#6127
+
+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.
+
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)
@@ -319,6 +345,8 @@ Patch to add function to return the text used in the quickfix window.
Patch to add readdirex() (Ken Takata, #5619)
+Wrong error when using local arglist. (Harm te Hennepe, #6133)
+
Request to support <Cmd> in mappings, similar to how Neovim does this.
(Daniel Hahler, #4784)
@@ -389,6 +417,9 @@ support combining characters. (Charles Campbell) Also #4687
Add "t" action to settagstack(): truncate and add new entries. (#5405)
+When 'relativenumber' is set the line just below a diff change doesn't get
+updated. (#6138)
+
Result of synID() sometimes wrong in help files. (#5252)
Status line is nut updated when splitting windows. (Marcin Szamotulski, #5496)
@@ -1329,6 +1360,8 @@ sort() is not stable when using numeric/float sort (Nikolay Pavlov, 2016 Sep
- Add ch_readlines(): for a channel in NL mode, reads as many lines as are
available. Should be more efficient than looping over ch_read() with
ch_status() to check for more.
+- If buffer contents is changed in a callback, set w_redr_status so that it
+ gets redrawn in redraw_after_callback(). #6120
- Add a separate timeout for opening a socket. Currently it's fixed at 50
msec, which is too small for a remote connection. (tverniquet, #2130)
- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026)
@@ -1452,9 +1485,6 @@ Also with latest version.
Cannot delete a file with square brackets with delete(). (#696)
-Patch to add ":syn foldlevel" to use fold level further down the line.
-(Brad King, 2016 Oct 19, update 2017 Jan 30)
-
Completion for input() does not expand environment variables. (chdiza, 2016
Jul 25, #948)
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 3eec280364..9a74b3ae7b 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 May 09
+*vim9.txt* For Vim version 8.2. Last change: 2020 May 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41,9 +41,10 @@ A secondary goal is to avoid Vim-specific constructs and get closer to
commonly used programming languages, such as JavaScript, TypeScript and Java.
The performance improvements can only be achieved by not being 100% backwards
-compatible. For example, in a function the arguments are not available in the
-"a:" dictionary, because creating that dictionary adds quite a lot of
-overhead. Other differences are more subtle, such as how errors are handled.
+compatible. For example, making function arguments available in the
+"a:" dictionary adds quite a lot of overhead. In a Vim9 function this
+dictionary is not available. Other differences are more subtle, such as how
+errors are handled.
The Vim9 script syntax and semantics are used in:
- a function defined with the `:def` command
@@ -79,12 +80,16 @@ Vim9 functions ~
A function defined with `:def` is compiled. Execution is many times faster,
often 10x to 100x times.
-Many errors are already found when compiling, before the function is called.
+Many errors are already found when compiling, before the function is executed.
The syntax is strict, to enforce code that is easy to read and understand.
-`:def` has no extra arguments like `:function` does: "range", "abort", "dict"
-or "closure". A `:def` function always aborts on an error, does not get a
-range passed and cannot be a "dict" function.
+Compilation is done when the function is first called, or when the
+`:defcompile` command is encountered in the script where the function was
+defined.
+
+`:def` has no options like `:function` does: "range", "abort", "dict" or
+"closure". A `:def` function always aborts on an error, does not get a range
+passed and cannot be a "dict" function.
The argument types and return type need to be specified. The "any" type can
be used, type checking will then be done at runtime, like with legacy
@@ -118,8 +123,8 @@ search for the function in this order:
- Local to the current scope and outer scopes up to the function scope.
- Local to the current script file.
- Imported functions, see `:import`.
-In all cases the function must be defined before used. To make a call cycle a
-global function needs to be used. (TODO: can we fix this?)
+In all cases the function must be defined before used. That is when it is
+first called or when `:defcompile` causes the call to be compiled.
The result is that functions and variables without a namespace can always be
found in the script, either defined there or imported. Global functions and
@@ -127,57 +132,7 @@ variables could be defined anywhere (good luck finding where!).
Global functions can be still be defined and deleted at nearly any time. In
Vim9 script script-local functions are defined once when the script is sourced
-and cannot be deleted.
-
-
-Four phases when loading a Vim9 script ~
-
-In legacy script the functions are created when encountered, but parsed only
-when used. This allows for defining functions in any order and having them
-call each other, so long as the function is defined when it is called: >
- func One()
- call Two()
- endfunc
- func Two()
- if cond
- call One() " recursive call
- endif
- endfunc
- call One()
-
-In Vim9 script the functions are compiled. When using the same functions as
-the above example it is not possible to compile function One without knowing
-that function Two exists. Or this would require a runtime check, which is slow
-and does not allow for compile time type checking.
-
-When sourcing a Vim9 script this happens in four phases:
-1. Cleanup: If the script was sourced before all script-local variables,
- imports and functions are deleted.
-2. Discovery: The script is read and declarations of functions, imports and
- variables are recognized and the type is parsed. Variable initializers
- that are a constant are evaluated, this can also give the type of the
- variable.
-3. Compilation: Functions are compiled. The script-local functions, imports
- and variables from the discovery phase are found and types are checked.
-4. Execution: the commands in the script are executed, top to bottom.
- Functions are skipped over, they do do not need to be processed again.
- Variable initializers are evaluated when encountered. Note that if a
- function called earlier has set the value this will be over-written. It is
- best to declare variables before where they are used to avoid confusion.
-
-The result is that items defined at the script level can be used anywhere in
-the script. This allows for putting the main function at the top: >
- def Main()
- SubOne()
- SubTwo()
- enddef
- def SubOne()
- ...
- def SubTwo()
- ...
-
-Note that script-local variables should either have a type defined or have a
-constant initializer. Otherwise an error is given for the type being unknown.
+and cannot be deleted or replaced.
Variable declarations with :let and :const ~
@@ -212,8 +167,8 @@ The declaration must be done earlier: >
endif
echo inner
-To intentionally use a variable that won't be available later, a block can be
-used: >
+To intentionally avoid a variable being available later, a block can be used:
+>
{
let temp = 'temp'
...
@@ -437,7 +392,9 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
`:def`, but it is not possible to nest `:def` inside
`:function`, for backwards compatibility.
- [!] is used as with `:function`.
+ [!] is used as with `:function`. Note that in Vim9
+ script script-local functions cannot be deleted or
+ redefined.
*:enddef*
:enddef End of a function defined with `:def`.
@@ -448,6 +405,10 @@ variables can be accessed without the "s:" prefix. They must be defined
before the function. If the script the function is defined in is legacy
script, then script-local variables must be accessed with the "s:" prefix.
+ *:defc* *:defcompile*
+:defc[ompile] Compile functions defined in the current script that
+ were not compiled yet.
+ This will report errors found during the compilation.
*:disa* *:disassemble*
:disa[ssemble] {func} Show the instructions generated for {func}.
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 751a033045..150f54a54e 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2018 Aug 07
+" Last Change: 2020 May 17
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -12,7 +12,7 @@ endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
-set cpo-=C
+set cpo&vim
if !exists('*VimFtpluginUndo')
func VimFtpluginUndo()
@@ -63,14 +63,14 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps")
let b:did_add_maps = 1
" Move around functions.
- nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR>
- vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR>
- nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR>
- vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR>
- nnoremap <silent><buffer> [] m':call search('^\s*endf\%[unction]\>', "bW")<CR>
- vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf\%[unction]\>', "bW")<CR>
- nnoremap <silent><buffer> ][ m':call search('^\s*endf\%[unction]\>', "W")<CR>
- vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf\%[unction]\>', "W")<CR>
+ nnoremap <silent><buffer> [[ m':call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR>
+ vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR>
+ nnoremap <silent><buffer> ]] m':call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR>
+ vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR>
+ nnoremap <silent><buffer> [] m':call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR>
+ vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR>
+ nnoremap <silent><buffer> ][ m':call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR>
+ vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR>
" Move around comments
nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
diff --git a/runtime/indent/sshconfig.vim b/runtime/indent/sshconfig.vim
new file mode 100644
index 0000000000..b456a9e3aa
--- /dev/null
+++ b/runtime/indent/sshconfig.vim
@@ -0,0 +1,34 @@
+" Vim indent file
+" Language: ssh config file
+" Maintainer: JasonKim <git@jasonk.me>
+" Last Change: 2020 May 16
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal autoindent
+setlocal indentexpr=GetSshconfigIndent(v:lnum)
+setlocal indentkeys=o,O,*<Return>,0=~host\ ,0=~match\ ,0#,!^F
+
+let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<"
+
+if exists("*GetSshconfigIndent")
+ finish
+endif
+
+function GetSshconfigIndent(lnum)
+ let sw = shiftwidth()
+ let prev_lnum = prevnonblank(a:lnum - 1)
+ let curr_lnum = a:lnum
+ let prev_line = getline(prev_lnum)
+ let curr_line = getline(curr_lnum)
+ if curr_line =~? '^\s*\(host\|match\)\s'
+ return 0
+