aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/netrw.vim5
-rw-r--r--runtime/doc/api.txt49
-rw-r--r--runtime/doc/builtin.txt19
-rw-r--r--runtime/doc/deprecated.txt3
-rw-r--r--runtime/doc/diagnostic.txt33
-rw-r--r--runtime/doc/editorconfig.txt4
-rw-r--r--runtime/doc/ft_sql.txt6
-rw-r--r--runtime/doc/gui.txt2
-rw-r--r--runtime/doc/help.txt5
-rw-r--r--runtime/doc/index.txt4
-rw-r--r--runtime/doc/lsp.txt56
-rw-r--r--runtime/doc/lua-guide.txt1
-rw-r--r--runtime/doc/lua.txt15
-rw-r--r--runtime/doc/map.txt1
-rw-r--r--runtime/doc/mbyte.txt2
-rw-r--r--runtime/doc/news-0.10.txt2
-rw-r--r--runtime/doc/news.txt11
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt17
-rw-r--r--runtime/doc/options.txt30
-rw-r--r--runtime/doc/pattern.txt2
-rw-r--r--runtime/doc/quickfix.txt2
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/sign.txt15
-rw-r--r--runtime/doc/syntax.txt46
-rw-r--r--runtime/doc/treesitter.txt6
-rw-r--r--runtime/doc/usr_29.txt2
-rw-r--r--runtime/doc/vim_diff.txt21
-rw-r--r--runtime/ftplugin/abaqus.vim3
-rw-r--r--runtime/ftplugin/arduino.lua1
-rw-r--r--runtime/ftplugin/arduino.vim3
-rw-r--r--runtime/ftplugin/asm.vim3
-rw-r--r--runtime/ftplugin/astro.vim7
-rw-r--r--runtime/ftplugin/bitbake.vim3
-rw-r--r--runtime/ftplugin/c.lua2
-rw-r--r--runtime/ftplugin/c.vim3
-rw-r--r--runtime/ftplugin/calendar.vim3
-rw-r--r--runtime/ftplugin/calender.lua1
-rw-r--r--runtime/ftplugin/cgdbrc.vim3
-rw-r--r--runtime/ftplugin/ch.lua1
-rw-r--r--runtime/ftplugin/cpp.vim6
-rw-r--r--runtime/ftplugin/cs.lua2
-rw-r--r--runtime/ftplugin/csh.vim3
-rw-r--r--runtime/ftplugin/css.lua1
-rw-r--r--runtime/ftplugin/css.vim3
-rw-r--r--runtime/ftplugin/d.lua2
-rw-r--r--runtime/ftplugin/desktop.vim3
-rw-r--r--runtime/ftplugin/dtd.vim3
-rw-r--r--runtime/ftplugin/dtrace.vim5
-rw-r--r--runtime/ftplugin/dts.vim3
-rw-r--r--runtime/ftplugin/erlang.vim5
-rw-r--r--runtime/ftplugin/eruby.vim3
-rw-r--r--runtime/ftplugin/fennel.vim3
-rw-r--r--runtime/ftplugin/fish.vim3
-rw-r--r--runtime/ftplugin/fortran.vim3
-rw-r--r--runtime/ftplugin/fstab.vim3
-rw-r--r--runtime/ftplugin/gdb.vim3
-rw-r--r--runtime/ftplugin/glsl.lua1
-rw-r--r--runtime/ftplugin/groovy.vim3
-rw-r--r--runtime/ftplugin/hamster.vim3
-rw-r--r--runtime/ftplugin/help.lua4
-rw-r--r--runtime/ftplugin/help.vim72
-rw-r--r--runtime/ftplugin/html.vim3
-rw-r--r--runtime/ftplugin/indent.lua2
-rw-r--r--runtime/ftplugin/indent.vim3
-rw-r--r--runtime/ftplugin/initex.vim3
-rw-r--r--runtime/ftplugin/java.vim3
-rw-r--r--runtime/ftplugin/javascript.vim3
-rw-r--r--runtime/ftplugin/jq.vim3
-rw-r--r--runtime/ftplugin/jsonc.vim3
-rw-r--r--runtime/ftplugin/kdl.vim17
-rw-r--r--runtime/ftplugin/lc.vim13
-rw-r--r--runtime/ftplugin/ld.vim5
-rw-r--r--runtime/ftplugin/liquid.vim3
-rw-r--r--runtime/ftplugin/lisp.vim3
-rw-r--r--runtime/ftplugin/markdown.vim3
-rw-r--r--runtime/ftplugin/mma.vim5
-rw-r--r--runtime/ftplugin/modula2.vim3
-rw-r--r--runtime/ftplugin/modula3.vim3
-rw-r--r--runtime/ftplugin/nroff.vim6
-rw-r--r--runtime/ftplugin/objc.lua1
-rw-r--r--runtime/ftplugin/obse.vim7
-rw-r--r--runtime/ftplugin/ocaml.vim4
-rw-r--r--runtime/ftplugin/odin.vim5
-rw-r--r--runtime/ftplugin/openvpn.vim3
-rw-r--r--runtime/ftplugin/pascal.vim3
-rw-r--r--runtime/ftplugin/pdf.vim3
-rw-r--r--runtime/ftplugin/perl.vim3
-rw-r--r--runtime/ftplugin/php.vim3
-rw-r--r--runtime/ftplugin/ps1.vim3
-rw-r--r--runtime/ftplugin/ps1xml.vim3
-rw-r--r--runtime/ftplugin/qml.vim3
-rw-r--r--runtime/ftplugin/racket.vim5
-rw-r--r--runtime/ftplugin/raku.vim13
-rw-r--r--runtime/ftplugin/rasi.vim25
-rw-r--r--runtime/ftplugin/rust.vim11
-rw-r--r--runtime/ftplugin/scdoc.vim9
-rw-r--r--runtime/ftplugin/scheme.vim15
-rw-r--r--runtime/ftplugin/svelte.vim13
-rw-r--r--runtime/ftplugin/tcl.vim3
-rw-r--r--runtime/ftplugin/typescript.vim3
-rw-r--r--runtime/ftplugin/vim.vim3
-rw-r--r--runtime/ftplugin/wat.vim3
-rw-r--r--runtime/ftplugin/xdefaults.lua1
-rw-r--r--runtime/ftplugin/xdefaults.vim9
-rw-r--r--runtime/ftplugin/xml.vim3
-rw-r--r--runtime/ftplugin/xs.lua1
-rw-r--r--runtime/indent/kdl.vim26
-rw-r--r--runtime/lua/editorconfig.lua21
-rw-r--r--runtime/lua/man.lua15
-rw-r--r--runtime/lua/tohtml.lua12
-rw-r--r--runtime/lua/vim/_comment.lua11
-rw-r--r--runtime/lua/vim/_defaults.lua30
-rw-r--r--runtime/lua/vim/_editor.lua5
-rw-r--r--runtime/lua/vim/_meta/api.lua65
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua3
-rw-r--r--runtime/lua/vim/_meta/api_keysets_extra.lua4
-rw-r--r--runtime/lua/vim/_meta/builtin.lua1
-rw-r--r--runtime/lua/vim/_meta/builtin_types.lua7
-rw-r--r--runtime/lua/vim/_meta/options.lua30
-rw-r--r--runtime/lua/vim/_meta/spell.lua2
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua58
-rw-r--r--runtime/lua/vim/_options.lua12
-rw-r--r--runtime/lua/vim/deprecated/health.lua2
-rw-r--r--runtime/lua/vim/diagnostic.lua23
-rw-r--r--runtime/lua/vim/filetype.lua4
-rw-r--r--runtime/lua/vim/filetype/detect.lua4
-rw-r--r--runtime/lua/vim/glob.lua11
-rw-r--r--runtime/lua/vim/highlight.lua49
-rw-r--r--runtime/lua/vim/iter.lua2
-rw-r--r--runtime/lua/vim/lsp.lua11
-rw-r--r--runtime/lua/vim/lsp/_changetracking.lua3
-rw-r--r--runtime/lua/vim/lsp/_dynamic.lua4
-rw-r--r--runtime/lua/vim/lsp/_meta/protocol.lua2
-rw-r--r--runtime/lua/vim/lsp/client.lua16
-rw-r--r--runtime/lua/vim/lsp/completion.lua333
-rw-r--r--runtime/lua/vim/lsp/handlers.lua1
-rw-r--r--runtime/lua/vim/lsp/inlay_hint.lua6
-rw-r--r--runtime/lua/vim/lsp/log.lua2
-rw-r--r--runtime/lua/vim/lsp/protocol.lua342
-rw-r--r--runtime/lua/vim/lsp/rpc.lua4
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua13
-rw-r--r--runtime/lua/vim/lsp/util.lua113
-rw-r--r--runtime/lua/vim/provider/health.lua2
-rw-r--r--runtime/lua/vim/shared.lua80
-rw-r--r--runtime/lua/vim/treesitter.lua2
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua1
-rw-r--r--runtime/lua/vim/treesitter/_meta.lua2
-rw-r--r--runtime/lua/vim/treesitter/dev.lua2
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua6
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua10
-rw-r--r--runtime/lua/vim/ui.lua8
-rw-r--r--runtime/lua/vim/vimhelp.lua38
-rw-r--r--runtime/optwin.vim4
-rw-r--r--runtime/queries/vimdoc/highlights.scm16
-rw-r--r--runtime/syntax/deb822sources.vim2
-rw-r--r--runtime/syntax/java.vim24
-rw-r--r--runtime/syntax/kdl.vim45
-rw-r--r--runtime/syntax/lc.vim2
-rw-r--r--runtime/syntax/mma.vim2
-rw-r--r--runtime/syntax/rasi.vim298
-rw-r--r--runtime/syntax/vim.vim29
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor2
162 files changed, 1499 insertions, 1095 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index ae602c5be6..a1929636e5 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -12,6 +12,8 @@
" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
" 2024 May 09 by Vim Project: remove hard-coded private.ppk
" 2024 May 10 by Vim Project: recursively delete directories by default
+" 2024 May 13 by Vim Project: prefer scp over pscp
+" 2024 Jun 04 by Vim Project: set bufhidden if buffer changed, nohidden is set and buffer shall be switched (#14915)
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
@@ -5681,6 +5683,9 @@ fun! s:NetrwEditFile(cmd,opt,fname)
exe "NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname)
else
" call Decho("exe NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname))
+ if a:cmd =~# 'e\%[new]!' && !&hidden && getbufvar(bufname('%'), '&modified', 0)
+ call setbufvar(bufname('%'), '&bufhidden', 'hide')
+ endif
exe "NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname)
endif
" call Dret("s:NetrwEditFile")
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 38960e1bc2..f92a69af4e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -2138,14 +2138,14 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• |api-buffer-updates-lua|
nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
- call a function with buffer as temporary current buffer
+ Call a function with buffer as temporary current buffer.
This temporarily switches current buffer to "buffer". If the current
- window already shows "buffer", the window is not switched If a window
- inside the current tabpage (including a float) already shows the buffer
- One of these windows will be set as current window temporarily. Otherwise
- a temporary scratch window (called the "autocmd window" for historical
- reasons) will be used.
+ window already shows "buffer", the window is not switched. If a window
+ inside the current tabpage (including a float) already shows the buffer,
+ then one of these windows will be set as current window temporarily.
+ Otherwise a temporary scratch window (called the "autocmd window" for
+ historical reasons) will be used.
This is useful e.g. to call Vimscript functions that only work with the
current buffer/window currently, like |termopen()|.
@@ -2758,8 +2758,6 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
• url: A URL to associate with this extmark. In the TUI, the
OSC 8 control sequence is used to generate a clickable
hyperlink to this URL.
- • scoped: boolean (EXPERIMENTAL) enables "scoping" for the
- extmark. See |nvim__win_add_ns()|
Return: ~
Id of the created/updated extmark
@@ -2831,7 +2829,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
["buf", bufnr, tick]
<
• on_win: called when starting to redraw a specific window. >
- ["win", winid, bufnr, topline, botline]
+ ["win", winid, bufnr, toprow, botrow]
<
• on_line: called for each buffer line being redrawn. (The
interaction with fold lines is subject to change) >
@@ -2841,41 +2839,26 @@ nvim_set_decoration_provider({ns_id}, {opts})
["end", tick]
<
-nvim__win_add_ns({window}, {ns_id}) *nvim__win_add_ns()*
+nvim__ns_get({ns_id}) *nvim__ns_get()*
EXPERIMENTAL: this API will change in the future.
- Scopes a namespace to the a window, so extmarks in the namespace will be
- active only in the given window.
+ Get the properties for namespace
Parameters: ~
- • {window} Window handle, or 0 for current window
- • {ns_id} Namespace
-
- Return: ~
- true if the namespace was added, else false
-
-nvim__win_del_ns({window}, {ns_id}) *nvim__win_del_ns()*
- EXPERIMENTAL: this API will change in the future.
-
- Unscopes a namespace (un-binds it from the given scope).
-
- Parameters: ~
- • {window} Window handle, or 0 for current window
- • {ns_id} the namespace to remove
+ • {ns_id} Namespace
Return: ~
- true if the namespace was removed, else false
+ Map defining the namespace properties, see |nvim__ns_set()|
-nvim__win_get_ns({window}) *nvim__win_get_ns()*
+nvim__ns_set({ns_id}, {opts}) *nvim__ns_set()*
EXPERIMENTAL: this API will change in the future.
- Gets the namespace scopes for a given window.
+ Set some properties for namespace
Parameters: ~
- • {window} Window handle, or 0 for current window
-
- Return: ~
- a list of namespaces ids
+ • {ns_id} Namespace
+ • {opts} Optional parameters to set:
+ • wins: a list of windows to be scoped in
==============================================================================
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 1a762c6ec0..8ee01d6156 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -4102,10 +4102,21 @@ line({expr} [, {winid}]) *line()*
display isn't updated, e.g. in silent Ex mode)
w$ last line visible in current window (this is one
less than "w0" if no lines are visible)
- v In Visual mode: the start of the Visual area (the
- cursor is the end). When not in Visual mode
- returns the cursor position. Differs from |'<| in
- that it's updated right away.
+ v When not in Visual mode, returns the cursor
+ position. In Visual mode, returns the other end
+ of the Visual area. A good way to think about
+ this is that in Visual mode "v" and "." complement
+ each other. While "." refers to the cursor
+ position, "v" refers to where |v_o| would move the
+ cursor. As a result, you can use "v" and "."
+ together to work on all of a selection in
+ characterwise visual mode. If the cursor is at
+ the end of a characterwise visual area, "v" refers
+ to the start of the same visual area. And if the
+ cursor is at the start of a characterwise visual
+ area, "v" refers to the end of the same visual
+ area. "v" differs from |'<| and |'>| in that it's
+ updated right away.
Note that a mark in another file can be used. The line number
then applies to another buffer.
To get the column number use |col()|. To get both use
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 3b3e6afa9e..6c6585d76e 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -22,9 +22,6 @@ API
LUA
- vim.region() Use |getregionpos()| instead.
-LSP
-- *vim.lsp.util.buf_versions* Use |b:changedtick| instead.
-
DIAGNOSTICS
- *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count = 1}` instead.
- *vim.diagnostic.goto_prev()* Use |vim.diagnostic.jump()| with `{count = -1}` instead.
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 2438c48154..05af2eddc3 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -363,7 +363,6 @@ Lua module: vim.diagnostic *diagnostic-api*
• {message} (`string`) The diagnostic text
• {source}? (`string`) The source of the diagnostic
• {code}? (`string|integer`) The diagnostic code
- • {_tags}? (`{ deprecated: boolean, unnecessary: boolean}`)
• {user_data}? (`any`) arbitrary data plugins can add
• {namespace}? (`integer`)
@@ -393,11 +392,11 @@ Lua module: vim.diagnostic *diagnostic-api*
by {count} diagnostics, while a negative integer moves
backward by {count} diagnostics. Mutually exclusive
with {diagnostic}.
- • {pos}? (`{[1]:integer,[2]:integer}`) Cursor position as a
- `(row, col)` tuple. See |nvim_win_get_cursor()|. Used
- to find the nearest diagnostic when {count} is used.
- Only used when {count} is non-nil. Default is the
- current cursor position.
+ • {pos}? (`[integer,integer]`) Cursor position as a `(row, col)`
+ tuple. See |nvim_win_get_cursor()|. Used to find the
+ nearest diagnostic when {count} is used. Only used when
+ {count} is non-nil. Default is the current cursor
+ position.
• {wrap}? (`boolean`, default: `true`) Whether to loop around
file or not. Similar to 'wrapscan'.
• {severity}? (`vim.diagnostic.SeverityFilter`) See
@@ -467,18 +466,18 @@ Lua module: vim.diagnostic *diagnostic-api*
current cursor position (`cursor`). Shorthand
versions are also accepted (`c` for `cursor`, `l`
for `line`, `b` for `buffer`).
- • {pos}? (`integer|{[1]:integer,[2]:integer}`) If {scope} is
- "line" or "cursor", use this position rather than
- the cursor position. If a number, interpreted as a
- line number; otherwise, a (row, col) tuple.
+ • {pos}? (`integer|[integer,integer]`) If {scope} is "line"
+ or "cursor", use this position rather than the
+ cursor position. If a number, interpreted as a line
+ number; otherwise, a (row, col) tuple.
• {severity_sort}? (`boolean|{reverse?:boolean}`, default: `false`)
Sort diagnostics by severity. Overrides the setting
from |vim.diagnostic.config()|.
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|. Overrides the setting from
|vim.diagnostic.config()|.
- • {header}? (`string|{[1]:string,[2]:any}`) String to use as the
- header for the floating window. If a table, it is
+ • {header}? (`string|[string,any]`) String to use as the header
+ for the floating window. If a table, it is
interpreted as a `[text, hl_group]` tuple. Overrides
the setting from |vim.diagnostic.config()|.
• {source}? (`boolean|'if_many'`) Include the diagnostic source
@@ -516,10 +515,11 @@ Lua module: vim.diagnostic *diagnostic-api*
*vim.diagnostic.Opts.Jump*
Fields: ~
- • {float}? (`boolean|vim.diagnostic.Opts.Float`) Default value of
- the {float} parameter of |vim.diagnostic.jump()|.
- • {wrap}? (`boolean`) Default value of the {wrap} parameter of
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, default: false)
+ Default value of the {float} parameter of
|vim.diagnostic.jump()|.
+ • {wrap}? (`boolean`, default: true) Default value of the {wrap}
+ parameter of |vim.diagnostic.jump()|.
• {severity}? (`vim.diagnostic.SeverityFilter`) Default value of the
{severity} parameter of |vim.diagnostic.jump()|.
@@ -591,8 +591,7 @@ Lua module: vim.diagnostic *diagnostic-api*
<
• {hl_mode}? (`'replace'|'combine'|'blend'`) See
|nvim_buf_set_extmark()|.
- • {virt_text}? (`{[1]:string,[2]:any}[]`) See
- |nvim_buf_set_extmark()|.
+ • {virt_text}? (`[string,any][]`) See |nvim_buf_set_extmark()|.
• {virt_text_pos}? (`'eol'|'overlay'|'right_align'|'inline'`) See
|nvim_buf_set_extmark()|.
• {virt_text_win_col}? (`integer`) See |nvim_buf_set_extmark()|.
diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt
index 0b20c77801..eef14ed51c 100644
--- a/runtime/doc/editorconfig.txt
+++ b/runtime/doc/editorconfig.txt
@@ -78,6 +78,10 @@ root *editorconfig.root*
directories. This property must be at the top-level of the `.editorconfig`
file (i.e. it must not be within a glob section).
+spelling_language *editorconfig.spelling_language*
+ A code of the format ss or ss-TT, where ss is an ISO 639 language code and
+ TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
+
tab_width *editorconfig.tab_width*
The display size of a single tab character. Sets the 'tabstop' option.
diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt
index 241fa4bd74..1dbac66db0 100644
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -293,7 +293,7 @@ loaded by Vim: >
ftplugin/sql.vim
syntax/sqlinformix.vim
indent/sql.vim
->
+<
Notice indent/sqlinformix.sql was not loaded. There is no indent file
for Informix, Vim loads the default files if the specified files does not
exist.
@@ -349,7 +349,7 @@ The defaults static maps are: >
The use of "<C-C>" can be user chosen by using the following in your |init.vim|
as it may not work properly on all platforms: >
let g:ftplugin_sql_omni_key = '<C-C>'
->
+<
The static maps (which are based on the syntax highlight groups) follow this
format: >
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
@@ -664,7 +664,7 @@ your |init.vim|: >
filetype is changed temporarily to SQL, the sqlcompletion plugin
will cache the syntax groups listed in the List specified in this
option.
->
+
------------------------------------------------------------------------------
4.5 SQL Maps *sql-completion-maps*
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index a64d722177..104413ce0d 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -221,7 +221,7 @@ is right aligned, and the "O" is underlined, to indicate it is the shortcut.
*:am* *:amenu* *:an* *:anoremenu*
The ":amenu" command can be used to define menu entries for all modes at once,
-expect for Terminal mode. To make the command work correctly, a character is
+except for Terminal mode. To make the command work correctly, a character is
automatically inserted for some modes:
mode inserted appended ~
Normal nothing nothing
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 43f80101ed..fefead7fc9 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -127,6 +127,7 @@ PROGRAMMING LANGUAGE SUPPORT
|filetype| Settings for specific types of files
|quickfix| Commands for a quick edit-compile-fix cycle
|ft_ada.txt| Ada filetype plugin
+|ft_hare.txt| Filetype plugin for Hare
|ft_ps1.txt| PowerShell filetype plugin
|ft_raku.txt| Raku filetype plugin
|ft_rust.txt| Rust filetype plugin
@@ -187,7 +188,7 @@ Local additions ~
*local-additions*
------------------------------------------------------------------------------
-*bars* Bars example
+Bars example *bars*
Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.
@@ -199,5 +200,5 @@ You can use CTRL-] on any word (even if it is not within "|") and Nvim will
try to find help for it. Especially for options in single quotes, e.g.
'hlsearch'.
-------------------------------------------------------------------------------
+
vim:tw=78:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 79f10b33f1..05c8b94d94 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -366,7 +366,7 @@ tag char note action in Normal mode ~
or start of putted text
|`]| `] 1 cursor to the end of last operated text or
end of putted text
-|``| `` 1 cursor to the position before latest jump
+|``| "``" 1 cursor to the position before latest jump
|`{| `{ 1 cursor to the start of the current paragraph
|`}| `} 1 cursor to the end of the current paragraph
|a| a 2 append text after the cursor N times
@@ -1136,7 +1136,7 @@ tag command action ~
|:!!| :!! repeat last ":!" command
|:#| :# same as ":number"
|:&| :& repeat last ":substitute"
-|:star| :* use the last Visual area, like :'<,'>
+|:star| :* use the last Visual area, like ":'<,'>"
|:<| :< shift lines one 'shiftwidth' left
|:=| := print the last line number
|:>| :> shift lines one 'shiftwidth' right
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index a78a16968f..ca9dfd0350 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -514,10 +514,10 @@ LspAttach *LspAttach*
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
- if client.server_capabilities.completionProvider then
+ if client.supports_method("textDocument/completion") then
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
end
- if client.server_capabilities.definitionProvider then
+ if client.supports_method("textDocument/definition") then
vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc"
end
end,
@@ -874,13 +874,13 @@ start({config}, {opts}) *vim.lsp.start()*
• {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
|vim.lsp.ClientConfig|.
• {opts} (`table?`) Optional keyword arguments
- • {reuse_client}
+ • {reuse_client}?
(`fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean`)
Predicate used to decide if a client should be re-used.
Used on all running clients. The default implementation
re-uses a client if name and root_dir matches.
- • {bufnr} (`integer`) Buffer handle to attach to if starting
- or re-using a client (0 for current).
+ • {bufnr}? (`integer`) Buffer handle to attach to if
+ starting or re-using a client (0 for current).
• {silent}? (`boolean`) Suppress error reporting if the LSP
server fails to start (default false).
@@ -1832,8 +1832,8 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
document.
Parameters: ~
- • {text_document_edit} (`table`) a `TextDocumentEdit` object
- • {index} (`integer`) Optional index of the edit, if from
+ • {text_document_edit} (`lsp.TextDocumentEdit`)
+ • {index} (`integer?`) Optional index of the edit, if from
a list of edits (or nil, if not from a list)
• {offset_encoding} (`string?`)
@@ -1845,7 +1845,7 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer.
Parameters: ~
- • {text_edits} (`table`) list of `TextEdit` objects
+ • {text_edits} (`lsp.TextEdit[]`)
• {bufnr} (`integer`) Buffer id
• {offset_encoding} (`string`) utf-8|utf-16|utf-32
@@ -1857,7 +1857,7 @@ apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`.
Parameters: ~
- • {workspace_edit} (`table`) `WorkspaceEdit`
+ • {workspace_edit} (`lsp.WorkspaceEdit`)
• {offset_encoding} (`string`) utf-8|utf-16|utf-32 (required)
See also: ~
@@ -1875,8 +1875,7 @@ buf_highlight_references({bufnr}, {references}, {offset_encoding})
Parameters: ~
• {bufnr} (`integer`) Buffer id
- • {references} (`table`) List of `DocumentHighlight` objects to
- highlight
+ • {references} (`lsp.DocumentHighlight[]`) objects to highlight
• {offset_encoding} (`string`) One of "utf-8", "utf-16", "utf-32".
See also: ~
@@ -1910,8 +1909,8 @@ convert_input_to_markdown_lines({input}, {contents})
Parameters: ~
• {input} (`lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent`)
- • {contents} (`table?`) List of strings to extend with converted lines.
- Defaults to {}.
+ • {contents} (`string[]?`) List of strings to extend with converted
+ lines. Defaults to {}.
Return: ~
(`string[]`) extended with lines of converted markdown.
@@ -1924,15 +1923,16 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers})
Converts `textDocument/signatureHelp` response to markdown lines.
Parameters: ~
- • {signature_help} (`table`) Response of `textDocument/SignatureHelp`
+ • {signature_help} (`lsp.SignatureHelp`) Response of
+ `textDocument/SignatureHelp`
• {ft} (`string?`) filetype that will be use as the `lang`
for the label markdown code block
• {triggers} (`table?`) list of trigger characters from the lsp
server. used to better determine parameter offsets
Return (multiple): ~
- (`table?`) table list of lines of converted markdown.
- (`table?`) table of active hl
+ (`string[]?`) table list of lines of converted markdown.
+ (`number[]?`) table of active hl
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
@@ -1954,7 +1954,7 @@ jump_to_location({location}, {offset_encoding}, {reuse_win})
Jumps to a location.
Parameters: ~
- • {location} (`table`) (`Location`|`LocationLink`)
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {offset_encoding} (`string?`) utf-8|utf-16|utf-32
• {reuse_win} (`boolean?`) Jump to existing window if buffer is
already open.
@@ -1983,7 +1983,9 @@ locations_to_items({locations}, {offset_encoding})
(`table[]`) A list of objects with the following fields:
• {filename} (`string`)
• {lnum} (`integer`) 1-indexed line number
+ • {end_lnum} (`integer`) 1-indexed end line number
• {col} (`integer`) 1-indexed column
+ • {end_col} (`integer`) 1-indexed end column
• {text} (`string`)
• {user_data} (`lsp.Location|lsp.LocationLink`)
@@ -2019,7 +2021,8 @@ make_formatting_params({options})
cursor position.
Parameters: ~
- • {options} (`table?`) with valid `FormattingOptions` entries
+ • {options} (`lsp.FormattingOptions?`) with valid `FormattingOptions`
+ entries
Return: ~
(`lsp.DocumentFormattingParams`) object
@@ -2059,7 +2062,7 @@ make_position_params({window}, {offset_encoding})
`window`
Return: ~
- (`table`) `TextDocumentPositionParams` object
+ (`lsp.TextDocumentPositionParams`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
@@ -2090,7 +2093,7 @@ make_text_document_params({bufnr})
• {bufnr} (`integer?`) Buffer handle, defaults to current
Return: ~
- (`table`) `TextDocumentIdentifier`
+ (`lsp.TextDocumentIdentifier`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
@@ -2100,8 +2103,11 @@ make_workspace_params({added}, {removed})
Create the workspace params
Parameters: ~
- • {added} (`table`)
- • {removed} (`table`)
+ • {added} (`lsp.WorkspaceFolder[]`)
+ • {removed} (`lsp.WorkspaceFolder[]`)
+
+ Return: ~
+ (`lsp.WorkspaceFoldersChangeEvent`)
*vim.lsp.util.open_floating_preview()*
open_floating_preview({contents}, {syntax}, {opts})
@@ -2145,7 +2151,7 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
definition)
Parameters: ~
- • {location} (`table`) a single `Location` or `LocationLink`
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {opts} (`table`)
Return (multiple): ~
@@ -2175,7 +2181,7 @@ show_document({location}, {offset_encoding}, {opts})
Shows document and optionally jumps to the location.
Parameters: ~
- • {location} (`table`) (`Location`|`LocationLink`)
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {offset_encoding} (`string?`) utf-8|utf-16|utf-32
• {opts} (`table?`) options
• reuse_win (boolean) Jump to existing window if
@@ -2200,7 +2206,7 @@ stylize_markdown({bufnr}, {contents}, {opts})
Parameters: ~
• {bufnr} (`integer`)
- • {contents} (`table`) of lines to show in window
+ • {contents} (`string[]`) of lines to show in window
• {opts} (`table`) with optional fields
• height of floating window
• width of floating window
diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt
index e8757a1859..5f06d51f42 100644
--- a/runtime/doc/lua-guide.txt
+++ b/runtime/doc/lua-guide.txt
@@ -225,7 +225,6 @@ Vimscript are automatically converted:
end
vim.fn.jobstart('ls', { on_stdout = print_stdout })
- print(vim.fn.printf('Hello from %s', 'Lua'))
<
This works for both |builtin-functions| and |user-function|s.
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 8e600adeb9..3bfd1d1885 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -834,8 +834,8 @@ vim.spell.check({str}) *vim.spell.check()*
• {str} (`string`)
Return: ~
- (`{[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]`)
- List of tuples with three items:
+ (`[string, 'bad'|'rare'|'local'|'caps', integer][]`) List of tuples
+ with three items:
• The badly spelled word.
• The type of the spelling error: "bad" spelling mistake "rare" rare
word "local" word only valid in another region "caps" word should
@@ -981,6 +981,9 @@ vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()*
• {index} (`integer`)
• {use_utf16} (`boolean?`)
+ Return: ~
+ (`integer`)
+
vim.str_utf_end({str}, {index}) *vim.str_utf_end()*
Gets the distance (in bytes) from the last byte of the codepoint
(character) that {index} points to.
@@ -4079,10 +4082,10 @@ Iter:map({f}) *Iter:map()*
<
Parameters: ~
- • {f} (`fun(...):any`) Mapping function. Takes all values returned from
- the previous stage in the pipeline as arguments and returns one
- or more new values, which are used in the next pipeline stage.
- Nil return values are filtered from the output.
+ • {f} (`fun(...):...:any`) Mapping function. Takes all values returned
+ from the previous stage in the pipeline as arguments and returns
+ one or more new values, which are used in the next pipeline
+ stage. Nil return values are filtered from the output.
Return: ~
(`Iter`)
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 9ec34d5d52..f5cbb7b732 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1381,7 +1381,6 @@ completion can be enabled:
-complete=arglist file names in argument list
-complete=augroup autocmd groups
-complete=buffer buffer names
- -complete=behave :behave suboptions
-complete=color color schemes
-complete=command Ex command (and arguments)
-complete=compiler compilers
diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt
index 0a7e0baad3..a8c5670352 100644
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -686,7 +686,7 @@ You might want to select the font used for the menus. Unfortunately this
doesn't always work. See the system specific remarks below, and 'langmenu'.
-USING UTF-8 IN X-Windows *utf-8-in-xwindows*
+USING UTF-8 IN X-WINDOWS *utf-8-in-xwindows*
You need to specify a font to be used. For double-wide characters another
font is required, which is exactly twice as wide. There are three ways to do
diff --git a/runtime/doc/news-0.10.txt b/runtime/doc/news-0.10.txt
index d611eee242..bc868c1099 100644
--- a/runtime/doc/news-0.10.txt
+++ b/runtime/doc/news-0.10.txt
@@ -155,8 +155,6 @@ The following new features were added.
• |nvim_input_mouse()| supports mouse buttons "x1" and "x2".
• Added "force_crlf" option field in |nvim_open_term()|.
• Added |nvim_tabpage_set_win()| to set the current window of a tabpage.
- • |nvim__win_add_ns()| can bind a |namespace| to a window-local scope(s).
- • Extmarks opt-in to this scoping via the `scoped` flag of |nvim_buf_set_extmark()|.
• Mapping APIs now support abbreviations when mode short-name has suffix "a".
• Floating windows can now show footer with new `footer` and `footer_pos`
config fields. Uses |hl-FloatFooter| by default.
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 13e4b23ea1..4addbf84c3 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -83,7 +83,7 @@ The following new features were added.
API
-• TODO
+• |nvim__ns_set()| can set properties for a namespace
DEFAULTS
@@ -113,6 +113,7 @@ LSP
• Completion side effects (including snippet expansion, execution of commands
and application of additional text edits) is now built-in.
+• |vim.lsp.util.locations_to_items()| sets `end_col` and `end_lnum` fields.
LUA
@@ -128,7 +129,8 @@ PERFORMANCE
PLUGINS
-• TODO
+• EditorConfig
+ • spelling_language property is now supported.
STARTUP
@@ -136,7 +138,10 @@ STARTUP
TERMINAL
-• TODO
+• The |terminal| now understands the OSC 52 escape sequence to write to the
+ system clipboard (copy). Querying with OSC 52 (paste) is not supported.
+• |hl-StatusLineTerm| and |hl-StatusLineTermNC| define highlights for the
+ status line in |terminal| windows.
TREESITTER
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index a6ebc7e958..81bcd89146 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -164,7 +164,22 @@ directory indicated in the request. >lua
To try it out, select the above code and source it with `:'<,'>lua`, then run
this command in a :terminal buffer: >
- printf "\033]7;file://./foo/bar\033\\"
+ printf "\033]7;file://./foo/bar\033\\"
+
+OSC 52: write to system clipboard *terminal-osc52*
+
+Applications in the :terminal buffer can write to the system clipboard by
+emitting an OSC 52 sequence. Example: >
+
+ printf '\033]52;;%s\033\\' "$(echo -n 'Hello world' | base64)"
+
+Nvim uses the configured |clipboard| provider to write to the system
+clipboard. Reading from the system clipboard with OSC 52 is not supported, as
+this would allow any arbitrary program in the :terminal to read the user's
+clipboard.
+
+OSC 52 sequences sent from the :terminal buffer do not emit a |TermRequest|
+event. The event is handled directly by Nvim and is not forwarded to plugins.
==============================================================================
Status Variables *terminal-status*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index edda46e197..f02d3c9741 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1442,8 +1442,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'commentstring' 'cms' string (default "")
local to buffer
A template for a comment. The "%s" in the value is replaced with the
- comment text. For example, C uses "/*%s*/". Used for |commenting| and to
- add markers for folding, see |fold-marker|.
+ comment text, and should be padded with a space when possible.
+ Used for |commenting| and to add markers for folding, see |fold-marker|.
*'complete'* *'cpt'* *E535*
'complete' 'cpt' string (default ".,w,b,u,t")
@@ -1495,7 +1495,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'completeopt'* *'cot'*
'completeopt' 'cot' string (default "menu,preview")
- global
+ global or local to buffer |global-local|
A comma-separated list of options for Insert mode completion
|ins-completion|. The supported values are:
@@ -1517,6 +1517,10 @@ A jump table for the options with a short description can be found at |Q_op|.
completion in the preview window. Only works in
combination with "menu" or "menuone".
+ popup Show extra information about the currently selected
+ completion in a popup window. Only works in combination
+ with "menu" or "menuone". Overrides "preview".
+
noinsert Do not insert any text for a match until the user selects
a match from the menu. Only works in combination with
"menu" or "menuone". No effect if "longest" is present.
@@ -1525,9 +1529,13 @@ A jump table for the options with a short description can be found at |Q_op|.
select one from the menu. Only works in combination with
"menu" or "menuone".
- popup Show extra information about the currently selected
- completion in a popup window. Only works in combination
- with "menu" or "menuone". Overrides "preview".
+ fuzzy Enable |fuzzy-matching| for completion candidates. This
+ allows for more flexible and intuitive matching, where
+ characters can be skipped and matches can be found even
+ if the exact sequence is not typed. Only makes a
+ difference how completion candidates are reduced from the
+ list of alternatives, but not how the candidates are
+ collected (using different completion types).
*'completeslash'* *'csl'*
'completeslash' 'csl' string (default "")
@@ -5459,8 +5467,8 @@ A jump table for the options with a short description can be found at |Q_op|.
message; also for quickfix message (e.g., ":cn")
s don't give "search hit BOTTOM, continuing at TOP" or *shm-s*
"search hit TOP, continuing at BOTTOM" messages; when using
- the search count do not show "W" after the count message (see
- S below)
+ the search count do not show "W" before the count message
+ (see |shm-S| below)
t truncate file message at the start if it is too long *shm-t*
to fit on the command-line, "<" will appear in the left most
column; ignored in Ex mode
@@ -5482,7 +5490,11 @@ A jump table for the options with a short description can be found at |Q_op|.
`:silent` was used for the command; note that this also
affects messages from 'autoread' reloading
S do not show search count message when searching, e.g. *shm-S*
- "[1/5]"
+ "[1/5]". When the "S" flag is not present (e.g. search count
+ is shown), the "search hit BOTTOM, continuing at TOP" and
+ "search hit TOP, continuing at BOTTOM" messages are only
+ indicated by a "W" (Mnemonic: Wrapped) letter before the
+ search count statistics.
This gives you the opportunity to avoid that a change between buffers
requires you to hit <Enter>, but still gives as useful a message as
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 1ef182127c..67ef769203 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1494,5 +1494,7 @@ the matching positions and the fuzzy match scores.
The "f" flag of `:vimgrep` enables fuzzy matching.
+To enable fuzzy matching for |ins-completion|, add the "fuzzy" value to the
+'completeopt' option.
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 5d3c0cbdc2..897e503fc4 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1296,7 +1296,7 @@ passed to make, say :make html or :make pdf.
Additional arguments can be passed to pandoc:
- either by appending them to make, say `:make html --self-contained` .
-- or setting them in `b:pandoc_compiler_args` or `g:pandoc_compiler_args`
+- or setting them in `b:pandoc_compiler_args` or `g:pandoc_compiler_args`.
PERL *quickfix-perl* *compiler-perl*
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index c0d00d16cb..5eea9baa20 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -898,6 +898,7 @@ Short explanation of each option: *option-list*
'tagstack' 'tgst' push tags onto the tag stack
'term' name of the terminal
'termbidi' 'tbidi' terminal takes care of bi-directionality
+'termguicolors' 'tgc' enable 24-bit RGB color in the TUI
'textwidth' 'tw' maximum width of text that is being inserted
'thesaurus' 'tsr' list of thesaurus files for keyword completion
'thesaurusfunc' 'tsrfu' function to be used for thesaurus completion
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index 6fa260be40..a64ba0ea1c 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -67,15 +67,12 @@ sign group allows Vim plugins to use unique signs without interfering with
other plugins using signs.
*sign-priority*
-Each placed sign is assigned a priority value. When multiple signs are placed
-on the same line, the attributes of the sign with the highest priority is used
-independently of the sign group. The default priority for a sign is 10. The
-priority is assigned at the time of placing a sign.
-
-When multiple signs that each have an icon or text are present, signs are
-ordered with increasing priority from left to right, up until the maximum
-width set in 'signcolumn'. Lower priority signs that do not fit are hidden.
-Highest priority signs with highlight attributes are always shown.
+Each placed sign is assigned a priority value independently of the sign group.
+The default priority for a sign is 10. When multiple signs that each have an
+icon or text are placed on the same line, signs are ordered with decreasing
+priority from left to right, up until the maximum width set in 'signcolumn'.
+Lower priority signs that do not fit are hidden. Highest priority signs with
+highlight attributes are always shown.
When the line on which the sign is placed is deleted, the sign is removed along
with it.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 06d7ad8f7e..9fc415a158 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -466,14 +466,14 @@ ASTRO *astro.vim* *ft-astro-syntax*
Configuration
The following variables control certain syntax highlighting features.
-You can add them to your .vimrc: >
+You can add them to your .vimrc.
+
+To enable TypeScript and TSX for ".astro" files (default "disable"): >
let g:astro_typescript = "enable"
<
-Enables TypeScript and TSX for ".astro" files. Default Value: "disable" >
+To enable Stylus for ".astro" files (default "disable"): >
let g:astro_stylus = "enable"
<
-Enables Stylus for ".astro" files. Default Value: "disable"
-
NOTE: You need to install an external plugin to support stylus in astro files.
@@ -1437,7 +1437,7 @@ Note: Syntax folding might slow down syntax highlighting significantly,
especially for large files.
-HTML/OS (by Aestiva) *htmlos.vim* *ft-htmlos-syntax*
+HTML/OS (BY AESTIVA) *htmlos.vim* *ft-htmlos-syntax*
The coloring scheme for HTML/OS works as follows:
@@ -2575,6 +2575,13 @@ To highlight R code in knitr chunk headers, add to your |vimrc|: >
let rrst_syn_hl_chunk = 1
+RASI *rasi.vim* *ft-rasi-syntax*
+
+Rasi stands for Rofi Advanced Style Information. It is used by the program
+rofi to style the rendering of the search window. The language is heavily
+inspired by CSS stylesheet. Files with the following extensions are recognized
+as rasi files: .rasi.
+
READLINE *readline.vim* *ft-readline-syntax*
The readline library is primarily used by the BASH shell, which adds quite a
@@ -3320,23 +3327,31 @@ The g:vimsyn_embed option allows users to select what, if any, types of
embedded script highlighting they wish to have. >
g:vimsyn_embed == 0 : disable (don't embed any scripts)
- g:vimsyn_embed == 'lpPr' : support embedded lua, perl, python and ruby
+ g:vimsyn_embed == 'lpPr' : support embedded Lua, Perl, Python and Ruby
<
This option is disabled by default.
*g:vimsyn_folding*
-
-Some folding is now supported with syntax/vim.vim: >
+Some folding is now supported with when 'foldmethod' is set to "syntax": >
g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
g:vimsyn_folding =~ 'a' : augroups
g:vimsyn_folding =~ 'f' : fold functions
g:vimsyn_folding =~ 'h' : fold heredocs
- g:vimsyn_folding =~ 'l' : fold lua script
- g:vimsyn_folding =~ 'p' : fold perl script
- g:vimsyn_folding =~ 'P' : fold python script
- g:vimsyn_folding =~ 'r' : fold ruby script
+ g:vimsyn_folding =~ 'l' : fold Lua script
+ g:vimsyn_folding =~ 'p' : fold Perl script
+ g:vimsyn_folding =~ 'P' : fold Python script
+ g:vimsyn_folding =~ 'r' : fold Ruby script
<
- *g:vimsyn_noerror*
+
+By default, g:vimsyn_folding is unset. Concatenate the indicated characters
+to support folding of multiple syntax constructs (e.g.,
+g:vimsyn_folding = "fh" will enable folding of both functions and heredocs).
+
+ *g:vimsyn_comment_strings*
+By default, strings are highlighted inside comments. This may be disabled by
+setting g:vimsyn_comment_strings to false.
+
+ *g:vimsyn_noerror*
Not all error highlighting that syntax/vim.vim does may be correct; Vim script
is a difficult language to highlight correctly. A way to suppress error
highlighting is to put the following line in your |vimrc|: >
@@ -5092,6 +5107,11 @@ SpellRare Word that is recognized by the spellchecker as one that is
StatusLine Status line of current window.
*hl-StatusLineNC*
StatusLineNC Status lines of not-current windows.
+ *hl-StatusLineTerm*
+StatusLineTerm Status line of |terminal| window.
+ *hl-StatusLineTermNC*
+StatusLineTermNC
+ Status line of non-current |terminal| windows.
*hl-TabLine*
TabLine Tab pages line, not active tab page label.
*hl-TabLineFill*
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 0b84bb60d4..25b070b310 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -764,9 +764,9 @@ get_node({opts}) *vim.treesitter.get_node()*
• {opts} (`table?`) Optional keyword arguments:
• {bufnr} (`integer?`) Buffer number (nil or 0 for current
buffer)
- • {pos} (`{ [1]: integer, [2]: integer }?`) 0-indexed (row,
- col) tuple. Defaults to cursor position in the current
- window. Required if {bufnr} is not the current buffer
+ • {pos} (`[integer, integer]?`) 0-indexed (row, col) tuple.
+ Defaults to cursor position in the current window. Required
+ if {bufnr} is not the current buffer
• {lang} (`string?`) Parser language. (default: from buffer
filetype)
• {ignore_injections} (`boolean?`) Ignore injected languages
diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt
index dd8598a3a0..9929be5079 100644
--- a/runtime/doc/usr_29.txt
+++ b/runtime/doc/usr_29.txt
@@ -87,7 +87,7 @@ The ":tags" command shows the list of tags that you traversed through:
1 1 write_line 8 write_block.c ~
2 1 write_char 7 write_line.c ~
> ~
->
+<
Now to go back. The CTRL-T command goes to the preceding tag. In the example
above you get back to the "write_line" function, in the call to "write_char".
This command takes a count argument that indicates how many tags to jump
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index ac20948f14..a6f08402f6 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -166,6 +166,14 @@ nvim_terminal:
when 'background' is "light". While this may not reflect the actual
foreground/background color, it permits 'background' to be retained for a
nested Nvim instance running in the terminal emulator.
+- TermOpen: Sets default options for |terminal| buffers:
+ - 'nomodifiable'
+ - 'undolevels' set to -1
+ - 'textwidth' set to 0
+ - 'nowrap'
+ - 'nolist'
+ - 'winhighlight' uses |hl-StatusLineTerm| and |hl-StatusLineTermNC| in
+ place of |hl-StatusLine| and |hl-StatusLineNC|
nvim_cmdwin:
- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
@@ -538,6 +546,8 @@ Highlight groups:
- Highlight groups names are allowed to contain `@` characters.
- It is an error to define a highlight group with a name that doesn't match
the regexp `[a-zA-Z0-9_.@-]*` (see |group-name|).
+- |hl-StatusLineTerm| |hl-StatusLineTermNC| are implemented as 'winhighlight'
+ window-local highlights which are set by the default |TermOpen| handler.
Macro (|recording|) behavior:
- Replay of a macro recorded during :lmap produces the same actions as when it
@@ -665,17 +675,6 @@ Events:
- *SafeStateAgain*
- *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
-Highlight groups:
-- *hl-StatusLineTerm* *hl-StatusLineTermNC* are unnecessary because Nvim
- supports 'winhighlight' window-local highlights. For example, to mimic Vim's
- StatusLineTerm: >vim
- hi StatusLineTerm ctermfg=black ctermbg=green
- hi StatusLineTermNC ctermfg=green
- autocmd TermOpen,WinEnter * if &buftype=='terminal'
- \|setlocal winhighlight=StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC
- \|else|setlocal winhighlight=|endif
-<
-
Options:
- *'aleph'* *'al'*
- antialias
diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim
index c16e7b032e..d4bb6fe777 100644
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -3,6 +3,7 @@
" Maintainer: Carl Osterwisch <costerwi@gmail.com>
" Last Change: 2022 Oct 08
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -27,7 +28,7 @@ setlocal isfname-=,
" Define format of comment lines (see 'formatoptions' for uses)
setlocal comments=:**
-setlocal commentstring=**%s
+setlocal commentstring=**\ %s
" Definitions start with a * and assign a NAME, NSET, or ELSET
" Used in [d ^wd and other commands
diff --git a/runtime/ftplugin/arduino.lua b/runtime/ftplugin/arduino.lua
new file mode 100644
index 0000000000..f398d66a63
--- /dev/null
+++ b/runtime/ftplugin/arduino.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/arduino.vim b/runtime/ftplugin/arduino.vim
index dae3dd83d3..60b11dab1a 100644
--- a/runtime/ftplugin/arduino.vim
+++ b/runtime/ftplugin/arduino.vim
@@ -3,6 +3,7 @@
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Ken Takata <https://github.com/k-takata>
" Last Change: 2024 Apr 12
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
"
" Most of the part was copied from c.vim.
@@ -32,7 +33,7 @@ setlocal fo-=t fo+=croql
" These options have the right value as default, but the user may have
" overruled that.
-setlocal commentstring& define& include&
+setlocal commentstring=/*\ %s\ */ define& include&
" Set completion with CTRL-X CTRL-O to autoloaded function.
if exists('&ofu')
diff --git a/runtime/ftplugin/asm.vim b/runtime/ftplugin/asm.vim
index 0ae1610394..4482b90d0b 100644
--- a/runtime/ftplugin/asm.vim
+++ b/runtime/ftplugin/asm.vim
@@ -4,13 +4,14 @@
" Last Change: 2020 May 23
" 2023 Aug 28 by Vim Project (undo_ftplugin)
" 2024 Apr 09 by Vim Project (add Matchit support)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
setl include=^\\s*%\\s*include
setl comments=:;,s1:/*,mb:*,ex:*/,://
-setl commentstring=;%s
+setl commentstring=;\ %s
let b:undo_ftplugin = "setl commentstring< comments< include<"
diff --git a/runtime/ftplugin/astro.vim b/runtime/ftplugin/astro.vim
index 0b0e03447b..5d35ba9624 100644
--- a/runtime/ftplugin/astro.vim
+++ b/runtime/ftplugin/astro.vim
@@ -2,6 +2,7 @@
" Language: Astro
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
" Last Change: 2024 Apr 21
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -25,17 +26,17 @@ function! s:AstroComments() abort
\ || s:IdentifyScope('^\s*<script', '^\s*<\/script>')
" ECMAScript comments
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
- setlocal commentstring=//%s
+ setlocal commentstring=//\ %s
elseif s:IdentifyScope('^\s*<style', '^\s*<\/style>')
" CSS comments
setlocal comments=s1:/*,mb:*,ex:*/
- setlocal commentstring=/*%s*/
+ setlocal commentstring=/*\ %s\ */
else
" HTML comments
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
- setlocal commentstring=<!--%s-->
+ setlocal commentstring=<!--\ %s\ -->
endif
endfunction
diff --git a/runtime/ftplugin/bitbake.vim b/runtime/ftplugin/bitbake.vim
index 99fe334627..4d50a7feb7 100644
--- a/runtime/ftplugin/bitbake.vim
+++ b/runtime/ftplugin/bitbake.vim
@@ -3,13 +3,14 @@
" Maintainer: Gregory Anders <greg@gpanders.com>
" Repository: https://github.com/openembedded/bitbake
" Latest Revision: 2022-07-23
+" 2024-05-23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal comments=:#
setlocal suffixesadd=.bb,.bbclass
diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua
index 0ddbf09470..2695b642aa 100644
--- a/runtime/ftplugin/c.lua
+++ b/runtime/ftplugin/c.lua
@@ -1,5 +1,5 @@
-- These are the default option values in Vim, but not in Nvim, so must be set explicitly.
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
vim.bo.define = '^\\s*#\\s*define'
vim.bo.include = '^\\s*#\\s*include'
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim
index 716b454675..8b2b784eb4 100644
--- a/runtime/ftplugin/c.vim
+++ b/runtime/ftplugin/c.vim
@@ -2,6 +2,7 @@
" Language: C
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2023 Aug 22
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -24,7 +25,7 @@ setlocal fo-=t fo+=croql
" These options have the right value as default, but the user may have
" overruled that.
-setlocal commentstring& define& include&
+setlocal commentstring=/*\ %s\ */ define& include&
" Set completion with CTRL-X CTRL-O to autoloaded function.
if exists('&ofu')
diff --git a/runtime/ftplugin/calendar.vim b/runtime/ftplugin/calendar.vim
index f454ba1dc8..c4e683acf6 100644
--- a/runtime/ftplugin/calendar.vim
+++ b/runtime/ftplugin/calendar.vim
@@ -2,6 +2,7 @@
" Language: calendar(1) input file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
+" 2024-06-02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring& include&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */ include&
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/calender.lua b/runtime/ftplugin/calender.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/calender.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/cgdbrc.vim b/runtime/ftplugin/cgdbrc.vim
index 46cf135c5c..99f9702d26 100644
--- a/runtime/ftplugin/cgdbrc.vim
+++ b/runtime/ftplugin/cgdbrc.vim
@@ -3,6 +3,7 @@
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
" Documentation: https://cgdb.github.io/docs/Configuring-CGDB.html
" Latest Revision: 2024-04-09
+" 2024-05-23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -14,7 +15,7 @@ set cpoptions&vim
let b:undo_ftplugin = 'setl com< cms<'
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal comments=:#
let &cpoptions = s:save_cpoptions
diff --git a/runtime/ftplugin/ch.lua b/runtime/ftplugin/ch.lua
new file mode 100644
index 0000000000..f398d66a63
--- /dev/null
+++ b/runtime/ftplugin/ch.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim
index 5cdad8fdc8..73768bc592 100644
--- a/runtime/ftplugin/cpp.vim
+++ b/runtime/ftplugin/cpp.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: C++
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Jun 06
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -13,6 +13,10 @@ endif
" XXX: "[.]" in the first pattern makes it a wildcard on Windows
runtime! ftplugin/c[.]{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
+" Change 'commentstring' to "C++ style"/"mono-line" comments
+setlocal commentstring=//\ %s
+let b:undo_ftplugin ..= ' | setl commentstring<'
+
" C++ uses templates with <things>
" Disabled, because it gives an error for typing an unmatched ">".
" set matchpairs+=<:>
diff --git a/runtime/ftplugin/cs.lua b/runtime/ftplugin/cs.lua
index b4e68148f5..f398d66a63 100644
--- a/runtime/ftplugin/cs.lua
+++ b/runtime/ftplugin/cs.lua
@@ -1 +1 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim
index a22bee3279..74666b9680 100644
--- a/runtime/ftplugin/csh.vim
+++ b/runtime/ftplugin/csh.vim
@@ -4,6 +4,7 @@
" Previous Maintainer: Dan Sharp
" Contributor: Johannes Zellner <johannes@zellner.org>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ let s:save_cpo = &cpo
set cpo-=C
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions-=t
setlocal formatoptions+=crql
diff --git a/runtime/ftplugin/css.lua b/runtime/ftplugin/css.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/css.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/css.vim b/runtime/ftplugin/css.vim
index ece2def4ee..778a9e12d6 100644
--- a/runtime/ftplugin/css.vim
+++ b/runtime/ftplugin/css.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Last Change: 2020 Dec 21
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo< ofu< isk<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */
setlocal formatoptions-=t formatoptions+=croql
setlocal omnifunc=csscomplete#CompleteCSS
setlocal iskeyword+=-
diff --git a/runtime/ftplugin/d.lua b/runtime/ftplugin/d.lua
index b4e68148f5..f398d66a63 100644
--- a/runtime/ftplugin/d.lua
+++ b/runtime/ftplugin/d.lua
@@ -1 +1 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/desktop.vim b/runtime/ftplugin/desktop.vim
index bd6fd7097c..d15afd24b9 100644
--- a/runtime/ftplugin/desktop.vim
+++ b/runtime/ftplugin/desktop.vim
@@ -2,6 +2,7 @@
" Language: XDG desktop entry
" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
" Last Change: 2022-07-26
+" 2024-05-24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -9,5 +10,5 @@ endif
let b:did_ftplugin = v:true
setl comments=:#
-setl commentstring=#%s
+setl commentstring=#\ %s
let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim
index bea8c5c18a..f97014814b 100644
--- a/runtime/ftplugin/dtd.vim
+++ b/runtime/ftplugin/dtd.vim
@@ -6,6 +6,7 @@
" Former maintainer: Dan Sharp
" Last Change: 2009 Jan 20
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -15,7 +16,7 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
setlocal comments=s:<!--,m:\ \ \ \ \ ,e:-->
setlocal formatoptions-=t
diff --git a/runtime/ftplugin/dtrace.vim b/runtime/ftplugin/dtrace.vim
index 9288097f7f..a276b310a3 100644
--- a/runtime/ftplugin/dtrace.vim
+++ b/runtime/ftplugin/dtrace.vim
@@ -1,6 +1,7 @@
" Language: D script as described in "Solaris Dynamic Tracing Guide",
" http://docs.sun.com/app/docs/doc/817-6223
" Last Change: 2008/03/20
+" 2024/05/23 by Riley Bruins <ribru17@gmail.com ('commentstring')
" Version: 1.2
" Maintainer: Nicolas Weber <nicolasweber@gmx.de>
@@ -26,8 +27,8 @@ setlocal fo-=t fo+=croql
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/
" dtrace uses /* */ comments. Set this explicitly, just in case the user
-" changed this (/*%s*/ is the default)
-setlocal commentstring=/*%s*/
+" changed this (/*\ %s\ */ is the default)
+setlocal commentstring=/*\ %s\ */
setlocal iskeyword+=@,$
diff --git a/runtime/ftplugin/dts.vim b/runtime/ftplugin/dts.vim
index 42e38338b7..346ff94704 100644
--- a/runtime/ftplugin/dts.vim
+++ b/runtime/ftplugin/dts.vim
@@ -2,6 +2,7 @@
" Language: dts/dtsi (device tree files)
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
" Latest Revision: 2024 Apr 12
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -12,5 +13,5 @@ let b:undo_ftplugin = 'setl inc< cms< com<'
setlocal include=^\\%(#include\\\|/include/\\)
" same as C
-setlocal commentstring&
+setlocal commentstring=/*\ %s\ */
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim
index 1cb57f4c85..5a3ab717d9 100644
--- a/runtime/ftplugin/erlang.vim
+++ b/runtime/ftplugin/erlang.vim
@@ -6,7 +6,8 @@
" Eduardo Lopez (http://github.com/tapichu)
" Arvid Bjurklint (http://github.com/slarwise)
" Paweł Zacharek (http://github.com/subc2)
-" Last Update: 2023-Dec-20
+" Riley Bruins (http://github.com/ribru17) ('commentstring')
+" Last Update: 2024 May 23
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime
@@ -27,7 +28,7 @@ if get(g:, 'erlang_folding', 0)
endif
setlocal comments=:%%%,:%%,:%
-setlocal commentstring=%%s
+setlocal commentstring=%\ %s
setlocal formatoptions+=ro
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index b5c4665d24..b3e074aa20 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -5,6 +5,7 @@
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2022 May 15
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -125,7 +126,7 @@ if exists("loaded_matchit")
endif
" TODO: comments=
-setlocal commentstring=<%#%s%>
+setlocal commentstring=<%#\ %s\ %>
let b:undo_ftplugin = "setl cms< " .
\ " | unlet! b:browsefilter b:match_words | " . b:undo_ftplugin
diff --git a/runtime/ftplugin/fennel.vim b/runtime/ftplugin/fennel.vim
index 93cf366726..2a9623faff 100644
--- a/runtime/ftplugin/fennel.vim
+++ b/runtime/ftplugin/fennel.vim
@@ -2,13 +2,14 @@
" Language: Fennel
" Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com>
" Last Update: 2023 Jun 9
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal comments=:;;,:;
setlocal formatoptions-=t
setlocal suffixesadd=.fnl
diff --git a/runtime/ftplugin/fish.vim b/runtime/ftplugin/fish.vim
index f06ad3a0bf..55d7ea8dd9 100644
--- a/runtime/ftplugin/fish.vim
+++ b/runtime/ftplugin/fish.vim
@@ -4,6 +4,7 @@
" Repository: https://github.com/nickeb96/fish.vim
" Last Change: February 1, 2023
" 2023 Aug 28 by Vim Project (undo_ftplugin)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ let b:did_ftplugin = 1
setlocal iskeyword=@,48-57,_,192-255,-,.
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions+=crjq
let b:undo_ftplugin = "setl cms< com< fo< isk<"
diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim
index 3c325818d3..19a4c1e62b 100644
--- a/runtime/ftplugin/fortran.vim
+++ b/runtime/ftplugin/fortran.vim
@@ -11,6 +11,7 @@
" Doug Kearns, and Fritz Reese.
" Last Change: 2023 Dec 22
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do these settings when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -89,7 +90,7 @@ else
endif
" Set commentstring for foldmethod=marker
-setlocal cms=!%s
+setlocal cms=!\ %s
" Tabs are not a good idea in Fortran so the default is to expand tabs
if !exists("fortran_have_tabs")
diff --git a/runtime/ftplugin/fstab.vim b/runtime/ftplugin/fstab.vim
index 99805322cd..0e7ffda498 100644
--- a/runtime/ftplugin/fstab.vim
+++ b/runtime/ftplugin/fstab.vim
@@ -3,6 +3,7 @@
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim
" Last Change: 2021 Jan 02
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Version: 1.0
"
" Credits:
@@ -13,7 +14,7 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
let b:undo_ftplugin = "setlocal commentstring<"
" vim: ts=8 ft=vim
diff --git a/runtime/ftplugin/gdb.vim b/runtime/ftplugin/gdb.vim
index 7c10633be4..af88a04d54 100644
--- a/runtime/ftplugin/gdb.vim
+++ b/runtime/ftplugin/gdb.vim
@@ -3,11 +3,12 @@
" Maintainer: Michaël Peeters <NOSPAMm.vim@noekeon.org>
" Last Changed: 2017-10-26
" 2024-04-10: - add Matchit support (by Vim Project)
+" 2024-04-23: - add space to commentstring (by Riley Bruins) ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal include=^\\s*source
" Undo the stuff we changed.
diff --git a/runtime/ftplugin/glsl.lua b/runtime/ftplugin/glsl.lua
new file mode 100644
index 0000000000..f398d66a63
--- /dev/null
+++ b/runtime/ftplugin/glsl.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/groovy.vim b/runtime/ftplugin/groovy.vim
index cc7d6e35eb..a2e2b2f93e 100644
--- a/runtime/ftplugin/groovy.vim
+++ b/runtime/ftplugin/groovy.vim
@@ -2,6 +2,7 @@
" Language: groovy
" Maintainer: Justin M. Keyes <justinkz@gmail.com>
" Last Change: 2016 May 22
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -13,7 +14,7 @@ set cpo-=C
let b:undo_ftplugin = 'setlocal commentstring<'
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim
index 5446e72286..904f267fdc 100644
--- a/runtime/ftplugin/hamster.vim
+++ b/runtime/ftplugin/hamster.vim
@@ -3,6 +3,7 @@
" Version: 2.0.6.0
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Last Change: 2021 Jan 19
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -31,7 +32,7 @@ if &tw == 0
endif
" Comments start with a double quote
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Move around functions.
noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR>
diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua
index 67c417b1be..86e181504f 100644
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -26,3 +26,7 @@ elseif vim.endswith(bufname, '/doc/lsp.txt') then
{ start = [[\*lsp-semantic-highlight\*]], stop = '^======', match = '^@[%w%p]+' },
})
end
+
+vim.keymap.set('n', 'gO', function()
+ require('vim.vimhelp').show_toc()
+end, { buffer = 0, silent = true })
diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim
index a188e45cb4..833baf5d8f 100644
--- a/runtime/ftplugin/help.vim
+++ b/runtime/ftplugin/help.vim
@@ -21,77 +21,5 @@ endif
" Prefer Vim help instead of manpages.
setlocal keywordprg=:help
-if !exists('g:no_plugin_maps')
- function! s:show_toc() abort
- let bufname = bufname('%')
- let info = getloclist(0, {'winid': 1})
- if !empty(info) && getwinvar(info.winid, 'qf_toc') ==# bufname
- lopen
- return
- endif
-
- let toc = []
- let lnum = 2
- let last_line = line('$') - 1
- let last_added = 0
- let has_section = 0
- let has_sub_section = 0
-
- while lnum && lnum <= last_line
- let level = 0
- let add_text = ''
- let text = getline(lnum)
-
- if text =~# '^=\+$' && lnum + 1 < last_line
- " A de-facto section heading. Other headings are inferred.
- let has_section = 1
- let has_sub_section = 0
- let lnum = nextnonblank(lnum + 1)
- let text = getline(lnum)
- let add_text = text
- while add_text =~# '\*[^*]\+\*\s*$'
- let add_text = matchstr(add_text, '.*\ze\*[^*]\+\*\s*$')
- endwhile
- elseif text =~# '^[A-Z0-9][-A-ZA-Z0-9 .][-A-Z0-9 .():]*\%([ \t]\+\*.\+\*\)\?$'
- " Any line that's yelling is important.
- let has_sub_section = 1
- let level = has_section
- let add_text = matchstr(text, '.\{-}\ze\s*\%([ \t]\+\*.\+\*\)\?$')
- elseif text =~# '\~$'
- \ && matchstr(text, '^\s*\zs.\{-}\ze\s*\~$') !~# '\t\|\s\{2,}'
- \ && getline(lnum - 1) =~# '^\s*<\?$\|^\s*\*.*\*$'
- \ && getline(lnum + 1) =~# '^\s*>\?$\|^\s*\*.*\*$'
- " These lines could be headers or code examples. We only want the
- " ones that have subsequent lines at the same indent or more.
- let l = nextnonblank(lnum + 1)
- if getline(l) =~# '\*[^*]\+\*$'
- " Ignore tag lines
- let l = nextnonblank(l + 1)
- endif
-
- if indent(lnum) <= indent(l)
- let level = has_section + has_sub_section
- let add_text = matchstr(text, '\S.\{-}\ze\s\=\~$')
- endif
- endif
-
- let add_text = substitute(add_text, '\s\+$', '', 'g')
- if !empty(add_text) && last_added != lnum
- let last_added = lnum
- call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum,
- \ 'text': repeat("\u00a0\u00a0", level) . add_text})
- endif
- let lnum = nextnonblank(lnum + 1)
- endwhile
-
- call setloclist(0, toc, ' ')
- call setloclist(0, [], 'a', {'title': 'Help TOC'})
- lopen
- let w:qf_toc = bufname
- endfunction
-
- nnoremap <silent><buffer> gO :call <sid>show_toc()<cr>
-endif
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim
index 3aa60a873e..5495f859de 100644
--- a/runtime/ftplugin/html.vim
+++ b/runtime/ftplugin/html.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ let s:save_cpo = &cpo
set cpo-=C
setlocal matchpairs+=<:>
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua
index b4e68148f5..f398d66a63 100644
--- a/runtime/ftplugin/indent.lua
+++ b/runtime/ftplugin/indent.lua
@@ -1 +1 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/indent.vim b/runtime/ftplugin/indent.vim
index 64a650ad7b..32208d38d8 100644
--- a/runtime/ftplugin/indent.vim
+++ b/runtime/ftplugin/indent.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
+" 2024-06-02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/initex.vim b/runtime/ftplugin/initex.vim
index 0ee3e8d899..71049df6bd 100644
--- a/runtime/ftplugin/initex.vim
+++ b/runtime/ftplugin/initex.vim
@@ -3,6 +3,7 @@
" Maintainer: Benji Fisher, Ph.D. <benji@member.AMS.org>
" Version: 1.0
" Last Change: Wed 19 Apr 2006
+" Last Change: Thu 23 May 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer.
if exists("b:did_ftplugin")
@@ -23,7 +24,7 @@ setlocal com=sO:%\ -,mO:%\ \ ,eO:%%,:%
" Set 'commentstring' to recognize the % comment character:
" (Thanks to Ajit Thakkar.)
-setlocal cms=%%s
+setlocal cms=%\ %s
" Allow "[d" to be used to find a macro definition:
let &l:define='\\\([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\='
diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim
index fa2b61075f..eee7ef0153 100644
--- a/runtime/ftplugin/java.vim
+++ b/runtime/ftplugin/java.vim
@@ -5,6 +5,7 @@
" Repository: https://github.com/zzzyxwvut/java-vim.git
" Last Change: 2024 Apr 18
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -61,7 +62,7 @@ setlocal formatoptions-=t formatoptions+=croql
" Set 'comments' to format dashed lists in comments. Behaves just like C.
setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
" Change the :browse e filter to primarily show Java-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
diff --git a/runtime/ftplugin/javascript.vim b/runtime/ftplugin/javascript.vim
index 2633954903..455b794cf0 100644
--- a/runtime/ftplugin/javascript.vim
+++ b/runtime/ftplugin/javascript.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Contributor: Romain Lafourcade <romainlafourcade@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -24,7 +25,7 @@ endif
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
" Change the :browse e filter to primarily show JavaScript-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
diff --git a/runtime/ftplugin/jq.vim b/runtime/ftplugin/jq.vim
index 88958e80dd..d25883640b 100644
--- a/runtime/ftplugin/jq.vim
+++ b/runtime/ftplugin/jq.vim
@@ -2,6 +2,7 @@
" Language: jq
" Maintainer: Vito <vito.blog@gmail.com>
" Last Change: 2024 Apr 29
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Upstream: https://github.com/vito-c/jq.vim
if exists('b:did_ftplugin')
@@ -10,7 +11,7 @@ endif
let b:did_ftplugin = 1
setlocal include=^\\s*\\%(import\\\|include\\)
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
compiler jq
let b:undo_ftplugin = 'setl commentstring< include<'
diff --git a/runtime/ftplugin/jsonc.vim b/runtime/ftplugin/jsonc.vim
index e47a75f574..ec3268492c 100644
--- a/runtime/ftplugin/jsonc.vim
+++ b/runtime/ftplugin/jsonc.vim
@@ -5,6 +5,7 @@
" https://github.com/kevinoid/vim-jsonc
" License: MIT
" Last Change: 2021 Nov 22
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
runtime! ftplugin/json.vim
@@ -15,7 +16,7 @@ else
endif
" Set comment (formatting) related options. {{{1
-setlocal commentstring=//%s comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
" Let Vim know how to disable the plug-in.
let b:undo_ftplugin = 'setlocal commentstring< comments<'
diff --git a/runtime/ftplugin/kdl.vim b/runtime/ftplugin/kdl.vim
new file mode 100644
index 0000000000..c9a1d8b185
--- /dev/null
+++ b/runtime/ftplugin/kdl.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin
+" Language: KDL
+" Author: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024-06-10
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setlocal comments=://
+setlocal commentstring=//\ %s
+setlocal formatoptions-=t
+
+let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<'
diff --git a/runtime/ftplugin/lc.vim b/runtime/ftplugin/lc.vim
new file mode 100644
index 0000000000..e818f1aecb
--- /dev/null
+++ b/runtime/ftplugin/lc.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: Elsa
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 May 25
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:-- commentstring=--\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/ld.vim b/runtime/ftplugin/ld.vim
index 1ab80d533c..9cc70bd94d 100644
--- a/runtime/ftplugin/ld.vim
+++ b/runtime/ftplugin/ld.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: ld(1) script
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Latest Revision: 2008 Jul 09
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*%s*/ include=^\\s*INCLUDE
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */ include=^\\s*INCLUDE
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/liquid.vim b/runtime/ftplugin/liquid.vim
index f24ec4cbb2..dbd8abe457 100644
--- a/runtime/ftplugin/liquid.vim
+++ b/runtime/ftplugin/liquid.vim
@@ -2,6 +2,7 @@
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2022 Mar 15
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -56,6 +57,6 @@ if exists('loaded_matchit')
let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,\<\(capture\|comment\|highlight\)\>:\<end\1\>'
endif
-setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
+setlocal commentstring={%\ comment\ %}\ %s\ {%\ endcomment\ %}
let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words'
diff --git a/runtime/ftplugin/lisp.vim b/runtime/ftplugin/lisp.vim
index db3ac96631..fe3c6fe996 100644
--- a/runtime/ftplugin/lisp.vim
+++ b/runtime/ftplugin/lisp.vim
@@ -5,6 +5,7 @@
" Original author: Dorai Sitaram <ds26@gte.com>
" Original URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html
" Last Change: Mar 10, 2021
+" May 23, 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -19,6 +20,6 @@ setl define=^\\s*(def\\k*
setl formatoptions-=t
setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94
setl lisp
-setl commentstring=;%s
+setl commentstring=;\ %s
let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp< commentstring<"
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index 022dd0d601..d4ee5ac242 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -2,6 +2,7 @@
" Language: Markdown
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
" Last Change: 2023 Dec 28
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
let s:keepcpo= &cpo
set cpo&vim
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
+setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--\ %s\ -->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
diff --git a/runtime/ftplugin/mma.vim b/runtime/ftplugin/mma.vim
index ce4cee18ae..91a8111bcb 100644
--- a/runtime/ftplugin/mma.vim
+++ b/runtime/ftplugin/mma.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: Mathematica
" Maintainer: Ian Ford <ianf@wolfram.com>
-" Last Change: 22 January 2019
+" Last Change: 2019 Jan 22
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -13,4 +14,4 @@ let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal commentstring<"
-setlocal commentstring=\(*%s*\)
+setlocal commentstring=\(*\ %s\ *\)
diff --git a/runtime/ftplugin/modula2.vim b/runtime/ftplugin/modula2.vim
index 9c1acc276a..306688da05 100644
--- a/runtime/ftplugin/modula2.vim
+++ b/runtime/ftplugin/modula2.vim
@@ -2,6 +2,7 @@
" Language: Modula-2
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -17,7 +18,7 @@ if s:dialect ==# "r10"
setlocal comments=s:(*,m:\ ,e:*),:!
setlocal commentstring=!\ %s
else
- setlocal commentstring=(*%s*)
+ setlocal commentstring=(*\ %s\ *)
setlocal comments=s:(*,m:\ ,e:*)
endif
setlocal formatoptions-=t formatoptions+=croql
diff --git a/runtime/ftplugin/modula3.vim b/runtime/ftplugin/modula3.vim
index 45dd7ca01c..f899d1d103 100644
--- a/runtime/ftplugin/modula3.vim
+++ b/runtime/ftplugin/modula3.vim
@@ -2,6 +2,7 @@
" Language: Modula-3
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal comments=s0:(*,mb:\ ,ex:*)
-setlocal commentstring=(*%s*)
+setlocal commentstring=(*\ %s\ *)
setlocal formatoptions-=t formatoptions+=croql
setlocal suffixesadd+=.m3
setlocal formatprg=m3pp
diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim
index cf62d02daa..ed0b32f5f3 100644
--- a/runtime/ftplugin/nroff.vim
+++ b/runtime/ftplugin/nroff.vim
@@ -2,15 +2,15 @@
" Language: roff(7)
" Maintainer: Aman Verma
" Homepage: https://github.com/a-vrma/vim-nroff-ftplugin
-" Previous Maintainer: Chris Spiegel <cspiegel@gmail.com>
-" Last Change: 2020 Nov 21
+" Previous Maintainer: Chris Spiegel <cspiegel@gmail.com>
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=.\\\"%s
+setlocal commentstring=.\\\"\ %s
setlocal comments=:.\\\"
setlocal sections+=Sh
diff --git a/runtime/ftplugin/objc.lua b/runtime/ftplugin/objc.lua
new file mode 100644
index 0000000000..f398d66a63
--- /dev/null
+++ b/runtime/ftplugin/objc.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '// %s'
diff --git a/runtime/ftplugin/obse.vim b/runtime/ftplugin/obse.vim
index 6d865f05ee..bf5076f41f 100644
--- a/runtime/ftplugin/obse.vim
+++ b/runtime/ftplugin/obse.vim
@@ -2,8 +2,9 @@
" Language: Oblivion Language (obl)
" Original Creator: Kat <katisntgood@gmail.com>
" Maintainer: Kat <katisntgood@gmail.com>
-" Created: August 08, 2021
-" Last Change: 13 November 2022
+" Created: 2021 Aug 08
+" Last Change: 2022 Nov 13
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -20,7 +21,7 @@ noremap <script> <buffer> <silent> ]] <nop>
noremap <script> <buffer> <silent> [] <nop>
noremap <script> <buffer> <silent> ][ <nop>
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal comments=:;
function s:NextSection(type, backwards, visual)
diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim
index 20172c9b32..8b88d8d001 100644
--- a/runtime/ftplugin/ocaml.vim
+++ b/runtime/ftplugin/ocaml.vim
@@ -5,12 +5,14 @@
" Pierre Vittet <pierre-vittet@pvittet.com>
" Stefano Zacchiroli <zack@bononia.it>
" Vincent Aravantinos <firstname.name@imag.fr>
+" Riley Bruins <ribru17@gmail.com> ('commentstring')
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
" 2013 Oct 27 - Added commentstring (MM)
" 2013 Jul 26 - load default compiler settings (MM)
" 2013 Jul 24 - removed superfluous efm-setting (MM)
" 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM)
+" 2024 May 23 - added space in commentstring (RB)
if exists("b:did_ftplugin")
finish
@@ -40,7 +42,7 @@ set cpo&vim
" Comment string
setlocal comments=sr:(*\ ,mb:\ ,ex:*)
setlocal comments^=sr:(**,mb:\ \ ,ex:*)
-setlocal commentstring=(*%s*)
+setlocal commentstring=(*\ %s\ *)
" Add mappings, unless the user didn't want this.
if !exists("no_plugin_maps") && !exists("no_ocaml_maps")
diff --git a/runtime/ftplugin/odin.vim b/runtime/ftplugin/odin.vim
index c50fea65a3..ca534bb30c 100644
--- a/runtime/ftplugin/odin.vim
+++ b/runtime/ftplugin/odin.vim
@@ -2,7 +2,8 @@
" Language: Odin
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/habamax/vim-odin
-" Last Change: 2024-01-15
+" Last Change: 2024 Jan 15
+" 2024-May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
"
" This file has been manually translated from Vim9 script.
@@ -19,7 +20,7 @@ let b:undo_ftplugin = 'setlocal commentstring<'
\ .. '| setlocal suffixesadd<'
setlocal suffixesadd=.odin
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal comments=s1:/*,mb:*,ex:*/,://
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/openvpn.vim b/runtime/ftplugin/openvpn.vim
index 56c0f25b39..9cd7b7ad1a 100644
--- a/runtime/ftplugin/openvpn.vim
+++ b/runtime/ftplugin/openvpn.vim
@@ -2,6 +2,7 @@
" Language: OpenVPN
" Maintainer: ObserverOfTime <chronobserver@disroot.org>
" Last Change: 2022 Oct 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -9,6 +10,6 @@ endif
let b:did_ftplugin = 1
setlocal iskeyword+=-,.,/
-setlocal comments=:#,:; commentstring=#%s
+setlocal comments=:#,:; commentstring=#\ %s
let b:undo_ftplugin = 'setl isk< com< cms<'
diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim
index 9abd7dd382..7c800c4fbd 100644
--- a/runtime/ftplugin/pascal.vim
+++ b/runtime/ftplugin/pascal.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -11,7 +12,7 @@ let s:cpo_save = &cpo
set cpo&vim
set comments=s:(*,m:\ ,e:*),s:{,m:\ ,e:}
-set commentstring={%s}
+set commentstring={\ %s\ }
if exists("pascal_delphi")
set comments+=:///
diff --git a/runtime/ftplugin/pdf.vim b/runtime/ftplugin/pdf.vim
index 1ed99117d6..96c77c870a 100644
--- a/runtime/ftplugin/pdf.vim
+++ b/runtime/ftplugin/pdf.vim
@@ -2,13 +2,14 @@
" Language: PDF
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=%%s
+setlocal commentstring=%\ %s
setlocal comments=:%
let b:undo_ftplugin = "setlocal cms< com< | unlet! b:match_words"
diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim
index 8c6a80eb4f..03368a7af3 100644
--- a/runtime/ftplugin/perl.vim
+++ b/runtime/ftplugin/perl.vim
@@ -8,6 +8,7 @@
" 2023 Sep 07 by Vim Project (safety check: don't execute perl
" from current directory)
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -22,7 +23,7 @@ setlocal formatoptions+=crqol
setlocal keywordprg=perldoc\ -f
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim
index f03f14512a..e124961ba1 100644
--- a/runtime/ftplugin/php.vim
+++ b/runtime/ftplugin/php.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" Last Change: 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -44,7 +45,7 @@ if exists("b:match_skip")
endif
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
-setlocal commentstring=/*%s*/
+setlocal commentstring=/*\ %s\ */
setlocal formatoptions+=l formatoptions-=t
if get(g:, "php_autocomment", 1)
diff --git a/runtime/ftplugin/ps1.vim b/runtime/ftplugin/ps1.vim
index d6ab01016b..9d698f2423 100644
--- a/runtime/ftplugin/ps1.vim
+++ b/runtime/ftplugin/ps1.vim
@@ -3,6 +3,7 @@
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -14,7 +15,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions=tcqro
" Enable autocompletion of hyphenated PowerShell commands,
" e.g. Get-Content or Get-ADUser
diff --git a/runtime/ftplugin/ps1xml.vim b/runtime/ftplugin/ps1xml.vim
index 17bb181f37..0052de19ce 100644
--- a/runtime/ftplugin/ps1xml.vim
+++ b/runtime/ftplugin/ps1xml.vim
@@ -3,6 +3,7 @@
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -14,7 +15,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions=tcqro
" Change the browse dialog on Win32 and GTK to show mainly PowerShell-related files
diff --git a/runtime/ftplugin/qml.vim b/runtime/ftplugin/qml.vim
index aa05c11bf9..53df11c6b8 100644
--- a/runtime/ftplugin/qml.vim
+++ b/runtime/ftplugin/qml.vim
@@ -3,6 +3,7 @@
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
" Last Change: 2023 Aug 16
" 2023 Aug 23 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists( 'b:did_ftplugin' )
finish
@@ -28,7 +29,7 @@ endif
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal formatoptions-=t
setlocal formatoptions+=croql
diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim
index 84f5422140..7bfd87ddc3 100644
--- a/runtime/ftplugin/racket.vim
+++ b/runtime/ftplugin/racket.vim
@@ -3,8 +3,7 @@
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
" Previous Maintainer: Will Langstroth <will@langstroth.com>
" URL: https://github.com/benknoble/vim-racket
-" Last Change: 2022 Aug 29
-" 2024 Jan 14 by Vim Project (browsefilter)
+" Last Change: 2024 May 28
if exists("b:did_ftplugin")
finish
@@ -21,7 +20,7 @@ setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94
setlocal comments=:;;;;,:;;;,:;;,:;
setlocal formatoptions+=r
-"setlocal commentstring=;;%s
+"setlocal commentstring=;;\ %s
setlocal commentstring=#\|\ %s\ \|#
setlocal formatprg=raco\ fmt
diff --git a/runtime/ftplugin/raku.vim b/runtime/ftplugin/raku.vim
index 941222bd38..f57427e323 100644
--- a/runtime/ftplugin/raku.vim
+++ b/runtime/ftplugin/raku.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: Raku
-" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: https://github.com/Raku/vim-raku
+" Language: Raku
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Homepage: https://github.com/Raku/vim-raku
" Bugs/requests: https://github.com/Raku/vim-raku/issues
-" Last Change: 2021-04-16
-" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
+" Last Change: 2021 Apr 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
@@ -21,7 +22,7 @@ setlocal formatoptions+=crqol
setlocal keywordprg=p6doc
setlocal comments=:#\|,:#=,:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
diff --git a/runtime/ftplugin/rasi.vim b/runtime/ftplugin/rasi.vim
new file mode 100644
index 0000000000..5f8ce862df
--- /dev/null
+++ b/runtime/ftplugin/rasi.vim
@@ -0,0 +1,25 @@
+" Vim filetype plugin file
+" Language: RASI
+" Maintainer: Pierrick Guillaume <pierguill@gmail.com>
+" Last Change: 2024 May 21
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = "setl com< cms< isk< inc<"
+
+setlocal comments=s1:/*,mb:*,ex:*/
+setlocal commentstring=//\ %s
+setlocal iskeyword+=-
+
+let &l:include = '^\s*@import\s\+\%(url(\)\='
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8
diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim
index fb15b444d0..c2bcdd34bc 100644
--- a/runtime/ftplugin/rust.vim
+++ b/runtime/ftplugin/rust.vim
@@ -1,7 +1,8 @@
-" Language: Rust
-" Description: Vim ftplugin for Rust
-" Maintainer: Chris Morgan <me@chrismorgan.info>
-" Last Change: 2024-03-17
+" Language: Rust
+" Description: Vim ftplugin for Rust
+" Maintainer: Chris Morgan <me@chrismorgan.info>
+" Last Change: 2024 Mar 17
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com ('commentstring')
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists("b:did_ftplugin")
@@ -36,7 +37,7 @@ if get(g:, 'rust_bang_comment_leader', 0)
else
setlocal comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
endif
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal formatoptions-=t formatoptions+=croqnl
" j was only added in 7.3.541, so stop complaints about its nonexistence
silent! setlocal formatoptions+=j
diff --git a/runtime/ftplugin/scdoc.vim b/runtime/ftplugin/scdoc.vim
index 552c865baa..8225e437a8 100644
--- a/runtime/ftplugin/scdoc.vim
+++ b/runtime/ftplugin/scdoc.vim
@@ -1,7 +1,8 @@
" scdoc filetype plugin
-" Maintainer: Gregory Anders <contact@gpanders.com>
-" Last Updated: 2022-05-09
-" Upstream: https://github.com/gpanders/vim-scdoc
+" Maintainer: Gregory Anders <contact@gpanders.com>
+" Last Updated: 2022 May 09
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Upstream: https://github.com/gpanders/vim-scdoc
" Only do this when not done yet for this buffer
if exists('b:did_ftplugin')
@@ -12,7 +13,7 @@ endif
let b:did_ftplugin = 1
setlocal comments=b:;
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal formatoptions+=t
setlocal noexpandtab
setlocal shiftwidth=0
diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim
index 04655bc136..03f625b564 100644
--- a/runtime/ftplugin/scheme.vim
+++ b/runtime/ftplugin/scheme.vim
@@ -1,11 +1,12 @@
" Vim filetype plugin file
-" Language: Scheme (R7RS)
-" Last Change: 2019-11-19
-" Author: Evan Hanson <evhan@foldling.org>
-" Maintainer: Evan Hanson <evhan@foldling.org>
+" Language: Scheme (R7RS)
+" Last Change: 2019 Nov 19
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Author: Evan Hanson <evhan@foldling.org>
+" Maintainer: Evan Hanson <evhan@foldling.org>
" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
-" Repository: https://git.foldling.org/vim-scheme.git
-" URL: https://foldling.org/vim/ftplugin/scheme.vim
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/ftplugin/scheme.vim
if exists('b:did_ftplugin')
finish
@@ -16,7 +17,7 @@ set cpo&vim
setl lisp
setl comments=:;;;;,:;;;,:;;,:;,sr:#\|,mb:\|,ex:\|#
-setl commentstring=;%s
+setl commentstring=;\ %s
setl define=^\\s*(def\\k*
setl iskeyword=33,35-39,42-43,45-58,60-90,94,95,97-122,126
diff --git a/runtime/ftplugin/svelte.vim b/runtime/ftplugin/svelte.vim
new file mode 100644
index 0000000000..e0ec4e0ae3
--- /dev/null
+++ b/runtime/ftplugin/svelte.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: svelte
+" Maintainer: Igor Lacerda <igorlafarsi@gmail.com>
+" Last Change: 2024 Jun 09
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl commentstring=<!--\ %s\ -->
+
+let b:undo_ftplugin = 'setl cms<'
diff --git a/runtime/ftplugin/tcl.vim b/runtime/ftplugin/tcl.vim
index fa900096c0..214d9c256d 100644
--- a/runtime/ftplugin/tcl.vim
+++ b/runtime/ftplugin/tcl.vim
@@ -3,6 +3,7 @@
" Maintainer: Robert L Hicks <sigzero@gmail.com>
" Latest Revision: 2009-05-01
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -15,7 +16,7 @@ let s:cpo_save = &cpo
set cpo-=C
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions+=croql
" Change the browse dialog on Windows to show mainly Tcl-related files
diff --git a/runtime/ftplugin/typescript.vim b/runtime/ftplugin/typescript.vim
index 680521df31..fb5f4e135f 100644
--- a/runtime/ftplugin/typescript.vim
+++ b/runtime/ftplugin/typescript.vim
@@ -2,6 +2,7 @@
" Language: TypeScript
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -18,7 +19,7 @@ setlocal formatoptions-=t formatoptions+=croql
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal suffixesadd+=.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 5c99df7f5a..34412f8fec 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -2,6 +2,7 @@
" Language: Vim
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Apr 13
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -51,7 +52,7 @@ setlocal keywordprg=:help
" Comments starts with # in Vim9 script. We have to guess which one to use.
if "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
- setlocal commentstring=#%s
+ setlocal commentstring=#\ %s
else
setlocal commentstring=\"%s
endif
diff --git a/runtime/ftplugin/wat.vim b/runtime/ftplugin/wat.vim
index 35d2d6a322..ad1140bbb5 100644
--- a/runtime/ftplugin/wat.vim
+++ b/runtime/ftplugin/wat.vim
@@ -2,6 +2,7 @@
" Language: WebAssembly
" Maintainer: rhysd <lin90162@yahoo.co.jp>
" Last Change: Nov 14, 2023
+" May 24, 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" For bugs, patches and license go to https://github.com/rhysd/vim-wasm
if exists("b:did_ftplugin")
@@ -10,7 +11,7 @@ endif
let b:did_ftplugin = 1
setlocal comments=s:(;,e:;),:;;
-setlocal commentstring=(;%s;)
+setlocal commentstring=(;\ %s\ ;)
setlocal formatoptions-=t
setlocal iskeyword+=$,.,/
diff --git a/runtime/ftplugin/xdefaults.lua b/runtime/ftplugin/xdefaults.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/xdefaults.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/xdefaults.vim b/runtime/ftplugin/xdefaults.vim
index c1aff70176..26c7516f8e 100644
--- a/runtime/ftplugin/xdefaults.vim
+++ b/runtime/ftplugin/xdefaults.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: X resources files like ~/.Xdefaults (xrdb)
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Language: X resources files like ~/.Xdefaults (xrdb)
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2008 Jul 09
+" 2024 Jun 03 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/,:! commentstring& inc&
+setlocal comments=s1:/*,mb:*,ex:*/,:! commentstring=!\ %s inc&
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim
index b81c3980d2..83c528eff2 100644
--- a/runtime/ftplugin/xml.vim
+++ b/runtime/ftplugin/xml.vim
@@ -3,6 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Last Changed: Dec 07th, 2018
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
" Previous Maintainer: Dan Sharp
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
@@ -15,7 +16,7 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
" Remove the middlepart from the comments section, as this causes problems:
" https://groups.google.com/d/msg/vim_dev/x4GT-nqa0Kg/jvtRnEbtAnMJ
setlocal comments=s:<!--,e:-->
diff --git a/runtime/ftplugin/xs.lua b/runtime/ftplugin/xs.lua
new file mode 100644
index 0000000000..f398d66a63
--- /dev/null
+++ b/runtime/ftplugin/xs.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '// %s'
diff --git a/runtime/indent/kdl.vim b/runtime/indent/kdl.vim
new file mode 100644
index 0000000000..b1b004d0a2
--- /dev/null
+++ b/runtime/indent/kdl.vim
@@ -0,0 +1,26 @@
+" Vim indent file
+" Language: KDL
+" Author: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024-06-11
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=KdlIndent()
+let b:undo_indent = "setlocal indentexpr<"
+
+function! KdlIndent(...)
+ let line = getline(v:lnum)
+ let previousNum = prevnonblank(v:lnum - 1)
+ let previous = getline(previousNum)
+
+ if previous =~ "{" && previous !~ "}" && line !~ "}" && line !~ ":$"
+ return indent(previousNum) + shiftwidth()
+ else
+ return indent(previousNum)
+ endif
+endfunction
diff --git a/runtime/lua/editorconfig.lua b/runtime/lua/editorconfig.lua
index dcd7425c29..e65d267a70 100644
--- a/runtime/lua/editorconfig.lua
+++ b/runtime/lua/editorconfig.lua
@@ -190,6 +190,27 @@ function properties.insert_final_newline(bufnr, val)
end
end
+--- A code of the format ss or ss-TT, where ss is an ISO 639 language code and TT is an ISO 3166 territory identifier.
+--- Sets the 'spelllang' option.
+function properties.spelling_language(bufnr, val)
+ local error_msg =
+ 'spelling_language must be of the format ss or ss-TT, where ss is an ISO 639 language code and TT is an ISO 3166 territory identifier.'
+
+ assert(val:len() == 2 or val:len() == 5, error_msg)
+
+ local language_code = val:sub(1, 2):lower()
+ assert(language_code:match('%l%l'), error_msg)
+ if val:len() == 2 then
+ vim.bo[bufnr].spelllang = language_code
+ else
+ assert(val:sub(3, 3) == '-', error_msg)
+
+ local territory_code = val:sub(4, 5):lower()
+ assert(territory_code:match('%l%l'), error_msg)
+ vim.bo[bufnr].spelllang = language_code .. '_' .. territory_code
+ end
+end
+
--- @private
--- Modified version of [glob2regpat()] that does not match path separators on `*`.
---
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index 02e841030f..348e502f34 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -35,7 +35,7 @@ local function highlight_line(line, linenr)
---@type string[]
local chars = {}
local prev_char = ''
- local overstrike, escape = false, false
+ local overstrike, escape, osc8 = false, false, false
---@type table<integer,{attr:integer,start:integer,final:integer}>
local hls = {} -- Store highlight groups as { attr, start, final }
@@ -139,6 +139,12 @@ local function highlight_line(line, linenr)
prev_char = ''
byte = byte + #char
chars[#chars + 1] = char
+ elseif osc8 then
+ -- eat characters until String Terminator or bell
+ if (prev_char == '\027' and char == '\\') or char == '\a' then
+ osc8 = false
+ end
+ prev_char = char
elseif escape then
-- Use prev_char to store the escape sequence
prev_char = prev_char .. char
@@ -157,8 +163,11 @@ local function highlight_line(line, linenr)
add_attr_hl(match + 0) -- coerce to number
end
escape = false
- elseif not prev_char:match('^%[[\032-\063]*$') then
- -- Stop looking if this isn't a partial CSI sequence
+ elseif prev_char == ']8;' then
+ osc8 = true
+ escape = false
+ elseif not prev_char:match('^[][][\032-\063]*$') then
+ -- Stop looking if this isn't a partial CSI or OSC sequence
escape = false
end
elseif char == '\027' then
diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua
index 120247ed4e..a67e1c69e2 100644
--- a/runtime/lua/tohtml.lua
+++ b/runtime/lua/tohtml.lua
@@ -46,7 +46,7 @@
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
--- @class (private) vim.tohtml.line
---- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]}
+--- @field virt_lines {[integer]:[string,integer][]}
--- @field pre_text string[][]
--- @field hide? boolean
--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive))
@@ -481,7 +481,7 @@ local function styletable_treesitter(state)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
--- @param namespaces table<integer,string>
local function _styletable_extmarks_highlight(state, extmark, namespaces)
if not extmark[4].hl_group then
@@ -503,7 +503,7 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
--- @param namespaces table<integer,string>
local function _styletable_extmarks_virt_text(state, extmark, namespaces)
if not extmark[4].virt_text then
@@ -559,7 +559,7 @@ local function _styletable_extmarks_virt_text(state, extmark, namespaces)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
local function _styletable_extmarks_virt_lines(state, extmark)
---TODO(altermo) if the fold start is equal to virt_line start then the fold hides the virt_line
if not extmark[4].virt_lines then
@@ -580,7 +580,7 @@ local function _styletable_extmarks_virt_lines(state, extmark)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
local function _styletable_extmarks_conceal(state, extmark)
if not extmark[4].conceal or state.opt.conceallevel == 0 then
return
@@ -648,7 +648,7 @@ local function styletable_conceal(state)
local bufnr = state.bufnr
vim.api.nvim_buf_call(bufnr, function()
for row = 1, state.buflen do
- --- @type table<integer,{[1]:integer,[2]:integer,[3]:string}>
+ --- @type table<integer,[integer,integer,string]>
local conceals = {}
local line_len_exclusive = #vim.fn.getline(row) + 1
for col = 1, line_len_exclusive do
diff --git a/runtime/lua/vim/_comment.lua b/runtime/lua/vim/_comment.lua
index 044cd69716..efe289b3e1 100644
--- a/runtime/lua/vim/_comment.lua
+++ b/runtime/lua/vim/_comment.lua
@@ -194,14 +194,9 @@ local function toggle_lines(line_start, line_end, ref_position)
-- - Debatable for highlighting in text area (like LSP semantic tokens).
-- Mostly because it causes flicker as highlighting is preserved during
-- comment toggling.
- package.loaded['vim._comment']._lines = vim.tbl_map(f, lines)
- local lua_cmd = string.format(
- 'vim.api.nvim_buf_set_lines(0, %d, %d, false, package.loaded["vim._comment"]._lines)',
- line_start - 1,
- line_end
- )
- vim.cmd.lua({ lua_cmd, mods = { lockmarks = true } })
- package.loaded['vim._comment']._lines = nil
+ vim._with({ lockmarks = true }, function()
+ vim.api.nvim_buf_set_lines(0, line_start - 1, line_end, false, vim.tbl_map(f, lines))
+ end)
end
--- Operator which toggles user-supplied range of lines
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 79fe5a8513..f417bda3fb 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -282,6 +282,26 @@ do
end,
})
+ vim.api.nvim_create_autocmd('TermOpen', {
+ group = nvim_terminal_augroup,
+ desc = 'Default settings for :terminal buffers',
+ callback = function()
+ vim.bo.modifiable = false
+ vim.bo.undolevels = -1
+ vim.bo.scrollback = vim.o.scrollback < 0 and 10000 or math.max(1, vim.o.scrollback)
+ vim.bo.textwidth = 0
+ vim.wo.wrap = false
+ vim.wo.list = false
+
+ -- This is gross. Proper list options support when?
+ local winhl = vim.o.winhighlight
+ if winhl ~= '' then
+ winhl = winhl .. ','
+ end
+ vim.wo.winhighlight = winhl .. 'StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC'
+ end,
+ })
+
vim.api.nvim_create_autocmd('CmdwinEnter', {
pattern = '[:>]',
desc = 'Limit syntax sync to maxlines=1 in the command window',
@@ -470,10 +490,14 @@ do
--- response indicates that it does support truecolor enable 'termguicolors',
--- but only if the user has not already disabled it.
do
- if tty.rgb then
- -- The TUI was able to determine truecolor support
+ local colorterm = os.getenv('COLORTERM')
+ if tty.rgb or colorterm == 'truecolor' or colorterm == '24bit' then
+ -- The TUI was able to determine truecolor support or $COLORTERM explicitly indicates
+ -- truecolor support
setoption('termguicolors', true)
- else
+ elseif colorterm == nil or colorterm == '' then
+ -- Neither the TUI nor $COLORTERM indicate that truecolor is supported, so query the
+ -- terminal
local caps = {} ---@type table<string, boolean>
require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found)
if not found then
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 9f952db4fc..c7c8362bfb 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -608,10 +608,9 @@ end
--- Displays a notification to the user.
---
---- This function can be overridden by plugins to display notifications using a
---- custom provider (such as the system notification provider). By default,
+--- This function can be overridden by plugins to display notifications using
+--- a custom provider (such as the system notification provider). By default,
--- writes to |:messages|.
----
---@param msg string Content of the notification to show to the user.
---@param level integer|nil One of the values from |vim.log.levels|.
---@param opts table|nil Optional parameters. Unused by default.
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index c99eefa4f6..d91b2d08bf 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -100,6 +100,25 @@ function vim.api.nvim__inspect_cell(grid, row, col) end
function vim.api.nvim__invalidate_glyph_cache() end
--- @private
+--- EXPERIMENTAL: this API will change in the future.
+---
+--- Get the properties for namespace
+---
+--- @param ns_id integer Namespace
+--- @return vim.api.keyset.ns_opts
+function vim.api.nvim__ns_get(ns_id) end
+
+--- @private
+--- EXPERIMENTAL: this API will change in the future.
+---
+--- Set some properties for namespace
+---
+--- @param ns_id integer Namespace
+--- @param opts vim.api.keyset.ns_opts Optional parameters to set:
+--- • wins: a list of windows to be scoped in
+function vim.api.nvim__ns_set(ns_id, opts) end
+
+--- @private
--- EXPERIMENTAL: this API may change in the future.
---
--- Instruct Nvim to redraw various components.
@@ -144,36 +163,6 @@ function vim.api.nvim__stats() end
--- @return any
function vim.api.nvim__unpack(str) end
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Scopes a namespace to the a window, so extmarks in the namespace will be
---- active only in the given window.
----
---- @param window integer Window handle, or 0 for current window
---- @param ns_id integer Namespace
---- @return boolean
-function vim.api.nvim__win_add_ns(window, ns_id) end
-
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Unscopes a namespace (un-binds it from the given scope).
----
---- @param window integer Window handle, or 0 for current window
---- @param ns_id integer the namespace to remove
---- @return boolean
-function vim.api.nvim__win_del_ns(window, ns_id) end
-
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Gets the namespace scopes for a given window.
----
---- @param window integer Window handle, or 0 for current window
---- @return integer[]
-function vim.api.nvim__win_get_ns(window) end
-
--- Adds a highlight to buffer.
---
--- Useful for plugins that dynamically generate highlights to a buffer (like
@@ -276,14 +265,14 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start
--- @return boolean
function vim.api.nvim_buf_attach(buffer, send_buffer, opts) end
---- call a function with buffer as temporary current buffer
+--- Call a function with buffer as temporary current buffer.
---
--- This temporarily switches current buffer to "buffer". If the current
---- window already shows "buffer", the window is not switched If a window
---- inside the current tabpage (including a float) already shows the buffer
---- One of these windows will be set as current window temporarily. Otherwise
---- a temporary scratch window (called the "autocmd window" for historical
---- reasons) will be used.
+--- window already shows "buffer", the window is not switched. If a window
+--- inside the current tabpage (including a float) already shows the buffer,
+--- then one of these windows will be set as current window temporarily.
+--- Otherwise a temporary scratch window (called the "autocmd window" for
+--- historical reasons) will be used.
---
--- This is useful e.g. to call Vimscript functions that only work with the
--- current buffer/window currently, like `termopen()`.
@@ -686,8 +675,6 @@ function vim.api.nvim_buf_line_count(buffer) end
--- • url: A URL to associate with this extmark. In the TUI, the
--- OSC 8 control sequence is used to generate a clickable
--- hyperlink to this URL.
---- • scoped: boolean (EXPERIMENTAL) enables "scoping" for the
---- extmark. See `nvim__win_add_ns()`
--- @return integer
function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
@@ -1953,7 +1940,7 @@ function vim.api.nvim_set_current_win(window) end
---
--- • on_win: called when starting to redraw a specific window.
--- ```
---- ["win", winid, bufnr, topline, botline]
+--- ["win", winid, bufnr, toprow, botrow]
--- ```
---
--- • on_line: called for each buffer line being redrawn. (The
diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua
index f7cd92a3b2..2fe5c32faf 100644
--- a/runtime/lua/vim/_meta/api_keysets.lua
+++ b/runtime/lua/vim/_meta/api_keysets.lua
@@ -197,6 +197,9 @@ error('Cannot require a meta file')
--- @field desc? string
--- @field replace_keycodes? boolean
+--- @class vim.api.keyset.ns_opts
+--- @field wins? any[]
+
--- @class vim.api.keyset.open_term
--- @field on_input? function
--- @field force_crlf? boolean
diff --git a/runtime/lua/vim/_meta/api_keysets_extra.lua b/runtime/lua/vim/_meta/api_keysets_extra.lua
index 76b56b04e7..e1f12868d0 100644
--- a/runtime/lua/vim/_meta/api_keysets_extra.lua
+++ b/runtime/lua/vim/_meta/api_keysets_extra.lua
@@ -26,13 +26,13 @@ error('Cannot require a meta file')
--- @field url? boolean
--- @field hl_mode? string
---
---- @field virt_text? {[1]: string, [2]: string}[]
+--- @field virt_text? [string, string][]
--- @field virt_text_hide? boolean
--- @field virt_text_repeat_linebreak? boolean
--- @field virt_text_win_col? integer
--- @field virt_text_pos? string
---
---- @field virt_lines? {[1]: string, [2]: string}[][]
+--- @field virt_lines? [string, string][][]
--- @field virt_lines_above? boolean
--- @field virt_lines_leftcol? boolean
---
diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua
index 75737bd040..3aca3cdfa5 100644
--- a/runtime/lua/vim/_meta/builtin.lua
+++ b/runtime/lua/vim/_meta/builtin.lua
@@ -121,6 +121,7 @@ function vim.stricmp(a, b) end
--- @param str string
--- @param index integer
--- @param use_utf16? boolean
+--- @return integer
function vim.str_byteindex(str, index, use_utf16) end
--- Gets a list of the starting byte positions of each UTF-8 codepoint in the given string.
diff --git a/runtime/lua/vim/_meta/builtin_types.lua b/runtime/lua/vim/_meta/builtin_types.lua
index 9f0d2e7038..9afb8c84f4 100644
--- a/runtime/lua/vim/_meta/builtin_types.lua
+++ b/runtime/lua/vim/_meta/builtin_types.lua
@@ -25,7 +25,7 @@
--- @field variables table<string,any>
--- @field windows integer[]
---- @alias vim.fn.getjumplist.ret {[1]: vim.fn.getjumplist.ret.item[], [2]: integer}
+--- @alias vim.fn.getjumplist.ret [vim.fn.getjumplist.ret.item[], integer]
--- @class vim.fn.getjumplist.ret.item
--- @field bufnr integer
@@ -34,6 +34,11 @@
--- @field filename? string
--- @field lnum integer
+--- @class vim.fn.getmarklist.ret.item
+--- @field mark string
+--- @field pos [integer, integer, integer, integer]
+--- @field file string
+
--- @class vim.fn.getmousepos.ret
--- @field screenrow integer
--- @field screencol integer
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 428b7c4d4f..155c93726b 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -974,8 +974,8 @@ vim.bo.comments = vim.o.comments
vim.bo.com = vim.bo.comments
--- A template for a comment. The "%s" in the value is replaced with the
---- comment text. For example, C uses "/*%s*/". Used for `commenting` and to
---- add markers for folding, see `fold-marker`.
+--- comment text, and should be padded with a space when possible.
+--- Used for `commenting` and to add markers for folding, see `fold-marker`.
---
--- @type string
vim.o.commentstring = ""
@@ -1061,6 +1061,10 @@ vim.bo.cfu = vim.bo.completefunc
--- completion in the preview window. Only works in
--- combination with "menu" or "menuone".
---
+--- popup Show extra information about the currently selected
+--- completion in a popup window. Only works in combination
+--- with "menu" or "menuone". Overrides "preview".
+---
--- noinsert Do not insert any text for a match until the user selects
--- a match from the menu. Only works in combination with
--- "menu" or "menuone". No effect if "longest" is present.
@@ -1069,13 +1073,19 @@ vim.bo.cfu = vim.bo.completefunc
--- select one from the menu. Only works in combination with
--- "menu" or "menuone".
---
---- popup Show extra information about the currently selected
---- completion in a popup window. Only works in combination
---- with "menu" or "menuone". Overrides "preview".
+--- fuzzy Enable `fuzzy-matching` for completion candidates. This
+--- allows for more flexible and intuitive matching, where
+--- characters can be skipped and matches can be found even
+--- if the exact sequence is not typed. Only makes a
+--- difference how completion candidates are reduced from the
+--- list of alternatives, but not how the candidates are
+--- collected (using different completion types).
---
--- @type string
vim.o.completeopt = "menu,preview"
vim.o.cot = vim.o.completeopt
+vim.bo.completeopt = vim.o.completeopt
+vim.bo.cot = vim.bo.completeopt
vim.go.completeopt = vim.o.completeopt
vim.go.cot = vim.go.completeopt
@@ -5781,8 +5791,8 @@ vim.bo.sw = vim.bo.shiftwidth
--- message; also for quickfix message (e.g., ":cn")
--- s don't give "search hit BOTTOM, continuing at TOP" or *shm-s*
--- "search hit TOP, continuing at BOTTOM" messages; when using
---- the search count do not show "W" after the count message (see
---- S below)
+--- the search count do not show "W" before the count message
+--- (see `shm-S` below)
--- t truncate file message at the start if it is too long *shm-t*
--- to fit on the command-line, "<" will appear in the left most
--- column; ignored in Ex mode
@@ -5804,7 +5814,11 @@ vim.bo.sw = vim.bo.shiftwidth
--- `:silent` was used for the command; note that this also
--- affects messages from 'autoread' reloading
--- S do not show search count message when searching, e.g. *shm-S*
---- "[1/5]"
+--- "[1/5]". When the "S" flag is not present (e.g. search count
+--- is shown), the "search hit BOTTOM, continuing at TOP" and
+--- "search hit TOP, continuing at BOTTOM" messages are only
+--- indicated by a "W" (Mnemonic: Wrapped) letter before the
+--- search count statistics.
---
--- This gives you the opportunity to avoid that a change between buffers
--- requires you to hit <Enter>, but still gives as useful a message as
diff --git a/runtime/lua/vim/_meta/spell.lua b/runtime/lua/vim/_meta/spell.lua
index c636db3b53..b4e3bf6ca4 100644
--- a/runtime/lua/vim/_meta/spell.lua
+++ b/runtime/lua/vim/_meta/spell.lua
@@ -20,7 +20,7 @@
--- ```
---
--- @param str string
---- @return {[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]
+--- @return [string, 'bad'|'rare'|'local'|'caps', integer][]
--- List of tuples with three items:
--- - The badly spelled word.
--- - The type of the spelling error:
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 84bb26a135..ad057d902b 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -2766,8 +2766,9 @@ function vim.fn.getchangelist(buf) end
--- endfunction
--- <
---
+--- @param expr? 0|1
--- @return integer
-function vim.fn.getchar() end
+function vim.fn.getchar(expr) end
--- The result is a Number which is the state of the modifiers for
--- the last obtained character with getchar() or in another way.
@@ -2837,8 +2838,9 @@ function vim.fn.getcharsearch() end
--- Otherwise this works like |getchar()|, except that a number
--- result is converted to a string.
---
+--- @param expr? 0|1
--- @return string
-function vim.fn.getcharstr() end
+function vim.fn.getcharstr(expr) end
--- Return the type of the current command-line completion.
--- Only works when the command line is being edited, thus
@@ -3249,8 +3251,8 @@ function vim.fn.getloclist(nr, what) end
--- Refer to |getpos()| for getting information about a specific
--- mark.
---
---- @param buf? any
---- @return any
+--- @param buf? integer?
+--- @return vim.fn.getmarklist.ret.item[]
function vim.fn.getmarklist(buf) end
--- Returns a |List| with all matches previously defined for the
@@ -4969,10 +4971,21 @@ function vim.fn.libcallnr(libname, funcname, argument) end
--- display isn't updated, e.g. in silent Ex mode)
--- w$ last line visible in current window (this is one
--- less than "w0" if no lines are visible)
---- v In Visual mode: the start of the Visual area (the
---- cursor is the end). When not in Visual mode
---- returns the cursor position. Differs from |'<| in
---- that it's updated right away.
+--- v When not in Visual mode, returns the cursor
+--- position. In Visual mode, returns the other end
+--- of the Visual area. A good way to think about
+--- this is that in Visual mode "v" and "." complement
+--- each other. While "." refers to the cursor
+--- position, "v" refers to where |v_o| would move the
+--- cursor. As a result, you can use "v" and "."
+--- together to work on all of a selection in
+--- characterwise visual mode. If the cursor is at
+--- the end of a characterwise visual area, "v" refers
+--- to the start of the same visual area. And if the
+--- cursor is at the start of a characterwise visual
+--- area, "v" refers to the end of the same visual
+--- area. "v" differs from |'<| and |'>| in that it's
+--- updated right away.
--- Note that a mark in another file can be used. The line number
--- then applies to another buffer.
--- To get the column number use |col()|. To get both use
@@ -5297,8 +5310,9 @@ function vim.fn.mapcheck(name, mode, abbr) end
--- ounmap xyzzy
--- echo printf("Operator-pending mode bit: 0x%x", op_bit)
---
---- @return any
-function vim.fn.maplist() end
+--- @param abbr? 0|1
+--- @return table[]
+function vim.fn.maplist(abbr) end
--- Like |map()| but instead of replacing items in {expr1} a new
--- List or Dictionary is created and returned. {expr1} remains
@@ -7634,8 +7648,15 @@ function vim.fn.searchdecl(name, global, thisblock) end
--- \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')
--- <
---
---- @return any
-function vim.fn.searchpair() end
+--- @param start any
+--- @param middle any
+--- @param end_ any
+--- @param flags? string
+--- @param skip? any
+--- @param stopline? any
+--- @param timeout? integer
+--- @return integer
+function vim.fn.searchpair(start, middle, end_, flags, skip, stopline, timeout) end
--- Same as |searchpair()|, but returns a |List| with the line and
--- column position of the match. The first element of the |List|
@@ -7647,8 +7668,15 @@ function vim.fn.searchpair() end
--- <
--- See |match-parens| for a bigger and more useful example.
---
---- @return any
-function vim.fn.searchpairpos() end
+--- @param start any
+--- @param middle any
+--- @param end_ any
+--- @param flags? string
+--- @param skip? any
+--- @param stopline? any
+--- @param timeout? integer
+--- @return [integer, integer]
+function vim.fn.searchpairpos(start, middle, end_, flags, skip, stopline, timeout) end
--- Same as |search()|, but returns a |List| with the line and
--- column position of the match. The first element of the |List|
@@ -9796,7 +9824,7 @@ function vim.fn.synIDtrans(synID) end
---
--- @param lnum integer
--- @param col integer
---- @return {[1]: integer, [2]: string, [3]: integer}
+--- @return [integer, string, integer]
function vim.fn.synconcealed(lnum, col) end
--- Return a |List|, which is the stack of syntax items at the
diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua
index b41e298dd7..a61fa61256 100644
--- a/runtime/lua/vim/_options.lua
+++ b/runtime/lua/vim/_options.lua
@@ -95,7 +95,6 @@
local api = vim.api
-- TODO(tjdevries): Improve option metadata so that this doesn't have to be hardcoded.
--- Can be done in a separate PR.
local key_value_options = {
fillchars = true,
fcs = true,
@@ -175,6 +174,11 @@ local function new_buf_opt_accessor(bufnr)
end
local function new_win_opt_accessor(winid, bufnr)
+ -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value
+ if bufnr ~= nil and bufnr ~= 0 then
+ error('only bufnr=0 is supported')
+ end
+
return setmetatable({}, {
__index = function(_, k)
if bufnr == nil and type(k) == 'number' then
@@ -185,11 +189,6 @@ local function new_win_opt_accessor(winid, bufnr)
end
end
- if bufnr ~= nil and bufnr ~= 0 then
- error('only bufnr=0 is supported')
- end
-
- -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value
return api.nvim_get_option_value(k, {
scope = bufnr and 'local' or nil,
win = winid or 0,
@@ -197,7 +196,6 @@ local function new_win_opt_accessor(winid, bufnr)
end,
__newindex = function(_, k, v)
- -- TODO(lewis6991): allow passing both buf and win to nvim_set_option_value
return api.nvim_set_option_value(k, v, {
scope = bufnr and 'local' or nil,
win = winid or 0,
diff --git a/runtime/lua/vim/deprecated/health.lua b/runtime/lua/vim/deprecated/health.lua
index 64a755b248..eed889d90a 100644
--- a/runtime/lua/vim/deprecated/health.lua
+++ b/runtime/lua/vim/deprecated/health.lua
@@ -1,7 +1,7 @@
local M = {}
local health = vim.health
-local deprecated = {} ---@type {[1]: string, [2]: table, [3]: string}[]
+local deprecated = {} ---@type [string, table, string][]
function M.check()
if next(deprecated) == nil then
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index dca7698356..c8e34258f5 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -108,7 +108,7 @@ local M = {}
--- If {scope} is "line" or "cursor", use this position rather than the cursor
--- position. If a number, interpreted as a line number; otherwise, a
--- (row, col) tuple.
---- @field pos? integer|{[1]:integer,[2]:integer}
+--- @field pos? integer|[integer,integer]
---
--- Sort diagnostics by severity.
--- Overrides the setting from |vim.diagnostic.config()|.
@@ -122,7 +122,7 @@ local M = {}
--- String to use as the header for the floating window. If a table, it is
--- interpreted as a `[text, hl_group]` tuple.
--- Overrides the setting from |vim.diagnostic.config()|.
---- @field header? string|{[1]:string,[2]:any}
+--- @field header? string|[string,any]
---
--- Include the diagnostic source in the message.
--- Use "if_many" to only show sources if there is more than one source of
@@ -203,7 +203,7 @@ local M = {}
--- @field hl_mode? 'replace'|'combine'|'blend'
---
--- See |nvim_buf_set_extmark()|.
---- @field virt_text? {[1]:string,[2]:any}[]
+--- @field virt_text? [string,any][]
---
--- See |nvim_buf_set_extmark()|.
--- @field virt_text_pos? 'eol'|'overlay'|'right_align'|'inline'
@@ -247,9 +247,11 @@ local M = {}
--- @class vim.diagnostic.Opts.Jump
---
--- Default value of the {float} parameter of |vim.diagnostic.jump()|.
+--- (default: false)
--- @field float? boolean|vim.diagnostic.Opts.Float
---
--- Default value of the {wrap} parameter of |vim.diagnostic.jump()|.
+--- (default: true)
--- @field wrap? boolean
---
--- Default value of the {severity} parameter of |vim.diagnostic.jump()|.
@@ -1252,7 +1254,7 @@ end
--- Cursor position as a `(row, col)` tuple. See |nvim_win_get_cursor()|. Used
--- to find the nearest diagnostic when {count} is used. Only used when {count}
--- is non-nil. Default is the current cursor position.
---- @field pos? {[1]:integer,[2]:integer}
+--- @field pos? [integer,integer]
---
--- Whether to loop around file or not. Similar to 'wrapscan'.
--- (default: `true`)
@@ -1857,16 +1859,19 @@ function M.open_float(opts, ...)
if scope == 'line' then
--- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
- return lnum >= d.lnum and lnum <= d.end_lnum
+ return lnum >= d.lnum
+ and lnum <= d.end_lnum
+ and (d.lnum == d.end_lnum or lnum ~= d.end_lnum or d.end_col ~= 0)
end, diagnostics)
elseif scope == 'cursor' then
- -- LSP servers can send diagnostics with `end_col` past the length of the line
+ -- If `col` is past the end of the line, show if the cursor is on the last char in the line
local line_length = #api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
--- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
- return d.lnum == lnum
- and math.min(d.col, line_length - 1) <= col
- and (d.end_col >= col or d.end_lnum > lnum)
+ return lnum >= d.lnum
+ and lnum <= d.end_lnum
+ and (lnum ~= d.lnum or col >= math.min(d.col, line_length - 1))
+ and ((d.lnum == d.end_lnum and d.col == d.end_col) or lnum ~= d.end_lnum or col < d.end_col)
end, diagnostics)
end
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 2ab6cc6059..cc2fbe0cec 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -4,7 +4,7 @@ local fn = vim.fn
local M = {}
--- @alias vim.filetype.mapfn fun(path:string,bufnr:integer, ...):string?, fun(b:integer)?
---- @alias vim.filetype.maptbl {[1]:string|vim.filetype.mapfn, [2]:{priority:integer}}
+--- @alias vim.filetype.maptbl [string|vim.filetype.mapfn, {priority:integer}]
--- @alias vim.filetype.mapping.value string|vim.filetype.mapfn|vim.filetype.maptbl
--- @alias vim.filetype.mapping table<string,vim.filetype.mapping.value>
@@ -873,6 +873,7 @@ local extension = {
t6 = 'raku',
p6 = 'raku',
raml = 'raml',
+ rasi = 'rasi',
rbs = 'rbs',
rego = 'rego',
rem = 'remind',
@@ -1450,6 +1451,7 @@ local filename = {
['.firebaserc'] = 'json',
['.prettierrc'] = 'json',
['.stylelintrc'] = 'json',
+ ['.lintstagedrc'] = 'json',
['flake.lock'] = 'json',
['.babelrc'] = 'jsonc',
['.eslintrc'] = 'jsonc',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 58d2666564..c56ece6289 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -594,7 +594,7 @@ function M.frm(_, bufnr)
end
--- @type vim.filetype.mapfn
-function M.fvwm_1(_, _)
+function M.fvwm_v1(_, _)
return 'fvwm', function(bufnr)
vim.b[bufnr].fvwm_version = 1
end
@@ -1355,7 +1355,7 @@ end
function M.sgml(_, bufnr)
local lines = table.concat(getlines(bufnr, 1, 5))
if lines:find('linuxdoc') then
- return 'smgllnx'
+ return 'sgmllnx'
elseif lines:find('<!DOCTYPE.*DocBook') then
return 'docbk',
function(b)
diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua
index ad4a915a94..6de2bc3e94 100644
--- a/runtime/lua/vim/glob.lua
+++ b/runtime/lua/vim/glob.lua
@@ -29,8 +29,10 @@ function M.to_lpeg(pattern)
return patt
end
- local function add(acc, a)
- return acc + a
+ local function condlist(conds, after)
+ return vim.iter(conds):fold(P(false), function(acc, cond)
+ return acc + cond * after
+ end)
end
local function mul(acc, m)
@@ -63,15 +65,14 @@ function M.to_lpeg(pattern)
* C(P('!') ^ -1)
* Ct(Ct(C(P(1)) * P('-') * C(P(1) - P(']'))) ^ 1 * P(']'))
/ class,
- CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * P('}'),
+ CondList = P('{') * Ct(V('Cond') * (P(',') * V('Cond')) ^ 0) * P('}') * V('Pattern') / condlist,
-- TODO: '*' inside a {} condition is interpreted literally but should probably have the same
-- wildcard semantics it usually has.
-- Fixing this is non-trivial because '*' should match non-greedily up to "the rest of the
-- pattern" which in all other cases is the entire succeeding part of the pattern, but at the end of a {}
-- condition means "everything after the {}" where several other options separated by ',' may
-- exist in between that should not be matched by '*'.
- Cond = Cf((V('Ques') + V('Class') + V('CondList') + (V('Literal') - S(',}'))) ^ 1, mul)
- + Cc(P(0)),
+ Cond = Cf((V('Ques') + V('Class') + V('Literal') - S(',}')) ^ 1, mul) + Cc(P(0)),
Literal = P(1) / P,
End = P(-1) * Cc(P(-1)),
})
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index 89298ce568..233bc50237 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -31,8 +31,6 @@ M.priorities = {
--- Indicates priority of highlight
--- (default: `vim.highlight.priorities.user`)
--- @field priority? integer
----
---- @field package _scoped? boolean
--- Apply highlight group to range of text.
---
@@ -47,12 +45,23 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
local regtype = opts.regtype or 'v'
local inclusive = opts.inclusive or false
local priority = opts.priority or M.priorities.user
- local scoped = opts._scoped or false
+
+ local v_maxcol = vim.v.maxcol
local pos1 = type(start) == 'string' and vim.fn.getpos(start)
- or { bufnr, start[1] + 1, start[2] + 1, 0 }
+ or {
+ bufnr,
+ start[1] + 1,
+ start[2] ~= -1 and start[2] ~= v_maxcol and start[2] + 1 or v_maxcol,
+ 0,
+ }
local pos2 = type(finish) == 'string' and vim.fn.getpos(finish)
- or { bufnr, finish[1] + 1, finish[2] + 1, 0 }
+ or {
+ bufnr,
+ finish[1] + 1,
+ finish[2] ~= -1 and start[2] ~= v_maxcol and finish[2] + 1 or v_maxcol,
+ 0,
+ }
local buf_line_count = vim.api.nvim_buf_line_count(bufnr)
pos1[2] = math.min(pos1[2], buf_line_count)
@@ -63,10 +72,14 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
end
vim.api.nvim_buf_call(bufnr, function()
- local max_col1 = vim.fn.col({ pos1[2], '$' })
- pos1[3] = math.min(pos1[3], max_col1)
- local max_col2 = vim.fn.col({ pos2[2], '$' })
- pos2[3] = math.min(pos2[3], max_col2)
+ if pos1[3] ~= v_maxcol then
+ local max_col1 = vim.fn.col({ pos1[2], '$' })
+ pos1[3] = math.min(pos1[3], max_col1)
+ end
+ if pos2[3] ~= v_maxcol then
+ local max_col2 = vim.fn.col({ pos2[2], '$' })
+ pos2[3] = math.min(pos2[3], max_col2)
+ end
end)
local region = vim.fn.getregionpos(pos1, pos2, {
@@ -77,6 +90,14 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
-- For non-blockwise selection, use a single extmark.
if regtype == 'v' or regtype == 'V' then
region = { { region[1][1], region[#region][2] } }
+ if
+ regtype == 'V'
+ or region[1][2][2] == pos1[2] and pos1[3] == v_maxcol
+ or region[1][2][2] == pos2[2] and pos2[3] == v_maxcol
+ then
+ region[1][2][2] = region[1][2][2] + 1
+ region[1][2][3] = 0
+ end
end
for _, res in ipairs(region) do
@@ -84,17 +105,12 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
local start_col = res[1][3] - 1
local end_row = res[2][2] - 1
local end_col = res[2][3]
- if regtype == 'V' then
- end_row = end_row + 1
- end_col = 0
- end
api.nvim_buf_set_extmark(bufnr, ns, start_row, start_col, {
hl_group = higroup,
end_row = end_row,
end_col = end_col,
priority = priority,
strict = false,
- scoped = scoped,
})
end
end
@@ -158,19 +174,18 @@ function M.on_yank(opts)
yank_cancel()
end
- vim.api.nvim__win_add_ns(winid, yank_ns)
+ vim.api.nvim__ns_set(yank_ns, { wins = { winid } })
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
- _scoped = true,
})
yank_cancel = function()
yank_timer = nil
yank_cancel = nil
pcall(vim.api.nvim_buf_clear_namespace, bufnr, yank_ns, 0, -1)
- pcall(vim.api.nvim__win_del_ns, winid, yank_ns)
+ pcall(vim.api.nvim__ns_set, { wins = {} })
end
yank_timer = vim.defer_fn(yank_cancel, timeout)
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua
index 1093759efe..6bddf0bc5e 100644
--- a/runtime/lua/vim/iter.lua
+++ b/runtime/lua/vim/iter.lua
@@ -276,7 +276,7 @@ end
--- -- { 6, 12 }
--- ```
---
----@param f fun(...):any Mapping function. Takes all values returned from
+---@param f fun(...):...:any Mapping function. Takes all values returned from
--- the previous stage in the pipeline as arguments
--- and returns one or more new values, which are used
--- in the next pipeline stage. Nil return values
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index c2deac0113..623ccdd5cd 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -201,10 +201,10 @@ end
--- Predicate used to decide if a client should be re-used. Used on all
--- running clients. The default implementation re-uses a client if name and
--- root_dir matches.
---- @field reuse_client fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean
+--- @field reuse_client? fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean
---
--- Buffer handle to attach to if starting or re-using a client (0 for current).
---- @field bufnr integer
+--- @field bufnr? integer
---
--- Suppress error reporting if the LSP server fails to start (default false).
--- @field silent? boolean
@@ -393,7 +393,7 @@ local function on_client_exit(code, signal, client_id)
vim.schedule(function()
for bufnr in pairs(client.attached_buffers) do
- if client and client.attached_buffers[bufnr] then
+ if client and client.attached_buffers[bufnr] and api.nvim_buf_is_valid(bufnr) then
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,
@@ -484,6 +484,7 @@ local function text_document_did_save_handler(bufnr)
text = lsp._buf_get_full_text(bufnr),
},
})
+ util.buf_versions[bufnr] = 0
end
local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save')
if save_capability then
@@ -574,11 +575,12 @@ local function buf_attach(bufnr)
})
-- First time, so attach and set up stuff.
api.nvim_buf_attach(bufnr, false, {
- on_lines = function(_, _, _, firstline, lastline, new_lastline)
+ on_lines = function(_, _, changedtick, firstline, lastline, new_lastline)
if #lsp.get_clients({ bufnr = bufnr }) == 0 then
-- detach if there are no clients
return #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0
end
+ util.buf_versions[bufnr] = changedtick
changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
end,
@@ -602,6 +604,7 @@ local function buf_attach(bufnr)
buf_detach_client(bufnr, client)
end
attached_buffers[bufnr] = nil
+ util.buf_versions[bufnr] = nil
end,
-- TODO if we know all of the potential clients ahead of time, then we
diff --git a/runtime/lua/vim/lsp/_changetracking.lua b/runtime/lua/vim/lsp/_changetracking.lua
index ce701f0772..b2be53269f 100644
--- a/runtime/lua/vim/lsp/_changetracking.lua
+++ b/runtime/lua/vim/lsp/_changetracking.lua
@@ -1,5 +1,6 @@
local protocol = require('vim.lsp.protocol')
local sync = require('vim.lsp.sync')
+local util = require('vim.lsp.util')
local api = vim.api
local uv = vim.uv
@@ -276,7 +277,7 @@ local function send_changes(bufnr, sync_kind, state, buf_state)
client.notify(protocol.Methods.textDocument_didChange, {
textDocument = {
uri = uri,
- version = vim.b[bufnr].changedtick,
+ version = util.buf_versions[bufnr],
},
contentChanges = changes,
})
diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua
index 819b03a63a..27113c0e74 100644
--- a/runtime/lua/vim/lsp/_dynamic.lua
+++ b/runtime/lua/vim/lsp/_dynamic.lua
@@ -24,7 +24,6 @@ function M:supports_registration(method)
end
--- @param registrations lsp.Registration[]
---- @package
function M:register(registrations)
-- remove duplicates
self:unregister(registrations)
@@ -38,7 +37,6 @@ function M:register(registrations)
end
--- @param unregisterations lsp.Unregistration[]
---- @package
function M:unregister(unregisterations)
for _, unreg in ipairs(unregisterations) do
local method = unreg.method
@@ -58,7 +56,6 @@ end
--- @param method string
--- @param opts? {bufnr: integer?}
--- @return lsp.Registration? (table|nil) the registration if found
---- @package
function M:get(method, opts)
opts = opts or {}
opts.bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
@@ -78,7 +75,6 @@ end
--- @param method string
--- @param opts? {bufnr: integer?}
---- @package
function M:supports(method, opts)
return self:get(method, opts) ~= nil
end
diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua
index 9a11972007..cbddd24630 100644
--- a/runtime/lua/vim/lsp/_meta/protocol.lua
+++ b/runtime/lua/vim/lsp/_meta/protocol.lua
@@ -3235,7 +3235,7 @@ error('Cannot require a meta file')
---
---*Note*: a label of type string should be a substring of its containing signature label.
---Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
----@field label string|{ [1]: uinteger, [2]: uinteger }
+---@field label string|[uinteger, uinteger]
---
---The human-readable doc-comment of this parameter. Will be shown
---in the UI but can be omitted.
diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua
index b28fe2f797..d3ff918792 100644
--- a/runtime/lua/vim/lsp/client.lua
+++ b/runtime/lua/vim/lsp/client.lua
@@ -436,7 +436,7 @@ local function ensure_list(x)
return { x }
end
---- @package
+--- @nodoc
--- @param config vim.lsp.ClientConfig
--- @return vim.lsp.Client?
function Client.create(config)
@@ -535,7 +535,7 @@ function Client:_run_callbacks(cbs, error_id, ...)
end
end
---- @package
+--- @nodoc
function Client:initialize()
local config = self.config
@@ -656,7 +656,7 @@ end
--- @param method string LSP method name.
--- @param params? table LSP request params.
--- @param handler? lsp.Handler Response |lsp-handler| for this method.
---- @param bufnr? integer Buffer handle (0 for current).
+--- @param bufnr integer Buffer handle (0 for current).
--- @return boolean status, integer? request_id {status} is a bool indicating
--- whether the request was successful. If it is `false`, then it will
--- always be `false` (the client has shutdown). If it was
@@ -673,8 +673,8 @@ function Client:_request(method, params, handler, bufnr)
end
-- Ensure pending didChange notifications are sent so that the server doesn't operate on a stale state
changetracking.flush(self, bufnr)
+ local version = lsp.util.buf_versions[bufnr]
bufnr = resolve_bufnr(bufnr)
- local version = vim.b[bufnr].changedtick
log.debug(self._log_prefix, 'client.request', self.id, method, params, handler, bufnr)
local success, request_id = self.rpc.request(method, params, function(err, result)
local context = {
@@ -861,7 +861,6 @@ function Client:_is_stopped()
return self.rpc.is_closing()
end
---- @package
--- Execute a lsp command, either via client command function (if available)
--- or via workspace/executeCommand (if supported by the server)
---
@@ -906,7 +905,6 @@ function Client:_exec_cmd(command, context, handler, on_unsupported)
self.request(ms.workspace_executeCommand, params, handler, context.bufnr)
end
---- @package
--- Default handler for the 'textDocument/didOpen' LSP notification.
---
--- @param bufnr integer Number of the buffer, or 0 for current
@@ -922,13 +920,14 @@ function Client:_text_document_did_open_handler(bufnr)
local params = {
textDocument = {
- version = vim.b[bufnr].changedtick,
+ version = 0,
uri = vim.uri_from_bufnr(bufnr),
languageId = self.get_language_id(bufnr, filetype),
text = lsp._buf_get_full_text(bufnr),
},
}
self.notify(ms.textDocument_didOpen, params)
+ lsp.util.buf_versions[bufnr] = params.textDocument.version
-- Next chance we get, we should re-do the diagnostics
vim.schedule(function()
@@ -941,7 +940,6 @@ function Client:_text_document_did_open_handler(bufnr)
end)
end
---- @package
--- Runs the on_attach function from the client's config if it was defined.
--- @param bufnr integer Buffer number
function Client:_on_attach(bufnr)
@@ -1064,7 +1062,6 @@ function Client:_on_exit(code, signal)
)
end
---- @package
--- Add a directory to the workspace folders.
--- @param dir string?
function Client:_add_workspace_folder(dir)
@@ -1087,7 +1084,6 @@ function Client:_add_workspace_folder(dir)
vim.list_extend(self.workspace_folders, wf)
end
---- @package
--- Remove a directory to the workspace folders.
--- @param dir string?
function Client:_remove_workspace_folder(dir)
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
index 39c0c5fa29..4b7deabf41 100644
--- a/runtime/lua/vim/lsp/completion.lua
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -30,7 +30,7 @@ local buf_handles = {}
--- @nodoc
--- @class vim.lsp.completion.Context
local Context = {
- cursor = nil, --- @type { [1]: integer, [2]: integer }?
+ cursor = nil, --- @type [integer, integer]?
last_request_time = nil, --- @type integer?
pending_requests = {}, --- @type function[]
isIncomplete = false,
@@ -153,7 +153,8 @@ local function get_completion_word(item)
return item.label
end
elseif item.textEdit then
- return item.textEdit.newText
+ local word = item.textEdit.newText
+ return word:match('^(%S*)') or word
elseif item.insertText and item.insertText ~= '' then
return item.insertText
end
@@ -201,6 +202,24 @@ local function get_items(result)
end
end
+---@param item lsp.CompletionItem
+---@return string
+local function get_doc(item)
+ local doc = item.documentation
+ if not doc then
+ return ''
+ end
+ if type(doc) == 'string' then
+ return doc
+ end
+ if type(doc) == 'table' and type(doc.value) == 'string' then
+ return doc.value
+ end
+
+ vim.notify('invalid documentation value: ' .. vim.inspect(doc), vim.log.levels.WARN)
+ return ''
+end
+
--- Turns the result of a `textDocument/completion` request into vim-compatible
--- |complete-items|.
---
@@ -216,58 +235,48 @@ function M._lsp_to_complete_items(result, prefix, client_id)
return {}
end
- if prefix ~= '' then
- ---@param item lsp.CompletionItem
- local function match_prefix(item)
- if item.filterText then
- return next(vim.fn.matchfuzzy({ item.filterText }, prefix))
- end
- return true
+ local matches = prefix == '' and function()
+ return true
+ end or function(item)
+ if item.filterText then
+ return next(vim.fn.matchfuzzy({ item.filterText }, prefix))
end
-
- items = vim.tbl_filter(match_prefix, items) --[[@as lsp.CompletionItem[]|]]
+ return true
end
- table.sort(items, function(a, b)
- return (a.sortText or a.label) < (b.sortText or b.label)
- end)
-
- local matches = {}
+ local candidates = {}
for _, item in ipairs(items) do
- local info = ''
- local documentation = item.documentation
- if documentation then
- if type(documentation) == 'string' and documentation ~= '' then
- info = documentation
- elseif type(documentation) == 'table' and type(documentation.value) == 'string' then
- info = documentation.value
- else
- vim.notify(
- ('invalid documentation value %s'):format(vim.inspect(documentation)),
- vim.log.levels.WARN
- )
- end
- end
- local word = get_completion_word(item)
- table.insert(matches, {
- word = word,
- abbr = item.label,
- kind = protocol.CompletionItemKind[item.kind] or 'Unknown',
- menu = item.detail or '',
- info = #info > 0 and info or '',
- icase = 1,
- dup = 1,
- empty = 1,
- user_data = {
- nvim = {
- lsp = {
- completion_item = item,
- client_id = client_id,
+ if matches(item) then
+ local word = get_completion_word(item)
+ table.insert(candidates, {
+ word = word,
+ abbr = item.label,
+ kind = protocol.CompletionItemKind[item.kind] or 'Unknown',
+ menu = item.detail or '',
+ info = get_doc(item),
+ icase = 1,
+ dup = 1,
+ empty = 1,
+ user_data = {
+ nvim = {
+ lsp = {
+ completion_item = item,
+ client_id = client_id,
+ },
},
},
- },
- })
+ })
+ end
end
- return matches
+ ---@diagnostic disable-next-line: no-unknown
+ table.sort(candidates, function(a, b)
+ ---@type lsp.CompletionItem
+ local itema = a.user_data.nvim.lsp.completion_item
+ ---@type lsp.CompletionItem
+ local itemb = b.user_data.nvim.lsp.completion_item
+ return (itema.sortText or itema.label) < (itemb.sortText or itemb.label)
+ end)
+
+ return candidates
end
--- @param lnum integer 0-indexed
@@ -340,79 +349,7 @@ function M._convert_results(
return matches, server_start_boundary
end
---- Implements 'omnifunc' compatible LSP completion.
----
---- @see |complete-functions|
---- @see |complete-items|
---- @see |CompleteDone|
----
---- @param findstart integer 0 or 1, decides behavior
---- @param base integer findstart=0, text to match against
----
---- @return integer|table Decided by {findstart}:
---- - findstart=0: column where the completion starts, or -2 or -3
---- - findstart=1: list of matches (actually just calls |complete()|)
-function M._omnifunc(findstart, base)
- vim.lsp.log.debug('omnifunc.findstart', { findstart = findstart, base = base })
- assert(base) -- silence luals
- local bufnr = api.nvim_get_current_buf()
- local clients = lsp.get_clients({ bufnr = bufnr, method = ms.textDocument_completion })
- local remaining = #clients
- if remaining == 0 then
- return findstart == 1 and -1 or {}
- end
-
- local win = api.nvim_get_current_win()
- local cursor = api.nvim_win_get_cursor(win)
- local lnum = cursor[1] - 1
- local cursor_col = cursor[2]
- local line = api.nvim_get_current_line()
- local line_to_cursor = line:sub(1, cursor_col)
- local client_start_boundary = vim.fn.match(line_to_cursor, '\\k*$') --[[@as integer]]
- local server_start_boundary = nil
- local items = {}
-
- local function on_done()
- local mode = api.nvim_get_mode()['mode']
- if mode == 'i' or mode == 'ic' then
- vim.fn.complete((server_start_boundary or client_start_boundary) + 1, items)
- end
- end
-
- local util = vim.lsp.util
- for _, client in ipairs(clients) do
- local params = util.make_position_params(win, client.offset_encoding)
- client.request(ms.textDocument_completion, params, function(err, result)
- if err then
- lsp.log.warn(err.message)
- end
- if result and vim.fn.mode() == 'i' then
- local matches
- matches, server_start_boundary = M._convert_results(
- line,
- lnum,
- cursor_col,
- client.id,
- client_start_boundary,
- server_start_boundary,
- result,
- client.offset_encoding
- )
- vim.list_extend(items, matches)
- end
- remaining = remaining - 1
- if remaining == 0 then
- vim.schedule(on_done)
- end
- end, bufnr)
- end
-
- -- Return -2 to signal that we should continue completion so that we can
- -- async complete.
- return -2
-end
-
---- @param clients table<integer, vim.lsp.Client>
+--- @param clients table<integer, vim.lsp.Client> # keys != client_id
--- @param bufnr integer
--- @param win integer
--- @param callback fun(responses: table<integer, { err: lsp.ResponseError, result: vim.lsp.CompletionResult }>)
@@ -422,7 +359,8 @@ local function request(clients, bufnr, win, callback)
local request_ids = {} --- @type table<integer, integer>
local remaining_requests = vim.tbl_count(clients)
- for client_id, client in pairs(clients) do
+ for _, client in pairs(clients) do
+ local client_id = client.id
local params = lsp.util.make_position_params(win, client.offset_encoding)
local ok, request_id = client.request(ms.textDocument_completion, params, function(err, result)
responses[client_id] = { err = err, result = result }
@@ -447,6 +385,64 @@ local function request(clients, bufnr, win, callback)
end
end
+local function trigger(bufnr, clients)
+ reset_timer()
+ Context:cancel_pending()
+
+ local win = api.nvim_get_current_win()
+ local cursor_row, cursor_col = unpack(api.nvim_win_get_cursor(win)) --- @type integer, integer
+ local line = api.nvim_get_current_line()
+ local line_to_cursor = line:sub(1, cursor_col)
+ local word_boundary = vim.fn.match(line_to_cursor, '\\k*$')
+ local start_time = vim.uv.hrtime()
+ Context.last_request_time = start_time
+
+ local cancel_request = request(clients, bufnr, win, function(responses)
+ local end_time = vim.uv.hrtime()
+ rtt_ms = compute_new_average((end_time - start_time) * ns_to_ms)
+
+ Context.pending_requests = {}
+ Context.isIncomplete = false
+
+ local row_changed = api.nvim_win_get_cursor(win)[1] ~= cursor_row
+ local mode = api.nvim_get_mode().mode
+ if row_changed or not (mode == 'i' or mode == 'ic') then
+ return
+ end
+
+ local matches = {}
+ local server_start_boundary --- @type integer?
+ for client_id, response in pairs(responses) do
+ if response.err then
+ vim.notify_once(response.err.message, vim.log.levels.warn)
+ end
+
+ local result = response.result
+ if result then
+ Context.isIncomplete = Context.isIncomplete or result.isIncomplete
+ local client = lsp.get_client_by_id(client_id)
+ local encoding = client and client.offset_encoding or 'utf-16'
+ local client_matches
+ client_matches, server_start_boundary = M._convert_results(
+ line,
+ cursor_row - 1,
+ cursor_col,
+ client_id,
+ word_boundary,
+ nil,
+ result,
+ encoding
+ )
+ vim.list_extend(matches, client_matches)
+ end
+ end
+ local start_col = (server_start_boundary or word_boundary) + 1
+ vim.fn.complete(start_col, matches)
+ end)
+
+ table.insert(Context.pending_requests, cancel_request)
+end
+
--- @param handle vim.lsp.completion.BufHandle
local function on_insert_char_pre(handle)
if tonumber(vim.fn.pumvisible()) == 1 then
@@ -581,8 +577,10 @@ end
---@param bufnr integer
---@param opts vim.lsp.completion.BufferOpts
local function enable_completions(client_id, bufnr, opts)
- if not buf_handles[bufnr] then
- buf_handles[bufnr] = { clients = {}, triggers = {} }
+ local buf_handle = buf_handles[bufnr]
+ if not buf_handle then
+ buf_handle = { clients = {}, triggers = {} }
+ buf_handles[bufnr] = buf_handle
-- Attach to buffer events.
api.nvim_buf_attach(bufnr, false, {
@@ -623,12 +621,12 @@ local function enable_completions(client_id, bufnr, opts)
end
end
- if not buf_handles[bufnr].clients[client_id] then
+ if not buf_handle.clients[client_id] then
local client = lsp.get_client_by_id(client_id)
assert(client, 'invalid client ID')
-- Add the new client to the buffer's clients.
- buf_handles[bufnr].clients[client_id] = client
+ buf_handle.clients[client_id] = client
-- Add the new client to the clients that should be triggered by its trigger characters.
--- @type string[]
@@ -638,10 +636,10 @@ local function enable_completions(client_id, bufnr, opts)
'triggerCharacters'
) or {}
for _, char in ipairs(triggers) do
- local clients_for_trigger = buf_handles[bufnr].triggers[char]
+ local clients_for_trigger = buf_handle.triggers[char]
if not clients_for_trigger then
clients_for_trigger = {}
- buf_handles[bufnr].triggers[char] = clients_for_trigger
+ buf_handle.triggers[char] = clients_for_trigger
end
local client_exists = vim.iter(clients_for_trigger):any(function(c)
return c.id == client_id
@@ -693,63 +691,38 @@ end
--- Trigger LSP completion in the current buffer.
function M.trigger()
- reset_timer()
- Context:cancel_pending()
-
- local win = api.nvim_get_current_win()
local bufnr = api.nvim_get_current_buf()
- local cursor_row, cursor_col = unpack(api.nvim_win_get_cursor(win)) --- @type integer, integer
- local line = api.nvim_get_current_line()
- local line_to_cursor = line:sub(1, cursor_col)
local clients = (buf_handles[bufnr] or {}).clients or {}
- local word_boundary = vim.fn.match(line_to_cursor, '\\k*$')
- local start_time = vim.uv.hrtime()
- Context.last_request_time = start_time
-
- local cancel_request = request(clients, bufnr, win, function(responses)
- local end_time = vim.uv.hrtime()
- rtt_ms = compute_new_average((end_time - start_time) * ns_to_ms)
-
- Context.pending_requests = {}
- Context.isIncomplete = false
-
- local row_changed = api.nvim_win_get_cursor(win)[1] ~= cursor_row
- local mode = api.nvim_get_mode().mode
- if row_changed or not (mode == 'i' or mode == 'ic') then
- return
- end
+ trigger(bufnr, clients)
+end
- local matches = {}
- local server_start_boundary --- @type integer?
- for client_id, response in pairs(responses) do
- if response.err then
- vim.notify_once(response.err.message, vim.log.levels.warn)
- end
+--- Implements 'omnifunc' compatible LSP completion.
+---
+--- @see |complete-functions|
+--- @see |complete-items|
+--- @see |CompleteDone|
+---
+--- @param findstart integer 0 or 1, decides behavior
+--- @param base integer findstart=0, text to match against
+---
+--- @return integer|table Decided by {findstart}:
+--- - findstart=0: column where the completion starts, or -2 or -3
+--- - findstart=1: list of matches (actually just calls |complete()|)
+function M._omnifunc(findstart, base)
+ vim.lsp.log.debug('omnifunc.findstart', { findstart = findstart, base = base })
+ assert(base) -- silence luals
+ local bufnr = api.nvim_get_current_buf()
+ local clients = lsp.get_clients({ bufnr = bufnr, method = ms.textDocument_completion })
+ local remaining = #clients
+ if remaining == 0 then
+ return findstart == 1 and -1 or {}
+ end
- local result = response.result
- if result then
- Context.isIncomplete = Context.isIncomplete or result.isIncomplete
- local client = lsp.get_client_by_id(client_id)
- local encoding = client and client.offset_encoding or 'utf-16'
- local client_matches
- client_matches, server_start_boundary = M._convert_results(
- line,
- cursor_row - 1,
- cursor_col,
- client_id,
- word_boundary,
- nil,
- result,
- encoding
- )
- vim.list_extend(matches, client_matches)
- end
- end
- local start_col = (server_start_boundary or word_boundary) + 1
- vim.fn.complete(start_col, matches)
- end)
+ trigger(bufnr, clients)
- table.insert(Context.pending_requests, cancel_request)
+ -- Return -2 to signal that we should continue completion so that we can
+ -- async complete.
+ return -2
end
return M
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 38c43893eb..44548fec92 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -646,6 +646,7 @@ M[ms.window_showMessage] = function(_, result, ctx, _)
if message_type == protocol.MessageType.Error then
err_message('LSP[', client_name, '] ', message)
else
+ --- @type string
local message_type_name = protocol.MessageType[message_type]
api.nvim_out_write(string.format('LSP[%s][%s] %s\n', client_name, message_type_name, message))
end
diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua
index 78f309abf7..2d784816cb 100644
--- a/runtime/lua/vim/lsp/inlay_hint.lua
+++ b/runtime/lua/vim/lsp/inlay_hint.lua
@@ -43,7 +43,7 @@ function M.on_inlayhint(err, result, ctx, _)
return
end
local bufnr = assert(ctx.bufnr)
- if vim.b[bufnr].changedtick ~= ctx.version then
+ if util.buf_versions[bufnr] ~= ctx.version then
return
end
local client_id = ctx.client_id
@@ -324,7 +324,7 @@ api.nvim_set_decoration_provider(namespace, {
return
end
- if bufstate.version ~= vim.b[bufnr].changedtick then
+ if bufstate.version ~= util.buf_versions[bufnr] then
return
end
@@ -348,7 +348,7 @@ api.nvim_set_decoration_provider(namespace, {
text = text .. part.value
end
end
- local vt = {} --- @type {[1]: string, [2]: string?}[]
+ local vt = {} --- @type [string, string?][]
if hint.paddingLeft then
vt[#vt + 1] = { ' ' }
end
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index 9f2bd71158..0438ca84af 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -9,7 +9,7 @@ local log_levels = vim.log.levels
--- Can be used to lookup the number from the name or the name from the number.
--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
--- Level numbers begin with "TRACE" at 0
---- @type table<string|integer, string|integer>
+--- @type table<string,integer> | table<integer, string>
--- @nodoc
log.levels = vim.deepcopy(log_levels)
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 8ac4cc794b..eb18043843 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -12,9 +12,6 @@ end
local sysname = vim.uv.os_uname().sysname
--- Protocol for the Microsoft Language Server Protocol (mslsp)
-local protocol = {}
-
local constants = {
--- @enum lsp.DiagnosticSeverity
DiagnosticSeverity = {
@@ -46,6 +43,8 @@ local constants = {
Info = 3,
-- A log message.
Log = 4,
+ -- A debug message.
+ Debug = 5,
},
-- The file event type.
@@ -308,326 +307,18 @@ local constants = {
},
}
-for k1, v1 in pairs(constants) do
- local tbl = vim.deepcopy(v1, true)
- for _, k2 in ipairs(vim.tbl_keys(tbl)) do
- local v2 = tbl[k2]
- tbl[v2] = k2
+-- Protocol for the Microsoft Language Server Protocol (mslsp)
+local protocol = {}
+
+--- @diagnostic disable:no-unknown
+for k1, v1 in pairs(vim.deepcopy(constants, true)) do
+ for _, k2 in ipairs(vim.tbl_keys(v1)) do
+ local v2 = v1[k2]
+ v1[v2] = k2
end
- protocol[k1] = tbl
+ protocol[k1] = v1
end
-
---[=[
---Text document specific client capabilities.
-export interface TextDocumentClientCapabilities {
- synchronization?: {
- --Whether text document synchronization supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports sending will save notifications.
- willSave?: boolean;
- --The client supports sending a will save request and
- --waits for a response providing text edits which will
- --be applied to the document before it is saved.
- willSaveWaitUntil?: boolean;
- --The client supports did save notifications.
- didSave?: boolean;
- }
- --Capabilities specific to the `textDocument/completion`
- completion?: {
- --Whether completion supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the following `CompletionItem` specific
- --capabilities.
- completionItem?: {
- --The client supports snippets as insert text.
- --
- --A snippet can define tab stops and placeholders with `$1`, `$2`
- --and `${3:foo}`. `$0` defines the final tab stop, it defaults to
- --the end of the snippet. Placeholders with equal identifiers are linked,
- --that is typing in one will update others too.
- snippetSupport?: boolean;
- --The client supports commit characters on a completion item.
- commitCharactersSupport?: boolean
- --The client supports the following content formats for the documentation
- --property. The order describes the preferred format of the client.
- documentationFormat?: MarkupKind[];
- --The client supports the deprecated property on a completion item.
- deprecatedSupport?: boolean;
- --The client supports the preselect property on a completion item.
- preselectSupport?: boolean;
- }
- completionItemKind?: {
- --The completion item kind values the client supports. When this
- --property exists the client also guarantees that it will
- --handle values outside its set gracefully and falls back
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the completion items kinds from `Text` to `Reference` as defined in
- --the initial version of the protocol.
- valueSet?: CompletionItemKind[];
- },
- --The client supports to send additional context information for a
- --`textDocument/completion` request.
- contextSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/hover`
- hover?: {
- --Whether hover supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the follow content formats for the content
- --property. The order describes the preferred format of the client.
- contentFormat?: MarkupKind[];
- };
- --Capabilities specific to the `textDocument/signatureHelp`
- signatureHelp?: {
- --Whether signature help supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the following `SignatureInformation`
- --specific properties.
- signatureInformation?: {
- --The client supports the follow content formats for the documentation
- --property. The order describes the preferred format of the client.
- documentationFormat?: MarkupKind[];
- --Client capabilities specific to parameter information.
- parameterInformation?: {
- --The client supports processing label offsets instead of a
- --simple label string.
- --
- --Since 3.14.0
- labelOffsetSupport?: boolean;
- }
- };
- };
- --Capabilities specific to the `textDocument/references`
- references?: {
- --Whether references supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentHighlight`
- documentHighlight?: {
- --Whether document highlight supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentSymbol`
- documentSymbol?: {
- --Whether document symbol supports dynamic registration.
- dynamicRegistration?: boolean;
- --Specific capabilities for the `SymbolKind`.
- symbolKind?: {
- --The symbol kind values the client supports. When this
- --property exists the client also guarantees that it will
- --handle values outside its set gracefully and falls back
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the symbol kinds from `File` to `Array` as defined in
- --the initial version of the protocol.
- valueSet?: SymbolKind[];
- }
- --The client supports hierarchical document symbols.
- hierarchicalDocumentSymbolSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/formatting`
- formatting?: {
- --Whether formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/rangeFormatting`
- rangeFormatting?: {
- --Whether range formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/onTypeFormatting`
- onTypeFormatting?: {
- --Whether on type formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/declaration`
- declaration?: {
- --Whether declaration supports dynamic registration. If this is set to `true`
- --the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of declaration links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/definition`.
- --
- --Since 3.14.0
- definition?: {
- --Whether definition supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/typeDefinition`
- --
- --Since 3.6.0
- typeDefinition?: {
- --Whether typeDefinition supports dynamic registration. If this is set to `true`
- --the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/implementation`.
- --
- --Since 3.6.0
- implementation?: {
- --Whether implementation supports dynamic registration. If this is set to `true`
- --the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/codeAction`
- codeAction?: {
- --Whether code action supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client support code action literals as a valid
- --response of the `textDocument/codeAction` request.
- --
- --Since 3.8.0
- codeActionLiteralSupport?: {
- --The code action kind is support with the following value
- --set.
- codeActionKind: {
- --The code action kind values the client supports. When this
- --property exists the client also guarantees that it will
- --handle values outside its set gracefully and falls back
- --to a default value when unknown.
- valueSet: CodeActionKind[];
- };
- };
- };
- --Capabilities specific to the `textDocument/codeLens`
- codeLens?: {
- --Whether code lens supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentLink`
- documentLink?: {
- --Whether document link supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentColor` and the
- --`textDocument/colorPresentation` request.
- --
- --Since 3.6.0
- colorProvider?: {
- --Whether colorProvider supports dynamic registration. If this is set to `true`
- --the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- }
- --Capabilities specific to the `textDocument/rename`
- rename?: {
- --Whether rename supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports testing for validity of rename operations
- --before execution.
- prepareSupport?: boolean;
- };
- --Capabilities specific to `textDocument/publishDiagnostics`.
- publishDiagnostics?: {
- --Whether the clients accepts diagnostics with related information.
- relatedInformation?: boolean;
- --Client supports the tag property to provide meta data about a diagnostic.
- --Clients supporting tags have to handle unknown tags gracefully.
- --Since 3.15.0
- tagSupport?: {
- --The tags supported by this client
- valueSet: DiagnosticTag[];
- };
- };
- --Capabilities specific to `textDocument/foldingRange` requests.
- --
- --Since 3.10.0
- foldingRange?: {
- --Whether implementation supports dynamic registration for folding range providers. If this is set to `true`
- --the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- --The maximum number of folding ranges that the client prefers to receive per document. The value serves as a
- --hint, servers are free to follow the limit.
- rangeLimit?: number;
- --If set, the client signals that it only supports folding complete lines. If set, client will
- --ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange.
- lineFoldingOnly?: boolean;
- };
-}
---]=]
-
---[=[
---Workspace specific client capabilities.
-export interface WorkspaceClientCapabilities {
- --The client supports applying batch edits to the workspace by supporting
- --the request 'workspace/applyEdit'
- applyEdit?: boolean;
- --Capabilities specific to `WorkspaceEdit`s
- workspaceEdit?: {
- --The client supports versioned document changes in `WorkspaceEdit`s
- documentChanges?: boolean;
- --The resource operations the client supports. Clients should at least
- --support 'create', 'rename' and 'delete' files and folders.
- resourceOperations?: ResourceOperationKind[];
- --The failure handling strategy of a client if applying the workspace edit
- --fails.
- failureHandling?: FailureHandlingKind;
- };
- --Capabilities specific to the `workspace/didChangeConfiguration` notification.
- didChangeConfiguration?: {
- --Did change configuration notification supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
- didChangeWatchedFiles?: {
- --Did change watched files notification supports dynamic registration. Please note
- --that the current protocol doesn't support static configuration for file changes
- --from the server side.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `workspace/symbol` request.
- symbol?: {
- --Symbol request supports dynamic registration.
- dynamicRegistration?: boolean;
- --Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
- symbolKind?: {
- --The symbol kind values the client supports. When this
- --property exists the client also guarantees that it will
- --handle values outside its set gracefully and falls back
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the symbol kinds from `File` to `Array` as defined in
- --the initial version of the protocol.
- valueSet?: SymbolKind[];
- }
- };
- --Capabilities specific to the `workspace/executeCommand` request.
- executeCommand?: {
- --Execute command supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --The client has support for workspace folders.
- --
- --Since 3.6.0
- workspaceFolders?: boolean;
- --The client supports `workspace/configuration` requests.
- --
- --Since 3.6.0
- configuration?: boolean;
-}
---]=]
+--- @diagnostic enable:no-unknown
--- Gets a new ClientCapabilities object describing the LSP client
--- capabilities.
@@ -1250,14 +941,5 @@ protocol.Methods = {
--- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
workspace_workspaceFolders = 'workspace/workspaceFolders',
}
-local function freeze(t)
- return setmetatable({}, {
- __index = t,
- __newindex = function()
- error('cannot modify immutable table')
- end,
- })
-end
-protocol.Methods = freeze(protocol.Methods)
return protocol
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 3c63a12da2..5e2b041a0a 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -140,7 +140,7 @@ local client_errors = {
SERVER_RESULT_CALLBACK_ERROR = 7,
}
---- @type table<string|integer, string|integer>
+--- @type table<string,integer> | table<integer,string>
--- @nodoc
M.client_errors = vim.deepcopy(client_errors)
for k, v in pairs(client_errors) do
@@ -502,7 +502,7 @@ function Client:handle_body(body)
if decoded.error then
decoded.error = setmetatable(decoded.error, {
__tostring = M.format_rpc_error,
- }) --- @type table
+ })
end
self:try_call(
M.client_errors.SERVER_RESULT_CALLBACK_ERROR,
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index 278014a4ea..f92c0eb2e6 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -116,7 +116,7 @@ local function tokens_to_ranges(data, bufnr, client, request)
if elapsed_ns > yield_interval_ns then
vim.schedule(function()
- coroutine.resume(co, vim.b[bufnr].changedtick)
+ coroutine.resume(co, util.buf_versions[bufnr])
end)
if request.version ~= coroutine.yield() then
-- request became stale since the last time the coroutine ran.
@@ -197,12 +197,6 @@ function STHighlighter.new(bufnr)
highlighter:send_request()
end
end,
- on_detach = function(_, buf)
- local highlighter = STHighlighter.active[buf]
- if highlighter then
- highlighter:destroy()
- end
- end,
})
api.nvim_create_autocmd({ 'BufWinEnter', 'InsertLeave' }, {
@@ -275,7 +269,7 @@ end
---
---@package
function STHighlighter:send_request()
- local version = vim.b[self.bufnr].changedtick
+ local version = util.buf_versions[self.bufnr]
self:reset_timer()
@@ -418,7 +412,7 @@ end
function STHighlighter:on_win(topline, botline)
for client_id, state in pairs(self.client_state) do
local current_result = state.current_result
- if current_result.version and current_result.version == vim.b[self.bufnr].changedtick then
+ if current_result.version and current_result.version == util.buf_versions[self.bufnr] then
if not current_result.namespace_cleared then
api.nvim_buf_clear_namespace(self.bufnr, state.namespace, 0, -1)
current_result.namespace_cleared = true
@@ -779,7 +773,6 @@ function M.highlight_token(token, bufnr, client_id, hl_group, opts)
})
end
---- @package
--- |lsp-handler| for the method `workspace/semanticTokens/refresh`
---
--- Refresh requests are sent by the server to indicate a project-wide change
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index d1f0e97065..ae6de591b3 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -173,11 +173,11 @@ local _str_byteindex_enc = M._str_byteindex_enc
--- CAUTION: Changes in-place!
---
---@deprecated
----@param lines (table) Original list of strings
----@param A (table) Start position; a 2-tuple of {line,col} numbers
----@param B (table) End position; a 2-tuple of {line,col} numbers
----@param new_lines (table) list of strings to replace the original
----@return table The modified {lines} object
+---@param lines string[] Original list of strings
+---@param A [integer, integer] Start position; a 2-tuple of {line,col} numbers
+---@param B [integer, integer] End position; a 2-tuple {line,col} numbers
+---@param new_lines string[] list of strings to replace the original
+---@return string[] The modified {lines} object
function M.set_lines(lines, A, B, new_lines)
vim.deprecate('vim.lsp.util.set_lines()', 'nil', '0.12')
-- 0-indexing to 1-indexing
@@ -238,6 +238,7 @@ end
---@param rows integer[] zero-indexed line numbers
---@return table<integer, string>|string a table mapping rows to lines
local function get_lines(bufnr, rows)
+ --- @type integer[]
rows = type(rows) == 'table' and rows or { rows }
-- This is needed for bufload and bufloaded
@@ -246,7 +247,7 @@ local function get_lines(bufnr, rows)
end
local function buf_lines()
- local lines = {}
+ local lines = {} --- @type table<integer,string>
for _, row in ipairs(rows) do
lines[row] = (api.nvim_buf_get_lines(bufnr, row, row + 1, false) or { '' })[1]
end
@@ -274,11 +275,11 @@ local function get_lines(bufnr, rows)
if not fd then
return ''
end
- local stat = uv.fs_fstat(fd)
- local data = uv.fs_read(fd, stat.size, 0)
+ local stat = assert(uv.fs_fstat(fd))
+ local data = assert(uv.fs_read(fd, stat.size, 0))
uv.fs_close(fd)
- local lines = {} -- rows we need to retrieve
+ local lines = {} --- @type table<integer,true|string> rows we need to retrieve
local need = 0 -- keep track of how many unique rows we need
for _, row in pairs(rows) do
if not lines[row] then
@@ -307,7 +308,7 @@ local function get_lines(bufnr, rows)
lines[i] = ''
end
end
- return lines
+ return lines --[[@as table<integer,string>]]
end
--- Gets the zero-indexed line from the given buffer.
@@ -322,7 +323,8 @@ local function get_line(bufnr, row)
end
--- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position
----@param offset_encoding string|nil utf-8|utf-16|utf-32
+---@param position lsp.Position
+---@param offset_encoding? string utf-8|utf-16|utf-32
---@return integer
local function get_line_byte_from_position(bufnr, position, offset_encoding)
-- LSP's line and characters are 0-indexed
@@ -343,7 +345,7 @@ local function get_line_byte_from_position(bufnr, position, offset_encoding)
end
--- Applies a list of text edits to a buffer.
----@param text_edits table list of `TextEdit` objects
+---@param text_edits lsp.TextEdit[]
---@param bufnr integer Buffer id
---@param offset_encoding string utf-8|utf-16|utf-32
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
@@ -366,6 +368,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- Fix reversed range and indexing each text_edits
local index = 0
+ --- @param text_edit lsp.TextEdit
text_edits = vim.tbl_map(function(text_edit)
index = index + 1
text_edit._index = index
@@ -383,6 +386,9 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
end, text_edits)
-- Sort text_edits
+ ---@param a lsp.TextEdit | { _index: integer }
+ ---@param b lsp.TextEdit | { _index: integer }
+ ---@return boolean
table.sort(text_edits, function(a, b)
if a.range.start.line ~= b.range.start.line then
return a.range.start.line > b.range.start.line
@@ -391,12 +397,13 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
return a.range.start.character > b.range.start.character
end
if a._index ~= b._index then
- return a._index > b._index
+ return a._index < b._index
end
+ return false
end)
-- save and restore local marks since they get deleted by nvim_buf_set_lines
- local marks = {}
+ local marks = {} --- @type table<string,[integer,integer]>
for _, m in pairs(vim.fn.getmarklist(bufnr)) do
if m.mark:match("^'[a-z]$") then
marks[m.mark:sub(2, 2)] = { m.pos[2], m.pos[3] - 1 } -- api-indexed
@@ -481,8 +488,8 @@ end
--- Applies a `TextDocumentEdit`, which is a list of changes to a single
--- document.
---
----@param text_document_edit table: a `TextDocumentEdit` object
----@param index integer: Optional index of the edit, if from a list of edits (or nil, if not from a list)
+---@param text_document_edit lsp.TextDocumentEdit
+---@param index? integer: Optional index of the edit, if from a list of edits (or nil, if not from a list)
---@param offset_encoding? string
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
@@ -509,7 +516,8 @@ function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
and (
text_document.version
and text_document.version > 0
- and vim.b[bufnr].changedtick > text_document.version
+ and M.buf_versions[bufnr]
+ and M.buf_versions[bufnr] > text_document.version
)
then
print('Buffer ', text_document.uri, ' newer than edits.')
@@ -533,6 +541,7 @@ local function path_under_prefix(path, prefix)
end
--- Get list of buffers whose filename matches the given path prefix (normalized full path)
+---@param prefix string
---@return integer[]
local function get_bufs_with_prefix(prefix)
prefix = path_components(prefix)
@@ -677,7 +686,7 @@ end
--- Applies a `WorkspaceEdit`.
---
----@param workspace_edit table `WorkspaceEdit`
+---@param workspace_edit lsp.WorkspaceEdit
---@param offset_encoding string utf-8|utf-16|utf-32 (required)
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
function M.apply_workspace_edit(workspace_edit, offset_encoding)
@@ -723,8 +732,8 @@ end
--- Note that if the input is of type `MarkupContent` and its kind is `plaintext`,
--- then the corresponding value is returned without further modifications.
---
----@param input (lsp.MarkedString | lsp.MarkedString[] | lsp.MarkupContent)
----@param contents (table|nil) List of strings to extend with converted lines. Defaults to {}.
+---@param input lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent
+---@param contents string[]|nil List of strings to extend with converted lines. Defaults to {}.
---@return string[] extended with lines of converted markdown.
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
function M.convert_input_to_markdown_lines(input, contents)
@@ -759,11 +768,11 @@ end
--- Converts `textDocument/signatureHelp` response to markdown lines.
---
----@param signature_help table Response of `textDocument/SignatureHelp`
+---@param signature_help lsp.SignatureHelp Response of `textDocument/SignatureHelp`
---@param ft string|nil filetype that will be use as the `lang` for the label markdown code block
---@param triggers table|nil list of trigger characters from the lsp server. used to better determine parameter offsets
----@return table|nil table list of lines of converted markdown.
----@return table|nil table of active hl
+---@return string[]|nil table list of lines of converted markdown.
+---@return number[]|nil table of active hl
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers)
if not signature_help.signatures then
@@ -960,7 +969,7 @@ end
--- Shows document and optionally jumps to the location.
---
----@param location table (`Location`|`LocationLink`)
+---@param location lsp.Location|lsp.LocationLink
---@param offset_encoding string|nil utf-8|utf-16|utf-32
---@param opts table|nil options
--- - reuse_win (boolean) Jump to existing window if buffer is already open.
@@ -1017,7 +1026,7 @@ end
--- Jumps to a location.
---
----@param location table (`Location`|`LocationLink`)
+---@param location lsp.Location|lsp.LocationLink
---@param offset_encoding string|nil utf-8|utf-16|utf-32
---@param reuse_win boolean|nil Jump to existing window if buffer is already open.
---@return boolean `true` if the jump succeeded
@@ -1038,7 +1047,7 @@ end
--- - for Location, range is shown (e.g., function definition)
--- - for LocationLink, targetRange is shown (e.g., body of function definition)
---
----@param location table a single `Location` or `LocationLink`
+---@param location lsp.Location|lsp.LocationLink
---@param opts table
---@return integer|nil buffer id of float window
---@return integer|nil window id of float window
@@ -1154,7 +1163,7 @@ end
--- If you want to open a popup with fancy markdown, use `open_floating_preview` instead
---
---@param bufnr integer
----@param contents table of lines to show in window
+---@param contents string[] of lines to show in window
---@param opts table with optional fields
--- - height of floating window
--- - width of floating window
@@ -1669,7 +1678,7 @@ do --[[ References ]]
--- Shows a list of document highlights for a certain buffer.
---
---@param bufnr integer Buffer id
- ---@param references table List of `DocumentHighlight` objects to highlight
+ ---@param references lsp.DocumentHighlight[] objects to highlight
---@param offset_encoding string One of "utf-8", "utf-16", "utf-32".
---@see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent
function M.buf_highlight_references(bufnr, references, offset_encoding)
@@ -1720,7 +1729,9 @@ end)
---@inlinedoc
---@field filename string
---@field lnum integer 1-indexed line number
+---@field end_lnum integer 1-indexed end line number
---@field col integer 1-indexed column
+---@field end_col integer 1-indexed end column
---@field text string
---@field user_data lsp.Location|lsp.LocationLink
@@ -1747,7 +1758,7 @@ function M.locations_to_items(locations, offset_encoding)
end
local items = {}
- ---@type table<string, {start: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
+ ---@type table<string, {start: lsp.Position, end: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
local grouped = setmetatable({}, {
__index = function(t, k)
local v = {}
@@ -1759,7 +1770,7 @@ function M.locations_to_items(locations, offset_encoding)
-- locations may be Location or LocationLink
local uri = d.uri or d.targetUri
local range = d.range or d.targetSelectionRange
- table.insert(grouped[uri], { start = range.start, location = d })
+ table.insert(grouped[uri], { start = range.start, ['end'] = range['end'], location = d })
end
---@type string[]
@@ -1774,6 +1785,9 @@ function M.locations_to_items(locations, offset_encoding)
local line_numbers = {}
for _, temp in ipairs(rows) do
table.insert(line_numbers, temp.start.line)
+ if temp.start.line ~= temp['end'].line then
+ table.insert(line_numbers, temp['end'].line)
+ end
end
-- get all the lines for this uri
@@ -1781,13 +1795,18 @@ function M.locations_to_items(locations, offset_encoding)
for _, temp in ipairs(rows) do
local pos = temp.start
+ local end_pos = temp['end']
local row = pos.line
+ local end_row = end_pos.line
local line = lines[row] or ''
local col = M._str_byteindex_enc(line, pos.character, offset_encoding)
+ local end_col = M._str_byteindex_enc(lines[end_row] or '', end_pos.character, offset_encoding)
table.insert(items, {
filename = filename,
lnum = row + 1,
+ end_lnum = end_row + 1,
col = col + 1,
+ end_col = end_col + 1,
text = line,
user_data = temp.location,
})
@@ -1873,7 +1892,7 @@ end
--- CAUTION: Modifies the input in-place!
---
---@deprecated
----@param lines table list of lines
+---@param lines string[] list of lines
---@return string filetype or "markdown" if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
vim.deprecate('vim.lsp.util.try_trim_markdown_code_blocks()', 'nil', '0.12')
@@ -1898,7 +1917,7 @@ function M.try_trim_markdown_code_blocks(lines)
end
---@param window integer|nil: window handle or 0 for current, defaults to current
----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
+---@param offset_encoding? string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
local function make_position_param(window, offset_encoding)
window = window or 0
local buf = api.nvim_win_get_buf(window)
@@ -1919,7 +1938,7 @@ end
---
---@param window integer|nil: window handle or 0 for current, defaults to current
---@param offset_encoding string|nil utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
----@return table `TextDocumentPositionParams` object
+---@return lsp.TextDocumentPositionParams
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
function M.make_position_params(window, offset_encoding)
window = window or 0
@@ -1932,7 +1951,7 @@ function M.make_position_params(window, offset_encoding)
end
--- Utility function for getting the encoding of the first LSP client on the given buffer.
----@param bufnr (integer) buffer handle or 0 for current, defaults to current
+---@param bufnr integer buffer handle or 0 for current, defaults to current
---@return string encoding first client if there is one, nil otherwise
function M._get_offset_encoding(bufnr)
validate({
@@ -2033,15 +2052,16 @@ end
--- Creates a `TextDocumentIdentifier` object for the current buffer.
---
---@param bufnr integer|nil: Buffer handle, defaults to current
----@return table `TextDocumentIdentifier`
+---@return lsp.TextDocumentIdentifier
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
function M.make_text_document_params(bufnr)
return { uri = vim.uri_from_bufnr(bufnr or 0) }
end
--- Create the workspace params
----@param added table
----@param removed table
+---@param added lsp.WorkspaceFolder[]
+---@param removed lsp.WorkspaceFolder[]
+---@return lsp.WorkspaceFoldersChangeEvent
function M.make_workspace_params(added, removed)
return { event = { added = added, removed = removed } }
end
@@ -2049,8 +2069,8 @@ end
--- Returns indentation size.
---
---@see 'shiftwidth'
----@param bufnr (integer|nil): Buffer handle, defaults to current
----@return (integer) indentation size
+---@param bufnr integer|nil: Buffer handle, defaults to current
+---@return integer indentation size
function M.get_effective_tabstop(bufnr)
validate({ bufnr = { bufnr, 'n', true } })
local bo = bufnr and vim.bo[bufnr] or vim.bo
@@ -2060,7 +2080,7 @@ end
--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position.
---
----@param options table|nil with valid `FormattingOptions` entries
+---@param options lsp.FormattingOptions|nil with valid `FormattingOptions` entries
---@return lsp.DocumentFormattingParams object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
function M.make_formatting_params(options)
@@ -2199,16 +2219,9 @@ function M._refresh(method, opts)
end
end
----@nodoc
----@deprecated
----@type table<integer,integer>
-M.buf_versions = setmetatable({}, {
- __index = function(_, bufnr)
- vim.deprecate('vim.lsp.util.buf_versions', 'vim.b.changedtick', '0.13')
- return vim.b[bufnr].changedtick
- end,
-})
-
M._get_line_byte_from_position = get_line_byte_from_position
+---@nodoc
+M.buf_versions = {} ---@type table<integer,integer>
+
return M
diff --git a/runtime/lua/vim/provider/health.lua b/runtime/lua/vim/provider/health.lua
index fa2c452268..860f839f23 100644
--- a/runtime/lua/vim/provider/health.lua
+++ b/runtime/lua/vim/provider/health.lua
@@ -353,7 +353,7 @@ end
--- their respective paths. If either of those is invalid, return two empty
--- strings, effectively ignoring pyenv.
---
---- @return {[1]: string, [2]: string}
+--- @return [string, string]
local function check_for_pyenv()
local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 0ec79e1dc7..7fd29d5f7b 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -789,7 +789,7 @@ do
}
--- @nodoc
- --- @class vim.validate.Spec {[1]: any, [2]: string|string[], [3]: boolean }
+ --- @class vim.validate.Spec [any, string|string[], boolean]
--- @field [1] any Argument value
--- @field [2] string|string[]|fun(v:any):boolean, string? Type name, or callable
--- @field [3]? boolean
@@ -1139,4 +1139,82 @@ function vim._defer_require(root, mod)
})
end
+--- @nodoc
+--- @class vim.context.mods
+--- @field buf? integer
+--- @field emsg_silent? boolean
+--- @field hide? boolean
+--- @field horizontal? boolean
+--- @field keepalt? boolean
+--- @field keepjumps? boolean
+--- @field keepmarks? boolean
+--- @field keeppatterns? boolean
+--- @field lockmarks? boolean
+--- @field noautocmd? boolean
+--- @field options? table<string, any>
+--- @field sandbox? boolean
+--- @field silent? boolean
+--- @field unsilent? boolean
+--- @field win? integer
+
+--- Executes function `f` with the given context specification.
+---
+--- @param context vim.context.mods
+function vim._with(context, f)
+ vim.validate('context', context, 'table')
+ vim.validate('f', f, 'function')
+
+ vim.validate('context.buf', context.buf, 'number', true)
+ vim.validate('context.emsg_silent', context.emsg_silent, 'boolean', true)
+ vim.validate('context.hide', context.hide, 'boolean', true)
+ vim.validate('context.horizontal', context.horizontal, 'boolean', true)
+ vim.validate('context.keepalt', context.keepalt, 'boolean', true)
+ vim.validate('context.keepjumps', context.keepjumps, 'boolean', true)
+ vim.validate('context.keepmarks', context.keepmarks, 'boolean', true)
+ vim.validate('context.keeppatterns', context.keeppatterns, 'boolean', true)
+ vim.validate('context.lockmarks', context.lockmarks, 'boolean', true)
+ vim.validate('context.noautocmd', context.noautocmd, 'boolean', true)
+ vim.validate('context.options', context.options, 'table', true)
+ vim.validate('context.sandbox', context.sandbox, 'boolean', true)
+ vim.validate('context.silent', context.silent, 'boolean', true)
+ vim.validate('context.unsilent', context.unsilent, 'boolean', true)
+ vim.validate('context.win', context.win, 'number', true)
+
+ -- Check buffer exists
+ if context.buf then
+ if not vim.api.nvim_buf_is_valid(context.buf) then
+ error('Invalid buffer id: ' .. context.buf)
+ end
+ end
+
+ -- Check window exists
+ if context.win then
+ if not vim.api.nvim_win_is_valid(context.win) then
+ error('Invalid window id: ' .. context.win)
+ end
+ end
+
+ -- Store original options
+ local previous_options ---@type table<string, any>
+ if context.options then
+ previous_options = {}
+ for k, v in pairs(context.options) do
+ previous_options[k] =
+ vim.api.nvim_get_option_value(k, { win = context.win, buf = context.buf })
+ vim.api.nvim_set_option_value(k, v, { win = context.win, buf = context.buf })
+ end
+ end
+
+ local retval = { vim._with_c(context, f) }
+
+ -- Restore original options
+ if previous_options then
+ for k, v in pairs(previous_options) do
+ vim.api.nvim_set_option_value(k, v, { win = context.win, buf = context.buf })
+ end
+ end
+
+ return unpack(retval)
+end
+
return vim
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index db544c1ab1..e36aacfd94 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -335,7 +335,7 @@ end
---
--- 0-indexed (row, col) tuple. Defaults to cursor position in the
--- current window. Required if {bufnr} is not the current buffer
---- @field pos { [1]: integer, [2]: integer }?
+--- @field pos [integer, integer]?
---
--- Parser language. (default: from buffer filetype)
--- @field lang string?
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
index eecf1ad6b1..04a3c62cf1 100644
--- a/runtime/lua/vim/treesitter/_fold.lua
+++ b/runtime/lua/vim/treesitter/_fold.lua
@@ -383,7 +383,6 @@ local function on_bytes(bufnr, foldinfo, start_row, start_col, old_row, old_col,
end
end
----@package
---@param lnum integer|nil
---@return string
function M.foldexpr(lnum)
diff --git a/runtime/lua/vim/treesitter/_meta.lua b/runtime/lua/vim/treesitter/_meta.lua
index 177699a207..2aedf5754e 100644
--- a/runtime/lua/vim/treesitter/_meta.lua
+++ b/runtime/lua/vim/treesitter/_meta.lua
@@ -33,6 +33,7 @@ error('Cannot require a meta file')
---@field iter_children fun(self: TSNode): fun(): TSNode, string
---@field field fun(self: TSNode, name: string): TSNode[]
---@field byte_length fun(self: TSNode): integer
+---@field __has_ancestor fun(self: TSNode, node_types: string[]): boolean
local TSNode = {}
---@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string)
@@ -62,6 +63,7 @@ local TSNode = {}
---@field patterns table<integer, (integer|string)[][]>
--- @param lang string
+--- @return table
vim._ts_inspect_language = function(lang) end
---@return integer
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index ca8cf85eda..56608bbf14 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -174,7 +174,7 @@ end
--- @param source_buf integer
--- @param inspect_buf integer
--- @param inspect_win integer
---- @param pos? { [1]: integer, [2]: integer }
+--- @param pos? [integer, integer]
local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, inspect_win, pos)
api.nvim_buf_clear_namespace(inspect_buf, treeview.ns, 0, -1)
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index d2f986b874..003f7e0169 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -47,7 +47,7 @@ function TSHighlighterQuery:get_hl_from_capture(capture)
return self.hl_cache[capture]
end
----@package
+---@nodoc
function TSHighlighterQuery:query()
return self._query
end
@@ -75,7 +75,7 @@ local TSHighlighter = {
TSHighlighter.__index = TSHighlighter
----@package
+---@nodoc
---
--- Creates a highlighter for `tree`.
---
@@ -232,7 +232,7 @@ function TSHighlighter:on_changedtree(changes)
end
--- Gets the query used for @param lang
----@package
+---@nodoc
---@param lang string Language used by the highlighter.
---@return vim.treesitter.highlighter.Query
function TSHighlighter:get_query(lang)
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index b0812123b9..3523ea95e0 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -98,9 +98,9 @@ local LanguageTree = {}
LanguageTree.__index = LanguageTree
---- @package
+--- @nodoc
---
---- |LanguageTree| contains a tree of parsers: the root treesitter parser for {lang} and any
+--- LanguageTree contains a tree of parsers: the root treesitter parser for {lang} and any
--- "injected" language parsers, which themselves may inject other languages, recursively.
---
---@param source (integer|string) Buffer or text string to parse
@@ -951,7 +951,7 @@ function LanguageTree:_edit(
end
end
----@package
+---@nodoc
---@param bufnr integer
---@param changed_tick integer
---@param start_row integer
@@ -1023,12 +1023,12 @@ function LanguageTree:_on_bytes(
)
end
----@package
+---@nodoc
function LanguageTree:_on_reload()
self:invalidate(true)
end
----@package
+---@nodoc
function LanguageTree:_on_detach(...)
self:invalidate(true)
self:_do_callback('detach', ...)
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index 99b9b78e2a..f168da4955 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -179,7 +179,13 @@ function M._get_url()
current_node = current_node:parent()
end
end
- return vim.fn.expand('<cfile>')
+
+ local old_isfname = vim.o.isfname
+ vim.cmd [[set isfname+=@-@]]
+ local url = vim.fn.expand('<cfile>')
+ vim.o.isfname = old_isfname
+
+ return url
end
return M
diff --git a/runtime/lua/vim/vimhelp.lua b/runtime/lua/vim/vimhelp.lua
index 4af6866d48..33324602c9 100644
--- a/runtime/lua/vim/vimhelp.lua
+++ b/runtime/lua/vim/vimhelp.lua
@@ -30,4 +30,42 @@ function M.highlight_groups(patterns)
vim.fn.setpos('.', save_cursor)
end
+--- Show a table of contents for the help buffer in a loclist
+function M.show_toc()
+ local bufnr = vim.api.nvim_get_current_buf()
+ local parser = vim.treesitter.get_parser(bufnr, 'vimdoc')
+ local query = vim.treesitter.query.parse(
+ parser:lang(),
+ [[
+ (h1 (heading) @h1)
+ (h2 (heading) @h2)
+ (h3 (heading) @h3)
+ (column_heading (heading) @h4)
+ ]]
+ )
+ local root = parser:parse()[1]:root()
+ local headings = {}
+ for id, node, _, _ in query:iter_captures(root, bufnr) do
+ local text = vim.treesitter.get_node_text(node, bufnr)
+ local capture = query.captures[id]
+ local row, col = node:start()
+ -- only column_headings at col 1 are headings, otherwise it's code examples
+ local is_code = (capture == 'h4' and col > 0)
+ -- ignore tabular material
+ local is_table = (capture == 'h4' and (text:find('\t') or text:find(' ')))
+ -- ignore tag-only headings
+ local is_tag = node:child_count() == 1 and node:child(0):type() == 'tag'
+ if not (is_code or is_table or is_tag) then
+ table.insert(headings, {
+ bufnr = bufnr,
+ lnum = row + 1,
+ text = (capture == 'h3' or capture == 'h4') and '  ' .. text or text,
+ })
+ end
+ end
+ vim.fn.setloclist(0, headings, ' ')
+ vim.fn.setloclist(0, {}, 'a', { title = 'Help TOC' })
+ vim.cmd.lopen()
+end
+
return M
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 5b5b33e4ad..3b874f4cda 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 31
+" Last Change: 2024 Jun 05
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -723,7 +723,7 @@ if has("insert_expand")
call append("$", "\t" .. s:local_to_buffer)
call <SID>OptionL("cpt")
call <SID>AddOption("completeopt", gettext("whether to use a popup menu for Insert mode completion"))
- call <SID>OptionG("cot", &cot)
+ call <SID>OptionL("cot")
call <SID>AddOption("pumheight", gettext("maximum height of the popup menu"))
call <SID>OptionG("ph", &ph)
call <SID>AddOption("pumwidth", gettext("minimum width of the popup menu"))
diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm
index 70a3a2f206..194c80362c 100644
--- a/runtime/queries/vimdoc/highlights.scm
+++ b/runtime/queries/vimdoc/highlights.scm
@@ -1,13 +1,19 @@
-(h1) @markup.heading.1
+(h1
+ (delimiter) @markup.heading.1
+ (heading) @markup.heading.1)
-(h2) @markup.heading.2
+(h2
+ (delimiter) @markup.heading.2
+ (heading) @markup.heading.2)
-(h3) @markup.heading.3
+(h3
+ (heading) @markup.heading.3)
-(column_heading) @markup.heading.4
+(column_heading
+ (heading) @markup.heading.4)
(column_heading
- "~" @markup.heading.4
+ (delimiter) @markup.heading.4
(#set! conceal ""))
(tag
diff --git a/runtime/syntax/deb822sources.vim b/runtime/syntax/deb822sources.vim
index f7d337fce9..ec45605905 100644
--- a/runtime/syntax/deb822sources.vim
+++ b/runtime/syntax/deb822sources.vim
@@ -40,7 +40,7 @@ syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorre
syn region deb822sourcesStrictField matchgroup=deb822sourcesEntryField start="^\%(Types\|URIs\|Suites\|Components\): *" end="$" contains=deb822sourcesType,deb822sourcesUri,deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites,deb822sourcesFreeComponent,deb822sourcesNonFreeComponent oneline
syn region deb822sourcesField matchgroup=deb822sourcesOptionField start="^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" end="$" oneline
syn region deb822sourcesField matchgroup=deb822sourcesMultiValueOptionField start="^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" end="$" oneline
-syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\): *" end="$" contains=deb822sourcesYesNo oneline
+syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\|Enabled\): *" end="$" contains=deb822sourcesYesNo oneline
syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline
hi def link deb822sourcesField Default
diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim
index 9867b147c2..f5910a8557 100644
--- a/runtime/syntax/java.vim
+++ b/runtime/syntax/java.vim
@@ -3,7 +3,7 @@
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://github.com/zzzyxwvut/java-vim.git
-" Last Change: 2024 May 10
+" Last Change: 2024 Jun 08
" Please check :help java.vim for comments on some of the options available.
@@ -215,7 +215,7 @@ syn keyword javaLabelVarType contained var
syn keyword javaLabelCastType contained char byte short int
" Allow for the contingency of the enclosing region not being able to
" _keep_ its _end_, e.g. case ':':.
-syn region javaLabelWhenClause contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal
+syn region javaLabelWhenClause contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal,javaLambdaDef
syn match javaLabelNumber contained "\<0\>[lL]\@!"
syn match javaLabelNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)\>[lL]\@!"
hi def link javaLabelDefault javaLabel
@@ -348,7 +348,6 @@ if exists("java_highlight_functions")
exec 'syn region javaFuncDef start=/' . s:ff.Engine('\%#=2', '') . '^\s\+\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\%(p\%(ublic\|rotected\|rivate\)\s\+\)\=\%(\%(abstract\|default\)\s\+\|\%(\%(final\|\%(native\|strictfp\)\|s\%(tatic\|ynchronized\)\)\s\+\)*\)\=\%(<.*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\s\+\)\=\%(void\|\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\)\%(\[\]\)*\)\s\+\<' . s:ff.LowerCase('[$_[:lower:]]', '[^A-Z0-9]') . '\k*\>\s*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=@javaFuncParams'
endif
- exec 'syn match javaLambdaDef "\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*->"'
syn match javaBraces "[{}]"
endif
@@ -421,9 +420,26 @@ syn match javaParenError "\]"
hi def link javaParenError javaError
+" Lambda expressions (JLS-17, §15.27).
if exists("java_highlight_functions")
" Make ()-matching definitions after the parenthesis error catcher.
- exec 'syn match javaLambdaDef "\k\@' . s:ff.Peek('4', '') . '<!(\%(\k\|[[:space:]<>?\[\]@,.]\)*)\s*->"'
+ "
+ " Match: ([@A [@B ...] final] var a[, var b, ...]) ->
+ " | ([@A [@B ...] final] T[<α>][[][]] a[, T b, ...]) ->
+ " There is no recognition of expressions interspersed with comments
+ " or of expressions whose parameterised parameter types are written
+ " across multiple lines.
+ exec 'syn match javaLambdaDef "\k\@' . s:ff.Peek('4', '') . '<!([[:space:]\n]*\%(\%(@\%(\K\k*\.\)*\K\k*\>\%((\_.\{-1,})\)\{-,1}[[:space:]\n]\+\)*\%(final[[:space:]\n]\+\)\=\%(\<\K\k*\>\.\)*\<\K\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\%(\%(\%(\[\]\)\+\|\.\.\.\)\)\=[[:space:]\n]\+\<\K\k*\>\%(\[\]\)*\%(,[[:space:]\n]*\)\=\)\+)[[:space:]\n]*->" contains=javaAnnotation,javaParamModifier,javaLambdaVarType,javaType,@javaClasses,javaVarArg'
+ " Match: () ->
+ " | (a[, b, ...]) ->
+ exec 'syn match javaLambdaDef "\k\@' . s:ff.Peek('4', '') . '<!([[:space:]\n]*\%(\<\K\k*\>\%(,[[:space:]\n]*\)\=\)*)[[:space:]\n]*->"'
+ " Match: a ->
+ exec 'syn match javaLambdaDef "\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<![[:space:]\n]*->"'
+
+ syn keyword javaParamModifier contained final
+ hi def link javaParamModifier javaConceptKind
+ syn keyword javaLambdaVarType contained var
+ hi def link javaLambdaVarType javaOperator
endif
" The @javaTop cluster comprises non-contained Java syntax groups.
diff --git a/runtime/syntax/kdl.vim b/runtime/syntax/kdl.vim
new file mode 100644
index 0000000000..a36bb9e927
--- /dev/null
+++ b/runtime/syntax/kdl.vim
@@ -0,0 +1,45 @@
+" Vim syntax file
+" Language: KDL
+" Maintainer: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Latest Revision: 2024-06-10
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match kdlNode '\v(\w|-|\=)' display
+syn match kdlBool '\v(true|false)' display
+
+syn keyword kdlTodo contained TODO FIXME XXX NOTE
+syn match kdlComment "//.*$" contains=kdlTodo
+
+" Regular int like number with - + or nothing in front
+syn match kdlNumber '\d\+'
+syn match kdlNumber '[-+]\d\+'
+
+" Floating point number with decimal no E or e (+,-)
+syn match kdlNumber '\d\+\.\d*' contained display
+syn match kdlNumber '[-+]\d\+\.\d*' contained display
+
+" Floating point like number with E and no decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+
+" Floating point like number with E and decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+
+syn region kdlString start='"' end='"' skip='\\\\\|\\"' display
+
+syn region kdlChildren start="{" end="}" contains=kdlString,kdlNumber,kdlNode,kdlBool,kdlComment
+
+hi def link kdlTodo Todo
+hi def link kdlComment Comment
+hi def link kdlNode Statement
+hi def link kdlBool Boolean
+hi def link kdlString String
+hi def link kdlNumber Number
+
+let b:current_syntax = "kdl"
diff --git a/runtime/syntax/lc.vim b/runtime/syntax/lc.vim
index a334529385..1991c1b582 100644
--- a/runtime/syntax/lc.vim
+++ b/runtime/syntax/lc.vim
@@ -2,6 +2,7 @@
" Language: Elsa
" Maintainer: Miles Glapa-Grossklag <miles@glapa-grossklag.com>
" Last Change: 2023-01-29
+" 2024 May 25 by Riley Bruins <ribru17@gmail.com> (move 'commentstring' to ftplugin)
if exists('b:current_syntax')
finish
@@ -13,7 +14,6 @@ syntax match elsaKeyword "\v:"
highlight link elsaKeyword Keyword
" Comments
-setlocal commentstring=--%s
syntax match elsaComment "\v--.*$"
highlight link elsaComment Comment
diff --git a/runtime/syntax/mma.vim b/runtime/syntax/mma.vim
index d2f22e9be5..802cbe5538 100644
--- a/runtime/syntax/mma.vim
+++ b/runtime/syntax/mma.vim
@@ -2,6 +2,7 @@
" Language: Mathematica
" Maintainer: steve layland <layland@wolfram.com>
" Last Change: 2012 Feb 03 by Thilo Six
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> (remove 'commentstring')
" Source: http://members.wri.com/layland/vim/syntax/mma.vim
" http://vim.sourceforge.net/scripts/script.php?script_id=1273
" Id: $Id: mma.vim,v 1.4 2006/04/14 20:40:38 vimboss Exp $
@@ -248,7 +249,6 @@ syntax match mmaBoring "[(){}]" contained
"syntax region mmaRegion start="(\*\+[^<]*<!--[^>]*\*\+)" end="--> \*)" containedin=ALLBUT,@mmaStrings transparent fold keepend
" show fold text
-set commentstring='(*%s*)'
"set foldtext=MmaFoldText()
"function MmaFoldText()
diff --git a/runtime/syntax/rasi.vim b/runtime/syntax/rasi.vim
new file mode 100644
index 0000000000..40c3393fc5
--- /dev/null
+++ b/runtime/syntax/rasi.vim
@@ -0,0 +1,298 @@
+" Vim syntax file
+" Language: rasi (Rofi Advanced Style Information)
+" Maintainer: Pierrick Guillaume <pierguill@gmail.com>
+" Last Change: 2024 May 21
+"
+" Syntax support for rasi config file
+
+" This file is based on syntax defined in rofi-theme man page
+" https://man.archlinux.org/man/community/rofi/rofi-theme.5.en
+
+if exists('b:current_syntax')
+ finish
+endif
+let b:current_syntax = 'rasi'
+
+" String {{{
+syn region rasiString start=+"+ skip=+\\"+ end=+"+ oneline contained
+syn match rasiCharacter +L\='[^\\]'+ contained
+
+syn cluster rasiPropertyVals add=rasiString,rasiCharacter
+" }}}
+
+" Integer/Real {{{
+syn match rasiNumber display contained '[+-]\?\d\+\(\.\d\+\)\?'
+
+syn cluster rasiPropertyVals add=rasiNumber
+" }}}
+
+" Boolean {{{
+syn keyword rasiBool contained true false
+
+syn cluster rasiPropertyVals add=rasiBool
+" }}}
+
+" Image {{{
+syn match rasiInvImage display contained 'url([^)]*)'
+syn keyword rasiImageK contained url linear-gradient
+
+syn match rasiImage display contained transparent 'url(\s*"\([^"]\|\\"\)\+"\(\s*,\s*\(none\|both\|width\|height\)\)\?\s*)' contains=rasiImageScale,rasiString,rasiImageK
+syn keyword rasiImageScale contained none both width height
+
+syn match rasiImage display contained transparent 'linear-gradient(\s*\(\(top\|left\|right\|bottom\)\s*,\s*\)\?[^,)]\+\s*\(,\s*[^,)]\+\s*\)\+)' contains=rasiImageDirection,@rasiColors,rasiImageK
+syn keyword rasiImageDirection contained top left right bottom
+
+syn match rasiImage display contained transparent 'linear-gradient(\s*\d\+\(rad\|grad\|deg\)\s*,\s*[^,)]\+\s*\(,\s*[^,)]\+\s*\)\+)' contains=rasiImageUnit,@rasiColor,@rasiInvColor,rasiNumber,rasiImageK
+syn match rasiImageUnit display contained '\(rad\|grad\|deg\)\>'
+
+syn cluster rasiPropertyVals add=rasiInvImage,rasiImage
+" }}}
+
+" Reference {{{
+syn match rasiReference display contained '@[a-zA-Z0-9-]\+'
+
+syn keyword rasiVarReferenceK contained var
+
+syn match rasiInvVarReference display contained 'var([^)]*)'
+syn match rasiVarReference display contained transparent 'var(\s*[a-zA-Z0-9-]\+\s*,\s*\(\a\+\s*([^)]*)\)\?[^),]*)' contains=rasiVarReferenceK,rasiPropertyIdRef,@rasiPropertyVals
+syn match rasiPropertyIdRef display contained '\a[a-zA-Z0-9-]*'
+
+syn cluster rasiPropertyVals add=rasiReference,rasiInvVarReference,rasiVarReference
+" }}}
+
+" Env variable {{{
+syn match rasiInvEnv display contained '${[^}]*}'
+syn match rasiEnv display contained '${\w\+}'hs=s+2,he=e-1
+
+syn keyword rasiEnvVarK contained env
+
+syn match rasiInvEnvVar display contained 'env([^)]*)'
+syn match rasiEnvVar display contained transparent 'env(\s*\w\+\s*,\s*\(\a\+([^)]*)\)\?[^),]*)' contains=rasiEnvVarK,rasiEnvRef,@rasiPropertyVals
+syn match rasiEnvRef display contained '\a\w*'
+
+syn cluster rasiPropertyVals add=rasiEnv,rasiInvEnv,rasiInvEnvVar,rasiEnvVar
+" }}}
+
+" Color {{{
+syn keyword rasiColorK contained rgb[a] hsl[a] hwb[a] cmyk
+
+syn match rasiHexColor display contained '#\x\{3,4}'
+syn match rasiHexColor display contained '#\x\{6}'
+syn match rasiHexColor display contained '#\x\{8}'
+syn match rasiInvHexColor display contained '#\x\{5}\X'he=e-1,me=e-1
+syn match rasiInvHexColor display contained '#\x\{7}\X'he=e-1,me=e-1
+
+syn match rasiInvRGBColor display contained 'rgb\(a\)\?([^)]*)'
+syn match rasiRGBColor display contained transparent 'rgb\(a\)\?(\s*\d\+\s*\(%\)\?\s*,\(\s*\d\+\s*\(%\)\?\s*\){2}\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\?)' contains=rasiColorK,rasiNumber,rasiDistance
+
+syn match rasiInvHSLColor display contained 'h\(sl\|wb\)\(a\)\?([^)]*)'
+syn match rasiHSLColor display contained transparent 'h\(sl\|wb\)\(a\)\?(\s*\d\+\(\.\d*\)\?\(deg\|rad\|grad\|turn\)\?\s*\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\{2,3})' contains=rasiColorK,rasiNumber,rasiDistance
+
+
+"this matches doesn't works properly (too long ?)
+syn match rasiInvCMYKColor display contained 'cmyk([^)]*)'
+syn match rasiCMYKColor display contained transparent 'cmyk(\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\{3,4})' contains=rasiColorK,rasiNumber,rasiDistance
+
+syn case ignore
+syn keyword rasiNamedColor contained
+ \ AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue
+ \ BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk
+ \ Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray DarkGrey DarkGreen DarkKhaki DarkMagenta
+ \ DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen Dark SlateBlue
+ \ DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DimGrey
+ \ DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod
+ \ Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender
+ \ LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow
+ \ LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray
+ \ LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine
+ \ MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen
+ \ MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy
+ \ OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise
+ \ PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple RebeccaPurple Red
+ \ RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue
+ \ SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise
+ \ Violet Wheat White WhiteSmoke Yellow YellowGreen transparent[] "uses `[]` to escape keyword
+
+syn cluster rasiColors add=rasiHexColor,rasiRGBColor,rasiHSLColor,rasiCMYKColor,rasiNamedColor
+syn cluster rasiColors add=rasiInvHexColor,rasiInvRGBColor,rasiInvHSLColor,rasiInvCMYKColor
+
+syn cluster rasiPropertyVals add=@rasiColors
+" }}}
+
+" Text-Style {{{
+syn keyword rasiTextStyle contained bold italic underline strikethrough none
+
+syn cluster rasiPropertyVals add=rasiTextStyle
+" }}}
+
+" Line-Style {{{
+syn keyword rasiLineStyle contained dash solid
+
+syn cluster rasiPropertyVals add=rasiLineStyle
+" }}}
+
+" Distance {{{
+syn match rasiDistanceUnit display contained '\(px\|em\|ch\|%\|mm\)'
+
+syn match rasiInvDistance display contained '[+-]\?\d\+\.\d\+\(px\|mm\)'
+syn match rasiDistance display contained transparent '[-+]\?\d\+\(px\|mm\)' contains=rasiDistanceUnit,rasiNumber
+syn match rasiDistance display contained transparent '[+-]\?\d\+\(\.\d\+\)\?\(em\|ch\|%\)' contains=rasiDistanceUnit,rasiNumber
+
+syn keyword rasiDistanceCalc contained calc nextgroup=rasiDistanceCalcBody
+syn region rasiDistanceCalcBody display contained start=+(+ end=+)+ contains=rasiDistanceCalcOp,rasiDistance,rasiInvDistance
+syn match rasiDistanceCalcOp display contained '\(+\|-\|/\|\*\|%\|min\|max\)'
+
+syn cluster rasiPropertyVals add=rasiInvDistance,rasiDistance,rasiDistanceCalc
+" }}}
+
+" Position {{{
+syn keyword rasiPosition contained center east north west south
+
+syn cluster rasiPropertyVals add=rasiPosition
+" }}}
+
+" Orientation {{{
+syn keyword rasiOrientation contained horizontal vertical
+
+syn cluster rasiPropertyVals add=rasiOrientation
+" }}}
+
+" Cursor {{{
+syn keyword rasiCursor contained default pointer text
+
+syn cluster rasiPropertyVals add=rasiCursor
+" }}}
+
+" Keyword List {{{
+syn region rasiKeywordList contained start=+\[+ end=+\]+ contains=rasiPropertyIdRef
+
+syn cluster rasiPropertyVals add=rasiKeywordList
+" }}}
+
+" Inherit {{{
+syn keyword rasiInherit contained inherit children
+
+syn cluster rasiPropertyVals add=rasiInherit
+" }}}
+
+syn match rasiGlobalImport display '^\s*@\(import\|theme\)' nextgroup=rasiString skipwhite
+
+" Section {{{
+" syn region rasiSection transparent start='^[^{]\+{'me=e-1 end='}' contains=rasiSectionOpenning,rasiSectionContent
+syn match rasiSectionOpenning transparent '^[^{]\+{'me=e-1 contains=rasiGlobalSection,rasiWidgetName,rasiGlobalMedia nextgroup=rasiThemeSectionContent
+" syn match rasiThemeInnerSectionOpenning transparent '^[^:${]\+{'me=e-1 contains=rasiWidgetName nextgroup=rasiThemeInnerSectionContent contained
+
+syn match rasiGlobalMedia display contained '^\s*@media' nextgroup=rasiInvMediaBody,rasiMediaBody skipwhite
+syn match rasiInvMediaBody display contained '([^)]*)'
+syn match rasiMediaBody display contained '(\s*[a-z-]\+\s*:\s*\d\+\(px\|mm\)\?\s*)' contains=rasiMediaK,rasiNumber,rasiDistance
+syn keyword rasiMediaK contained min-width max-width min-height max-height min-aspect-ratio max-aspect-ratio monitor-id
+
+syn match rasiGlobalSection display contained '^*'
+syn match rasiWidgetName display contained '[a-zA-Z0-9-]\+' nextgroup=rasiVisibleMod skipwhite
+
+syn keyword rasiVisibleMod contained normal selected alternate nextgroup=rasiVisibleMod,rasiStateWrapper skipwhite
+syn match rasiStateWrapper display contained transparent '\.\(normal\|active\|urgent\)' contains=rasiState
+syn keyword rasiState contained normal active urgent
+
+
+syn region rasiThemeSectionContent transparent start="{" end="}" contains=rasiProperty,rasiComment,rasiCommentL,rasiSectionOpenning contained
+" syn region rasiThemeInnerSectionContent transparent start="{" end="}" contains=rasiProperty,rasiComment,rasiCommentL,rasiThemeInnerSectionOpenning contained
+
+syn match rasiProperty transparent '^\s*\S\+\s*:.*;\s*$' keepend contained contains=rasiPropertyId,rasiInvPropertyId,rasiPropertyVal,rasiComment,rasiCommentL
+syn match rasiInvPropertyId '^\([^:]\&[^/]\{2}\)*:'me=e-1 contained
+syn match rasiPropertyId '^\s*[0-9a-zA-Z-]\+\s*:'me=e-1 contained
+syn match rasiInvPropertyVal ':[^;];\s*\S\+\s*$'ms=s+1,hs=s+1
+syn match rasiPropertyVal ':\s*[^;]\+;\s*$'ms=s+1,hs=s+1 contained contains=@rasiPropertyVals
+" }}}
+
+" Comment {{{
+syn cluster rasiCommentGroup contains=rasiTodo,rasiBadContinuation
+
+syn region rasiCommentL start="//" skip="\\$" end="$" keepend contains=@rasiCommentGroup,@Spell
+syn region rasiComment start="/\*" end="\*/" contains=@rasiCommentGroup,rasiCommentStartError,@Spell fold extend
+
+syn match rasiCommentError display '\*/'
+
+syn keyword rasiTodo contained TODO FIXME XXX NOTE
+
+if exists("rasi_minlines")
+ let b:rasi_minlines = rasi_minlines
+else
+ let b:rasi_minlines = 50
+endif
+exec "syn sync ccomment rasiComment minlines=" . b:rasi_minlines
+" }}}
+
+
+
+" Highlighting: {{{
+hi def link rasiError Error
+
+hi def link rasiTodo Todo
+hi def link rasiComment Comment
+hi def link rasiCommentStart rasiComment
+hi def link rasiCommentL rasiComment
+hi def link rasiCommentError rasiError
+
+hi def link rasiString String
+hi def link rasiNumber Number
+hi def link rasiBool Boolean
+
+hi def link rasiImageK Function
+hi def link rasiImageScale Keyword
+hi def link rasiImageDirection Keyword
+hi def link rasiImageUnit Type
+hi def link rasiInvImage rasiError
+
+hi def link rasiHexColor Number
+hi def link rasiColorK Function
+hi def link rasiNamedColor Number
+hi def link rasiInvColor rasiError
+hi def link rasiInvHexColor rasiInvColor
+hi def link rasiInvRGBColor rasiInvColor
+hi def link rasiInvHSLColor rasiInvColor
+hi def link rasiInvCMYKColor rasiInvColor
+
+hi def link rasiTextStyle Keyword
+hi def link rasiLineStyle Keyword
+
+hi def link rasiDistanceUnit Type
+hi def link rasiDistanceCalc Function
+hi def link rasiDistanceCalcOp Operator
+hi def link rasiInvDistance rasiError
+
+hi def link rasiPosition Keyword
+hi def link rasiOrientation Keyword
+hi def link rasiCursor Keyword
+
+hi def link rasiReference Identifier
+hi def link rasiPropertyIdRef Identifier
+hi def link rasiVarReferenceK Function
+hi def link rasiInvVarReference rasiError
+
+hi def link rasiEnv Identifier
+hi def link rasiEnvRef Identifier
+hi def link rasiEnvVarK Function
+hi def link rasiInvEnv rasiError
+hi def link rasiInvEnvVar rasiError
+
+hi def link rasiWidgetName StorageClass
+hi def link rasiGlobalSection StorageClass
+hi def link rasiVisibleMod Type
+hi def link rasiState Tag
+
+hi def link rasiInherit Identifier
+
+hi def link rasiGlobalImport Include
+
+hi def link rasiGlobalMedia Preproc
+hi def link rasiMediaK Keyword
+hi def link rasiInvMediaBody rasiError
+
+hi def link rasiPropertyId Identifier
+hi def link rasiInvProperty rasiError
+hi def link rasiInvPropertyId rasiError
+hi def link rasiInvPropertyVal rasiError
+" }}}
+
+" vim:ts=8
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 22c1e16a30..d16d62dc4a 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -359,7 +359,9 @@ syn region vimUserCmdBlock contained matchgroup=vimSep start="{" end="}" contain
" Lower Priority Comments: after some vim commands... {{{2
" =======================
-syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"'
+if get(g:, "vimsyn_comment_strings", 1)
+ syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"'
+endif
if s:vim9script
syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained
@@ -428,12 +430,10 @@ syn match vimStringInterpolationBrace contained "}}"
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
syn cluster vimSubstList add=vimCollection
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required
" : # is allowed but "not recommended" (see :h pattern-delimiter)
syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
@@ -446,6 +446,10 @@ syn match vimSubstTwoBS contained "\\\\"
syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
+" Vi compatibility
+syn match vimSubstDelim contained "\\"
+syn match vimSubstPat contained "\\\ze[/?&]" contains=vimSubstDelim nextgroup=vimSubstRep4
+
" 'String': {{{2
syn match vimString "[^(,]'[^']\{-}\zs'"
@@ -804,16 +808,17 @@ syn match vimCtrlChar "[- -]"
" Beginners - Patterns that involve ^ {{{2
" =========
if s:vim9script
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle
+ syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle
+ syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained
else
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained
+ syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle
+ syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained
endif
syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
+
syn match vimContinue "^\s*\zs\\"
-syn match vimContinueComment '^\s*\zs["#]\\ .*' contained
+syn match vimContinueComment '^\s*\zs["#]\\ .*'
syn cluster vimContinue contains=vimContinue,vimContinueComment
syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue
syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
index 622eb7cc06..e6b81d63b9 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -888,7 +888,7 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
Neovim has a comprehensive online help system.
-To get started, try one of these three:
+To get started, try one of these two:
- press the `<F1>`{normal} key (if you have one)
- type `:help`{vim}