From 8594b0858fd2d8e629b58ce323d77fdb891547d9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Nov 2023 23:35:40 +0100 Subject: vim-patch:a9058440b7b9 runtime(html): Update syntax file (vim/vim#13591) Add missing search element and update ARIA attribute list. Add a very basic test file to check all elements are matched. https://github.com/vim/vim/commit/a9058440b7b9d7f5d0027c8cd44366e9200ca241 Co-authored-by: dkearns --- runtime/syntax/html.vim | 90 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 19 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim index 82c829a2e1..c975ae8620 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -3,9 +3,9 @@ " Maintainer: Doug Kearns " Previous Maintainers: Jorge Maldonado Ventura " Claudio Fleiner -" Last Change: 2023 Feb 20 +" Last Change: 2023 Nov 28 -" Please check :help html.vim for some comments and a description of the options +" See :help html.vim for some comments and a description of the options " quit when a syntax file was already loaded if !exists("main_syntax") @@ -28,7 +28,6 @@ syn case ignore " mark illegal characters syn match htmlError "[<>&]" - " tags syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc @@ -39,7 +38,6 @@ syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName, syn match htmlTagN contained +]<"ms=s+1 - " tag names syn keyword htmlTagName contained address applet area a base basefont syn keyword htmlTagName contained big blockquote br caption center @@ -61,7 +59,7 @@ syn keyword htmlTagName contained article aside audio bdi canvas data syn keyword htmlTagName contained datalist details dialog embed figcaption syn keyword htmlTagName contained figure footer header hgroup keygen main syn keyword htmlTagName contained mark menuitem meter nav output picture -syn keyword htmlTagName contained progress rb rp rt rtc ruby section +syn keyword htmlTagName contained progress rb rp rt rtc ruby search section syn keyword htmlTagName contained slot source summary template time track syn keyword htmlTagName contained video wbr @@ -88,19 +86,72 @@ syn keyword htmlArg contained size src start target text type url syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 -" aria attributes -exe 'syn match htmlArg contained "\"' syn keyword htmlArg contained role +" ARIA attributes {{{1 +let s:aria =<< trim END + activedescendant + atomic + autocomplete + braillelabel + brailleroledescription + busy + checked + colcount + colindex + colindextext + colspan + controls + current + describedby + description + details + disabled + errormessage + expanded + flowto + haspopup + hidden + invalid + keyshortcuts + label + labelledby + level + live + modal + multiline + multiselectable + orientation + owns + placeholder + posinset + pressed + readonly + relevant + required + roledescription + rowcount + rowindex + rowindextext + rowspan + selected + setsize + sort + valuemax + valuemin + valuenow + valuetext +END +let s:aria_deprecated =<< trim END + dropeffect + grabbed +END + +call extend(s:aria, s:aria_deprecated) +exe 'syn match htmlArg contained "\%#=1\join('\|') .. '\)\>"' +unlet s:aria s:aria_deprecated +" }}} + " Netscape extensions syn keyword htmlTagName contained frame noframes frameset nobr blink syn keyword htmlTagName contained layer ilayer nolayer spacer @@ -321,9 +372,9 @@ if !exists("html_no_rendering") hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline hi def htmlItalic term=italic cterm=italic gui=italic if v:version > 800 || v:version == 800 && has("patch1038") - hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough + hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough else - hi def htmlStrike term=underline cterm=underline gui=underline + hi def htmlStrike term=underline cterm=underline gui=underline endif endif endif @@ -356,4 +407,5 @@ endif let &cpo = s:cpo_save unlet s:cpo_save -" vim: ts=8 + +" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -- cgit From 543e0256c19f397921a332e06b423215fd9aecb5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 15:51:05 +0800 Subject: build: don't define FUNC_ATTR_* as empty in headers (#26317) FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header. --- runtime/doc/dev_style.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index cb28f1a845..02fd07ce24 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -190,7 +190,7 @@ Function declarations ~ Every function must not have a separate declaration. -Function declarations are created by the gendeclarations.lua script. >c +Function declarations are created by the gen_declarations.lua script. >c static void f(void); -- cgit From 01b91deec7b6113ae728ac3f7a55f64f57ddb3e0 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 30 Nov 2023 07:04:20 -0600 Subject: fix(treesitter): fix parens stacking in inspector display (#26304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When first opened, the tree-sitter inspector traverses all of the nodes in the buffer to calculate an array of nodes. This traversal is done only once, and _all_ nodes (both named and anonymous) are included. Toggling anonymous nodes in the inspector only changes how the tree is drawn in the buffer, but does not affect the underlying data structure at all. When the buffer is traversed and the list of nodes is calculated, we don't know whether or not anonymous nodes will be displayed in the inspector or not. Thus, we cannot determine during traversal where to put closing parentheses. Instead, this must be done when drawing. When we draw, the tree structure has been flatted into a single array, so we lose parent-child relationships that would otherwise make determining the number of closing parentheses straightforward. However, we can instead rely on the fact that a delta between the depth of a node and the depth of the successive node _must_ mean that more closing parentheses are required: (foo (bar) (baz) ↑ │ └ (bar) and (baz) have different depths, so (bar) must have an extra closing parenthesis This does not depend on whether or not anonymous nodes are displayed and so works in both cases. --- runtime/lua/vim/treesitter/dev.lua | 103 ++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 53 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 69ddc9b558..aad639d85a 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -14,16 +14,12 @@ local M = {} local TSTreeView = {} ---@class TSP.Node ----@field id integer Node id ----@field text string Node text ----@field named boolean True if this is a named (non-anonymous) node ----@field depth integer Depth of the node within the tree ----@field lnum integer Beginning line number of this node in the source buffer ----@field col integer Beginning column number of this node in the source buffer ----@field end_lnum integer Final line number of this node in the source buffer ----@field end_col integer Final column number of this node in the source buffer +---@field node TSNode Tree-sitter node +---@field field string? Node field +---@field depth integer Depth of this node in the tree +---@field text string? Text displayed in the inspector for this node. Not computed until the +--- inspector is drawn. ---@field lang string Source language of this node ----@field root TSNode ---@class TSP.Injection ---@field lang string Source language of this injection @@ -54,37 +50,14 @@ local function traverse(node, depth, lang, injections, tree) end for child, field in node:iter_children() do - local type = child:type() - local lnum, col, end_lnum, end_col = child:range() - local named = child:named() - local text ---@type string - if named then - if field then - text = string.format('%s: (%s', field, type) - else - text = string.format('(%s', type) - end - else - text = string.format('"%s"', type:gsub('\n', '\\n'):gsub('"', '\\"')) - end - table.insert(tree, { - id = child:id(), - text = text, - named = named, + node = child, + field = field, depth = depth, - lnum = lnum, - col = col, - end_lnum = end_lnum, - end_col = end_col, lang = lang, }) traverse(child, depth + 1, lang, injections, tree) - - if named then - tree[#tree].text = string.format('%s)', tree[#tree].text) - end end return tree @@ -132,7 +105,7 @@ function TSTreeView:new(bufnr, lang) local named = {} ---@type TSP.Node[] for _, v in ipairs(nodes) do - if v.named then + if v.node:named() then named[#named + 1] = v end end @@ -213,7 +186,7 @@ local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, ins local cursor_node_id = cursor_node:id() for i, v in treeview:iter() do - if v.id == cursor_node_id then + if v.node:id() == cursor_node_id then local start = v.depth * treeview.opts.indent ---@type integer local end_col = start + #v.text api.nvim_buf_set_extmark(inspect_buf, treeview.ns, i - 1, start, { @@ -228,6 +201,8 @@ end --- Write the contents of this View into {bufnr}. --- +--- Calling this function computes the text that is displayed for each node. +--- ---@param bufnr integer Buffer number to write into. ---@package function TSTreeView:draw(bufnr) @@ -235,13 +210,35 @@ function TSTreeView:draw(bufnr) local lines = {} ---@type string[] local lang_hl_marks = {} ---@type table[] - for _, item in self:iter() do - local range_str = get_range_str(item.lnum, item.col, item.end_lnum, item.end_col) + for i, item in self:iter() do + local range_str = get_range_str(item.node:range()) local lang_str = self.opts.lang and string.format(' %s', item.lang) or '' + + local text ---@type string + if item.node:named() then + if item.field then + text = string.format('%s: (%s', item.field, item.node:type()) + else + text = string.format('(%s', item.node:type()) + end + else + text = string.format('"%s"', item.node:type():gsub('\n', '\\n'):gsub('"', '\\"')) + end + + local next = self:get(i + 1) + if not next or next.depth <= item.depth then + local parens = item.depth - (next and next.depth or 0) + (item.node:named() and 1 or 0) + if parens > 0 then + text = string.format('%s%s', text, string.rep(')', parens)) + end + end + + item.text = text + local line = string.format( '%s%s ; %s%s', string.rep(' ', item.depth * self.opts.indent), - item.text, + text, range_str, lang_str ) @@ -253,7 +250,7 @@ function TSTreeView:draw(bufnr) } end - lines[#lines + 1] = line + lines[i] = line end api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) @@ -364,9 +361,9 @@ function M.inspect_tree(opts) desc = 'Jump to the node under the cursor in the source buffer', callback = function() local row = api.nvim_win_get_cursor(w)[1] - local pos = treeview:get(row) + local lnum, col = treeview:get(row).node:start() api.nvim_set_current_win(win) - api.nvim_win_set_cursor(win, { pos.lnum + 1, pos.col }) + api.nvim_win_set_cursor(win, { lnum + 1, col }) end, }) api.nvim_buf_set_keymap(b, 'n', 'a', '', { @@ -374,7 +371,7 @@ function M.inspect_tree(opts) callback = function() local row, col = unpack(api.nvim_win_get_cursor(w)) ---@type integer, integer local curnode = treeview:get(row) - while curnode and not curnode.named do + while curnode and not curnode.node:named() do row = row - 1 curnode = treeview:get(row) end @@ -386,9 +383,9 @@ function M.inspect_tree(opts) return end - local id = curnode.id + local id = curnode.node:id() for i, node in treeview:iter() do - if node.id == id then + if node.node:id() == id then api.nvim_win_set_cursor(w, { i, col }) break end @@ -424,20 +421,20 @@ function M.inspect_tree(opts) api.nvim_buf_clear_namespace(buf, treeview.ns, 0, -1) local row = api.nvim_win_get_cursor(w)[1] - local pos = treeview:get(row) - api.nvim_buf_set_extmark(buf, treeview.ns, pos.lnum, pos.col, { - end_row = pos.end_lnum, - end_col = math.max(0, pos.end_col), + local lnum, col, end_lnum, end_col = treeview:get(row).node:range() + api.nvim_buf_set_extmark(buf, treeview.ns, lnum, col, { + end_row = end_lnum, + end_col = math.max(0, end_col), hl_group = 'Visual', }) local topline, botline = vim.fn.line('w0', win), vim.fn.line('w$', win) -- Move the cursor if highlighted range is completely out of view - if pos.lnum < topline and pos.end_lnum < topline then - api.nvim_win_set_cursor(win, { pos.end_lnum + 1, 0 }) - elseif pos.lnum > botline and pos.end_lnum > botline then - api.nvim_win_set_cursor(win, { pos.lnum + 1, 0 }) + if lnum < topline and end_lnum < topline then + api.nvim_win_set_cursor(win, { end_lnum + 1, 0 }) + elseif lnum > botline and end_lnum > botline then + api.nvim_win_set_cursor(win, { lnum + 1, 0 }) end end, }) -- cgit From f5573fba3d460ddf479826b7404e568cc825ed57 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Fri, 1 Dec 2023 01:37:42 +0900 Subject: fix: Remove nested for_each_tree in TSTreeView (#26328) Problem: `LanguageTree:for_each_tree` calls itself for child nodes, so when we calls `for_each_tree` inside `for_each_tree`, this quickly leads to exponential tree calls. Solution: Use `pairs(child:trees())` directly in this case, as we don't need the extra callback for each children, this is already handled from the outer `for_each_tree` call --- runtime/lua/vim/treesitter/dev.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index aad639d85a..870761b7c7 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -87,17 +87,17 @@ function TSTreeView:new(bufnr, lang) parser:for_each_tree(function(parent_tree, parent_ltree) local parent = parent_tree:root() for _, child in pairs(parent_ltree:children()) do - child:for_each_tree(function(tree, ltree) + for _, tree in pairs(child:trees()) do local r = tree:root() local node = assert(parent:named_descendant_for_range(r:range())) local id = node:id() if not injections[id] or r:byte_length() > injections[id].root:byte_length() then injections[id] = { - lang = ltree:lang(), + lang = child:lang(), root = r, } end - end) + end end end) -- cgit From 307d5bcc7940d14f7d17e7c2de795ebed7b0f00c Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Thu, 30 Nov 2023 19:00:33 +0200 Subject: vim-patch:9.0.2137: Can't detect angular & mustache filetypes Problem: Can't detect angular & mustache filetypes Solution: Detect *.mustache as Mustache filetype; detect *.component.html as html.angular filetype closes: vim/vim#13594 https://github.com/vim/vim/commit/7bed263c343c62129c5d8f51796895a28db1b312 --- runtime/lua/vim/filetype.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index c6200f16bb..2bbc545fc4 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -695,6 +695,7 @@ local extension = { msql = 'msql', mu = 'mupad', mush = 'mush', + mustache = 'mustache', mysql = 'mysql', n1ql = 'n1ql', nql = 'n1ql', @@ -1716,6 +1717,7 @@ local pattern = { ['.*/etc/host%.conf'] = 'hostconf', ['.*/etc/hosts%.deny'] = 'hostsaccess', ['.*/etc/hosts%.allow'] = 'hostsaccess', + ['.*%.component%.html'] = 'html.angular', ['.*%.html%.m4'] = 'htmlm4', ['.*/%.i3/config'] = 'i3config', ['.*/i3/config'] = 'i3config', -- cgit From b32b5b2711ed338f4944c983a247f80c3163f87c Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:17:38 -0600 Subject: fix: use BEL to terminate OSC 11 request (#26335) --- runtime/lua/vim/_defaults.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index cc872dea83..c3bb36fc36 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -297,7 +297,7 @@ do end, }) - io.stdout:write('\027]11;?\027\\') + io.stdout:write('\027]11;?\007') timer:start(1000, 0, function() -- No response received. Delete the autocommand -- cgit From fedbf32250ba303ee06c751e798c28c5a3f05862 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 2 Dec 2023 09:42:16 +0800 Subject: vim-patch:9.0.2139: html.angular ft is problematic (#26357) Problem: html.angular ft is problematic Solution: partly revert v9.0.2137 The html.angular filetype causes issues and does not trigger FileType autocommands for the html or angular filetypes. So let's roll back that particular change and detect this only as html file related: https://github.com/vim/vim/pull/13594#issuecomment-1834465890 closes: vim/vim#13604 https://github.com/vim/vim/commit/4f3480c94358e3b938594fc3574477e780525cd7 Co-authored-by: Christian Brabandt --- runtime/lua/vim/filetype.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 2bbc545fc4..60882d4432 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1717,7 +1717,6 @@ local pattern = { ['.*/etc/host%.conf'] = 'hostconf', ['.*/etc/hosts%.deny'] = 'hostsaccess', ['.*/etc/hosts%.allow'] = 'hostsaccess', - ['.*%.component%.html'] = 'html.angular', ['.*%.html%.m4'] = 'htmlm4', ['.*/%.i3/config'] = 'i3config', ['.*/i3/config'] = 'i3config', -- cgit From 64a14026d76ba1798d91e15a941fcb6af7cbc5ad Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Wed, 29 Nov 2023 22:16:09 +0200 Subject: feat(highlight): update default color scheme Problem: Default color scheme is suboptimal. Solution: Start using new color scheme. Introduce new `vim` color scheme for opt-in backward compatibility. ------ Main design ideas - Be "Neovim branded". - Be minimal for 256 colors with a bit more shades for true colors. - Be accessible through high enough contrast ratios. - Be suitable for dark and light backgrounds via exchange of dark and light palettes. ------ Palettes - Have dark and light variants. Implemented through exporeted `NvimDark*` and `NvimLight*` hex colors. - Palettes have 4 shades of grey for UI elements and 6 colors (red, yellow, green, cyan, blue, magenta). - Actual values are computed procedurally in Oklch color space based on a handful of hyperparameters. - Each color has a 256 colors variant with perceptually closest color. ------ Highlight groups Use: - Grey shades for general UI according to their design. - Bold text for keywords (`Statement` highlight group). This is an important choice to increase accessibility for people with color deficiencies, as it doesn't rely on actual color. - Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some minor text UI elements. - Cyan as main syntax color, i.e. for function usage (`Function` highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI elements. - Red to generally mean high user attention, i.e. errors; in particular for `ErrorMsg`, `DiffDelete`, `DiagnosticError`. - Yellow very sparingly only with true colors to mean mild user attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`. - Blue very sparingly only with true colors as `DiagnosticHint` and some additional important syntax group (like `Identifier`). - Magenta very carefully (if at all). ------ Notes - To make tests work without relatively larege updates, each one is prepended with an equivalent of the call `:colorscheme vim`. Plus some tests which spawn new Neovim instances also now use 'vim' color scheme. In some cases tests are updated to fit new default color scheme. --- runtime/colors/default.vim | 12 +- runtime/colors/vim.vim | 269 +++++++++++++++++++++++++++++++++++++++++++++ runtime/doc/dev_theme.txt | 103 +++++++++++++++++ runtime/doc/news.txt | 3 + runtime/doc/vim_diff.txt | 2 + 5 files changed, 382 insertions(+), 7 deletions(-) create mode 100644 runtime/colors/vim.vim create mode 100644 runtime/doc/dev_theme.txt (limited to 'runtime') diff --git a/runtime/colors/default.vim b/runtime/colors/default.vim index d2960fa78b..fac120ccf5 100644 --- a/runtime/colors/default.vim +++ b/runtime/colors/default.vim @@ -1,12 +1,10 @@ -" Vim color file -" Maintainer: The Vim Project -" Last Change: 2023 Aug 10 -" Former Maintainer: Bram Moolenaar +" Neovim color file +" Maintainer: The Neovim Project +" Last Change: 2023 Dec 01 -" This is the default color scheme. It doesn't define the Normal -" highlighting, it uses whatever the colors used to be. +" This is the default color scheme. -" Set 'background' back to the default. The value can't always be estimated +" Set 'background' back to the default. The value can't always be estimated " and is then guessed. hi clear Normal set bg& diff --git a/runtime/colors/vim.vim b/runtime/colors/vim.vim new file mode 100644 index 0000000000..3418abe424 --- /dev/null +++ b/runtime/colors/vim.vim @@ -0,0 +1,269 @@ +" Name: vim +" Description: Vim's default color scheme +" Author: Bram Moolenaar +" Maintainer: The Vim Project +" Website: https://github.com/vim/vim +" License: Same as Vim +" Last Updated: 2023 Aug 10 + +" This is Vim's default color scheme. It doesn't define the Normal +" highlighting, it uses whatever the colors used to be. + +hi clear +let g:colors_name = 'vim' + +" General +hi Conceal guifg=LightGrey guibg=DarkGrey guisp=NONE gui=NONE ctermfg=LightGrey ctermbg=DarkGrey cterm=NONE +hi Cursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE +hi lCursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE +hi DiffText guifg=NONE guibg=Red guisp=NONE gui=bold ctermfg=NONE ctermbg=Red cterm=bold +hi ErrorMsg guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=DarkRed cterm=NONE +hi IncSearch guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse +hi ModeMsg guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi NonText guifg=Blue guibg=NONE guisp=NONE gui=bold ctermfg=Blue ctermbg=NONE cterm=NONE +hi Normal guifg=NONE guibg=NONE guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi PmenuSbar guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=NONE ctermbg=Grey cterm=NONE +hi StatusLine guifg=NONE guibg=NONE guisp=NONE gui=reverse,bold ctermfg=NONE ctermbg=NONE cterm=reverse,bold +hi StatusLineNC guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse +hi TabLineFill guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse +hi TabLineSel guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi TermCursor guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse +hi WinBar guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi WildMenu guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE +hi! link VertSplit Normal +hi! link WinSeparator VertSplit +hi! link WinBarNC WinBar +hi! link EndOfBuffer NonText +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr +hi! link QuickFixLine Search +hi! link CursorLineSign SignColumn +hi! link CursorLineFold FoldColumn +hi! link CurSearch Search +hi! link PmenuKind Pmenu +hi! link PmenuKindSel PmenuSel +hi! link PmenuExtra Pmenu +hi! link PmenuExtraSel PmenuSel +hi! link Substitute Search +hi! link Whitespace NonText +hi! link MsgSeparator StatusLine +hi! link NormalFloat Pmenu +hi! link FloatBorder WinSeparator +hi! link FloatTitle Title +hi! link FloatFooter Title +hi FloatShadow guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=80 +hi FloatShadowThrough guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=100 +hi RedrawDebugNormal guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse +hi RedrawDebugClear guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE +hi RedrawDebugComposed guifg=NONE guibg=Green guisp=NONE gui=NONE ctermfg=NONE ctermbg=Green cterm=NONE +hi RedrawDebugRecompose guifg=NONE guibg=Red guisp=NONE gui=NONE ctermfg=NONE ctermbg=Red cterm=NONE +hi Error guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=Red cterm=NONE term=reverse +hi Todo guifg=Blue guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE term=standout +hi! link String Constant +hi! link Character Constant +hi! link Number Constant +hi! link Boolean Constant +hi! link Float Number +hi! link Function Identifier +hi! link Conditional Statement +hi! link Repeat Statement +hi! link Label Statement +hi! link Operator Statement +hi! link Keyword Statement +hi! link Exception Statement +hi! link Include PreProc +hi! link Define PreProc +hi! link Macro PreProc +hi! link PreCondit PreProc +hi! link StorageClass Type +hi! link Structure Type +hi! link Typedef Type +hi! link Tag Special +hi! link SpecialChar Special +hi! link Delimiter Special +hi! link SpecialComment Special +hi! link Debug Special +hi DiagnosticError guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=1 ctermbg=NONE cterm=NONE +hi DiagnosticWarn guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=3 ctermbg=NONE cterm=NONE +hi DiagnosticInfo guifg=LightBlue guibg=NONE guisp=NONE gui=NONE ctermfg=4 ctermbg=NONE cterm=NONE +hi DiagnosticHint guifg=LightGrey guibg=NONE guisp=NONE gui=NONE ctermfg=7 ctermbg=NONE cterm=NONE +hi DiagnosticOk guifg=LightGreen guibg=NONE guisp=NONE gui=NONE ctermfg=10 ctermbg=NONE cterm=NONE +hi DiagnosticUnderlineError guifg=NONE guibg=NONE guisp=Red gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi DiagnosticUnderlineWarn guifg=NONE guibg=NONE guisp=Orange gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi DiagnosticUnderlineInfo guifg=NONE guibg=NONE guisp=LightBlue gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi DiagnosticUnderlineHint guifg=NONE guibg=NONE guisp=LightGrey gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi DiagnosticUnderlineOk guifg=NONE guibg=NONE guisp=LightGreen gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi! link DiagnosticVirtualTextError DiagnosticError +hi! link DiagnosticVirtualTextWarn DiagnosticWarn +hi! link DiagnosticVirtualTextInfo DiagnosticInfo +hi! link DiagnosticVirtualTextHint DiagnosticHint +hi! link DiagnosticVirtualTextOk DiagnosticOk +hi! link DiagnosticFloatingError DiagnosticError +hi! link DiagnosticFloatingWarn DiagnosticWarn +hi! link DiagnosticFloatingInfo DiagnosticInfo +hi! link DiagnosticFloatingHint DiagnosticHint +hi! link DiagnosticFloatingOk DiagnosticOk +hi! link DiagnosticSignError DiagnosticError +hi! link DiagnosticSignWarn DiagnosticWarn +hi! link DiagnosticSignInfo DiagnosticInfo +hi! link DiagnosticSignHint DiagnosticHint +hi! link DiagnosticSignOk DiagnosticOk +hi DiagnosticDeprecated guifg=NONE guibg=NONE guisp=Red gui=strikethrough ctermfg=NONE ctermbg=NONE cterm=strikethrough +hi! link DiagnosticUnnecessary Comment +hi! link LspInlayHint NonText +hi! link SnippetTabstop Visual + +" Text +hi! link @text.literal Comment +hi! link @text.reference Identifier +hi! link @text.title Title +hi! link @text.uri Underlined +hi! link @text.underline Underlined +hi! link @text.todo Todo + +" Miscs +hi! link @comment Comment +hi! link @punctuation Delimiter + +" Constants +hi! link @constant Constant +hi! link @constant.builtin Special +hi! link @constant.macro Define +hi! link @define Define +hi! link @macro Macro +hi! link @string String +hi! link @string.escape SpecialChar +hi! link @string.special SpecialChar +hi! link @character Character +hi! link @character.special SpecialChar +hi! link @number Number +hi! link @boolean Boolean +hi! link @float Float + +" Functions +hi! link @function Function +hi! link @function.builtin Special +hi! link @function.macro Macro +hi! link @parameter Identifier +hi! link @method Function +hi! link @field Identifier +hi! link @property Identifier +hi! link @constructor Special + +" Keywords +hi! link @conditional Conditional +hi! link @repeat Repeat +hi! link @label Label +hi! link @operator Operator +hi! link @keyword Keyword +hi! link @exception Exception + +hi! link @variable Identifier +hi! link @type Type +hi! link @type.definition Typedef +hi! link @storageclass StorageClass +hi! link @namespace Identifier +hi! link @include Include +hi! link @preproc PreProc +hi! link @debug Debug +hi! link @tag Tag + +" LSP semantic tokens +hi! link @lsp.type.class Structure +hi! link @lsp.type.comment Comment +hi! link @lsp.type.decorator Function +hi! link @lsp.type.enum Structure +hi! link @lsp.type.enumMember Constant +hi! link @lsp.type.function Function +hi! link @lsp.type.interface Structure +hi! link @lsp.type.macro Macro +hi! link @lsp.type.method Function +hi! link @lsp.type.namespace Structure +hi! link @lsp.type.parameter Identifier +hi! link @lsp.type.property Identifier +hi! link @lsp.type.struct Structure +hi! link @lsp.type.type Type +hi! link @lsp.type.typeParameter TypeDef +hi! link @lsp.type.variable Identifier + +if &background ==# 'light' + " Default colors only used with a light background. + hi ColorColumn guifg=NONE guibg=LightRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightRed cterm=NONE + hi CursorColumn guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightGrey cterm=NONE + hi CursorLine guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorLineNr guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=underline + hi DiffAdd guifg=NONE guibg=LightBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightBlue cterm=NONE + hi DiffChange guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightMagenta cterm=NONE + hi DiffDelete guifg=Blue guibg=LightCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=LightCyan cterm=NONE + hi Directory guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE + hi FoldColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE + hi Folded guifg=DarkBlue guibg=LightGrey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE + hi LineNr guifg=Brown guibg=NONE guisp=NONE gui=NONE ctermfg=Brown ctermbg=NONE cterm=NONE + hi MatchParen guifg=NONE guibg=Cyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=Cyan cterm=NONE + hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE + hi Pmenu guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=Black ctermbg=LightMagenta cterm=NONE + hi PmenuSel guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=Black ctermbg=LightGrey cterm=NONE blend=NONE + hi PmenuThumb guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=Black cterm=NONE + hi Question guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE + hi Search guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE + hi SignColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE + hi SpecialKey guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE + hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=LightRed cterm=NONE + hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=LightBlue cterm=NONE + hi SpellLocal guifg=NONE guibg=NONE guisp=DarkCyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE + hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=LightMagenta cterm=NONE + hi TabLine guifg=NONE guibg=LightGrey guisp=NONE gui=underline ctermfg=black ctermbg=LightGrey cterm=underline + hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=DarkMagenta ctermbg=NONE cterm=NONE + hi Visual guifg=NONE guibg=LightGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE + hi Comment guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE term=bold + hi Constant guifg=Magenta guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE term=underline + hi Special guifg=#6a5acd guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=bold + hi Identifier guifg=DarkCyan guibg=NONE guisp=NONE gui=NONE ctermfg=DarkCyan ctermbg=NONE cterm=NONE term=underline + hi Statement guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=NONE term=bold + hi PreProc guifg=#6a0dad guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=underline + hi Type guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE term=underline + hi Underlined guifg=SlateBlue guibg=NONE guisp=NONE gui=underline ctermfg=DarkMagenta ctermbg=NONE cterm=underline term=underline + hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE term=NONE +else + " Default colors only used with a dark background. + hi ColorColumn guifg=NONE guibg=DarkRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkRed cterm=NONE + hi CursorColumn guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkGrey cterm=NONE + hi CursorLine guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorLineNr guifg=Yellow guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=underline + hi DiffAdd guifg=NONE guibg=DarkBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkBlue cterm=NONE + hi DiffChange guifg=NONE guibg=DarkMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkMagenta cterm=NONE + hi DiffDelete guifg=Blue guibg=DarkCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=DarkCyan cterm=NONE + hi Directory guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightCyan ctermbg=NONE cterm=NONE + hi FoldColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE + hi Folded guifg=Cyan guibg=DarkGrey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE + hi LineNr guifg=Yellow guibg=NONE guisp=NONE gui=NONE ctermfg=Yellow ctermbg=NONE cterm=NONE + hi MatchParen guifg=NONE guibg=DarkCyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkCyan cterm=NONE + hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE + hi Pmenu guifg=NONE guibg=Magenta guisp=NONE gui=NONE ctermfg=Black ctermbg=Magenta cterm=NONE + hi PmenuSel guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=DarkGrey ctermbg=Black cterm=NONE blend=NONE + hi PmenuThumb guifg=NONE guibg=White guisp=NONE gui=NONE ctermfg=NONE ctermbg=White cterm=NONE + hi Question guifg=Green guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE + hi Search guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE + hi SignColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE + hi SpecialKey guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE + hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=Red cterm=NONE + hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=Blue cterm=NONE + hi SpellLocal guifg=NONE guibg=NONE guisp=Cyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE + hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=Magenta cterm=NONE + hi TabLine guifg=NONE guibg=DarkGrey guisp=NONE gui=underline ctermfg=white ctermbg=DarkGrey cterm=underline + hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=LightMagenta ctermbg=NONE cterm=NONE + hi Visual guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE + hi Comment guifg=#80a0ff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=NONE term=bold + hi Constant guifg=#ffa0a0 guibg=NONE guisp=NONE gui=NONE ctermfg=Magenta ctermbg=NONE cterm=NONE term=underline + hi Special guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE term=bold + hi Identifier guifg=#40ffff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=bold term=underline + hi Statement guifg=#ffff60 guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=NONE term=bold + hi PreProc guifg=#ff80ff guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE term=underline + hi Type guifg=#60ff60 guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE term=underline + hi Underlined guifg=#80a0ff guibg=NONE guisp=NONE gui=underline ctermfg=LightBlue ctermbg=NONE cterm=underline term=underline + hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=black ctermbg=NONE cterm=NONE term=NONE +endif + +" vim: sw=2 diff --git a/runtime/doc/dev_theme.txt b/runtime/doc/dev_theme.txt new file mode 100644 index 0000000000..04ec3f293c --- /dev/null +++ b/runtime/doc/dev_theme.txt @@ -0,0 +1,103 @@ +*dev_theme.txt* Nvim + + + NVIM REFERENCE MANUAL + + +Nvim theme style guide *dev-theme* + +This is style guide for developers working on Nvim's default color scheme. + +License: CC-By 3.0 https://creativecommons.org/licenses/by/3.0/ + + Type |gO| to see the table of contents. + +============================================================================== +Design + +- Be "Neovim branded", i.e. have mostly "green-blue" feel plus one or two + colors reserved for very occasional user attention. + +- Be extra minimal for 'notermguicolors' (256 colors) while allowing a bit + more shades when 'termguicolors' is set (true colors). + +- Be accessible, i.e. have high enough contrast ratio (as defined in + https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef). + This means to have value at least 7 for |hl-Normal| and 4.5 for some common + cases (|hl-Visual|, `Comment` with set 'cursorline', colored syntax, `Diff*`, + |hl-Search|). + +- Be suitable for dark and light backgrounds via exchange of dark and light + palettes. + +- Be usable, i.e. provide enough visual feedback for common objects. + + +============================================================================== +Palettes + +- There are two separate palettes: dark and light. They all contain the same + set of colors exported as `NvimDark*` and `NvimLight*` colors respectively. + +- The dark palette is used for background in the dark color scheme and for + foreground in the light color scheme; and vice versa. This introduces + recognizable visual system without too standing out. + +- Actual computation of palettes should be done in a perceptually uniform + color space. Oklch is a good choice. + +- Each palette has the following colors (descriptions are for dark background; + reverse for light one): + + - Four shades of "colored" greys for general UI. In 256 colors they are + exact greys; in true colors they are shades of "cold" grey. + + - Dark ones (from darkest to lightest) are reserved as background for + |hl-NormalFloat| (considered as "black"), |hl-Normal| (background), + |hl-CursorLine|, |hl-Visual|. + + - Light ones (also from darkest to lightest) are reserved for + `Comment`, |hl-StatusLine|/|hl-TabLine|, |hl-Normal| (foreground), + and color considered as "white". + +- Six colors to provide enough terminal colors: red, yellow, green, cyan, + blue, magenta. + They should have (reasonably) similar lightness and chroma to make them + visually coherent. Lightness should be as equal to the palette's basic grey + (which is used for |hl-Normal|) as possible. They should have (reasonably) + different hues to make them visually separable. + +- Each palette color should have a 256 colors variant with closest color + computed based on the perceptually uniform distance measure. + + +============================================================================== +Highlight groups + +Use: + +- Grey shades for general UI according to their design. + +- Bold text for keywords (`Statement` highlight group). This is an important + choice to increase accessibility for people with color deficiencies, as it + doesn't rely on actual color. + +- Green for strings, |hl-DiffAdd| (as background), |hl-DiagnosticOk|, and some + minor text UI elements. + +- Cyan as main syntax color, i.e. for function usage (`Function` highlight + group), |hl-DiffText|, |hl-DiagnosticInfo|, and some minor text UI elements. + +- Red to generally mean high user attention, i.e. errors; in particular for + |hl-ErrorMsg|, |hl-DiffDelete|, |hl-DiagnosticError|. + +- Yellow very sparingly only with true colors to mean mild user attention, + i.e. warnings. That is, |hl-DiagnosticWarn| and |hl-WarningMsg|. + +- Blue very sparingly only with true colors as |hl-DiagnosticHint| and some + additional important syntax group (like `Identifier`). + +- Magenta very carefully (if at all). + + + vim:tw=78:ts=8:et:ft=help:norl: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 825e5ba41f..f5b41f38a6 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -95,6 +95,9 @@ The following changes may require adaptations in user config or plugins. • Legacy and extmark signs are displayed and listed with the same priority: line number -> priority -> sign id -> recently placed +• Default color scheme has been updated to be "Neovim branded" and accessible. + Use `:colorscheme vim` to revert to the old legacy color scheme. + ============================================================================== BREAKING CHANGES IN HEAD *news-breaking-dev* diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index cf9b3cf0e5..f6dfe3b14a 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -30,6 +30,8 @@ Defaults *nvim-defaults* ":filetype off" to |init.vim|. - Syntax highlighting is enabled by default. This can be disabled by adding ":syntax off" to |init.vim|. +- Default color scheme has been updated. This can be reversed by adding + ":colorscheme vim" to |init.vim|. - 'autoindent' is enabled - 'autoread' is enabled (works in all UIs, including terminal) -- cgit From 988b472d902e6116353fc2ae605bed32a37e6391 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 3 Dec 2023 15:58:27 +0100 Subject: feat(treesitter): highlight help files by default (#26347) --- runtime/doc/news.txt | 1 + runtime/ftplugin/help.lua | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index f5b41f38a6..e38707fa76 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -269,6 +269,7 @@ The following changes to existing APIs or features add new behavior. vim.g.query_lint_on = {} < • Enabled treesitter highlighting for treesitter query files. + • Enabled treesitter highlighting for help files. • The `workspace/didChangeWatchedFiles` LSP client capability is now enabled by default. diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua index 4cc3386167..bf3408c2d9 100644 --- a/runtime/ftplugin/help.lua +++ b/runtime/ftplugin/help.lua @@ -1,3 +1,7 @@ +-- use treesitter over syntax (for highlighted code blocks) +vim.treesitter.start() + +-- add custom highlights for list in `:h highlight-groups` if vim.endswith(vim.fs.normalize(vim.api.nvim_buf_get_name(0)), '/doc/syntax.txt') then require('vim.vimhelp').highlight_groups() end -- cgit From cf612c64b0fc87c399bc5c72735335c5e73d6de1 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Mon, 4 Dec 2023 04:00:49 -0500 Subject: fix(treesitter): allow passing lang to vim.treesitter.get_node() now correctly takes opts.lang (#26360) PROBLEM: `vim.treesitter.get_node()` does not recognize the `lang` in the option table. This option was used in somewhere else, for instance, `vim.treesitter.dev` (for `inspect_tree`) but was never implemented. SOLUTION: Make `get_node()` correctly use `opts.lang` when getting a treesitter parser. --- runtime/doc/treesitter.txt | 2 ++ runtime/lua/vim/treesitter.lua | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 9bdc6b8d24..e3836a357b 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -616,6 +616,8 @@ get_node({opts}) *vim.treesitter.get_node()* • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor position in the current window. Required if {bufnr} is not the current buffer + • lang string|nil Parser language. (default: from buffer + filetype) • ignore_injections boolean Ignore injected languages (default true) diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua index e7a66c00b2..7b795380fe 100644 --- a/runtime/lua/vim/treesitter.lua +++ b/runtime/lua/vim/treesitter.lua @@ -362,6 +362,7 @@ end --- - bufnr integer|nil Buffer number (nil or 0 for current buffer) --- - pos table|nil 0-indexed (row, col) tuple. Defaults to cursor position in the --- current window. Required if {bufnr} is not the current buffer +--- - lang string|nil Parser language. (default: from buffer filetype) --- - ignore_injections boolean Ignore injected languages (default true) --- ---@return TSNode | nil Node at the given position @@ -392,7 +393,7 @@ function M.get_node(opts) local ts_range = { row, col, row, col } - local root_lang_tree = M.get_parser(bufnr) + local root_lang_tree = M.get_parser(bufnr, opts.lang) if not root_lang_tree then return end -- cgit From c9828200ac99c0f0769c587ddc060045ab3a9ad5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 5 Dec 2023 09:24:28 +0100 Subject: vim-patch:9.0.2148: Vim does not detect pacman.log file Problem: Vim does not detect pacman.log file Solution: Detect pacmanlogs and add syntax highlighting pacman.log is a filetype common to Arch Liux and related distributions. Add some simple syntax highlighting for the pacmanlog filetype. closes: vim/vim#13618 https://github.com/vim/vim/commit/1e5d66408ef85c750a5af03bbf5cc19b5de7a6bc Co-authored-by: Ronan Pigott --- runtime/lua/vim/filetype.lua | 1 + runtime/syntax/pacmanlog.vim | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 runtime/syntax/pacmanlog.vim (limited to 'runtime') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 60882d4432..e64923ab54 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1394,6 +1394,7 @@ local filename = { octaverc = 'octave', ['octave.conf'] = 'octave', opam = 'opam', + ['pacman.log'] = 'pacmanlog', ['/etc/pam.conf'] = 'pamconf', ['pam_env.conf'] = 'pamenv', ['.pam_environment'] = 'pamenv', diff --git a/runtime/syntax/pacmanlog.vim b/runtime/syntax/pacmanlog.vim new file mode 100644 index 0000000000..98abd58685 --- /dev/null +++ b/runtime/syntax/pacmanlog.vim @@ -0,0 +1,41 @@ +" Vim syntax file +" Language: pacman.log +" Maintainer: Ronan Pigott +" Last Change: 2023 Dec 04 + +if exists("b:current_syntax") + finish +endif + +syn sync maxlines=1 +syn region pacmanlogMsg start='\S' end='$' keepend contains=pacmanlogTransaction,pacmanlogALPMMsg +syn region pacmanlogTag start='\['hs=s+1 end='\]'he=e-1 keepend nextgroup=pacmanlogMsg +syn region pacmanlogTime start='^\['hs=s+1 end='\]'he=e-1 keepend nextgroup=pacmanlogTag + +syn match pacmanlogPackageName '\v[a-z0-9@_+.-]+' contained skipwhite nextgroup=pacmanlogPackageVersion +syn match pacmanlogPackageVersion '(.*)' contained + +syn match pacmanlogTransaction 'transaction \v(started|completed)$' contained +syn match pacmanlogInstalled '\v(re)?installed' contained nextgroup=pacmanlogPackageName +syn match pacmanlogUpgraded 'upgraded' contained nextgroup=pacmanlogPackageName +syn match pacmanlogDowngraded 'downgraded' contained nextgroup=pacmanlogPackageName +syn match pacmanlogRemoved 'removed' contained nextgroup=pacmanlogPackageName +syn match pacmanlogWarning 'warning:.*$' contained + +syn region pacmanlogALPMMsg start='\v(\[ALPM\] )@<=(transaction|(re)?installed|upgraded|downgraded|removed|warning)>' end='$' contained + \ contains=pacmanlogTransaction,pacmanlogInstalled,pacmanlogUpgraded,pacmanlogDowngraded,pacmanlogRemoved,pacmanlogWarning,pacmanlogPackageName,pacmanlogPackgeVersion + +hi def link pacmanlogTime String +hi def link pacmanlogTag Type + +hi def link pacmanlogTransaction Special +hi def link pacmanlogInstalled Identifier +hi def link pacmanlogRemoved Repeat +hi def link pacmanlogUpgraded pacmanlogInstalled +hi def link pacmanlogDowngraded pacmanlogRemoved +hi def link pacmanlogWarning WarningMsg + +hi def link pacmanlogPackageName Normal +hi def link pacmanlogPackageVersion Comment + +let b:current_syntax = "pacmanlog" -- cgit From 0b74ad0a641f28d9d3da5353e98372d87078bd9d Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Tue, 5 Dec 2023 12:33:57 +0100 Subject: refactor(api): complete conversion from `Dictionary` to `Dict(opts)` (#26365) --- runtime/doc/api.txt | 18 +++++++++--------- runtime/lua/vim/_meta/api.lua | 20 ++++++++++---------- runtime/lua/vim/_meta/api_keysets.lua | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 19 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index ba3b7c0915..4aba1f8141 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1006,7 +1006,7 @@ nvim_get_keymap({mode}) *nvim_get_keymap()* Array of |maparg()|-like dictionaries describing mappings. The "buffer" key is always zero. -nvim_get_mark({name}, {opts}) *nvim_get_mark()* +nvim_get_mark({name}, {*opts}) *nvim_get_mark()* Returns a `(row, col, buffer, buffername)` tuple representing the position of the uppercase/file named mark. "End of line" column position is returned as |v:maxcol| (big number). See |mark-motions|. @@ -1204,7 +1204,7 @@ nvim_notify({msg}, {log_level}, {opts}) *nvim_notify()* • {log_level} The log level • {opts} Reserved for future use. -nvim_open_term({buffer}, {opts}) *nvim_open_term()* +nvim_open_term({buffer}, {*opts}) *nvim_open_term()* Open a terminal instance in a buffer By default (and currently the only option) the terminal will not be @@ -1305,7 +1305,7 @@ nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) • cpoptions *nvim_select_popupmenu_item()* -nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts}) +nvim_select_popupmenu_item({item}, {insert}, {finish}, {*opts}) Selects an item in the completion popup menu. If neither |ins-completion| nor |cmdline-completion| popup menu is active @@ -1878,7 +1878,7 @@ nvim_get_commands({*opts}) *nvim_get_commands()* See also: ~ • |nvim_get_all_options_info()| -nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()* +nvim_parse_cmd({str}, {*opts}) *nvim_parse_cmd()* Parse command line. Doesn't check the validity of command arguments. @@ -2057,7 +2057,7 @@ affected. You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()| to check whether a buffer is loaded. -nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()* +nvim_buf_attach({buffer}, {send_buffer}, {*opts}) *nvim_buf_attach()* Activates buffer-update events on a channel, or as Lua callbacks. Example (Lua): capture buffer updates in a global `events` variable (use @@ -2193,7 +2193,7 @@ nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()* • {buffer} Buffer handle, or 0 for current buffer • {name} Variable name -nvim_buf_delete({buffer}, {opts}) *nvim_buf_delete()* +nvim_buf_delete({buffer}, {*opts}) *nvim_buf_delete()* Deletes the buffer. See |:bwipeout| Attributes: ~ @@ -2310,7 +2310,7 @@ nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()* *nvim_buf_get_text()* nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col}, - {opts}) + {*opts}) Gets a range from the buffer. This differs from |nvim_buf_get_lines()| in that it allows retrieving only @@ -2412,7 +2412,7 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement}) • |nvim_buf_set_text()| *nvim_buf_set_mark()* -nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {opts}) +nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {*opts}) Sets a named mark in the given buffer, all marks are allowed file/uppercase, visual, last change, etc. See |mark-motions|. @@ -2553,7 +2553,7 @@ nvim_buf_del_extmark({buffer}, {ns_id}, {id}) *nvim_buf_del_extmark()* true if the extmark was found, else false *nvim_buf_get_extmark_by_id()* -nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts}) +nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {*opts}) Gets the position (0-indexed) of an |extmark|. Parameters: ~ diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 49269ba631..4ad0a2e791 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -151,7 +151,7 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start --- `nvim_buf_lines_event`. Else the first notification --- will be `nvim_buf_changedtick_event`. Not for Lua --- callbacks. ---- @param opts table Optional parameters. +--- @param opts vim.api.keyset.buf_attach Optional parameters. --- • on_lines: Lua callback invoked on change. Return `true` to detach. Args: --- • the string "lines" --- • buffer handle @@ -284,7 +284,7 @@ function vim.api.nvim_buf_del_var(buffer, name) end --- Deletes the buffer. See `:bwipeout` --- --- @param buffer integer Buffer handle, or 0 for current buffer ---- @param opts table Optional parameters. Keys: +--- @param opts vim.api.keyset.buf_delete Optional parameters. Keys: --- • force: Force deletion and ignore unsaved changes. --- • unload: Unloaded only, do not delete. See `:bunload` function vim.api.nvim_buf_delete(buffer, opts) end @@ -307,7 +307,7 @@ function vim.api.nvim_buf_get_commands(buffer, opts) end --- @param buffer integer Buffer handle, or 0 for current buffer --- @param ns_id integer Namespace id from `nvim_create_namespace()` --- @param id integer Extmark id ---- @param opts table Optional parameters. Keys: +--- @param opts vim.api.keyset.get_extmark Optional parameters. Keys: --- • details: Whether to include the details dict --- • hl_name: Whether to include highlight group name instead --- of id, true if omitted @@ -440,7 +440,7 @@ function vim.api.nvim_buf_get_option(buffer, name) end --- @param start_col integer Starting column (byte offset) on first line --- @param end_row integer Last line index, inclusive --- @param end_col integer Ending column (byte offset) on last line, exclusive ---- @param opts table Optional parameters. Currently unused. +--- @param opts vim.api.keyset.empty Optional parameters. Currently unused. --- @return string[] function vim.api.nvim_buf_get_text(buffer, start_row, start_col, end_row, end_col, opts) end @@ -626,7 +626,7 @@ function vim.api.nvim_buf_set_lines(buffer, start, end_, strict_indexing, replac --- @param name string Mark name --- @param line integer Line number --- @param col integer Column/row number ---- @param opts table Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. --- @return boolean function vim.api.nvim_buf_set_mark(buffer, name, line, col, opts) end @@ -675,7 +675,7 @@ function vim.api.nvim_buf_set_var(buffer, name, value) end --- @param src_id integer --- @param line integer --- @param chunks any[] ---- @param opts table +--- @param opts vim.api.keyset.empty --- @return integer function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) end @@ -1241,7 +1241,7 @@ function vim.api.nvim_get_keymap(mode) end --- Marks are (1,0)-indexed. `api-indexing` --- --- @param name string Mark name ---- @param opts table Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. --- @return any[] function vim.api.nvim_get_mark(name, opts) end @@ -1439,7 +1439,7 @@ function vim.api.nvim_notify(msg, log_level, opts) end --- virtual terminal having the intended size. --- --- @param buffer integer the buffer to use (expected to be empty) ---- @param opts table Optional parameters. +--- @param opts vim.api.keyset.open_term Optional parameters. --- • on_input: Lua callback for input sent, i e keypresses in --- terminal mode. Note: keypresses are sent raw as they would --- be to the pty master end. For instance, a carriage return @@ -1602,7 +1602,7 @@ function vim.api.nvim_out_write(str) end --- Doesn't check the validity of command arguments. --- --- @param str string Command line string to parse. Cannot contain "\n". ---- @param opts table Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. --- @return table function vim.api.nvim_parse_cmd(str, opts) end @@ -1685,7 +1685,7 @@ function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end --- inserted in the buffer. Ignored for `cmdline-completion`. --- @param finish boolean Finish the completion and dismiss the popup menu. Implies --- {insert}. ---- @param opts table Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end --- Sets the current buffer. diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index f69e5a92c7..6a3e574455 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -3,6 +3,19 @@ -- DO NOT EDIT error('Cannot require a meta file') +--- @class vim.api.keyset.buf_attach +--- @field on_lines? function +--- @field on_bytes? function +--- @field on_changedtick? function +--- @field on_detach? function +--- @field on_reload? function +--- @field utf_sizes? boolean +--- @field preview? boolean + +--- @class vim.api.keyset.buf_delete +--- @field force? boolean +--- @field unload? boolean + --- @class vim.api.keyset.clear_autocmds --- @field buffer? integer --- @field event? any @@ -74,6 +87,8 @@ error('Cannot require a meta file') --- @class vim.api.keyset.echo_opts --- @field verbose? boolean +--- @class vim.api.keyset.empty + --- @class vim.api.keyset.eval_statusline --- @field winid? integer --- @field maxwidth? integer @@ -124,6 +139,10 @@ error('Cannot require a meta file') --- @class vim.api.keyset.get_commands --- @field builtin? boolean +--- @class vim.api.keyset.get_extmark +--- @field details? boolean +--- @field hl_name? boolean + --- @class vim.api.keyset.get_extmarks --- @field limit? integer --- @field details? boolean @@ -196,6 +215,9 @@ error('Cannot require a meta file') --- @field desc? string --- @field replace_keycodes? boolean +--- @class vim.api.keyset.open_term +--- @field on_input? function + --- @class vim.api.keyset.option --- @field scope? string --- @field win? integer -- cgit From 4a1abc91a0ec71f85239dbaf0ffa1fe42c50e368 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 6 Dec 2023 06:44:37 +0800 Subject: vim-patch:2103a56eab5a (#26411) runtime(doc): remove non-existent parameter in shift-command (vim/vim#13626) The variant with the {count} parameter is explained in the next item. https://github.com/vim/vim/commit/2103a56eab5a935f3c14c6e0b1610ff16fc8678f N/A patches: vim-patch:9.0.2150: Using int for errbuflen in option funcs vim-patch:3f7855a6123c Co-authored-by: Roy Orbitson --- runtime/doc/change.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index e1bb7c5fc7..fe796422c2 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -485,7 +485,7 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* lines to [indent] (default 0). *:>* -:[range]> [flags] Shift {count} [range] lines one 'shiftwidth' right. +:[range]> [flags] Shift [range] lines one 'shiftwidth' right. Repeat '>' for shifting multiple 'shiftwidth's. See |ex-flags| for [flags]. -- cgit From cc38086039853d53157b30fec41babb148399038 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:04:21 +0100 Subject: docs: small fixes (#26243) Co-authored-by: umlx5h Co-authored-by: Gregory Anders Co-authored-by: Evan Farrar --- runtime/doc/autocmd.txt | 4 ++-- runtime/doc/editorconfig.txt | 2 ++ runtime/doc/eval.txt | 2 +- runtime/doc/lua-guide.txt | 2 +- runtime/doc/quickref.txt | 10 +++++----- 5 files changed, 11 insertions(+), 9 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index c6f6559e37..45d7a4244c 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1001,10 +1001,10 @@ TermResponse When Nvim receives an OSC or DCS response from once = true, callback = function(args) local resp = args.data - local r, g, b = resp:match("\x1b%]4;1;rgb:(%w+)/(%w+)/(%w+)") + local r, g, b = resp:match("\027%]4;1;rgb:(%w+)/(%w+)/(%w+)") end, }) - io.stdout:write("\x1b]4;1;?\x1b\\") + io.stdout:write("\027]4;1;?\027\\") < *TextChanged* TextChanged After a change was made to the text in the diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt index 7c6e8fb95f..a2281a7b7c 100644 --- a/runtime/doc/editorconfig.txt +++ b/runtime/doc/editorconfig.txt @@ -49,6 +49,8 @@ indent_size A number indicating the size of a single indent. Alternatively, use the value "tab" to use the value of the tab_width property. Sets the 'shiftwidth' and 'softtabstop' options. + If this value is not "tab" and the tab_width property + is not set, 'tabstop' is also set to this value. *editorconfig_insert_final_newline* insert_final_newline "true" or "false" to ensure the file always has a diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a73932be00..a3ba098740 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4365,7 +4365,7 @@ have Vim execute random executables or may have forbidden to do so for specific filetypes by setting the "_exec" variable (|plugin_exec|). It returns |TRUE| or |FALSE| to indicate whether the plugin should run the given -exectuable. It takes the following arguments: +executable. It takes the following arguments: argument type ~ diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt index c15b1b0495..e8757a1859 100644 --- a/runtime/doc/lua-guide.txt +++ b/runtime/doc/lua-guide.txt @@ -157,7 +157,7 @@ its functions if this succeeds and prints an error message otherwise: end < In contrast to |:source|, |require()| not only searches through all `lua/` directories -under |'runtimepath'|, it also cache the module on first use. Calling +under |'runtimepath'|, it also caches the module on first use. Calling `require()` a second time will therefore _not_ execute the script again and instead return the cached file. To rerun the file, you need to remove it from the cache manually first: diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index f976eb7464..572dc8a841 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -623,9 +623,9 @@ Short explanation of each option: *option-list* 'aleph' 'al' ASCII code of the letter Aleph (Hebrew) 'allowrevins' 'ari' allow CTRL-_ in Insert and Command-line mode 'ambiwidth' 'ambw' what to do with Unicode chars of ambiguous width -'autochdir' 'acd' change directory to the file in the current window 'arabic' 'arab' for Arabic as a default second language 'arabicshape' 'arshape' do shaping for Arabic characters +'autochdir' 'acd' change directory to the file in the current window 'autoindent' 'ai' take indent for new line from previous line 'autoread' 'ar' autom. read file when changed outside of Vim 'autowrite' 'aw' automatically write file if changed @@ -655,8 +655,8 @@ Short explanation of each option: *option-list* 'cindent' 'cin' do C program indenting 'cinkeys' 'cink' keys that trigger indent when 'cindent' is set 'cinoptions' 'cino' how to do indenting when 'cindent' is set -'cinwords' 'cinw' words where 'si' and 'cin' add an indent 'cinscopedecls' 'cinsd' words that are recognized by 'cino-g' +'cinwords' 'cinw' words where 'si' and 'cin' add an indent 'clipboard' 'cb' use the clipboard as the unnamed register 'cmdheight' 'ch' number of lines to use for the command-line 'cmdwinheight' 'cwh' height of the command-line window @@ -738,10 +738,10 @@ Short explanation of each option: *option-list* 'helpheight' 'hh' minimum height of a new help window 'helplang' 'hlg' preferred help languages 'hidden' 'hid' don't unload buffer when it is |abandon|ed -'hlsearch' 'hls' highlight matches with last search pattern 'history' 'hi' number of command-lines that are remembered 'hkmap' 'hk' Hebrew keyboard mapping 'hkmapp' 'hkp' phonetic Hebrew keyboard mapping +'hlsearch' 'hls' highlight matches with last search pattern 'icon' let Vim set the text of the window icon 'iconstring' string to use for the Vim icon text 'ignorecase' 'ic' ignore case in search patterns @@ -939,10 +939,10 @@ Short explanation of each option: *option-list* 'wildoptions' 'wop' specifies how command line completion is done 'winaltkeys' 'wak' when the windows system handles ALT keys 'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B -'winheight' 'wh' minimum number of lines for the current window -'winhighlight' 'winhl' window-local highlighting 'winfixheight' 'wfh' keep window height when opening/closing windows 'winfixwidth' 'wfw' keep window width when opening/closing windows +'winheight' 'wh' minimum number of lines for the current window +'winhighlight' 'winhl' window-local highlighting 'winminheight' 'wmh' minimum number of lines for any window 'winminwidth' 'wmw' minimal number of columns for any window 'winwidth' 'wiw' minimal number of columns for current window -- cgit From 5b40a1c09dda83275784053b325ad16626fc55f2 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Tue, 5 Dec 2023 18:35:22 -0800 Subject: feat(lua): implement Iter:join() (#26416) --- runtime/doc/lua.txt | 13 +++++++++++++ runtime/lua/vim/iter.lua | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index a35d70cae8..f7f722bc0e 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3410,6 +3410,19 @@ Iter:fold({init}, {f}) *Iter:fold()* Return: ~ any +Iter:join({delim}) *Iter:join()* + Collect the iterator into a delimited string. + + Each element in the iterator is joined into a string separated by {delim}. + + Consumes the iterator. + + Parameters: ~ + • {delim} (string) Delimiter + + Return: ~ + (string) + Iter:last() *Iter:last()* Drains the iterator and returns the last item. diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index 874bdfb437..e9c2b66bf2 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -356,6 +356,18 @@ function ListIter.totable(self) return self._table end +--- Collect the iterator into a delimited string. +--- +--- Each element in the iterator is joined into a string separated by {delim}. +--- +--- Consumes the iterator. +--- +--- @param delim string Delimiter +--- @return string +function Iter.join(self, delim) + return table.concat(self:totable(), delim) +end + --- Folds ("reduces") an iterator into a single value. --- --- Examples: -- cgit From b95eba22ffa7a5103f60ccd90bc82f7b72524b3f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 5 Dec 2023 23:04:00 +0100 Subject: vim-patch:4e043b1fc7ee runtime(vim): Update syntax file and syntax test (vim/vim#13632) Add missing assignment operators (:let*=, :let/= and :let%=). https://github.com/vim/vim/commit/4e043b1fc7eeba2f726bbca3d50a4e872c8cb658 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index fcd50bccd2..b7ecd917ed 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -200,7 +200,7 @@ syn keyword vimAugroupKey contained aug[roup] " Operators: {{{2 " ========= syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar -syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(\" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup -- cgit From f64e4b43e1191ff30d902730f752875aa55682ce Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 6 Dec 2023 08:51:09 +0100 Subject: vim-patch:6863084d3bd0 runtime(fortran): update syntax and ftplugins closes: vim/vim#13629 https://github.com/vim/vim/commit/6863084d3bd044700973e6180ccb1a044566ec46 Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/doc/filetype.txt | 5 +- runtime/doc/indent.txt | 34 +++-- runtime/doc/syntax.txt | 109 ++++++-------- runtime/ftplugin/fortran.vim | 17 +-- runtime/indent/fortran.vim | 7 +- runtime/syntax/fortran.vim | 329 +++++++++++++++++++------------------------ 6 files changed, 216 insertions(+), 285 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index ed21dc1c37..115fc18cc5 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -530,8 +530,9 @@ FORTRAN *ft-fortran-plugin* Options: 'expandtab' is switched on to avoid tabs as required by the Fortran standards unless the user has set fortran_have_tabs in vimrc. -'textwidth' is set to 72 for fixed source format as required by the - Fortran standards and to 80 for free source format. +'textwidth' is set to 80 for fixed source format whereas it is set to 132 + for free source format. Setting the fortran_extended_line_length + variable increases the width to 132 for fixed source format. 'formatoptions' is set to break code and comment lines and to preserve long lines. You can format comments with |gq|. For further discussion of fortran_have_tabs and the method used for the diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 853facdaa0..1cd5c7b5f5 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -711,26 +711,25 @@ FORTRAN *ft-fortran-indent* Block if, select case, where, and forall constructs are indented. So are type, interface, associate, block, and enum constructs. The indenting of subroutines, functions, modules, and program blocks is optional. Comments, -labelled statements and continuation lines are indented if the Fortran is in +labeled statements, and continuation lines are indented if the Fortran is in free source form, whereas they are not indented if the Fortran is in fixed source form because of the left margin requirements. Hence manual indent -corrections will be necessary for labelled statements and continuation lines +corrections will be necessary for labeled statements and continuation lines when fixed source form is being used. For further discussion of the method used for the detection of source format see |ft-fortran-syntax|. Do loops ~ All do loops are left unindented by default. Do loops can be unstructured in -Fortran with (possibly multiple) loops ending on a labelled executable +Fortran with (possibly multiple) loops ending on a labeled executable statement of almost arbitrary type. Correct indentation requires -compiler-quality parsing. Old code with do loops ending on labelled statements -of arbitrary type can be indented with elaborate programs such as Tidy -(https://www.unb.ca/chem/ajit/f_tidy.htm). Structured do/continue loops are -also left unindented because continue statements are also used for purposes -other than ending a do loop. Programs such as Tidy can convert structured -do/continue loops to the do/enddo form. Do loops of the do/enddo variety can -be indented. If you use only structured loops of the do/enddo form, you should -declare this by setting the fortran_do_enddo variable in your vimrc as -follows > +compiler-quality parsing. Old code with do loops ending on labeled statements +of arbitrary type can be indented with elaborate programs such as Tidy. +Structured do/continue loops are also left unindented because continue +statements are used for purposes other than ending a do loop. Programs such +as Tidy can convert structured do/continue loops to the do/enddo form. Do +loops of the do/enddo variety can be indented. If you use only structured +loops of the do/enddo form, you should declare this by setting the +fortran_do_enddo variable in your vimrc as follows > let fortran_do_enddo=1 @@ -744,15 +743,14 @@ to get do loops indented in .f90 files and left alone in Fortran files with other extensions such as .for. Program units ~ -The indenting of program units (subroutines, functions, modules, and program -blocks) is enabled by default but can be suppressed if a lighter, screen-width -preserving indent style is desired. To suppress the indenting of program -units for all fortran files set the global fortran_indent_less variable in -your vimrc as follows > +Indenting of program units (subroutines, functions, modules, and program +blocks) can be increased by setting the variable fortran_indent_more and can +be decreased by setting the variable fortran_indent_less. These variables +can be set for all fortran files in your vimrc as follows > let fortran_indent_less=1 -A finer level of suppression can be achieved by setting the corresponding +A finer level of control can be achieved by setting the corresponding buffer-local variable as follows > let b:fortran_indent_less=1 diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index e1053b54f1..1d02e49071 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1554,7 +1554,15 @@ FORTRAN *fortran.vim* *ft-fortran-syntax* Default highlighting and dialect ~ Highlighting appropriate for Fortran 2008 is used by default. This choice should be appropriate for most users most of the time because Fortran 2008 is -almost a superset of previous versions (Fortran 2003, 95, 90, and 77). +almost a superset of previous versions (Fortran 2003, 95, 90, and 77). A +small number of features new to Fortran 2018 and Fortran 2023 are supported +and the complete transition to Fortran 2023 will be completed in the future. +A few legacy constructs deleted or declared obsolescent in recent Fortran +standards are highlighted as todo items. + +The syntax script no longer supports Fortran dialects. The variable +fortran_dialect is now silently ignored. Since computers are much faster now, +the variable fortran_more_precise is no longer needed and is silently ignored. Fortran source code form ~ Fortran code can be in either fixed or free source form. Note that the @@ -1563,10 +1571,8 @@ syntax highlighting will not be correct if the form is incorrectly set. When you create a new fortran file, the syntax script assumes fixed source form. If you always use free source form, then > :let fortran_free_source=1 -in your vimrc prior to the :syntax on command. If you always use fixed -source form, then > +If you always use fixed source form, then > :let fortran_fixed_source=1 -in your vimrc prior to the :syntax on command. If the form of the source code depends, in a non-standard way, upon the file extension, then it is most convenient to set fortran_free_source in a ftplugin @@ -1582,14 +1588,33 @@ neither of these variables have been set, the syntax script attempts to determine which source form has been used by examining the file extension using conventions common to the ifort, gfortran, Cray, NAG, and PathScale compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for -free-source). If none of this works, then the script examines the first five -columns of the first 500 lines of your file. If no signs of free source form -are detected, then the file is assumed to be in fixed source form. The -algorithm should work in the vast majority of cases. In some cases, such as a -file that begins with 500 or more full-line comments, the script may -incorrectly decide that the fortran code is in fixed form. If that happens, -just add a non-comment statement beginning anywhere in the first five columns -of the first twenty-five lines, save (:w) and then reload (:e!) the file. +free-source). No default is used for the .fpp and .ftn file extensions because +different compilers treat them differently. If none of this works, then the +script examines the first five columns of the first 500 lines of your file. If +no signs of free source form are detected, then the file is assumed to be in +fixed source form. The algorithm should work in the vast majority of cases. +In some cases, such as a file that begins with 500 or more full-line comments, +the script may incorrectly decide that the code is in fixed form. If that +happens, just add a non-comment statement beginning anywhere in the first five +columns of the first twenty-five lines, save (:w), and then reload (:e!) the +file. + +Vendor extensions ~ +Fixed-form Fortran requires a maximum line length of 72 characters but the +script allows a maximum line length of 80 characters as do all compilers +created in the last three decades. An even longer line length of 132 +characters is allowed if you set the variable fortran_extended_line_length +with a command such as > + :let fortran_extended_line_length=1 + +If you want additional highlighting of the CUDA Fortran extensions, you should +set the variable fortran_CUDA with a command such as > + :let fortran_CUDA=1 + +To activate recognition of some common, non-standard, vendor-supplied +intrinsics, you should set the variable fortran_vendor_intrinsics with a +command such as > + :let fortran_vendor_intrinsics=1 Tabs in fortran files ~ Tabs are not recognized by the Fortran standards. Tabs are not a good idea in @@ -1598,8 +1623,8 @@ Therefore, tabs are marked as errors. Nevertheless, some programmers like using tabs. If your fortran files contain tabs, then you should set the variable fortran_have_tabs in your vimrc with a command such as > :let fortran_have_tabs=1 -placed prior to the :syntax on command. Unfortunately, the use of tabs will -mean that the syntax file will not be able to detect incorrect margins. +Unfortunately, the use of tabs will mean that the syntax file will not be able +to detect incorrect margins. Syntax folding of fortran files ~ If you wish to use foldmethod=syntax, then you must first set the variable @@ -1611,8 +1636,8 @@ subprograms, block data subprograms, interface blocks, and modules. If you also set the variable fortran_fold_conditionals with a command such as > :let fortran_fold_conditionals=1 then fold regions will also be defined for do loops, if blocks, and select -case constructs. If you also set the variable -fortran_fold_multilinecomments with a command such as > +case constructs. If you also set the variable fortran_fold_multilinecomments +with a command such as > :let fortran_fold_multilinecomments=1 then fold regions will also be defined for three or more consecutive comment lines. Note that defining fold regions can be slow for large files. @@ -1623,58 +1648,6 @@ you set foldmethod=syntax. Comments or blank lines placed between two program units are not folded because they are seen as not belonging to any program unit. -More precise fortran syntax ~ -If you set the variable fortran_more_precise with a command such as > - :let fortran_more_precise=1 -then the syntax coloring will be more precise but slower. In particular, -statement labels used in do, goto and arithmetic if statements will be -recognized, as will construct names at the end of a do, if, select or forall -construct. - -Non-default fortran dialects ~ -The syntax script supports two Fortran dialects: f08 and F. You will probably -find the default highlighting (f08) satisfactory. A few legacy constructs -deleted or declared obsolescent in the 2008 standard are highlighted as todo -items. - -If you use F, the advantage of setting the dialect appropriately is that -other legacy features excluded from F will be highlighted as todo items and -that free source form will be assumed. - -The dialect can be selected in various ways. If all your fortran files use -the same dialect, set the global variable fortran_dialect in your vimrc prior -to your syntax on statement. The case-sensitive, permissible values of -fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are -ignored. - -If the dialect depends upon the file extension, then it is most convenient to -set a buffer-local variable in a ftplugin file. For more information on -ftplugin files, see |ftplugin|. For example, if all your fortran files with -an .f90 extension are written in the F subset, your ftplugin file should -contain the code > - let s:extfname = expand("%:e") - if s:extfname ==? "f90" - let b:fortran_dialect="F" - else - unlet! b:fortran_dialect - endif -Note that this will work only if the "filetype plugin indent on" command -precedes the "syntax on" command in your vimrc file. - -Finer control is necessary if the file extension does not uniquely identify -the dialect. You can override the default dialect, on a file-by-file basis, -by including a comment with the directive "fortran_dialect=xx" (where xx=F or -f08) in one of the first three lines in your file. For example, your older .f -files may be legacy code but your newer ones may be F codes, and you would -identify the latter by including in the first three lines of those files a -Fortran comment of the form > - ! fortran_dialect=F - -For previous versions of the syntax, you may have set fortran_dialect to the -now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be -silently handled as "f08". Users of "elf" may wish to experiment with "F" -instead. - The syntax/fortran.vim script contains embedded comments that tell you how to comment and/or uncomment some lines to (a) activate recognition of some non-standard, vendor-supplied intrinsics and (b) to prevent features deleted diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim index 8f5b243b82..a057db9a4b 100644 --- a/runtime/ftplugin/fortran.vim +++ b/runtime/ftplugin/fortran.vim @@ -1,7 +1,8 @@ " Vim settings file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66) -" Version: (v53) 2021 April 06 (updated 2022 May 22) -" Maintainer: Ajit J. Thakkar ; +" Version: (v54) 2023 December 5 +" Maintainers: Ajit J. Thakkar ; +" Joshua Hollett " Usage: For instructions, do :help fortran-plugin from Vim " Credits: " Version 0.1 was created in September 2000 by Ajit Thakkar. @@ -39,7 +40,7 @@ if !exists("b:fortran_fixed_source") " Fixed-form file extension defaults let b:fortran_fixed_source = 1 else - " Modern fortran still allows both fixed and free source form + " Modern fortran compilers still allow both fixed and free source form " Assume fixed source form unless signs of free source form " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines @@ -70,14 +71,14 @@ if (b:fortran_fixed_source == 1) " but some vendor extensions allow longer lines if exists("fortran_extended_line_length") setlocal tw=132 - elseif exists("fortran_cardimage_line_length") - setlocal tw=80 else - setlocal tw=72 + " The use of columns 73-80 for sequence numbers is obsolete + " so almost all compilers allow a textwidth of 80 + setlocal tw=80 " If you need to add "&" on continued lines so that the code is " compatible with both free and fixed format, then you should do so - " in column 73 and uncomment the next line - " setlocal tw=73 + " in column 81 and uncomment the next line + " setlocal tw=81 endif else setlocal comments=:! diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index 9623014818..7130658f59 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,7 +1,8 @@ " Vim indent file -" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: (v49) 2022 May 14 -" Maintainer: Ajit J. Thakkar ; +" Language: Fortran 2008 (and Fortran 2003, 95, 90, and 77) +" Version: (v49) 2023 December 1 +" Maintainers: Ajit J. Thakkar ; +" Joshua Hollett " Usage: For instructions, do :help fortran-indent from Vim " Credits: " Version 0.1 was created in September 2000 by Ajit Thakkar. diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index fc6c82b480..971a2b633d 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: (v105) 2023 August 14 -" Maintainer: Ajit J. Thakkar ; +" Language: Fortran 2008 (and Fortran 2003, 95, 90, and 77) +" Version: (v106) 2023 December 4 +" Maintainers: Ajit J. Thakkar ; +" Joshua Hollett " Usage: For instructions, do :help fortran-syntax from Vim " Credits: " Version 0.1 for Fortran 95 was created in April 2000 by Ajit Thakkar from an @@ -11,7 +12,8 @@ " Walter Dieudonne, Alexander Wagner, Roman Bertle, Charles Rendleman, " Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann, " Stefano Zaghi, Vishnu V. Krishnan, Judicael Grasset, Takuma Yoshida, -" Eisuke Kawashima, Andre Chalella, Fritz Reese, and Karl D. Hammond. +" Eisuke Kawashima, Andre Chalella, Fritz Reese, Karl D. Hammond, +" and Michele Esposito Marzino. if exists("b:current_syntax") finish @@ -20,34 +22,9 @@ endif let s:cpo_save = &cpo set cpo&vim -" Choose fortran_dialect using the priority: -" source file directive > buffer-local value > global value > file extension -" first try using directive in first three lines of file -let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3) -if b:fortran_retype =~? '\' - let b:fortran_dialect = "F" -elseif b:fortran_retype =~? '\' - let b:fortran_dialect = "f08" -elseif !exists("b:fortran_dialect") - if exists("g:fortran_dialect") && g:fortran_dialect =~# '\' - " try global variable - let b:fortran_dialect = g:fortran_dialect - else " nothing found, so use default - let b:fortran_dialect = "f08" - endif -endif -unlet! b:fortran_retype -" make sure buffer-local value is not invalid -if b:fortran_dialect !~# '\' - let b:fortran_dialect = "f08" -endif - " Choose between fixed and free source form if this hasn't been done yet if !exists("b:fortran_fixed_source") - if b:fortran_dialect == "F" - " F requires free source form - let b:fortran_fixed_source = 0 - elseif exists("fortran_free_source") + if exists("fortran_free_source") " User guarantees free source form for all fortran files let b:fortran_fixed_source = 0 elseif exists("fortran_fixed_source") @@ -60,7 +37,7 @@ if !exists("b:fortran_fixed_source") " Fixed-form file extension defaults let b:fortran_fixed_source = 1 else - " Modern fortran still allows both free and fixed source form. + " Modern fortran compilers still allow both free and fixed source form. " Assume fixed source form unless signs of free source form " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines @@ -91,32 +68,29 @@ if b:fortran_fixed_source == 1 else syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:" endif -if exists("fortran_more_precise") - syn match fortranConstructName "\(\" syn match fortranType "\" syn match fortranType "\" syn keyword fortranType intrinsic -syn match fortranType "\\s\+\(none\)\?" +syn match fortranType "\\s\+\(none\(\s\+\\)\?\)\?" syn keyword fortranStructure dimension syn keyword fortranStorageClass parameter save -syn match fortranUnitHeader "\" -syn keyword fortranCall call -syn match fortranUnitHeader "\" -syn match fortranUnitHeader "\" -syn match fortranUnitHeader "\" -syn keyword fortranKeyword return stop +syn match fortranCall "call\s\+\a\w*" +syn match fortranUnitHeader "\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\|block\)" +syn keyword fortranKeyword return +syn match fortranKeyword "\(error\s\+\)\=stop" syn keyword fortranConditional else then syn match fortranConditional "\" -syn match fortranConditionalOb "\" -syn keyword fortranTodo contained todo fixme +syn keyword fortranTodo contained bug note debug todo fixme "Catch errors caused by too many right parentheses syn region fortranParen transparent start="(" end=")" contains=ALLBUT,fortranParenError,@fortranCommentGroup,cIncluded,@spell @@ -141,8 +115,6 @@ endif syn match fortranIO '\%(\((\|,\|, *&\n\)\s*\)\@<=\(access\|blank\|direct\|exist\|file\|fmt\|form\|formatted\|iostat\|name\|named\|nextrec\|number\|opened\|rec\|recl\|sequential\|status\|unformatted\|unit\)\ze\s*=' -syn keyword fortranIntrinsicR alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl - " Intrinsics provided by some vendors syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh @@ -150,6 +122,11 @@ syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmpl syn match fortranIntrinsic "\\(\s\+is\>\)\?" syn match fortranType "^\s*\(type\s\+\(is\)\? \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" syn match fortranType "^\s*\(implicit \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" @@ -188,32 +165,28 @@ syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1 syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1 syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1 -if exists("fortran_more_precise") - " Numbers as targets - syn match fortranTarget display "\(\" - syn match fortranTarget display "\(\" - syn match fortranTarget display "\(\" -endif +" Numbers as targets +syn match fortranTarget display "\(\" +syn match fortranTarget display "\(\" +syn match fortranTarget display "\(\" syn keyword fortranTypeR external syn keyword fortranIOR format -syn match fortranKeywordR "\" +syn match fortranKeyword "\" syn match fortranKeyword "^\s*\d\+\s\+continue\>" syn match fortranKeyword "\" syn match fortranKeywordDel "\" syn match fortranStorageClass "\" -syn match fortranUnitHeader "\" syn keyword fortranUnitHeader use only contains syn keyword fortranUnitHeader result operator assignment syn match fortranUnitHeader "\" @@ -223,7 +196,7 @@ syn match fortranConditional "\" syn keyword fortranConditional where elsewhere syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" -syn match fortranOperator "=>" +syn match fortranOperator "\(%\|?\|=>\)" syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber syn keyword fortranIO pad position action delim readwrite @@ -233,25 +206,18 @@ syn match fortranIntrinsic '\<\(adjustl\|adjustr\|all\|allocated\|any\|associate syn match fortranIntrinsic "\\(\s*\.\)\@!"me=s+3 syn match fortranIntrinsic "\\s*[(,]"me=s+4 -syn match fortranUnitHeader "\" +syn match fortranType "\(end\s\+\)\?\(\" syn keyword fortranIOR namelist syn keyword fortranConditionalR while -syn keyword fortranIntrinsicR achar iachar transfer +syn keyword fortranIntrinsicR achar iachar transfer dble dprod dim lge lgt lle llt mod +syn keyword fortranIntrinsicOb alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl syn keyword fortranInclude include syn keyword fortranStorageClassR sequence @@ -263,63 +229,62 @@ syn match fortranConditional "\\(\s\+\a\w*\s*/\)\@=" +syn match fortranStorageClassOb "^\s*common\>\(\s*/\)\@=" +syn keyword fortranStorageClassOb equivalence syn match fortranOperatorR "\.\s*[gl][et]\s*\." syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." -syn keyword fortranRepeat forall -syn match fortranRepeat "\" syn match fortranType "\" syn match fortranType "\" syn match fortranType "\" -if exists("fortran_more_precise") - syn match fortranConstructName "\(\" -endif - -if b:fortran_dialect == "f08" - " F2003 - syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of - " ISO_C_binding - syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab - syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr - syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer - syn keyword fortranType c_ptr c_funptr - " ISO_Fortran_env - syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit - " IEEE_arithmetic - syn keyword fortranIntrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode - - syn keyword fortranReadWrite flush wait - syn keyword fortranIO decimal round iomsg - syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import - syn keyword fortranType non_intrinsic value bind deferred generic final enumerator - syn match fortranType "\" - syn match fortranType "\" - syn match fortranType "\" - syn match fortranType "\" - syn match fortranConditional "\" - syn match fortranUnitHeader "\" - syn match fortranOperator "\([\|]\)" - - " F2008 - syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 - syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits - syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image - syn keyword fortranIO newunit - syn keyword fortranType contiguous - syn keyword fortranRepeat concurrent +syn match fortranConstructNameOb "\(\" + +" F2003 +syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of +" ISO_C_binding +syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab +syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr +syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer +syn keyword fortranType c_ptr c_funptr +" ISO_Fortran_env +syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit +" IEEE_arithmetic +syn keyword fortranIntrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode + +syn keyword fortranReadWrite flush wait +syn keyword fortranIO decimal round iomsg +syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import +syn keyword fortranType non_intrinsic value bind deferred generic final enumerator +syn match fortranType "\" +syn match fortranType "\" +syn match fortranType "\" +syn match fortranType "\" +syn match fortranConditional "\" +syn match fortranUnitHeader "\" +syn match fortranOperator "\([\|]\)" + +" F2008 +syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 +syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits +syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image +syn keyword fortranIO newunit +syn keyword fortranType contiguous +syn keyword fortranRepeat concurrent " CUDA fortran +if exists("fortran_CUDA") syn match fortranTypeCUDA "\" - syn keyword fortranTypeCUDA host global device value + syn keyword fortranTypeCUDA host global device syn keyword fortranTypeCUDA shared constant pinned texture syn keyword fortranTypeCUDA dim1 dim2 dim3 dim4 syn keyword fortranTypeCUDA cudadeviceprop cuda_count_kind cuda_stream_kind @@ -349,10 +314,10 @@ if b:fortran_dialect == "f08" syn keyword fortranIntrinsicCUDA cudaHostAlloc cudaHostGetDevicePointer cudaHostGetFlags cudaHostRegister cudaHostUnregister cudaMalloc cudaMallocArray cudaMallocHost cudaMallocPitch cudaMalloc3D cudaMalloc3DArray syn keyword fortranIntrinsicCUDA cudaMemcpy cudaMemcpyArraytoArray cudaMemcpyAsync cudaMemcpyFromArray cudaMemcpyFromSymbol cudaMemcpyFromSymbolAsync cudaMemcpyPeer cudaMemcpyPeerAsync cudaMemcpyToArray cudaMemcpyToSymbol cudaMemcpyToSymbolAsync cudaMemcpy2D cudaMemcpy2DArrayToArray cudaMemcpy2DAsync cudaMemcpy2DFromArray cudaMemcpy2DToArray cudaMemcpy3D cudaMemcpy3DAsync syn keyword fortranIntrinsicCUDA cudaMemGetInfo cudaMemset cudaMemset2D cudaMemset3D cudaDeviceCanAccessPeer cudaDeviceDisablePeerAccess cudaDeviceEnablePeerAccess cudaPointerGetAttributes cudaDriverGetVersion cudaRuntimeGetVersion - - syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none endif +syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none + syn cluster fortranCommentGroup contains=fortranTodo if (b:fortran_fixed_source == 1) @@ -391,7 +356,7 @@ syn match cIncluded contained "<[^>]*>" syn match cInclude "^\s*#\s*include\>\s*["<]" contains=cIncluded "Synchronising limits assume that comment and continuation lines are not mixed -if exists("fortran_fold") || exists("fortran_more_precise") +if exists("fortran_fold") syn sync fromstart elseif (b:fortran_fixed_source == 0) syn sync linecont "&" minlines=30 @@ -447,79 +412,71 @@ if exists("fortran_fold") endif " Define the default highlighting. -" The default highlighting differs for each dialect. " Transparent groups: " fortranParen, fortranLeftMargin " fortranProgram, fortranModule, fortranSubroutine, fortranFunction, " fortranBlockData " fortran77Loop, fortran90Loop, fortranIfBlock, fortranCase " fortranMultiCommentLines -hi def link fortranKeyword Keyword +hi def link fortranKeyword Keyword hi def link fortranConstructName Identifier -hi def link fortranConditional Conditional -hi def link fortranRepeat Repeat -hi def link fortranTodo Todo -hi def link fortranContinueMark Special -hi def link fortranString String -hi def link fortranNumber Number -hi def link fortranBinary Number -hi def link fortranOctal Number -hi def link fortranHex Number -hi def link fortranOperator Operator -hi def link fortranBoolean Boolean -hi def link fortranLabelError Error -hi def link fortranObsolete Todo -hi def link fortranType Type -hi def link fortranStructure Type -hi def link fortranStorageClass StorageClass -hi def link fortranCall Function -hi def link fortranUnitHeader fortranPreCondit -hi def link fortranReadWrite Keyword -hi def link fortranIO Keyword -hi def link fortranIntrinsic Function -hi def link fortranConstant Constant - -" To stop deleted & obsolescent features being highlighted as Todo items, -" comment out the next 5 lines and uncomment the 5 lines after that -hi def link fortranUnitHeaderOb fortranObsolete -hi def link fortranKeywordOb fortranObsolete -hi def link fortranConditionalOb fortranObsolete -hi def link fortranTypeOb fortranObsolete -hi def link fortranKeywordDel fortranObsolete -"hi def link fortranUnitHeaderOb fortranUnitHeader -"hi def link fortranKeywordOb fortranKeyword -"hi def link fortranConditionalOb fortranConditional -"hi def link fortranTypeOb fortranType -"hi def link fortranKeywordDel fortranKeyword - -if b:fortran_dialect == "F" - hi! def link fortranIntrinsicR fortranObsolete - hi! def link fortranUnitHeaderR fortranObsolete - hi! def link fortranTypeR fortranObsolete - hi! def link fortranStorageClassR fortranObsolete - hi! def link fortranOperatorR fortranObsolete - hi! def link fortranInclude fortranObsolete - hi! def link fortranLabelNumber fortranObsolete - hi! def link fortranTarget fortranObsolete - hi! def link fortranFloatIll fortranObsolete - hi! def link fortranIOR fortranObsolete - hi! def link fortranKeywordR fortranObsolete - hi! def link fortranStringR fortranObsolete - hi! def link fortranConditionalR fortranObsolete +hi def link fortranConditional Conditional +hi def link fortranRepeat Repeat +hi def link fortranTodo Todo +hi def link fortranContinueMark Special +hi def link fortranString String +hi def link fortranNumber Number +hi def link fortranBinary Number +hi def link fortranOctal Number +hi def link fortranHex Number +hi def link fortranOperator Operator +hi def link fortranBoolean Boolean +hi def link fortranLabelError Error +hi def link fortranObsolete Todo +hi def link fortranType Type +hi def link fortranStructure Type + +hi def link fortranStorageClass StorageClass +hi def link fortranIntrinsic Function +hi def link fortranCall Function +hi def link fortranUserUnit Function +hi def link fortranUnitHeader fortranPreCondit +hi def link fortranReadWrite Keyword +hi def link fortranIO Keyword +hi def link fortranConstant Constant + +hi def link fortranInclude Include +hi def link fortranLabelNumber Special +hi def link fortranTarget Special +hi def link fortranFloatIll fortranFloat + +" Redundant features which may one day become obsolescent +hi def link fortranIntrinsicR fortranIntrinsic +hi def link fortranTypeR fortranType +hi def link fortranStorageClassR fortranStorageClass +hi def link fortranOperatorR fortranOperator +hi def link fortranIOR fortranIO +hi def link fortranConditionalR fortranConditional + +" features deleted or declared obsolescent in Fortran 2023 +if (b:fortran_fixed_source == 1) + hi def link fortranUnitHeaderOb fortranUnitHeader + hi def link fortranKeywordOb fortranKeyword + hi def link fortranKeywordDel fortranKeyword + hi def link fortranConditionalDel fortranConditional + hi def link fortranTypeOb fortranType + hi def link fortranStorageClassOb fortranStorageClass + hi def link fortranRepeatOb fortranRepeat + hi def link fortranIntrinsicOb fortranIntrinsic else - hi! def link fortranIntrinsicR fortranIntrinsic - hi! def link fortranUnitHeaderR fortranPreCondit - hi! def link fortranTypeR fortranType - hi! def link fortranStorageClassR fortranStorageClass - hi! def link fortranOperatorR fortranOperator - hi! def link fortranInclude Include - hi! def link fortranLabelNumber Special - hi! def link fortranTarget Special - hi! def link fortranFloatIll fortranFloat - hi! def link fortranIOR fortranIO - hi! def link fortranKeywordR fortranKeyword - hi! def link fortranStringR fortranString - hi! def link fortranConditionalR fortranConditional + hi def link fortranUnitHeaderOb fortranObsolete + hi def link fortranKeywordOb fortranObsolete + hi def link fortranKeywordDel fortranObsolete + hi def link fortranConditionalDel fortranObsolete + hi def link fortranTypeOb fortranObsolete + hi def link fortranStorageClassOb fortranObsolete + hi def link fortranRepeatOb fortranObsolete + hi def link fortranIntrinsicOb fortranObsolete endif hi def link fortranFormatSpec Identifier -- cgit From e057b38e7037808b3593fb1035794595b4e4a45e Mon Sep 17 00:00:00 2001 From: Emanuel Date: Wed, 6 Dec 2023 16:56:04 +0100 Subject: fix(json): allow objects with empty keys #25564 Problem: Empty string is a valid JSON key, but json_decode() treats an object with empty key as ":help msgpack-special-dict". #20757 :echo json_decode('{"": "1"}') {'_TYPE': [], '_VAL': [['', '1']]} Note: vim returns `{'': '1'}`. Solution: Allow empty string as an object key. Note that we still (currently) disallow empty keys in object_to_vim() (since 7c01d5ff9286d262097484c680e3a4eab49e2911): https://github.com/neovim/neovim/blob/f64e4b43e1191ff30d902730f752875aa55682ce/src/nvim/api/private/converter.c#L333-L334 Fix #20757 Co-authored-by: Justin M. Keyes --- runtime/doc/builtin.txt | 4 +--- runtime/lua/vim/_meta/vimfn.lua | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 6ffb514487..4b0da06971 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -3873,8 +3873,7 @@ json_decode({expr}) *json_decode()* Vim value. In the following cases it will output |msgpack-special-dict|: 1. Dictionary contains duplicate key. - 2. Dictionary contains empty key. - 3. String contains NUL byte. Two special dictionaries: for + 2. String contains NUL byte. Two special dictionaries: for dictionary and for string will be emitted in case string with NUL byte was a dictionary key. @@ -4954,7 +4953,6 @@ msgpackparse({data}) *msgpackparse()* are binary strings). 2. String with NUL byte inside. 3. Duplicate key. - 4. Empty key. ext |List| with two values: first is a signed integer representing extension type. Second is |readfile()|-style list of strings. diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 05e5b2b871..7234b813b6 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -4678,8 +4678,7 @@ function vim.fn.join(list, sep) end --- Vim value. In the following cases it will output --- |msgpack-special-dict|: --- 1. Dictionary contains duplicate key. ---- 2. Dictionary contains empty key. ---- 3. String contains NUL byte. Two special dictionaries: for +--- 2. String contains NUL byte. Two special dictionaries: for --- dictionary and for string will be emitted in case string --- with NUL byte was a dictionary key. --- @@ -5922,7 +5921,6 @@ function vim.fn.msgpackdump(list, type) end --- are binary strings). --- 2. String with NUL byte inside. --- 3. Duplicate key. ---- 4. Empty key. --- ext |List| with two values: first is a signed integer --- representing extension type. Second is --- |readfile()|-style list of strings. -- cgit From 2613ba5000d4c0d9b15e2eec2d2b97615575925e Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 5 Dec 2023 10:01:32 -0800 Subject: feat(defaults): enable 'termguicolors' by default when supported by terminal Enable 'termguicolors' automatically when Nvim can detect that truecolor is supported by the host terminal. If $COLORTERM is set to "truecolor" or "24bit", or the terminal's terminfo entry contains capabilities for Tc, RGB, or setrgbf and setrgbb, then we assume that the terminal supports truecolor. Otherwise, the terminal is queried (using both XTGETTCAP and SGR + DECRQSS). If the terminal's response to these queries (if any) indicates that it supports truecolor, then 'termguicolors' is enabled. --- runtime/doc/news.txt | 3 + runtime/doc/options.txt | 4 + runtime/doc/vim_diff.txt | 2 + runtime/lua/vim/_defaults.lua | 255 +++++++++++++++++++++++++++----------- runtime/lua/vim/_meta.lua | 1 + runtime/lua/vim/_meta/options.lua | 4 + runtime/lua/vim/termcap.lua | 52 ++++++-- runtime/plugin/osc52.lua | 8 +- 8 files changed, 242 insertions(+), 87 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index e38707fa76..3006287e62 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -98,6 +98,9 @@ The following changes may require adaptations in user config or plugins. • Default color scheme has been updated to be "Neovim branded" and accessible. Use `:colorscheme vim` to revert to the old legacy color scheme. +• 'termguicolors' is enabled by default when Nvim is able to determine that + the host terminal emulator supports 24-bit color. + ============================================================================== BREAKING CHANGES IN HEAD *news-breaking-dev* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f47093782c..355c8cc99a 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6495,6 +6495,10 @@ A jump table for the options with a short description can be found at |Q_op|. attributes instead of "cterm" attributes. |guifg| Requires an ISO-8613-3 compatible terminal. + Nvim will automatically attempt to determine if the host terminal + supports 24-bit color and will enable this option if it does + (unless explicitly disabled by the user). + *'termpastefilter'* *'tpf'* 'termpastefilter' 'tpf' string (default "BS,HT,ESC,DEL") global diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index f6dfe3b14a..220505f573 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -75,6 +75,8 @@ Defaults *nvim-defaults* - 'switchbuf' defaults to "uselast" - 'tabpagemax' defaults to 50 - 'tags' defaults to "./tags;,tags" +- 'termguicolors' is enabled by default if Nvim can detect support from the + host terminal - 'ttimeoutlen' defaults to 50 - 'ttyfast' is always set - 'undodir' defaults to ~/.local/state/nvim/undo// (|xdg|), auto-created diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index c3bb36fc36..b73681be04 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -165,91 +165,92 @@ do }) end ---- Guess value of 'background' based on terminal color. ---- ---- We write Operating System Command (OSC) 11 to the terminal to request the ---- terminal's background color. We then wait for a response. If the response ---- matches `rgba:RRRR/GGGG/BBBB/AAAA` where R, G, B, and A are hex digits, then ---- compute the luminance[1] of the RGB color and classify it as light/dark ---- accordingly. Note that the color components may have anywhere from one to ---- four hex digits, and require scaling accordingly as values out of 4, 8, 12, ---- or 16 bits. Also note the A(lpha) component is optional, and is parsed but ---- ignored in the calculations. ---- ---- [1] https://en.wikipedia.org/wiki/Luma_%28video%29 -do - --- Parse a string of hex characters as a color. - --- - --- The string can contain 1 to 4 hex characters. The returned value is - --- between 0.0 and 1.0 (inclusive) representing the intensity of the color. - --- - --- For instance, if only a single hex char "a" is used, then this function - --- returns 0.625 (10 / 16), while a value of "aa" would return 0.664 (170 / - --- 256). - --- - --- @param c string Color as a string of hex chars - --- @return number? Intensity of the color - local function parsecolor(c) - if #c == 0 or #c > 4 then - return nil - end - - local val = tonumber(c, 16) - if not val then - return nil - end - - local max = tonumber(string.rep('f', #c), 16) - return val / max +-- Only do the following when the TUI is attached +local tty = nil +for _, ui in ipairs(vim.api.nvim_list_uis()) do + if ui.chan == 1 and ui.stdout_tty then + tty = ui + break end +end - --- Parse an OSC 11 response - --- - --- Either of the two formats below are accepted: - --- - --- OSC 11 ; rgb:// - --- - --- or - --- - --- OSC 11 ; rgba:/// +if tty then + --- Guess value of 'background' based on terminal color. --- - --- where + --- We write Operating System Command (OSC) 11 to the terminal to request the + --- terminal's background color. We then wait for a response. If the response + --- matches `rgba:RRRR/GGGG/BBBB/AAAA` where R, G, B, and A are hex digits, then + --- compute the luminance[1] of the RGB color and classify it as light/dark + --- accordingly. Note that the color components may have anywhere from one to + --- four hex digits, and require scaling accordingly as values out of 4, 8, 12, + --- or 16 bits. Also note the A(lpha) component is optional, and is parsed but + --- ignored in the calculations. --- - --- , , , := h | hh | hhh | hhhh - --- - --- The alpha component is ignored, if present. - --- - --- @param resp string OSC 11 response - --- @return string? Red component - --- @return string? Green component - --- @return string? Blue component - local function parseosc11(resp) - local r, g, b - r, g, b = resp:match('^\027%]11;rgb:(%x+)/(%x+)/(%x+)$') - if not r and not g and not b then - local a - r, g, b, a = resp:match('^\027%]11;rgba:(%x+)/(%x+)/(%x+)/(%x+)$') - if not a or #a > 4 then - return nil, nil, nil + --- [1] https://en.wikipedia.org/wiki/Luma_%28video%29 + do + --- Parse a string of hex characters as a color. + --- + --- The string can contain 1 to 4 hex characters. The returned value is + --- between 0.0 and 1.0 (inclusive) representing the intensity of the color. + --- + --- For instance, if only a single hex char "a" is used, then this function + --- returns 0.625 (10 / 16), while a value of "aa" would return 0.664 (170 / + --- 256). + --- + --- @param c string Color as a string of hex chars + --- @return number? Intensity of the color + local function parsecolor(c) + if #c == 0 or #c > 4 then + return nil end - end - if r and g and b and #r <= 4 and #g <= 4 and #b <= 4 then - return r, g, b + local val = tonumber(c, 16) + if not val then + return nil + end + + local max = tonumber(string.rep('f', #c), 16) + return val / max end - return nil, nil, nil - end + --- Parse an OSC 11 response + --- + --- Either of the two formats below are accepted: + --- + --- OSC 11 ; rgb:// + --- + --- or + --- + --- OSC 11 ; rgba:/// + --- + --- where + --- + --- , , , := h | hh | hhh | hhhh + --- + --- The alpha component is ignored, if present. + --- + --- @param resp string OSC 11 response + --- @return string? Red component + --- @return string? Green component + --- @return string? Blue component + local function parseosc11(resp) + local r, g, b + r, g, b = resp:match('^\027%]11;rgb:(%x+)/(%x+)/(%x+)$') + if not r and not g and not b then + local a + r, g, b, a = resp:match('^\027%]11;rgba:(%x+)/(%x+)/(%x+)/(%x+)$') + if not a or #a > 4 then + return nil, nil, nil + end + end + + if r and g and b and #r <= 4 and #g <= 4 and #b <= 4 then + return r, g, b + end - local tty = false - for _, ui in ipairs(vim.api.nvim_list_uis()) do - if ui.chan == 1 and ui.stdout_tty then - tty = true - break + return nil, nil, nil end - end - if tty then local timer = assert(vim.uv.new_timer()) ---@param bg string New value of the 'background' option @@ -300,7 +301,7 @@ do io.stdout:write('\027]11;?\007') timer:start(1000, 0, function() - -- No response received. Delete the autocommand + -- Delete the autocommand if no response was received vim.schedule(function() -- Suppress error if autocommand has already been deleted pcall(vim.api.nvim_del_autocmd, id) @@ -311,4 +312,108 @@ do end end) end + + --- If the TUI (term_has_truecolor) was able to determine that the host + --- terminal supports truecolor, enable 'termguicolors'. Otherwise, query the + --- terminal (using both XTGETTCAP and SGR + DECRQSS). If the terminal's + --- 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 + vim.o.termguicolors = true + else + --- Enable 'termguicolors', but only if it was not already set by the user. + local function settgc() + if not vim.api.nvim_get_option_info2('termguicolors', {}).was_set then + vim.o.termguicolors = true + end + end + + local caps = {} ---@type table + require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found) + if not found then + return + end + + caps[cap] = true + if caps.Tc or caps.RGB or (caps.setrgbf and caps.setrgbb) then + settgc() + end + end) + + local timer = assert(vim.uv.new_timer()) + + -- Arbitrary colors to set in the SGR sequence + local r = 1 + local g = 2 + local b = 3 + + local id = vim.api.nvim_create_autocmd('TermResponse', { + nested = true, + callback = function(args) + local resp = args.data ---@type string + local decrqss = resp:match('^\027P1%$r([%d;:]+)m$') + + if decrqss then + -- The DECRQSS SGR response first contains attributes separated by + -- semicolons, followed by the SGR itself with parameters separated + -- by colons. Some terminals include "0" in the attribute list + -- unconditionally; others do not. Our SGR sequence did not set any + -- attributes, so there should be no attributes in the list. + local attrs = vim.split(decrqss, ';') + if #attrs ~= 1 and (#attrs ~= 2 or attrs[1] ~= '0') then + return true + end + + -- The returned SGR sequence should begin with 48:2 + local sgr = attrs[#attrs]:match('^48:2:([%d:]+)$') + if not sgr then + return true + end + + -- The remaining elements of the SGR sequence should be the 3 colors + -- we set. Some terminals also include an additional parameter + -- (which can even be empty!), so handle those cases as well + local params = vim.split(sgr, ':') + if #params ~= 3 and (#params ~= 4 or (params[1] ~= '' and params[1] ~= '1')) then + return true + end + + if + tonumber(params[#params - 2]) == r + and tonumber(params[#params - 1]) == g + and tonumber(params[#params]) == b + then + settgc() + end + + return true + end + end, + }) + + -- Write SGR followed by DECRQSS. This sets the background color then + -- immediately asks the terminal what the background color is. If the + -- terminal responds to the DECRQSS with the same SGR sequence that we + -- sent then the terminal supports truecolor. + local decrqss = '\027P$qm\027\\' + if os.getenv('TMUX') then + decrqss = string.format('\027Ptmux;%s\027\\', decrqss:gsub('\027', '\027\027')) + end + io.stdout:write(string.format('\027[48;2;%d;%d;%dm%s', r, g, b, decrqss)) + + timer:start(1000, 0, function() + -- Delete the autocommand if no response was received + vim.schedule(function() + -- Suppress error if autocommand has already been deleted + pcall(vim.api.nvim_del_autocmd, id) + end) + + if not timer:is_closing() then + timer:close() + end + end) + end + end end diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index e3b99f6b3d..bb9ed722e2 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -20,6 +20,7 @@ vim.lsp = require('vim.lsp') vim.re = require('vim.re') vim.secure = require('vim.secure') vim.snippet = require('vim.snippet') +vim.text = require('vim.text') vim.treesitter = require('vim.treesitter') vim.ui = require('vim.ui') vim.version = require('vim.version') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index d2bdab4d28..5e65ca6b1b 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6941,6 +6941,10 @@ vim.go.tbidi = vim.go.termbidi --- attributes instead of "cterm" attributes. `guifg` --- Requires an ISO-8613-3 compatible terminal. --- +--- Nvim will automatically attempt to determine if the host terminal +--- supports 24-bit color and will enable this option if it does +--- (unless explicitly disabled by the user). +--- --- @type boolean vim.o.termguicolors = false vim.o.tgc = vim.o.termguicolors diff --git a/runtime/lua/vim/termcap.lua b/runtime/lua/vim/termcap.lua index 862cc52149..b88d9ac9ba 100644 --- a/runtime/lua/vim/termcap.lua +++ b/runtime/lua/vim/termcap.lua @@ -12,7 +12,10 @@ local M = {} --- emulator supports the XTGETTCAP sequence. --- --- @param caps string|table A terminal capability or list of capabilities to query ---- @param cb function(cap:string, seq:string) Function to call when a response is received +--- @param cb function(cap:string, found:bool, seq:string?) Callback function which is called for +--- each capability in {caps}. {found} is set to true if the capability was found or false +--- otherwise. {seq} is the control sequence for the capability if found, or nil for +--- boolean capabilities. function M.query(caps, cb) vim.validate({ caps = { caps, { 'string', 'table' } }, @@ -23,21 +26,33 @@ function M.query(caps, cb) caps = { caps } end - local count = #caps + local pending = {} ---@type table + for _, v in ipairs(caps) do + pending[v] = true + end + + local timer = assert(vim.uv.new_timer()) - vim.api.nvim_create_autocmd('TermResponse', { + local id = vim.api.nvim_create_autocmd('TermResponse', { callback = function(args) local resp = args.data ---@type string - local k, v = resp:match('^\027P1%+r(%x+)=(%x+)$') - if k and v then + local k, rest = resp:match('^\027P1%+r(%x+)(.*)$') + if k and rest then local cap = vim.text.hexdecode(k) - local seq = - vim.text.hexdecode(v):gsub('\\E', '\027'):gsub('%%p%d', ''):gsub('\\(%d+)', string.char) + local seq ---@type string? + if rest:match('^=%x+$') then + seq = vim.text + .hexdecode(rest:sub(2)) + :gsub('\\E', '\027') + :gsub('%%p%d', '') + :gsub('\\(%d+)', string.char) + end + + cb(cap, true, seq) - cb(cap, seq) + pending[cap] = nil - count = count - 1 - if count == 0 then + if next(pending) == nil then return true end end @@ -57,6 +72,23 @@ function M.query(caps, cb) end io.stdout:write(query) + + timer:start(1000, 0, function() + -- Delete the autocommand if no response was received + vim.schedule(function() + -- Suppress error if autocommand has already been deleted + pcall(vim.api.nvim_del_autocmd, id) + + -- Call the callback for all capabilities that were not found + for k in pairs(pending) do + cb(k, false, nil) + end + end) + + if not timer:is_closing() then + timer:close() + end + end) end return M diff --git a/runtime/plugin/osc52.lua b/runtime/plugin/osc52.lua index 374b70066f..7a90518966 100644 --- a/runtime/plugin/osc52.lua +++ b/runtime/plugin/osc52.lua @@ -6,7 +6,11 @@ if not tty or vim.g.clipboard ~= nil or vim.o.clipboard ~= '' or not os.getenv(' return end -require('vim.termcap').query('Ms', function(cap, seq) +require('vim.termcap').query('Ms', function(cap, found, seq) + if not found then + return + end + assert(cap == 'Ms') -- Check 'clipboard' and g:clipboard again to avoid a race condition @@ -16,7 +20,7 @@ require('vim.termcap').query('Ms', function(cap, seq) -- If the terminal reports a sequence other than OSC 52 for the Ms capability -- then ignore it. We only support OSC 52 (for now) - if not seq:match('^\027%]52') then + if not seq or not seq:match('^\027%]52') then return end -- cgit From a1bdf2852d6d848e5b4522f9a66d53e9296c1872 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Fri, 8 Dec 2023 12:23:46 -0800 Subject: fix(snippet): remove misleading comment about TM_FILENAME_BASE (#26465) --- runtime/lua/vim/snippet.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua index 32a8ea0b0d..ac25fb6a2d 100644 --- a/runtime/lua/vim/snippet.lua +++ b/runtime/lua/vim/snippet.lua @@ -42,9 +42,7 @@ local function resolve_variable(var, default) elseif var == 'TM_FILENAME' then return expand_or_default('%:t') elseif var == 'TM_FILENAME_BASE' then - -- Not using '%:t:r' since we want to remove all extensions. - local filename_base = expand_or_default('%:t'):gsub('%.[^%.]*$', '') - return filename_base + return expand_or_default('%:t:r') elseif var == 'TM_DIRECTORY' then return expand_or_default('%:p:h:t') elseif var == 'TM_FILEPATH' then -- cgit From f45bf44176461992e7ed7c381aa9750e8955517f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Dec 2023 07:45:31 +0800 Subject: vim-patch:ff0baca86523 (#26476) runtime(syntax): unlet b:filetype_in_cpp_family for cpp & squirrel Update runtime/syntax/cpp.vim and runtime/syntax/squirrel.vim to unlet b:filetype_in_cpp_family as it remains set even after updating the ft of a file manually or through a modeline, not allowing c specific keywords to be highlighted. Since the variable b:filetype_in_cpp_family is only used by the c.vim syntax script, unlet it directly after sourcing the c.vim runtime file instead of at the end of the script. Also update the last Change Header for both files. closes: vim/vim#13650 https://github.com/vim/vim/commit/ff0baca86523f1e8c6ea593ec0ef2f9860f001d0 Co-authored-by: laburnumT --- runtime/syntax/cpp.vim | 3 ++- runtime/syntax/squirrel.vim | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 5437580a0a..8daf90a33c 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -2,7 +2,7 @@ " Language: C++ " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan -" Last Change: 2021 Aug 23 +" Last Change: 2023 Dec 08 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -15,6 +15,7 @@ let b:filetype_in_cpp_family = 1 " Read the C syntax to start with runtime! syntax/c.vim unlet b:current_syntax +unlet b:filetype_in_cpp_family " C++ extensions syn keyword cppStatement new delete this friend using diff --git a/runtime/syntax/squirrel.vim b/runtime/syntax/squirrel.vim index 81d59cc986..85bdd87d9e 100644 --- a/runtime/syntax/squirrel.vim +++ b/runtime/syntax/squirrel.vim @@ -2,7 +2,7 @@ " Language: squirrel " Current Maintainer: Matt Dunford (zenmatic@gmail.com) " URL: https://github.com/zenmatic/vim-syntax-squirrel -" Last Change: 2021 Nov 28 +" Last Change: 2023 Dec 08 " http://squirrel-lang.org/ @@ -17,6 +17,7 @@ let b:filetype_in_cpp_family = 1 " Read the C syntax to start with runtime! syntax/c.vim unlet b:current_syntax +unlet b:filetype_in_cpp_family " squirrel extensions syn keyword squirrelStatement delete this in yield resume base clone -- cgit From 29aa4dd10af74d29891cb293dc9ff393e9dba11f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Dec 2023 15:35:45 +0800 Subject: vim-patch:61e984e212ed (#26484) runtime(doc): link cmdline completion to to |wildcards| and fix typos (vim/vim#13636) The docs for cmdline completion doesn't mention that [abc] is considered a wildcard, and |wildcards| contains more detailed information, so just link to it. Also fix some typos in other help files. https://github.com/vim/vim/commit/61e984e212ed19774e088868c30c2d03c4e5a0cf --- runtime/doc/cmdline.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 8bed8a9ffc..57a4223c53 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -439,9 +439,8 @@ CTRL-T When 'incsearch' is set, entering a search pattern for "/" or keyboard T is above G. The 'wildchar' option defaults to (CTRL-E when in Vi compatible mode; in -a previous version was used). In the pattern standard wildcards "*" and -'?' are accepted when matching file names. "*" matches any string, '?' -matches exactly one character. +a previous version was used). In the pattern standard |wildcards| are +accepted when matching file names. When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually ending up back to what was typed. If the first match is not what you wanted, -- cgit From c675e51c2f3f8bf46457a3f6653af06a2a946f69 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 9 Dec 2023 11:45:42 +0100 Subject: docs(news): very, very minorly * fix garbled item for new treesitter injection format * add missing item for new `vim.lpeg` and `vim.re` * use taglinks where possible * remove redundant "Added" and "Removed" from items --- runtime/doc/news.txt | 75 ++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 35 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 3006287e62..95d6b7a2f6 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -71,9 +71,6 @@ The following changes may require adaptations in user config or plugins. now requires an explicit range argument to be passed. If injections are required, provide an explicit range via `parser:parse({ start_row, end_row })`. -• Float window support hide and show by setting `hide` on `nvim_open_win` and - `nvim_win_set_config`. - • |vim.lsp.util.parse_snippet()| will now strictly follow the snippet grammar defined by LSP, and hence previously parsed snippets might now be considered invalid input. @@ -125,14 +122,14 @@ The following new APIs and features were added. • |vim.iter()| provides a generic iterator interface for tables and Lua iterators |for-in|. -• Added |vim.ringbuf()| to create ring buffers. +• |vim.ringbuf()| creates ring buffers. -• Added |vim.keycode()| for translating keycodes in a string. +• |vim.keycode()| translates keycodes in a string. • |'smoothscroll'| option to scroll by screen line rather than by text line when |'wrap'| is set. -• Added inline virtual text support to |nvim_buf_set_extmark()|. +• |nvim_buf_set_extmark()| supports inline virtual text. • 'foldtext' now supports virtual text format. |fold-foldtext| @@ -142,7 +139,10 @@ The following new APIs and features were added. • |vim.system()| for running system commands. -• Added |nvim_win_text_height()| to compute the number of screen lines occupied +• |vim.lpeg| and |vim.re| expose the bundled Lpeg expression grammar parser + and its regex interface. + +• |nvim_win_text_height()| computes the number of screen lines occupied by a range of text in a given window. • |nvim_set_keymap()| and |nvim_del_keymap()| now support abbreviations. @@ -164,7 +164,7 @@ The following new APIs and features were added. https://microsoft.github.io/language-server-protocol/specification/#textDocument_inlayHint • Implemented pull diagnostic textDocument/diagnostic: |vim.lsp.diagnostic.on_diagnostic()| https://microsoft.github.io/language-server-protocol/specification/#textDocument_diagnostic - • Added |vim.lsp.status()| to consume the last progress messages as a string. + • |vim.lsp.status()| consumes the last progress messages as a string. • LSP client now always saves and restores named buffer marks when applying text edits. • LSP client now supports the `positionEncoding` server capability. If a server @@ -175,25 +175,29 @@ The following new APIs and features were added. indicator to see if a server supports a feature. Instead use `client.supports_method()`. It considers both the dynamic capabilities and static `server_capabilities`. - • Added a new `anchor_bias` option to |lsp-handlers| to aid in positioning of - floating windows. + • `anchor_bias` option to |lsp-handlers| aids in positioning of floating + windows. + • |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to + the original LSP `Location` or `LocationLink`. • Treesitter • Bundled parsers and queries (highlight, folds) for Markdown, Python, and Bash. - • Added |vim.treesitter.query.omnifunc()| for treesitter query files (set by + • |vim.treesitter.query.omnifunc()| for treesitter query files (set by default). • |Query:iter_matches()| now has the ability to set the maximum start depth for matches. - • `@injection.language` now has smarter resolution and will now fallback to language aliases and/or attempt lower case variants of the text. - language via aliases (e.g., filetype) registered via - `vim.treesitter.language.register`. - • The `#set!` directive now supports `injection.self` and `injection.parent` for injecting either the current node's language - or the parent LanguageTree's language, respectively. - • Added `vim.treesitter.query.edit()`, for live editing of treesitter + • `@injection.language` now has smarter resolution and will fall back to + language aliases (e.g., filetype or custom shorthands) registered via + |vim.treesitter.language.register()| and/or attempt lower case variants of + the text. + • The `#set!` directive now supports `injection.self` and `injection.parent` + for injecting either the current node's language or the parent + |LanguageTree|'s language, respectively. + • |vim.treesitter.query.edit()| allows live editing of treesitter queries. • Improved error messages for query parsing. - • Added |vim.treesitter.foldtext()| to apply treesitter highlighting to + • |vim.treesitter.foldtext()| applies treesitter highlighting to foldtext. • |vim.ui.open()| opens URIs using the system default handler (macOS `open`, @@ -212,28 +216,28 @@ The following new APIs and features were added. • Functions that take a severity as an optional parameter (e.g. |vim.diagnostic.get()|) now also accept a list of severities |vim.diagnostic.severity| -• New RPC client type `msgpack-rpc` is added for `nvim_set_client_info` to +• New RPC client type `msgpack-rpc` is added for |nvim_set_client_info()| to support fully MessagePack-RPC compliant clients. • Floating windows can now show footer with new `footer` and `footer_pos` config fields. Uses |hl-FloatFooter| by default. +• Floating windows can now be hidden by setting `hide` in |nvim_open_win()| or + |nvim_win_set_config()|. + • The |:terminal| command now accepts some |:command-modifiers| (specifically |:horizontal| and those that affect splitting a window). -• |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to the - original LSP `Location` or `LocationLink`. - • |$NVIM_APPNAME| can be set to a relative path instead of only a name. -• Added |:fclose| command. +• |:fclose| command. -• Added |vim.snippet| for snippet expansion support. +• |vim.snippet| handles expansion of snippets in LSP format. • 'complete' option supports "f" flag for completing buffer names. -• Added |vim.base64.encode()| and |vim.base64.decode()| for encoding and decoding - strings using Base64 encoding. +• |vim.base64.encode()| and |vim.base64.decode()| encode and decode strings + using Base64 encoding. • The |TermResponse| autocommand event can be used with |v:termresponse| to read escape sequence responses from the terminal. @@ -245,8 +249,8 @@ The following new APIs and features were added. • The 'termsync' option asks the terminal emulator to buffer screen updates until the redraw cycle is complete. Requires support from the terminal. -• Added |vim.text.hexencode()| and |vim.text.hexdecode()| to convert strings - to and from byte representations. +• |vim.text.hexencode()| and |vim.text.hexdecode()| convert strings to and + from byte representations. ============================================================================== CHANGED FEATURES *news-changed* @@ -259,7 +263,7 @@ The following changes to existing APIs or features add new behavior. • |vim.region()| can use a string accepted by |getpos()| as position. -• vim.diagnostic.config() now accepts a function for the virtual_text.prefix +• |vim.diagnostic.config()| now accepts a function for the virtual_text.prefix option, which allows for rendering e.g., diagnostic severities differently. • Defaults: @@ -280,7 +284,7 @@ The following changes to existing APIs or features add new behavior. • |LspRequest| autocmd callbacks now contain additional information about the LSP request status update that occurred. -• `:source` without arguments treats a buffer with its 'filetype' set to "lua" +• |:source| without arguments treats a buffer with its 'filetype' set to "lua" as Lua code regardless of its extension. • |:checkhealth| buffer now implements |folding|. The initial folding status is @@ -290,6 +294,7 @@ The following changes to existing APIs or features add new behavior. • |gx| now uses |vim.ui.open()| and not netrw. To customize, you can redefine `vim.ui.open` or remap `gx`. To continue using netrw (deprecated): >vim + :call netrw#BrowseX(expand(exists("g:netrw_gx")? g:netrw_gx : ''), netrw#CheckIfRemote()) • |vim.lsp.start()| now maps |K| to use |vim.lsp.buf.hover()| if the server @@ -339,12 +344,12 @@ REMOVED FEATURES *news-removed* The following deprecated functions or APIs were removed. -• Vimball support is removed. - - :Vimuntar command removed. +• Vimball support + - :Vimuntar command -• Support for legacy treesitter injection queries is removed. +• Support for legacy treesitter injection queries -• Removed 'shortmess' flags: +• 'shortmess' flags: - |shm-f|. Always uses "(3 of 5)", never "(file 3 of 5)" - |shm-i|. Always use "[noeol]". - |shm-x|. Always use "[dos]", "[unix]" and "[mac]" @@ -382,7 +387,7 @@ release. - |vim.lsp.util.parse_snippet()| - |vim.lsp.util.text_document_completion_list_to_complete_items()| -• `vim.loop` has been renamed to `vim.uv`. +• `vim.loop` has been renamed to |vim.uv|. • vim.treesitter.languagetree functions: - |LanguageTree:for_each_child()| Use |LanguageTree:children()| (non-recursive) instead. -- cgit From 3692fd4c873a2cd7ad69eb09765eed2993570c49 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Mon, 11 Dec 2023 04:10:00 -0500 Subject: feat(gen_lsp.lua): validate CLI args #26514 - Improve CLI argument parsing, rejects invalid argument and commands as early as possible. Also prints USAGE in the command line. - No longer allows `--`, use `--out ` instead. - Print a little bit of verbose messages to better know what's going on rather than remaining silent at all times. - Add type annotation `gen_lsp._opt` to avoid type warnings. --- runtime/lua/vim/lsp/_meta/protocol.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua index 72b0f00f65..979dad84fd 100644 --- a/runtime/lua/vim/lsp/_meta/protocol.lua +++ b/runtime/lua/vim/lsp/_meta/protocol.lua @@ -1,7 +1,7 @@ --[[ This file is autogenerated from scripts/gen_lsp.lua Regenerate: -nvim -l scripts/gen_lsp.lua gen --version 3.18 --runtime/lua/vim/lsp/_meta/protocol.lua +nvim -l scripts/gen_lsp.lua gen --version 3.18 --out runtime/lua/vim/lsp/_meta/protocol.lua --]] ---@meta -- cgit From 7c6f9690f74eea5ae922f1d0db808de61ef61ab0 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 9 Dec 2023 15:21:08 +0900 Subject: fix(treesitter): fix indexing in foldexpr --- runtime/lua/vim/treesitter/_fold.lua | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua index 5c1cc06908..d5626d0391 100644 --- a/runtime/lua/vim/treesitter/_fold.lua +++ b/runtime/lua/vim/treesitter/_fold.lua @@ -5,8 +5,8 @@ local Range = require('vim.treesitter._range') local api = vim.api ---@class TS.FoldInfo ----@field levels table ----@field levels0 table +---@field levels string[] the foldexpr value for each line +---@field levels0 integer[] the raw fold levels ---@field private start_counts table ---@field private stop_counts table local FoldInfo = {} @@ -24,13 +24,13 @@ end ---@package ---@param srow integer ----@param erow integer +---@param erow integer 0-indexed, exclusive function FoldInfo:invalidate_range(srow, erow) - for i = srow, erow do - self.start_counts[i + 1] = nil - self.stop_counts[i + 1] = nil - self.levels0[i + 1] = nil - self.levels[i + 1] = nil + for i = srow + 1, erow do + self.start_counts[i] = nil + self.stop_counts[i] = nil + self.levels0[i] = nil + self.levels[i] = nil end end @@ -55,7 +55,7 @@ end ---@package ---@param srow integer ----@param erow integer +---@param erow integer 0-indexed, exclusive function FoldInfo:remove_range(srow, erow) list_remove(self.levels, srow + 1, erow) list_remove(self.levels0, srow + 1, erow) @@ -91,7 +91,7 @@ end ---@package ---@param srow integer ----@param erow integer +---@param erow integer 0-indexed, exclusive function FoldInfo:add_range(srow, erow) list_insert(self.levels, srow + 1, erow, '-1') list_insert(self.levels0, srow + 1, erow, -1) @@ -140,10 +140,10 @@ end --- TODO(lewis6991): Handle this generally --- --- @param bufnr integer ---- @param erow integer? +--- @param erow integer? 0-indexed, exclusive --- @return integer local function normalise_erow(bufnr, erow) - local max_erow = api.nvim_buf_line_count(bufnr) - 1 + local max_erow = api.nvim_buf_line_count(bufnr) return math.min(erow or max_erow, max_erow) end @@ -152,7 +152,7 @@ end ---@param bufnr integer ---@param info TS.FoldInfo ---@param srow integer? ----@param erow integer? +---@param erow integer? 0-indexed, exclusive ---@param parse_injections? boolean local function get_folds_levels(bufnr, info, srow, erow, parse_injections) srow = srow or 0 @@ -173,10 +173,7 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) return end - -- erow in query is end-exclusive - local q_erow = erow and erow + 1 or -1 - - for id, node, metadata in query:iter_captures(tree:root(), bufnr, srow, q_erow) do + for id, node, metadata in query:iter_captures(tree:root(), bufnr, srow, erow) do if query.captures[id] == 'fold' then local range = ts.get_range(node, bufnr, metadata[id]) local start, _, stop, stop_col = Range.unpack4(range) @@ -205,7 +202,7 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) local current_level = info.levels0[srow] or 0 -- We now have the list of fold opening and closing, fill the gaps and mark where fold start - for lnum = srow + 1, erow + 1 do + for lnum = srow + 1, erow do local last_trimmed_level = trim_level(current_level) current_level = current_level + info:get_start(lnum) info.levels0[lnum] = current_level @@ -296,7 +293,10 @@ end local function on_changedtree(bufnr, foldinfo, tree_changes) schedule_if_loaded(bufnr, function() for _, change in ipairs(tree_changes) do - local srow, _, erow = Range.unpack4(change) + local srow, _, erow, ecol = Range.unpack4(change) + if ecol > 0 then + erow = erow + 1 + end get_folds_levels(bufnr, foldinfo, srow, erow) end if #tree_changes > 0 then @@ -311,8 +311,9 @@ end ---@param old_row integer ---@param new_row integer local function on_bytes(bufnr, foldinfo, start_row, old_row, new_row) - local end_row_old = start_row + old_row - local end_row_new = start_row + new_row + -- extend the end to fully include the range + local end_row_old = start_row + old_row + 1 + local end_row_new = start_row + new_row + 1 if new_row ~= old_row then if new_row < old_row then -- cgit From 6f75facb9d755e2e3a10a9a1d6d258a12578dc14 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sun, 10 Dec 2023 22:18:48 +0900 Subject: fix(treesitter): improve vim.treesitter.foldexpr * Collect on_bytes and flush at the invocation of the scheduled callback to take account of commands that triggers multiple on_bytes. * More accurately track movement of folds so that foldexpr returns reasonable values even when the scheduled computation is not run yet. * Start computing folds from the line above (+ foldminlines) the changed lines to handle the folds that are removed due to the size limit. * Shrink folds that end at the line at which another fold starts to assign proper level to that line. * Use level '=' for lines that are not computed yet. --- runtime/lua/vim/treesitter/_fold.lua | 184 +++++++++++++++++++++-------------- 1 file changed, 110 insertions(+), 74 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua index d5626d0391..735627d29f 100644 --- a/runtime/lua/vim/treesitter/_fold.lua +++ b/runtime/lua/vim/treesitter/_fold.lua @@ -5,35 +5,20 @@ local Range = require('vim.treesitter._range') local api = vim.api ---@class TS.FoldInfo ----@field levels string[] the foldexpr value for each line +---@field levels string[] the foldexpr result for each line ---@field levels0 integer[] the raw fold levels ----@field private start_counts table ----@field private stop_counts table +---@field edits? {[1]: integer, [2]: integer} line range edited since the last invocation of the callback scheduled in on_bytes. 0-indexed, end-exclusive. local FoldInfo = {} FoldInfo.__index = FoldInfo ---@private function FoldInfo.new() return setmetatable({ - start_counts = {}, - stop_counts = {}, levels0 = {}, levels = {}, }, FoldInfo) end ----@package ----@param srow integer ----@param erow integer 0-indexed, exclusive -function FoldInfo:invalidate_range(srow, erow) - for i = srow + 1, erow do - self.start_counts[i] = nil - self.stop_counts[i] = nil - self.levels0[i] = nil - self.levels[i] = nil - end -end - --- Efficiently remove items from middle of a list a list. --- --- Calling table.remove() in a loop will re-index the tail of the table on @@ -59,8 +44,6 @@ end function FoldInfo:remove_range(srow, erow) list_remove(self.levels, srow + 1, erow) list_remove(self.levels0, srow + 1, erow) - list_remove(self.start_counts, srow + 1, erow) - list_remove(self.stop_counts, srow + 1, erow) end --- Efficiently insert items into the middle of a list. @@ -93,44 +76,35 @@ end ---@param srow integer ---@param erow integer 0-indexed, exclusive function FoldInfo:add_range(srow, erow) - list_insert(self.levels, srow + 1, erow, '-1') + list_insert(self.levels, srow + 1, erow, '=') list_insert(self.levels0, srow + 1, erow, -1) - list_insert(self.start_counts, srow + 1, erow, nil) - list_insert(self.stop_counts, srow + 1, erow, nil) -end - ----@package ----@param lnum integer -function FoldInfo:add_start(lnum) - self.start_counts[lnum] = (self.start_counts[lnum] or 0) + 1 end ---@package ----@param lnum integer -function FoldInfo:add_stop(lnum) - self.stop_counts[lnum] = (self.stop_counts[lnum] or 0) + 1 -end - ----@package ----@param lnum integer ----@return integer -function FoldInfo:get_start(lnum) - return self.start_counts[lnum] or 0 +---@param srow integer +---@param erow_old integer +---@param erow_new integer 0-indexed, exclusive +function FoldInfo:edit_range(srow, erow_old, erow_new) + if self.edits then + self.edits[1] = math.min(srow, self.edits[1]) + if erow_old <= self.edits[2] then + self.edits[2] = self.edits[2] + (erow_new - erow_old) + end + self.edits[2] = math.max(self.edits[2], erow_new) + else + self.edits = { srow, erow_new } + end end ---@package ----@param lnum integer ----@return integer -function FoldInfo:get_stop(lnum) - return self.stop_counts[lnum] or 0 -end - -local function trim_level(level) - local max_fold_level = vim.wo.foldnestmax - if level > max_fold_level then - return max_fold_level +---@return integer? srow +---@return integer? erow 0-indexed, exclusive +function FoldInfo:flush_edit() + if self.edits then + local srow, erow = self.edits[1], self.edits[2] + self.edits = nil + return srow, erow end - return level end --- If a parser doesn't have any ranges explicitly set, treesitter will @@ -158,22 +132,24 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) srow = srow or 0 erow = normalise_erow(bufnr, erow) - info:invalidate_range(srow, erow) - - local prev_start = -1 - local prev_stop = -1 - local parser = ts.get_parser(bufnr) parser:parse(parse_injections and { srow, erow } or nil) + local enter_counts = {} ---@type table + local leave_counts = {} ---@type table + local prev_start = -1 + local prev_stop = -1 + parser:for_each_tree(function(tree, ltree) local query = ts.query.get(ltree:lang(), 'folds') if not query then return end - for id, node, metadata in query:iter_captures(tree:root(), bufnr, srow, erow) do + -- Collect folds starting from srow - 1, because we should first subtract the folds that end at + -- srow - 1 from the level of srow - 1 to get accurate level of srow. + for id, node, metadata in query:iter_captures(tree:root(), bufnr, math.max(srow - 1, 0), erow) do if query.captures[id] == 'fold' then local range = ts.get_range(node, bufnr, metadata[id]) local start, _, stop, stop_col = Range.unpack4(range) @@ -190,8 +166,8 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) if fold_length > vim.wo.foldminlines and not (start == prev_start and stop == prev_stop) then - info:add_start(start + 1) - info:add_stop(stop + 1) + enter_counts[start + 1] = (enter_counts[start + 1] or 0) + 1 + leave_counts[stop + 1] = (leave_counts[stop + 1] or 0) + 1 prev_start = start prev_stop = stop end @@ -199,16 +175,15 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) end end) - local current_level = info.levels0[srow] or 0 + local nestmax = vim.wo.foldnestmax + local level0_prev = info.levels0[srow] or 0 + local leave_prev = leave_counts[srow] or 0 -- We now have the list of fold opening and closing, fill the gaps and mark where fold start for lnum = srow + 1, erow do - local last_trimmed_level = trim_level(current_level) - current_level = current_level + info:get_start(lnum) - info.levels0[lnum] = current_level - - local trimmed_level = trim_level(current_level) - current_level = current_level - info:get_stop(lnum) + local enter_line = enter_counts[lnum] or 0 + local leave_line = leave_counts[lnum] or 0 + local level0 = level0_prev - leave_prev + enter_line -- Determine if it's the start/end of a fold -- NB: vim's fold-expr interface does not have a mechanism to indicate that @@ -216,14 +191,36 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections) -- ( \n ( \n )) \n (( \n ) \n ) -- versus -- ( \n ( \n ) \n ( \n ) \n ) - -- If it did have such a mechanism, (trimmed_level - last_trimmed_level) + -- Both are represented by ['>1', '>2', '2', '>2', '2', '1'], and + -- vim interprets as the second case. + -- If it did have such a mechanism, (clamped - clamped_prev) -- would be the correct number of starts to pass on. + local adjusted = level0 ---@type integer local prefix = '' - if trimmed_level - last_trimmed_level > 0 then + if enter_line > 0 then prefix = '>' + if leave_line > 0 then + -- If this line ends a fold f1 and starts a fold f2, then move f1's end to the previous line + -- so that f2 gets the correct level on this line. This may reduce the size of f1 below + -- foldminlines, but we don't handle it for simplicity. + adjusted = level0 - leave_line + leave_line = 0 + end + end + + -- Clamp at foldnestmax. + local clamped = adjusted + if adjusted > nestmax then + prefix = '' + clamped = nestmax end - info.levels[lnum] = prefix .. tostring(trimmed_level) + -- Record the "real" level, so that it can be used as "base" of later get_folds_levels(). + info.levels0[lnum] = adjusted + info.levels[lnum] = prefix .. tostring(clamped) + + leave_prev = leave_line + level0_prev = adjusted end end @@ -297,7 +294,8 @@ local function on_changedtree(bufnr, foldinfo, tree_changes) if ecol > 0 then erow = erow + 1 end - get_folds_levels(bufnr, foldinfo, srow, erow) + -- Start from `srow - foldminlines`, because this edit may have shrunken the fold below limit. + get_folds_levels(bufnr, foldinfo, math.max(srow - vim.wo.foldminlines, 0), erow) end if #tree_changes > 0 then foldupdate(bufnr) @@ -309,20 +307,46 @@ end ---@param foldinfo TS.FoldInfo ---@param start_row integer ---@param old_row integer +---@param old_col integer ---@param new_row integer -local function on_bytes(bufnr, foldinfo, start_row, old_row, new_row) +---@param new_col integer +local function on_bytes(bufnr, foldinfo, start_row, start_col, old_row, old_col, new_row, new_col) -- extend the end to fully include the range local end_row_old = start_row + old_row + 1 local end_row_new = start_row + new_row + 1 if new_row ~= old_row then + -- foldexpr can be evaluated before the scheduled callback is invoked. So it may observe the + -- outdated levels, which may spuriously open the folds that didn't change. So we should shift + -- folds as accurately as possible. For this to be perfectly accurate, we should track the + -- actual TSNodes that account for each fold, and compare the node's range with the edited + -- range. But for simplicity, we just check whether the start row is completely removed (e.g., + -- `dd`) or shifted (e.g., `o`). if new_row < old_row then - foldinfo:remove_range(end_row_new, end_row_old) + if start_col == 0 and new_row == 0 and new_col == 0 then + foldinfo:remove_range(start_row, start_row + (end_row_old - end_row_new)) + else + foldinfo:remove_range(end_row_new, end_row_old) + end else - foldinfo:add_range(start_row, end_row_new) + if start_col == 0 and old_row == 0 and old_col == 0 then + foldinfo:add_range(start_row, start_row + (end_row_new - end_row_old)) + else + foldinfo:add_range(end_row_old, end_row_new) + end end + foldinfo:edit_range(start_row, end_row_old, end_row_new) + + -- This callback must not use on_bytes arguments, because they can be outdated when the callback + -- is invoked. For example, `J` with non-zero count triggers multiple on_bytes before executing + -- the scheduled callback. So we should collect the edits. schedule_if_loaded(bufnr, function() - get_folds_levels(bufnr, foldinfo, start_row, end_row_new) + local srow, erow = foldinfo:flush_edit() + if not srow then + return + end + -- Start from `srow - foldminlines`, because this edit may have shrunken the fold below limit. + get_folds_levels(bufnr, foldinfo, math.max(srow - vim.wo.foldminlines, 0), erow) foldupdate(bufnr) end) end @@ -349,8 +373,8 @@ function M.foldexpr(lnum) on_changedtree(bufnr, foldinfos[bufnr], tree_changes) end, - on_bytes = function(_, _, start_row, _, _, old_row, _, _, new_row, _, _) - on_bytes(bufnr, foldinfos[bufnr], start_row, old_row, new_row) + on_bytes = function(_, _, start_row, start_col, _, old_row, old_col, _, new_row, new_col, _) + on_bytes(bufnr, foldinfos[bufnr], start_row, start_col, old_row, old_col, new_row, new_col) end, on_detach = function() @@ -362,6 +386,18 @@ function M.foldexpr(lnum) return foldinfos[bufnr].levels[lnum] or '0' end +api.nvim_create_autocmd('OptionSet', { + pattern = { 'foldminlines', 'foldnestmax' }, + desc = 'Refresh treesitter folds', + callback = function() + for _, bufnr in ipairs(vim.tbl_keys(foldinfos)) do + foldinfos[bufnr] = FoldInfo.new() + get_folds_levels(bufnr, foldinfos[bufnr]) + foldupdate(bufnr) + end + end, +}) + ---@package ---@return { [1]: string, [2]: string[] }[]|string function M.foldtext() -- cgit From 1d4a5cd18537d054a564ff19b9361120597d9dd7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 12 Dec 2023 19:06:22 +0800 Subject: feat(eval): exists() function supports checking v:lua functions (#26485) Problem: Vimscript function exists() can't check v:lua functions. Solution: Add support for v:lua functions to exists(). --- runtime/doc/news.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 95d6b7a2f6..6166f4759d 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -339,6 +339,8 @@ The following changes to existing APIs or features add new behavior. • |vim.wait()| is no longer allowed to be called in |api-fast|. +• Vimscript function |exists()| supports checking |v:lua| functions. + ============================================================================== REMOVED FEATURES *news-removed* -- cgit From 69ffbb76c237fcbba24de80f1b5346d92642e800 Mon Sep 17 00:00:00 2001 From: Will Hopkins Date: Tue, 12 Dec 2023 12:27:24 -0800 Subject: feat(iter): add `Iter.take` (#26525) --- runtime/doc/lua.txt | 19 +++++++++++++++++++ runtime/lua/vim/iter.lua | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index f7f722bc0e..7e0ad5f4c3 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3639,6 +3639,25 @@ Iter:slice({first}, {last}) *Iter:slice()* Return: ~ Iter +Iter:take({n}) *Iter:take()* + Transforms an iterator to yield only the first n values. + + Example: >lua + local it = vim.iter({ 1, 2, 3, 4 }):take(2) + it:next() + -- 1 + it:next() + -- 2 + it:next() + -- nil +< + + Parameters: ~ + • {n} (integer) + + Return: ~ + Iter + Iter:totable() *Iter:totable()* Collect the iterator into a table. diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index e9c2b66bf2..8e602c406a 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -592,6 +592,41 @@ function ListIter.rfind(self, f) -- luacheck: no unused args self._head = self._tail end +--- Transforms an iterator to yield only the first n values. +--- +--- Example: +--- +--- ```lua +--- local it = vim.iter({ 1, 2, 3, 4 }):take(2) +--- it:next() +--- -- 1 +--- it:next() +--- -- 2 +--- it:next() +--- -- nil +--- ``` +--- +---@param n integer +---@return Iter +function Iter.take(self, n) + local next = self.next + local i = 0 + self.next = function() + if i < n then + i = i + 1 + return next(self) + end + end + return self +end + +---@private +function ListIter.take(self, n) + local inc = self._head < self._tail and 1 or -1 + self._tail = math.min(self._tail, self._head + n * inc) + return self +end + --- "Pops" a value from a |list-iterator| (gets the last value and decrements the tail). --- --- Example: -- cgit From e527842211188a5c069ef4f4759aa291353b707f Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:14:30 -0600 Subject: fix(termcap): only call callback for requested capabilities (#26546) If multiple XTGETTCAP requests are active at once (for example, for requesting the Ms capability and truecolor capabilities), then the TermResponse autocommand may fire for capabilities that were not requested. Instead, make sure that the provided callback is only called for capabilities that were actually requested. --- runtime/lua/vim/termcap.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/termcap.lua b/runtime/lua/vim/termcap.lua index b88d9ac9ba..e48657b3c2 100644 --- a/runtime/lua/vim/termcap.lua +++ b/runtime/lua/vim/termcap.lua @@ -39,6 +39,12 @@ function M.query(caps, cb) local k, rest = resp:match('^\027P1%+r(%x+)(.*)$') if k and rest then local cap = vim.text.hexdecode(k) + if not pending[cap] then + -- Received a response for a capability we didn't request. This can happen if there are + -- multiple concurrent XTGETTCAP requests + return + end + local seq ---@type string? if rest:match('^=%x+$') then seq = vim.text -- cgit From 8122470f8310ae34bcd5e436e8474f9255eb16f2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 13 Dec 2023 22:19:53 +0800 Subject: refactor(diagnostic): set sign by using extmark (#26193) after sign implementation refactor by using extmark, we can use `nvim_buf_set_extmark` to set diagnostic sign instead use `sign_define` --- runtime/doc/diagnostic.txt | 10 +++++++ runtime/doc/news.txt | 3 +++ runtime/lua/vim/diagnostic.lua | 61 +++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 34 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 7f5c809ac3..1e16edbdb2 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -435,6 +435,16 @@ config({opts}, {namespace}) *vim.diagnostic.config()* for signs. When {severity_sort} is used, the priority of a sign is adjusted based on its severity. Otherwise, all signs use the same priority. + • text: (table) A table mapping |diagnostic-severity| + to the sign text to display in the sign column. The + default is to use "E", "W", "I", and "H" for errors, + warnings, information, and hints, respectively. + Example: >lua + + vim.diagnostic.config({ + sign = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } + }) +< • float: Options for floating windows. See |vim.diagnostic.open_float()|. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 6166f4759d..04f143f0c3 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -341,6 +341,9 @@ The following changes to existing APIs or features add new behavior. • Vimscript function |exists()| supports checking |v:lua| functions. +• Diagnostic sign text is no longer configured with |sign_define()|. + Use |vim.diagnostic.config()| instead. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 99448982b4..729156584f 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -221,30 +221,6 @@ local underline_highlight_map = make_highlight_map('Underline') local floating_highlight_map = make_highlight_map('Floating') local sign_highlight_map = make_highlight_map('Sign') ----@private -local define_default_signs = (function() - local signs_defined = false - return function() - if signs_defined then - return - end - - for severity, sign_hl_name in pairs(sign_highlight_map) do - if vim.tbl_isempty(vim.fn.sign_getdefined(sign_hl_name)) then - local severity_name = M.severity[severity] - vim.fn.sign_define(sign_hl_name, { - text = (severity_name or 'U'):sub(1, 1), - texthl = sign_hl_name, - linehl = '', - numhl = '', - }) - end - end - - signs_defined = true - end -end)() - local function get_bufnr(bufnr) if not bufnr or bufnr == 0 then return api.nvim_get_current_buf() @@ -618,6 +594,14 @@ end --- * priority: (number, default 10) Base priority to use for signs. When --- {severity_sort} is used, the priority of a sign is adjusted based on --- its severity. Otherwise, all signs use the same priority. +--- * text: (table) A table mapping |diagnostic-severity| to the sign text +--- to display in the sign column. The default is to use "E", "W", "I", and "H" +--- for errors, warnings, information, and hints, respectively. Example: +---
lua
+---                     vim.diagnostic.config({
+---                       sign = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
+---                     })
+---                   
--- - float: Options for floating windows. See |vim.diagnostic.open_float()|. --- - update_in_insert: (default false) Update diagnostics in Insert mode (if false, --- diagnostics are updated on InsertLeave) @@ -868,8 +852,6 @@ M.handlers.signs = { diagnostics = filter_by_severity(opts.signs.severity, diagnostics) end - define_default_signs() - -- 10 is the default sign priority when none is explicitly specified local priority = opts.signs and opts.signs.priority or 10 local get_priority @@ -890,22 +872,33 @@ M.handlers.signs = { end local ns = M.get_namespace(namespace) - if not ns.user_data.sign_group then - ns.user_data.sign_group = string.format('vim.diagnostic.%s', ns.name) + if not ns.user_data.sign_ns then + ns.user_data.sign_ns = api.nvim_create_namespace('') + end + + local text = {} + for k in pairs(M.severity) do + if opts.signs.text and opts.signs.text[k] then + text[k] = opts.signs.text[k] + elseif type(k) == 'string' and not text[k] then + text[k] = string.sub(k, 1, 1):upper() + end end - local sign_group = ns.user_data.sign_group for _, diagnostic in ipairs(diagnostics) do - vim.fn.sign_place(0, sign_group, sign_highlight_map[diagnostic.severity], bufnr, { - priority = get_priority(diagnostic.severity), - lnum = diagnostic.lnum + 1, - }) + if api.nvim_buf_is_loaded(diagnostic.bufnr) then + api.nvim_buf_set_extmark(bufnr, ns.user_data.sign_ns, diagnostic.lnum, 0, { + sign_text = text[diagnostic.severity] or text[M.severity[diagnostic.severity]] or 'U', + sign_hl_group = sign_highlight_map[diagnostic.severity], + priority = get_priority(diagnostic.severity), + }) + end end end, hide = function(namespace, bufnr) local ns = M.get_namespace(namespace) if ns.user_data.sign_group and api.nvim_buf_is_valid(bufnr) then - vim.fn.sign_unplace(ns.user_data.sign_group, { buffer = bufnr }) + api.nvim_buf_clear_namespace(bufnr, ns.user_data.sign_ns, 0, -1) end end, } -- cgit From 29d5ff6ac4eade7996d14eec60a31ec6328a165d Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 13 Dec 2023 09:26:39 -0600 Subject: fix(diagnostic): check for sign namespace instead of sign group --- runtime/lua/vim/diagnostic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 729156584f..d6db530bb0 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -897,7 +897,7 @@ M.handlers.signs = { end, hide = function(namespace, bufnr) local ns = M.get_namespace(namespace) - if ns.user_data.sign_group and api.nvim_buf_is_valid(bufnr) then + if ns.user_data.sign_ns and api.nvim_buf_is_valid(bufnr) then api.nvim_buf_clear_namespace(bufnr, ns.user_data.sign_ns, 0, -1) end end, -- cgit From 39112c72dd3722cd4a0770fc23c9d7269a9c2283 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 13 Dec 2023 09:43:27 -0600 Subject: docs(diagnostic): fix typo in example --- runtime/doc/diagnostic.txt | 6 +++--- runtime/lua/vim/diagnostic.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 1e16edbdb2..895f88f393 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -441,9 +441,9 @@ config({opts}, {namespace}) *vim.diagnostic.config()* warnings, information, and hints, respectively. Example: >lua - vim.diagnostic.config({ - sign = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } - }) + vim.diagnostic.config({ + signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } + }) < • float: Options for floating windows. See diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index d6db530bb0..1d76d1d7a0 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -598,9 +598,9 @@ end --- to display in the sign column. The default is to use "E", "W", "I", and "H" --- for errors, warnings, information, and hints, respectively. Example: ---
lua
----                     vim.diagnostic.config({
----                       sign = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
----                     })
+---                       vim.diagnostic.config({
+---                         signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
+---                       })
 ---                   
--- - float: Options for floating windows. See |vim.diagnostic.open_float()|. --- - update_in_insert: (default false) Update diagnostics in Insert mode (if false, -- cgit From a3b39784744f330b922117655811542202fcd85b Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 13 Dec 2023 09:54:04 -0600 Subject: feat(diagnostics): support numhl and linehl for diagnostic signs --- runtime/doc/diagnostic.txt | 6 ++++++ runtime/lua/vim/diagnostic.lua | 9 +++++++++ 2 files changed, 15 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 895f88f393..4cf8fef7c4 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -445,6 +445,12 @@ config({opts}, {namespace}) *vim.diagnostic.config()* signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } }) < + • numhl: (table) A table mapping |diagnostic-severity| + to the highlight group used for the line number where + the sign is placed. + • linehl: (table) A table mapping |diagnostic-severity| + to the highlight group used for the whole line the + sign is placed in. • float: Options for floating windows. See |vim.diagnostic.open_float()|. diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 1d76d1d7a0..0eb1ac7f15 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -602,6 +602,10 @@ end --- signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } --- }) --- +--- * numhl: (table) A table mapping |diagnostic-severity| to the highlight +--- group used for the line number where the sign is placed. +--- * linehl: (table) A table mapping |diagnostic-severity| to the highlight group +--- used for the whole line the sign is placed in. --- - float: Options for floating windows. See |vim.diagnostic.open_float()|. --- - update_in_insert: (default false) Update diagnostics in Insert mode (if false, --- diagnostics are updated on InsertLeave) @@ -885,11 +889,16 @@ M.handlers.signs = { end end + local numhl = opts.signs.numhl or {} + local linehl = opts.signs.linehl or {} + for _, diagnostic in ipairs(diagnostics) do if api.nvim_buf_is_loaded(diagnostic.bufnr) then api.nvim_buf_set_extmark(bufnr, ns.user_data.sign_ns, diagnostic.lnum, 0, { sign_text = text[diagnostic.severity] or text[M.severity[diagnostic.severity]] or 'U', sign_hl_group = sign_highlight_map[diagnostic.severity], + number_hl_group = numhl[diagnostic.severity], + line_hl_group = linehl[diagnostic.severity], priority = get_priority(diagnostic.severity), }) end -- cgit From ef58ee48f4d553d364c4284870b0860f8cc8427b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:31:39 +0100 Subject: docs: add wiki FAQ to the runtime documentation (#26539) Problem: Wiki contents are not discoverable and hard to maintain. Solution: Move FAQ to runtime docs. Co-authored-by: Christian Clason --- runtime/doc/dev_tools.txt | 192 ++++++++++++++++++ runtime/doc/faq.txt | 485 ++++++++++++++++++++++++++++++++++++++++++++++ runtime/doc/help.txt | 4 +- runtime/doc/intro.txt | 3 +- runtime/doc/options.txt | 1 + runtime/nvim.appdata.xml | 2 +- 6 files changed, 683 insertions(+), 4 deletions(-) create mode 100644 runtime/doc/dev_tools.txt create mode 100644 runtime/doc/faq.txt (limited to 'runtime') diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt new file mode 100644 index 0000000000..f222930e99 --- /dev/null +++ b/runtime/doc/dev_tools.txt @@ -0,0 +1,192 @@ +*dev_tools.txt* Nvim + + + NVIM REFERENCE MANUAL + + +Tools and techniques for developing Nvim *dev-tools* + +The following advice is helpful when working on or debugging issues with Nvim +itself. See also |debug.txt| for advice that applies to Vim. + + Type |gO| to see the table of contents. + +============================================================================== +Backtraces *dev-tools-backtrace* + +LINUX ~ + +Core dumps are disabled by default on Ubuntu +https://stackoverflow.com/a/18368068, CentOS and others. To enable core dumps: +>bash + ulimit -c unlimited +< +On systemd-based systems getting a backtrace is as easy as: +>bash + coredumpctl -1 gdb +< +It's an optional tool, so you may need to install it: +>bash + sudo apt install systemd-coredump +< + +The full backtrace is most useful, send us the `bt.txt` file: +>bash + 2>&1 coredumpctl -1 gdb | tee -a bt.txt + thread apply all bt full +< +On older systems a `core` file will appear in the current directory. To get +a backtrace from the `core` file: +>bash + gdb build/bin/nvim core 2>&1 | tee backtrace.txt + thread apply all bt full +< + +MACOS + +If `nvim` crashes, you can see the backtrace in `Console.app` (under "Crash +Reports" or "User Diagnostic Reports" for older macOS versions). +>bash + open -a Console +< +You may also want to enable core dumps on macOS. To do this, first make sure +the `/cores/` directory exists and is writable: +>bash + sudo mkdir /cores + sudo chown root:admin /cores + sudo chmod 1775 /cores +< +Then set the core size limit to `unlimited`: +>bash + ulimit -c unlimited +< +Note that this is done per shell process. If you want to make this the default +for all shells, add the above line to your shell's init file (e.g. `~/.bashrc` +or similar). + +You can then open the core file in `lldb`: +>bash + lldb -c /cores/core.12345 +< +Apple's documentation archive has some other useful information +https://developer.apple.com/library/archive/technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391-CH1-SECCOREDUMPS, +but note that some of the things on this page are out of date (such as enabling +core dumps with `/etc/launchd.conf`). + +============================================================================== +Gdb *dev-tools-gdb* + +USING GDB TO STEP THROUGH FUNCTIONAL TESTS ~ + +Use `TEST_TAG` to run tests matching busted tags (of the form `#foo` e.g. +`it("test #foo ...", ...)`): +>bash + GDB=1 TEST_TAG=foo make functionaltest +< +Then, in another terminal: +>bash + gdb build/bin/nvim + target remote localhost:7777 +< +- See also test/functional/helpers.lua https://github.com/neovim/neovim/blob/3098b18a2b63a841351f6d5e3697cb69db3035ef/test/functional/helpers.lua#L38-L44. + + +USING LLDB TO STEP THROUGH UNIT TESTS ~ + +>bash + lldb .deps/usr/bin/luajit -- .deps/usr/bin/busted --lpath="./build/?.lua" test/unit/ +< + +USING GDB ~ + +To attach to a running `nvim` process with a pid of 1234: +>bash + gdb -tui -p 1234 build/bin/nvim +< +The `gdb` interactive prompt will appear. At any time you can: + +- `break foo` to set a breakpoint on the `foo()` function +- `n` to step over the next statement + - `` to repeat the last command +- `s` to step into the next statement +- `c` to continue +- `finish` to step out of the current function +- `p zub` to print the value of `zub` +- `bt` to see a backtrace (callstack) from the current location +- `CTRL-x CTRL-a` or `tui enable` to show a TUI view of the source file in the + current debugging context. This can be extremely useful as it avoids the + need for a gdb "frontend". +- `` and `` to scroll the source file view + + +GDB "REVERSE DEBUGGING" ~ + +- `set record full insn-number-max unlimited` +- `continue` for a bit (at least until `main()` is executed +- `record` +- provoke the bug, then use `revert-next`, `reverse-step`, etc. to rewind the + debugger + + +USING GDBSERVER ~ + +You may want to connect multiple `gdb` clients to the same running `nvim` +process, or you may want to connect to a remote `nvim` process with a local +`gdb`. Using `gdbserver`, you can attach to a single process and control it +from multiple `gdb` clients. + +Open a terminal and start `gdbserver` attached to `nvim` like this: +>bash + gdbserver :6666 build/bin/nvim 2> gdbserver.log +< +`gdbserver` is now listening on port 6666. You then need to attach to this +debugging session in another terminal: +>bash + gdb build/bin/nvim +< +Once you've entered `gdb`, you need to attach to the remote session: +> + target remote localhost:6666 +< +In case gdbserver puts the TUI as a background process, the TUI can become +unable to read input from pty (and receives SIGTTIN signal) and/or output data +(SIGTTOU signal). To force the TUI as the foreground process, you can add +> + signal (SIGTTOU, SIG_IGN); + if (!tcsetpgrp(data->input.in_fd, getpid())) { + perror("tcsetpgrp failed"); + } +< +to `tui.c:terminfo_start`. + + +USING GDBSERVER IN TMUX ~ + +Consider using a custom makefile +https://github.com/neovim/neovim/wiki/Building-Neovim#custom-makefile to +quickly start debugging sessions using the `gdbserver` method mentioned above. +This example `local.mk` will create the debugging session when you type +`make debug`. +>make + .PHONY: dbg-start dbg-attach debug build + + build: + @$(MAKE) nvim + + dbg-start: build + @tmux new-window -n 'dbg-neovim' 'gdbserver :6666 ./build/bin/nvim -D' + + dbg-attach: + @tmux new-window -n 'dbg-cgdb' 'cgdb -x gdb_start.sh ./build/bin/nvim' + + debug: dbg-start dbg-attach +< +Here `gdb_start.sh` includes `gdb` commands to be called when the debugger +starts. It needs to attach to the server started by the `dbg-start` rule. For +example: +> + target remote localhost:6666 + br main +< + +vim:tw=78:ts=8:et:ft=help:norl: diff --git a/runtime/doc/faq.txt b/runtime/doc/faq.txt new file mode 100644 index 0000000000..1e9dc052a1 --- /dev/null +++ b/runtime/doc/faq.txt @@ -0,0 +1,485 @@ +*faq.txt* Nvim + + NVIM REFERENCE MANUAL + + +Frequently asked Questions *faq* + + Type |gO| to see the table of contents. + +============================================================================== +General Questions *faq-general* + + +WHERE SHOULD I PUT MY CONFIG (VIMRC)? ~ + +See |config|; you can copy (or symlink) your existing vimrc. |nvim-from-vim| + + +HOW STABLE IS THE DEVELOPMENT (PRE-RELEASE) VERSION? ~ + +The unstable (pre-release) +https://github.com/neovim/neovim/releases/tag/nightly version of Nvim +("HEAD", i.e. the `master` branch) is used to aggressively stage new features +and changes. It's usually stable, but will occasionally break your workflow. +We depend on HEAD users to report "blind spots" that were not caught by +automated tests. + +Use the stable (release) https://github.com/neovim/neovim/releases/latest +version for a more predictable experience. + + +CAN I USE RUBY-BASED VIM PLUGINS (E.G. LUSTYEXPLORER)? ~ + +Yes, starting with Nvim 0.1.5 PR #4980 +https://github.com/neovim/neovim/pull/4980 the legacy Vim `if_ruby` interface +is supported. + + +CAN I USE LUA-BASED VIM PLUGINS (E.G. NEOCOMPLETE)? ~ + +No. Starting with Nvim 0.2 PR #4411 +https://github.com/neovim/neovim/pull/4411 Lua is built-in, but the legacy +Vim `if_lua` interface is not supported. + + +HOW CAN I USE "TRUE COLOR" IN THE TERMINAL? ~ + +Truecolor (24bit colors) are enabled by default if a supporting terminal is +detected. If your terminal is not detected but you are sure it supports +truecolor, add this to your |init.vim|: +>vim + set termguicolors +< + +NVIM SHOWS WEIRD SYMBOLS (`�[2 q`) WHEN CHANGING MODES ~ + +This is a bug in your terminal emulator. It happens because Nvim sends +cursor-shape termcodes by default, if the terminal appears to be +xterm-compatible (`TERM=xterm-256color`). + +To workaround the issue, you can: + +- Use a different terminal emulator +- Disable 'guicursor' in your Nvim config: >vim + + :set guicursor= + " Workaround some broken plugins which set guicursor indiscriminately. + :autocmd OptionSet guicursor noautocmd set guicursor= +< +See also |$TERM| for recommended values of `$TERM`. + + +HOW TO CHANGE CURSOR SHAPE IN THE TERMINAL? ~ + +- For Nvim 0.1.7 or older: see the note about `NVIM_TUI_ENABLE_CURSOR_SHAPE` in `man nvim`. +- For Nvim 0.2 or newer: cursor styling is controlled by the 'guicursor' option. + - To _disable_ cursor-styling, set 'guicursor' to empty: >vim + + :set guicursor= + " Workaround some broken plugins which set guicursor indiscriminately. + :autocmd OptionSet guicursor noautocmd set guicursor= +< + - If you want a non-blinking cursor, use `blinkon0`. See 'guicursor'. + - 'guicursor' is enabled by default, unless Nvim thinks your terminal doesn't + support it. If you're sure that your terminal supports cursor-shaping, set + 'guicursor' in your |init.vim|, as described in 'guicursor'. +- The Vim terminal options |t_SI| and `t_EI` are ignored, like all other |t_xx| options. +- Old versions of libvte (gnome-terminal, roxterm, terminator, ...) do not + support cursor style control codes. #2537 + https://github.com/neovim/neovim/issues/2537 + + +HOW TO CHANGE CURSOR COLOR IN THE TERMINAL? ~ + +Cursor styling (shape, color, behavior) is controlled by 'guicursor', even in +the terminal. Cursor color (as opposed to shape) only works if +'termguicolors' is set. + +'guicursor' gives an example, but here's a more complicated example +which sets different colors in insert-mode and normal-mode: +>vim + :set termguicolors + :hi Cursor guifg=green guibg=green + :hi Cursor2 guifg=red guibg=red + :set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor50 +< + +CURSOR STYLE ISN'T RESTORED AFTER EXITING OR SUSPENDING AND RESUMING NVIM ~ + +Terminals do not provide a way to query the cursor style. Use autocommands to +manage the cursor style: +>vim + au VimEnter,VimResume * set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 + \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor + \,sm:block-blinkwait175-blinkoff150-blinkon175 + + au VimLeave,VimSuspend * set guicursor=a:block-blinkon0 +< + +CURSOR SHAPE DOESN'T CHANGE IN TMUX ~ + +tmux decides that, not Nvim. See |tui-cursor-shape| for a fix. + +See #3165 https://github.com/neovim/neovim/pull/3165 for discussion. + + +CURSOR FLICKER IN TMUX? ~ + +If cursor `_` appears and disappears very quickly when opening nvim without a +document under tmux, and you set |ctermbg| in `EndOfBuffer` and `Normal`, try +setting these to `NONE`: +>vim + hi EndOfBuffer ctermbg=NONE ctermfg=200 cterm=NONE + hi Normal ctermbg=NONE ctermfg=200 cterm=NONE +< + +WHAT HAPPENED TO --remote AND FRIENDS? ~ + +|--remote| is partly supported. |clientserver| + +If you require flags from Vim that are missing in Nvim, you can use +https://github.com/mhinz/neovim-remote instead. + +============================================================================== +Runtime issues *faq-runtime* + + +COPYING TO X11 PRIMARY SELECTION WITH THE MOUSE DOESN'T WORK ~ + +`clipboard=autoselect` is not implemented yet +https://github.com/neovim/neovim/issues/2325. You may find this workaround to +be useful: +>vim + vnoremap "*ygv + vnoremap <2-LeftRelease> "*ygv +< + +MY CTRL-H MAPPING DOESN'T WORK ~ + +This was fixed in Nvim 0.2. If you are running Nvim 0.1.7 or older, +adjust your terminal's "kbs" (key_backspace) terminfo entry: +>vim + infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti + tic $TERM.ti +< +(Feel free to delete the temporary `*.ti` file created after running the above +commands). + + + OR SOME OTHER "SPECIAL" KEY DOESN'T WORK ~ + +Make sure |$TERM| is set correctly. + +- For screen or tmux, `$TERM` should be `screen-256color` (not `xterm-256color`!) +- In other cases if "256" does not appear in the string it's probably wrong. + Try `TERM=xterm-256color`. + + +:! AND SYSTEM() DO WEIRD THINGS WITH INTERACTIVE PROCESSES ~ + +Interactive commands are supported by |:terminal| in Nvim. But |:!| and +|system()| do not support interactive commands, primarily because Nvim UIs use +stdio for msgpack communication, but also for performance, reliability, and +consistency across platforms (see +https://vimhelp.org/gui_x11.txt.html#gui-pty). + +See also #1496 https://github.com/neovim/neovim/issues/1496 and #8217 +https://github.com/neovim/neovim/issues/8217#issuecomment-402152307. + + +PYTHON SUPPORT ISN'T WORKING ~ + +Run |:checkhealth| in Nvim for automatic diagnosis. + +Other hints: + +- The python `neovim` module was renamed to `pynvim` (long ago). +- If you're using pyenv or virtualenv for the `pynvim` module + https://pypi.python.org/pypi/pynvim/, you must set `g:python3_host_prog` to + the virtualenv's interpreter path. +- Read |provider-python|. +- Be sure you have the latest version of the `pynvim` Python module: >bash + + python -m pip install setuptools + python -m pip install --upgrade pynvim + python3 -m pip install --upgrade pynvim +< +- Try with `nvim -u NORC` to make sure your config (|init.vim|) isn't causing a + problem. If you get `E117: Unknown function`, that means there's a runtime + issue: |faq-runtime|. + + +:CHECKHEALTH REPORTS E5009: INVALID $VIMRUNTIME ~ + +This means `health#check()` couldn't load, which suggests that |$VIMRUNTIME| +or 'runtimepath' is broken. + +- |$VIMRUNTIME| must point to Nvim's runtime files, not Vim's. +- The |$VIMRUNTIME| directory contents should be readable by the current user. +- Verify that `:echo &runtimepath` contains the $VIMRUNTIME path. +- Check the output of: >vim + + :call health#check() + :verbose func health#check +< + +NEOVIM CAN'T FIND ITS RUNTIME ~ + +This is the case if `:help nvim` shows `E149: Sorry, no help for nvim`. + +Make sure that |$VIM| and |$VIMRUNTIME| point to Nvim's (as opposed to +Vim's) runtime by checking `:echo $VIM` and `:echo $VIMRUNTIME`. This should +give something like `/usr/share/nvim` resp. `/usr/share/nvim/runtime`. + +Also make sure that you don't accidentally overwrite your runtimepath +(`:set runtimepath?`), which includes the above |$VIMRUNTIME| by default (see +'runtimepath'). + + +NEOVIM IS SLOW ~ + + +Use a fast terminal emulator: + +- kitty https://github.com/kovidgoyal/kitty +- alacritty https://github.com/jwilm/alacritty + + +Use an optimized build: + +`:checkhealth nvim` should report one of these "build types": +> + Build type: RelWithDebInfo + Build type: MinSizeRel + Build type: Release +< +If it reports `Build type: Debug` and you're building Nvim from source, see +https://github.com/neovim/neovim/wiki/Building-Neovim. + + +COLORS AREN'T DISPLAYED CORRECTLY ~ + +Ensure that |$TERM| is set correctly. + +From a shell, run `TERM=xterm-256color nvim`. If colors are displayed +correctly, then export that value of `TERM` in your user profile (usually +`~/.profile`): +>bash + export TERM=xterm-256color +< +If you're using `tmux`, instead add this to your `tmux.conf`: +>bash + set -g default-terminal "tmux-256color" +< + +For GNU `screen`, configure your `.screenrc` +: +> + term screen-256color +< + +NOTE: Nvim ignores `t_Co` and other |t_xx| terminal codes. + + +NEOVIM CAN'T READ UTF-8 CHARACTERS ~ + +Run the following from the command line: +>bash + locale | grep -E '(LANG|LC_CTYPE|LC_ALL)=(.*\.)?(UTF|utf)-?8' +< +If there's no results, then you might not be using a UTF-8 locale. See the +following issues: +#1601 https://github.com/neovim/neovim/issues/1601 +#1858 https://github.com/neovim/neovim/issues/1858 +#2386 https://github.com/neovim/neovim/issues/2386 + + +ESC IN TMUX OR GNU SCREEN IS DELAYED ~ + +This is a common problem +https://www.google.com/?q=tmux%20vim%20escape%20delay in `tmux` / `screen` +(see also tmux/#131 +https://github.com/tmux/tmux/issues/131#issuecomment-145853211). The +corresponding timeout needs to be tweaked to a low value (10-20ms). + +`.tmux.conf`: +> + set -g escape-time 10 + # Or for tmux >= 2.6 + set -sg escape-time 10 +< +`.screenrc`: +> + maptimeout 10 +< + +"WHY DOESN'T THIS HAPPEN IN VIM?" + +It does happen (try `vim -N -u NONE`), but if you hit a key quickly after +ESC_ then Vim interprets the ESC as ESC instead of ALT (META). You won't +notice the delay unless you closely observe the cursor. The tradeoff is that +Vim won't understand ALT (META) key-chords, so for example `nnoremap ` +won't work. ALT (META) key-chords always work in Nvim. See also `:help +xterm-cursor-keys` in Vim. + +Nvim 0.3 mimics the Vim behavior while still fully supporting ALT mappings. See +|i_ALT|. + + +ESC IN GNU SCREEN IS LOST WHEN MOUSE MODE IS ENABLED ~ + +This happens because of a bug in screen https://savannah.gnu.org/bugs/?60196: +in mouse mode, screen assumes that `ESC` is part of a mouse sequence and will +wait an unlimited time for the rest of the sequence, regardless of +`maptimeout`. Until it's fixed in screen, there's no known workaround for +this other than double-pressing escape, which causes a single escape to be +passed through to Nvim. + + +CALLING INPUTLIST(), ECHOMSG, ... IN FILETYPE PLUGINS AND AUTOCMD DOES NOT WORK ~ + +#10008 https://github.com/neovim/neovim/issues/10008, +#10116 https://github.com/neovim/neovim/issues/10116, +#12288 https://github.com/neovim/neovim/issues/12288, +# vim/vim#4379 https://github.com/vim/vim/issues/4379. +This is because Nvim sets `shortmess+=F` by default. Vim behaves the same way +with `set shortmes+=F`. There are plans to improve this, but meanwhile as a +workaround, use `set shortmess-=F` or use `unsilent` as follows. +>vim + unsilent let var = inputlist(['1. item1', '2. item2']) + autocmd BufNewFile * unsilent echomsg 'The autocmd has been fired.' +< + +G:CLIPBOARD SETTINGS ARE NOT USED. ~ + +If the clipboard provider is already loaded, you will need to reload it after +configuration. Use the following configuration. +>vim + let g:clipboard = { 'name' : ... } + if exists('g:loaded_clipboard_provider') + unlet g:loaded_clipboard_provider + runtime autoload/provider/clipboard.vim + endif +< + +Or, if you want automatic reloading when assigning to |g:clipboard|, set +|init.vim| as follows. +>vim + function! s:clipboard_changed(...) abort + if exists('g:loaded_clipboard_provider') + unlet g:loaded_clipboard_provider + endif + runtime autoload/provider/clipboard.vim + endfunction + + if !exists('s:loaded") + call dictwatcheradd(g:, 'clipboard', function('s:clipboard_changed')) + endif + let s:loaded = v:true +< + +============================================================================== +Build issues *faq-build* + + +GENERAL BUILD ISSUES ~ + +Run `make distclean && make` to rule out a stale build environment causing the +failure. + + +SETTINGS IN LOCAL.MK DON'T TAKE EFFECT ~ + +CMake caches build settings, so you might need to run `rm -r build && make` +after modifying `local.mk`. + + +CMAKE ERRORS ~ + +`configure_file Problem configuring file` + +This is probably a permissions issue, which can happen if you run `make` as the +root user, then later run an unprivileged `make`. To fix this, run `rm -rf +build` and try again. + + +GENERATING HELPTAGS FAILED ~ + +If re-installation fails with "Generating helptags failed", try removing the +previously installed runtime directory (if `CMAKE_INSTALL_PREFIX` is not set +during building, the default is `/usr/local/share/nvim`): +>bash + rm -r /usr/local/share/nvim +< + +============================================================================== +Design *faq-design* + + +WHY NOT USE JSON FOR RPC? ~ + +- JSON cannot easily/efficiently handle binary data +- JSON specification is ambiguous: https://seriot.ch/parsing_json.php + + +WHY EMBED LUA INSTEAD OF X? ~ + +- Lua is a very small language, ideal for embedding. The biggest advantage of + Python/Ruby/etc is their huge collection of libraries, but that isn't + relevant for Nvim, where Nvim is the "batteries included" library: + introducing another stdlib would be redundant. +- Lua 5.1 is a complete language: the syntax is frozen. This is great for + backwards compatibility. +- Nvim also uses Lua internally as an alternative to C. Extra performance is + useful there, as opposed to a slow language like Python or Vim9script. +- LuaJIT is one of the fastest runtimes on the planet, 10x faster than Python + and "Vim9script" https://vimhelp.org/vim9.txt.html, 100x faster than + Vimscript. +- Python/JS cost more than Lua in terms of size and portability, and there are + already numerous Python/JS-based editors. So Python/JS would make Nvim + bigger and less portable, in exchange for a non-differentiating feature. + +See also: + +- Why Lua https://web.archive.org/web/20150219224654/https://blog.datamules.com/blog/2012/01/30/why-lua/ +- The Design of Lua https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-design-of-lua/fulltext +- Scripting architecture considerations http://oldblog.antirez.com/post/redis-and-scripting.html +- LuaJIT performance https://julialang.org/benchmarks/ +- Discussion of JavaScript vs Lua https://github.com/vim/vim/pull/5198#issuecomment-554693754 +- Discussion Python embedding https://lobste.rs/s/pnuak4/mercurial_s_journey_reflections_on#c_zshdwy + + +WHY LUA 5.1 INSTEAD OF LUA 5.3+? ~ + +Lua 5.1 is a different language than 5.3. The Lua org makes breaking changes +with every new version, so even if we switched (not upgraded, but switched) to +5.3 we gain nothing when they create the next new language in 5.4, 5.5, etc. +And we would lose LuaJIT, which is far more valuable than Lua 5.3+. + +Lua 5.1 is a complete language. To "upgrade" it, add libraries, not syntax. +Nvim itself already is a pretty good "stdlib" for Lua, and we will continue to +grow and enhance it. Changing the rules of Lua gains nothing in this context. + + +WILL NEOVIM TRANSLATE VIMSCRIPT TO LUA, INSTEAD OF EXECUTING VIMSCRIPT DIRECTLY? ~ + +- We are experimenting with vim9jit https://github.com/tjdevries/vim9jit to + transpile Vim9script (Vim9's Vimscript variant) to Lua and have used this to + port Vim9 plugins https://github.com/neovim/neovim/pull/21662 to Nvim Lua. +- We have no plans for transpiling legacy Vimscript. + + +ARE PLUGIN AUTHORS ENCOURAGED TO PORT THEIR PLUGINS FROM VIMSCRIPT TO LUA? DO YOU PLAN ON SUPPORTING VIMSCRIPT INDEFINITELY? (#1152) ~ + +We don't anticipate any reason to deprecate Vimscript, which is a valuable DSL +https://en.wikipedia.org/wiki/Domain-specific_language for text-editing tasks. +Maintaining Vimscript compatibility is less costly than a mass migration of +existing Vim plugins. + +Porting from Vimscript to Lua just for the heck of it gains nothing. Nvim is +emphatically a fork of Vim in order to leverage the work already spent on +thousands of Vim plugins, while enabling new types of plugins and +integrations. + +vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index b8526b55e9..47ae413714 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -47,6 +47,7 @@ ABOUT NVIM *reference_toc* *doc-file-list* *Q_ct* |news| News since the previous release |nvim| Transitioning from Vim |vim-differences| Nvim compared to Vim +|faq| Frequently Asked Questions |user-manual| User manual: How to accomplish editing tasks. |quickref| Overview of common commands |tutor| 30-minute interactive course for beginners @@ -167,7 +168,8 @@ DEVELOPING NVIM |dev| Development of Nvim |dev-style| Development style guidelines -|debug.txt| Debugging Vim itself +|dev-theme| Design guidelines (colorschemes etc.) +|dev-tools| Tools and techniques for developing Nvim Standard plugins ~ *standard-plugin-list* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 85115fc22b..c9211291d0 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -49,10 +49,9 @@ For more information try one of these: ============================================================================== Nvim on the interwebs *internet* - *www* *faq* *distribution* *download* + *www* *distribution* *download* Nvim home page: https://neovim.io/ - Nvim FAQ: https://github.com/neovim/neovim/wiki/FAQ Downloads: https://github.com/neovim/neovim/releases Vim FAQ: https://vimhelp.org/vim_faq.txt.html diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 355c8cc99a..fda60eaab2 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -30,6 +30,7 @@ achieve special effects. These options come in three forms: *E518* *E519* :se[t] {option}? Show value of {option}. + NOTE: some legacy options were removed. |nvim-removed| :se[t] {option} Toggle option: set, switch it on. Number option: show value. diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml index 29db9d5ee4..bff8bc4bff 100644 --- a/runtime/nvim.appdata.xml +++ b/runtime/nvim.appdata.xml @@ -56,7 +56,7 @@ nvim.desktop https://neovim.io/ https://github.com/neovim/neovim/issues - https://github.com/neovim/neovim/wiki/FAQ + https://neovim.io/doc/user/faq.html https://neovim.io/doc/ https://neovim.io/#sponsor https://github.com/neovim/neovim/tree/master/src/nvim/po -- cgit From fbd0f6658f960a069f8fef09f5f91c4b11259977 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 12 Dec 2023 16:42:02 +0100 Subject: docs: add installation and build guides from wiki to repo --- runtime/lua/nvim/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua index 6b6370fa19..afab6f824d 100644 --- a/runtime/lua/nvim/health.lua +++ b/runtime/lua/nvim/health.lua @@ -17,7 +17,7 @@ local shell_error = function() return vim.v.shell_error ~= 0 end -local suggest_faq = 'https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds' +local suggest_faq = 'https://github.com/neovim/neovim/blob/docs/install/BUILD.md#building' local function check_runtime() health.start('Runtime') -- cgit From 7908dc0d1552e715cc4cc077e6b87d53d0e323c2 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 12 Dec 2023 22:48:48 +0100 Subject: docs: move vim-patch wiki page to runtime documentation --- runtime/doc/dev_vimpatch.txt | 304 +++++++++++++++++++++++++++++++++++++++++++ runtime/doc/help.txt | 1 + 2 files changed, 305 insertions(+) create mode 100644 runtime/doc/dev_vimpatch.txt (limited to 'runtime') diff --git a/runtime/doc/dev_vimpatch.txt b/runtime/doc/dev_vimpatch.txt new file mode 100644 index 0000000000..c302a3e934 --- /dev/null +++ b/runtime/doc/dev_vimpatch.txt @@ -0,0 +1,304 @@ +*dev_vimpatch.txt* Nvim + + NVIM REFERENCE MANUAL + +Merging patches from Vim *dev-vimpatch* + + +Nvim was forked from Vim 7.4.160; it is kept up-to-date with relevant Vim +patches in order to avoid duplicate work. Run `vim-patch.sh` +https://github.com/neovim/neovim/blob/master/scripts/vim-patch.sh to see the +status of Vim patches: +>bash + ./scripts/vim-patch.sh -l +< +Everyone is welcome to |dev-vimpatch-pull-requests| for relevant Vim +patches, but some types of patches are |dev-vimpatch-not-applicable|. +See |dev-vimpatch-quickstart| to get started immediately. + + + Type |gO| to see the table of contents. + +============================================================================== +QUICKSTART *dev-vimpatch-quickstart* + +1. Pull the Nvim source: +>bash + git clone https://github.com/neovim/neovim.git +< +2. Run `./scripts/vim-patch.sh -l` to see the list of missing Vim patches. + +3. Choose a patch from the list (usually the oldest one), e.g. `8.0.0123`. + + - Check for open vim-patch PRs + https://github.com/neovim/neovim/pulls?q=is%3Apr+is%3Aopen+label%3Avim-patch. + +4. Run `./scripts/vim-patch.sh -p 8.0.0123` + +5. Follow the instructions given by the script. + +NOTES ~ + +- It's strongly recommended to work on the oldest missing patch, because + later patches might depend on the changes. +- Use `git log --grep` or `git log -G` to search the Nvim/Vim source history + (even deleted code). E.g. to find `reset_option_was_set`: >bash + + git log -p -G reset_option_was_set +< +- Pass `git log` options like `--grep` and `-G` to `./scripts/vim-patch.sh -L` + to filter unmerged Vim patches E.g. to find `+quickfix` patches: >bash + + ./scripts/vim-patch.sh -L --grep quickfix -- src +< +============================================================================== +PULL REQUESTS *dev-vimpatch-pull-requests* + +Note: vim-patch.sh automates these steps for you. Use it! + +- Install `gh` (https://cli.github.com/) if you want to use `vim-patch.sh` to + create PRs automatically +- The pull request title should include `vim-patch:8.x.xxxx` (no whitespace) +- The commit message + https://github.com/neovim/neovim/commit/4ccf1125ff569eccfc34abc4ad794044c5ab7455 + should include: + - A token indicating the Vim patch number, formatted as follows: + `vim-patch:8.0.0123` (no whitespace) + - A URL pointing to the Vim commit: + https://github.com/vim/vim/commit/c8020ee825b9d9196b1329c0e097424576fc9b3a + - The original Vim commit message, including author + +Reviewers: hint for reviewing `runtime/` patches +https://github.com/neovim/neovim/pull/1744#issuecomment-68202876 + +============================================================================== +NA (NOT APPLICABLE) PATCHES *dev-vimpatch-not-applicable* + +Many Vim patches are not applicable to Nvim. If you find NA patches, visit an +open "version.c: update" pull request +https://github.com/neovim/neovim/pulls?q=is%3Apr+author%3Aapp%2Fgithub-actions+version.c+is%3Aopen +and mention the NA patches in a comment (please edit/update one comment, +rather than adding a new comment for each patch). + +If there are no open `version.c: update` pull requests, include NA patches in +a commit message in the following format: +> + vim-patch: + vim-patch: + ... +< +where `` is a valid Vim version (like `8.0.0123`) or +commit-id (SHA). Each patch is on a separate line. + +It is preferred to include NA patches by squashing it in applicable Vim +patches, especially if the Vim patches are related. First line of the commit +message should be from the applicable Vim patch. +> + ./scripts/vim-patch -p + ./scripts/vim-patch -p + ... + ./scripts/vim-patch -P + git rebase -i master +< +Example: +https://github.com/neovim/neovim/commit/00f60c2ce78fc1280e93d5a36bc7b2267d5f4ac6 + +TYPES OF "NOT APPLICABLE" VIM PATCHES ~ + +- Vim9script features, and anything related to `:scriptversion`. (Nvim + supports Vimscript version 1 only.) Be aware that patches labelled `Vim9:` + may still contain applicable fixes to other parts of the codebase, so these + patch need to be checked individually. +- Updates to `testdir/Makefile` are usually NA because the Makefile implicitly + finds + https://github.com/neovim/neovim/commit/8a677f8a4bff6005fa39f090c14e970c3dfdbe6e#diff-b3c6ad6680a25a1b42095879e3a87104R52 + all `test_*.vim` files. +- Compiler warning fixes: Nvim strives to have no warnings at all, and has a + very different build system from Vim. + - Note: Coverity fixes in Vim are relevant to Nvim. +- `*.proto` changes: Nvim autogenerates function prototypes +- `#ifdef` tweaking: For example, Vim decided to enable `FEAT_VISUAL` for all + platforms - but Nvim already does that. Adding new `FEAT_` guards also isn't + relevant to Nvim. +- Legacy system support: Fixes for legacy systems such as Amiga, OS/2 Xenix, + Mac OS 9, Windows older than XP SP2, are not needed because they are not + supported by Nvim. + - NA files: `src/Make_*`, `src/testdir/Make__*` +- `if_*.c` changes: `if_python.c` et. al. were removed. +- `term.c` changes: the Nvim TUI uses `libtermkey` to read terminal sequences; + Vim's `term.c` was removed. +- `job` patches: incompatible API and implementation + - NA files: `src/channel_*`, `src/job_*`, `src/testdir/test_channel_*`, + `src/testdir/test_job_*` +- `:terminal` patches that modify NA files: incompatible API and + implementation + - NA files: `src/terminal_*`, `src/testdir/test_terminal_*` +- `defaults.vim` patches +- Most GUI-related changes: Nvim GUIs are implemented external to the core C + codebase. + - NA files: `src/gui_*`, `src/gvim_*`, `src/GvimExt/*`, `src/testdir/test_gui*` +- `balloon` changes: Nvim does not support balloon feature + - NA files: `src/beval_*`, `src/testdir/test_balloon_*` +- libvterm changes: Nvim does not vendor libvterm in `src/`. +- Screendump tests from `test_popupwin.vim`, `test_popupwin_textprop.vim`: + https://github.com/neovim/neovim/pull/12741#issuecomment-704677141 +- json changes: incompatible API https://github.com/neovim/neovim/pull/4131 + - NA files: `src/json*`, `src/testdir/test_json.vim` +- `test_restricted.vim` restricted mode is removed in + https://github.com/neovim/neovim/pull/11996 +- Many tests in `test_prompt_buffer.vim` require incompatible Vim features + such as `channel`; they should still be included, but skipped +- non-runtime documentation: Moved to https://neovim.io/doc/, + https://github.com/neovim/neovim/wiki#developers + - NA files: `Filelist`, `README`, `INSTALL`, +- Anything else might be relevant; err on the side of caution, and post an + issue if you aren't sure. + +============================================================================== +VERSION.C *dev-vimpatch-version.c* + +The list of Vim patches in `src/nvim/version.c` is automatically updated +https://github.com/neovim/neovim/pull/7780 based on the presence of +`vim-patch:xxx` tokens in the Nvim git log. + +- Don't update `src/nvim/version.c` yourself. + - `scripts/vim-patch.sh -p` intentionally omits `version.c` to avoid merge + conflicts and save time when porting a patch. +- The automation script (`scripts/vimpatch.lua`) only recognizes tokens like + `vim-patch:8.0.1206`, not `vim-patch:`. + +============================================================================== +CODE DIFFERENCES *dev-vimpatch-code-differences* + +The following functions have been removed or deprecated in favor of newer +alternatives. See `memory.c` +https://github.com/neovim/neovim/blob/master/src/nvim/memory.c for more +information. +> + ----------------------------------------------------------------------- + Deprecated or removed Replacement + ----------------------------------------------------------------------- + vim_free xfree + VIM_CLEAR(&foo) XFREE_CLEAR(foo) + malloc alloc lalloc lalloc_id ALLOC_ONE xmalloc + calloc lalloc_clear xcalloc + realloc vim_realloc xrealloc + mch_memmove memmove + vim_memset copy_chars copy_spaces memset + vim_strbyte strchr + vim_strncpy strncpy xstrlcpy + vim_strcat strncat xstrlcat + VIM_ISWHITE ascii_iswhite + IS_WHITE_OR_NUL ascii_iswhite_or_nul + vim_isalpha mb_isalpha + vim_isNormalIDc ascii_isident + vim_islower vim_isupper mb_islower mb_isupper + vim_tolower vim_toupper mb_tolower mb_toupper + mb_ptr2len utfc_ptr2len + mb_ptr2len_len utfc_ptr2len_len + mb_char2len utf_char2len + mb_char2bytes utf_char2bytes + mb_ptr2cells utf_ptr2cells + mb_ptr2cells_len utf_ptr2cells_len + mb_char2cells utf_char2cells + mb_off2cells utf_off2cells + mb_ptr2char utf_ptr2char + mb_head_off utf_head_off + mb_tail_off utf_cp_tail_off + mb_lefthalve grid_lefthalve + mb_fix_col grid_fix_col + utf_off2cells grid_off2cells + ml_get_curline get_cursor_line_ptr + ml_get_cursor get_cursor_pos_ptr + screen_char ui_line + screen_line grid_put_linebuf + screen_* (most functions) grid_* + update_prepare, update_finish #9484 removed; use update_screen only + ARRAY_LENGTH ARRAY_SIZE + vim_strsave_escape_csi vim_strsave_escape_ks + vim_unescape_csi vim_unescape_ks + gettail path_tail + mch_isFullName path_is_absolute + script_do_profile profile_init + + ----------------------------------------------------------------------- +< +Make sure to note the difference between `utf_` and `utfc_` when replacing +`mb_` functions. Also indirect call syntax `(*mb_ptr2len)(...)` should be +replaced with an ordinary function call `utfc_ptr2len(...)`. +> + ----------------------------------------------------------------------- + Data type Format (Vim source) Portable format (Nvim source) + ------------ ----------------------- ---------------------------------- + long long "%lld" "%" PRId64 + size_t "%ld" "%zu" + linenr_T "%ld" "%" PRIdLINENR + ----------------------------------------------------------------------- +< +- See also: https://github.com/neovim/neovim/pull/1729#discussion_r22423779 +- Vim's `ga_init2` was renamed to `ga_init` and the original `ga_init` is + gone. +- "Old style" Vim tests (`src/testdir/*.in`) should be converted to Lua tests + (see #1286 https://github.com/neovim/neovim/issues/1286 and #1328 + https://github.com/neovim/neovim/pull/1328). See Checklist for migrating + legacy tests + https://github.com/neovim/neovim/blob/master/test/README.md#checklist-for-migrating-legacy-tests. + - However, please do not convert "new style" Vim tests + (`src/testdir/*.vim`) to Lua. The "new style" Vim tests are faster than + the old ones, and converting them takes time and effort better spent + elsewhere. Just copy them to `test/old/testdir/*.vim`. +- Conditions that check `enc_utf8` or `has_mbyte` are obsolete (only the + "true" case is applicable). + - `enc_utf8` and `has_mbyte` macros were removed in + https://github.com/neovim/neovim/pull/13293 +- Check for `CSI` in typeahead buffer is only necessary in Vim with + `FEAT_GUI`. `CSI` does not have a special meaning in typeahead buffer in + Nvim. (also see https://github.com/neovim/neovim/pull/16936) + +============================================================================== +LIST MANAGEMENT *dev-vimpatch-list-management* + +Management of lists (types `list_T` and `listitem_T` from vim) was changed in +https://github.com/neovim/neovim/pull/7708/. There is a lint against the "old" +usage, but here are the most important changes. + +Declarations for the table + +- `list_T list`: a list +- `listitem_T li`: an item of `list` +- `int val` a value for `lv_copyID` + +> + -------------------------------------------------------------------------------------- + Old New Comment + ------------------------------- ------------------------------------------------------ + list->lv_first tv_list_first(list) + list->lv_last tv_list_last(list) + li->li_next TV_LIST_ITEM_NEXT(list, li) To be avoided if possible, must use list which li belongs to. + li->li_prev TV_LIST_ITEM_PREV(list, li) To be avoided if possible, must use list which li belongs to. + Suggestion by @ZyX-l: Use TV_LIST_ITER or indexing instead of the previous two calls. + list->lv_len tv_list_len(list) + list->lv_lock tv_list_locked(list) + &li->li_tv TV_LIST_ITEM_TV(li) + list->lv_refcount++ tv_list_ref(list) + val = list->lv_copyID val = tv_list_copyid(list) + list->lv_copyID = val tv_list_set_copyid(list, val) + + for (li = list->lv_first; TV_LIST_ITER_CONST(list, li, Use TV_LIST_ITER(...) if you need to + li != NULL && another_cond; { if (another_cond) {break;} code}) modify list items (note: assigning copyID is also modification and this happens + li = li->li_next) code always when recursively traversing a list). + + -------------------------------------------------------------------------------------- +< +For more details and some more advanced usage, see `typval.h` and `typval.c`. + +============================================================================== +DOCUMENTATION DIFFERENCES *dev-vimpatch-documentation* + +The following should be removed from all imported documentation, and not be +used in new documentation: + +- `{Only when compiled with ...}`: the vast majority of features have been + made non-optional (see https://github.com/neovim/neovim/wiki/Introduction) + +vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 47ae413714..7545d2c621 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -170,6 +170,7 @@ DEVELOPING NVIM |dev-style| Development style guidelines |dev-theme| Design guidelines (colorschemes etc.) |dev-tools| Tools and techniques for developing Nvim +|dev-vimpatch| Merging patches from Vim Standard plugins ~ *standard-plugin-list* -- cgit From 1d63a057a6cb47e84c204f64ba5406cfe7a3ab93 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 13 Dec 2023 19:16:41 +0100 Subject: docs: fix links --- runtime/doc/dev_tools.txt | 6 +++--- runtime/doc/dev_vimpatch.txt | 1 - runtime/doc/faq.txt | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt index f222930e99..3ee48bec90 100644 --- a/runtime/doc/dev_tools.txt +++ b/runtime/doc/dev_tools.txt @@ -163,10 +163,10 @@ to `tui.c:terminfo_start`. USING GDBSERVER IN TMUX ~ Consider using a custom makefile -https://github.com/neovim/neovim/wiki/Building-Neovim#custom-makefile to +https://github.com/neovim/neovim/blob/master/BUILD.md#custom-makefile to quickly start debugging sessions using the `gdbserver` method mentioned above. -This example `local.mk` will create the debugging session when you type -`make debug`. +This example `local.mk` will create the debugging session when you type `make +debug`. >make .PHONY: dbg-start dbg-attach debug build diff --git a/runtime/doc/dev_vimpatch.txt b/runtime/doc/dev_vimpatch.txt index c302a3e934..4ed585589c 100644 --- a/runtime/doc/dev_vimpatch.txt +++ b/runtime/doc/dev_vimpatch.txt @@ -149,7 +149,6 @@ TYPES OF "NOT APPLICABLE" VIM PATCHES ~ - Many tests in `test_prompt_buffer.vim` require incompatible Vim features such as `channel`; they should still be included, but skipped - non-runtime documentation: Moved to https://neovim.io/doc/, - https://github.com/neovim/neovim/wiki#developers - NA files: `Filelist`, `README`, `INSTALL`, - Anything else might be relevant; err on the side of caution, and post an issue if you aren't sure. diff --git a/runtime/doc/faq.txt b/runtime/doc/faq.txt index 1e9dc052a1..09bf829512 100644 --- a/runtime/doc/faq.txt +++ b/runtime/doc/faq.txt @@ -255,7 +255,7 @@ Use an optimized build: Build type: Release < If it reports `Build type: Debug` and you're building Nvim from source, see -https://github.com/neovim/neovim/wiki/Building-Neovim. +https://github.com/neovim/neovim/blob/master/BUILD.md. COLORS AREN'T DISPLAYED CORRECTLY ~ -- cgit From 5aa1ba3efe0597a5f508b8220961c75c3359ccdb Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Thu, 14 Dec 2023 07:16:21 +0900 Subject: fix(defaults): background detection in tmux (#26557) Wrap the query with passthrough sequence --- runtime/lua/vim/_defaults.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index b73681be04..2db82a04a1 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -298,7 +298,11 @@ if tty then end, }) - io.stdout:write('\027]11;?\007') + local query = '\027]11;?\007' + if os.getenv('TMUX') then + query = string.format('\027Ptmux;%s\027\\', query:gsub('\027', '\027\027')) + end + io.stdout:write(query) timer:start(1000, 0, function() -- Delete the autocommand if no response was received -- cgit From 619407eb548c7df56bc99b945338e9446f846fbb Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 14 Dec 2023 16:08:00 +0800 Subject: feat(nvim_open_term): convert LF => CRLF (#26384) Problem: Unlike termopen(), nvim_open_term() PTYs do not carriage-return the cursor on newline ("\n") input. nvim --clean :let chan_id = nvim_open_term(1, {}) :call chansend(chan_id, ["here", "are", "some", "lines"]) Actual behavior: here are some lines Expected behaviour: here are some lines Solution: Add `force_crlf` option, and enable it by default. --- runtime/doc/api.txt | 2 ++ runtime/doc/news.txt | 2 ++ runtime/lua/vim/_meta/api.lua | 2 ++ runtime/lua/vim/_meta/api_keysets.lua | 1 + 4 files changed, 7 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 4aba1f8141..48bbdc33df 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1231,6 +1231,8 @@ nvim_open_term({buffer}, {*opts}) *nvim_open_term()* is sent as a "\r", not as a "\n". |textlock| applies. It is possible to call |nvim_chan_send()| directly in the callback however. ["input", term, bufnr, data] + • force_crlf: (boolean, default true) Convert "\n" to + "\r\n". Return: ~ Channel id, or 0 on error diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 04f143f0c3..9bfc577e87 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -344,6 +344,8 @@ The following changes to existing APIs or features add new behavior. • Diagnostic sign text is no longer configured with |sign_define()|. Use |vim.diagnostic.config()| instead. +• Added "force_crlf" option field in |nvim_open_term()|. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 4ad0a2e791..231e1c3404 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1446,6 +1446,8 @@ function vim.api.nvim_notify(msg, log_level, opts) end --- is sent as a "\r", not as a "\n". `textlock` applies. It --- is possible to call `nvim_chan_send()` directly in the --- callback however. ["input", term, bufnr, data] +--- • force_crlf: (boolean, default true) Convert "\n" to +--- "\r\n". --- @return integer function vim.api.nvim_open_term(buffer, opts) end diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 6a3e574455..f64cdb8afd 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -217,6 +217,7 @@ error('Cannot require a meta file') --- @class vim.api.keyset.open_term --- @field on_input? function +--- @field force_crlf? boolean --- @class vim.api.keyset.option --- @field scope? string -- cgit From 3c2c022e5e299ecac4663c3813e2db5e2b099ffa Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Thu, 7 Dec 2023 01:34:29 +0600 Subject: refactor(options): remove option type macros Problem: We have `P_(BOOL|NUM|STRING)` macros to represent an option's type, which is redundant because `OptValType` can already do that. The current implementation of option type flags is also too limited to allow adding multitype options in the future. Solution: Remove `P_(BOOL|NUM|STRING)` and replace it with a new `type_flags` attribute in `vimoption_T`. Also do some groundwork for adding multitype options in the future. Side-effects: Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error. --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 9bfc577e87..ad2de7a40a 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -346,6 +346,9 @@ The following changes to existing APIs or features add new behavior. • Added "force_crlf" option field in |nvim_open_term()|. +• Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer + gives an error. + ============================================================================== REMOVED FEATURES *news-removed* -- cgit From 97bea3163a3fe50359e7f6ffda747e28974a818a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 13 Dec 2023 12:00:11 +0000 Subject: feat(lsp): more annotations --- runtime/doc/lsp.txt | 17 ++- runtime/lua/vim/_editor.lua | 2 +- runtime/lua/vim/_meta/vvars.lua | 23 ++++ runtime/lua/vim/lsp.lua | 114 +++++++++++-------- runtime/lua/vim/lsp/_meta.lua | 3 +- runtime/lua/vim/lsp/buf.lua | 6 +- runtime/lua/vim/lsp/codelens.lua | 14 ++- runtime/lua/vim/lsp/diagnostic.lua | 9 ++ runtime/lua/vim/lsp/handlers.lua | 92 ++++++++------- runtime/lua/vim/lsp/inlay_hint.lua | 28 +++-- runtime/lua/vim/lsp/log.lua | 4 +- runtime/lua/vim/lsp/protocol.lua | 2 +- runtime/lua/vim/lsp/rpc.lua | 192 ++++++++++++++++++-------------- runtime/lua/vim/lsp/semantic_tokens.lua | 58 ++++++---- runtime/lua/vim/lsp/sync.lua | 28 +++-- runtime/lua/vim/lsp/util.lua | 4 +- 16 files changed, 366 insertions(+), 230 deletions(-) create mode 100644 runtime/lua/vim/_meta/vvars.lua (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 5e97628f42..40889f4255 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1102,7 +1102,7 @@ with({handler}, {override_config}) *vim.lsp.with()* Function to manage overriding defaults for LSP handlers. Parameters: ~ - • {handler} (function) See |lsp-handler| + • {handler} (lsp.Handler) See |lsp-handler| • {override_config} (table) Table containing the keys to override behavior of the {handler} @@ -1378,6 +1378,7 @@ on_diagnostic({_}, {result}, {ctx}, {config}) < Parameters: ~ + • {ctx} lsp.HandlerContext • {config} (table) Configuration table (see |vim.diagnostic.config()|). *vim.lsp.diagnostic.on_publish_diagnostics()* @@ -1406,6 +1407,7 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config}) < Parameters: ~ + • {ctx} lsp.HandlerContext • {config} (table) Configuration table (see |vim.diagnostic.config()|). @@ -1441,6 +1443,9 @@ get({bufnr}) *vim.lsp.codelens.get()* on_codelens({err}, {result}, {ctx}, {_}) |lsp-handler| for the method `textDocument/codeLens` + Parameters: ~ + • {ctx} lsp.HandlerContext + refresh() *vim.lsp.codelens.refresh()* Refresh the codelens for the current buffer @@ -1549,6 +1554,7 @@ get_at_pos({bufnr}, {row}, {col}) • type (string) token type as string, e.g. "variable" • modifiers (table) token modifiers as a set. E.g., { static = true, readonly = true } + • client_id (integer) *vim.lsp.semantic_tokens.highlight_token()* highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) @@ -1620,6 +1626,7 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()* < Parameters: ~ + • {ctx} lsp.HandlerContext • {config} (table) Configuration table. • border: (default=nil) • Add borders to the floating window @@ -1641,7 +1648,7 @@ signature_help({_}, {result}, {ctx}, {config}) Parameters: ~ • {result} (table) Response from the language server - • {ctx} (table) Client context + • {ctx} lsp.HandlerContext Client context • {config} (table) Configuration table. • border: (default=nil) • Add borders to the floating window @@ -1849,7 +1856,7 @@ make_formatting_params({options}) • {options} (table|nil) with valid `FormattingOptions` entries Return: ~ - `DocumentFormattingParams` object + lsp.DocumentFormattingParams object See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting @@ -2152,7 +2159,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) for LSP server process Return: ~ - (table|nil) Client RPC object, with these methods: + RpcClientPublic|nil Client RPC object, with these methods: • `notify()` |vim.lsp.rpc.notify()| • `request()` |vim.lsp.rpc.request()| • `is_closing()` returns a boolean indicating if the RPC is closing. @@ -2185,6 +2192,6 @@ resolve_capabilities({server_capabilities}) server Return: ~ - (table|nil) Normalized table of capabilities + lsp.ServerCapabilities|nil Normalized table of capabilities vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 6cccbe8313..0bb1becf58 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -478,7 +478,7 @@ do end vim.g = make_dict_accessor('g', false) - vim.v = make_dict_accessor('v', false) + vim.v = make_dict_accessor('v', false) --[[@as vim.v]] vim.b = make_dict_accessor('b') vim.w = make_dict_accessor('w') vim.t = make_dict_accessor('t') diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua new file mode 100644 index 0000000000..059ef04203 --- /dev/null +++ b/runtime/lua/vim/_meta/vvars.lua @@ -0,0 +1,23 @@ +--- @meta _ + +-- TODO(lewis6991): generate this and `:help vim-variable` + +--- @class vim.v +--- The count given for the last Normal mode command. Can be used +--- to get the count before a mapping. Read-only. Example: +--- ```vim +--- :map _x :echo "the count is " .. v:count +--- ``` +--- Note: The is required to remove the line range that you +--- get when typing ':' after a count. +--- When there are two counts, as in "3d2w", they are multiplied, +--- just like what happens in the command, "d6w" for the example. +--- Also used for evaluating the 'formatexpr' option. +--- @field count integer +--- +--- Line number for the 'foldexpr' |fold-expr|, 'formatexpr', +--- 'indentexpr' and 'statuscolumn' expressions, tab page number +--- for 'guitablabel' and 'guitabtooltip'. Only valid while one of +--- these expressions is being evaluated. Read-only when in the |sandbox|. +--- @field lnum integer +vim.v = ... diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 261a3aa5de..31aacd668b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -257,7 +257,7 @@ end --- Validates a client configuration as given to |vim.lsp.start_client()|. --- ---@param config (lsp.ClientConfig) ----@return (string|fun(dispatchers:table):table) Command +---@return (string|fun(dispatchers:vim.rpc.Dispatchers):RpcClientPublic?) Command ---@return string[] Arguments ---@return string Encoding. local function validate_client_config(config) @@ -290,7 +290,7 @@ local function validate_client_config(config) 'flags.debounce_text_changes must be a number with the debounce time in milliseconds' ) - local cmd, cmd_args --- @type (string|fun(dispatchers:table):table), string[] + local cmd, cmd_args --- @type (string|fun(dispatchers:vim.rpc.Dispatchers):RpcClientPublic), string[] local config_cmd = config.cmd if type(config_cmd) == 'function' then cmd = config_cmd @@ -397,13 +397,14 @@ do end, }) + ---@param client lsp.Client ---@return CTGroup local function get_group(client) local allow_inc_sync = if_nil(client.config.flags.allow_incremental_sync, true) local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change') local sync_kind = change_capability or protocol.TextDocumentSyncKind.None if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then - sync_kind = protocol.TextDocumentSyncKind.Full + sync_kind = protocol.TextDocumentSyncKind.Full --[[@as integer]] end return { sync_kind = sync_kind, @@ -572,7 +573,7 @@ do return end - local changes + local changes --- @type lsp.TextDocumentContentChangeEvent[] if sync_kind == protocol.TextDocumentSyncKind.None then return elseif sync_kind == protocol.TextDocumentSyncKind.Incremental then @@ -650,6 +651,7 @@ do end ---@private + ---@param buf_state CTBufferState function changetracking._reset_timer(buf_state) local timer = buf_state.timer if timer then @@ -663,6 +665,8 @@ do --- Flushes any outstanding change notification. ---@private + ---@param client lsp.Client + ---@param bufnr? integer function changetracking.flush(client, bufnr) local group = get_group(client) local state = state_by_group[group] @@ -685,7 +689,7 @@ end --- Default handler for the 'textDocument/didOpen' LSP notification. --- ---@param bufnr integer Number of the buffer, or 0 for current ----@param client table Client object +---@param client lsp.Client Client object local function text_document_did_open_handler(bufnr, client) changetracking.init(client, bufnr) if not vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then @@ -890,7 +894,7 @@ end ---@return string function lsp.status() local percentage = nil - local messages = {} + local messages = {} --- @type string[] for _, client in ipairs(vim.lsp.get_clients()) do for progress in client.progress do local value = progress.value @@ -913,12 +917,15 @@ function lsp.status() end -- Determines whether the given option can be set by `set_defaults`. +---@param bufnr integer +---@param option string +---@return boolean local function is_empty_or_default(bufnr, option) if vim.bo[bufnr][option] == '' then return true end - local info = vim.api.nvim_get_option_info2(option, { buf = bufnr }) + local info = api.nvim_get_option_info2(option, { buf = bufnr }) local scriptinfo = vim.tbl_filter(function(e) return e.sid == info.last_set_sid end, vim.fn.getscriptinfo()) @@ -932,6 +939,7 @@ end ---@private ---@param client lsp.Client +---@param bufnr integer function lsp._set_defaults(client, bufnr) if client.supports_method(ms.textDocument_definition) and is_empty_or_default(bufnr, 'tagfunc') @@ -1131,7 +1139,7 @@ function lsp.start_client(config) --- Returns the default handler if the user hasn't set a custom one. --- ---@param method (string) LSP method name - ---@return lsp-handler|nil The handler for the given method, if defined, or the default from |vim.lsp.handlers| + ---@return lsp.Handler|nil handler for the given method, if defined, or the default from |vim.lsp.handlers| local function resolve_handler(method) return handlers[method] or default_handlers[method] end @@ -1189,7 +1197,7 @@ function lsp.start_client(config) --- Invoked when the client operation throws an error. --- ---@param code (integer) Error code - ---@param err (...) Other arguments may be passed depending on the error kind + ---@param err any Other arguments may be passed depending on the error kind ---@see vim.lsp.rpc.client_errors for possible errors. Use ---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name. function dispatch.on_error(code, err) @@ -1197,7 +1205,9 @@ function lsp.start_client(config) if config.on_error then local status, usererr = pcall(config.on_error, code, err) if not status then - local _ = log.error() and log.error(log_prefix, 'user on_error failed', { err = usererr }) + if log.error() then + log.error(log_prefix, 'user on_error failed', { err = usererr }) + end err_message(log_prefix, ' user on_error failed: ', tostring(usererr)) end end @@ -1283,7 +1293,7 @@ function lsp.start_client(config) end -- Start the RPC client. - local rpc + local rpc --- @type RpcClientPublic? if type(cmd) == 'function' then rpc = cmd(dispatch) else @@ -1306,9 +1316,10 @@ function lsp.start_client(config) rpc = rpc, offset_encoding = offset_encoding, config = config, - attached_buffers = {}, + attached_buffers = {}, --- @type table handlers = handlers, + --- @type table commands = config.commands or {}, --- @type table @@ -1346,7 +1357,7 @@ function lsp.start_client(config) verbose = 'verbose', } - local workspace_folders --- @type table[]? + local workspace_folders --- @type lsp.WorkspaceFolder[]? local root_uri --- @type string? local root_path --- @type string? if config.workspace_folders or config.root_dir then @@ -1426,7 +1437,9 @@ function lsp.start_client(config) end end - local _ = log.trace() and log.trace(log_prefix, 'initialize_params', initialize_params) + if log.trace() then + log.trace(log_prefix, 'initialize_params', initialize_params) + end rpc.request('initialize', initialize_params, function(init_err, result) assert(not init_err, tostring(init_err)) assert(result, 'server sent empty result') @@ -1439,7 +1452,7 @@ function lsp.start_client(config) -- when to send certain events to clients. client.server_capabilities = assert(result.capabilities, "initialize result doesn't contain capabilities") - client.server_capabilities = protocol.resolve_capabilities(client.server_capabilities) + client.server_capabilities = assert(protocol.resolve_capabilities(client.server_capabilities)) if client.server_capabilities.positionEncoding then client.offset_encoding = client.server_capabilities.positionEncoding @@ -1455,12 +1468,13 @@ function lsp.start_client(config) write_error(lsp.client_errors.ON_INIT_CALLBACK_ERROR, err) end end - local _ = log.info() - and log.info( + if log.info() then + log.info( log_prefix, 'server_capabilities', { server_capabilities = client.server_capabilities } ) + end -- Only assign after initialized. active_clients[client_id] = client @@ -1483,7 +1497,7 @@ function lsp.start_client(config) --- ---@param method string LSP method name. ---@param params table|nil LSP request params. - ---@param handler lsp-handler|nil Response |lsp-handler| for this method. + ---@param handler lsp.Handler|nil Response |lsp-handler| for this method. ---@param bufnr integer Buffer handle (0 for current). ---@return boolean status, integer|nil request_id {status} is a bool indicating ---whether the request was successful. If it is `false`, then it will @@ -1677,9 +1691,9 @@ function lsp.start_client(config) --- ---@param command lsp.Command ---@param context? {bufnr: integer} - ---@param handler? lsp-handler only called if a server command + ---@param handler? lsp.Handler only called if a server command function client._exec_cmd(command, context, handler) - context = vim.deepcopy(context or {}) + context = vim.deepcopy(context or {}) --[[@as lsp.HandlerContext]] context.bufnr = context.bufnr or api.nvim_get_current_buf() context.client_id = client.id local cmdname = command.command @@ -1749,29 +1763,32 @@ function lsp.start_client(config) return client_id end ----@private ----@fn text_document_did_change_handler(_, bufnr, changedtick, firstline, lastline, new_lastline, old_byte_size, old_utf32_size, old_utf16_size) --- Notify all attached clients that a buffer has changed. -local text_document_did_change_handler -do - text_document_did_change_handler = function( - _, - bufnr, - changedtick, - firstline, - lastline, - new_lastline - ) - -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached - if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then - return true - end - util.buf_versions[bufnr] = changedtick - changetracking.send_changes(bufnr, firstline, lastline, new_lastline) +---@param _ integer +---@param bufnr integer +---@param changedtick integer +---@param firstline integer +---@param lastline integer +---@param new_lastline integer +---@return true? +local function text_document_did_change_handler( + _, + bufnr, + changedtick, + firstline, + lastline, + new_lastline +) + -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached + if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then + return true end + util.buf_versions[bufnr] = changedtick + changetracking.send_changes(bufnr, firstline, lastline, new_lastline) end ---Buffer lifecycle handler for textDocument/didSave +--- @param bufnr integer local function text_document_did_save_handler(bufnr) bufnr = resolve_bufnr(bufnr) local uri = vim.uri_from_bufnr(bufnr) @@ -1797,7 +1814,7 @@ local function text_document_did_save_handler(bufnr) end local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save') if save_capability then - local included_text + local included_text --- @type string? if type(save_capability) == 'table' and save_capability.includeText then included_text = text(bufnr) end @@ -1826,8 +1843,9 @@ function lsp.buf_attach_client(bufnr, client_id) }) bufnr = resolve_bufnr(bufnr) if not api.nvim_buf_is_loaded(bufnr) then - local _ = log.warn() - and log.warn(string.format('buf_attach_client called on unloaded buffer (id: %d): ', bufnr)) + if log.warn() then + log.warn(string.format('buf_attach_client called on unloaded buffer (id: %d): ', bufnr)) + end return false end local buffer_client_ids = all_buffer_active_clients[bufnr] @@ -2087,7 +2105,7 @@ api.nvim_create_autocmd('VimLeavePre', { client.stop() end - local timeouts = {} + local timeouts = {} --- @type table local max_timeout = 0 local send_kill = false @@ -2134,7 +2152,7 @@ api.nvim_create_autocmd('VimLeavePre', { ---@param bufnr (integer) Buffer handle, or 0 for current. ---@param method (string) LSP method name ---@param params table|nil Parameters to send to the server ----@param handler? lsp-handler See |lsp-handler| +---@param handler? lsp.Handler See |lsp-handler| --- If nil, follows resolution strategy defined in |lsp-handler-configuration| --- ---@return table client_request_ids Map of client-id:request-id pairs @@ -2152,7 +2170,7 @@ function lsp.buf_request(bufnr, method, params, handler) bufnr = resolve_bufnr(bufnr) local method_supported = false local clients = lsp.get_clients({ bufnr = bufnr }) - local client_request_ids = {} + local client_request_ids = {} --- @type table for _, client in ipairs(clients) do if client.supports_method(method, { bufnr = bufnr }) then method_supported = true @@ -2194,7 +2212,7 @@ end --- a `client_id:result` map. ---@return function cancel Function that cancels all requests. function lsp.buf_request_all(bufnr, method, params, handler) - local results = {} + local results = {} --- @type table local result_count = 0 local expected_result_count = 0 @@ -2324,6 +2342,7 @@ function lsp.formatexpr(opts) local params = util.make_formatting_params() local end_line = vim.fn.getline(end_lnum) --[[@as string]] local end_col = util._str_utfindex_enc(end_line, nil, client.offset_encoding) + --- @cast params +lsp.DocumentRangeFormattingParams params.range = { start = { line = start_lnum - 1, @@ -2378,7 +2397,7 @@ end ---@return table result is table of (client_id, client) pairs ---@deprecated Use |vim.lsp.get_clients()| instead. function lsp.buf_get_clients(bufnr) - local result = {} + local result = {} --- @type table for _, client in ipairs(lsp.get_clients({ bufnr = resolve_bufnr(bufnr) })) do result[client.id] = client end @@ -2432,7 +2451,7 @@ function lsp.for_each_buffer_client(bufnr, fn) end --- Function to manage overriding defaults for LSP handlers. ----@param handler (function) See |lsp-handler| +---@param handler (lsp.Handler) See |lsp-handler| ---@param override_config (table) Table containing the keys to override behavior of the {handler} function lsp.with(handler, override_config) return function(err, result, ctx, config) @@ -2497,6 +2516,7 @@ end --- arguments?: any[] --- --- The second argument is the `ctx` of |lsp-handler| +--- @type table lsp.commands = setmetatable({}, { __newindex = function(tbl, key, value) assert(type(key) == 'string', 'The key for commands in `vim.lsp.commands` must be a string') diff --git a/runtime/lua/vim/lsp/_meta.lua b/runtime/lua/vim/lsp/_meta.lua index acf799264e..559939c236 100644 --- a/runtime/lua/vim/lsp/_meta.lua +++ b/runtime/lua/vim/lsp/_meta.lua @@ -1,13 +1,14 @@ ---@meta error('Cannot require a meta file') ----@alias lsp-handler fun(err: lsp.ResponseError|nil, result: any, context: lsp.HandlerContext, config: table|nil): any? +---@alias lsp.Handler fun(err: lsp.ResponseError?, result: any, context: lsp.HandlerContext, config?: table): ...any ---@class lsp.HandlerContext ---@field method string ---@field client_id integer ---@field bufnr? integer ---@field params? any +---@field version? integer ---@class lsp.ResponseError ---@field code integer diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index cf9acc0808..2f754444e9 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -49,7 +49,7 @@ local function request_with_options(name, params, options) local req_handler if options then req_handler = function(err, result, ctx, config) - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) local handler = client.handlers[name] or vim.lsp.handlers[name] handler(err, result, ctx, vim.tbl_extend('force', config or {}, options)) end @@ -299,12 +299,12 @@ function M.rename(new_name, options) )[1] end - local try_use_client - try_use_client = function(idx, client) + local function try_use_client(idx, client) if not client then return end + --- @param name string local function rename(name) local params = util.make_position_params(win, client.offset_encoding) params.newName = name diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 9cccaa1d66..199da288f4 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -6,7 +6,7 @@ local M = {} --- bufnr → true|nil --- to throttle refreshes to at most one at a time -local active_refreshes = {} +local active_refreshes = {} --- @type table ---@type table> --- bufnr -> client_id -> lenses @@ -75,7 +75,7 @@ end function M.run() local line = api.nvim_win_get_cursor(0)[1] local bufnr = api.nvim_get_current_buf() - local options = {} + local options = {} --- @type {client: integer, lens: lsp.CodeLens}[] local lenses_by_client = lens_cache_by_buf[bufnr] or {} for client, lenses in pairs(lenses_by_client) do for _, lens in pairs(lenses) do @@ -230,6 +230,7 @@ local function resolve_lenses(lenses, bufnr, client_id, callback) if lens.command then countdown() else + assert(client) client.request('codeLens/resolve', lens, function(_, result) if api.nvim_buf_is_loaded(bufnr) and result and result.command then lens.command = result.command @@ -257,10 +258,13 @@ end --- |lsp-handler| for the method `textDocument/codeLens` --- +---@param ctx lsp.HandlerContext function M.on_codelens(err, result, ctx, _) if err then - active_refreshes[ctx.bufnr] = nil - local _ = log.error() and log.error('codelens', err) + active_refreshes[assert(ctx.bufnr)] = nil + if log.error() then + log.error('codelens', err) + end return end @@ -270,7 +274,7 @@ function M.on_codelens(err, result, ctx, _) -- once resolved. M.display(result, ctx.bufnr, ctx.client_id) resolve_lenses(result, ctx.bufnr, ctx.client_id, function() - active_refreshes[ctx.bufnr] = nil + active_refreshes[assert(ctx.bufnr)] = nil M.display(result, ctx.bufnr, ctx.client_id) end) end diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index b6f0cfa0b3..cba5b66672 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -37,6 +37,10 @@ local function severity_vim_to_lsp(severity) return severity end +---@param lines string[] +---@param lnum integer +---@param col integer +---@param offset_encoding string ---@return integer local function line_byte_from_position(lines, lnum, col, offset_encoding) if not lines or offset_encoding == 'utf-8' then @@ -52,6 +56,8 @@ local function line_byte_from_position(lines, lnum, col, offset_encoding) return col end +---@param bufnr integer +---@return string[] local function get_buf_lines(bufnr) if vim.api.nvim_buf_is_loaded(bufnr) then return vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) @@ -223,6 +229,7 @@ end --- ) --- ``` --- +---@param ctx lsp.HandlerContext ---@param config table Configuration table (see |vim.diagnostic.config()|). function M.on_publish_diagnostics(_, result, ctx, config) local client_id = ctx.client_id @@ -284,6 +291,7 @@ end --- ) --- ``` --- +---@param ctx lsp.HandlerContext ---@param config table Configuration table (see |vim.diagnostic.config()|). function M.on_diagnostic(_, result, ctx, config) local client_id = ctx.client_id @@ -400,6 +408,7 @@ end local bufstates = {} --- Disable pull diagnostics for a buffer +--- @param bufnr integer --- @private local function disable(bufnr) local bufstate = bufstates[bufnr] diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 6fde55cf04..c03a17fa59 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -4,6 +4,7 @@ local ms = protocol.Methods local util = require('vim.lsp.util') local api = vim.api +--- @type table local M = {} -- FIXME: DOC: Expose in vimdocs @@ -108,8 +109,7 @@ end --see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability M[ms.client_registerCapability] = function(_, result, ctx) local client_id = ctx.client_id - ---@type lsp.Client - local client = vim.lsp.get_client_by_id(client_id) + local client = assert(vim.lsp.get_client_by_id(client_id)) client.dynamic_capabilities:register(result.registrations) for bufnr, _ in pairs(client.attached_buffers) do @@ -139,7 +139,7 @@ end --see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_unregisterCapability M[ms.client_unregisterCapability] = function(_, result, ctx) local client_id = ctx.client_id - local client = vim.lsp.get_client_by_id(client_id) + local client = assert(vim.lsp.get_client_by_id(client_id)) client.dynamic_capabilities:unregister(result.unregisterations) for _, unreg in ipairs(result.unregisterations) do @@ -158,7 +158,7 @@ M[ms.workspace_applyEdit] = function(_, workspace_edit, ctx) ) -- TODO(ashkan) Do something more with label? local client_id = ctx.client_id - local client = vim.lsp.get_client_by_id(client_id) + local client = assert(vim.lsp.get_client_by_id(client_id)) if workspace_edit.label then print('Workspace edit', workspace_edit.label) end @@ -231,22 +231,23 @@ end M[ms.textDocument_references] = function(_, result, ctx, config) if not result or vim.tbl_isempty(result) then vim.notify('No references found') - else - local client = vim.lsp.get_client_by_id(ctx.client_id) - config = config or {} - local title = 'References' - local items = util.locations_to_items(result, client.offset_encoding) + return + end - if config.loclist then - vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) - api.nvim_command('lopen') - elseif config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') - config.on_list({ title = title, items = items, context = ctx }) - else - vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) - api.nvim_command('botright copen') - end + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + config = config or {} + local title = 'References' + local items = util.locations_to_items(result, client.offset_encoding) + + if config.loclist then + vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) + api.nvim_command('lopen') + elseif config.on_list then + assert(type(config.on_list) == 'function', 'on_list is not a function') + config.on_list({ title = title, items = items, context = ctx }) + else + vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) + api.nvim_command('botright copen') end end @@ -259,26 +260,27 @@ end --- ---@param map_result function `((resp, bufnr) -> list)` to convert the response ---@param entity string name of the resource used in a `not found` error message ----@param title_fn function Function to call to generate list title +---@param title_fn fun(ctx: lsp.HandlerContext): string Function to call to generate list title +---@return lsp.Handler local function response_to_list(map_result, entity, title_fn) return function(_, result, ctx, config) if not result or vim.tbl_isempty(result) then vim.notify('No ' .. entity .. ' found') + return + end + config = config or {} + local title = title_fn(ctx) + local items = map_result(result, ctx.bufnr) + + if config.loclist then + vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) + api.nvim_command('lopen') + elseif config.on_list then + assert(type(config.on_list) == 'function', 'on_list is not a function') + config.on_list({ title = title, items = items, context = ctx }) else - config = config or {} - local title = title_fn(ctx) - local items = map_result(result, ctx.bufnr) - - if config.loclist then - vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) - api.nvim_command('lopen') - elseif config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') - config.on_list({ title = title, items = items, context = ctx }) - else - vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) - api.nvim_command('botright copen') - end + vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) + api.nvim_command('botright copen') end end end @@ -304,7 +306,7 @@ M[ms.textDocument_rename] = function(_, result, ctx, _) vim.notify("Language server couldn't provide rename result", vim.log.levels.INFO) return end - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) util.apply_workspace_edit(result, client.offset_encoding) end @@ -313,7 +315,7 @@ M[ms.textDocument_rangeFormatting] = function(_, result, ctx, _) if not result then return end - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) util.apply_text_edits(result, ctx.bufnr, client.offset_encoding) end @@ -322,7 +324,7 @@ M[ms.textDocument_formatting] = function(_, result, ctx, _) if not result then return end - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) util.apply_text_edits(result, ctx.bufnr, client.offset_encoding) end @@ -331,7 +333,8 @@ M[ms.textDocument_completion] = function(_, result, _, _) if vim.tbl_isempty(result or {}) then return end - local row, col = unpack(api.nvim_win_get_cursor(0)) + local cursor = api.nvim_win_get_cursor(0) + local row, col = cursor[1], cursor[2] local line = assert(api.nvim_buf_get_lines(0, row - 1, row, false)[1]) local line_to_cursor = line:sub(col + 1) local textMatch = vim.fn.match(line_to_cursor, '\\k*$') @@ -354,6 +357,7 @@ end --- ) --- ``` --- +---@param ctx lsp.HandlerContext ---@param config table Configuration table. --- - border: (default=nil) --- - Add borders to the floating window @@ -394,14 +398,16 @@ M[ms.textDocument_hover] = M.hover --- Jumps to a location. Used as a handler for multiple LSP methods. ---@param _ nil not used ---@param result (table) result of LSP method; a location or a list of locations. ----@param ctx (table) table containing the context of the request, including the method +---@param ctx (lsp.HandlerContext) table containing the context of the request, including the method ---(`textDocument/definition` can return `Location` or `Location[]` local function location_handler(_, result, ctx, config) if result == nil or vim.tbl_isempty(result) then - local _ = log.info() and log.info(ctx.method, 'No location found') + if log.info() then + log.info(ctx.method, 'No location found') + end return nil end - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) config = config or {} @@ -450,7 +456,7 @@ M[ms.textDocument_implementation] = location_handler --- ``` --- ---@param result table Response from the language server ----@param ctx table Client context +---@param ctx lsp.HandlerContext Client context ---@param config table Configuration table. --- - border: (default=nil) --- - Add borders to the floating window @@ -470,7 +476,7 @@ function M.signature_help(_, result, ctx, config) end return end - local client = vim.lsp.get_client_by_id(ctx.client_id) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) local triggers = vim.tbl_get(client.server_capabilities, 'signatureHelpProvider', 'triggerCharacters') local ft = vim.bo[ctx.bufnr].filetype diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua index 4f7a3b0076..ce1680549e 100644 --- a/runtime/lua/vim/lsp/inlay_hint.lua +++ b/runtime/lua/vim/lsp/inlay_hint.lua @@ -17,13 +17,17 @@ local augroup = api.nvim_create_augroup('vim_lsp_inlayhint', {}) --- |lsp-handler| for the method `textDocument/inlayHint` --- Store hints for a specific buffer and client +---@param result lsp.InlayHint[]? +---@param ctx lsp.HandlerContext ---@private function M.on_inlayhint(err, result, ctx, _) if err then - local _ = log.error() and log.error('inlayhint', err) + if log.error() then + log.error('inlayhint', err) + end return end - local bufnr = ctx.bufnr + local bufnr = assert(ctx.bufnr) if util.buf_versions[bufnr] ~= ctx.version then return end @@ -40,7 +44,7 @@ function M.on_inlayhint(err, result, ctx, _) bufstate.version = ctx.version end local hints_by_client = bufstate.client_hint - local client = vim.lsp.get_client_by_id(client_id) + local client = assert(vim.lsp.get_client_by_id(client_id)) local new_hints_by_lnum = vim.defaulttable() local num_unprocessed = #result @@ -52,6 +56,8 @@ function M.on_inlayhint(err, result, ctx, _) end local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false) + ---@param position lsp.Position + ---@return integer local function pos_to_byte(position) local col = position.character if col > 0 then @@ -78,6 +84,7 @@ function M.on_inlayhint(err, result, ctx, _) end --- |lsp-handler| for the method `textDocument/inlayHint/refresh` +---@param ctx lsp.HandlerContext ---@private function M.on_refresh(err, _, ctx, _) if err then @@ -212,7 +219,7 @@ local function clear(bufnr) end local bufstate = bufstates[bufnr] local client_lens = (bufstate or {}).client_hint or {} - local client_ids = vim.tbl_keys(client_lens) + local client_ids = vim.tbl_keys(client_lens) --- @type integer[] for _, iter_client_id in ipairs(client_ids) do if bufstate then bufstate.client_hint[iter_client_id] = {} @@ -236,7 +243,7 @@ end --- Refresh inlay hints, only if we have attached clients that support it ---@param bufnr (integer) Buffer handle, or 0 for current ----@param opts? table Additional options to pass to util._refresh +---@param opts? lsp.util.RefreshOptions Additional options to pass to util._refresh ---@private local function _refresh(bufnr, opts) opts = opts or {} @@ -312,7 +319,7 @@ api.nvim_set_decoration_provider(namespace, { if bufstate.version ~= util.buf_versions[bufnr] then return end - local hints_by_client = bufstate.client_hint + local hints_by_client = assert(bufstate.client_hint) for lnum = topline, botline do if bufstate.applied[lnum] ~= bufstate.version then @@ -321,14 +328,15 @@ api.nvim_set_decoration_provider(namespace, { local line_hints = hints_by_lnum[lnum] or {} for _, hint in pairs(line_hints) do local text = '' - if type(hint.label) == 'string' then - text = hint.label + local label = hint.label + if type(label) == 'string' then + text = label else - for _, part in ipairs(hint.label) do + for _, part in ipairs(label) do text = text .. part.value end end - local vt = {} + local vt = {} --- @type {[1]: string, [2]: 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 6d2e0bc292..00433474fe 100644 --- a/runtime/lua/vim/lsp/log.lua +++ b/runtime/lua/vim/lsp/log.lua @@ -91,7 +91,9 @@ do -- -- Recommended usage: -- ``` - -- local _ = log.warn() and log.warn("123") + -- if log.warn() then + -- log.warn("123") + -- end -- ``` -- -- This way you can avoid string allocations if the log level isn't high enough. diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index a7c3914834..b2a92cd1ee 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -891,7 +891,7 @@ end --- Creates a normalized object describing LSP server capabilities. ---@param server_capabilities table Table of capabilities supported by the server ----@return table|nil Normalized table of capabilities +---@return lsp.ServerCapabilities|nil Normalized table of capabilities function protocol.resolve_capabilities(server_capabilities) local TextDocumentSyncKind = protocol.TextDocumentSyncKind local textDocumentSync = server_capabilities.textDocumentSync diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 6ab5708721..61ad1e479c 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -26,23 +26,42 @@ local function format_message_with_content_length(encoded_message) }) end +local function log_error(...) + if log.error() then + log.error(...) + end +end + +local function log_info(...) + if log.info() then + log.info(...) + end +end + +local function log_debug(...) + if log.debug() then + log.debug(...) + end +end + --- Parses an LSP Message's header --- ---@param header string: The header to parse. ---@return table # parsed headers local function parse_headers(header) assert(type(header) == 'string', 'header must be a string') - local headers = {} + local headers = {} --- @type table for line in vim.gsplit(header, '\r\n', { plain = true }) do if line == '' then break end + --- @type string?, string? local key, value = line:match('^%s*(%S+)%s*:%s*(.+)%s*$') if key then - key = key:lower():gsub('%-', '_') + key = key:lower():gsub('%-', '_') --- @type string headers[key] = value else - local _ = log.error() and log.error('invalid header line %q', line) + log_error('invalid header line %q', line) error(string.format('invalid header line %q', line)) end end @@ -96,17 +115,17 @@ local function request_parser_loop() end local body = table.concat(body_chunks) -- Yield our data. - buffer = rest - .. ( - coroutine.yield(headers, body) - or error('Expected more data for the body. The server may have died.') - ) -- TODO hmm. + + --- @type string + local data = coroutine.yield(headers, body) + or error('Expected more data for the body. The server may have died.') + buffer = rest .. data else -- Get more data since we don't have enough. - buffer = buffer - .. ( - coroutine.yield() or error('Expected more data for the header. The server may have died.') - ) -- TODO hmm. + --- @type string + local data = coroutine.yield() + or error('Expected more data for the header. The server may have died.') + buffer = buffer .. data end end end @@ -138,7 +157,7 @@ function M.format_rpc_error(err) -- There is ErrorCodes in the LSP specification, -- but in ResponseError.code it is not used and the actual type is number. - local code + local code --- @type string if protocol.ErrorCodes[err.code] then code = string.format('code_name = %s,', protocol.ErrorCodes[err.code]) else @@ -174,48 +193,51 @@ function M.rpc_response_error(code, message, data) }) end -local default_dispatchers = {} +--- @class vim.rpc.Dispatchers +--- @field notification fun(method: string, params: table) +--- @field server_request fun(method: string, params: table): any?, string? +--- @field on_exit fun(code: integer, signal: integer) +--- @field on_error fun(code: integer, err: any) ----@private ---- Default dispatcher for notifications sent to an LSP server. ---- ----@param method (string) The invoked LSP method ----@param params (table): Parameters for the invoked LSP method -function default_dispatchers.notification(method, params) - local _ = log.debug() and log.debug('notification', method, params) -end - ----@private ---- Default dispatcher for requests sent to an LSP server. ---- ----@param method (string) The invoked LSP method ----@param params (table): Parameters for the invoked LSP method ----@return nil ----@return table `vim.lsp.protocol.ErrorCodes.MethodNotFound` -function default_dispatchers.server_request(method, params) - local _ = log.debug() and log.debug('server_request', method, params) - return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound) -end - ----@private ---- Default dispatcher for when a client exits. ---- ----@param code (integer): Exit code ----@param signal (integer): Number describing the signal used to terminate (if ----any) -function default_dispatchers.on_exit(code, signal) - local _ = log.info() and log.info('client_exit', { code = code, signal = signal }) -end +--- @type vim.rpc.Dispatchers +local default_dispatchers = { + --- Default dispatcher for notifications sent to an LSP server. + --- + ---@param method (string) The invoked LSP method + ---@param params (table): Parameters for the invoked LSP method + notification = function(method, params) + log_debug('notification', method, params) + end, ----@private ---- Default dispatcher for client errors. ---- ----@param code (integer): Error code ----@param err (any): Details about the error ----any) -function default_dispatchers.on_error(code, err) - local _ = log.error() and log.error('client_error:', M.client_errors[code], err) -end + --- Default dispatcher for requests sent to an LSP server. + --- + ---@param method (string) The invoked LSP method + ---@param params (table): Parameters for the invoked LSP method + ---@return nil + ---@return table, `vim.lsp.protocol.ErrorCodes.MethodNotFound` + server_request = function(method, params) + log_debug('server_request', method, params) + return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound) + end, + + --- Default dispatcher for when a client exits. + --- + ---@param code (integer): Exit code + ---@param signal (integer): Number describing the signal used to terminate (if + ---any) + on_exit = function(code, signal) + log_info('client_exit', { code = code, signal = signal }) + end, + + --- Default dispatcher for client errors. + --- + ---@param code (integer): Error code + ---@param err (any): Details about the error + ---any) + on_error = function(code, err) + log_error('client_error:', M.client_errors[code], err) + end, +} ---@private function M.create_read_loop(handle_body, on_no_chunk, on_error) @@ -248,8 +270,8 @@ end ---@class RpcClient ---@field message_index integer ----@field message_callbacks table ----@field notify_reply_callbacks table +---@field message_callbacks table +---@field notify_reply_callbacks table ---@field transport table ---@field dispatchers table @@ -258,7 +280,7 @@ local Client = {} ---@private function Client:encode_and_send(payload) - local _ = log.debug() and log.debug('rpc.send', payload) + log_debug('rpc.send', payload) if self.transport.is_closing() then return false end @@ -267,7 +289,7 @@ function Client:encode_and_send(payload) return true end ----@private +---@package --- Sends a notification to the LSP server. ---@param method (string) The invoked LSP method ---@param params (any): Parameters for the invoked LSP method @@ -291,7 +313,7 @@ function Client:send_response(request_id, err, result) }) end ----@private +---@package --- Sends a request to the LSP server and runs {callback} upon response. --- ---@param method (string) The invoked LSP method @@ -329,7 +351,7 @@ function Client:request(method, params, callback, notify_reply_callback) end end ----@private +---@package function Client:on_error(errkind, ...) assert(M.client_errors[errkind]) -- TODO what to do if this fails? @@ -354,17 +376,17 @@ end -- time and log them. This would require storing the timestamp. I could call -- them with an error then, perhaps. ----@private +---@package function Client:handle_body(body) local ok, decoded = pcall(vim.json.decode, body, { luanil = { object = true } }) if not ok then self:on_error(M.client_errors.INVALID_SERVER_JSON, decoded) return end - local _ = log.debug() and log.debug('rpc.receive', decoded) + log_debug('rpc.receive', decoded) if type(decoded.method) == 'string' and decoded.id then - local err + local err --- @type table? -- Schedule here so that the users functions don't trigger an error and -- we can still use the result. schedule(function() @@ -376,11 +398,10 @@ function Client:handle_body(body) decoded.method, decoded.params ) - local _ = log.debug() - and log.debug( - 'server_request: callback result', - { status = status, result = result, err = err } - ) + log_debug( + 'server_request: callback result', + { status = status, result = result, err = err } + ) if status then if result == nil and err == nil then error( @@ -431,7 +452,7 @@ function Client:handle_body(body) if decoded.error then local mute_error = false if decoded.error.code == protocol.ErrorCodes.RequestCancelled then - local _ = log.debug() and log.debug('Received cancellation ack', decoded) + log_debug('Received cancellation ack', decoded) mute_error = true end @@ -467,7 +488,7 @@ function Client:handle_body(body) ) else self:on_error(M.client_errors.NO_RESULT_CALLBACK_FOUND, decoded) - local _ = log.error() and log.error('No callback found for server response id ' .. result_id) + log_error('No callback found for server response id ' .. result_id) end elseif type(decoded.method) == 'string' then -- Notification @@ -495,7 +516,14 @@ local function new_client(dispatchers, transport) return setmetatable(state, { __index = Client }) end +--- @class RpcClientPublic +--- @field is_closing fun(): boolean +--- @field terminate fun() +--- @field request fun(method: string, params: table?, callback: function, notify_reply_callbacks?: function) +--- @field notify fun(methid: string, params: table?): boolean + ---@param client RpcClient +---@return RpcClientPublic local function public_client(client) local result = {} @@ -531,12 +559,14 @@ local function public_client(client) return result end +--- @param dispatchers vim.rpc.Dispatchers? +--- @return vim.rpc.Dispatchers local function merge_dispatchers(dispatchers) if dispatchers then local user_dispatchers = dispatchers dispatchers = {} for dispatch_name, default_dispatch in pairs(default_dispatchers) do - local user_dispatcher = user_dispatchers[dispatch_name] + local user_dispatcher = user_dispatchers[dispatch_name] --- @type function if user_dispatcher then if type(user_dispatcher) ~= 'function' then error(string.format('dispatcher.%s must be a function', dispatch_name)) @@ -547,8 +577,10 @@ local function merge_dispatchers(dispatchers) then user_dispatcher = schedule_wrap(user_dispatcher) end + --- @diagnostic disable-next-line:no-unknown dispatchers[dispatch_name] = user_dispatcher else + --- @diagnostic disable-next-line:no-unknown dispatchers[dispatch_name] = default_dispatch end end @@ -567,7 +599,7 @@ end function M.connect(host, port) return function(dispatchers) dispatchers = merge_dispatchers(dispatchers) - local tcp = uv.new_tcp() + local tcp = assert(uv.new_tcp()) local closing = false local transport = { write = function(msg) @@ -624,15 +656,13 @@ end --- server process. May contain: --- - {cwd} (string) Working directory for the LSP server process --- - {env} (table) Additional environment variables for LSP server process ----@return table|nil Client RPC object, with these methods: +---@return RpcClientPublic|nil Client RPC object, with these methods: --- - `notify()` |vim.lsp.rpc.notify()| --- - `request()` |vim.lsp.rpc.request()| --- - `is_closing()` returns a boolean indicating if the RPC is closing. --- - `terminate()` terminates the RPC client. function M.start(cmd, cmd_args, dispatchers, extra_spawn_params) - if log.info() then - log.info('Starting RPC client', { cmd = cmd, args = cmd_args, extra = extra_spawn_params }) - end + log_info('Starting RPC client', { cmd = cmd, args = cmd_args, extra = extra_spawn_params }) validate({ cmd = { cmd, 's' }, @@ -671,8 +701,8 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params) end) local stderr_handler = function(_, chunk) - if chunk and log.error() then - log.error('rpc', cmd, 'stderr', chunk) + if chunk then + log_error('rpc', cmd, 'stderr', chunk) end end @@ -697,13 +727,13 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params) if not ok then local err = sysobj_or_err --[[@as string]] - local msg = string.format('Spawning language server with cmd: `%s` failed', cmd) + local sfx --- @type string if string.match(err, 'ENOENT') then - msg = msg - .. '. The language server is either not installed, missing from PATH, or not executable.' + sfx = '. The language server is either not installed, missing from PATH, or not executable.' else - msg = msg .. string.format(' with error message: %s', err) + sfx = string.format(' with error message: %s', err) end + local msg = string.format('Spawning language server with cmd: `%s` failed%s', cmd, sfx) vim.notify(msg, vim.log.levels.WARN) return end diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua index a5831c0beb..b0cec0dd0e 100644 --- a/runtime/lua/vim/lsp/semantic_tokens.lua +++ b/runtime/lua/vim/lsp/semantic_tokens.lua @@ -10,7 +10,7 @@ local uv = vim.uv --- @field start_col integer start column 0-based --- @field end_col integer end column 0-based --- @field type string token type as string ---- @field modifiers table token modifiers as a set. E.g., { static = true, readonly = true } +--- @field modifiers table token modifiers as a set. E.g., { static = true, readonly = true } --- @field marked boolean whether this token has had extmarks applied --- --- @class STCurrentResult @@ -21,8 +21,8 @@ local uv = vim.uv --- @field namespace_cleared? boolean whether the namespace was cleared for this result yet --- --- @class STActiveRequest ---- @field request_id integer the LSP request ID of the most recent request sent to the server ---- @field version integer the document version associated with the most recent request +--- @field request_id? integer the LSP request ID of the most recent request sent to the server +--- @field version? integer the document version associated with the most recent request --- --- @class STClientState --- @field namespace integer @@ -72,9 +72,11 @@ end --- Extracts modifier strings from the encoded number in the token array --- +---@param x integer +---@param modifiers_table table ---@return table local function modifiers_from_number(x, modifiers_table) - local modifiers = {} + local modifiers = {} ---@type table local idx = 1 while x > 0 do if bit.band(x, 1) == 1 then @@ -89,20 +91,24 @@ end --- Converts a raw token list to a list of highlight ranges used by the on_win callback --- +---@param data integer[] +---@param bufnr integer +---@param client lsp.Client +---@param request STActiveRequest ---@return STTokenRange[] local function tokens_to_ranges(data, bufnr, client, request) local legend = client.server_capabilities.semanticTokensProvider.legend local token_types = legend.tokenTypes local token_modifiers = legend.tokenModifiers local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false) - local ranges = {} + local ranges = {} ---@type STTokenRange[] local start = uv.hrtime() local ms_to_ns = 1000 * 1000 local yield_interval_ns = 5 * ms_to_ns local co, is_main = coroutine.running() - local line + local line ---@type integer? local start_char = 0 for i = 1, #data, 5 do -- if this function is called from the main coroutine, let it run to completion with no yield @@ -167,6 +173,7 @@ end --- ---@private ---@param bufnr integer +---@return STHighlighter function STHighlighter.new(bufnr) local self = setmetatable({}, { __index = STHighlighter }) @@ -221,7 +228,7 @@ function STHighlighter.new(bufnr) return self end ----@private +---@package function STHighlighter:destroy() for client_id, _ in pairs(self.client_state) do self:detach(client_id) @@ -231,7 +238,7 @@ function STHighlighter:destroy() STHighlighter.active[self.bufnr] = nil end ----@private +---@package function STHighlighter:attach(client_id) local state = self.client_state[client_id] if not state then @@ -244,7 +251,7 @@ function STHighlighter:attach(client_id) end end ----@private +---@package function STHighlighter:detach(client_id) local state = self.client_state[client_id] if state then @@ -267,7 +274,7 @@ end --- Finally, if the request was successful, the requestId and document version --- are saved to facilitate document synchronization in the response. --- ----@private +---@package function STHighlighter:send_request() local version = util.buf_versions[self.bufnr] @@ -303,7 +310,8 @@ function STHighlighter:send_request() -- look client up again using ctx.client_id instead of using a captured -- client object local c = vim.lsp.get_client_by_id(ctx.client_id) - local highlighter = STHighlighter.active[ctx.bufnr] + local bufnr = assert(ctx.bufnr) + local highlighter = STHighlighter.active[bufnr] if not err and c and highlighter then coroutine.wrap(STHighlighter.process_response)(highlighter, response, c, version) end @@ -328,6 +336,7 @@ end --- Finally, a redraw command is issued to force nvim to redraw the screen to --- pick up changed highlight tokens. --- +---@param response lsp.SemanticTokens|lsp.SemanticTokensDelta ---@private function STHighlighter:process_response(response, client, version) local state = self.client_state[client.id] @@ -348,15 +357,15 @@ function STHighlighter:process_response(response, client, version) -- if we have a response to a delta request, update the state of our tokens -- appropriately. if it's a full response, just use that - local tokens + local tokens ---@type integer[] local token_edits = response.edits if token_edits then table.sort(token_edits, function(a, b) return a.start < b.start end) - tokens = {} - local old_tokens = state.current_result.tokens + tokens = {} --- @type integer[] + local old_tokens = assert(state.current_result.tokens) local idx = 1 for _, token_edit in ipairs(token_edits) do vim.list_extend(tokens, old_tokens, idx, token_edit.start) @@ -404,7 +413,9 @@ end --- handler to avoid the "blink" that occurs due to the timing between the --- response handler and the actual redraw. --- ----@private +---@package +---@param topline integer +---@param botline integer function STHighlighter:on_win(topline, botline) for client_id, state in pairs(self.client_state) do local current_result = state.current_result @@ -450,7 +461,7 @@ function STHighlighter:on_win(topline, botline) end local ft = vim.bo[self.bufnr].filetype - local highlights = current_result.highlights + local highlights = assert(current_result.highlights) local first = lower_bound(highlights, topline, 1, #highlights + 1) local last = upper_bound(highlights, botline, first, #highlights + 1) - 1 @@ -480,7 +491,7 @@ end --- Reset the buffer's highlighting state and clears the extmark highlights. --- ----@private +---@package function STHighlighter:reset() for client_id, state in pairs(self.client_state) do api.nvim_buf_clear_namespace(self.bufnr, state.namespace, 0, -1) @@ -499,7 +510,7 @@ end --- in the on_win callback. The rest of the current results are saved --- in case the server supports delta requests. --- ----@private +---@package ---@param client_id integer function STHighlighter:mark_dirty(client_id) local state = self.client_state[client_id] @@ -521,7 +532,7 @@ function STHighlighter:mark_dirty(client_id) end end ----@private +---@package function STHighlighter:on_change() self:reset_timer() if self.debounce > 0 then @@ -636,6 +647,9 @@ function M.stop(bufnr, client_id) end end +--- @class STTokenRangeInspect : STTokenRange +--- @field client_id integer + --- Return the semantic token(s) at the given position. --- If called without arguments, returns the token under the cursor. --- @@ -643,13 +657,14 @@ end ---@param row integer|nil Position row (default cursor position) ---@param col integer|nil Position column (default cursor position) --- ----@return table|nil (table|nil) List of tokens at position. Each token has +---@return STTokenRangeInspect[]|nil (table|nil) List of tokens at position. Each token has --- the following fields: --- - line (integer) line number, 0-based --- - start_col (integer) start column, 0-based --- - end_col (integer) end column, 0-based --- - type (string) token type as string, e.g. "variable" --- - modifiers (table) token modifiers as a set. E.g., { static = true, readonly = true } +--- - client_id (integer) function M.get_at_pos(bufnr, row, col) if bufnr == nil or bufnr == 0 then bufnr = api.nvim_get_current_buf() @@ -665,13 +680,14 @@ function M.get_at_pos(bufnr, row, col) row, col = cursor[1] - 1, cursor[2] end - local tokens = {} + local tokens = {} --- @type STTokenRangeInspect[] for client_id, client in pairs(highlighter.client_state) do local highlights = client.current_result.highlights if highlights then local idx = lower_bound(highlights, row, 1, #highlights + 1) for i = idx, #highlights do local token = highlights[i] + --- @cast token STTokenRangeInspect if token.line > row then break diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua index ca01cdc08b..c2b5b54cb0 100644 --- a/runtime/lua/vim/lsp/sync.lua +++ b/runtime/lua/vim/lsp/sync.lua @@ -58,7 +58,7 @@ local function byte_to_utf(line, byte, offset_encoding) -- convert to 0 based indexing for str_utfindex byte = byte - 1 - local utf_idx + local utf_idx --- @type integer local _ -- Convert the byte range to utf-{8,16,32} and convert 1-based (lua) indexing to 0-based if offset_encoding == 'utf-16' then @@ -73,8 +73,11 @@ local function byte_to_utf(line, byte, offset_encoding) return utf_idx + 1 end +---@param line string +---@param offset_encoding string +---@return integer local function compute_line_length(line, offset_encoding) - local length + local length --- @type integer local _ if offset_encoding == 'utf-16' then _, length = str_utfindex(line) @@ -94,7 +97,7 @@ end ---@return integer byte_idx of first change position ---@return integer char_idx of first change position local function align_end_position(line, byte, offset_encoding) - local char + local char --- @type integer -- If on the first byte, or an empty string: the trivial case if byte == 1 or #line == 0 then char = byte @@ -120,8 +123,8 @@ local function align_end_position(line, byte, offset_encoding) end --- Finds the first line, byte, and char index of the difference between the previous and current lines buffer normalized to the previous codepoint. ----@param prev_lines table list of lines from previous buffer ----@param curr_lines table list of lines from current buffer +---@param prev_lines string[] list of lines from previous buffer +---@param curr_lines string[] list of lines from current buffer ---@param firstline integer firstline from on_lines, adjusted to 1-index ---@param lastline integer lastline from on_lines, adjusted to 1-index ---@param new_lastline integer new_lastline from on_lines, adjusted to 1-index @@ -135,14 +138,14 @@ local function compute_start_range( new_lastline, offset_encoding ) - local char_idx - local byte_idx + local char_idx --- @type integer? + local byte_idx --- @type integer? -- If firstline == lastline, no existing text is changed. All edit operations -- occur on a new line pointed to by lastline. This occurs during insertion of -- new lines(O), the new newline is inserted at the line indicated by -- new_lastline. if firstline == lastline then - local line_idx + local line_idx --- @type integer local line = prev_lines[firstline - 1] if line then line_idx = firstline - 1 @@ -343,6 +346,12 @@ end -- codeunits for utf-32 -- Line endings count here as 2 chars for \r\n (dos), 1 char for \n (unix), and 1 char for \r (mac) -- These correspond to Windows, Linux/macOS (OSX and newer), and macOS (version 9 and prior) +---@param lines string[] +---@param start_range table +---@param end_range table +---@param offset_encoding string +---@param line_ending string +---@return integer local function compute_range_length(lines, start_range, end_range, offset_encoding, line_ending) local line_ending_length = #line_ending -- Single line case @@ -351,7 +360,7 @@ local function compute_range_length(lines, start_range, end_range, offset_encodi end local start_line = lines[start_range.line_idx] - local range_length + local range_length --- @type integer if start_line and #start_line > 0 then range_length = compute_line_length(start_line, offset_encoding) - start_range.char_idx @@ -387,6 +396,7 @@ end ---@param lastline integer line to begin search in old_lines for last difference ---@param new_lastline integer line to begin search in new_lines for last difference ---@param offset_encoding string encoding requested by language server +---@param line_ending string ---@return table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent function M.compute_diff( prev_lines, diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 32b220746f..dc8fb25563 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -2089,7 +2089,7 @@ end --- Creates a `DocumentFormattingParams` object for the current buffer and cursor position. --- ---@param options table|nil with valid `FormattingOptions` entries ----@return `DocumentFormattingParams` object +---@return lsp.DocumentFormattingParams object ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting function M.make_formatting_params(options) validate({ options = { options, 't', true } }) @@ -2228,6 +2228,6 @@ end M._get_line_byte_from_position = get_line_byte_from_position ---@nodoc -M.buf_versions = {} +M.buf_versions = {} ---@type table return M -- cgit From ddcbc5c78a492b55951cd60ba91d3d4cbf35a5c5 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 14 Dec 2023 08:38:26 -0600 Subject: docs: add comment for OSC 11 tmux passthrough (#26566) --- runtime/lua/vim/_defaults.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 2db82a04a1..b75a3dc69e 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -299,9 +299,15 @@ if tty then }) local query = '\027]11;?\007' + + -- tmux 3.3a and earlier do not query the parent terminal for background color. As of the + -- writing of this comment, 3.3a is the latest release, so a passthrough sequence is necessary. + -- The passthrough should be removed as soon as a tmux version later than 3.3a is released. + -- See: https://github.com/neovim/neovim/pull/26557 if os.getenv('TMUX') then query = string.format('\027Ptmux;%s\027\\', query:gsub('\027', '\027\027')) end + io.stdout:write(query) timer:start(1000, 0, function() -- cgit From ef38fdfdc6c84abd8ce7be02eaf8edc91ebc7917 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 14 Dec 2023 09:19:33 -0600 Subject: refactor(diagnostic): use named namespaces (#26568) Anonymous namespaces are more difficult to extend or hook into since they do not appear in the output of nvim_get_namespaces(). Use named namespaces instead. --- runtime/lua/vim/diagnostic.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 0eb1ac7f15..2171ae14e6 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -877,7 +877,8 @@ M.handlers.signs = { local ns = M.get_namespace(namespace) if not ns.user_data.sign_ns then - ns.user_data.sign_ns = api.nvim_create_namespace('') + ns.user_data.sign_ns = + api.nvim_create_namespace(string.format('%s/diagnostic/signs', ns.name)) end local text = {} @@ -938,7 +939,8 @@ M.handlers.underline = { local ns = M.get_namespace(namespace) if not ns.user_data.underline_ns then - ns.user_data.underline_ns = api.nvim_create_namespace('') + ns.user_data.underline_ns = + api.nvim_create_namespace(string.format('%s/diagnostic/underline', ns.name)) end local underline_ns = ns.user_data.underline_ns @@ -1020,7 +1022,8 @@ M.handlers.virtual_text = { local ns = M.get_namespace(namespace) if not ns.user_data.virt_text_ns then - ns.user_data.virt_text_ns = api.nvim_create_namespace('') + ns.user_data.virt_text_ns = + api.nvim_create_namespace(string.format('%s/diagnostic/virtual_text', ns.name)) end local virt_text_ns = ns.user_data.virt_text_ns -- cgit From ffeb31c2f962b895bbc7111dd095e4b5ba27e88d Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Thu, 14 Dec 2023 11:37:45 -0600 Subject: fix(termcap): set 'nested' on TermResponse autocommand --- runtime/lua/vim/termcap.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/lua/vim/termcap.lua b/runtime/lua/vim/termcap.lua index e48657b3c2..ec29acca48 100644 --- a/runtime/lua/vim/termcap.lua +++ b/runtime/lua/vim/termcap.lua @@ -34,6 +34,7 @@ function M.query(caps, cb) local timer = assert(vim.uv.new_timer()) local id = vim.api.nvim_create_autocmd('TermResponse', { + nested = true, callback = function(args) local resp = args.data ---@type string local k, rest = resp:match('^\027P1%+r(%x+)(.*)$') -- cgit From b0e2643cb222989354a4c66c639206c84389a519 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Thu, 14 Dec 2023 11:11:46 -0600 Subject: refactor(defaults): defer setting 'termguicolors' until after VimEnter This ensures that any OptionSet autocommands will fire when the value is changed. --- runtime/lua/vim/_defaults.lua | 67 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index b75a3dc69e..041a8cd669 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -175,6 +175,34 @@ for _, ui in ipairs(vim.api.nvim_list_uis()) do end if tty then + --- Set an option after startup (so that OptionSet is fired), but only if not + --- already set by the user. + --- + --- @param option string Option name + --- @param value string Option value + local function setoption(option, value) + if vim.api.nvim_get_option_info2(option, {}).was_set then + -- Don't do anything if option is already set + return + end + + -- Wait until Nvim is finished starting to set the option to ensure the + -- OptionSet event fires. + if vim.v.vim_did_enter == 1 then + if vim.o[option] ~= value then + vim.o[option] = value + end + else + vim.api.nvim_create_autocmd('VimEnter', { + once = true, + nested = true, + callback = function() + setoption(option, value) + end, + }) + end + end + --- Guess value of 'background' based on terminal color. --- --- We write Operating System Command (OSC) 11 to the terminal to request the @@ -253,30 +281,6 @@ if tty then local timer = assert(vim.uv.new_timer()) - ---@param bg string New value of the 'background' option - local function setbg(bg) - if vim.api.nvim_get_option_info2('background', {}).was_set then - -- Don't do anything if 'background' is already set - return - end - - -- Wait until Nvim is finished starting to set 'background' to ensure the - -- OptionSet event fires. - if vim.v.vim_did_enter == 1 then - if vim.o.background ~= bg then - vim.o.background = bg - end - else - vim.api.nvim_create_autocmd('VimEnter', { - once = true, - nested = true, - callback = function() - setbg(bg) - end, - }) - end - end - local id = vim.api.nvim_create_autocmd('TermResponse', { nested = true, callback = function(args) @@ -290,7 +294,7 @@ if tty then if rr and gg and bb then local luminance = (0.299 * rr) + (0.587 * gg) + (0.114 * bb) local bg = luminance < 0.5 and 'dark' or 'light' - setbg(bg) + setoption('background', bg) end return true @@ -331,15 +335,8 @@ if tty then do if tty.rgb then -- The TUI was able to determine truecolor support - vim.o.termguicolors = true + setoption('termguicolors', true) else - --- Enable 'termguicolors', but only if it was not already set by the user. - local function settgc() - if not vim.api.nvim_get_option_info2('termguicolors', {}).was_set then - vim.o.termguicolors = true - end - end - local caps = {} ---@type table require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found) if not found then @@ -348,7 +345,7 @@ if tty then caps[cap] = true if caps.Tc or caps.RGB or (caps.setrgbf and caps.setrgbb) then - settgc() + setoption('termguicolors', true) end end) @@ -395,7 +392,7 @@ if tty then and tonumber(params[#params - 1]) == g and tonumber(params[#params]) == b then - settgc() + setoption('termguicolors', true) end return true -- cgit From 046efa106e93303bc848edf63887b3bc0889b535 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 15 Dec 2023 06:27:49 +0800 Subject: vim-patch:323dda1484d9 (#26583) runtime(termdebug): add Tbreak command closes: vim/vim#13656 https://github.com/vim/vim/commit/323dda1484d95ee5c8a1b2205f8c495446df75ee Co-authored-by: iam28th --- runtime/doc/nvim_terminal_emulator.txt | 9 +++++++-- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index dbc14f5a44..67e5e53c95 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -283,8 +283,13 @@ gdb: `:Run` [args] run the program with [args] or the previous arguments `:Arguments` {args} set arguments for the next `:Run` - *:Break* set a breakpoint at the current line; a sign will be displayed - *:Clear* delete the breakpoint at the current line + *:Break* set a breakpoint at the cursor position + :Break {position} + set a breakpoint at the specified position + *:Tbreak* set a temporary breakpoint at the cursor position + :Tbreak {position} + set a temporary breakpoint at the specified position + *:Clear* delete the breakpoint at the cursor position *:Step* execute the gdb "step" command *:Over* execute the gdb "next" command (`:Next` is a Vim command) diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 1b5baa9a8b..ee2dc4478e 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -985,6 +985,7 @@ func s:InstallCommands() set cpo&vim command -nargs=? Break call s:SetBreakpoint() + command -nargs=? Tbreak call s:SetBreakpoint(, v:true) command Clear call s:ClearBreakpoint() command Step call s:SendResumingCommand('-exec-step') command Over call s:SendResumingCommand('-exec-next') @@ -1093,6 +1094,7 @@ endfunc " Delete installed debugger commands in the current window. func s:DeleteCommands() delcommand Break + delcommand Tbreak delcommand Clear delcommand Step delcommand Over @@ -1193,7 +1195,7 @@ func s:Until(at) endfunc " :Break - Set a breakpoint at the cursor position. -func s:SetBreakpoint(at) +func s:SetBreakpoint(at, tbreak=v:false) " Setting a breakpoint may not work while the program is running. " Interrupt to make it work. let do_continue = 0 @@ -1206,7 +1208,12 @@ func s:SetBreakpoint(at) " Use the fname:lnum format, older gdb can't handle --source. let at = empty(a:at) ? \ fnameescape(expand('%:p')) . ':' . line('.') : a:at - call s:SendCommand('-break-insert ' . at) + if a:tbreak + let cmd = '-break-insert -t ' . at + else + let cmd = '-break-insert ' . at + endif + call s:SendCommand(cmd) if do_continue Continue endif -- cgit From 165e5ececc25ce2d705efdd8ee6c8406884bf898 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 15 Dec 2023 06:42:29 +0800 Subject: vim-patch:17dca3cb97cd (#26584) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime(doc): grammar & typo fixes closes: vim/vim#13654 https://github.com/vim/vim/commit/17dca3cb97cdd7835e334b990565c8c0b93b1284 Co-authored-by: Dominique Pellé --- runtime/doc/builtin.txt | 6 +++--- runtime/lua/vim/_meta/vimfn.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 4b0da06971..714320279a 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5171,9 +5171,9 @@ printf({fmt}, {expr1} ...) *printf()* < This limits the length of the text used from "line" to "width" bytes. - If the argument to be formatted is specified using a posional - argument specifier, and a '*' is used to indicate that a - number argument is to be used to specify the width or + If the argument to be formatted is specified using a + positional argument specifier, and a '*' is used to indicate + that a number argument is to be used to specify the width or precision, the argument(s) to be used must also be specified using a {n$} positional argument specifier. See |printf-$|. diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 7234b813b6..ead5d8d13b 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -6156,9 +6156,9 @@ function vim.fn.prevnonblank(lnum) end --- Date: Sun, 10 Dec 2023 16:14:29 +0100 Subject: vim-patch:f6869212c9e1 runtime(vim): Update syntax file (vim/vim#13653) Improve variable highlighting in :let, :unlet, :const and :for commands. Match registers and local, global and terminal option variables. https://github.com/vim/vim/commit/f6869212c9e19ec8f2a4434732dd28f84f170163 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index b7ecd917ed..b3eb3239d8 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -153,7 +153,9 @@ syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,v syn match vimIsCommand "\<\h\w*\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" -syn match vimVar "\s\zs&\a\+\>" +syn match vimVar "\s\zs&\%([lg]:\)\=\a\+\>" +syn match vimVar "\s\zs&t_\S[a-zA-Z0-9]\>" +syn match vimVar "\s\zs&t_k;" syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" syn keyword vimCommand contained in @@ -346,6 +348,7 @@ syn match vimRegister '\ Date: Mon, 11 Dec 2023 17:48:23 +0100 Subject: vim-patch:5a68cdf14915 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime(sbt): do not set b:did_ftplugin before sourcing scala ftplugin(vim/vim#13657) The `b:did_ftplugin` guard was set and prevented us from actually sourcing `ftplugin/scala.vim`. Since the latter script also sets the guard properly, we can simply remove the guard here. https://github.com/vim/vim/commit/5a68cdf14915f20a1a6889cd0a76d29ecd374f24 Co-authored-by: Karl Yngve Lervåg --- runtime/ftplugin/sbt.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim index 309d30e503..bf2c7a657a 100644 --- a/runtime/ftplugin/sbt.vim +++ b/runtime/ftplugin/sbt.vim @@ -9,7 +9,6 @@ if exists('b:did_ftplugin') || &cp finish endif -let b:did_ftplugin = 1 - runtime! ftplugin/scala.vim +let b:did_ftplugin = 1 -- cgit From 7e717805be35813bff69493b3d0363e969c47613 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 11 Dec 2023 17:48:42 +0100 Subject: vim-patch:b52e7ac7c61c runtime(netrw): Fix `w:netrw_bannercnt` ref error with `netrw_fastbrowse=2` (vim/vim#13659) * NetRW: Fix `w:netrw_bannercnt` ref error with `netrw_fastbrowse=2` * NetRW: Fix wrong `w:netrw_bannercnt` setting closes: vim/vim#13640 https://github.com/vim/vim/commit/b52e7ac7c61cd88d04ee6b7b1808c361dd4a7640 Co-authored-by: KSR-Yasuda <31273423+KSR-Yasuda@users.noreply.github.com> --- runtime/autoload/netrw.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index b8092ebeeb..501736542f 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -10270,7 +10270,7 @@ fun! s:NetrwRemoteListing() let w:netrw_bannercnt= s:bannercnt endif if !exists("w:netrw_bannercnt") && exists("b:bannercnt") - let w:netrw_bannercnt= s:bannercnt + let w:netrw_bannercnt= b:bannercnt endif call s:RemotePathAnalysis(b:netrw_curdir) @@ -11164,6 +11164,10 @@ endfun fun! s:NetrwLocalRename(path) range " call Dfunc("NetrwLocalRename(path<".a:path.">)") + if !exists("w:netrw_bannercnt") + let w:netrw_bannercnt= b:netrw_bannercnt + endif + " preparation for removing multiple files/directories let ykeep = @@ let ctr = a:firstline @@ -11265,6 +11269,10 @@ fun! s:NetrwLocalRm(path) range " call Dfunc("s:NetrwLocalRm(path<".a:path.">)") " call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("")) + if !exists("w:netrw_bannercnt") + let w:netrw_bannercnt= b:netrw_bannercnt + endif + " preparation for removing multiple files/directories let ykeep = @@ let ret = 0 -- cgit From 65032e03e0c43aa847665933c27cfc477b527968 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 12 Dec 2023 17:22:35 +0100 Subject: vim-patch:1c97b5c0c0b4 runtime(vim): Update syntax file, fix missing for highlight (vim/vim#13668) Fix highlighting of :for command. Link the vimFor syntax group to the vimCommand highlight group. Error introduced in commit f686921 https://github.com/vim/vim/commit/1c97b5c0c0b4a60d652b78da4470aeb8a7509700 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index b3eb3239d8..8f239a6888 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -891,6 +891,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimFuncEcho vimCommand hi def link vimHiCtermul vimHiTerm hi def link vimFold Folded + hi def link vimFor vimCommand hi def link vimFTCmd vimCommand hi def link vimFTOption vimSynType hi def link vimFuncKey vimCommand -- cgit From 34f008e2472425ff89cd58b4ecca633e7d70290c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 15 Dec 2023 01:08:19 +0100 Subject: vim-patch:3afc9f2556fa runtime(cmake): sync runtime files with upstream (vim/vim#13597) https://github.com/vim/vim/commit/3afc9f2556faf2574d7950d879f2bf61612f3367 Co-authored-by: Eisuke Kawashima --- runtime/indent/cmake.vim | 49 +- runtime/syntax/cmake.vim | 4713 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 4637 insertions(+), 125 deletions(-) (limited to 'runtime') diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim index af27c0d49b..c1aa3bff86 100644 --- a/runtime/indent/cmake.vim +++ b/runtime/indent/cmake.vim @@ -3,9 +3,9 @@ " Author: Andy Cedilnik " Maintainer: Dimitri Merejkowsky " Former Maintainer: Karthik Krishnan -" Last Change: 2022 Apr 06 +" Last Change: 2023 Dec 12 " -" Licence: The CMake license applies to this file. See +" License: The CMake license applies to this file. See " https://cmake.org/licensing " This implies that distribution with Vim is allowed @@ -55,32 +55,41 @@ fun! CMakeGetIndent(lnum) let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier . \ '\s*(' . cmake_regex_arguments . \ '\(' . cmake_regex_comment . '\)\?$' - let cmake_indent_close_regex = '^' . cmake_regex_arguments . \ ')\s*' . \ '\(' . cmake_regex_comment . '\)\?$' - let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*(' - let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*(' + let cmake_closing_parens_line = '^\s*\()\+\)\s*$' - " Add - if previous_line =~? cmake_indent_comment_line " Handle comments - let ind = ind - else - if previous_line =~? cmake_indent_begin_regex - let ind = ind + shiftwidth() + let cmake_indent_begin_regex = '^\s*\(BLOCK\|IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*(' + let cmake_indent_end_regex = '^\s*\(ENDBLOCK\|ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*(' + + if this_line =~? cmake_closing_parens_line + if previous_line !~? cmake_indent_open_regex + let ind = ind - shiftwidth() endif - if previous_line =~? cmake_indent_open_regex - let ind = ind + shiftwidth() + else + " Add + if previous_line =~? cmake_indent_comment_line " Handle comments + let ind = ind + else + if previous_line =~? cmake_indent_begin_regex + let ind = ind + shiftwidth() + endif + if previous_line =~? cmake_indent_open_regex + let ind = ind + shiftwidth() + endif endif - endif - " Subtract - if this_line =~? cmake_indent_end_regex - let ind = ind - shiftwidth() - endif - if previous_line =~? cmake_indent_close_regex - let ind = ind - shiftwidth() + " Subtract + if this_line =~? cmake_indent_end_regex + let ind = ind - shiftwidth() + endif + if previous_line !~? cmake_closing_parens_line + if previous_line =~? cmake_indent_close_regex + let ind = ind - shiftwidth() + endif + endif endif return ind diff --git a/runtime/syntax/cmake.vim b/runtime/syntax/cmake.vim index 7340ac238e..c95503beb5 100644 --- a/runtime/syntax/cmake.vim +++ b/runtime/syntax/cmake.vim @@ -1,15 +1,15 @@ " Vim syntax file " Program: CMake - Cross-Platform Makefile Generator -" Version: cmake version 3.9.20170830-ge0713 +" Version: cmake version 3.27.20230713-gdc88dd5 " Language: CMake " Author: Andy Cedilnik , " Nicholas Hutchinson , " Patrick Boettcher " Maintainer: Dimitri Merejkowsky " Former Maintainer: Karthik Krishnan -" Last Change: 2017 Aug 30 +" Last Change: 2023 Jul 13 " -" Licence: The CMake license applies to this file. See +" License: The CMake license applies to this file. See " https://cmake.org/licensing " This implies that distribution with Vim is allowed @@ -19,335 +19,4799 @@ endif let s:keepcpo= &cpo set cpo&vim -syn region cmakeComment start="#" end="$" contains=cmakeTodo,cmakeLuaComment,@Spell -syn region cmakeLuaComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell +syn region cmakeBracketArgument start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell + +syn region cmakeComment start="#\(\[=*\[\)\@!" end="$" contains=cmakeTodo,@Spell +syn region cmakeBracketComment start="#\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo -syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped +syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped,@Spell -syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo +syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo,cmakeVariableValue syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo -syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeArguments,cmakeTodo +syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo,@Spell syn case match syn keyword cmakeProperty contained - \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST + \ ABSTRACT + \ ADDITIONAL_CLEAN_FILES + \ ADDITIONAL_MAKE_CLEAN_FILES + \ ADVANCED + \ AIX_EXPORT_ALL_SYMBOLS + \ ALIASED_TARGET + \ ALIAS_GLOBAL + \ ALLOW_DUPLICATE_CUSTOM_TARGETS + \ ANDROID_ANT_ADDITIONAL_OPTIONS + \ ANDROID_API + \ ANDROID_API_MIN + \ ANDROID_ARCH + \ ANDROID_ASSETS_DIRECTORIES + \ ANDROID_GUI + \ ANDROID_JAR_DEPENDENCIES + \ ANDROID_JAR_DIRECTORIES + \ ANDROID_JAVA_SOURCE_DIR + \ ANDROID_NATIVE_LIB_DEPENDENCIES + \ ANDROID_NATIVE_LIB_DIRECTORIES + \ ANDROID_PROCESS_MAX + \ ANDROID_PROGUARD + \ ANDROID_PROGUARD_CONFIG_PATH + \ ANDROID_SECURE_PROPS_PATH + \ ANDROID_SKIP_ANT_STEP + \ ANDROID_STL_TYPE + \ ARCHIVE_OUTPUT_DIRECTORY + \ ARCHIVE_OUTPUT_NAME + \ ATTACHED_FILES + \ ATTACHED_FILES_ON_FAIL + \ AUTOGEN_BUILD_DIR + \ AUTOGEN_COMMAND_LINE_LENGTH_MAX + \ AUTOGEN_ORIGIN_DEPENDS + \ AUTOGEN_PARALLEL + \ AUTOGEN_SOURCE_GROUP + \ AUTOGEN_USE_SYSTEM_INCLUDE + \ AUTOGEN_TARGETS_FOLDER + \ AUTOGEN_TARGET_DEPENDS + \ AUTOGEN_USE_SYSTEM_INCLUDE + \ AUTOMOC + \ AUTOMOC_COMPILER_PREDEFINES + \ AUTOMOC_DEPEND_FILTERS + \ AUTOMOC_EXECUTABLE + \ AUTOMOC_MACRO_NAMES + \ AUTOMOC_MOC_OPTIONS + \ AUTOMOC_PATH_PREFIX + \ AUTOMOC_SOURCE_GROUP + \ AUTOMOC_TARGETS_FOLDER + \ AUTORCC + \ AUTORCC_EXECUTABLE + \ AUTORCC_OPTIONS + \ AUTORCC_SOURCE_GROUP + \ AUTOUIC + \ AUTOUIC_EXECUTABLE + \ AUTOUIC_OPTIONS + \ AUTOUIC_SEARCH_PATHS + \ AUTOUIC_SOURCE_GROUP + \ BINARY_DIR + \ BUILDSYSTEM_TARGETS + \ BUILD_RPATH + \ BUILD_RPATH_USE_ORIGIN + \ BUILD_WITH_INSTALL_NAME_DIR + \ BUILD_WITH_INSTALL_RPATH + \ BUNDLE + \ BUNDLE_EXTENSION + \ CACHE_VARIABLES + \ CLEAN_NO_CUSTOM + \ CMAKE_CONFIGURE_DEPENDS + \ CMAKE_CUDA_KNOWN_FEATURES + \ CMAKE_CXX_KNOWN_FEATURES + \ CMAKE_C_KNOWN_FEATURES + \ CMAKE_ROLE + \ COMMON_LANGUAGE_RUNTIME + \ COMPATIBLE_INTERFACE_BOOL + \ COMPATIBLE_INTERFACE_NUMBER_MAX + \ COMPATIBLE_INTERFACE_NUMBER_MIN + \ COMPATIBLE_INTERFACE_STRING + \ COMPILE_DEFINITIONS + \ COMPILE_FEATURES + \ COMPILE_FLAGS + \ COMPILE_OPTIONS + \ COMPILE_PDB_NAME + \ COMPILE_PDB_OUTPUT_DIRECTORY + \ COMPILE_WARNING_AS_ERROR + \ COST + \ CPACK_DESKTOP_SHORTCUTS + \ CPACK_NEVER_OVERWRITE + \ CPACK_PERMANENT + \ CPACK_STARTUP_SHORTCUTS + \ CPACK_START_MENU_SHORTCUTS + \ CPACK_WIX_ACL + \ CROSSCOMPILING_EMULATOR + \ CUDA_ARCHITECTURES + \ CUDA_CUBIN_COMPILATION + \ CUDA_EXTENSIONS + \ CUDA_FATBIN_COMPILATION + \ CUDA_OPTIX_COMPILATION + \ CUDA_PTX_COMPILATION + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_RUNTIME_LIBRARY + \ CUDA_SEPARABLE_COMPILATION + \ CUDA_STANDARD + \ CUDA_STANDARD_REQUIRED + \ CXX_EXTENSIONS + \ CXX_MODULE_DIRS + \ CXX_MODULE_SET + \ CXX_MODULE_SETS + \ CXX_SCAN_FOR_MODULES + \ CXX_STANDARD + \ CXX_STANDARD_REQUIRED + \ C_EXTENSIONS + \ C_STANDARD + \ C_STANDARD_REQUIRED + \ DEBUG_CONFIGURATIONS + \ DEBUG_POSTFIX + \ DEFINE_SYMBOL + \ DEFINITIONS + \ DEPENDS + \ DEPLOYMENT_ADDITIONAL_FILES + \ DEPLOYMENT_REMOTE_DIRECTORY + \ DEPRECATION + \ DISABLED + \ DISABLED_FEATURES + \ DISABLE_PRECOMPILE_HEADERS + \ DLL_NAME_WITH_SOVERSION + \ DOTNET_SDK + \ DOTNET_TARGET_FRAMEWORK + \ DOTNET_TARGET_FRAMEWORK_VERSION + \ ECLIPSE_EXTRA_CPROJECT_CONTENTS + \ ECLIPSE_EXTRA_NATURES + \ ENABLED_FEATURES + \ ENABLED_LANGUAGES + \ ENABLE_EXPORTS + \ ENVIRONMENT + \ ENVIRONMENT_MODIFICATION + \ EXCLUDE_FROM_ALL + \ EXCLUDE_FROM_DEFAULT_BUILD + \ EXPORT_COMPILE_COMMANDS + \ EXPORT_NAME + \ EXPORT_NO_SYSTEM + \ EXPORT_PROPERTIES + \ EXTERNAL_OBJECT + \ EchoString + \ FAIL_REGULAR_EXPRESSION + \ FIND_LIBRARY_USE_LIB32_PATHS + \ FIND_LIBRARY_USE_LIB64_PATHS + \ FIND_LIBRARY_USE_LIBX32_PATHS + \ FIND_LIBRARY_USE_OPENBSD_VERSIONING + \ FIXTURES_CLEANUP + \ FIXTURES_REQUIRED + \ FIXTURES_SETUP + \ FOLDER + \ FRAMEWORK + \ FRAMEWORK_VERSION + \ Fortran_BUILDING_INSTRINSIC_MODULES + \ Fortran_FORMAT + \ Fortran_MODULE_DIRECTORY + \ Fortran_PREPROCESS + \ GENERATED + \ GENERATOR_FILE_NAME + \ GENERATOR_IS_MULTI_CONFIG + \ GHS_INTEGRITY_APP + \ GHS_NO_SOURCE_GROUP_FILE + \ GLOBAL_DEPENDS_DEBUG_MODE + \ GLOBAL_DEPENDS_NO_CYCLES + \ GNUtoMS + \ HAS_CXX + \ HEADER_DIRS + \ HEADER_FILE_ONLY + \ HEADER_SET + \ HEADER_SETS + \ HELPSTRING + \ HIP_ARCHITECTURES + \ HIP_EXTENSIONS + \ HIP_STANDARD + \ HIP_STANDARD_REQUIRED + \ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + \ IMPORTED + \ IMPORTED_COMMON_LANGUAGE_RUNTIME + \ IMPORTED_CONFIGURATIONS + \ IMPORTED_GLOBAL + \ IMPORTED_IMPLIB + \ IMPORTED_LIBNAME + \ IMPORTED_LINK_DEPENDENT_LIBRARIES + \ IMPORTED_LINK_INTERFACE_LANGUAGES + \ IMPORTED_LINK_INTERFACE_LIBRARIES + \ IMPORTED_LINK_INTERFACE_MULTIPLICITY + \ IMPORTED_LOCATION + \ IMPORTED_NO_SONAME + \ IMPORTED_NO_SYSTEM + \ IMPORTED_OBJECTS + \ IMPORTED_SONAME + \ IMPORTED_TARGETS + \ IMPORT_PREFIX + \ IMPORT_SUFFIX + \ INCLUDE_DIRECTORIES + \ INCLUDE_REGULAR_EXPRESSION + \ INSTALL_NAME_DIR + \ INSTALL_REMOVE_ENVIRONMENT_RPATH + \ INSTALL_RPATH + \ INSTALL_RPATH_USE_LINK_PATH + \ INTERFACE_AUTOMOC_MACRO_NAMES + \ INTERFACE_AUTOUIC_OPTIONS + \ INTERFACE_AUTOMOC_MACRO_NAMES + \ INTERFACE_COMPILE_DEFINITIONS + \ INTERFACE_COMPILE_FEATURES + \ INTERFACE_COMPILE_OPTIONS + \ INTERFACE_CXX_MODULE_SETS + \ INTERFACE_HEADER_SETS + \ INTERFACE_HEADER_SETS_TO_VERIFY + \ INTERFACE_INCLUDE_DIRECTORIES + \ INTERFACE_LINK_DEPENDS + \ INTERFACE_LINK_DIRECTORIES + \ INTERFACE_LINK_LIBRARIES + \ INTERFACE_LINK_LIBRARIES_DIRECT + \ INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE + \ INTERFACE_LINK_OPTIONS + \ INTERFACE_POSITION_INDEPENDENT_CODE + \ INTERFACE_PRECOMPILE_HEADERS + \ INTERFACE_SOURCES + \ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + \ INTERPROCEDURAL_OPTIMIZATION + \ IN_TRY_COMPILE + \ IOS_INSTALL_COMBINED + \ ISPC_HEADER_DIRECTORY + \ ISPC_HEADER_SUFFIX + \ ISPC_INSTRUCTION_SETS + \ JOB_POOLS + \ JOB_POOL_COMPILE + \ JOB_POOL_LINK + \ JOB_POOL_PRECOMPILE_HEADER + \ KEEP_EXTENSION + \ LABELS + \ LANGUAGE + \ LIBRARY_OUTPUT_DIRECTORY + \ LIBRARY_OUTPUT_NAME + \ LINKER_LANGUAGE + \ LINK_DEPENDS + \ LINK_DEPENDS_NO_SHARED + \ LINK_DIRECTORIES + \ LINK_FLAGS + \ LINK_INTERFACE_LIBRARIES + \ LINK_INTERFACE_MULTIPLICITY + \ LINK_LIBRARIES + \ LINK_LIBRARIES_ONLY_TARGETS + \ LINK_LIBRARY_OVERRIDE + \ LINK_OPTIONS + \ LINK_SEARCH_END_STATIC + \ LINK_SEARCH_START_STATIC + \ LINK_WHAT_YOU_USE + \ LISTFILE_STACK + \ LOCATION + \ MACHO_COMPATIBILITY_VERSION + \ MACHO_CURRENT_VERSION + \ MACOSX_BUNDLE + \ MACOSX_BUNDLE_INFO_PLIST + \ MACOSX_FRAMEWORK_INFO_PLIST + \ MACOSX_PACKAGE_LOCATION + \ MACOSX_RPATH + \ MACROS + \ MANUALLY_ADDED_DEPENDENCIES + \ MEASUREMENT + \ MODIFIED + \ MSVC_DEBUG_INFORMATION_FORMAT + \ MSVC_RUNTIME_LIBRARY + \ NAME + \ NO_SONAME + \ NO_SYSTEM_FROM_IMPORTED + \ OBJCXX_EXTENSIONS + \ OBJCXX_STANDARD + \ OBJCXX_STANDARD_REQUIRED + \ OBJC_EXTENSIONS + \ OBJC_STANDARD + \ OBJC_STANDARD_REQUIRED + \ OBJECT_DEPENDS + \ OBJECT_OUTPUTS + \ OPTIMIZE_DEPENDENCIES + \ OSX_ARCHITECTURES + \ OUTPUT_NAME + \ PACKAGES_FOUND + \ PACKAGES_NOT_FOUND + \ PARENT_DIRECTORY + \ PASS_REGULAR_EXPRESSION + \ PCH_INSTANTIATE_TEMPLATES + \ PCH_WARN_INVALID + \ PDB_NAME + \ PDB_OUTPUT_DIRECTORY + \ POSITION_INDEPENDENT_CODE + \ POST_INSTALL_SCRIPT + \ PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS_REUSE_FROM + \ PREDEFINED_TARGETS_FOLDER + \ PREFIX + \ PRE_INSTALL_SCRIPT + \ PRIVATE_HEADER + \ PROCESSORS + \ PROCESSOR_AFFINITY + \ PROJECT_LABEL + \ PUBLIC_HEADER + \ REPORT_UNDEFINED_PROPERTIES + \ REQUIRED_FILES + \ RESOURCE + \ RESOURCE_GROUPS + \ RESOURCE_LOCK + \ RULE_LAUNCH_COMPILE + \ RULE_LAUNCH_CUSTOM + \ RULE_LAUNCH_LINK + \ RULE_MESSAGES + \ RUNTIME_OUTPUT_DIRECTORY + \ RUNTIME_OUTPUT_NAME + \ RUN_SERIAL + \ SKIP_AUTOGEN + \ SKIP_AUTOMOC + \ SKIP_AUTORCC + \ SKIP_AUTOUIC + \ SKIP_BUILD_RPATH + \ SKIP_LINTING + \ SKIP_PRECOMPILE_HEADERS + \ SKIP_REGULAR_EXPRESSION + \ SKIP_RETURN_CODE + \ SKIP_UNITY_BUILD_INCLUSION + \ SOURCES + \ SOURCE_DIR + \ SOVERSION + \ STATIC_LIBRARY_FLAGS + \ STATIC_LIBRARY_OPTIONS + \ STRINGS + \ SUBDIRECTORIES + \ SUFFIX + \ SYMBOLIC + \ SYSTEM + \ Swift_DEPENDENCIES_FILE + \ Swift_DIAGNOSTICS_FILE + \ Swift_LANGUAGE_VERSION + \ Swift_MODULE_DIRECTORY + \ Swift_MODULE_NAME + \ Swift_COMPILATION_MODE + \ TARGET_ARCHIVES_MAY_BE_SHARED_LIBS + \ TARGET_MESSAGES + \ TARGET_SUPPORTS_SHARED_LIBS + \ TESTS + \ TEST_INCLUDE_FILE + \ TEST_INCLUDE_FILES + \ TIMEOUT + \ TIMEOUT_AFTER_MATCH + \ TIMEOUT_SIGNAL_GRACE_PERIOD + \ TIMEOUT_SIGNAL_NAME + \ TYPE + \ UNITY_BUILD + \ UNITY_BUILD_BATCH_SIZE + \ UNITY_BUILD_CODE_AFTER_INCLUDE + \ UNITY_BUILD_CODE_BEFORE_INCLUDE + \ UNITY_BUILD_MODE + \ UNITY_BUILD_UNIQUE_ID + \ UNITY_GROUP + \ USE_FOLDERS + \ VALUE + \ VARIABLES + \ VERIFY_INTERFACE_HEADER_SETS + \ VERSION + \ VISIBILITY_INLINES_HIDDEN + \ VS_CONFIGURATION_TYPE + \ VS_COPY_TO_OUT_DIR + \ VS_DEBUGGER_COMMAND + \ VS_DEBUGGER_COMMAND_ARGUMENTS + \ VS_DEBUGGER_ENVIRONMENT + \ VS_DEBUGGER_WORKING_DIRECTORY + \ VS_DEPLOYMENT_CONTENT + \ VS_DEPLOYMENT_LOCATION + \ VS_DESKTOP_EXTENSIONS_VERSION + \ VS_DOTNET_DOCUMENTATION_FILE + \ VS_DOTNET_REFERENCES + \ VS_DOTNET_REFERENCES_COPY_LOCAL + \ VS_DOTNET_STARTUP_OBJECT + \ VS_DOTNET_TARGET_FRAMEWORK_VERSION + \ VS_DPI_AWARE + \ VS_GLOBAL_KEYWORD + \ VS_GLOBAL_PROJECT_TYPES + \ VS_GLOBAL_ROOTNAMESPACE + \ VS_INCLUDE_IN_VSIX + \ VS_IOT_EXTENSIONS_VERSION + \ VS_IOT_STARTUP_TASK + \ VS_JUST_MY_CODE_DEBUGGING + \ VS_KEYWORD + \ VS_MOBILE_EXTENSIONS_VERSION + \ VS_NO_COMPILE_BATCHING + \ VS_NO_SOLUTION_DEPLOY + \ VS_PACKAGE_REFERENCES + \ VS_PLATFORM_TOOLSET + \ VS_PROJECT_IMPORT + \ VS_RESOURCE_GENERATOR + \ VS_SCC_AUXPATH + \ VS_SCC_LOCALPATH + \ VS_SCC_PROJECTNAME + \ VS_SCC_PROVIDER + \ VS_SDK_REFERENCES + \ VS_SETTINGS + \ VS_SHADER_DISABLE_OPTIMIZATIONS + \ VS_SHADER_ENABLE_DEBUG + \ VS_SHADER_ENTRYPOINT + \ VS_SHADER_FLAGS + \ VS_SHADER_MODEL + \ VS_SHADER_OBJECT_FILE_NAME + \ VS_SHADER_OUTPUT_HEADER_FILE + \ VS_SHADER_TYPE + \ VS_SHADER_VARIABLE_NAME + \ VS_SOLUTION_DEPLOY + \ VS_STARTUP_PROJECT + \ VS_TOOL_OVERRIDE + \ VS_USER_PROPS + \ VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION + \ VS_WINRT_COMPONENT + \ VS_WINRT_EXTENSIONS + \ VS_WINRT_REFERENCES + \ VS_XAML_TYPE + \ WATCOM_RUNTIME_LIBRARY + \ WILL_FAIL + \ WIN32_EXECUTABLE + \ WINDOWS_EXPORT_ALL_SYMBOLS + \ WORKING_DIRECTORY + \ WRAP_EXCLUDE + \ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY + \ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY + \ XCODE_EMIT_EFFECTIVE_PLATFORM_NAME + \ XCODE_EXPLICIT_FILE_TYPE + \ XCODE_FILE_ATTRIBUTES + \ XCODE_GENERATE_SCHEME + \ XCODE_LAST_KNOWN_FILE_TYPE + \ XCODE_LINK_BUILD_PHASE_MODE + \ XCODE_PRODUCT_TYPE + \ XCODE_SCHEME_ADDRESS_SANITIZER + \ XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN + \ XCODE_SCHEME_ARGUMENTS + \ XCODE_SCHEME_DEBUG_AS_ROOT + \ XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING + \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER + \ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS + \ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ XCODE_SCHEME_ENVIRONMENT + \ XCODE_SCHEME_EXECUTABLE + \ XCODE_SCHEME_GUARD_MALLOC + \ XCODE_SCHEME_LAUNCH_CONFIGURATION + \ XCODE_SCHEME_LAUNCH_MODE + \ XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP + \ XCODE_SCHEME_MALLOC_GUARD_EDGES + \ XCODE_SCHEME_MALLOC_SCRIBBLE + \ XCODE_SCHEME_MALLOC_STACK + \ XCODE_SCHEME_THREAD_SANITIZER + \ XCODE_SCHEME_THREAD_SANITIZER_STOP + \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER + \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ XCODE_SCHEME_LAUNCH_CONFIGURATION + \ XCODE_SCHEME_WORKING_DIRECTORY + \ XCODE_SCHEME_ZOMBIE_OBJECTS + \ XCODE_XCCONFIG + \ XCTEST syn keyword cmakeVariable contained - \ ANDROID APPLE BORLAND BUILD_SHARED_LIBS CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ARCH_ABI CMAKE_ANDROID_ARM_MODE CMAKE_ANDROID_ARM_NEON CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_DEPRECATED_HEADERS CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STANDALONE_TOOLCHAIN CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_DEPEND_FILTERS CMAKE_AUTOMOC_MACRO_NAMES CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_AUTOUIC_SEARCH_PATHS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_RPATH CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_NAME_DIR CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_CODELITE_USE_TARGETS CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNUCC CMAKE_COMPILER_IS_GNUCXX CMAKE_COMPILER_IS_GNUG77 CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CUDA_EXTENSIONS CMAKE_CUDA_STANDARD CMAKE_CUDA_STANDARD_REQUIRED CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DEPENDS_IN_PROJECT_ONLY CMAKE_DIRECTORY_LABELS CMAKE_DL_LIBS CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT CMAKE_ECLIPSE_MAKE_ARGUMENTS CMAKE_ECLIPSE_VERSION CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_INIT CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_SORT_DIRECTION CMAKE_FIND_PACKAGE_SORT_ORDER CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SOLARIS CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_LINK_WHAT_YOU_USE CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_INIT CMAKE_MODULE_PATH CMAKE_MSVCIDE_RUN_PATH CMAKE_NINJA_OUTPUT_PATH_PREFIX CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_DESCRIPTION CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_INIT CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_INIT CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE CMAKE_SYSROOT CMAKE_SYSROOT_COMPILE CMAKE_SYSROOT_LINK CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_Swift_LANGUAGE_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_TRY_COMPILE_TARGET_TYPE CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_CUDA CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_GENERATE_SCHEME CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_INIT_SUBMODULES CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_LABELS_FOR_SUBPROJECTS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_DESCRIPTION PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE XCODE_VERSION + \ ANDROID + \ APPLE + \ BORLAND + \ BSD + \ BUILD_SHARED_LIBS + \ CACHE + \ CMAKE_ABSOLUTE_DESTINATION_FILES + \ CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY + \ CMAKE_ADSP_ROOT + \ CMAKE_AIX_EXPORT_ALL_SYMBOLS + \ CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS + \ CMAKE_ANDROID_API + \ CMAKE_ANDROID_API_MIN + \ CMAKE_ANDROID_ARCH + \ CMAKE_ANDROID_ARCH_ABI + \ CMAKE_ANDROID_ARM_MODE + \ CMAKE_ANDROID_ARM_NEON + \ CMAKE_ANDROID_ASSETS_DIRECTORIES + \ CMAKE_ANDROID_EXCEPTIONS + \ CMAKE_ANDROID_GUI + \ CMAKE_ANDROID_JAR_DEPENDENCIES + \ CMAKE_ANDROID_JAR_DIRECTORIES + \ CMAKE_ANDROID_JAVA_SOURCE_DIR + \ CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES + \ CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES + \ CMAKE_ANDROID_NDK + \ CMAKE_ANDROID_NDK_DEPRECATED_HEADERS + \ CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG + \ CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION + \ CMAKE_ANDROID_NDK_VERSION + \ CMAKE_ANDROID_PROCESS_MAX + \ CMAKE_ANDROID_PROGUARD + \ CMAKE_ANDROID_PROGUARD_CONFIG_PATH + \ CMAKE_ANDROID_RTTI + \ CMAKE_ANDROID_SECURE_PROPS_PATH + \ CMAKE_ANDROID_SKIP_ANT_STEP + \ CMAKE_ANDROID_STANDALONE_TOOLCHAIN + \ CMAKE_ANDROID_STL_TYPE + \ CMAKE_APPBUNDLE_PATH + \ CMAKE_APPLE_SILICON_PROCESSOR + \ CMAKE_AR + \ CMAKE_ARCHIVE_OUTPUT_DIRECTORY + \ CMAKE_ARGC + \ CMAKE_ARGV0 + \ CMAKE_ASM + \ CMAKE_ASM_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_ASM_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_ASM_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_ASM_ARCHIVE_APPEND + \ CMAKE_ASM_ARCHIVE_CREATE + \ CMAKE_ASM_ARCHIVE_FINISH + \ CMAKE_ASM_BYTE_ORDER + \ CMAKE_ASM_CLANG_TIDY + \ CMAKE_ASM_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_ASM_COMPILER + \ CMAKE_ASM_COMPILER_ABI + \ CMAKE_ASM_COMPILER_AR + \ CMAKE_ASM_COMPILER_ARCHITECTURE_ID + \ CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_COMPILER_FRONTEND_VARIANT + \ CMAKE_ASM_COMPILER_ID + \ CMAKE_ASM_COMPILER_LAUNCHER + \ CMAKE_ASM_COMPILER_LOADED + \ CMAKE_ASM_COMPILER_PREDEFINES_COMMAND + \ CMAKE_ASM_COMPILER_RANLIB + \ CMAKE_ASM_COMPILER_TARGET + \ CMAKE_ASM_COMPILER_VERSION + \ CMAKE_ASM_COMPILER_VERSION_INTERNAL + \ CMAKE_ASM_COMPILE_OBJECT + \ CMAKE_ASM_CPPCHECK + \ CMAKE_ASM_CPPLINT + \ CMAKE_ASM_CREATE_SHARED_LIBRARY + \ CMAKE_ASM_CREATE_SHARED_MODULE + \ CMAKE_ASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_EXTENSIONS + \ CMAKE_ASM_EXTENSIONS_DEFAULT + \ CMAKE_ASM_FLAGS + \ CMAKE_ASM_FLAGS_DEBUG + \ CMAKE_ASM_FLAGS_DEBUG_INIT + \ CMAKE_ASM_FLAGS_INIT + \ CMAKE_ASM_FLAGS_MINSIZEREL + \ CMAKE_ASM_FLAGS_MINSIZEREL_INIT + \ CMAKE_ASM_FLAGS_RELEASE + \ CMAKE_ASM_FLAGS_RELEASE_INIT + \ CMAKE_ASM_FLAGS_RELWITHDEBINFO + \ CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_ASM_IGNORE_EXTENSIONS + \ CMAKE_ASM_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_ASM_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_ASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_ASM_IMPLICIT_LINK_LIBRARIES + \ CMAKE_ASM_INCLUDE_WHAT_YOU_USE + \ CMAKE_ASM_INIT + \ CMAKE_ASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_LINKER_LAUNCHER + \ CMAKE_ASM_LINKER_PREFERENCE + \ CMAKE_ASM_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_ASM_LINKER_WRAPPER_FLAG + \ CMAKE_ASM_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_ASM_LINK_EXECUTABLE + \ CMAKE_ASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_ASM_MASM + \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_ASM_MASM_ARCHIVE_APPEND + \ CMAKE_ASM_MASM_ARCHIVE_CREATE + \ CMAKE_ASM_MASM_ARCHIVE_FINISH + \ CMAKE_ASM_MASM_BYTE_ORDER + \ CMAKE_ASM_MASM_CLANG_TIDY + \ CMAKE_ASM_MASM_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_ASM_MASM_COMPILER + \ CMAKE_ASM_MASM_COMPILER_ABI + \ CMAKE_ASM_MASM_COMPILER_AR + \ CMAKE_ASM_MASM_COMPILER_ARCHITECTURE_ID + \ CMAKE_ASM_MASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_MASM_COMPILER_FRONTEND_VARIANT + \ CMAKE_ASM_MASM_COMPILER_ID + \ CMAKE_ASM_MASM_COMPILER_LAUNCHER + \ CMAKE_ASM_MASM_COMPILER_LOADED + \ CMAKE_ASM_MASM_COMPILER_PREDEFINES_COMMAND + \ CMAKE_ASM_MASM_COMPILER_RANLIB + \ CMAKE_ASM_MASM_COMPILER_TARGET + \ CMAKE_ASM_MASM_COMPILER_VERSION + \ CMAKE_ASM_MASM_COMPILER_VERSION_INTERNAL + \ CMAKE_ASM_MASM_COMPILE_OBJECT + \ CMAKE_ASM_MASM_CPPCHECK + \ CMAKE_ASM_MASM_CPPLINT + \ CMAKE_ASM_MASM_CREATE_SHARED_LIBRARY + \ CMAKE_ASM_MASM_CREATE_SHARED_MODULE + \ CMAKE_ASM_MASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_MASM_EXTENSIONS + \ CMAKE_ASM_MASM_EXTENSIONS_DEFAULT + \ CMAKE_ASM_MASM_FLAGS + \ CMAKE_ASM_MASM_FLAGS_DEBUG + \ CMAKE_ASM_MASM_FLAGS_DEBUG_INIT + \ CMAKE_ASM_MASM_FLAGS_INIT + \ CMAKE_ASM_MASM_FLAGS_MINSIZEREL + \ CMAKE_ASM_MASM_FLAGS_MINSIZEREL_INIT + \ CMAKE_ASM_MASM_FLAGS_RELEASE + \ CMAKE_ASM_MASM_FLAGS_RELEASE_INIT + \ CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO + \ CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_ASM_MASM_IGNORE_EXTENSIONS + \ CMAKE_ASM_MASM_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_ASM_MASM_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_ASM_MASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_ASM_MASM_IMPLICIT_LINK_LIBRARIES + \ CMAKE_ASM_MASM_INCLUDE_WHAT_YOU_USE + \ CMAKE_ASM_MASM_INIT + \ CMAKE_ASM_MASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_MASM_LINKER_LAUNCHER + \ CMAKE_ASM_MASM_LINKER_PREFERENCE + \ CMAKE_ASM_MASM_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG + \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_ASM_MASM_LINK_EXECUTABLE + \ CMAKE_ASM_MASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_MASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_MASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_MASM_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_ASM_MASM_OUTPUT_EXTENSION + \ CMAKE_ASM_MASM_PLATFORM_ID + \ CMAKE_ASM_MASM_SIMULATE_ID + \ CMAKE_ASM_MASM_SIMULATE_VERSION + \ CMAKE_ASM_MASM_SIZEOF_DATA_PTR + \ CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_MASM_STANDARD + \ CMAKE_ASM_MASM_STANDARD_DEFAULT + \ CMAKE_ASM_MASM_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_ASM_MASM_STANDARD_LIBRARIES + \ CMAKE_ASM_MASM_STANDARD_REQUIRED + \ CMAKE_ASM_MASM_SUPPORTED + \ CMAKE_ASM_MASM_VISIBILITY_PRESET + \ CMAKE_ASM_NASM + \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_ASM_NASM_ARCHIVE_APPEND + \ CMAKE_ASM_NASM_ARCHIVE_CREATE + \ CMAKE_ASM_NASM_ARCHIVE_FINISH + \ CMAKE_ASM_NASM_BYTE_ORDER + \ CMAKE_ASM_NASM_CLANG_TIDY + \ CMAKE_ASM_NASM_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_ASM_NASM_COMPILER + \ CMAKE_ASM_NASM_COMPILER_ABI + \ CMAKE_ASM_NASM_COMPILER_AR + \ CMAKE_ASM_NASM_COMPILER_ARCHITECTURE_ID + \ CMAKE_ASM_NASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_NASM_COMPILER_FRONTEND_VARIANT + \ CMAKE_ASM_NASM_COMPILER_ID + \ CMAKE_ASM_NASM_COMPILER_LAUNCHER + \ CMAKE_ASM_NASM_COMPILER_LOADED + \ CMAKE_ASM_NASM_COMPILER_PREDEFINES_COMMAND + \ CMAKE_ASM_NASM_COMPILER_RANLIB + \ CMAKE_ASM_NASM_COMPILER_TARGET + \ CMAKE_ASM_NASM_COMPILER_VERSION + \ CMAKE_ASM_NASM_COMPILER_VERSION_INTERNAL + \ CMAKE_ASM_NASM_COMPILE_OBJECT + \ CMAKE_ASM_NASM_CPPCHECK + \ CMAKE_ASM_NASM_CPPLINT + \ CMAKE_ASM_NASM_CREATE_SHARED_LIBRARY + \ CMAKE_ASM_NASM_CREATE_SHARED_MODULE + \ CMAKE_ASM_NASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_NASM_EXTENSIONS + \ CMAKE_ASM_NASM_EXTENSIONS_DEFAULT + \ CMAKE_ASM_NASM_FLAGS + \ CMAKE_ASM_NASM_FLAGS_DEBUG + \ CMAKE_ASM_NASM_FLAGS_DEBUG_INIT + \ CMAKE_ASM_NASM_FLAGS_INIT + \ CMAKE_ASM_NASM_FLAGS_MINSIZEREL + \ CMAKE_ASM_NASM_FLAGS_MINSIZEREL_INIT + \ CMAKE_ASM_NASM_FLAGS_RELEASE + \ CMAKE_ASM_NASM_FLAGS_RELEASE_INIT + \ CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO + \ CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_ASM_NASM_IGNORE_EXTENSIONS + \ CMAKE_ASM_NASM_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_ASM_NASM_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_ASM_NASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_ASM_NASM_IMPLICIT_LINK_LIBRARIES + \ CMAKE_ASM_NASM_INCLUDE_WHAT_YOU_USE + \ CMAKE_ASM_NASM_INIT + \ CMAKE_ASM_NASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_NASM_LINKER_LAUNCHER + \ CMAKE_ASM_NASM_LINKER_PREFERENCE + \ CMAKE_ASM_NASM_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG + \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_ASM_NASM_LINK_EXECUTABLE + \ CMAKE_ASM_NASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_NASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_NASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_NASM_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_ASM_NASM_OUTPUT_EXTENSION + \ CMAKE_ASM_NASM_PLATFORM_ID + \ CMAKE_ASM_NASM_SIMULATE_ID + \ CMAKE_ASM_NASM_SIMULATE_VERSION + \ CMAKE_ASM_NASM_SIZEOF_DATA_PTR + \ CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_NASM_STANDARD + \ CMAKE_ASM_NASM_STANDARD_DEFAULT + \ CMAKE_ASM_NASM_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_ASM_NASM_STANDARD_LIBRARIES + \ CMAKE_ASM_NASM_STANDARD_REQUIRED + \ CMAKE_ASM_NASM_SUPPORTED + \ CMAKE_ASM_NASM_VISIBILITY_PRESET + \ CMAKE_ASM_OUTPUT_EXTENSION + \ CMAKE_ASM_PLATFORM_ID + \ CMAKE_ASM_SIMULATE_ID + \ CMAKE_ASM_SIMULATE_VERSION + \ CMAKE_ASM_SIZEOF_DATA_PTR + \ CMAKE_ASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_STANDARD + \ CMAKE_ASM_STANDARD_DEFAULT + \ CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_ASM_STANDARD_LIBRARIES + \ CMAKE_ASM_STANDARD_REQUIRED + \ CMAKE_ASM_SUPPORTED + \ CMAKE_ASM_VISIBILITY_PRESET + \ CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX + \ CMAKE_AUTOGEN_ORIGIN_DEPENDS + \ CMAKE_AUTOGEN_PARALLEL + \ CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE + \ CMAKE_AUTOGEN_VERBOSE + \ CMAKE_AUTOMOC + \ CMAKE_AUTOMOC_COMPILER_PREDEFINES + \ CMAKE_AUTOMOC_DEPEND_FILTERS + \ CMAKE_AUTOMOC_EXECUTABLE + \ CMAKE_AUTOMOC_MACRO_NAMES + \ CMAKE_AUTOMOC_MOC_OPTIONS + \ CMAKE_AUTOMOC_PATH_PREFIX + \ CMAKE_AUTOMOC_RELAXED_MODE + \ CMAKE_AUTOMOC_EXECUTABLE + \ CMAKE_AUTORCC + \ CMAKE_AUTORCC_EXECUTABLE + \ CMAKE_AUTORCC_OPTIONS + \ CMAKE_AUTORCC_EXECUTABLE + \ CMAKE_AUTOUIC + \ CMAKE_AUTOUIC_EXECUTABLE + \ CMAKE_AUTOUIC_OPTIONS + \ CMAKE_AUTOUIC_SEARCH_PATHS + \ CMAKE_AUTOUIC_EXECUTABLE + \ CMAKE_BACKWARDS_COMPATIBILITY + \ CMAKE_BINARY_DIR + \ CMAKE_BUILD_RPATH + \ CMAKE_BUILD_RPATH_USE_ORIGIN + \ CMAKE_BUILD_TOOL + \ CMAKE_BUILD_TYPE + \ CMAKE_BUILD_WITH_INSTALL_NAME_DIR + \ CMAKE_BUILD_WITH_INSTALL_RPATH + \ CMAKE_C + \ CMAKE_CACHEFILE_DIR + \ CMAKE_CACHE_MAJOR_VERSION + \ CMAKE_CACHE_MINOR_VERSION + \ CMAKE_CACHE_PATCH_VERSION + \ CMAKE_CFG_INTDIR + \ CMAKE_CLANG_VFS_OVERLAY + \ CMAKE_CL_64 + \ CMAKE_CODEBLOCKS_COMPILER_ID + \ CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES + \ CMAKE_CODELITE_USE_TARGETS + \ CMAKE_COLOR_DIAGNOSTICS + \ CMAKE_COLOR_MAKEFILE + \ CMAKE_COMMAND + \ CMAKE_COMPILER_2005 + \ CMAKE_COMPILER_IS_GNUCC + \ CMAKE_COMPILER_IS_GNUCXX + \ CMAKE_COMPILER_IS_GNUG77 + \ CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY + \ CMAKE_COMPILE_WARNING_AS_ERROR + \ CMAKE_CONFIGURATION_TYPES + \ CMAKE_CPACK_COMMAND + \ CMAKE_CROSSCOMPILING + \ CMAKE_CROSSCOMPILING_EMULATOR + \ CMAKE_CROSS_CONFIGS + \ CMAKE_CSharp + \ CMAKE_CSharp_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_CSharp_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_CSharp_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_CSharp_ARCHIVE_APPEND + \ CMAKE_CSharp_ARCHIVE_CREATE + \ CMAKE_CSharp_ARCHIVE_FINISH + \ CMAKE_CSharp_BYTE_ORDER + \ CMAKE_CSharp_CLANG_TIDY + \ CMAKE_CSharp_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_CSharp_COMPILER + \ CMAKE_CSharp_COMPILER_ABI + \ CMAKE_CSharp_COMPILER_AR + \ CMAKE_CSharp_COMPILER_ARCHITECTURE_ID + \ CMAKE_CSharp_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CSharp_COMPILER_FRONTEND_VARIANT + \ CMAKE_CSharp_COMPILER_ID + \ CMAKE_CSharp_COMPILER_LAUNCHER + \ CMAKE_CSharp_COMPILER_LOADED + \ CMAKE_CSharp_COMPILER_PREDEFINES_COMMAND + \ CMAKE_CSharp_COMPILER_RANLIB + \ CMAKE_CSharp_COMPILER_TARGET + \ CMAKE_CSharp_COMPILER_VERSION + \ CMAKE_CSharp_COMPILER_VERSION_INTERNAL + \ CMAKE_CSharp_COMPILE_OBJECT + \ CMAKE_CSharp_CPPCHECK + \ CMAKE_CSharp_CPPLINT + \ CMAKE_CSharp_CREATE_SHARED_LIBRARY + \ CMAKE_CSharp_CREATE_SHARED_MODULE + \ CMAKE_CSharp_CREATE_STATIC_LIBRARY + \ CMAKE_CSharp_EXTENSIONS + \ CMAKE_CSharp_EXTENSIONS_DEFAULT + \ CMAKE_CSharp_FLAGS + \ CMAKE_CSharp_FLAGS_DEBUG + \ CMAKE_CSharp_FLAGS_DEBUG_INIT + \ CMAKE_CSharp_FLAGS_INIT + \ CMAKE_CSharp_FLAGS_MINSIZEREL + \ CMAKE_CSharp_FLAGS_MINSIZEREL_INIT + \ CMAKE_CSharp_FLAGS_RELEASE + \ CMAKE_CSharp_FLAGS_RELEASE_INIT + \ CMAKE_CSharp_FLAGS_RELWITHDEBINFO + \ CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_CSharp_IGNORE_EXTENSIONS + \ CMAKE_CSharp_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_CSharp_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_CSharp_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_CSharp_IMPLICIT_LINK_LIBRARIES + \ CMAKE_CSharp_INCLUDE_WHAT_YOU_USE + \ CMAKE_CSharp_INIT + \ CMAKE_CSharp_LIBRARY_ARCHITECTURE + \ CMAKE_CSharp_LINKER_LAUNCHER + \ CMAKE_CSharp_LINKER_PREFERENCE + \ CMAKE_CSharp_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_CSharp_LINKER_WRAPPER_FLAG + \ CMAKE_CSharp_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_CSharp_LINK_EXECUTABLE + \ CMAKE_CSharp_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CSharp_LINK_LIBRARY_FLAG + \ CMAKE_CSharp_LINK_LIBRARY_SUFFIX + \ CMAKE_CSharp_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_CSharp_OUTPUT_EXTENSION + \ CMAKE_CSharp_PLATFORM_ID + \ CMAKE_CSharp_SIMULATE_ID + \ CMAKE_CSharp_SIMULATE_VERSION + \ CMAKE_CSharp_SIZEOF_DATA_PTR + \ CMAKE_CSharp_SOURCE_FILE_EXTENSIONS + \ CMAKE_CSharp_STANDARD + \ CMAKE_CSharp_STANDARD_DEFAULT + \ CMAKE_CSharp_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_CSharp_STANDARD_LIBRARIES + \ CMAKE_CSharp_STANDARD_REQUIRED + \ CMAKE_CSharp_SUPPORTED + \ CMAKE_CSharp_VISIBILITY_PRESET + \ CMAKE_CTEST_ARGUMENTS + \ CMAKE_CTEST_COMMAND + \ CMAKE_CUDA + \ CMAKE_CUDA_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_CUDA_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_CUDA_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_CUDA_ARCHITECTURES + \ CMAKE_CUDA_ARCHIVE_APPEND + \ CMAKE_CUDA_ARCHIVE_CREATE + \ CMAKE_CUDA_ARCHIVE_FINISH + \ CMAKE_CUDA_BYTE_ORDER + \ CMAKE_CUDA_CLANG_TIDY + \ CMAKE_CUDA_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_CUDA_COMPILER + \ CMAKE_CUDA_COMPILER_ABI + \ CMAKE_CUDA_COMPILER_AR + \ CMAKE_CUDA_COMPILER_ARCHITECTURE_ID + \ CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CUDA_COMPILER_FRONTEND_VARIANT + \ CMAKE_CUDA_COMPILER_ID + \ CMAKE_CUDA_COMPILER_LAUNCHER + \ CMAKE_CUDA_COMPILER_LOADED + \ CMAKE_CUDA_COMPILER_PREDEFINES_COMMAND + \ CMAKE_CUDA_COMPILER_RANLIB + \ CMAKE_CUDA_COMPILER_TARGET + \ CMAKE_CUDA_COMPILER_VERSION + \ CMAKE_CUDA_COMPILER_VERSION_INTERNAL + \ CMAKE_CUDA_COMPILE_FEATURES + \ CMAKE_CUDA_COMPILE_OBJECT + \ CMAKE_CUDA_CPPCHECK + \ CMAKE_CUDA_CPPLINT + \ CMAKE_CUDA_CREATE_SHARED_LIBRARY + \ CMAKE_CUDA_CREATE_SHARED_MODULE + \ CMAKE_CUDA_CREATE_STATIC_LIBRARY + \ CMAKE_CUDA_EXTENSIONS + \ CMAKE_CUDA_EXTENSIONS_DEFAULT + \ CMAKE_CUDA_FLAGS + \ CMAKE_CUDA_FLAGS_DEBUG + \ CMAKE_CUDA_FLAGS_DEBUG_INIT + \ CMAKE_CUDA_FLAGS_INIT + \ CMAKE_CUDA_FLAGS_MINSIZEREL + \ CMAKE_CUDA_FLAGS_MINSIZEREL_INIT + \ CMAKE_CUDA_FLAGS_RELEASE + \ CMAKE_CUDA_FLAGS_RELEASE_INIT + \ CMAKE_CUDA_FLAGS_RELWITHDEBINFO + \ CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_CUDA_HOST_COMPILER + \ CMAKE_CUDA_IGNORE_EXTENSIONS + \ CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES + \ CMAKE_CUDA_INCLUDE_WHAT_YOU_USE + \ CMAKE_CUDA_INIT + \ CMAKE_CUDA_LIBRARY_ARCHITECTURE + \ CMAKE_CUDA_LINKER_LAUNCHER + \ CMAKE_CUDA_LINKER_PREFERENCE + \ CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_CUDA_LINKER_WRAPPER_FLAG + \ CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_CUDA_LINK_EXECUTABLE + \ CMAKE_CUDA_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CUDA_LINK_LIBRARY_FLAG + \ CMAKE_CUDA_LINK_LIBRARY_SUFFIX + \ CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_CUDA_OUTPUT_EXTENSION + \ CMAKE_CUDA_PLATFORM_ID + \ CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS + \ CMAKE_CUDA_RUNTIME_LIBRARY + \ CMAKE_CUDA_SEPARABLE_COMPILATION + \ CMAKE_CUDA_SIMULATE_ID + \ CMAKE_CUDA_SIMULATE_VERSION + \ CMAKE_CUDA_SIZEOF_DATA_PTR + \ CMAKE_CUDA_SOURCE_FILE_EXTENSIONS + \ CMAKE_CUDA_STANDARD + \ CMAKE_CUDA_STANDARD_DEFAULT + \ CMAKE_CUDA_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_CUDA_STANDARD_LIBRARIES + \ CMAKE_CUDA_STANDARD_REQUIRED + \ CMAKE_CUDA_SUPPORTED + \ CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES + \ CMAKE_CUDA_VISIBILITY_PRESET + \ CMAKE_CURRENT_BINARY_DIR + \ CMAKE_CURRENT_FUNCTION + \ CMAKE_CURRENT_FUNCTION_LIST_DIR + \ CMAKE_CURRENT_FUNCTION_LIST_FILE + \ CMAKE_CURRENT_FUNCTION_LIST_LINE + \ CMAKE_CURRENT_LIST_DIR + \ CMAKE_CURRENT_LIST_FILE + \ CMAKE_CURRENT_LIST_LINE + \ CMAKE_CURRENT_SOURCE_DIR + \ CMAKE_CXX + \ CMAKE_CXX_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_CXX_ARCHIVE_APPEND + \ CMAKE_CXX_ARCHIVE_CREATE + \ CMAKE_CXX_ARCHIVE_FINISH + \ CMAKE_CXX_BYTE_ORDER + \ CMAKE_CXX_CLANG_TIDY + \ CMAKE_CXX_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_CXX_COMPILER + \ CMAKE_CXX_COMPILER_ABI + \ CMAKE_CXX_COMPILER_AR + \ CMAKE_CXX_COMPILER_ARCHITECTURE_ID + \ CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CXX_COMPILER_FRONTEND_VARIANT + \ CMAKE_CXX_COMPILER_ID + \ CMAKE_CXX_COMPILER_LAUNCHER + \ CMAKE_CXX_COMPILER_LOADED + \ CMAKE_CXX_COMPILER_PREDEFINES_COMMAND + \ CMAKE_CXX_COMPILER_RANLIB + \ CMAKE_CXX_COMPILER_TARGET + \ CMAKE_CXX_COMPILER_VERSION + \ CMAKE_CXX_COMPILER_VERSION_INTERNAL + \ CMAKE_CXX_COMPILE_FEATURES + \ CMAKE_CXX_COMPILE_OBJECT + \ CMAKE_CXX_CPPCHECK + \ CMAKE_CXX_CPPLINT + \ CMAKE_CXX_CREATE_SHARED_LIBRARY + \ CMAKE_CXX_CREATE_SHARED_MODULE + \ CMAKE_CXX_CREATE_STATIC_LIBRARY + \ CMAKE_CXX_EXTENSIONS + \ CMAKE_CXX_EXTENSIONS_DEFAULT + \ CMAKE_CXX_FLAGS + \ CMAKE_CXX_FLAGS_DEBUG + \ CMAKE_CXX_FLAGS_DEBUG_INIT + \ CMAKE_CXX_FLAGS_INIT + \ CMAKE_CXX_FLAGS_MINSIZEREL + \ CMAKE_CXX_FLAGS_MINSIZEREL_INIT + \ CMAKE_CXX_FLAGS_RELEASE + \ CMAKE_CXX_FLAGS_RELEASE_INIT + \ CMAKE_CXX_FLAGS_RELWITHDEBINFO + \ CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_CXX_IGNORE_EXTENSIONS + \ CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_CXX_IMPLICIT_LINK_LIBRARIES + \ CMAKE_CXX_INCLUDE_WHAT_YOU_USE + \ CMAKE_CXX_INIT + \ CMAKE_CXX_LIBRARY_ARCHITECTURE + \ CMAKE_CXX_LINKER_LAUNCHER + \ CMAKE_CXX_LINKER_PREFERENCE + \ CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_CXX_LINKER_WRAPPER_FLAG + \ CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_CXX_LINK_EXECUTABLE + \ CMAKE_CXX_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CXX_LINK_LIBRARY_FLAG + \ CMAKE_CXX_LINK_LIBRARY_SUFFIX + \ CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_CXX_OUTPUT_EXTENSION + \ CMAKE_CXX_PLATFORM_ID + \ CMAKE_CXX_SCAN_FOR_MODULES + \ CMAKE_CXX_SIMULATE_ID + \ CMAKE_CXX_SIMULATE_VERSION + \ CMAKE_CXX_SIZEOF_DATA_PTR + \ CMAKE_CXX_SOURCE_FILE_EXTENSIONS + \ CMAKE_CXX_STANDARD + \ CMAKE_CXX_STANDARD_DEFAULT + \ CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_CXX_STANDARD_LIBRARIES + \ CMAKE_CXX_STANDARD_REQUIRED + \ CMAKE_CXX_SUPPORTED + \ CMAKE_CXX_VISIBILITY_PRESET + \ CMAKE_C_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_C_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_C_ARCHIVE_APPEND + \ CMAKE_C_ARCHIVE_CREATE + \ CMAKE_C_ARCHIVE_FINISH + \ CMAKE_C_BYTE_ORDER + \ CMAKE_C_CLANG_TIDY + \ CMAKE_C_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_C_COMPILER + \ CMAKE_C_COMPILER_ABI + \ CMAKE_C_COMPILER_AR + \ CMAKE_C_COMPILER_ARCHITECTURE_ID + \ CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_C_COMPILER_FRONTEND_VARIANT + \ CMAKE_C_COMPILER_ID + \ CMAKE_C_COMPILER_LAUNCHER + \ CMAKE_C_COMPILER_LOADED + \ CMAKE_C_COMPILER_PREDEFINES_COMMAND + \ CMAKE_C_COMPILER_RANLIB + \ CMAKE_C_COMPILER_TARGET + \ CMAKE_C_COMPILER_VERSION + \ CMAKE_C_COMPILER_VERSION_INTERNAL + \ CMAKE_C_COMPILE_FEATURES + \ CMAKE_C_COMPILE_OBJECT + \ CMAKE_C_CPPCHECK + \ CMAKE_C_CPPLINT + \ CMAKE_C_CREATE_SHARED_LIBRARY + \ CMAKE_C_CREATE_SHARED_MODULE + \ CMAKE_C_CREATE_STATIC_LIBRARY + \ CMAKE_C_EXTENSIONS + \ CMAKE_C_EXTENSIONS_DEFAULT + \ CMAKE_C_FLAGS + \ CMAKE_C_FLAGS_DEBUG + \ CMAKE_C_FLAGS_DEBUG_INIT + \ CMAKE_C_FLAGS_INIT + \ CMAKE_C_FLAGS_MINSIZEREL + \ CMAKE_C_FLAGS_MINSIZEREL_INIT + \ CMAKE_C_FLAGS_RELEASE + \ CMAKE_C_FLAGS_RELEASE_INIT + \ CMAKE_C_FLAGS_RELWITHDEBINFO + \ CMAKE_C_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_C_IGNORE_EXTENSIONS + \ CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_C_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_C_IMPLICIT_LINK_LIBRARIES + \ CMAKE_C_INCLUDE_WHAT_YOU_USE + \ CMAKE_C_INIT + \ CMAKE_C_LIBRARY_ARCHITECTURE + \ CMAKE_C_LINKER_LAUNCHER + \ CMAKE_C_LINKER_PREFERENCE + \ CMAKE_C_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_C_LINKER_WRAPPER_FLAG + \ CMAKE_C_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_C_LINK_EXECUTABLE + \ CMAKE_C_LINK_LIBRARY_FILE_FLAG + \ CMAKE_C_LINK_LIBRARY_FLAG + \ CMAKE_C_LINK_LIBRARY_SUFFIX + \ CMAKE_C_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_C_OUTPUT_EXTENSION + \ CMAKE_C_PLATFORM_ID + \ CMAKE_C_SIMULATE_ID + \ CMAKE_C_SIMULATE_VERSION + \ CMAKE_C_SIZEOF_DATA_PTR + \ CMAKE_C_SOURCE_FILE_EXTENSIONS + \ CMAKE_C_STANDARD + \ CMAKE_C_STANDARD_DEFAULT + \ CMAKE_C_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_C_STANDARD_LIBRARIES + \ CMAKE_C_STANDARD_REQUIRED + \ CMAKE_C_SUPPORTED + \ CMAKE_C_VISIBILITY_PRESET + \ CMAKE_DEBUG_POSTFIX + \ CMAKE_DEBUG_TARGET_PROPERTIES + \ CMAKE_DEFAULT_BUILD_TYPE + \ CMAKE_DEFAULT_CONFIGS + \ CMAKE_DEPENDS_IN_PROJECT_ONLY + \ CMAKE_DEPENDS_USE_COMPILER + \ CMAKE_DIRECTORY_LABELS + \ CMAKE_DISABLE_PRECOMPILE_HEADERS + \ CMAKE_DLL_NAME_WITH_SOVERSION + \ CMAKE_DL_LIBS + \ CMAKE_DOTNET_SDK + \ CMAKE_DOTNET_TARGET_FRAMEWORK + \ CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION + \ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES + \ CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT + \ CMAKE_ECLIPSE_MAKE_ARGUMENTS + \ CMAKE_ECLIPSE_RESOURCE_ENCODING + \ CMAKE_ECLIPSE_VERSION + \ CMAKE_EDIT_COMMAND + \ CMAKE_ENABLE_EXPORTS + \ CMAKE_ERROR_DEPRECATED + \ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + \ CMAKE_EXECUTABLE_ENABLE_EXPORTS + \ CMAKE_EXECUTABLE_SUFFIX + \ CMAKE_EXECUTABLE_SUFFIX_ASM + \ CMAKE_EXECUTABLE_SUFFIX_ASM_MASM + \ CMAKE_EXECUTABLE_SUFFIX_ASM_NASM + \ CMAKE_EXECUTABLE_SUFFIX_C + \ CMAKE_EXECUTABLE_SUFFIX_CSharp + \ CMAKE_EXECUTABLE_SUFFIX_CUDA + \ CMAKE_EXECUTABLE_SUFFIX_CXX + \ CMAKE_EXECUTABLE_SUFFIX_Fortran + \ CMAKE_EXECUTABLE_SUFFIX_HIP + \ CMAKE_EXECUTABLE_SUFFIX_Java + \ CMAKE_EXECUTABLE_SUFFIX_RC + \ CMAKE_EXECUTABLE_SUFFIX_Swift + \ CMAKE_EXECUTE_PROCESS_COMMAND_ECHO + \ CMAKE_EXE_LINKER_FLAGS + \ CMAKE_EXE_LINKER_FLAGS_INIT + \ CMAKE_EXPORT_COMPILE_COMMANDS + \ CMAKE_EXPORT_NO_PACKAGE_REGISTRY + \ CMAKE_EXPORT_PACKAGE_REGISTRY + \ CMAKE_EXTRA_GENERATOR + \ CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES + \ CMAKE_FIND_APPBUNDLE + \ CMAKE_FIND_DEBUG_MODE + \ CMAKE_FIND_FRAMEWORK + \ CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX + \ CMAKE_FIND_LIBRARY_PREFIXES + \ CMAKE_FIND_LIBRARY_SUFFIXES + \ CMAKE_FIND_NO_INSTALL_PREFIX + \ CMAKE_FIND_PACKAGE_NAME + \ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY + \ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY + \ CMAKE_FIND_PACKAGE_PREFER_CONFIG + \ CMAKE_FIND_PACKAGE_REDIRECTS_DIR + \ CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS + \ CMAKE_FIND_PACKAGE_SORT_DIRECTION + \ CMAKE_FIND_PACKAGE_SORT_ORDER + \ CMAKE_FIND_PACKAGE_TARGETS_GLOBAL + \ CMAKE_FIND_PACKAGE_WARN_NO_MODULE + \ CMAKE_FIND_ROOT_PATH + \ CMAKE_FIND_ROOT_PATH_MODE_INCLUDE + \ CMAKE_FIND_ROOT_PATH_MODE_LIBRARY + \ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE + \ CMAKE_FIND_ROOT_PATH_MODE_PROGRAM + \ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH + \ CMAKE_FIND_USE_INSTALL_PREFIX + \ CMAKE_FIND_USE_CMAKE_PATH + \ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH + \ CMAKE_FIND_USE_INSTALL_PREFIX + \ CMAKE_FIND_USE_PACKAGE_REGISTRY + \ CMAKE_FIND_USE_PACKAGE_ROOT_PATH + \ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH + \ CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY + \ CMAKE_FOLDER + \ CMAKE_FRAMEWORK + \ CMAKE_FRAMEWORK_PATH + \ CMAKE_Fortran + \ CMAKE_Fortran_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_Fortran_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_Fortran_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_Fortran_ARCHIVE_APPEND + \ CMAKE_Fortran_ARCHIVE_CREATE + \ CMAKE_Fortran_ARCHIVE_FINISH + \ CMAKE_Fortran_BYTE_ORDER + \ CMAKE_Fortran_CLANG_TIDY + \ CMAKE_Fortran_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_Fortran_COMPILER + \ CMAKE_Fortran_COMPILER_ABI + \ CMAKE_Fortran_COMPILER_AR + \ CMAKE_Fortran_COMPILER_ARCHITECTURE_ID + \ CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Fortran_COMPILER_FRONTEND_VARIANT + \ CMAKE_Fortran_COMPILER_ID + \ CMAKE_Fortran_COMPILER_LAUNCHER + \ CMAKE_Fortran_COMPILER_LOADED + \ CMAKE_Fortran_COMPILER_PREDEFINES_COMMAND + \ CMAKE_Fortran_COMPILER_RANLIB + \ CMAKE_Fortran_COMPILER_TARGET + \ CMAKE_Fortran_COMPILER_VERSION + \ CMAKE_Fortran_COMPILER_VERSION_INTERNAL + \ CMAKE_Fortran_COMPILE_OBJECT + \ CMAKE_Fortran_CPPCHECK + \ CMAKE_Fortran_CPPLINT + \ CMAKE_Fortran_CREATE_SHARED_LIBRARY + \ CMAKE_Fortran_CREATE_SHARED_MODULE + \ CMAKE_Fortran_CREATE_STATIC_LIBRARY + \ CMAKE_Fortran_EXTENSIONS + \ CMAKE_Fortran_EXTENSIONS_DEFAULT + \ CMAKE_Fortran_FLAGS + \ CMAKE_Fortran_FLAGS_DEBUG + \ CMAKE_Fortran_FLAGS_DEBUG_INIT + \ CMAKE_Fortran_FLAGS_INIT + \ CMAKE_Fortran_FLAGS_MINSIZEREL + \ CMAKE_Fortran_FLAGS_MINSIZEREL_INIT + \ CMAKE_Fortran_FLAGS_RELEASE + \ CMAKE_Fortran_FLAGS_RELEASE_INIT + \ CMAKE_Fortran_FLAGS_RELWITHDEBINFO + \ CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_Fortran_FORMAT + \ CMAKE_Fortran_IGNORE_EXTENSIONS + \ CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES + \ CMAKE_Fortran_INCLUDE_WHAT_YOU_USE + \ CMAKE_Fortran_INIT + \ CMAKE_Fortran_LIBRARY_ARCHITECTURE + \ CMAKE_Fortran_LINKER_LAUNCHER + \ CMAKE_Fortran_LINKER_PREFERENCE + \ CMAKE_Fortran_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_Fortran_LINKER_WRAPPER_FLAG + \ CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_Fortran_LINK_EXECUTABLE + \ CMAKE_Fortran_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Fortran_LINK_LIBRARY_FLAG + \ CMAKE_Fortran_LINK_LIBRARY_SUFFIX + \ CMAKE_Fortran_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_Fortran_MODDIR_DEFAULT + \ CMAKE_Fortran_MODDIR_FLAG + \ CMAKE_Fortran_MODOUT_FLAG + \ CMAKE_Fortran_MODULE_DIRECTORY + \ CMAKE_Fortran_OUTPUT_EXTENSION + \ CMAKE_Fortran_PLATFORM_ID + \ CMAKE_Fortran_PREPROCESS + \ CMAKE_Fortran_SIMULATE_ID + \ CMAKE_Fortran_SIMULATE_VERSION + \ CMAKE_Fortran_SIZEOF_DATA_PTR + \ CMAKE_Fortran_SOURCE_FILE_EXTENSIONS + \ CMAKE_Fortran_STANDARD + \ CMAKE_Fortran_STANDARD_DEFAULT + \ CMAKE_Fortran_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_Fortran_STANDARD_LIBRARIES + \ CMAKE_Fortran_STANDARD_REQUIRED + \ CMAKE_Fortran_SUPPORTED + \ CMAKE_Fortran_VISIBILITY_PRESET + \ CMAKE_GENERATOR + \ CMAKE_GENERATOR_INSTANCE + \ CMAKE_GENERATOR_PLATFORM + \ CMAKE_GENERATOR_TOOLSET + \ CMAKE_GHS_NO_SOURCE_GROUP_FILE + \ CMAKE_GLOBAL_AUTOGEN_TARGET + \ CMAKE_GLOBAL_AUTOGEN_TARGET_NAME + \ CMAKE_GLOBAL_AUTORCC_TARGET + \ CMAKE_GLOBAL_AUTORCC_TARGET_NAME + \ CMAKE_GNUtoMS + \ CMAKE_HIP + \ CMAKE_HIP_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_HIP_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_HIP_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_HIP_ARCHITECTURES + \ CMAKE_HIP_ARCHIVE_APPEND + \ CMAKE_HIP_ARCHIVE_CREATE + \ CMAKE_HIP_ARCHIVE_FINISH + \ CMAKE_HIP_BYTE_ORDER + \ CMAKE_HIP_CLANG_TIDY + \ CMAKE_HIP_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_HIP_COMPILER + \ CMAKE_HIP_COMPILER_ABI + \ CMAKE_HIP_COMPILER_AR + \ CMAKE_HIP_COMPILER_ARCHITECTURE_ID + \ CMAKE_HIP_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_HIP_COMPILER_FRONTEND_VARIANT + \ CMAKE_HIP_COMPILER_ID + \ CMAKE_HIP_COMPILER_LAUNCHER + \ CMAKE_HIP_COMPILER_LOADED + \ CMAKE_HIP_COMPILER_PREDEFINES_COMMAND + \ CMAKE_HIP_COMPILER_RANLIB + \ CMAKE_HIP_COMPILER_TARGET + \ CMAKE_HIP_COMPILER_VERSION + \ CMAKE_HIP_COMPILER_VERSION_INTERNAL + \ CMAKE_HIP_COMPILE_FEATURES + \ CMAKE_HIP_COMPILE_OBJECT + \ CMAKE_HIP_CPPCHECK + \ CMAKE_HIP_CPPLINT + \ CMAKE_HIP_CREATE_SHARED_LIBRARY + \ CMAKE_HIP_CREATE_SHARED_MODULE + \ CMAKE_HIP_CREATE_STATIC_LIBRARY + \ CMAKE_HIP_EXTENSIONS + \ CMAKE_HIP_EXTENSIONS_DEFAULT + \ CMAKE_HIP_FLAGS + \ CMAKE_HIP_FLAGS_DEBUG + \ CMAKE_HIP_FLAGS_DEBUG_INIT + \ CMAKE_HIP_FLAGS_INIT + \ CMAKE_HIP_FLAGS_MINSIZEREL + \ CMAKE_HIP_FLAGS_MINSIZEREL_INIT + \ CMAKE_HIP_FLAGS_RELEASE + \ CMAKE_HIP_FLAGS_RELEASE_INIT + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_HIP_IGNORE_EXTENSIONS + \ CMAKE_HIP_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_LIBRARIES + \ CMAKE_HIP_INCLUDE_WHAT_YOU_USE + \ CMAKE_HIP_INIT + \ CMAKE_HIP_LIBRARY_ARCHITECTURE + \ CMAKE_HIP_LINKER_LAUNCHER + \ CMAKE_HIP_LINKER_PREFERENCE + \ CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_HIP_LINKER_WRAPPER_FLAG + \ CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_HIP_LINK_EXECUTABLE + \ CMAKE_HIP_LINK_LIBRARY_FILE_FLAG + \ CMAKE_HIP_LINK_LIBRARY_FLAG + \ CMAKE_HIP_LINK_LIBRARY_SUFFIX + \ CMAKE_HIP_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_HIP_OUTPUT_EXTENSION + \ CMAKE_HIP_PLATFORM_ID + \ CMAKE_HIP_SIMULATE_ID + \ CMAKE_HIP_SIMULATE_VERSION + \ CMAKE_HIP_SIZEOF_DATA_PTR + \ CMAKE_HIP_SOURCE_FILE_EXTENSIONS + \ CMAKE_HIP_STANDARD + \ CMAKE_HIP_STANDARD_DEFAULT + \ CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_HIP_STANDARD_LIBRARIES + \ CMAKE_HIP_STANDARD_REQUIRED + \ CMAKE_HIP_SUPPORTED + \ CMAKE_HIP_VISIBILITY_PRESET + \ CMAKE_HOME_DIRECTORY + \ CMAKE_HOST_APPLE + \ CMAKE_HOST_BSD + \ CMAKE_HOST_LINUX + \ CMAKE_HOST_SOLARIS + \ CMAKE_HOST_SYSTEM + \ CMAKE_HOST_SYSTEM_NAME + \ CMAKE_HOST_SYSTEM_PROCESSOR + \ CMAKE_HOST_SYSTEM_VERSION + \ CMAKE_HOST_UNIX + \ CMAKE_HOST_WIN32 + \ CMAKE_IGNORE_PATH + \ CMAKE_IGNORE_PREFIX_PATH + \ CMAKE_IMPORT_LIBRARY_PREFIX + \ CMAKE_IMPORT_LIBRARY_SUFFIX + \ CMAKE_INCLUDE_CURRENT_DIR + \ CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE + \ CMAKE_INCLUDE_DIRECTORIES_BEFORE + \ CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE + \ CMAKE_INCLUDE_PATH + \ CMAKE_INSTALL_DEFAULT_COMPONENT_NAME + \ CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + \ CMAKE_INSTALL_MESSAGE + \ CMAKE_INSTALL_NAME_DIR + \ CMAKE_INSTALL_PREFIX + \ CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT + \ CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH + \ CMAKE_INSTALL_RPATH + \ CMAKE_INSTALL_RPATH_USE_LINK_PATH + \ CMAKE_INTERNAL_PLATFORM_ABI + \ CMAKE_INTERPROCEDURAL_OPTIMIZATION + \ CMAKE_IOS_INSTALL_COMBINED + \ CMAKE_ISPC_HEADER_DIRECTORY + \ CMAKE_ISPC_HEADER_SUFFIX + \ CMAKE_ISPC_INSTRUCTION_SETS + \ CMAKE_JOB_POOLS + \ CMAKE_JOB_POOL_COMPILE + \ CMAKE_JOB_POOL_LINK + \ CMAKE_JOB_POOL_PRECOMPILE_HEADER + \ CMAKE_Java + \ CMAKE_Java_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_Java_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_Java_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_Java_ARCHIVE_APPEND + \ CMAKE_Java_ARCHIVE_CREATE + \ CMAKE_Java_ARCHIVE_FINISH + \ CMAKE_Java_BYTE_ORDER + \ CMAKE_Java_CLANG_TIDY + \ CMAKE_Java_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_Java_COMPILER + \ CMAKE_Java_COMPILER_ABI + \ CMAKE_Java_COMPILER_AR + \ CMAKE_Java_COMPILER_ARCHITECTURE_ID + \ CMAKE_Java_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Java_COMPILER_FRONTEND_VARIANT + \ CMAKE_Java_COMPILER_ID + \ CMAKE_Java_COMPILER_LAUNCHER + \ CMAKE_Java_COMPILER_LOADED + \ CMAKE_Java_COMPILER_PREDEFINES_COMMAND + \ CMAKE_Java_COMPILER_RANLIB + \ CMAKE_Java_COMPILER_TARGET + \ CMAKE_Java_COMPILER_VERSION + \ CMAKE_Java_COMPILER_VERSION_INTERNAL + \ CMAKE_Java_COMPILE_OBJECT + \ CMAKE_Java_CPPCHECK + \ CMAKE_Java_CPPLINT + \ CMAKE_Java_CREATE_SHARED_LIBRARY + \ CMAKE_Java_CREATE_SHARED_MODULE + \ CMAKE_Java_CREATE_STATIC_LIBRARY + \ CMAKE_Java_EXTENSIONS + \ CMAKE_Java_EXTENSIONS_DEFAULT + \ CMAKE_Java_FLAGS + \ CMAKE_Java_FLAGS_DEBUG + \ CMAKE_Java_FLAGS_DEBUG_INIT + \ CMAKE_Java_FLAGS_INIT + \ CMAKE_Java_FLAGS_MINSIZEREL + \ CMAKE_Java_FLAGS_MINSIZEREL_INIT + \ CMAKE_Java_FLAGS_RELEASE + \ CMAKE_Java_FLAGS_RELEASE_INIT + \ CMAKE_Java_FLAGS_RELWITHDEBINFO + \ CMAKE_Java_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_Java_IGNORE_EXTENSIONS + \ CMAKE_Java_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_Java_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_Java_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_Java_IMPLICIT_LINK_LIBRARIES + \ CMAKE_Java_INCLUDE_WHAT_YOU_USE + \ CMAKE_Java_INIT + \ CMAKE_Java_LIBRARY_ARCHITECTURE + \ CMAKE_Java_LINKER_LAUNCHER + \ CMAKE_Java_LINKER_PREFERENCE + \ CMAKE_Java_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_Java_LINKER_WRAPPER_FLAG + \ CMAKE_Java_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_Java_LINK_EXECUTABLE + \ CMAKE_Java_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Java_LINK_LIBRARY_FLAG + \ CMAKE_Java_LINK_LIBRARY_SUFFIX + \ CMAKE_Java_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_Java_OUTPUT_EXTENSION + \ CMAKE_Java_PLATFORM_ID + \ CMAKE_Java_SIMULATE_ID + \ CMAKE_Java_SIMULATE_VERSION + \ CMAKE_Java_SIZEOF_DATA_PTR + \ CMAKE_Java_SOURCE_FILE_EXTENSIONS + \ CMAKE_Java_STANDARD + \ CMAKE_Java_STANDARD_DEFAULT + \ CMAKE_Java_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_Java_STANDARD_LIBRARIES + \ CMAKE_Java_STANDARD_REQUIRED + \ CMAKE_Java_SUPPORTED + \ CMAKE_Java_VISIBILITY_PRESET + \ CMAKE_KATE_FILES_MODE + \ CMAKE_KATE_MAKE_ARGUMENTS + \ CMAKE_LIBRARY_ARCHITECTURE + \ CMAKE_LIBRARY_ARCHITECTURE_REGEX + \ CMAKE_LIBRARY_OUTPUT_DIRECTORY + \ CMAKE_LIBRARY_PATH + \ CMAKE_LIBRARY_PATH_FLAG + \ CMAKE_LINK_DEF_FILE_FLAG + \ CMAKE_LINK_DEPENDS_NO_SHARED + \ CMAKE_LINK_DEPENDS_USE_LINKER + \ CMAKE_LINK_DIRECTORIES_BEFORE + \ CMAKE_LINK_INTERFACE_LIBRARIES + \ CMAKE_LINK_LIBRARIES_ONLY_TARGETS + \ CMAKE_LINK_LIBRARY_FILE_FLAG + \ CMAKE_LINK_LIBRARY_FLAG + \ CMAKE_LINK_LIBRARY_SUFFIX + \ CMAKE_LINK_SEARCH_END_STATIC + \ CMAKE_LINK_SEARCH_START_STATIC + \ CMAKE_LINK_WHAT_YOU_USE + \ CMAKE_LINK_WHAT_YOU_USE_CHECK + \ CMAKE_MACOSX_BUNDLE + \ CMAKE_MACOSX_RPATH + \ CMAKE_MAJOR_VERSION + \ CMAKE_MAKE_PROGRAM + \ CMAKE_MATCH_COUNT + \ CMAKE_MAXIMUM_RECURSION_DEPTH + \ CMAKE_MESSAGE_CONTEXT + \ CMAKE_MESSAGE_CONTEXT_SHOW + \ CMAKE_MESSAGE_INDENT + \ CMAKE_MESSAGE_LOG_LEVEL + \ CMAKE_MFC_FLAG + \ CMAKE_MINIMUM_REQUIRED_VERSION + \ CMAKE_MINOR_VERSION + \ CMAKE_MODULE_LINKER_FLAGS + \ CMAKE_MODULE_LINKER_FLAGS_INIT + \ CMAKE_MODULE_PATH + \ CMAKE_MSVCIDE_RUN_PATH + \ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT + \ CMAKE_MSVC_RUNTIME_LIBRARY + \ CMAKE_NETRC + \ CMAKE_NETRC_FILE + \ CMAKE_NINJA_OUTPUT_PATH_PREFIX + \ CMAKE_NOT_USING_CONFIG_FLAGS + \ CMAKE_NO_BUILTIN_CHRPATH + \ CMAKE_NO_SYSTEM_FROM_IMPORTED + \ CMAKE_OBJCXX_CLANG_TIDY + \ CMAKE_OBJCXX_EXTENSIONS + \ CMAKE_OBJCXX_LINKER_LAUNCHER + \ CMAKE_OBJCXX_STANDARD + \ CMAKE_OBJCXX_STANDARD_REQUIRED + \ CMAKE_OBJC_CLANG_TIDY + \ CMAKE_OBJC_EXTENSIONS + \ CMAKE_OBJC_LINKER_LAUNCHER + \ CMAKE_OBJC_STANDARD + \ CMAKE_OBJC_STANDARD_REQUIRED + \ CMAKE_OBJECT_PATH_MAX + \ CMAKE_OPTIMIZE_DEPENDENCIES + \ CMAKE_OSX_ARCHITECTURES + \ CMAKE_OSX_DEPLOYMENT_TARGET + \ CMAKE_OSX_SYSROOT + \ CMAKE_PARENT_LIST_FILE + \ CMAKE_PATCH_VERSION + \ CMAKE_PCH_INSTANTIATE_TEMPLATES + \ CMAKE_PCH_WARN_INVALID + \ CMAKE_PDB_OUTPUT_DIRECTORY + \ CMAKE_PLATFORM_NO_VERSIONED_SONAME + \ CMAKE_POSITION_INDEPENDENT_CODE + \ CMAKE_PREFIX_PATH + \ CMAKE_PROGRAM_PATH + \ CMAKE_PROJECT_DESCRIPTION + \ CMAKE_PROJECT_HOMEPAGE_URL + \ CMAKE_PROJECT_INCLUDE + \ CMAKE_PROJECT_INCLUDE_BEFORE + \ CMAKE_PROJECT_NAME + \ CMAKE_PROJECT_TOP_LEVEL_INCLUDES + \ CMAKE_PROJECT_VERSION + \ CMAKE_PROJECT_VERSION_MAJOR + \ CMAKE_PROJECT_VERSION_MINOR + \ CMAKE_PROJECT_VERSION_PATCH + \ CMAKE_PROJECT_VERSION_TWEAK + \ CMAKE_RANLIB + \ CMAKE_RC + \ CMAKE_RC_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_RC_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_RC_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_RC_ARCHIVE_APPEND + \ CMAKE_RC_ARCHIVE_CREATE + \ CMAKE_RC_ARCHIVE_FINISH + \ CMAKE_RC_BYTE_ORDER + \ CMAKE_RC_CLANG_TIDY + \ CMAKE_RC_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_RC_COMPILER + \ CMAKE_RC_COMPILER_ABI + \ CMAKE_RC_COMPILER_AR + \ CMAKE_RC_COMPILER_ARCHITECTURE_ID + \ CMAKE_RC_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_RC_COMPILER_FRONTEND_VARIANT + \ CMAKE_RC_COMPILER_ID + \ CMAKE_RC_COMPILER_LAUNCHER + \ CMAKE_RC_COMPILER_LOADED + \ CMAKE_RC_COMPILER_PREDEFINES_COMMAND + \ CMAKE_RC_COMPILER_RANLIB + \ CMAKE_RC_COMPILER_TARGET + \ CMAKE_RC_COMPILER_VERSION + \ CMAKE_RC_COMPILER_VERSION_INTERNAL + \ CMAKE_RC_COMPILE_OBJECT + \ CMAKE_RC_CPPCHECK + \ CMAKE_RC_CPPLINT + \ CMAKE_RC_CREATE_SHARED_LIBRARY + \ CMAKE_RC_CREATE_SHARED_MODULE + \ CMAKE_RC_CREATE_STATIC_LIBRARY + \ CMAKE_RC_EXTENSIONS + \ CMAKE_RC_EXTENSIONS_DEFAULT + \ CMAKE_RC_FLAGS + \ CMAKE_RC_FLAGS_DEBUG + \ CMAKE_RC_FLAGS_DEBUG_INIT + \ CMAKE_RC_FLAGS_INIT + \ CMAKE_RC_FLAGS_MINSIZEREL + \ CMAKE_RC_FLAGS_MINSIZEREL_INIT + \ CMAKE_RC_FLAGS_RELEASE + \ CMAKE_RC_FLAGS_RELEASE_INIT + \ CMAKE_RC_FLAGS_RELWITHDEBINFO + \ CMAKE_RC_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_RC_IGNORE_EXTENSIONS + \ CMAKE_RC_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_RC_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_RC_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_RC_IMPLICIT_LINK_LIBRARIES + \ CMAKE_RC_INCLUDE_WHAT_YOU_USE + \ CMAKE_RC_INIT + \ CMAKE_RC_LIBRARY_ARCHITECTURE + \ CMAKE_RC_LINKER_LAUNCHER + \ CMAKE_RC_LINKER_PREFERENCE + \ CMAKE_RC_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_RC_LINKER_WRAPPER_FLAG + \ CMAKE_RC_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_RC_LINK_EXECUTABLE + \ CMAKE_RC_LINK_LIBRARY_FILE_FLAG + \ CMAKE_RC_LINK_LIBRARY_FLAG + \ CMAKE_RC_LINK_LIBRARY_SUFFIX + \ CMAKE_RC_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_RC_OUTPUT_EXTENSION + \ CMAKE_RC_PLATFORM_ID + \ CMAKE_RC_SIMULATE_ID + \ CMAKE_RC_SIMULATE_VERSION + \ CMAKE_RC_SIZEOF_DATA_PTR + \ CMAKE_RC_SOURCE_FILE_EXTENSIONS + \ CMAKE_RC_STANDARD + \ CMAKE_RC_STANDARD_DEFAULT + \ CMAKE_RC_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_RC_STANDARD_LIBRARIES + \ CMAKE_RC_STANDARD_REQUIRED + \ CMAKE_RC_SUPPORTED + \ CMAKE_RC_VISIBILITY_PRESET + \ CMAKE_ROOT + \ CMAKE_RULE_MESSAGES + \ CMAKE_RUNTIME_OUTPUT_DIRECTORY + \ CMAKE_SCRIPT_MODE_FILE + \ CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS + \ CMAKE_SHARED_LIBRARY_PREFIX + \ CMAKE_SHARED_LIBRARY_SUFFIX + \ CMAKE_SHARED_LINKER_FLAGS + \ CMAKE_SHARED_LINKER_FLAGS_INIT + \ CMAKE_SHARED_MODULE_PREFIX + \ CMAKE_SHARED_MODULE_SUFFIX + \ CMAKE_SIZEOF_VOID_P + \ CMAKE_SKIP_BUILD_RPATH + \ CMAKE_SKIP_INSTALL_ALL_DEPENDENCY + \ CMAKE_SKIP_INSTALL_RPATH + \ CMAKE_SKIP_INSTALL_RULES + \ CMAKE_SKIP_RPATH + \ CMAKE_SKIP_TEST_ALL_DEPENDENCY + \ CMAKE_SOURCE_DIR + \ CMAKE_STAGING_PREFIX + \ CMAKE_STATIC_LIBRARY_PREFIX + \ CMAKE_STATIC_LIBRARY_SUFFIX + \ CMAKE_STATIC_LINKER_FLAGS + \ CMAKE_STATIC_LINKER_FLAGS_INIT + \ CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS + \ CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE + \ CMAKE_SUPPRESS_REGENERATION + \ CMAKE_SYSROOT + \ CMAKE_SYSROOT_COMPILE + \ CMAKE_SYSROOT_LINK + \ CMAKE_SYSTEM + \ CMAKE_SYSTEM_APPBUNDLE_PATH + \ CMAKE_SYSTEM_FRAMEWORK_PATH + \ CMAKE_SYSTEM_IGNORE_PATH + \ CMAKE_SYSTEM_IGNORE_PREFIX_PATH + \ CMAKE_SYSTEM_INCLUDE_PATH + \ CMAKE_SYSTEM_LIBRARY_PATH + \ CMAKE_SYSTEM_NAME + \ CMAKE_SYSTEM_PREFIX_PATH + \ CMAKE_SYSTEM_PROCESSOR + \ CMAKE_SYSTEM_PROGRAM_PATH + \ CMAKE_SYSTEM_VERSION + \ CMAKE_Swift + \ CMAKE_Swift_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_Swift_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_Swift_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_Swift_ARCHIVE_APPEND + \ CMAKE_Swift_ARCHIVE_CREATE + \ CMAKE_Swift_ARCHIVE_FINISH + \ CMAKE_Swift_BYTE_ORDER + \ CMAKE_Swift_CLANG_TIDY + \ CMAKE_Swift_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_Swift_COMPILER + \ CMAKE_Swift_COMPILER_ABI + \ CMAKE_Swift_COMPILER_AR + \ CMAKE_Swift_COMPILER_ARCHITECTURE_ID + \ CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Swift_COMPILER_FRONTEND_VARIANT + \ CMAKE_Swift_COMPILER_ID + \ CMAKE_Swift_COMPILER_LAUNCHER + \ CMAKE_Swift_COMPILER_LOADED + \ CMAKE_Swift_COMPILER_PREDEFINES_COMMAND + \ CMAKE_Swift_COMPILER_RANLIB + \ CMAKE_Swift_COMPILER_TARGET + \ CMAKE_Swift_COMPILER_VERSION + \ CMAKE_Swift_COMPILER_VERSION_INTERNAL + \ CMAKE_Swift_COMPILE_OBJECT + \ CMAKE_Swift_CPPCHECK + \ CMAKE_Swift_CPPLINT + \ CMAKE_Swift_CREATE_SHARED_LIBRARY + \ CMAKE_Swift_CREATE_SHARED_MODULE + \ CMAKE_Swift_CREATE_STATIC_LIBRARY + \ CMAKE_Swift_EXTENSIONS + \ CMAKE_Swift_EXTENSIONS_DEFAULT + \ CMAKE_Swift_FLAGS + \ CMAKE_Swift_FLAGS_DEBUG + \ CMAKE_Swift_FLAGS_DEBUG_INIT + \ CMAKE_Swift_FLAGS_INIT + \ CMAKE_Swift_FLAGS_MINSIZEREL + \ CMAKE_Swift_FLAGS_MINSIZEREL_INIT + \ CMAKE_Swift_FLAGS_RELEASE + \ CMAKE_Swift_FLAGS_RELEASE_INIT + \ CMAKE_Swift_FLAGS_RELWITHDEBINFO + \ CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_Swift_IGNORE_EXTENSIONS + \ CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_Swift_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_Swift_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_Swift_IMPLICIT_LINK_LIBRARIES + \ CMAKE_Swift_INCLUDE_WHAT_YOU_USE + \ CMAKE_Swift_INIT + \ CMAKE_Swift_LANGUAGE_VERSION + \ CMAKE_Swift_LIBRARY_ARCHITECTURE + \ CMAKE_Swift_LINKER_LAUNCHER + \ CMAKE_Swift_LINKER_PREFERENCE + \ CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_Swift_LINKER_WRAPPER_FLAG + \ CMAKE_Swift_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_Swift_LINK_EXECUTABLE + \ CMAKE_Swift_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Swift_LINK_LIBRARY_FLAG + \ CMAKE_Swift_LINK_LIBRARY_SUFFIX + \ CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_Swift_MODULE_DIRECTORY + \ CMAKE_Swift_NUM_THREADS + \ CMAKE_Swift_OUTPUT_EXTENSION + \ CMAKE_Swift_PLATFORM_ID + \ CMAKE_Swift_SIMULATE_ID + \ CMAKE_Swift_SIMULATE_VERSION + \ CMAKE_Swift_SIZEOF_DATA_PTR + \ CMAKE_Swift_SOURCE_FILE_EXTENSIONS + \ CMAKE_Swift_STANDARD + \ CMAKE_Swift_STANDARD_DEFAULT + \ CMAKE_Swift_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_Swift_STANDARD_LIBRARIES + \ CMAKE_Swift_STANDARD_REQUIRED + \ CMAKE_Swift_SUPPORTED + \ CMAKE_Swift_VISIBILITY_PRESET + \ CMAKE_TASKING_TOOLSET + \ CMAKE_TLS_CAINFO + \ CMAKE_TLS_VERIFY + \ CMAKE_TOOLCHAIN_FILE + \ CMAKE_TRY_COMPILE_CONFIGURATION + \ CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES + \ CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + \ CMAKE_TRY_COMPILE_TARGET_TYPE + \ CMAKE_TWEAK_VERSION + \ CMAKE_UNITY_BUILD + \ CMAKE_UNITY_BUILD_BATCH_SIZE + \ CMAKE_UNITY_BUILD_UNIQUE_ID + \ CMAKE_USER_MAKE_RULES_OVERRIDE + \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM + \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_MASM + \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_NASM + \ CMAKE_USER_MAKE_RULES_OVERRIDE_C + \ CMAKE_USER_MAKE_RULES_OVERRIDE_CSharp + \ CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA + \ CMAKE_USER_MAKE_RULES_OVERRIDE_CXX + \ CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran + \ CMAKE_USER_MAKE_RULES_OVERRIDE_HIP + \ CMAKE_USER_MAKE_RULES_OVERRIDE_Java + \ CMAKE_USER_MAKE_RULES_OVERRIDE_RC + \ CMAKE_USER_MAKE_RULES_OVERRIDE_Swift + \ CMAKE_USE_RELATIVE_PATHS + \ CMAKE_VERBOSE_MAKEFILE + \ CMAKE_VERIFY_INTERFACE_HEADER_SETS + \ CMAKE_VERSION + \ CMAKE_VISIBILITY_INLINES_HIDDEN + \ CMAKE_VS_DEBUGGER_COMMAND + \ CMAKE_VS_DEBUGGER_COMMAND_ARGUMENTS + \ CMAKE_VS_DEBUGGER_ENVIRONMENT + \ CMAKE_VS_DEBUGGER_WORKING_DIRECTORY + \ CMAKE_VS_DEVENV_COMMAND + \ CMAKE_VS_GLOBALS + \ CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD + \ CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD + \ CMAKE_VS_INTEL_Fortran_PROJECT_VERSION + \ CMAKE_VS_JUST_MY_CODE_DEBUGGING + \ CMAKE_VS_MSBUILD_COMMAND + \ CMAKE_VS_NO_COMPILE_BATCHING + \ CMAKE_VS_NUGET_PACKAGE_RESTORE + \ CMAKE_VS_NsightTegra_VERSION + \ CMAKE_VS_PLATFORM_NAME + \ CMAKE_VS_PLATFORM_NAME_DEFAULT + \ CMAKE_VS_PLATFORM_TOOLSET + \ CMAKE_VS_PLATFORM_TOOLSET_CUDA + \ CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR + \ CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE + \ CMAKE_VS_PLATFORM_TOOLSET_VERSION + \ CMAKE_VS_SDK_EXCLUDE_DIRECTORIES + \ CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES + \ CMAKE_VS_SDK_INCLUDE_DIRECTORIES + \ CMAKE_VS_SDK_LIBRARY_DIRECTORIES + \ CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES + \ CMAKE_VS_SDK_REFERENCE_DIRECTORIES + \ CMAKE_VS_SDK_SOURCE_DIRECTORIES + \ CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER + \ CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION + \ CMAKE_VS_TARGET_FRAMEWORK_VERSION + \ CMAKE_VS_VERSION_BUILD_NUMBER + \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION + \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION + \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM + \ CMAKE_VS_WINRT_BY_DEFAULT + \ CMAKE_WARN_DEPRECATED + \ CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION + \ CMAKE_WATCOM_RUNTIME_LIBRARY + \ CMAKE_WIN32_EXECUTABLE + \ CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS + \ CMAKE_XCODE_BUILD_SYSTEM + \ CMAKE_XCODE_GENERATE_SCHEME + \ CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY + \ CMAKE_XCODE_LINK_BUILD_PHASE_MODE + \ CMAKE_XCODE_PLATFORM_TOOLSET + \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER + \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN + \ CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER + \ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS + \ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ CMAKE_XCODE_SCHEME_ENVIRONMENT + \ CMAKE_XCODE_SCHEME_GUARD_MALLOC + \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION + \ CMAKE_XCODE_SCHEME_LAUNCH_MODE + \ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP + \ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES + \ CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE + \ CMAKE_XCODE_SCHEME_MALLOC_STACK + \ CMAKE_XCODE_SCHEME_THREAD_SANITIZER + \ CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP + \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER + \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION + \ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY + \ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS + \ CMAKE_XCODE_XCCONFIG + \ CPACK_ABSOLUTE_DESTINATION_FILES + \ CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY + \ CPACK_CUSTOM_INSTALL_VARIABLES + \ CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + \ CPACK_INCLUDE_TOPLEVEL_DIRECTORY + \ CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + \ CPACK_PACKAGING_INSTALL_PREFIX + \ CPACK_SET_DESTDIR + \ CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION + \ CTEST_BINARY_DIRECTORY + \ CTEST_BUILD_COMMAND + \ CTEST_BUILD_NAME + \ CTEST_BZR_COMMAND + \ CTEST_BZR_UPDATE_OPTIONS + \ CTEST_CHANGE_ID + \ CTEST_CHECKOUT_COMMAND + \ CTEST_CONFIGURATION_TYPE + \ CTEST_CONFIGURE_COMMAND + \ CTEST_COVERAGE_COMMAND + \ CTEST_COVERAGE_EXTRA_FLAGS + \ CTEST_CURL_OPTIONS + \ CTEST_CUSTOM_COVERAGE_EXCLUDE + \ CTEST_CUSTOM_ERROR_EXCEPTION + \ CTEST_CUSTOM_ERROR_MATCH + \ CTEST_CUSTOM_ERROR_POST_CONTEXT + \ CTEST_CUSTOM_ERROR_PRE_CONTEXT + \ CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE + \ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS + \ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS + \ CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE + \ CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION + \ CTEST_CUSTOM_MEMCHECK_IGNORE + \ CTEST_CUSTOM_POST_MEMCHECK + \ CTEST_CUSTOM_POST_TEST + \ CTEST_CUSTOM_PRE_MEMCHECK + \ CTEST_CUSTOM_PRE_TEST + \ CTEST_CUSTOM_TESTS_IGNORE + \ CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION + \ CTEST_CUSTOM_WARNING_EXCEPTION + \ CTEST_CUSTOM_WARNING_MATCH + \ CTEST_CVS_CHECKOUT + \ CTEST_CVS_COMMAND + \ CTEST_CVS_UPDATE_OPTIONS + \ CTEST_DROP_LOCATION + \ CTEST_DROP_METHOD + \ CTEST_DROP_SITE + \ CTEST_DROP_SITE_CDASH + \ CTEST_DROP_SITE_PASSWORD + \ CTEST_DROP_SITE_USER + \ CTEST_EXTRA_COVERAGE_GLOB + \ CTEST_GIT_COMMAND + \ CTEST_GIT_INIT_SUBMODULES + \ CTEST_GIT_UPDATE_CUSTOM + \ CTEST_GIT_UPDATE_OPTIONS + \ CTEST_HG_COMMAND + \ CTEST_HG_UPDATE_OPTIONS + \ CTEST_LABELS_FOR_SUBPROJECTS + \ CTEST_MEMORYCHECK_COMMAND + \ CTEST_MEMORYCHECK_COMMAND_OPTIONS + \ CTEST_MEMORYCHECK_SANITIZER_OPTIONS + \ CTEST_MEMORYCHECK_SUPPRESSIONS_FILE + \ CTEST_MEMORYCHECK_TYPE + \ CTEST_NIGHTLY_START_TIME + \ CTEST_P4_CLIENT + \ CTEST_P4_COMMAND + \ CTEST_P4_OPTIONS + \ CTEST_P4_UPDATE_OPTIONS + \ CTEST_RESOURCE_SPEC_FILE + \ CTEST_RUN_CURRENT_SCRIPT + \ CTEST_SCP_COMMAND + \ CTEST_SCRIPT_DIRECTORY + \ CTEST_SITE + \ CTEST_SOURCE_DIRECTORY + \ CTEST_SUBMIT_INACTIVITY_TIMEOUT + \ CTEST_SUBMIT_URL + \ CTEST_SVN_COMMAND + \ CTEST_SVN_OPTIONS + \ CTEST_SVN_UPDATE_OPTIONS + \ CTEST_TEST_LOAD + \ CTEST_TEST_TIMEOUT + \ CTEST_TRIGGER_SITE + \ CTEST_UPDATE_COMMAND + \ CTEST_UPDATE_OPTIONS + \ CTEST_UPDATE_VERSION_ONLY + \ CTEST_UPDATE_VERSION_OVERRIDE + \ CTEST_USE_LAUNCHERS + \ CYGWIN + \ DOXYGEN_ABBREVIATE_BRIEF + \ DOXYGEN_ALIASES + \ DOXYGEN_ALLEXTERNALS + \ DOXYGEN_ALLOW_UNICODE_NAMES + \ DOXYGEN_ALPHABETICAL_INDEX + \ DOXYGEN_ALWAYS_DETAILED_SEC + \ DOXYGEN_AUTOLINK_SUPPORT + \ DOXYGEN_BINARY_TOC + \ DOXYGEN_BRIEF_MEMBER_DESC + \ DOXYGEN_BUILTIN_STL_SUPPORT + \ DOXYGEN_CALLER_GRAPH + \ DOXYGEN_CALL_GRAPH + \ DOXYGEN_CASE_SENSE_NAMES + \ DOXYGEN_CHM_FILE + \ DOXYGEN_CHM_INDEX_ENCODING + \ DOXYGEN_CITE_BIB_FILES + \ DOXYGEN_CLANG_ASSISTED_PARSING + \ DOXYGEN_CLANG_DATABASE_PATH + \ DOXYGEN_CLANG_OPTIONS + \ DOXYGEN_CLASS_DIAGRAMS + \ DOXYGEN_CLASS_GRAPH + \ DOXYGEN_COLLABORATION_GRAPH + \ DOXYGEN_COLS_IN_ALPHA_INDEX + \ DOXYGEN_COMPACT_LATEX + \ DOXYGEN_COMPACT_RTF + \ DOXYGEN_CPP_CLI_SUPPORT + \ DOXYGEN_CREATE_SUBDIRS + \ DOXYGEN_DIAFILE_DIRS + \ DOXYGEN_DIA_PATH + \ DOXYGEN_DIRECTORY_GRAPH + \ DOXYGEN_DISABLE_INDEX + \ DOXYGEN_DISTRIBUTE_GROUP_DOC + \ DOXYGEN_DOCBOOK_OUTPUT + \ DOXYGEN_DOCBOOK_PROGRAMLISTING + \ DOXYGEN_DOCSET_BUNDLE_ID + \ DOXYGEN_DOCSET_FEEDNAME + \ DOXYGEN_DOCSET_PUBLISHER_ID + \ DOXYGEN_DOCSET_PUBLISHER_NAME + \ DOXYGEN_DOTFILE_DIRS + \ DOXYGEN_DOT_CLEANUP + \ DOXYGEN_DOT_FONTNAME + \ DOXYGEN_DOT_FONTPATH + \ DOXYGEN_DOT_FONTSIZE + \ DOXYGEN_DOT_GRAPH_MAX_NODES + \ DOXYGEN_DOT_IMAGE_FORMAT + \ DOXYGEN_DOT_MULTI_TARGETS + \ DOXYGEN_DOT_NUM_THREADS + \ DOXYGEN_DOT_PATH + \ DOXYGEN_DOT_TRANSPARENT + \ DOXYGEN_DOXYFILE_ENCODING + \ DOXYGEN_ECLIPSE_DOC_ID + \ DOXYGEN_ENABLED_SECTIONS + \ DOXYGEN_ENABLE_PREPROCESSING + \ DOXYGEN_ENUM_VALUES_PER_LINE + \ DOXYGEN_EXAMPLE_PATH + \ DOXYGEN_EXAMPLE_PATTERNS + \ DOXYGEN_EXAMPLE_RECURSIVE + \ DOXYGEN_EXCLUDE + \ DOXYGEN_EXCLUDE_PATTERNS + \ DOXYGEN_EXCLUDE_SYMBOLS + \ DOXYGEN_EXCLUDE_SYMLINKS + \ DOXYGEN_EXPAND_AS_DEFINED + \ DOXYGEN_EXPAND_ONLY_PREDEF + \ DOXYGEN_EXTENSION_MAPPING + \ DOXYGEN_EXTERNAL_GROUPS + \ DOXYGEN_EXTERNAL_PAGES + \ DOXYGEN_EXTERNAL_SEARCH + \ DOXYGEN_EXTERNAL_SEARCH_ID + \ DOXYGEN_EXTRACT_ALL + \ DOXYGEN_EXTRACT_ANON_NSPACES + \ DOXYGEN_EXTRACT_LOCAL_CLASSES + \ DOXYGEN_EXTRACT_LOCAL_METHODS + \ DOXYGEN_EXTRACT_PACKAGE + \ DOXYGEN_EXTRACT_PRIVATE + \ DOXYGEN_EXTRACT_PRIV_VIRTUAL + \ DOXYGEN_EXTRACT_STATIC + \ DOXYGEN_EXTRA_PACKAGES + \ DOXYGEN_EXTRA_SEARCH_MAPPINGS + \ DOXYGEN_EXT_LINKS_IN_WINDOW + \ DOXYGEN_FILE_PATTERNS + \ DOXYGEN_FILE_VERSION_FILTER + \ DOXYGEN_FILTER_PATTERNS + \ DOXYGEN_FILTER_SOURCE_FILES + \ DOXYGEN_FILTER_SOURCE_PATTERNS + \ DOXYGEN_FORCE_LOCAL_INCLUDES + \ DOXYGEN_FORMULA_FONTSIZE + \ DOXYGEN_FORMULA_TRANSPARENT + \ DOXYGEN_FULL_PATH_NAMES + \ DOXYGEN_GENERATE_AUTOGEN_DEF + \ DOXYGEN_GENERATE_BUGLIST + \ DOXYGEN_GENERATE_CHI + \ DOXYGEN_GENERATE_DEPRECATEDLIST + \ DOXYGEN_GENERATE_DOCBOOK + \ DOXYGEN_GENERATE_DOCSET + \ DOXYGEN_GENERATE_ECLIPSEHELP + \ DOXYGEN_GENERATE_HTML + \ DOXYGEN_GENERATE_HTMLHELP + \ DOXYGEN_GENERATE_LATEX + \ DOXYGEN_GENERATE_LEGEND + \ DOXYGEN_GENERATE_MAN + \ DOXYGEN_GENERATE_PERLMOD + \ DOXYGEN_GENERATE_QHP + \ DOXYGEN_GENERATE_RTF + \ DOXYGEN_GENERATE_TAGFILE + \ DOXYGEN_GENERATE_TESTLIST + \ DOXYGEN_GENERATE_TODOLIST + \ DOXYGEN_GENERATE_TREEVIEW + \ DOXYGEN_GENERATE_XML + \ DOXYGEN_GRAPHICAL_HIERARCHY + \ DOXYGEN_GROUP_GRAPHS + \ DOXYGEN_GROUP_NESTED_COMPOUNDS + \ DOXYGEN_HAVE_DOT + \ DOXYGEN_HHC_LOCATION + \ DOXYGEN_HIDE_COMPOUND_REFERENCE + \ DOXYGEN_HIDE_FRIEND_COMPOUNDS + \ DOXYGEN_HIDE_IN_BODY_DOCS + \ DOXYGEN_HIDE_SCOPE_NAMES + \ DOXYGEN_HIDE_UNDOC_CLASSES + \ DOXYGEN_HIDE_UNDOC_MEMBERS + \ DOXYGEN_HIDE_UNDOC_RELATIONS + \ DOXYGEN_HTML_COLORSTYLE_GAMMA + \ DOXYGEN_HTML_COLORSTYLE_HUE + \ DOXYGEN_HTML_COLORSTYLE_SAT + \ DOXYGEN_HTML_DYNAMIC_MENUS + \ DOXYGEN_HTML_DYNAMIC_SECTIONS + \ DOXYGEN_HTML_EXTRA_FILES + \ DOXYGEN_HTML_EXTRA_STYLESHEET + \ DOXYGEN_HTML_FILE_EXTENSION + \ DOXYGEN_HTML_FOOTER + \ DOXYGEN_HTML_HEADER + \ DOXYGEN_HTML_INDEX_NUM_ENTRIES + \ DOXYGEN_HTML_OUTPUT + \ DOXYGEN_HTML_STYLESHEET + \ DOXYGEN_HTML_TIMESTAMP + \ DOXYGEN_IDL_PROPERTY_SUPPORT + \ DOXYGEN_IGNORE_PREFIX + \ DOXYGEN_IMAGE_PATH + \ DOXYGEN_INCLUDED_BY_GRAPH + \ DOXYGEN_INCLUDE_FILE_PATTERNS + \ DOXYGEN_INCLUDE_GRAPH + \ DOXYGEN_INCLUDE_PATH + \ DOXYGEN_INHERIT_DOCS + \ DOXYGEN_INLINE_GROUPED_CLASSES + \ DOXYGEN_INLINE_INFO + \ DOXYGEN_INLINE_INHERITED_MEMB + \ DOXYGEN_INLINE_SIMPLE_STRUCTS + \ DOXYGEN_INLINE_SOURCES + \ DOXYGEN_INPUT + \ DOXYGEN_INPUT_ENCODING + \ DOXYGEN_INPUT_FILTER + \ DOXYGEN_INTERACTIVE_SVG + \ DOXYGEN_INTERNAL_DOCS + \ DOXYGEN_JAVADOC_AUTOBRIEF + \ DOXYGEN_JAVADOC_BANNER + \ DOXYGEN_LATEX_BATCHMODE + \ DOXYGEN_LATEX_BIB_STYLE + \ DOXYGEN_LATEX_CMD_NAME + \ DOXYGEN_LATEX_EMOJI_DIRECTORY + \ DOXYGEN_LATEX_EXTRA_FILES + \ DOXYGEN_LATEX_EXTRA_STYLESHEET + \ DOXYGEN_LATEX_FOOTER + \ DOXYGEN_LATEX_HEADER + \ DOXYGEN_LATEX_HIDE_INDICES + \ DOXYGEN_LATEX_MAKEINDEX_CMD + \ DOXYGEN_LATEX_OUTPUT + \ DOXYGEN_LATEX_SOURCE_CODE + \ DOXYGEN_LATEX_TIMESTAMP + \ DOXYGEN_LAYOUT_FILE + \ DOXYGEN_LOOKUP_CACHE_SIZE + \ DOXYGEN_MACRO_EXPANSION + \ DOXYGEN_MAKEINDEX_CMD_NAME + \ DOXYGEN_MAN_EXTENSION + \ DOXYGEN_MAN_LINKS + \ DOXYGEN_MAN_OUTPUT + \ DOXYGEN_MAN_SUBDIR + \ DOXYGEN_MARKDOWN_SUPPORT + \ DOXYGEN_MATHJAX_CODEFILE + \ DOXYGEN_MATHJAX_EXTENSIONS + \ DOXYGEN_MATHJAX_FORMAT + \ DOXYGEN_MATHJAX_RELPATH + \ DOXYGEN_MAX_DOT_GRAPH_DEPTH + \ DOXYGEN_MAX_INITIALIZER_LINES + \ DOXYGEN_MSCFILE_DIRS + \ DOXYGEN_MULTILINE_CPP_IS_BRIEF + \ DOXYGEN_OPTIMIZE_FOR_FORTRAN + \ DOXYGEN_OPTIMIZE_OUTPUT_FOR_C + \ DOXYGEN_OPTIMIZE_OUTPUT_JAVA + \ DOXYGEN_OPTIMIZE_OUTPUT_SLICE + \ DOXYGEN_OPTIMIZE_OUTPUT_VHDL + \ DOXYGEN_OUTPUT_DIRECTORY + \ DOXYGEN_OUTPUT_LANGUAGE + \ DOXYGEN_OUTPUT_TEXT_DIRECTION + \ DOXYGEN_PAPER_TYPE + \ DOXYGEN_PDF_HYPERLINKS + \ DOXYGEN_PERLMOD_LATEX + \ DOXYGEN_PERLMOD_MAKEVAR_PREFIX + \ DOXYGEN_PERLMOD_PRETTY + \ DOXYGEN_PLANTUML_CFG_FILE + \ DOXYGEN_PLANTUML_INCLUDE_PATH + \ DOXYGEN_PLANTUML_JAR_PATH + \ DOXYGEN_PREDEFINED + \ DOXYGEN_PROJECT_BRIEF + \ DOXYGEN_PROJECT_LOGO + \ DOXYGEN_PROJECT_NAME + \ DOXYGEN_PROJECT_NUMBER + \ DOXYGEN_QCH_FILE + \ DOXYGEN_QHG_LOCATION + \ DOXYGEN_QHP_CUST_FILTER_ATTRS + \ DOXYGEN_QHP_CUST_FILTER_NAME + \ DOXYGEN_QHP_NAMESPACE + \ DOXYGEN_QHP_SECT_FILTER_ATTRS + \ DOXYGEN_QHP_VIRTUAL_FOLDER + \ DOXYGEN_QT_AUTOBRIEF + \ DOXYGEN_QUIET + \ DOXYGEN_RECURSIVE + \ DOXYGEN_REFERENCED_BY_RELATION + \ DOXYGEN_REFERENCES_LINK_SOURCE + \ DOXYGEN_REFERENCES_RELATION + \ DOXYGEN_REPEAT_BRIEF + \ DOXYGEN_RTF_EXTENSIONS_FILE + \ DOXYGEN_RTF_HYPERLINKS + \ DOXYGEN_RTF_OUTPUT + \ DOXYGEN_RTF_SOURCE_CODE + \ DOXYGEN_RTF_STYLESHEET_FILE + \ DOXYGEN_SEARCHDATA_FILE + \ DOXYGEN_SEARCHENGINE + \ DOXYGEN_SEARCHENGINE_URL + \ DOXYGEN_SEARCH_INCLUDES + \ DOXYGEN_SEPARATE_MEMBER_PAGES + \ DOXYGEN_SERVER_BASED_SEARCH + \ DOXYGEN_SHORT_NAMES + \ DOXYGEN_SHOW_FILES + \ DOXYGEN_SHOW_GROUPED_MEMB_INC + \ DOXYGEN_SHOW_INCLUDE_FILES + \ DOXYGEN_SHOW_NAMESPACES + \ DOXYGEN_SHOW_USED_FILES + \ DOXYGEN_SIP_SUPPORT + \ DOXYGEN_SKIP_FUNCTION_MACROS + \ DOXYGEN_SORT_BRIEF_DOCS + \ DOXYGEN_SORT_BY_SCOPE_NAME + \ DOXYGEN_SORT_GROUP_NAMES + \ DOXYGEN_SORT_MEMBERS_CTORS_1ST + \ DOXYGEN_SORT_MEMBER_DOCS + \ DOXYGEN_SOURCE_BROWSER + \ DOXYGEN_SOURCE_TOOLTIPS + \ DOXYGEN_STRICT_PROTO_MATCHING + \ DOXYGEN_STRIP_CODE_COMMENTS + \ DOXYGEN_STRIP_FROM_INC_PATH + \ DOXYGEN_STRIP_FROM_PATH + \ DOXYGEN_SUBGROUPING + \ DOXYGEN_TAB_SIZE + \ DOXYGEN_TAGFILES + \ DOXYGEN_TCL_SUBST + \ DOXYGEN_TEMPLATE_RELATIONS + \ DOXYGEN_TOC_EXPAND + \ DOXYGEN_TOC_INCLUDE_HEADINGS + \ DOXYGEN_TREEVIEW_WIDTH + \ DOXYGEN_TYPEDEF_HIDES_STRUCT + \ DOXYGEN_UML_LIMIT_NUM_FIELDS + \ DOXYGEN_UML_LOOK + \ DOXYGEN_USE_HTAGS + \ DOXYGEN_USE_MATHJAX + \ DOXYGEN_USE_MDFILE_AS_MAINPAGE + \ DOXYGEN_USE_PDFLATEX + \ DOXYGEN_VERBATIM_HEADERS + \ DOXYGEN_VERBATIM_VARS + \ DOXYGEN_VERSION + \ DOXYGEN_WARNINGS + \ DOXYGEN_WARN_AS_ERROR + \ DOXYGEN_WARN_FORMAT + \ DOXYGEN_WARN_IF_DOC_ERROR + \ DOXYGEN_WARN_IF_UNDOCUMENTED + \ DOXYGEN_WARN_LOGFILE + \ DOXYGEN_WARN_NO_PARAMDOC + \ DOXYGEN_XML_NS_MEMB_FILE_SCOPE + \ DOXYGEN_XML_OUTPUT + \ DOXYGEN_XML_PROGRAMLISTING + \ ENV + \ EXECUTABLE_OUTPUT_PATH + \ GHSMULTI + \ IOS + \ LIBRARY_OUTPUT_PATH + \ LINUX + \ MINGW + \ MSVC + \ MSVC10 + \ MSVC11 + \ MSVC12 + \ MSVC14 + \ MSVC60 + \ MSVC70 + \ MSVC71 + \ MSVC80 + \ MSVC90 + \ MSVC_IDE + \ MSVC_TOOLSET_VERSION + \ MSVC_VERSION + \ MSYS + \ PROJECT_BINARY_DIR + \ PROJECT_DESCRIPTION + \ PROJECT_HOMEPAGE_URL + \ PROJECT_IS_TOP_LEVEL + \ PROJECT_NAME + \ PROJECT_SOURCE_DIR + \ PROJECT_VERSION + \ PROJECT_VERSION_MAJOR + \ PROJECT_VERSION_MINOR + \ PROJECT_VERSION_PATCH + \ PROJECT_VERSION_TWEAK + \ UNIX + \ WIN32 + \ WINCE + \ WINDOWS_PHONE + \ WINDOWS_STORE + \ XCODE + \ XCODE_VERSION syn keyword cmakeModule contained \ ExternalProject + \ FetchContent syn keyword cmakeKWExternalProject contained - \ ALGO AWS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DOWNLOADED_FILE DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_EXTRACT DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL FORCE GIT_CONFIG GIT_PROGRESS GIT_REMOTE_NAME GIT_REPOSITORY GIT_SHALLOW GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG HTTP_HEADER HTTP_PASSWORD HTTP_USERNAME INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG_ LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE MAKE_EXE NAMES NOTE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR SOURCE_SUBDIR STAMP_DIR STEP_TARGETS STRING SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR TRUE UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY + \ AWS + \ BINARY_DIR + \ BUILD_ALWAYS + \ BUILD_BYPRODUCTS + \ BUILD_COMMAND + \ BUILD_IN_SOURCE + \ CHECKOUT + \ CMAKE_ARGS + \ CMAKE_CACHE_ARGS + \ CMAKE_CACHE_DEFAULT_ARGS + \ CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY + \ CMAKE_INSTALL_MODE + \ COMMENT + \ CONFIGURE_COMMAND + \ CONFIGURE_HANDLED_BY_BUILD + \ CVS + \ CVSROOT + \ CVS_MODULE + \ CVS_REPOSITORY + \ CVS_TAG + \ DEPENDEES + \ DEPENDERS + \ DEPENDS + \ DOWNLOADED_FILE + \ DOWNLOAD_COMMAND + \ DOWNLOAD_DIR + \ DOWNLOAD_EXTRACT_TIMESTAMP + \ DOWNLOAD_NAME + \ DOWNLOAD_NO_EXTRACT + \ DOWNLOAD_NO_PROGRESS + \ EP_BASE + \ EP_INDEPENDENT_STEP_TARGETS + \ EP_PREFIX + \ EP_STEP_TARGETS + \ EP_UPDATE_DISCONNECTED + \ EXCLUDE_FROM_ALL + \ FALSE + \ FORCE + \ GHS + \ GIT_CONFIG + \ GIT_PROGRESS + \ GIT_REMOTE_NAME + \ GIT_REMOTE_UPDATE_STRATEGY + \ GIT_REPOSITORY + \ GIT_SHALLOW + \ GIT_SUBMODULES + \ GIT_SUBMODULES_RECURSE + \ GIT_TAG + \ HG_REPOSITORY + \ HG_TAG + \ HTTP_HEADER + \ HTTP_PASSWORD + \ HTTP_USERNAME + \ IGNORED + \ INACTIVITY_TIMEOUT + \ INDEPENDENT_STEP_TARGETS + \ INSTALL_BYPRODUCTS + \ INSTALL_COMMAND + \ INSTALL_DIR + \ JOB_POOLS + \ LIST_SEPARATOR + \ LOG_BUILD + \ LOG_CONFIGURE + \ LOG_DIR + \ LOG_DOWNLOAD + \ LOG_INSTALL + \ LOG_MERGED_STDOUTERR + \ LOG_OUTPUT_ON_FAILURE + \ LOG_PATCH + \ LOG_TEST + \ LOG_UPDATE + \ MAKE_EXE + \ MULTI + \ NAMES + \ NETRC + \ NETRC_FILE + \ NOTE + \ NO_DEPENDS + \ OPTIONAL + \ PATCH_COMMAND + \ PREFIX + \ PROPERTY + \ REBASE + \ REBASE_CHECKOUT + \ REQUIRED + \ SOURCE_DIR + \ SOURCE_SUBDIR + \ STAMP_DIR + \ STEP_TARGETS + \ STRING + \ SVN_PASSWORD + \ SVN_REPOSITORY + \ SVN_REVISION + \ SVN_TRUST_CERT + \ SVN_USERNAME + \ TEST_AFTER_INSTALL + \ TEST_BEFORE_INSTALL + \ TEST_COMMAND + \ TEST_EXCLUDE_FROM_MAIN + \ TIMEOUT + \ TLS_CAINFO + \ TLS_VERIFY + \ TMP_DIR + \ TRUE + \ UPDATE_COMMAND + \ UPDATE_DISCONNECTED + \ URL + \ URL_HASH + \ URL_MD5 + \ USES_TERMINAL_BUILD + \ USES_TERMINAL_CONFIGURE + \ USES_TERMINAL_DOWNLOAD + \ USES_TERMINAL_INSTALL + \ USES_TERMINAL_PATCH + \ USES_TERMINAL_TEST + \ USES_TERMINAL_UPDATE + \ WORKING_DIRECTORY + +syn keyword cmakeKWFetchContent contained + \ ALWAYS + \ BINARY_DIR + \ BUILD_COMMAND + \ BYPASS_PROVIDER + \ CMAKE_PROJECT_ + \ CONFIGURE_COMMAND + \ COPY + \ CORRECT + \ DCMAKE_TOOLCHAIN_FILE + \ DESTINATION + \ DOWNLOAD_NO_EXTRACT + \ EXISTS + \ FETCHCONTENT_BASE_DIR + \ FETCHCONTENT_FULLY_DISCONNECTED + \ FETCHCONTENT_MAKEAVAILABLE_SERIAL + \ FETCHCONTENT_QUIET + \ FETCHCONTENT_SOURCE_DIR_ + \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE + \ FETCHCONTENT_UPDATES_DISCONNECTED + \ FETCHCONTENT_UPDATES_DISCONNECTED_ + \ FIND_PACKAGE_ARGS + \ GIT_REPOSITORY + \ GIT_TAG + \ GLOBAL + \ GTEST_BOTH_LIBRARIES + \ GTEST_LIBRARIES + \ GTEST_MAIN_LIBRARIES + \ INSTALL_COMMAND + \ INTERNAL + \ NAME + \ NAMES + \ NEVER + \ NOTE + \ OFF + \ OPTIONAL + \ OPT_IN + \ OVERRIDE_FIND_PACKAGE + \ PACKAGE_VERSION_COMPATIBLE + \ PACKAGE_VERSION_EXACT + \ QUIET + \ SOURCE_SUBDIR + \ STREQUAL + \ SUBBUILD_DIR + \ SVN_REPOSITORY + \ SVN_REVISION + \ SYSTEM + \ TARGET + \ TEST_COMMAND + \ TRUE + \ URL + \ URL_HASH + \ VERIFY_INTERFACE_HEADER_SETS + \ WRITE + \ WRONG + \ _BINARY_DIR + \ _INCLUDE + \ _POPULATED + \ _SOURCE_DIR + +syn keyword cmakeKWadd_compile_definitions contained + \ COMPILE_DEFINITIONS + \ VAR syn keyword cmakeKWadd_compile_options contained + \ CMAKE_ + \ COMPILE_LANGUAGE \ COMPILE_OPTIONS + \ CONFIG + \ SHELL + \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ syn keyword cmakeKWadd_custom_command contained - \ APPEND ARGS BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS DEPFILE GENERATED IMPLICIT_DEPENDS INCLUDE_DIRECTORIES JOIN MAIN_DEPENDENCY NOT OUTPUT POST_BUILD PRE_BUILD PRE_LINK SYMBOLIC TARGET_FILE TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY + \ APPEND + \ ARGS + \ BNF + \ BYPRODUCTS + \ CC + \ COMMAND + \ COMMAND_EXPAND_LISTS + \ COMMENT + \ CONFIG + \ CROSSCOMPILING_EMULATOR + \ DEPENDS + \ DEPENDS_EXPLICIT_ONLY + \ DEPFILE + \ GENERATED + \ IMPLICIT_DEPENDS + \ INCLUDE_DIRECTORIES + \ JOB_POOL + \ JOB_POOLS + \ JOIN + \ MAIN_DEPENDENCY + \ MODULE + \ NOT + \ OUTPUT + \ PATH + \ POST_BUILD + \ PRE_BUILD + \ PRE_LINK + \ SYMBOLIC + \ TARGET_FILE + \ TARGET_LINKER_FILE + \ TARGET_PDB_FILE + \ TARGET_PROPERTY + \ TARGET_SONAME_FILE + \ USES_TERMINAL + \ VERBATIM + \ WORKING_DIRECTORY syn keyword cmakeKWadd_custom_target contained - \ ALL BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS GENERATED INCLUDE_DIRECTORIES JOIN SOURCES TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY + \ ALL + \ BYPRODUCTS + \ CC + \ COMMAND + \ COMMAND_EXPAND_LISTS + \ COMMENT + \ CROSSCOMPILING_EMULATOR + \ DEPENDS + \ GENERATED + \ INCLUDE_DIRECTORIES + \ JOB_POOL + \ JOB_POOLS + \ JOIN + \ PATH + \ SOURCES + \ TARGET_FILE + \ TARGET_LINKER_FILE + \ TARGET_PDB_FILE + \ TARGET_PROPERTY + \ TARGET_SONAME_FILE + \ USES_TERMINAL + \ VERBATIM + \ WORKING_DIRECTORY syn keyword cmakeKWadd_definitions contained \ COMPILE_DEFINITIONS syn keyword cmakeKWadd_dependencies contained - \ DEPENDS OBJECT_DEPENDS + \ DEPENDS + \ OBJECT_DEPENDS syn keyword cmakeKWadd_executable contained - \ ALIAS CONFIG EXCLUDE_FROM_ALL GLOBAL HEADER_FILE_ONLY IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ MACOSX_BUNDLE OUTPUT_NAME RUNTIME_OUTPUT_DIRECTORY TARGET + \ ALIAS + \ ALIAS_GLOBAL + \ CONFIG + \ EXCLUDE_FROM_ALL + \ GLOBAL + \ HEADER_FILE_ONLY + \ IMPORTED + \ IMPORTED_ + \ IMPORTED_LOCATION + \ IMPORTED_LOCATION_ + \ MACOSX_BUNDLE + \ OUTPUT_NAME + \ RUNTIME_OUTPUT_DIRECTORY + \ TARGET syn keyword cmakeKWadd_library contained - \ ALIAS ARCHIVE_OUTPUT_DIRECTORY CLI CONFIG DLL EXCLUDE_FROM_ALL FRAMEWORK GLOBAL HEADER_FILE_ONLY IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ INTERFACE_ LIBRARY_OUTPUT_DIRECTORY MODULE OBJECT ON OUTPUT_NAME POSITION_INDEPENDENT_CODE POST_BUILD PRE_BUILD PRE_LINK RUNTIME_OUTPUT_DIRECTORY SHARED STATIC TARGET_OBJECTS UNKNOWN + \ ALIAS + \ ALIAS_GLOBAL + \ ARCHIVE_OUTPUT_DIRECTORY + \ CLI + \ CONFIG + \ DLL + \ EXCLUDE_FROM_ALL + \ FRAMEWORK + \ GLOBAL + \ HEADER_FILE_ONLY + \ HEADER_SETS + \ IMPORTED + \ IMPORTED_ + \ IMPORTED_IMPLIB + \ IMPORTED_IMPLIB_ + \ IMPORTED_LOCATION + \ IMPORTED_LOCATION_ + \ IMPORTED_NO_SONAME + \ IMPORTED_OBJECTS + \ IMPORTED_OBJECTS_ + \ IMPORTED_SONAME + \ INTERFACE + \ INTERFACE_ + \ INTERFACE_SOURCES + \ LC_ID_DYLIB + \ LIBRARY_OUTPUT_DIRECTORY + \ MODULE + \ OBJECT + \ ON + \ OUTPUT_NAME + \ POSITION_INDEPENDENT_CODE + \ POST_BUILD + \ PRE_BUILD + \ PRE_LINK + \ PRIVATE_HEADER + \ PUBLIC_HEADER + \ RUNTIME_OUTPUT_DIRECTORY + \ SHARED + \ SONAME + \ SOURCES + \ STATIC + \ TARGETS + \ TARGET_OBJECTS + \ TARGET_RUNTIME_DLLS + \ UNKNOWN + +syn keyword cmakeKWadd_link_options contained + \ CMAKE_ + \ CONFIG + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION + \ DEVICE_LINK + \ GCC + \ HOST_LINK + \ LANG + \ LINKER + \ LINK_OPTIONS + \ SHELL + \ STATIC_LIBRARY_OPTIONS + \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ + \ _LINKER_WRAPPER_FLAG + \ _LINKER_WRAPPER_FLAG_SEP syn keyword cmakeKWadd_subdirectory contained \ EXCLUDE_FROM_ALL + \ SYSTEM syn keyword cmakeKWadd_test contained - \ BUILD_TESTING COMMAND CONFIGURATIONS FAIL_REGULAR_EXPRESSION NAME PASS_REGULAR_EXPRESSION TARGET_FILE WILL_FAIL WORKING_DIRECTORY + \ BUILD_TESTING + \ COMMAND + \ COMMAND_EXPAND_LISTS + \ CONFIGURATIONS + \ FAIL_REGULAR_EXPRESSION + \ NAME + \ OFF + \ PASS_REGULAR_EXPRESSION + \ SKIP_REGULAR_EXPRESSION + \ TARGET_FILE + \ WILL_FAIL + \ WILL_FALL + \ WORKING_DIRECTORY + +syn keyword cmakeKWblock contained + \ PARENT_SCOPE + \ POLICIES + \ PROPAGATE + \ PUSH + \ SCOPE_FOR + \ TRUE + \ VARIABLES syn keyword cmakeKWbuild_command contained - \ CONFIGURATION TARGET + \ CONFIGURATION + \ PARALLEL_LEVEL + \ TARGET -syn keyword cmakeKWbuild_name contained - \ CMAKE_CXX_COMPILER +syn keyword cmakeKWcmake_file_api contained + \ API + \ API_VERSION + \ BUILD_DIR + \ CMAKEFILES + \ CODEMODEL + \ COMMAND + \ CONFIG + \ QUERY + \ TOOLCHAINS syn keyword cmakeKWcmake_host_system_information contained - \ AVAILABLE_PHYSICAL_MEMORY AVAILABLE_VIRTUAL_MEMORY FQDN HAS_FPU HAS_MMX HAS_MMX_PLUS HAS_SERIAL_NUMBER HAS_SSE HAS_SSE_FP HAS_SSE_MMX HOSTNAME ID NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES OS_NAME OS_PLATFORM OS_RELEASE OS_VERSION PROCESSOR_DESCRIPTION PROCESSOR_NAME PROCESSOR_SERIAL_NUMBER QUERY RESULT TOTAL_PHYSICAL_MEMORY TOTAL_VIRTUAL_MEMORY + \ APPEND + \ AVAILABLE_PHYSICAL_MEMORY + \ AVAILABLE_VIRTUAL_MEMORY + \ BOTH + \ CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID + \ CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS + \ DISTRIB_INFO + \ DISTRIB_PRETTY_NAME + \ DISTRO + \ DISTRO_BUG_REPORT_URL + \ DISTRO_HOME_URL + \ DISTRO_ID + \ DISTRO_ID_LIKE + \ DISTRO_NAME + \ DISTRO_PRETTY_NAME + \ DISTRO_PRIVACY_POLICY_URL + \ DISTRO_SUPPORT_URL + \ DISTRO_UBUNTU_CODENAME + \ DISTRO_VERSION + \ DISTRO_VERSION_CODENAME + \ DISTRO_VERSION_ID + \ ERROR_VARIABLE + \ EXISTS + \ FQDN + \ HAS_FPU + \ HAS_MMX + \ HAS_MMX_PLUS + \ HAS_SERIAL_NUMBER + \ HAS_SSE + \ HAS_SSE_FP + \ HAS_SSE_MMX + \ HKCC + \ HKCR + \ HKCU + \ HKEY_CLASSES_ROOT + \ HKEY_CURRENT_CONFIG + \ HKEY_CURRENT_USER + \ HKEY_LOCAL_MACHINE + \ HKEY_USERS + \ HKLM + \ HKU + \ HOSTNAME + \ ID + \ LIMIT_COUNT + \ LISTS + \ LTS + \ MATCHES + \ NNN + \ NOT + \ NUMBER_OF_LOGICAL_CORES + \ NUMBER_OF_PHYSICAL_CORES + \ OS_NAME + \ OS_PLATFORM + \ OS_RELEASE + \ OS_VERSION + \ PRETTY_NAME + \ PROCESSOR_DESCRIPTION + \ PROCESSOR_NAME + \ PROCESSOR_SERIAL_NUMBER + \ QUERY + \ REG_DWORD + \ REG_EXPAND_SZ + \ REG_MULTI_SZ + \ REG_QWORD + \ REG_SZ + \ RESULT + \ SEPARATOR + \ SOFTWARE + \ STATUS + \ STRINGS + \ SUBKEYS + \ TARGET + \ TOTAL_PHYSICAL_MEMORY + \ TOTAL_VIRTUAL_MEMORY + \ VALUE_NAMES + \ VAR + \ VIEW + \ WINDOWS_REGISTRY + +syn keyword cmakeKWcmake_language contained + \ AND + \ ANY + \ APPEND + \ ARGN + \ BINARY_DIR + \ BYPASS_PROVIDER + \ CALL + \ CANCEL_CALL + \ CODE + \ COMMAND + \ COMMAND_ERROR_IS_FATAL + \ DCMAKE_PROJECT_TOP_LEVEL_INCLUDES + \ DEFER + \ DIRECTORY + \ EVAL + \ FALSE + \ FETCHCONTENT_MAKEAVAILABE_SERIAL + \ FETCHCONTENT_MAKEAVAILABLE_SERIAL + \ FETCHCONTENT_SOURCE_DIR_ + \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE + \ FIND_PACKAGE + \ FIND_PACKAGE_ARGS + \ GET_CALL_IDS + \ GET_MESSAGE_LOG_LEVEL + \ GIT_REPOSITORY + \ GIT_SUBMODULES + \ GIT_TAG + \ ID_VAR + \ MATCHES + \ MYCOMP_PROVIDER_INSTALL_DIR + \ NEVER + \ NOT + \ OVERRIDE_FIND_PACKAGE + \ PATH + \ POP_BACK + \ QUIET + \ SET_DEPENDENCY_PROVIDER + \ SOURCE_DIR + \ STATUS + \ STREQUAL + \ SUPPORTED_METHODS + \ TRUE + \ VERSION + \ WRITE + \ _FOUND + \ _PATH syn keyword cmakeKWcmake_minimum_required contained - \ FATAL_ERROR VERSION + \ FATAL_ERROR + \ VERSION syn keyword cmakeKWcmake_parse_arguments contained - \ ARGN CONFIGURATIONS DESTINATION FALSE FAST FILES MY_INSTALL MY_INSTALL_CONFIGURATIONS MY_INSTALL_DESTINATION MY_INSTALL_FAST MY_INSTALL_OPTIONAL MY_INSTALL_RENAME MY_INSTALL_TARGETS MY_INSTALL_UNPARSED_ARGUMENTS OPTIONAL PARSE_ARGV RENAME TARGETS TRUE _UNPARSED_ARGUMENTS + \ ARGN + \ CONFIGURATIONS + \ DESTINATION + \ FALSE + \ FAST + \ FILES + \ MY_INSTALL + \ MY_INSTALL_CONFIGURATIONS + \ MY_INSTALL_DESTINATION + \ MY_INSTALL_FAST + \ MY_INSTALL_KEYWORDS_MISSING_VALUES + \ MY_INSTALL_OPTIONAL + \ MY_INSTALL_RENAME + \ MY_INSTALL_TARGETS + \ MY_INSTALL_UNPARSED_ARGUMENTS + \ OPTIONAL + \ PARSE_ARGV + \ RENAME + \ TARGETS + \ TRUE + \ UNDEFINED + \ _KEYWORDS_MISSING_VALUES + \ _UNPARSED_ARGUMENTS + +syn keyword cmakeKWcmake_path contained + \ ABSOLUTE_PATH + \ AND + \ APPEND + \ APPEND_STRING + \ BASE_DIRECTORY + \ COMPARE + \ CONVERT + \ EQUAL + \ EXTENSION + \ EXTENSION_DEF + \ FALSE + \ FILENAME + \ FILENAME_DEF + \ GET + \ GET_EXTENSION + \ GET_FILENAME + \ GET_PARENT_PATH + \ GET_RELATIVE_PART + \ GET_ROOT_DIRECTORY + \ GET_ROOT_NAME + \ GET_ROOT_PATH + \ GET_STEM + \ HASH + \ HAS_EXTENSION + \ HAS_FILENAME + \ HAS_PARENT_PATH + \ HAS_RELATIVE_PART + \ HAS_ROOT_DIRECTORY + \ HAS_ROOT_NAME + \ HAS_ROOT_PATH + \ HAS_STEM + \ IS_ABSOLUTE + \ IS_PREFIX + \ IS_RELATIVE + \ LAST_ONLY + \ MATCHES + \ NATIVE_PATH + \ NORMALIZE + \ NORMAL_PATH + \ NOT_EQUAL + \ OP + \ OUTPUT_VARIABLE + \ PARENT_PATH + \ REAL_PATH + \ RELATIVE_PART + \ RELATIVE_PATH + \ REMOVE_EXTENSION + \ REMOVE_FILENAME + \ REPLACE_EXTENSION + \ REPLACE_FILENAME + \ ROOT_DIRECTORY + \ ROOT_NAME + \ ROOT_PATH + \ SET + \ STEM + \ STREQUAL + \ TO_CMAKE_PATH_LIST + \ TO_NATIVE_PATH_LIST + \ TRUE + \ XOR syn keyword cmakeKWcmake_policy contained - \ CMAKE_POLICY_DEFAULT_CMP CMP GET NNNN NO_POLICY_SCOPE OLD POP PUSH SET VERSION + \ CMAKE_POLICY_DEFAULT_CMP + \ CMP + \ GET + \ NNNN + \ NO_POLICY_SCOPE + \ OLD + \ POLICIES + \ POP + \ PUSH + \ SCOPE_FOR + \ SET + \ VERSION syn keyword cmakeKWconfigure_file contained - \ COPYONLY CRLF DOS ESCAPE_QUOTES FOO_ENABLE FOO_STRING LF NEWLINE_STYLE VAR + \ COPYONLY + \ CRLF + \ DOS + \ ESCAPE_QUOTES + \ FILE_PERMISSIONS + \ FOO_ENABLE + \ FOO_STRING + \ GENERATE + \ INTERFACE + \ LF + \ NEWLINE_STYLE + \ NO_SOURCE_PERMISSIONS + \ PRIVATE + \ PUBLIC + \ SYSTEM + \ USE_SOURCE_PERMISSIONS + \ VAR syn keyword cmakeKWcreate_test_sourcelist contained - \ CMAKE_TESTDRIVER_AFTER_TESTMAIN CMAKE_TESTDRIVER_BEFORE_TESTMAIN EXTRA_INCLUDE FUNCTION + \ CMAKE_TESTDRIVER_AFTER_TESTMAIN + \ CMAKE_TESTDRIVER_BEFORE_TESTMAIN + \ EXTRA_INCLUDE + \ FUNCTION syn keyword cmakeKWctest_build contained - \ ALL_BUILD APPEND BUILD CAPTURE_CMAKE_ERROR CONFIGURATION CTEST_BUILD_CONFIGURATION CTEST_BUILD_FLAGS CTEST_BUILD_TARGET CTEST_PROJECT_NAME FLAGS NUMBER_ERRORS NUMBER_WARNINGS QUIET RETURN_VALUE TARGET + \ ALL_BUILD + \ APPEND + \ BUILD + \ CAPTURE_CMAKE_ERROR + \ CMAKE_BUILD_PARALLEL_LEVEL + \ CONFIGURATION + \ CTEST_BUILD_CONFIGURATION + \ CTEST_BUILD_FLAGS + \ CTEST_BUILD_TARGET + \ FLAGS + \ NUMBER_ERRORS + \ NUMBER_WARNINGS + \ PARALLEL_LEVEL + \ QUIET + \ RETURN_VALUE + \ TARGET syn keyword cmakeKWctest_configure contained - \ APPEND BUILD CAPTURE_CMAKE_ERROR OPTIONS QUIET RETURN_VALUE SOURCE + \ APPEND + \ BUILD + \ CAPTURE_CMAKE_ERROR + \ OPTIONS + \ QUIET + \ RETURN_VALUE + \ SOURCE syn keyword cmakeKWctest_coverage contained - \ APPEND BUILD CAPTURE_CMAKE_ERROR LABELS QUIET RETURN_VALUE + \ APPEND + \ BUILD + \ CAPTURE_CMAKE_ERROR + \ LABELS + \ QUIET + \ RETURN_VALUE syn keyword cmakeKWctest_memcheck contained - \ APPEND BUILD DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD + \ APPEND + \ BUILD + \ CAPTURE_CMAKE_ERROR + \ DEFECT_COUNT + \ EXCLUDE + \ EXCLUDE_FIXTURE + \ EXCLUDE_FIXTURE_CLEANUP + \ EXCLUDE_FIXTURE_SETUP + \ EXCLUDE_LABEL + \ INCLUDE + \ INCLUDE_LABEL + \ OFF + \ ON + \ OUTPUT_JUNIT + \ PARALLEL_LEVEL + \ QUIET + \ REPEAT + \ RESOURCE_SPEC_FILE + \ RETURN_VALUE + \ SCHEDULE_RANDOM + \ START + \ STOP_ON_FAILURE + \ STOP_TIME + \ STRIDE + \ TEST_LOAD syn keyword cmakeKWctest_run_script contained - \ NEW_PROCESS RETURN_VALUE + \ NEW_PROCESS + \ RETURN_VALUE syn keyword cmakeKWctest_start contained - \ APPEND QUIET TAG TRACK + \ APPEND + \ GROUP + \ QUIET + \ TAG + \ TRACK syn keyword cmakeKWctest_submit contained - \ API CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE + \ API + \ BUILD_ID + \ CAPTURE_CMAKE_ERROR + \ CDASH_UPLOAD + \ CDASH_UPLOAD_TYPE + \ CTEST_EXTRA_SUBMIT_FILES + \ CTEST_NOTES_FILES + \ FILES + \ HTTPHEADER + \ PARTS + \ QUIET + \ RETRY_COUNT + \ RETRY_DELAY + \ RETURN_VALUE + \ SUBMIT_URL syn keyword cmakeKWctest_test contained - \ APPEND BUILD CAPTURE_CMAKE_ERROR CPU EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD + \ AFTER_TIMEOUT + \ APPEND + \ ATTACHED_FILES + \ ATTACHED_FILES_ON_FAIL + \ BUILD + \ CAPTURE_CMAKE_ERROR + \ CPU + \ EXCLUDE + \ EXCLUDE_FIXTURE + \ EXCLUDE_FIXTURE_CLEANUP + \ EXCLUDE_FIXTURE_SETUP + \ EXCLUDE_LABEL + \ INCLUDE + \ INCLUDE_LABEL + \ LABELS + \ OFF + \ ON + \ OUTPUT_JUNIT + \ PARALLEL_LEVEL + \ QUIET + \ REPEAT + \ RESOURCE_SPEC_FILE + \ RETURN_VALUE + \ SCHEDULE_RANDOM + \ START + \ STOP_ON_FAILURE + \ STOP_TIME + \ STRIDE + \ TEST_LOAD + \ UNTIL_FAIL + \ UNTIL_PASS + \ URL + \ XML syn keyword cmakeKWctest_update contained - \ QUIET RETURN_VALUE SOURCE + \ CAPTURE_CMAKE_ERROR + \ QUIET + \ RETURN_VALUE + \ SOURCE syn keyword cmakeKWctest_upload contained - \ CAPTURE_CMAKE_ERROR FILES QUIET + \ CAPTURE_CMAKE_ERROR + \ FILES + \ QUIET syn keyword cmakeKWdefine_property contained - \ BRIEF_DOCS CACHED_VARIABLE DIRECTORY FULL_DOCS GLOBAL INHERITED PROPERTY SOURCE TARGET TEST VARIABLE + \ APPEND + \ APPEND_STRING + \ BRIEF_DOCS + \ CACHED_VARIABLE + \ CMAKE_ + \ DIRECTORY + \ FULL_DOCS + \ GLOBAL + \ INHERITED + \ INITIALIZE_FROM_VARIABLE + \ PROPERTY + \ SOURCE + \ TARGET + \ TEST + \ VARIABLE + \ _CMAKE_ + +syn keyword cmakeKWdoxygen_add_docs contained + \ ALL + \ COMMENT + \ USE_STAMP_FILE + \ WORKING_DIRECTORY syn keyword cmakeKWenable_language contained + \ ASM + \ ASM_MARMASM + \ ASM_MASM + \ ASM_NASM + \ ATT + \ CUDA + \ HIP + \ ISPC + \ OBJC + \ OBJCXX \ OPTIONAL +syn keyword cmakeKWenable_testing contained + \ BUILD_TESTING + syn keyword cmakeKWexec_program contained - \ ARGS OUTPUT_VARIABLE RETURN_VALUE + \ ARGS + \ OUTPUT_VARIABLE + \ RETURN_VALUE syn keyword cmakeKWexecute_process contained - \ ANSI AUTO COMMAND ENCODING ERROR_FILE ERROR_QUIET ERROR_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE INPUT_FILE NONE OEM OUTPUT_FILE OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE RESULTS_VARIABLE RESULT_VARIABLE TIMEOUT UTF VERBATIM WORKING_DIRECTORY + \ ANSI + \ ANY + \ AUTO + \ COMMAND + \ COMMAND_ECHO + \ COMMAND_ERROR_IS_FATAL + \ ECHO_ERROR_VARIABLE + \ ECHO_OUTPUT_VARIABLE + \ ENCODING + \ ERROR_FILE + \ ERROR_QUIET + \ ERROR_STRIP_TRAILING_WHITESPACE + \ ERROR_VARIABLE + \ INPUT_FILE + \ LAST + \ NONE + \ OEM + \ OUTPUT_FILE + \ OUTPUT_QUIET + \ OUTPUT_STRIP_TRAILING_WHITESPACE + \ OUTPUT_VARIABLE + \ POSIX + \ RESULTS_VARIABLE + \ RESULT_VARIABLE + \ RFC + \ STDERR + \ STDOUT + \ TIMEOUT + \ UTF + \ WORKING_DIRECTORY syn keyword cmakeKWexport contained - \ ANDROID_MK APPEND CONFIG EXPORT EXPORT_LINK_INTERFACE_LIBRARIES FILE IMPORTED IMPORTED_ NAMESPACE NDK OLD PACKAGE TARGETS + \ ANDROID_MK + \ APPEND + \ CONFIG + \ CXX_MODULES_DIRECTORY + \ EXPORT + \ EXPORT_LINK_INTERFACE_LIBRARIES + \ FILE + \ IMPORTED_ + \ NAMESPACE + \ NDK + \ OLD + \ PACKAGE + \ TARGETS syn keyword cmakeKWexport_library_dependencies contained - \ APPEND EXPORT INCLUDE LINK_INTERFACE_LIBRARIES SET + \ APPEND + \ EXPORT + \ INCLUDE + \ LINK_INTERFACE_LIBRARIES + \ SET syn keyword cmakeKWfile contained - \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HASH HEX HTTPHEADER INACTIVITY_TIMEOUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFFSET OLD PATTERN PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SSL STATUS STRINGS TIMESTAMP TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USERPWD USE_SOURCE_PERMISSIONS UTC UTF WRITE + \ APPEND + \ ARCHIVE_CREATE + \ ARCHIVE_EXTRACT + \ ASCII + \ BASE_DIRECTORY + \ BUNDLE_EXECUTABLE + \ CHMOD + \ CHMOD_RECURSE + \ CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND + \ CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM + \ CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL + \ CMAKE_INSTALL_MODE + \ CMAKE_OBJDUMP + \ CODE + \ COMPILE_FEATURES + \ COMPRESSION + \ COMPRESSION_LEVEL + \ CONDITION + \ CONFIGURE + \ CONFIGURE_DEPENDS + \ CONFLICTING_DEPENDENCIES_PREFIX + \ CONTENT + \ CONVERT + \ COPYONLY + \ COPY_FILE + \ COPY_ON_ERROR + \ CREATE_LINK + \ CRLF + \ DESTINATION + \ DIRECTORIES + \ DIRECTORY_PERMISSIONS + \ DLL + \ DOS + \ DOWNLOAD + \ ENCODING + \ ESCAPE_QUOTES + \ EXECUTABLES + \ EXPAND_TILDE + \ EXPECTED_HASH + \ FILES_MATCHING + \ FILE_PERMISSIONS + \ FOLLOW_SYMLINKS + \ FOLLOW_SYMLINK_CHAIN + \ FORMAT + \ FUNCTION + \ GENERATE + \ GET_RUNTIME_DEPENDENCIES + \ GLOB + \ GLOB_RECURSE + \ GROUP_EXECUTE + \ GROUP_READ + \ GROUP_WRITE + \ GUARD + \ HASH + \ HEX + \ HOME + \ HTTPHEADER + \ IGNORED + \ INACTIVITY_TIMEOUT + \ INPUT + \ INPUT_MAY_BE_RECENT + \ INSTALL + \ IS_ABSOLUTE + \ LENGTH_MAXIMUM + \ LENGTH_MINIMUM + \ LF + \ LIBRARIES + \ LIMIT + \ LIMIT_COUNT + \ LIMIT_INPUT + \ LIMIT_OUTPUT + \ LIST_DIRECTORIES + \ LIST_ONLY + \ LOCK + \ LOG + \ MAKE_DIRECTORY + \ MODULES + \ MTIME + \ MYLIBRARY + \ NETRC + \ NETRC_FILE + \ NEWLINE_CONSUME + \ NEWLINE_STYLE + \ NOT + \ NO_HEX_CONVERSION + \ NO_REPLACE + \ NO_SOURCE_PERMISSIONS + \ OFFSET + \ ONLY + \ ONLY_IF_DIFFERENT + \ OPTIONAL + \ OUTPUT + \ OWNER_EXECUTE + \ OWNER_READ + \ OWNER_WRITE + \ PATHS + \ PATTERN + \ PATTERNS + \ PERMISSIONS + \ POST_EXCLUDE_FILES + \ POST_EXCLUDE_REGEXES + \ POST_INCLUDE_FILES + \ POST_INCLUDE_REGEXES + \ PRE_EXCLUDE_REGEXES + \ PRE_INCLUDE_REGEXES + \ PROCESS + \ RANGE_END + \ RANGE_START + \ READ + \ READ_SYMLINK + \ REAL_PATH + \ REGEX + \ RELATIVE + \ RELATIVE_PATH + \ RELEASE + \ REMOVE + \ REMOVE_RECURSE + \ RENAME + \ REQUIRED + \ RESOLVED_DEPENDENCIES_VAR + \ RESULT + \ RESULT_VARIABLE + \ RPATH + \ RUNPATH + \ RUNTIME_DEPENDENCY_SET + \ SCRIPT + \ SETGID + \ SETUID + \ SHARED + \ SHOW_PROGRESS + \ SIZE + \ SSL + \ STATIC + \ STATUS + \ STRINGS + \ SYMBOLIC + \ TARGET + \ TARGET_PROPERTY + \ TIMESTAMP + \ TLS_CAINFO + \ TLS_VERIFY + \ TOUCH + \ TOUCH_NOCREATE + \ TO_CMAKE_PATH + \ TO_CMAKE_PATH_LIST + \ TO_NATIVE_PATH + \ TO_NATIVE_PATH_LIST + \ UNRESOLVED_DEPENDENCIES_VAR + \ UPLOAD + \ URL + \ USERPROFILE + \ USERPWD + \ USE_SOURCE_PERMISSIONS + \ UTC + \ UTF + \ VERBOSE + \ WORLD_EXECUTE + \ WORLD_READ + \ WORLD_WRITE + \ WRITE + \ XZ + \ _FILENAMES syn keyword cmakeKWfind_file contained - \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR + \ BOTH + \ CATEGORY + \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ DOC + \ DVAR + \ FALSE + \ FIND_XXX_REGISTRY_VIEW + \ HINTS + \ HOST + \ INCLUDE + \ MATCHES + \ NAMES + \ NOT + \ NO_CACHE + \ NO_CMAKE_ENVIRONMENT_PATH + \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX + \ NO_CMAKE_PATH + \ NO_CMAKE_SYSTEM_PATH + \ NO_DEFAULT_PATH + \ NO_PACKAGE_ROOT_PATH + \ NO_SYSTEM_ENVIRONMENT_PATH + \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE + \ PATHS + \ PATH_SUFFIXES + \ REGISTRY_VIEW + \ REQUIRED + \ TARGET + \ VALIDATOR + \ VAR syn keyword cmakeKWfind_library contained - \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS LIB NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR + \ BOTH + \ CATEGORY + \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ DOC + \ DVAR + \ FALSE + \ FIND_XXX_REGISTRY_VIEW + \ HINTS + \ HOST + \ LIB + \ MATCHES + \ NAMES + \ NAMES_PER_DIR + \ NOT + \ NO_CACHE + \ NO_CMAKE_ENVIRONMENT_PATH + \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX + \ NO_CMAKE_PATH + \ NO_CMAKE_SYSTEM_PATH + \ NO_DEFAULT_PATH + \ NO_PACKAGE_ROOT_PATH + \ NO_SYSTEM_ENVIRONMENT_PATH + \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE + \ PATHS + \ PATH_SUFFIXES + \ REGISTRY_VIEW + \ REQUIRED + \ TARGET + \ VALIDATOR + \ VAR syn keyword cmakeKWfind_package contained - \ CMAKE_DISABLE_FIND_PACKAGE_ CMAKE_FIND_ROOT_PATH_BOTH COMPONENTS CONFIG CONFIGS DEC DVAR EXACT HINTS MODULE NAMES NATURAL NO_CMAKE_BUILDS_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_PATH NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_MODULE NO_POLICY_SCOPE NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OPTIONAL_COMPONENTS OS PACKAGE_FIND_NAME PACKAGE_FIND_VERSION PACKAGE_FIND_VERSION_COUNT PACKAGE_FIND_VERSION_MAJOR PACKAGE_FIND_VERSION_MINOR PACKAGE_FIND_VERSION_PATCH PACKAGE_FIND_VERSION_TWEAK PACKAGE_VERSION PACKAGE_VERSION_COMPATIBLE PACKAGE_VERSION_EXACT PACKAGE_VERSION_UNSUITABLE PATHS PATH_SUFFIXES QUIET REQUIRED SET TRUE _CONFIG _CONSIDERED_CONFIGS _CONSIDERED_VERSIONS _DIR _FIND_COMPONENTS _FIND_QUIETLY _FIND_REQUIRED _FIND_REQUIRED_ _FIND_VERSION_EXACT _FOUND + \ ABI + \ BOTH + \ BUNDLE + \ BYPASS_PROVIDER + \ CATEGORY + \ CMAKE_DISABLE_FIND_PACKAGE_ + \ CMAKE_REQUIRE_FIND_PACKAGE_ + \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ CMAKE_REQUIRE_FIND_PACKAGE_ + \ COMPONENTS + \ CONFIG + \ CONFIGS + \ DEC + \ DVAR + \ EXACT + \ EXCLUDE + \ FALSE + \ FIND_PACKAGE_VERSION_FORMAT + \ FRAMEWORK + \ GLOBAL + \ HINTS + \ HOST + \ INCLUDE + \ MODULE + \ NAMES + \ NATURAL + \ NO_CMAKE_BUILDS_PATH + \ NO_CMAKE_ENVIRONMENT_PATH + \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX + \ NO_CMAKE_PACKAGE_REGISTRY + \ NO_CMAKE_PATH + \ NO_CMAKE_SYSTEM_PACKAGE_REGISTRY + \ NO_CMAKE_SYSTEM_PATH + \ NO_DEFAULT_PATH + \ NO_MODULE + \ NO_PACKAGE_ROOT_PATH + \ NO_POLICY_SCOPE + \ NO_SYSTEM_ENVIRONMENT_PATH + \ OLD + \ ONLY_CMAKE_FIND_ROOT_PATH + \ OPTIONAL_COMPONENTS + \ PACKAGENAME + \ PACKAGE_FIND_NAME + \ PACKAGE_FIND_VERSION + \ PACKAGE_FIND_VERSION_COMPLETE + \ PACKAGE_FIND_VERSION_COUNT + \ PACKAGE_FIND_VERSION_MAJOR + \ PACKAGE_FIND_VERSION_MAX + \ PACKAGE_FIND_VERSION_MAX_COUNT + \ PACKAGE_FIND_VERSION_MAX_MAJOR + \ PACKAGE_FIND_VERSION_MAX_MINOR + \ PACKAGE_FIND_VERSION_MAX_PATCH + \ PACKAGE_FIND_VERSION_MAX_TWEAK + \ PACKAGE_FIND_VERSION_MINOR + \ PACKAGE_FIND_VERSION_MIN_COUNT + \ PACKAGE_FIND_VERSION_MIN_MAJOR + \ PACKAGE_FIND_VERSION_MIN_MINOR + \ PACKAGE_FIND_VERSION_MIN_PATCH + \ PACKAGE_FIND_VERSION_MIN_TWEAK + \ PACKAGE_FIND_VERSION_PATCH + \ PACKAGE_FIND_VERSION_RANGE + \ PACKAGE_FIND_VERSION_RANGE_MAX + \ PACKAGE_FIND_VERSION_RANGE_MIN + \ PACKAGE_FIND_VERSION_TWEAK + \ PACKAGE_VERSION_COMPATIBLE + \ PACKAGE_VERSION_EXACT + \ PACKAGE_VERSION_UNSUITABLE + \ PATHS + \ PATH_SUFFIXES + \ QUIET + \ REGISTRY_VIEW + \ REQUIRED + \ SET + \ TARGET + \ TRUE + \ VALUE + \ _CONFIG + \ _CONSIDERED_CONFIGS + \ _CONSIDERED_VERSIONS + \ _DIR + \ _FIND_COMPONENTS + \ _FIND_QUIETLY + \ _FIND_REGISTRY_VIEW + \ _FIND_REQUIRED + \ _FIND_REQUIRED_ + \ _FIND_VERSION_EXACT + \ _FOUND syn keyword cmakeKWfind_path contained - \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR + \ BOTH + \ CATEGORY + \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ DOC + \ DVAR + \ FALSE + \ FIND_XXX_REGISTRY_VIEW + \ HINTS + \ HOST + \ INCLUDE + \ MATCHES + \ NAMES + \ NOT + \ NO_CACHE + \ NO_CMAKE_ENVIRONMENT_PATH + \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX + \ NO_CMAKE_PATH + \ NO_CMAKE_SYSTEM_PATH + \ NO_DEFAULT_PATH + \ NO_PACKAGE_ROOT_PATH + \ NO_SYSTEM_ENVIRONMENT_PATH + \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE + \ PATHS + \ PATH_SUFFIXES + \ REGISTRY_VIEW + \ REQUIRED + \ TARGET + \ VALIDATOR + \ VAR syn keyword cmakeKWfind_program contained - \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR + \ BOTH + \ CATEGORY + \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ DOC + \ DVAR + \ FALSE + \ FIND_XXX_REGISTRY_VIEW + \ HINTS + \ HOST + \ MATCHES + \ NAMES + \ NAMES_PER_DIR + \ NOT + \ NO_CACHE + \ NO_CMAKE_ENVIRONMENT_PATH + \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX + \ NO_CMAKE_PATH + \ NO_CMAKE_SYSTEM_PATH + \ NO_DEFAULT_PATH + \ NO_PACKAGE_ROOT_PATH + \ NO_SYSTEM_ENVIRONMENT_PATH + \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE + \ PATHS + \ PATH_SUFFIXES + \ REGISTRY_VIEW + \ REQUIRED + \ TARGET + \ VALIDATOR + \ VAR syn keyword cmakeKWfltk_wrap_ui contained \ FLTK syn keyword cmakeKWforeach contained - \ ARGS IN ITEMS LISTS RANGE + \ APPEND + \ IN + \ ITEMS + \ LISTS + \ RANGE + \ STATUS + \ ZIP_LISTS syn keyword cmakeKWfunction contained - \ ARGC ARGN ARGS ARGV PARENT_SCOPE + \ ARGC + \ ARGN + \ ARGV + \ CALL + \ FOO + \ PARENT_SCOPE syn keyword cmakeKWget_cmake_property contained - \ COMPONENTS GLOBAL MACROS VAR VARIABLES + \ COMPONENTS + \ GLOBAL + \ MACROS + \ VARIABLES syn keyword cmakeKWget_directory_property contained - \ DEFINITION DIRECTORY + \ DEFINITION + \ DIRECTORY + \ INHERITED syn keyword cmakeKWget_filename_component contained - \ ABSOLUTE ARG_VAR BASE_DIR CACHE COMP DIRECTORY EXT NAME NAME_WE PATH PROGRAM PROGRAM_ARGS REALPATH VAR + \ ABSOLUTE + \ BASE_DIR + \ DIRECTORY + \ EXT + \ LAST_EXT + \ NAME + \ NAME_WE + \ NAME_WLE + \ PROGRAM + \ PROGRAM_ARGS + \ QUERY + \ REALPATH + \ REAL_PATH + \ WINDOWS_REGISTRY syn keyword cmakeKWget_property contained - \ BRIEF_DOCS CACHE DEFINED DIRECTORY FULL_DOCS GLOBAL INSTALL PROPERTY SET SOURCE TARGET TEST VARIABLE + \ BRIEF_DOCS + \ DEFINED + \ DIRECTORY + \ FULL_DOCS + \ GENERATED + \ GLOBAL + \ INSTALL + \ PROPERTY + \ SET + \ SOURCE + \ TARGET + \ TARGET_DIRECTORY + \ TEST + \ VARIABLE syn keyword cmakeKWget_source_file_property contained - \ LOCATION VAR + \ DIRECTORY + \ GENERATED + \ INHERITED + \ LOCATION + \ TARGET_DIRECTORY syn keyword cmakeKWget_target_property contained + \ INHERITED \ VAR syn keyword cmakeKWget_test_property contained + \ INHERITED \ VAR syn keyword cmakeKWif contained - \ ARGS CMAKE_MATCH_ CMP COMMAND DEFINED EQUAL EXISTS FALSE GREATER GREATER_EQUAL IGNORE IN_LIST IS_ABSOLUTE IS_DIRECTORY IS_NEWER_THAN IS_SYMLINK LESS LESS_EQUAL MATCHES NNNN NOT OFF OR POLICY STREQUAL STRGREATER STRGREATER_EQUAL STRLESS STRLESS_EQUAL TARGET TEST THEN TRUE VERSION_EQUAL VERSION_GREATER VERSION_GREATER_EQUAL VERSION_LESS VERSION_LESS_EQUAL YES + \ CMAKE_MATCH_ + \ CMP + \ COMMAND + \ COMPARE + \ DEFINED + \ EQUAL + \ EXISTS + \ FALSE + \ GREATER + \ GREATER_EQUAL + \ IGNORE + \ IN_LIST + \ IS_ABSOLUTE + \ IS_DIRECTORY + \ IS_NEWER_THAN + \ IS_SYMLINK + \ LESS + \ LESS_EQUAL + \ MATCHES + \ NNNN + \ NOT + \ OFF + \ OR + \ PATH_EQUAL + \ POLICY + \ STREQUAL + \ STRGREATER + \ STRGREATER_EQUAL + \ STRLESS + \ STRLESS_EQUAL + \ TARGET + \ TEST + \ TRUE + \ VERSION_EQUAL + \ VERSION_GREATER + \ VERSION_GREATER_EQUAL + \ VERSION_LESS + \ VERSION_LESS_EQUAL + \ YES syn keyword cmakeKWinclude contained - \ NO_POLICY_SCOPE OPTIONAL RESULT_VARIABLE + \ NO_POLICY_SCOPE + \ OPTIONAL + \ RESULT_VARIABLE syn keyword cmakeKWinclude_directories contained - \ AFTER BEFORE INCLUDE_DIRECTORIES ON SYSTEM + \ AFTER + \ BEFORE + \ INCLUDE_DIRECTORIES + \ ON + \ SYSTEM syn keyword cmakeKWinclude_external_msproject contained - \ GUID MAP_IMPORTED_CONFIG_ PLATFORM TYPE WIX + \ GUID + \ MAP_IMPORTED_CONFIG_ + \ PLATFORM + \ TYPE + \ WIX syn keyword cmakeKWinclude_guard contained - \ DIRECTORY GLOBAL TRUE __CURRENT_FILE_VAR__ + \ DIRECTORY + \ GLOBAL + \ TRUE + \ __CURRENT_FILE_VAR__ syn keyword cmakeKWinstall contained - \ ARCHIVE BUNDLE CODE COMPONENT CONFIGURATIONS CVS DESTDIR DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DLL EXCLUDE_FROM_ALL EXPORT EXPORT_ANDROID_MK EXPORT_LINK_INTERFACE_LIBRARIES FILES FILES_MATCHING FILE_PERMISSIONS FRAMEWORK GROUP_EXECUTE GROUP_READ GROUP_WRITE IMPORTED_ INCLUDES INSTALL_PREFIX INTERFACE_INCLUDE_DIRECTORIES LIBRARY MACOSX_BUNDLE MESSAGE_NEVER NAMELINK_ONLY NAMELINK_SKIP NAMESPACE NDK OBJECTS OPTIONAL OWNER_EXECUTE OWNER_READ OWNER_WRITE PATTERN PERMISSIONS POST_INSTALL_SCRIPT PRE_INSTALL_SCRIPT PRIVATE_HEADER PROGRAMS PUBLIC_HEADER REGEX RENAME RESOURCE RUNTIME SCRIPT SETGID SETUID SOVERSION TARGETS TRUE USE_SOURCE_PERMISSIONS VERSION WORLD_EXECUTE WORLD_READ WORLD_WRITE + \ AFTER + \ AIX + \ ALL_COMPONENTS + \ APT + \ ARCHIVE + \ BEFORE + \ BUILD_TYPE + \ BUNDLE + \ BUNDLE_EXECUTABLE + \ CMAKE_INSTALL_BINDIR + \ CMAKE_INSTALL_DATADIR + \ CMAKE_INSTALL_DATAROOTDIR + \ CMAKE_INSTALL_DOCDIR + \ CMAKE_INSTALL_INCLUDEDIR + \ CMAKE_INSTALL_INFODIR + \ CMAKE_INSTALL_LIBDIR + \ CMAKE_INSTALL_LOCALEDIR + \ CMAKE_INSTALL_LOCALSTATEDIR + \ CMAKE_INSTALL_MANDIR + \ CMAKE_INSTALL_MODE + \ CMAKE_INSTALL_RUNSTATEDIR + \ CMAKE_INSTALL_SBINDIR + \ CMAKE_INSTALL_SHARESTATEDIR + \ CMAKE_INSTALL_SYSCONFDIR + \ CODE + \ COMPONENT + \ CONFIGURATIONS + \ CVS + \ CXX_MODULES_BMI + \ CXX_MODULES_DIRECTORY + \ DATA + \ DATAROOT + \ DBUILD_TYPE + \ DCOMPONENT + \ DESTDIR + \ DESTINATION + \ DIRECTORY + \ DIRECTORY_PERMISSIONS + \ DLL + \ DOC + \ ENABLE_EXPORTS + \ EXCLUDE_FROM_ALL + \ EXECUTABLES + \ EXPORT + \ EXPORT_ANDROID_MK + \ EXPORT_LINK_INTERFACE_LIBRARIES + \ EXPORT_NAME + \ FILES + \ FILES_MATCHING + \ FILE_PERMISSIONS + \ FILE_SET + \ FRAMEWORK + \ GET_RUNTIME_DEPENDENCIES + \ GROUP_EXECUTE + \ GROUP_READ + \ GROUP_WRITE + \ HEADERS + \ IMPORTED_RUNTIME_ARTIFACTS + \ INCLUDES + \ INFO + \ INSTALL_PREFIX + \ INTERFACE + \ INTERFACE_INCLUDE_DIRECTORIES + \ LIBRARY + \ LOCALE + \ LOCALSTATE + \ MACOSX_BUNDLE + \ MAN + \ MESSAGE_NEVER + \ NAMELINK_COMPONENT + \ NAMELINK_ONLY + \ NAMELINK_SKIP + \ NAMESPACE + \ NDK + \ OBJECTS + \ OPTIONAL + \ OWNER_EXECUTE + \ OWNER_READ + \ OWNER_WRITE + \ PATTERN + \ PERMISSIONS + \ POST_EXCLUDE_FILES + \ POST_EXCLUDE_REGEXES + \ POST_INCLUDE_FILES + \ POST_INCLUDE_REGEXES + \ POST_INSTALL_SCRIPT + \ PRE_EXCLUDE_REGEXES + \ PRE_INCLUDE_REGEXES + \ PRE_INSTALL_SCRIPT + \ PRIVATE_HEADER + \ PROGRAMS + \ PROPERTIES + \ PUBLIC_HEADER + \ RENAME + \ RESOURCE + \ RPM + \ RUNSTATE + \ RUNTIME_DEPENDENCIES + \ RUNTIME_DEPENDENCY_SET + \ SBIN + \ SCRIPT + \ SETGID + \ SETUID + \ SHAREDSTATE + \ SOVERSION + \ STATIC + \ SYSCONF + \ TARGETS + \ TRUE + \ TYPE + \ USE_SOURCE_PERMISSIONS + \ VERSION + \ WORLD_EXECUTE + \ WORLD_READ + \ WORLD_WRITE syn keyword cmakeKWinstall_files contained - \ FILES GLOB + \ FILES + \ GLOB syn keyword cmakeKWinstall_programs contained - \ FILES GLOB PROGRAMS TARGETS + \ FILES + \ GLOB + \ PROGRAMS + \ TARGETS syn keyword cmakeKWinstall_targets contained - \ DLL RUNTIME_DIRECTORY TARGETS + \ DLL + \ RUNTIME_DIRECTORY + +syn keyword cmakeKWlink_directories contained + \ AFTER + \ BEFORE + \ LINK_DIRECTORIES + \ ON + \ ORIGIN + \ RPATH syn keyword cmakeKWlist contained - \ APPEND CACHE EXCLUDE FILTER FIND GET INCLUDE INSERT INTERNAL LENGTH LIST NOTES PARENT_SCOPE REGEX REMOVE_AT REMOVE_DUPLICATES REMOVE_ITEM REVERSE SORT + \ ACTION + \ APPEND + \ ASCENDING + \ CASE + \ COMPARE + \ DESCENDING + \ EXCLUDE + \ FILE_BASENAME + \ FILTER + \ FIND + \ GENEX_STRIP + \ GET + \ INCLUDE + \ INSENSITIVE + \ INSERT + \ INTERNAL + \ JOIN + \ LENGTH + \ NATURAL + \ ORDER + \ OUTPUT_VARIABLE + \ PARENT_SCOPE + \ POP_BACK + \ POP_FRONT + \ PREPEND + \ REGEX + \ REMOVE_AT + \ REMOVE_DUPLICATES + \ REMOVE_ITEM + \ REPLACE + \ REVERSE + \ SELECTOR + \ SENSITIVE + \ SORT + \ STRING + \ STRIP + \ SUBLIST + \ TOLOWER + \ TOUPPER + \ TRANSFORM + \ TRANSFORM_APPEND + \ TRANSFORM_GENEX_STRIP + \ TRANSFORM_REPLACE + \ TRANSFORM_STRIP + \ TRANSFORM_TOLOWER syn keyword cmakeKWload_cache contained - \ EXCLUDE INCLUDE_INTERNALS READ_WITH_PREFIX + \ EXCLUDE + \ INCLUDE_INTERNALS + \ READ_WITH_PREFIX syn keyword cmakeKWload_command contained - \ CMAKE_LOADED_COMMAND_ COMMAND_NAME + \ CMAKE_LOADED_COMMAND_ + \ COMMAND_NAME syn keyword cmakeKWmacro contained - \ ARGC ARGN ARGS ARGV DEFINED GREATER LISTS NOT _BAR _FOO - -syn keyword cmakeKWmake_directory contained - \ MAKE_DIRECTORY + \ ARGC + \ ARGN + \ ARGV + \ CALL + \ DEFINED + \ FOO + \ GREATER + \ LISTS + \ NOT syn keyword cmakeKWmark_as_advanced contained - \ CLEAR FORCE VAR + \ CLEAR + \ FORCE syn keyword cmakeKWmath contained \ EXPR + \ HEXADECIMAL + \ OUTPUT_FORMAT syn keyword cmakeKWmessage contained - \ AUTHOR_WARNING DEPRECATION FATAL_ERROR GUI SEND_ERROR STATUS WARNING + \ APPEND + \ AUTHOR_WARNING + \ CHECK_ + \ CHECK_FAIL + \ CHECK_PASS + \ CHECK_START + \ CONFIGURE_LOG + \ DEBUG + \ DEFINED + \ DEPRECATION + \ FATAL_ERROR + \ GET_MESSAGE_LOG_LEVEL + \ GUI + \ INTERNAL + \ MY_CHECK_RESULT + \ NOTICE + \ POP_BACK + \ SEND_ERROR + \ STATUS + \ TRACE + \ VERBOSE + \ WARNING syn keyword cmakeKWoption contained - \ OFF ON + \ OFF syn keyword cmakeKWproject contained - \ CMAKE_PROJECT_ DESCRIPTION LANGUAGES NAME NONE PROJECT VERSION _BINARY_DIR _INCLUDE _SOURCE_DIR _VERSION _VERSION_MAJOR _VERSION_MINOR _VERSION_PATCH _VERSION_TWEAK + \ ASM + \ ASM_MARMASM + \ ASM_MASM + \ ASM_NASM + \ ATT + \ CMAKE_PROJECT_ + \ CUDA + \ DESCRIPTION + \ HIP + \ HOMEPAGE_URL + \ ISPC + \ LANGUAGES + \ NAME + \ NONE + \ OBJC + \ OBJCXX + \ PROJECT + \ VERSION + \ _BINARY_DIR + \ _DESCRIPTION + \ _HOMEPAGE_URL + \ _INCLUDE_BEFORE + \ _IS_TOP_LEVEL + \ _SOURCE_DIR + \ _VERSION + \ _VERSION_MAJOR + \ _VERSION_MINOR + \ _VERSION_PATCH + \ _VERSION_TWEAK + +syn keyword cmakeKWqt_wrap_cpp contained + \ AUTOMOC + +syn keyword cmakeKWqt_wrap_ui contained + \ AUTOUIC syn keyword cmakeKWremove contained - \ REMOVE_ITEM VALUE VAR + \ VALUE + \ VAR + +syn keyword cmakeKWreturn contained + \ DEFER + \ PARENT_SCOPE + \ PROPAGATE + \ SCOPE_FOR + \ VARIABLES + \ VERSION syn keyword cmakeKWseparate_arguments contained - \ MSDN NATIVE NATIVE_COMMAND UNIX_COMMAND WINDOWS WINDOWS_COMMAND _COMMAND + \ MSDN + \ NATIVE_COMMAND + \ PROGRAM + \ SEPARATE_ARGS + \ UNIX_COMMAND + \ WINDOWS_COMMAND syn keyword cmakeKWset contained - \ BOOL CACHE FILEPATH FORCE INTERNAL OFF ON PARENT_SCOPE STRING STRINGS + \ BOOL + \ FILEPATH + \ FORCE + \ INTERNAL + \ OFF + \ OLD + \ ON + \ PARENT_SCOPE + \ PROPAGATE + \ STRING + \ STRINGS + \ VAR syn keyword cmakeKWset_directory_properties contained + \ DIRECTORY \ PROPERTIES syn keyword cmakeKWset_property contained - \ APPEND APPEND_STRING CACHE DIRECTORY GLOBAL INSTALL PROPERTY SOURCE TARGET TEST WIX + \ APPEND + \ APPEND_STRING + \ DIRECTORY + \ GENERATED + \ GLOBAL + \ INHERITED + \ INSTALL + \ NAME + \ PROPERTY + \ SOURCE + \ TARGET + \ TARGET_DIRECTORY + \ TEST + \ WIX syn keyword cmakeKWset_source_files_properties contained + \ DIRECTORY + \ GENERATED \ PROPERTIES + \ SOURCE + \ TARGET_DIRECTORY syn keyword cmakeKWset_target_properties contained \ PROPERTIES syn keyword cmakeKWset_tests_properties contained + \ NAME \ PROPERTIES +syn keyword cmakeKWsite_name contained + \ HOSTNAME + syn keyword cmakeKWsource_group contained - \ FILES PREFIX REGULAR_EXPRESSION TREE + \ FILES + \ PREFIX + \ REGULAR_EXPRESSION + \ TREE syn keyword cmakeKWstring contained - \ ALPHABET APPEND ASCII CMAKE_MATCH_ COMPARE CONCAT CONFIGURE EQUAL ESCAPE_QUOTES FIND GENEX_STRIP GREATER GREATER_EQUAL GUID HASH LENGTH LESS LESS_EQUAL MAKE_C_IDENTIFIER MATCH MATCHALL MATCHES NAMESPACE NOTEQUAL ONLY PREPEND RANDOM RANDOM_SEED REGEX REPLACE REVERSE RFC SHA SOURCE_DATE_EPOCH STRIP SUBSTRING SZ TIMESTAMP TOLOWER TOUPPER TYPE US UTC UUID + \ ALPHABET + \ APPEND + \ ARRAY + \ ASCII + \ BOOLEAN + \ CMAKE_MATCH_ + \ COMPARE + \ CONCAT + \ CONFIGURE + \ EQUAL + \ ERROR_VARIABLE + \ ESCAPE_QUOTES + \ FIND + \ GENEX_STRIP + \ GET + \ GREATER + \ GREATER_EQUAL + \ GUID + \ HASH + \ HEX + \ ISO + \ JOIN + \ JSON + \ LENGTH + \ LESS + \ LESS_EQUAL + \ MAKE_C_IDENTIFIER + \ MATCH + \ MATCHALL + \ MATCHES + \ MEMBER + \ NAMESPACE + \ NOTEQUAL + \ NULL + \ NUMBER + \ OBJECT + \ OFF + \ ONLY + \ PREPEND + \ RANDOM + \ RANDOM_SEED + \ REGEX + \ REMOVE + \ REPEAT + \ REPLACE + \ REVERSE + \ RFC + \ SET + \ SHA + \ SOURCE_DATE_EPOCH + \ STRIP + \ SUBSTRING + \ SZ + \ TIMESTAMP + \ TOLOWER + \ TOUPPER + \ TYPE + \ US + \ UTC + \ UUID syn keyword cmakeKWsubdirs contained - \ EXCLUDE_FROM_ALL PREORDER + \ EXCLUDE_FROM_ALL + \ PREORDER syn keyword cmakeKWtarget_compile_definitions contained - \ COMPILE_DEFINITIONS INTERFACE INTERFACE_COMPILE_DEFINITIONS PRIVATE PUBLIC + \ ALIAS + \ COMPILE_DEFINITIONS + \ FOO + \ IMPORTED + \ INTERFACE + \ INTERFACE_COMPILE_DEFINITIONS + \ PRIVATE + \ PUBLIC syn keyword cmakeKWtarget_compile_features contained - \ COMPILE_FEATURES IMPORTED INTERFACE INTERFACE_COMPILE_FEATURES PRIVATE PUBLIC + \ ALIAS + \ COMPILE_FEATURES + \ IMPORTED + \ INTERFACE + \ INTERFACE_COMPILE_FEATURES + \ PRIVATE + \ PUBLIC syn keyword cmakeKWtarget_compile_options contained - \ BEFORE COMPILE_OPTIONS IMPORTED INTERFACE INTERFACE_COMPILE_OPTIONS PRIVATE PUBLIC + \ ALIAS + \ BEFORE + \ CMAKE_ + \ COMPILE_LANGUAGE + \ COMPILE_OPTIONS + \ CONFIG + \ IMPORTED + \ INTERFACE + \ INTERFACE_COMPILE_OPTIONS + \ PRIVATE + \ PUBLIC + \ SHELL + \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ syn keyword cmakeKWtarget_include_directories contained - \ BEFORE BUILD_INTERFACE IMPORTED INCLUDE_DIRECTORIES INSTALL_INTERFACE INTERFACE INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES PRIVATE PUBLIC SYSTEM + \ AFTER + \ ALIAS + \ BEFORE + \ BUILD_INTERFACE + \ IMPORTED + \ INCLUDE_DIRECTORIES + \ INSTALL_INTERFACE + \ INTERFACE + \ INTERFACE_INCLUDE_DIRECTORIES + \ INTERFACE_LINK_LIBRARIES + \ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + \ PRIVATE + \ PUBLIC + \ SYSTEM + +syn keyword cmakeKWtarget_link_directories contained + \ ALIAS + \ BEFORE + \ IMPORTED + \ INTERFACE + \ INTERFACE_LINK_DIRECTORIES + \ LINK_DIRECTORIES + \ ORIGIN + \ PRIVATE + \ PUBLIC + \ RPATH syn keyword cmakeKWtarget_link_libraries contained - \ ALIAS DAG DEBUG_CONFIGURATIONS IMPORTED IMPORTED_NO_SONAME INTERFACE INTERFACE_LINK_LIBRARIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_MULTIPLICITY LINK_PRIVATE LINK_PUBLIC OLD OSX PRIVATE PUBLIC STATIC + \ ALIAS + \ DA + \ DAG + \ DEBUG_CONFIGURATIONS + \ DOBJ + \ IMPORTED + \ IMPORTED_NO_SONAME + \ INTERFACE + \ INTERFACE_LINK_LIBRARIES + \ LINK_FLAGS + \ LINK_INTERFACE_LIBRARIES + \ LINK_INTERFACE_LIBRARIES_DEBUG + \ LINK_INTERFACE_MULTIPLICITY + \ LINK_OPTIONS + \ LINK_PRIVATE + \ LINK_PUBLIC + \ OBJECT + \ OLD + \ PRIVATE + \ PUBLIC + \ SHARED + \ STATIC + \ TARGET_OBJECTS + +syn keyword cmakeKWtarget_link_options contained + \ ALIAS + \ BEFORE + \ CMAKE_ + \ CONFIG + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION + \ DEVICE_LINK + \ GCC + \ HOST_LINK + \ IMPORTED + \ INTERFACE + \ INTERFACE_LINK_OPTIONS + \ LANG + \ LINKER + \ LINK_OPTIONS + \ PRIVATE + \ PUBLIC + \ SHELL + \ STATIC_LIBRARY_OPTIONS + \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ + \ _LINKER_WRAPPER_FLAG + \ _LINKER_WRAPPER_FLAG_SEP + +syn keyword cmakeKWtarget_precompile_headers contained + \ ALIAS + \ ANGLE + \ BUILD_INTERFACE + \ COMPILE_LANGUAGE + \ DISABLE_PRECOMPILE_HEADERS + \ EXPORT + \ FI + \ GCC + \ IMPORTED + \ INTERFACE + \ INTERFACE_PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS_REUSE_FROM + \ PRIVATE + \ PUBLIC + \ REUSE_FROM + \ SKIP_PRECOMPILE_HEADERS syn keyword cmakeKWtarget_sources contained - \ IMPORTED INTERFACE INTERFACE_SOURCES PRIVATE PUBLIC SOURCES + \ ALIAS + \ BASE_DIRS + \ BUILD_INTERFACE + \ CONFIG + \ CORRECT + \ CXX_MODULES + \ CXX_MODULE_DIRS + \ CXX_MODULE_DIRS_ + \ CXX_MODULE_SETS + \ CXX_MODULE_SET_ + \ EXPORT + \ FILES + \ FILE_SET + \ FRAMEWORK + \ HEADERS + \ HEADER_DIRS + \ HEADER_DIRS_ + \ HEADER_FILE_ONLY + \ HEADER_SETS + \ HEADER_SET_ + \ IMPORTED + \ INCLUDE_DIRECTORIES + \ INTERFACE + \ INTERFACE_CXX_MODULE_SETS + \ INTERFACE_HEADER_SETS + \ INTERFACE_INCLUDE_DIRECTORIES + \ INTERFACE_SOURCES + \ NAME + \ PRIVATE + \ PUBLIC + \ SOURCES + \ SOURCE_DIR + \ TARGETS + \ TRUE + \ TYPE + \ WRONG syn keyword cmakeKWtry_compile contained - \ ALL_BUILD CMAKE_FLAGS COMPILE_DEFINITIONS COPY_FILE COPY_FILE_ERROR CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEFINED DLINK_LIBRARIES DVAR FALSE INCLUDE_DIRECTORIES LANG LINK_DIRECTORIES LINK_LIBRARIES NOT OUTPUT_VARIABLE RESULT_VAR SOURCES TRUE TYPE VALUE _EXTENSIONS _STANDARD _STANDARD_REQUIRED + \ ALL_BUILD + \ BINARY_DIR + \ CMAKE_FLAGS + \ COMPILE_DEFINITIONS + \ COPY_FILE + \ COPY_FILE_ERROR + \ CUDA_EXTENSIONS + \ CUDA_STANDARD + \ CUDA_STANDARD_REQUIRED + \ CXX_EXTENSIONS + \ CXX_STANDARD + \ CXX_STANDARD_REQUIRED + \ C_EXTENSIONS + \ C_STANDARD + \ C_STANDARD_REQUIRED + \ DEFINED + \ DLINK_LIBRARIES + \ DVAR + \ EXECUTABLE + \ FALSE + \ GHS + \ HIP_EXTENSIONS + \ HIP_STANDARD + \ HIP_STANDARD_REQUIRED + \ INCLUDE_DIRECTORIES + \ LANG + \ LINK_DIRECTORIES + \ LINK_LIBRARIES + \ LINK_OPTIONS + \ LOG_DESCRIPTION + \ MULTI + \ NOT + \ NO_CACHE + \ NO_LOG + \ OBJCXX_EXTENSIONS + \ OBJCXX_STANDARD + \ OBJCXX_STANDARD_REQUIRED + \ OBJC_EXTENSIONS + \ OBJC_STANDARD + \ OBJC_STANDARD_REQUIRED + \ OUTPUT_VARIABLE + \ PRIVATE + \ PROJECT + \ RESULTVAR + \ SOURCES + \ SOURCE_DIR + \ SOURCE_FROM_CONTENT + \ SOURCE_FROM_FILE + \ SOURCE_FROM_VAR + \ STATIC_LIBRARY + \ STATIC_LIBRARY_OPTIONS + \ TARGET + \ TRUE + \ TYPE + \ VALUE + \ _EXTENSIONS + \ _STANDARD + \ _STANDARD_REQUIRED syn keyword cmakeKWtry_run contained - \ ARGS CMAKE_FLAGS COMPILE_DEFINITIONS COMPILE_OUTPUT_VARIABLE COMPILE_RESULT_VAR DLINK_LIBRARIES DVAR FAILED_TO_RUN FALSE INCLUDE_DIRECTORIES LINK_DIRECTORIES LINK_LIBRARIES RUN_OUTPUT_VARIABLE RUN_RESULT_VAR TRUE TYPE VALUE __TRYRUN_OUTPUT + \ ARGS + \ CMAKE_FLAGS + \ COMPILE_DEFINITIONS + \ COMPILE_OUTPUT_VARIABLE + \ COPY_FILE + \ COPY_FILE_ERROR + \ FAILED_TO_RUN + \ FALSE + \ LANG + \ LINK_LIBRARIES + \ LINK_OPTIONS + \ LOG_DESCRIPTION + \ NO_CACHE + \ NO_LOG + \ RUN_OUTPUT_STDERR_VARIABLE + \ RUN_OUTPUT_STDOUT_VARIABLE + \ RUN_OUTPUT_VARIABLE + \ SOURCES + \ SOURCE_FROM_CONTENT + \ SOURCE_FROM_FILE + \ SOURCE_FROM_VAR + \ TRUE + \ WORKING_DIRECTORY + \ _EXTENSIONS + \ _STANDARD + \ _STANDARD_REQUIRED + \ __TRYRUN_OUTPUT syn keyword cmakeKWunset contained - \ CACHE LD_LIBRARY_PATH PARENT_SCOPE + \ PARENT_SCOPE + \ VAR syn keyword cmakeKWuse_mangled_mesa contained - \ GL OUTPUT_DIRECTORY PATH_TO_MESA + \ GL + \ OUTPUT_DIRECTORY + \ PATH_TO_MESA syn keyword cmakeKWvariable_requires contained - \ RESULT_VARIABLE TEST_VARIABLE + \ RESULT_VARIABLE + \ TEST_VARIABLE syn keyword cmakeKWvariable_watch contained + \ APPEND \ COMMAND - -syn keyword cmakeKWwhile contained - \ ARGS + \ DEFINED + \ MODIFIED_ACCESS + \ READ_ACCESS + \ REMOVED_ACCESS + \ UNKNOWN_MODIFIED_ACCESS + \ UNKNOWN_READ_ACCESS syn keyword cmakeKWwrite_file contained - \ APPEND CONFIGURE_FILE NOTE WRITE + \ APPEND + \ CONFIGURE_FILE + \ NOTE + \ WRITE syn keyword cmakeGeneratorExpressions contained - \ LINK_LIBRARIES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS CONFIG DEBUG_MODE BOOL AND NOT IF STREQUAL MAP_IMPORTED_CONFIG_ PLATFORM_ID C_COMPILER_ID CXX_COMPILER_ID VERSION_LESS VERSION_GREATER VERSION_EQUAL VERSION_LESS_EQUAL VERSION_GREATER_EQUAL C_COMPILER_VERSION CXX_COMPILER_VERSION TARGET_POLICY COMPILE_FEATURES C_STANDARD CXX_STANDARD COMPILE_LANGUAGE PRIVATE PUBLIC COMPILING_CXX GNU OLD_COMPILER CMAKE_CXX_COMPILER_VERSION CONFIGURATION TARGET_FILE TARGET_FILE_NAME TARGET_FILE_DIR TARGET_LINKER_FILE TARGET_LINKER_FILE_NAME TARGET_LINKER_FILE_DIR TARGET_SONAME_FILE TARGET_SONAME_FILE_NAME TARGET_SONAME_FILE_DIR TARGET_PDB_FILE PDB_NAME PDB_OUTPUT_DIRECTORY PDB_NAME_ PDB_OUTPUT_DIRECTORY_ TARGET_PDB_FILE_NAME TARGET_PDB_FILE_DIR TARGET_BUNDLE_DIR TARGET_BUNDLE_CONTENT_DIR SDK TARGET_PROPERTY INSTALL_PREFIX EXPORT JOIN ANGLE COMMA SEMICOLON TARGET_NAME LINK_ONLY INTERFACE_LINK_LIBRARIES INSTALL_INTERFACE BUILD_INTERFACE LOWER_CASE UPPER_CASE MAKE_C_IDENTIFIER TARGET_OBJECTS OBJECT_LIBRARY SHELL_PATH MSYS + \ ABSOLUTE_PATH + \ ACTION + \ AIX + \ ANGLE + \ APPEND + \ ARCHIVE_OUTPUT_NAME + \ ARCHIVE_OUTPUT_NAME_ + \ ASCENDING + \ BAR + \ BOOL + \ BUILD_INTERFACE + \ BUILD_LOCAL_INTERFACE + \ CMAKE_LINK_GROUP_USING_ + \ CMAKE_LINK_LIBRARY_USING_ + \ CMAKE_PATH + \ CODE + \ COMMAND_CONFIG + \ COMMAND_EXPAND_LISTS + \ COMPARE + \ COMPILE_DEFINITIONS + \ COMPILE_FEATURES + \ COMPILE_LANGUAGE + \ COMPILE_LANG_AND_ID + \ COMPILE_ONLY + \ COMPILING_CUDA + \ COMPILING_CXX + \ COMPILING_CXX_WITH_CLANG + \ COMPILING_CXX_WITH_INTEL + \ COMPILING_C_WITH_CLANG + \ CONFIG + \ CONFIGURATION + \ CONTENT + \ CUDA_COMPILER_ID + \ CUDA_COMPILER_VERSION + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION + \ CUSTOM_KEYS + \ CXX_COMPILER_ID + \ CXX_COMPILER_VERSION + \ CXX_CONFIG + \ CXX_STANDARD + \ C_COMPILER_ID + \ C_COMPILER_VERSION + \ C_STANDARD + \ DEBUG_MODE + \ DEBUG_POSTFIX + \ DENABLE_SOME_FEATURE + \ DESCENDING + \ DEVICE_LINK + \ DLL + \ ENABLE_EXPORTS + \ EXCLUDE + \ EXPORT + \ EXTENSION_DEF + \ FALSE + \ FILENAME_DEF + \ FILE_BASENAME + \ FILTER + \ FIND + \ FOO_EXTRA_THINGS + \ GENERATE + \ GENEX_EVAL + \ GET_EXTENSION + \ GET_FILENAME + \ GET_PARENT_PATH + \ GET_RELATIVE_PART + \ GET_ROOT_DIRECTORY + \ GET_ROOT_NAME + \ GET_ROOT_PATH + \ GET_STEM + \ HAS_ + \ HAS_EXTENSION + \ HAS_FILENAME + \ HAS_PARENT_PATH + \ HAS_RELATIVE_PART + \ HAS_ROOT_DIRECTORY + \ HAS_ROOT_NAME + \ HAS_ROOT_PATH + \ HAS_STEM + \ HAVE_SOME_FEATURE + \ HIP_COMPILER_ID + \ HIP_COMPILER_VERSION + \ HIP_STANDARD + \ HOST_LINK + \ IF + \ IGNORE + \ IMPORTED_LOCATION + \ IMPORT_PREFIX + \ IMPORT_SUFFIX + \ INCLUDE_DIRECTORIES + \ INSENSITIVE + \ INSERT + \ INSTALL_INTERFACE + \ INSTALL_NAME_DIR + \ INSTALL_PREFIX + \ INSTALL_RPATH + \ INTERFACE_LINK_LIBRARIES + \ INTERFACE_LINK_LIBRARIES_DIRECT + \ IN_LIST + \ ISPC_COMPILER_ID + \ ISPC_COMPILER_VERSION + \ IS_ABSOLUTE + \ IS_PREFIX + \ IS_RELATIVE + \ JOIN + \ LANG + \ LANG_COMPILER_ID + \ LAST_ONLY + \ LENGTH + \ LIBRARY_OUTPUT_NAME + \ LIBRARY_OUTPUT_NAME_ + \ LINK_GROUP + \ LINK_GROUP_PREDEFINED_FEATURES + \ LINK_LANGUAGE + \ LINK_LANG_AND_ID + \ LINK_LIBRARIES + \ LINK_LIBRARY + \ LINK_LIBRARY_OVERRIDE + \ LINK_LIBRARY_OVERRIDE_ + \ LINK_LIBRARY_PREDEFINED_FEATURES + \ LINK_ONLY + \ LOWER_CASE + \ MAKE_C_IDENTIFIER + \ MAP_IMPORTED_CONFIG_ + \ MODULE + \ NATURAL + \ NO + \ NORMALIZE + \ NORMAL_PATH + \ NOT + \ OBJCXX_COMPILER_ID + \ OBJCXX_COMPILER_VERSION + \ OBJC_COMPILER_ID + \ OBJC_COMPILER_VERSION + \ OBJECT + \ OFF + \ OLD_COMPILER + \ ORDER + \ OUTPUT + \ OUTPUT_CONFIG + \ OUTPUT_NAME + \ OUTPUT_NAME_ + \ PATH + \ PATH_EQUAL + \ PDB_NAME + \ PDB_NAME_ + \ PDB_OUTPUT_DIRECTORY + \ PDB_OUTPUT_DIRECTORY_ + \ PLATFORM_ID + \ POP_BACK + \ POP_FRONT + \ POSIX + \ POST_BUILD + \ PREPEND + \ PRIVATE + \ PUBLIC + \ REGEX + \ RELATIVE_PATH + \ REMOVE_AT + \ REMOVE_DUPLICATES + \ REMOVE_EXTENSION + \ REMOVE_FILENAME + \ REMOVE_ITEM + \ REPLACE + \ REPLACE_EXTENSION + \ REPLACE_FILENAME + \ REQUIRED + \ RESCAN + \ REVERSE + \ RPATH + \ RUNTIME_DEPENDENCY_SET + \ RUNTIME_OUTPUT_NAME + \ RUNTIME_OUTPUT_NAME_ + \ SCRIPT + \ SDK + \ SELECTOR + \ SEMICOLON + \ SENSITIVE + \ SHARED + \ SHELL_PATH + \ SORT + \ STATIC + \ STREQUAL + \ STRING + \ STRIP + \ SUBLIST + \ TARGET_BUNDLE_CONTENT_DIR + \ TARGET_BUNDLE_DIR + \ TARGET_BUNDLE_DIR_NAME + \ TARGET_EXISTS + \ TARGET_FILE + \ TARGET_FILE_BASE_NAME + \ TARGET_FILE_DIR + \ TARGET_FILE_NAME + \ TARGET_FILE_PREFIX + \ TARGET_FILE_SUFFIX + \ TARGET_GENEX_EVAL + \ TARGET_IMPORT_FILE + \ TARGET_IMPORT_FILE_BASE_NAME + \ TARGET_IMPORT_FILE_DIR + \ TARGET_IMPORT_FILE_NAME + \ TARGET_IMPORT_FILE_PREFIX + \ TARGET_IMPORT_FILE_SUFFIX + \ TARGET_LINKER_FILE + \ TARGET_LINKER_FILE_BASE_NAME + \ TARGET_LINKER_FILE_DIR + \ TARGET_LINKER_FILE_NAME + \ TARGET_LINKER_FILE_PREFIX + \ TARGET_LINKER_FILE_SUFFIX + \ TARGET_LINKER_IMPORT_FILE + \ TARGET_LINKER_IMPORT_FILE_BASE_NAME + \ TARGET_LINKER_IMPORT_FILE_DIR + \ TARGET_LINKER_IMPORT_FILE_NAME + \ TARGET_LINKER_IMPORT_FILE_PREFIX + \ TARGET_LINKER_IMPORT_FILE_SUFFIX + \ TARGET_LINKER_LIBRARY_FILE + \ TARGET_LINKER_LIBRARY_FILE_BASE_NAME + \ TARGET_LINKER_LIBRARY_FILE_DIR + \ TARGET_LINKER_LIBRARY_FILE_NAME + \ TARGET_LINKER_LIBRARY_FILE_PREFIX + \ TARGET_LINKER_LIBRARY_FILE_SUFFIX + \ TARGET_NAME_IF_EXISTS + \ TARGET_OBJECTS + \ TARGET_PDB_FILE + \ TARGET_PDB_FILE_BASE_NAME + \ TARGET_PDB_FILE_DIR + \ TARGET_PDB_FILE_NAME + \ TARGET_POLICY + \ TARGET_PROPERTY + \ TARGET_RUNTIME_DLLS + \ TARGET_RUNTIME_DLL_DIRS + \ TARGET_SONAME_FILE + \ TARGET_SONAME_FILE_DIR + \ TARGET_SONAME_FILE_NAME + \ TARGET_SONAME_IMPORT_FILE + \ TARGET_SONAME_IMPORT_FILE_DIR + \ TARGET_SONAME_IMPORT_FILE_NAME + \ TOLOWER + \ TOUPPER + \ TRANSFORM + \ TRANSFORM_APPEND + \ TRANSFORM_REPLACE + \ TRANSFORM_STRIP + \ TRANSFORM_TOLOWER + \ UNKNOWN + \ UPPER_CASE + \ VERBATIM + \ VERSION_EQUAL + \ VERSION_GREATER_EQUAL + \ VERSION_LESS + \ VERSION_LESS_EQUAL + \ WHOLE_ARCHIVE + \ WRONG + \ _LINK_GROUP_USING_ + \ _LINK_LIBRARY_USING_ + \ _POSTFIX + \ _SUPPORTED syn case ignore syn keyword cmakeCommand - \ add_compile_options add_compile_definitions add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_host_system_information cmake_minimum_required cmake_parse_arguments cmake_policy configure_file continue create_test_sourcelist ctest_build ctest_configure ctest_coverage ctest_empty_binary_directory ctest_memcheck ctest_read_custom_files ctest_run_script ctest_sleep ctest_start ctest_submit ctest_test ctest_update ctest_upload define_property enable_language enable_testing endfunction endmacro execute_process export file find_file find_library find_package find_path find_program fltk_wrap_ui function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property include include_directories include_external_msproject include_guard include_regular_expression install link_directories list load_cache load_command macro mark_as_advanced math message option project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_compile_definitions target_compile_features target_compile_options target_include_directories target_link_libraries target_sources try_compile try_run unset variable_watch + \ add_compile_definitions + \ add_compile_options + \ add_custom_command + \ add_custom_target + \ add_definitions + \ add_dependencies + \ add_executable + \ add_library + \ add_link_options + \ add_subdirectory + \ add_test + \ aux_source_directory + \ block + \ break + \ build_command + \ cmake_file_api + \ cmake_host_system_information + \ cmake_language + \ cmake_minimum_required + \ cmake_parse_arguments + \ cmake_path + \ cmake_policy + \ configure_file + \ continue + \ create_test_sourcelist + \ ctest_build + \ ctest_configure + \ ctest_coverage + \ ctest_empty_binary_directory + \ ctest_memcheck + \ ctest_read_custom_files + \ ctest_run_script + \ ctest_sleep + \ ctest_start + \ ctest_submit + \ ctest_test + \ ctest_update + \ ctest_upload + \ define_property + \ enable_language + \ enable_testing + \ endblock + \ endfunction + \ endmacro + \ execute_process + \ export + \ file + \ find_file + \ find_library + \ find_package + \ find_path + \ find_program + \ fltk_wrap_ui + \ function + \ get_cmake_property + \ get_directory_property + \ get_filename_component + \ get_property + \ get_source_file_property + \ get_target_property + \ get_test_property + \ include + \ include_directories + \ include_external_msproject + \ include_guard + \ include_regular_expression + \ install + \ link_directories + \ list + \ load_cache + \ load_command + \ macro + \ mark_as_advanced + \ math + \ message + \ option + \ project + \ qt_wrap_cpp + \ qt_wrap_ui + \ remove_definitions + \ return + \ separate_arguments + \ set + \ set_directory_properties + \ set_property + \ set_source_files_properties + \ set_target_properties + \ set_tests_properties + \ site_name + \ source_group + \ string + \ target_compile_definitions + \ target_compile_features + \ target_compile_options + \ target_include_directories + \ target_link_directories + \ target_link_libraries + \ target_link_options + \ target_precompile_headers + \ target_sources + \ try_compile + \ try_run + \ unset + \ variable_watch \ nextgroup=cmakeArguments syn keyword cmakeCommandConditional - \ else elseif endif if + \ else + \ elseif + \ endif + \ if \ nextgroup=cmakeArguments syn keyword cmakeCommandRepeat - \ endforeach endwhile foreach while + \ endforeach + \ endwhile + \ foreach + \ while \ nextgroup=cmakeArguments syn keyword cmakeCommandDeprecated - \ build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file + \ build_name + \ exec_program + \ export_library_dependencies + \ install_files + \ install_programs + \ install_targets + \ link_libraries + \ make_directory + \ output_required_files + \ remove + \ subdir_depends + \ subdirs + \ use_mangled_mesa + \ utility_source + \ variable_requires + \ write_file \ nextgroup=cmakeArguments syn case match @@ -356,6 +4820,8 @@ syn keyword cmakeTodo \ TODO FIXME XXX \ contained +hi def link cmakeBracketArgument String +hi def link cmakeBracketComment Comment hi def link cmakeCommand Function hi def link cmakeCommandConditional Conditional hi def link cmakeCommandDeprecated WarningMsg @@ -365,7 +4831,6 @@ hi def link cmakeEnvironment Special hi def link cmakeEscaped Special hi def link cmakeGeneratorExpression WarningMsg hi def link cmakeGeneratorExpressions Constant -hi def link cmakeLuaComment Comment hi def link cmakeModule Include hi def link cmakeProperty Constant hi def link cmakeRegistry Underlined @@ -375,6 +4840,8 @@ hi def link cmakeVariableValue Type hi def link cmakeVariable Identifier hi def link cmakeKWExternalProject ModeMsg +hi def link cmakeKWFetchContent ModeMsg +hi def link cmakeKWadd_compile_definitions ModeMsg hi def link cmakeKWadd_compile_options ModeMsg hi def link cmakeKWadd_custom_command ModeMsg hi def link cmakeKWadd_custom_target ModeMsg @@ -382,13 +4849,17 @@ hi def link cmakeKWadd_definitions ModeMsg hi def link cmakeKWadd_dependencies ModeMsg hi def link cmakeKWadd_executable ModeMsg hi def link cmakeKWadd_library ModeMsg +hi def link cmakeKWadd_link_options ModeMsg hi def link cmakeKWadd_subdirectory ModeMsg hi def link cmakeKWadd_test ModeMsg +hi def link cmakeKWblock ModeMsg hi def link cmakeKWbuild_command ModeMsg -hi def link cmakeKWbuild_name ModeMsg +hi def link cmakeKWcmake_file_api ModeMsg hi def link cmakeKWcmake_host_system_information ModeMsg +hi def link cmakeKWcmake_language ModeMsg hi def link cmakeKWcmake_minimum_required ModeMsg hi def link cmakeKWcmake_parse_arguments ModeMsg +hi def link cmakeKWcmake_path ModeMsg hi def link cmakeKWcmake_policy ModeMsg hi def link cmakeKWconfigure_file ModeMsg hi def link cmakeKWcreate_test_sourcelist ModeMsg @@ -403,7 +4874,9 @@ hi def link cmakeKWctest_test ModeMsg hi def link cmakeKWctest_update ModeMsg hi def link cmakeKWctest_upload ModeMsg hi def link cmakeKWdefine_property ModeMsg +hi def link cmakeKWdoxygen_add_docs ModeMsg hi def link cmakeKWenable_language ModeMsg +hi def link cmakeKWenable_testing ModeMsg hi def link cmakeKWexec_program ModeMsg hi def link cmakeKWexecute_process ModeMsg hi def link cmakeKWexport ModeMsg @@ -433,17 +4906,20 @@ hi def link cmakeKWinstall ModeMsg hi def link cmakeKWinstall_files ModeMsg hi def link cmakeKWinstall_programs ModeMsg hi def link cmakeKWinstall_targets ModeMsg +hi def link cmakeKWlink_directories ModeMsg hi def link cmakeKWlist ModeMsg hi def link cmakeKWload_cache ModeMsg hi def link cmakeKWload_command ModeMsg hi def link cmakeKWmacro ModeMsg -hi def link cmakeKWmake_directory ModeMsg hi def link cmakeKWmark_as_advanced ModeMsg hi def link cmakeKWmath ModeMsg hi def link cmakeKWmessage ModeMsg hi def link cmakeKWoption ModeMsg hi def link cmakeKWproject ModeMsg +hi def link cmakeKWqt_wrap_cpp ModeMsg +hi def link cmakeKWqt_wrap_ui ModeMsg hi def link cmakeKWremove ModeMsg +hi def link cmakeKWreturn ModeMsg hi def link cmakeKWseparate_arguments ModeMsg hi def link cmakeKWset ModeMsg hi def link cmakeKWset_directory_properties ModeMsg @@ -451,6 +4927,7 @@ hi def link cmakeKWset_property ModeMsg hi def link cmakeKWset_source_files_properties ModeMsg hi def link cmakeKWset_target_properties ModeMsg hi def link cmakeKWset_tests_properties ModeMsg +hi def link cmakeKWsite_name ModeMsg hi def link cmakeKWsource_group ModeMsg hi def link cmakeKWstring ModeMsg hi def link cmakeKWsubdirs ModeMsg @@ -458,7 +4935,10 @@ hi def link cmakeKWtarget_compile_definitions ModeMsg hi def link cmakeKWtarget_compile_features ModeMsg hi def link cmakeKWtarget_compile_options ModeMsg hi def link cmakeKWtarget_include_directories ModeMsg +hi def link cmakeKWtarget_link_directories ModeMsg hi def link cmakeKWtarget_link_libraries ModeMsg +hi def link cmakeKWtarget_link_options ModeMsg +hi def link cmakeKWtarget_precompile_headers ModeMsg hi def link cmakeKWtarget_sources ModeMsg hi def link cmakeKWtry_compile ModeMsg hi def link cmakeKWtry_run ModeMsg @@ -466,9 +4946,32 @@ hi def link cmakeKWunset ModeMsg hi def link cmakeKWuse_mangled_mesa ModeMsg hi def link cmakeKWvariable_requires ModeMsg hi def link cmakeKWvariable_watch ModeMsg -hi def link cmakeKWwhile ModeMsg hi def link cmakeKWwrite_file ModeMsg +" Manually added - difficult to parse out of documentation +syn case ignore + +syn keyword cmakeCommandManuallyAdded + \ configure_package_config_file write_basic_package_version_file + \ nextgroup=cmakeArguments + +syn case match + +syn keyword cmakeKWconfigure_package_config_file contained + \ INSTALL_DESTINATION PATH_VARS NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO INSTALL_PREFIX + +syn keyword cmakeKWconfigure_package_config_file_constants contained + \ AnyNewerVersion SameMajorVersion SameMinorVersion ExactVersion + +syn keyword cmakeKWwrite_basic_package_version_file contained + \ VERSION COMPATIBILITY + +hi def link cmakeCommandManuallyAdded Function + +hi def link cmakeKWconfigure_package_config_file ModeMsg +hi def link cmakeKWwrite_basic_package_version_file ModeMsg +hi def link cmakeKWconfigure_package_config_file_constants Constant + let b:current_syntax = "cmake" let &cpo = s:keepcpo -- cgit From 0d26d192d82716a72f5216cafd675a68c6e93580 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 16 Dec 2023 05:28:57 +0800 Subject: vim-patch:9a775b4a2ae6 (#26588) runtime(netrw): escape curdir in BrowseUpDir (vim/vim#13681) fixes vim/vim#13678 https://github.com/vim/vim/commit/9a775b4a2ae658e61f9d6582de72ea7a1b241aaa Co-authored-by: Christian Brabandt --- runtime/autoload/netrw.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 501736542f..30964ae80d 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -5268,7 +5268,8 @@ fun! s:NetrwBrowseUpDir(islocal) endif call s:RestorePosn(s:netrw_posn) let curdir= substitute(curdir,'^.*[\/]','','') - call search('\<'.curdir.'/','wc') + let curdir= '\<'. escape(curdir, '~'). '/' + call search(curdir,'wc') endif " call Dret("s:NetrwBrowseUpDir") endfun -- cgit From f4f7e294695abe7837af62b68564114de7abd0b4 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:35:55 -0600 Subject: refactor(defaults): always set options, even if value hasn't changed (#26595) Comparing against the old value before setting matched the original C implementation, but there is no reason to use this restriction. In particular, this inhibits using OptionSet to determine when the option was set. If users need to handle a case where the option _changed_, it is easy to do so in an OptionSet autocommand using v:option_new and v:option_old (and friends). --- runtime/lua/vim/_defaults.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 041a8cd669..2627cbcd0d 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -189,9 +189,7 @@ if tty then -- Wait until Nvim is finished starting to set the option to ensure the -- OptionSet event fires. if vim.v.vim_did_enter == 1 then - if vim.o[option] ~= value then - vim.o[option] = value - end + vim.o[option] = value else vim.api.nvim_create_autocmd('VimEnter', { once = true, -- cgit From 7cae94e91e495c6ffbd32c8e9ba7d3c572610409 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 15 Dec 2023 22:43:05 +0100 Subject: vim-patch:e06f2b498ccc runtime(doc): fix typo in change.txt https://github.com/vim/vim/commit/e06f2b498ccca921f34a1bec4464f042a5a2cabd Co-authored-by: Christian Brabandt --- runtime/doc/change.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index fe796422c2..61e7c0c6e0 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -425,7 +425,7 @@ Note that when 'nrformats' includes "octal", decimal numbers with leading zeros cause mistakes, because they can be confused with octal numbers. Note similarly, when 'nrformats' includes "bin", binary numbers with a leading -'0x' or '0X' can be interpreted as hexadecimal rather than binary since '0b' +'0b' or '0B' can be interpreted as hexadecimal rather than binary since '0b' are valid hexadecimal digits. When the number under the cursor is too big to fit into 64 bits, it will be -- cgit From e38027ef69f75653ee953b16ebf4a8652a3fb748 Mon Sep 17 00:00:00 2001 From: mathew Date: Tue, 15 Aug 2023 18:47:14 +0800 Subject: feat(ui): completeopt support popup like vim --- runtime/doc/api.txt | 15 +++++++++++++++ runtime/doc/builtin.txt | 2 ++ runtime/doc/news.txt | 3 +++ runtime/doc/options.txt | 4 ++++ runtime/lua/vim/_meta/api.lua | 10 ++++++++++ runtime/lua/vim/_meta/api_keysets.lua | 3 +++ runtime/lua/vim/_meta/options.lua | 4 ++++ runtime/lua/vim/_meta/vimfn.lua | 2 ++ 8 files changed, 43 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 48bbdc33df..72ac357ac0 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -700,6 +700,21 @@ nvim_chan_send({chan}, {data}) *nvim_chan_send()* • {chan} id of the channel • {data} data to write. 8-bit clean: can contain NUL bytes. +nvim_complete_set({index}, {*opts}) *nvim_complete_set()* + Set info for the completion candidate index. if the info was shown in a + window, then the window and buffer ids are returned for further + customization. If the text was not shown, an empty dict is returned. + + Parameters: ~ + • {index} the completion candidate index + • {opts} Optional parameters. + • info: (string) info text. + + Return: ~ + Dictionary containing these keys: + • winid: (number) floating window id + • bufnr: (number) buffer id in floating window + nvim_create_buf({listed}, {scratch}) *nvim_create_buf()* Creates a new, empty, unnamed buffer. diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 714320279a..98201c0eed 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -802,6 +802,8 @@ complete_info([{what}]) *complete_info()* no item is selected when using the or keys) inserted Inserted string. [NOT IMPLEMENTED YET] + preview_winid Info floating preview window id. + preview_bufnr Info floating preview buffer id. *complete_info_mode* mode values are: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index ad2de7a40a..406ac879eb 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -252,6 +252,9 @@ The following new APIs and features were added. • |vim.text.hexencode()| and |vim.text.hexdecode()| convert strings to and from byte representations. +• 'completeopt' option supports "popup" flags to show extra information in + in floating window. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index fda60eaab2..970f687c99 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1516,6 +1516,10 @@ 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". + *'completeslash'* *'csl'* 'completeslash' 'csl' string (default "") local to buffer diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 231e1c3404..c8afbd58dd 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -773,6 +773,16 @@ function vim.api.nvim_command(command) end --- @return string function vim.api.nvim_command_output(command) end +--- Set info for the completion candidate index. if the info was shown in a +--- window, then the window and buffer ids are returned for further +--- customization. If the text was not shown, an empty dict is returned. +--- +--- @param index integer the completion candidate index +--- @param opts vim.api.keyset.complete_set Optional parameters. +--- • info: (string) info text. +--- @return table +function vim.api.nvim_complete_set(index, opts) end + --- Create or get an autocommand group `autocmd-groups`. --- To get an existing group id, do: --- diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index f64cdb8afd..4ec8b03d30 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -68,6 +68,9 @@ error('Cannot require a meta file') --- @class vim.api.keyset.cmd_opts --- @field output? boolean +--- @class vim.api.keyset.complete_set +--- @field info? string + --- @class vim.api.keyset.context --- @field types? any[] diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 5e65ca6b1b..c908d7ae54 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1061,6 +1061,10 @@ 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". +--- --- @type string vim.o.completeopt = "menu,preview" vim.o.cot = vim.o.completeopt diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index ead5d8d13b..59d9836688 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -1024,6 +1024,8 @@ function vim.fn.complete_check() end --- no item is selected when using the or --- keys) --- inserted Inserted string. [NOT IMPLEMENTED YET] +--- preview_winid Info floating preview window id. +--- preview_bufnr Info floating preview buffer id. --- --- *complete_info_mode* --- mode values are: -- cgit From 574519d9d68f7f28a868e95ef0d081cbae6ddec4 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Tue, 12 Dec 2023 18:07:45 +0200 Subject: feat(highlight): tweak default color scheme Problem: Updating default color scheme produced some feedback. Solution: Address the feedback. Outline of the changes: - Colors `Grey1` and `Grey2` are made a little bit more extreme (dark - darker, light - lighter) to increase overall contrast. - `gui` colors are treated as base with `cterm` colors falling back to using 0-15 colors which come from terminal emulator. - Update highlight group definition to not include attribute definition if it is intended to staty uncolored. - Tweak some specific highlight groups. - Add a list of Neovim specific highlight groups which are now defined differently in a breaking way. - Minor tweaks in several other places related to default color scheme. --- runtime/colors/default.vim | 7 +------ runtime/colors/vim.vim | 8 ++++---- runtime/doc/dev_theme.txt | 38 ++++++++++++++++++++++++++++---------- runtime/doc/news.txt | 15 ++++++++++++++- runtime/doc/syntax.txt | 12 ++++++++++++ runtime/doc/vim_diff.txt | 6 ++++-- 6 files changed, 63 insertions(+), 23 deletions(-) (limited to 'runtime') diff --git a/runtime/colors/default.vim b/runtime/colors/default.vim index fac120ccf5..8ee18a4ec4 100644 --- a/runtime/colors/default.vim +++ b/runtime/colors/default.vim @@ -2,12 +2,7 @@ " Maintainer: The Neovim Project " Last Change: 2023 Dec 01 -" This is the default color scheme. - -" Set 'background' back to the default. The value can't always be estimated -" and is then guessed. -hi clear Normal -set bg& +" This is the default color scheme. See `:help dev_theme`. " Remove all existing highlighting and set the defaults. hi clear diff --git a/runtime/colors/vim.vim b/runtime/colors/vim.vim index 3418abe424..0d02477ba7 100644 --- a/runtime/colors/vim.vim +++ b/runtime/colors/vim.vim @@ -14,8 +14,8 @@ let g:colors_name = 'vim' " General hi Conceal guifg=LightGrey guibg=DarkGrey guisp=NONE gui=NONE ctermfg=LightGrey ctermbg=DarkGrey cterm=NONE -hi Cursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE -hi lCursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE +hi Cursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi lCursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffText guifg=NONE guibg=Red guisp=NONE gui=bold ctermfg=NONE ctermbg=Red cterm=bold hi ErrorMsg guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=DarkRed cterm=NONE hi IncSearch guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse @@ -214,7 +214,7 @@ if &background ==# 'light' hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=LightMagenta cterm=NONE hi TabLine guifg=NONE guibg=LightGrey guisp=NONE gui=underline ctermfg=black ctermbg=LightGrey cterm=underline hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=DarkMagenta ctermbg=NONE cterm=NONE - hi Visual guifg=NONE guibg=LightGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual guifg=NONE guibg=LightGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightGrey cterm=NONE hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE hi Comment guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE term=bold hi Constant guifg=Magenta guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE term=underline @@ -253,7 +253,7 @@ else hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=Magenta cterm=NONE hi TabLine guifg=NONE guibg=DarkGrey guisp=NONE gui=underline ctermfg=white ctermbg=DarkGrey cterm=underline hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=LightMagenta ctermbg=NONE cterm=NONE - hi Visual guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkGrey cterm=NONE hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE hi Comment guifg=#80a0ff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=NONE term=bold hi Constant guifg=#ffa0a0 guibg=NONE guisp=NONE gui=NONE ctermfg=Magenta ctermbg=NONE cterm=NONE term=underline diff --git a/runtime/doc/dev_theme.txt b/runtime/doc/dev_theme.txt index 04ec3f293c..29a2da0d90 100644 --- a/runtime/doc/dev_theme.txt +++ b/runtime/doc/dev_theme.txt @@ -18,8 +18,8 @@ Design - Be "Neovim branded", i.e. have mostly "green-blue" feel plus one or two colors reserved for very occasional user attention. -- Be extra minimal for 'notermguicolors' (256 colors) while allowing a bit - more shades when 'termguicolors' is set (true colors). +- Be oriented for 'termguicolors' (true colors) while being extra minimal for + 'notermguicolors' (16 colors) as fallback. - Be accessible, i.e. have high enough contrast ratio (as defined in https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef). @@ -49,8 +49,7 @@ Palettes - Each palette has the following colors (descriptions are for dark background; reverse for light one): - - Four shades of "colored" greys for general UI. In 256 colors they are - exact greys; in true colors they are shades of "cold" grey. + - Four shades of colored "cold" greys for general UI. - Dark ones (from darkest to lightest) are reserved as background for |hl-NormalFloat| (considered as "black"), |hl-Normal| (background), @@ -67,8 +66,17 @@ Palettes (which is used for |hl-Normal|) as possible. They should have (reasonably) different hues to make them visually separable. -- Each palette color should have a 256 colors variant with closest color - computed based on the perceptually uniform distance measure. +- For 16 colors: + + - Greys are not used and are replaced with the foreground and background + colors of the terminal emulator. + + - Non-grey colors fall back to terminal colors as ordered in ANSI codes + (https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit), + that is red (1, 9), green (2, 10), yellow (3, 11), blue (4, 12), + magenta (5, 13), cyan (6, 14). + To increase contrast, colors 1-6 are used for light background and 9-14 + for dark background. ============================================================================== @@ -91,13 +99,23 @@ Use: - Red to generally mean high user attention, i.e. errors; in particular for |hl-ErrorMsg|, |hl-DiffDelete|, |hl-DiagnosticError|. -- Yellow very sparingly only with true colors to mean mild user attention, - i.e. warnings. That is, |hl-DiagnosticWarn| and |hl-WarningMsg|. +- Yellow very sparingly to mean mild user attention, i.e. warnings. That is, + |hl-DiagnosticWarn| and |hl-WarningMsg|. -- Blue very sparingly only with true colors as |hl-DiagnosticHint| and some - additional important syntax group (like `Identifier`). +- Blue very sparingly as |hl-DiagnosticHint| and some additional important + syntax group (like `Identifier`). - Magenta very carefully (if at all). +In case of 16 colors: + +- Rely on the assumption "Background color can be used as background; other + colors can be used as foreground". This means that in any + foreground/background combination there should be background and one + non-background color. + +- Use 0 (black) or 15 (bright white) as foreground for non-grey background, + depending on whether normal background is light or dark. + vim:tw=78:ts=8:et:ft=help:norl: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 406ac879eb..925c63f259 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -92,9 +92,22 @@ The following changes may require adaptations in user config or plugins. • Legacy and extmark signs are displayed and listed with the same priority: line number -> priority -> sign id -> recently placed -• Default color scheme has been updated to be "Neovim branded" and accessible. +• Default color scheme has been updated to be "Nvim branded" and accessible. Use `:colorscheme vim` to revert to the old legacy color scheme. + Here is a list of Nvim specific highlight groups which are now defined in + a meaningfully different way and might need an update: + • |hl-FloatBorder| is linked to |hl-NormalFloat| instead of |hl-WinSeparator|. + • |hl-NormalFloat| is not linked to |hl-Pmenu|. + • |hl-WinBar| is linked to |hl-StatusLine|. + • |hl-WinBarNC| is linked to |hl-StatusLineNC| instead of |hl-WinBar|. + • |hl-WinSeparator| is linked to |hl-Normal| instead of |hl-VertSplit|. + + This also might result into some color schemes looking differently due to + them relying on an implicit assumptions about how highlight groups are + defined by default. To account for this, define all attributes of highlight + groups explicitly or use `:colorscheme vim` to restore previous definitions. + • 'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1d02e49071..6b5f0393ea 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5136,6 +5136,18 @@ guisp={color-name} *guisp* Black White Orange Purple Violet + Colors which define Nvim's default color scheme: + NvimDarkBlue NvimLightBlue + NvimDarkCyan NvimLightCyan + NvimDarkGreen NvimLightGreen + NvimDarkGrey1 NvimLightGrey1 + NvimDarkGrey2 NvimLightGrey2 + NvimDarkGrey3 NvimLightGrey3 + NvimDarkGrey4 NvimLightGrey4 + NvimDarkMagenta NvimLightMagenta + NvimDarkRed NvimLightRed + NvimDarkYellow NvimLightYellow + You can also specify a color by its RGB (red, green, blue) values. The format is "#rrggbb", where "rr" is the Red value diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 220505f573..e0ad0ff0f9 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -30,8 +30,10 @@ Defaults *nvim-defaults* ":filetype off" to |init.vim|. - Syntax highlighting is enabled by default. This can be disabled by adding ":syntax off" to |init.vim|. -- Default color scheme has been updated. This can be reversed by adding - ":colorscheme vim" to |init.vim|. +- Default color scheme has been updated. This can result in color schemes + looking differently due to them relying on how highlight groups are defined + by default. Add ":colorscheme vim" to |init.vim| or your color scheme file to + restore the old default links and colors. - 'autoindent' is enabled - 'autoread' is enabled (works in all UIs, including terminal) -- cgit From 6b8084a6beb5633ddaf9d1a51b4a501e291958c8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 16 Dec 2023 14:24:37 +0100 Subject: vim-patch:0378f07fbaee runtime(colorschemes): Update colorschemes (vim/vim#13691) Minor changes: - Regenerated using colortemplate 2.2.3 - Removed reversed gui-cursor for some of the colorschemes (retrobox, wildcharm, lunaperche) - Change MatchParen for some of colorschemes. https://github.com/vim/vim/commit/0378f07fbaee9fd8773f3cf8cef146606dd7bf72 Co-authored-by: Maxim Kim --- runtime/colors/blue.vim | 6 ++--- runtime/colors/darkblue.vim | 6 ++--- runtime/colors/delek.vim | 6 ++--- runtime/colors/desert.vim | 6 ++--- runtime/colors/elflord.vim | 6 ++--- runtime/colors/evening.vim | 6 ++--- runtime/colors/habamax.vim | 6 ++--- runtime/colors/industry.vim | 6 ++--- runtime/colors/koehler.vim | 6 ++--- runtime/colors/lunaperche.vim | 63 ++++++++++++++++++++++++++++++++----------- runtime/colors/morning.vim | 6 ++--- runtime/colors/murphy.vim | 6 ++--- runtime/colors/pablo.vim | 6 ++--- runtime/colors/peachpuff.vim | 6 ++--- runtime/colors/quiet.vim | 6 ++--- runtime/colors/retrobox.vim | 38 +++++++++++++------------- runtime/colors/ron.vim | 6 ++--- runtime/colors/shine.vim | 6 ++--- runtime/colors/slate.vim | 6 ++--- runtime/colors/sorbet.vim | 6 ++--- runtime/colors/torte.vim | 6 ++--- runtime/colors/wildcharm.vim | 54 ++++++++++++++++++------------------- runtime/colors/zaibatsu.vim | 6 ++--- runtime/colors/zellner.vim | 6 ++--- 24 files changed, 156 insertions(+), 125 deletions(-) (limited to 'runtime') diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index aa99bacd3b..f0009d1000 100644 --- a/runtime/colors/blue.vim +++ b/runtime/colors/blue.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:41:44 MSK +" Last Updated: Fri 15 Dec 2023 20:05:33 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -587,4 +587,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index c7bba4471e..ec8d03ed22 100644 --- a/runtime/colors/darkblue.vim +++ b/runtime/colors/darkblue.vim @@ -4,9 +4,9 @@ " Maintainer: Original author Bohdan Vlasyuk " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:40:36 MSK +" Last Updated: Fri 15 Dec 2023 20:05:37 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -471,4 +471,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim index d9db90f2c5..e8152e3e39 100644 --- a/runtime/colors/delek.vim +++ b/runtime/colors/delek.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer David Schweikert " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun 04 Sep 2022 09:31:26 MSK +" Last Updated: Fri 15 Dec 2023 20:05:34 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=light @@ -412,4 +412,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim index 0b56740664..627394df3e 100644 --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Hans Fugal " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:39:21 MSK +" Last Updated: Fri 15 Dec 2023 20:05:34 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -401,4 +401,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim index 4a33e33eec..4808f1158f 100644 --- a/runtime/colors/elflord.vim +++ b/runtime/colors/elflord.vim @@ -3,9 +3,9 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:44:22 MSK +" Last Updated: Fri 15 Dec 2023 20:05:35 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -450,4 +450,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index 70ae55aa8d..fd689461f0 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun 04 Sep 2022 09:48:34 MSK +" Last Updated: Fri 15 Dec 2023 20:05:35 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -532,4 +532,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim index c84354ca03..fd372b9e73 100644 --- a/runtime/colors/habamax.vim +++ b/runtime/colors/habamax.vim @@ -4,9 +4,9 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 24 Mar 2023 20:28:06 AEDT +" Last Updated: Fri 15 Dec 2023 20:05:35 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -469,4 +469,4 @@ endif " Color: white #dadada 253 white " Term colors: color00 color01 color02 color03 color04 color05 color06 color07 " Term colors: color08 color09 color10 color11 color12 color13 color14 color15 -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim index f09786000d..28d410be65 100644 --- a/runtime/colors/industry.vim +++ b/runtime/colors/industry.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Shian Lee. " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun 04 Sep 2022 09:50:04 MSK +" Last Updated: Fri 15 Dec 2023 20:05:36 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -413,4 +413,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index 67719123a2..c1eb425d7e 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -3,9 +3,9 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:23:56 MSK +" Last Updated: Fri 15 Dec 2023 20:05:36 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -427,4 +427,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim index 44c75c40cb..e9a4e8ecf6 100644 --- a/runtime/colors/lunaperche.vim +++ b/runtime/colors/lunaperche.vim @@ -4,9 +4,9 @@ " Maintainer: Maxim Kim " Website: https://www.github.com/vim/colorschemes " License: Vim License (see `:help license`) -" Last Updated: Sun 26 Mar 2023 23:04:18 AEDT +" Last Updated: Fri 15 Dec 2023 20:05:37 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 hi clear let g:colors_name = 'lunaperche' @@ -16,8 +16,24 @@ let s:t_Co = &t_Co hi! link helpVim Title hi! link helpHeader Title hi! link helpHyperTextJump Underlined +hi! link fugitiveSymbolicRef PreProc +hi! link fugitiveHeading Statement +hi! link fugitiveStagedHeading Statement +hi! link fugitiveUnstagedHeading Statement +hi! link fugitiveUntrackedHeading Statement +hi! link fugitiveStagedModifier PreProc +hi! link fugitiveUnstagedModifier PreProc +hi! link fugitiveHash Constant hi! link diffFile PreProc hi! link markdownHeadingDelimiter Special +hi! link rstSectionDelimiter Statement +hi! link rstDirective PreProc +hi! link rstHyperlinkReference Special +hi! link rstFieldName Constant +hi! link rstDelimiter Special +hi! link rstInterpretedText Special +hi! link rstCodeBlock Normal +hi! link rstLiteralBlock rstCodeBlock hi! link markdownUrl String hi! link colortemplateKey Statement hi! link xmlTagName Statement @@ -122,10 +138,10 @@ if &background ==# 'dark' hi WildMenu guifg=#000000 guibg=#ffd787 gui=bold cterm=bold hi debugPC guifg=#5f87af guibg=NONE gui=reverse cterm=reverse hi debugBreakpoint guifg=#5fafaf guibg=NONE gui=reverse cterm=reverse - hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi lCursor guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse hi Visual guifg=#ffffff guibg=#005f87 gui=NONE cterm=NONE - hi MatchParen guifg=#c5e7c5 guibg=#000000 gui=reverse cterm=reverse + hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold hi VisualNOS guifg=#000000 guibg=#5fafaf gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#262626 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE @@ -216,10 +232,10 @@ else hi WildMenu guifg=#000000 guibg=#ffd787 gui=bold cterm=bold hi debugPC guifg=#005fd7 guibg=NONE gui=reverse cterm=reverse hi debugBreakpoint guifg=#005f5f guibg=NONE gui=reverse cterm=reverse - hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE hi lCursor guifg=#ff00ff guibg=#000000 gui=reverse cterm=reverse hi Visual guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE - hi MatchParen guifg=NONE guibg=#c5e7c5 gui=NONE cterm=NONE + hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold hi VisualNOS guifg=#ffffff guibg=#008787 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE @@ -270,8 +286,24 @@ if s:t_Co >= 256 hi! link helpVim Title hi! link helpHeader Title hi! link helpHyperTextJump Underlined + hi! link fugitiveSymbolicRef PreProc + hi! link fugitiveHeading Statement + hi! link fugitiveStagedHeading Statement + hi! link fugitiveUnstagedHeading Statement + hi! link fugitiveUntrackedHeading Statement + hi! link fugitiveStagedModifier PreProc + hi! link fugitiveUnstagedModifier PreProc + hi! link fugitiveHash Constant hi! link diffFile PreProc hi! link markdownHeadingDelimiter Special + hi! link rstSectionDelimiter Statement + hi! link rstDirective PreProc + hi! link rstHyperlinkReference Special + hi! link rstFieldName Constant + hi! link rstDelimiter Special + hi! link rstInterpretedText Special + hi! link rstCodeBlock Normal + hi! link rstLiteralBlock rstCodeBlock hi! link markdownUrl String hi! link colortemplateKey Statement hi! link xmlTagName Statement @@ -370,7 +402,7 @@ if s:t_Co >= 256 hi debugPC ctermfg=67 ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=73 ctermbg=NONE cterm=reverse hi Visual ctermfg=231 ctermbg=24 cterm=NONE - hi MatchParen ctermfg=30 ctermbg=16 cterm=reverse + hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold hi VisualNOS ctermfg=16 ctermbg=73 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE @@ -455,7 +487,7 @@ if s:t_Co >= 256 hi debugPC ctermfg=26 ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=23 ctermbg=NONE cterm=reverse hi Visual ctermfg=231 ctermbg=67 cterm=NONE - hi MatchParen ctermfg=30 ctermbg=231 cterm=reverse + hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold hi VisualNOS ctermfg=231 ctermbg=30 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=255 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE @@ -545,8 +577,7 @@ if s:t_Co >= 16 hi WildMenu ctermfg=black ctermbg=yellow cterm=bold hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=white ctermbg=darkblue cterm=NONE - hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE @@ -631,7 +662,7 @@ if s:t_Co >= 16 hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse hi Visual ctermfg=white ctermbg=darkblue cterm=NONE - hi MatchParen ctermfg=darkcyan ctermbg=white cterm=reverse + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline hi VisualNOS ctermfg=black ctermbg=cyan cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE @@ -722,7 +753,7 @@ if s:t_Co >= 8 hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse - hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse + hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE @@ -789,7 +820,7 @@ if s:t_Co >= 8 hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse - hi MatchParen ctermfg=darkcyan ctermbg=grey cterm=reverse + hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE @@ -914,7 +945,7 @@ endif " Color: colorC #FFFFFF 231 white " Color: colorlC #FF5FFF 207 magenta " Color: colorV #005F87 24 darkblue -" Color: colorMP #C5E7C5 30 darkcyan +" Color: colorMP #ff00af 199 magenta " Color: colorPMenuSel #4e4e4e 239 darkcyan " Color: colorDim #878787 102 grey " Color: diffAdd #875f87 96 darkmagenta @@ -949,7 +980,7 @@ endif " Color: colorC #000000 16 black " Color: colorlC #FF00FF 201 magenta " Color: colorV #5F87AF 67 darkblue -" Color: colorMP #C5E7C5 30 darkcyan +" Color: colorMP #ff00af 199 magenta " Color: colorPMenuSel #C6C6C6 251 darkcyan " Color: colorDim #626262 241 darkgrey " Color: diffAdd #D7AFD7 182 darkmagenta @@ -960,4 +991,4 @@ endif " Term colors: color00 color01 color02 color03 color04 color05 color06 color07 " Term colors: color08 color09 color10 color11 color12 color13 color14 color15 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index 5c6a617137..def4f9ef65 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Bram Moolenaar " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:46:24 MSK +" Last Updated: Fri 15 Dec 2023 20:05:37 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=light @@ -404,4 +404,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index 47d7dbe22e..434fafc058 100644 --- a/runtime/colors/murphy.vim +++ b/runtime/colors/murphy.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Ron Aaron . " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:47:20 MSK +" Last Updated: Fri 15 Dec 2023 20:05:38 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -398,4 +398,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim index 8766cc4776..b4335eedec 100644 --- a/runtime/colors/pablo.vim +++ b/runtime/colors/pablo.vim @@ -3,9 +3,9 @@ " Maintainer: Original maintainerRon Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Wed 14 Sep 2022 19:05:27 MSK +" Last Updated: Fri 15 Dec 2023 20:05:38 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -431,4 +431,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim index 0bab72dace..3ae756f682 100644 --- a/runtime/colors/peachpuff.vim +++ b/runtime/colors/peachpuff.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer David Ne\v{c}as (Yeti) " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:50:02 MSK +" Last Updated: Fri 15 Dec 2023 20:05:39 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=light @@ -409,4 +409,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim index 9ab313b837..52d49ba258 100644 --- a/runtime/colors/quiet.vim +++ b/runtime/colors/quiet.vim @@ -4,9 +4,9 @@ " Maintainer: Maxence Weynans " Website: https://github.com/vim/colorschemes " License: Vim License (see `:help license`)` -" Last Updated: Wed 15 Mar 2023 06:45:06 PM CET +" Last Updated: Fri 15 Dec 2023 20:05:39 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 hi clear let g:colors_name = 'quiet' @@ -750,4 +750,4 @@ endif " Term colors: light0 light1 light2 light3 light4 light5 light6 light7 " Term colors: light8 light9 light10 light11 light12 light13 light14 light15 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim index c0c4f9f6c2..f9d8d329e4 100644 --- a/runtime/colors/retrobox.vim +++ b/runtime/colors/retrobox.vim @@ -4,9 +4,9 @@ " Maintainer: Maxim Kim , ported from gruvbox8 of Lifepillar " Website: https://www.github.com/vim/colorschemes " License: Vim License (see `:help license`) -" Last Updated: Sun 12 Mar 2023 15:14:04 AEDT +" Last Updated: Fri 15 Dec 2023 20:05:40 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 hi clear let g:colors_name = 'retrobox' @@ -65,7 +65,7 @@ if &background ==# 'dark' hi WildMenu guifg=#83a598 guibg=#504945 gui=bold cterm=bold hi EndOfBuffer guifg=#504945 guibg=NONE gui=NONE cterm=NONE hi Conceal guifg=#83a598 guibg=NONE gui=NONE cterm=NONE - hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor guifg=#1c1c1c guibg=#fbf1c7 gui=NONE cterm=NONE hi DiffAdd guifg=#b8bb26 guibg=#1c1c1c gui=reverse cterm=reverse hi DiffChange guifg=#8ec07c guibg=#1c1c1c gui=reverse cterm=reverse hi DiffDelete guifg=#fb4934 guibg=#1c1c1c gui=reverse cterm=reverse @@ -116,7 +116,7 @@ if &background ==# 'dark' hi Type guifg=#fabd2f guibg=NONE gui=NONE cterm=NONE hi Typedef guifg=#fabd2f guibg=NONE gui=NONE cterm=NONE hi Underlined guifg=#83a598 guibg=NONE gui=underline cterm=underline - hi CursorIM guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM guifg=#1c1c1c guibg=#fbf1c7 gui=NONE cterm=NONE else " Light background if (has('termguicolors') && &termguicolors) || has('gui_running') @@ -160,7 +160,7 @@ else hi WildMenu guifg=#076678 guibg=#e5d4b1 gui=bold cterm=bold hi EndOfBuffer guifg=#e5d4b1 guibg=NONE gui=NONE cterm=NONE hi Conceal guifg=#076678 guibg=NONE gui=NONE cterm=NONE - hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor guifg=#fbf1c7 guibg=#282828 gui=NONE cterm=NONE hi DiffAdd guifg=#79740e guibg=#fbf1c7 gui=reverse cterm=reverse hi DiffChange guifg=#427b58 guibg=#fbf1c7 gui=reverse cterm=reverse hi DiffDelete guifg=#9d0006 guibg=#fbf1c7 gui=reverse cterm=reverse @@ -211,7 +211,7 @@ else hi Type guifg=#b57614 guibg=NONE gui=NONE cterm=NONE hi Typedef guifg=#b57614 guibg=NONE gui=NONE cterm=NONE hi Underlined guifg=#076678 guibg=NONE gui=underline cterm=underline - hi CursorIM guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM guifg=#fbf1c7 guibg=#282828 gui=NONE cterm=NONE endif if s:t_Co >= 256 @@ -250,7 +250,7 @@ if s:t_Co >= 256 hi WildMenu ctermfg=109 ctermbg=239 cterm=bold hi EndOfBuffer ctermfg=239 ctermbg=NONE cterm=NONE hi Conceal ctermfg=109 ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=234 ctermbg=230 cterm=NONE hi DiffAdd ctermfg=142 ctermbg=234 cterm=reverse hi DiffChange ctermfg=107 ctermbg=234 cterm=reverse hi DiffDelete ctermfg=203 ctermbg=234 cterm=reverse @@ -301,7 +301,7 @@ if s:t_Co >= 256 hi Type ctermfg=214 ctermbg=NONE cterm=NONE hi Typedef ctermfg=214 ctermbg=NONE cterm=NONE hi Underlined ctermfg=109 ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=234 ctermbg=230 cterm=NONE else " Light background hi Normal ctermfg=237 ctermbg=230 cterm=NONE @@ -338,7 +338,7 @@ if s:t_Co >= 256 hi WildMenu ctermfg=23 ctermbg=188 cterm=bold hi EndOfBuffer ctermfg=188 ctermbg=NONE cterm=NONE hi Conceal ctermfg=23 ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=230 ctermbg=235 cterm=NONE hi DiffAdd ctermfg=64 ctermbg=230 cterm=reverse hi DiffChange ctermfg=29 ctermbg=230 cterm=reverse hi DiffDelete ctermfg=124 ctermbg=230 cterm=reverse @@ -389,7 +389,7 @@ if s:t_Co >= 256 hi Type ctermfg=172 ctermbg=NONE cterm=NONE hi Typedef ctermfg=172 ctermbg=NONE cterm=NONE hi Underlined ctermfg=23 ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=230 ctermbg=235 cterm=NONE endif unlet s:t_Co finish @@ -431,7 +431,7 @@ if s:t_Co >= 16 hi WildMenu ctermfg=White ctermbg=Black cterm=bold hi EndOfBuffer ctermfg=DarkGray ctermbg=NONE cterm=NONE hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=Black ctermbg=White cterm=NONE hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse hi DiffDelete ctermfg=Red ctermbg=Black cterm=reverse @@ -482,7 +482,7 @@ if s:t_Co >= 16 hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=Black ctermbg=White cterm=NONE else " Light background hi Normal ctermfg=Black ctermbg=White cterm=NONE @@ -519,7 +519,7 @@ if s:t_Co >= 16 hi WildMenu ctermfg=Black ctermbg=White cterm=bold hi EndOfBuffer ctermfg=Grey ctermbg=NONE cterm=NONE hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse hi DiffDelete ctermfg=Red ctermbg=White cterm=reverse @@ -570,7 +570,7 @@ if s:t_Co >= 16 hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=White ctermbg=DarkGray cterm=NONE endif unlet s:t_Co finish @@ -612,7 +612,7 @@ if s:t_Co >= 8 hi WildMenu ctermfg=Blue ctermbg=DarkGray cterm=bold hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=Black ctermbg=White cterm=NONE hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse hi DiffDelete ctermfg=Red ctermbg=Black cterm=reverse @@ -663,7 +663,7 @@ if s:t_Co >= 8 hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=Black ctermbg=White cterm=NONE else " Light background hi Normal ctermfg=Black ctermbg=Grey cterm=NONE @@ -700,7 +700,7 @@ if s:t_Co >= 8 hi WildMenu ctermfg=Blue ctermbg=Grey cterm=bold hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE - hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse hi DiffDelete ctermfg=Red ctermbg=White cterm=reverse @@ -751,7 +751,7 @@ if s:t_Co >= 8 hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline - hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorIM ctermfg=White ctermbg=DarkGray cterm=NONE endif unlet s:t_Co finish @@ -879,4 +879,4 @@ endif " Term colors: fg1 neutralred neutralgreen neutralyellow neutralblue neutralpurple neutralaqua fg4 " Term colors: grey red green yellow blue purple aqua bg0 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index d3a692a69f..1ea8d71143 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -3,9 +3,9 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:50:56 MSK +" Last Updated: Fri 15 Dec 2023 20:05:41 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -445,4 +445,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim index b30ac415d0..4e2e4bc3d9 100644 --- a/runtime/colors/shine.vim +++ b/runtime/colors/shine.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer is Yasuhiro Matsumoto " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:51:42 MSK +" Last Updated: Fri 15 Dec 2023 20:05:41 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=light @@ -417,4 +417,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim index 6da572d9a7..225a845de3 100644 --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Ralph Amissah " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:52:25 MSK +" Last Updated: Fri 15 Dec 2023 20:05:41 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -432,4 +432,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim index 38cb141243..77e2223dca 100644 --- a/runtime/colors/sorbet.vim +++ b/runtime/colors/sorbet.vim @@ -4,9 +4,9 @@ " Maintainer: Maxence Weynans " Website: https://github.com/vim/colorschemes " License: Vim License (see `:help license`)` -" Last Updated: Wed 15 Mar 2023 05:40:19 PM CET +" Last Updated: Fri 15 Dec 2023 20:05:42 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -445,4 +445,4 @@ endif " Color: errorred #ff5f5f 203 red " Term colors: dark0 dark1 dark2 dark3 dark4 dark5 dark6 dark7 " Term colors: dark8 dark9 dark10 dark11 dark12 dark13 dark14 dark15 -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim index bec681bb4e..bcba7258da 100644 --- a/runtime/colors/torte.vim +++ b/runtime/colors/torte.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Thorsten Maerz " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:53:21 MSK +" Last Updated: Fri 15 Dec 2023 20:05:42 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -424,4 +424,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim index 0f95ec88bb..f41e5379f0 100644 --- a/runtime/colors/wildcharm.vim +++ b/runtime/colors/wildcharm.vim @@ -4,9 +4,9 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun 12 Mar 2023 18:46:06 AEDT +" Last Updated: Fri 15 Dec 2023 20:05:43 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 hi clear let g:colors_name = 'wildcharm' @@ -55,8 +55,8 @@ if &background ==# 'dark' hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error guifg=#ffffff guibg=#d7005f gui=NONE cterm=NONE - hi ErrorMsg guifg=#ffffff guibg=#d7005f gui=NONE cterm=NONE + hi Error guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse + hi ErrorMsg guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg guifg=#00d75f guibg=NONE gui=NONE cterm=NONE hi Question guifg=#ff87ff guibg=NONE gui=NONE cterm=NONE @@ -67,9 +67,9 @@ if &background ==# 'dark' hi WildMenu guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE hi debugPC guifg=#0087d7 guibg=NONE gui=reverse cterm=reverse hi debugBreakpoint guifg=#00afaf guibg=NONE gui=reverse cterm=reverse - hi Cursor guifg=#ffffff guibg=#000000 gui=reverse cterm=reverse - hi lCursor guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse - hi Visual guifg=#000000 guibg=#0087d7 gui=NONE cterm=NONE + hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE + hi lCursor guifg=#000000 guibg=#ff5fff gui=NONE cterm=NONE + hi Visual guifg=#0087d7 guibg=#000000 gui=reverse cterm=reverse hi VisualNOS guifg=#000000 guibg=#00afff gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#262626 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE @@ -133,8 +133,8 @@ else hi PmenuExtra guifg=#808080 guibg=#e4e4e4 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE - hi ErrorMsg guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE + hi Error guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse + hi ErrorMsg guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg guifg=#008700 guibg=NONE gui=NONE cterm=NONE hi Question guifg=#870087 guibg=NONE gui=NONE cterm=NONE @@ -145,9 +145,9 @@ else hi WildMenu guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE hi debugPC guifg=#005faf guibg=NONE gui=reverse cterm=reverse hi debugBreakpoint guifg=#008787 guibg=NONE gui=reverse cterm=reverse - hi Cursor guifg=#000000 guibg=#ffffff gui=reverse cterm=reverse - hi lCursor guifg=#ff00ff guibg=#000000 gui=reverse cterm=reverse - hi Visual guifg=#ffffff guibg=#0087d7 gui=NONE cterm=NONE + hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE + hi lCursor guifg=#000000 guibg=#ff00ff gui=NONE cterm=NONE + hi Visual guifg=#0087d7 guibg=#ffffff gui=reverse cterm=reverse hi VisualNOS guifg=#ffffff guibg=#005faf gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE @@ -215,8 +215,8 @@ if s:t_Co >= 256 hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE hi PmenuExtraSel ctermfg=16 ctermbg=214 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error ctermfg=231 ctermbg=161 cterm=NONE - hi ErrorMsg ctermfg=231 ctermbg=161 cterm=NONE + hi Error ctermfg=161 ctermbg=231 cterm=reverse + hi ErrorMsg ctermfg=161 ctermbg=231 cterm=reverse hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=41 ctermbg=NONE cterm=NONE hi Question ctermfg=213 ctermbg=NONE cterm=NONE @@ -227,7 +227,7 @@ if s:t_Co >= 256 hi WildMenu ctermfg=16 ctermbg=214 cterm=NONE hi debugPC ctermfg=32 ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=37 ctermbg=NONE cterm=reverse - hi Visual ctermfg=16 ctermbg=32 cterm=NONE + hi Visual ctermfg=32 ctermbg=16 cterm=reverse hi VisualNOS ctermfg=16 ctermbg=39 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE @@ -284,8 +284,8 @@ if s:t_Co >= 256 hi PmenuExtra ctermfg=240 ctermbg=254 cterm=NONE hi PmenuExtraSel ctermfg=231 ctermbg=172 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error ctermfg=231 ctermbg=160 cterm=NONE - hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE + hi Error ctermfg=160 ctermbg=231 cterm=reverse + hi ErrorMsg ctermfg=160 ctermbg=231 cterm=reverse hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=28 ctermbg=NONE cterm=NONE hi Question ctermfg=90 ctermbg=NONE cterm=NONE @@ -296,7 +296,7 @@ if s:t_Co >= 256 hi WildMenu ctermfg=231 ctermbg=172 cterm=NONE hi debugPC ctermfg=25 ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=30 ctermbg=NONE cterm=reverse - hi Visual ctermfg=231 ctermbg=32 cterm=NONE + hi Visual ctermfg=32 ctermbg=231 cterm=reverse hi VisualNOS ctermfg=231 ctermbg=25 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=255 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE @@ -358,8 +358,8 @@ if s:t_Co >= 16 hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error ctermfg=white ctermbg=darkred cterm=NONE - hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE + hi Error ctermfg=darkred ctermbg=white cterm=reverse + hi ErrorMsg ctermfg=darkred ctermbg=white cterm=reverse hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=green ctermbg=NONE cterm=NONE hi Question ctermfg=magenta ctermbg=NONE cterm=NONE @@ -370,7 +370,7 @@ if s:t_Co >= 16 hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=black ctermbg=darkblue cterm=NONE + hi Visual ctermfg=darkblue ctermbg=black cterm=reverse hi VisualNOS ctermfg=black ctermbg=blue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE @@ -427,8 +427,8 @@ if s:t_Co >= 16 hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error ctermfg=white ctermbg=red cterm=NONE - hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE + hi Error ctermfg=red ctermbg=white cterm=reverse + hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE @@ -439,7 +439,7 @@ if s:t_Co >= 16 hi WildMenu ctermfg=white ctermbg=yellow cterm=NONE hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=white ctermbg=blue cterm=NONE + hi Visual ctermfg=blue ctermbg=white cterm=reverse hi VisualNOS ctermfg=white ctermbg=darkblue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE @@ -513,7 +513,7 @@ if s:t_Co >= 8 hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=black ctermbg=darkblue cterm=NONE + hi Visual ctermfg=darkblue ctermbg=black cterm=reverse hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline hi VisualNOS ctermfg=black ctermbg=darkblue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline @@ -580,7 +580,7 @@ if s:t_Co >= 8 hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=grey ctermbg=darkblue cterm=NONE + hi Visual ctermfg=darkblue ctermbg=grey cterm=reverse hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline hi VisualNOS ctermfg=black ctermbg=darkblue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline @@ -758,4 +758,4 @@ endif " Term colors: color00 color01 color02 color03 color04 color05 color06 color07 " Term colors: color08 color09 color10 color11 color12 color13 color14 color15 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim index e029f1451b..50c5122989 100644 --- a/runtime/colors/zaibatsu.vim +++ b/runtime/colors/zaibatsu.vim @@ -4,9 +4,9 @@ " Maintainer: Romain Lafourcade " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Mar 12 17:21:15 2023 +" Last Updated: Fri 15 Dec 2023 20:05:43 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=dark @@ -564,4 +564,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim index af48ef86dc..a998033566 100644 --- a/runtime/colors/zellner.vim +++ b/runtime/colors/zellner.vim @@ -4,9 +4,9 @@ " Maintainer: Original maintainer Ron Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 02 Sep 2022 09:54:15 MSK +" Last Updated: Fri 15 Dec 2023 20:05:44 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.3 set background=light @@ -412,4 +412,4 @@ endif " Color: fgDiffB #000000 16 black " Color: bgDiffC8 #5F87AF 67 darkblue " Color: bgDiffD8 #AF5FAF 133 darkmagenta -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 -- cgit From ba613d63c4ba363e1629be4a56144df17deb51e5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 16 Dec 2023 14:31:36 +0100 Subject: vim-patch:5eb9cb53d619 runtime(racket): update Racket runtime files (vim/vim#13693) This brings the included Racket runtime files to commit 43bfc87 (update headers, 2023-12-15) of https://github.com/benknoble/vim-racket. Note that not all files from that repository are included. (In particular, the ftdetect script is omitted for now.) https://github.com/vim/vim/commit/5eb9cb53d619f89251d22299e2cb4f21918d9d38 Co-authored-by: D. Ben Knoble --- runtime/indent/racket.vim | 17 +++++++++++++---- runtime/syntax/racket.vim | 9 +++++---- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim index 93bd38fbff..2d45d89242 100644 --- a/runtime/indent/racket.vim +++ b/runtime/indent/racket.vim @@ -3,7 +3,7 @@ " Maintainer: D. Ben Knoble " Previous Maintainer: Will Langstroth " URL: https://github.com/benknoble/vim-racket -" Last Change: 2022 Aug 12 +" Last Change: 2023 Jul 17 if exists("b:did_indent") finish @@ -11,18 +11,25 @@ endif let b:did_indent = 1 setlocal lisp autoindent nosmartindent +if has('vim9script') + setlocal indentexpr=racket#Indent() lispoptions+=expr:1 +endif -setlocal lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local +setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local setlocal lispwords+=define/contract setlocal lispwords+=λ setlocal lispwords+=with-handlers setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class +setlocal lispwords+=define-syntax-parameter,syntax-parameterize setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig setlocal lispwords+=define-opt/c,define-syntax-rule -setlocal lispwords+=define-test-suite +setlocal lispwords+=define-test-suite,test-case setlocal lispwords+=struct setlocal lispwords+=with-input-from-file,with-output-to-file +setlocal lispwords+=begin,begin0 +setlocal lispwords+=place +setlocal lispwords+=cond " Racket OOP " TODO missing a lot of define-like forms here (e.g., define/augment, etc.) @@ -41,6 +48,8 @@ setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/fl setlocal lispwords+=for/async setlocal lispwords+=for/set,for*/set setlocal lispwords+=for/first,for*/first +setlocal lispwords+=for/last,for*/last +setlocal lispwords+=for/stream,for*/stream setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda** setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values @@ -57,4 +66,4 @@ setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view setlocal lispwords+=case/dep setlocal lispwords+=define/obs -let b:undo_indent = "setlocal lisp< ai< si< lw<" +let b:undo_indent = "setlocal indentexpr< lisp< lispoptions< ai< si< lw<" diff --git a/runtime/syntax/racket.vim b/runtime/syntax/racket.vim index b1ed2b454c..fcd64a7c9b 100644 --- a/runtime/syntax/racket.vim +++ b/runtime/syntax/racket.vim @@ -4,7 +4,7 @@ " Previous Maintainer: Will Langstroth " URL: https://github.com/benknoble/vim-racket " Description: Contains all of the keywords in #lang racket -" Last Change: 2022 Aug 12 +" Last Change: 2023 Sep 22 " Initializing: if exists("b:current_syntax") @@ -514,13 +514,13 @@ syntax region racketString start=/\%(\\\)\@ Date: Sat, 16 Dec 2023 14:32:19 +0100 Subject: vim-patch:0f61943eb776 runtime(logtalk): Update Logtalk runtime files for the latest language spec (vim/vim#13697) https://github.com/vim/vim/commit/0f61943eb7769777a281e0f8b8ba4c5f46d13e84 Co-authored-by: Paulo Moura --- runtime/ftplugin/logtalk.dict | 19 +++++++++++----- runtime/syntax/logtalk.vim | 51 ++++++++++++++++++++++--------------------- 2 files changed, 39 insertions(+), 31 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/logtalk.dict b/runtime/ftplugin/logtalk.dict index 3fcdfc6f6a..0d076b7b3e 100644 --- a/runtime/ftplugin/logtalk.dict +++ b/runtime/ftplugin/logtalk.dict @@ -18,11 +18,8 @@ atan2 atom atomic atom_chars -atom_chars -atom_codes atom_codes atom_concat -atom_concat atom_length at_end_of_stream bagof @@ -32,6 +29,7 @@ call callable calls catch +catchall_catch category category_property ceiling @@ -45,9 +43,9 @@ coinduction coinductive compare complements -complements complements_object compound +conditionals conforms_to_protocol context context_switching_calls @@ -87,6 +85,7 @@ end_object end_protocol engines ensure_loaded +error evaluation_error events existence_error @@ -152,12 +151,13 @@ nonvar number numbervars number_chars -number_chars -number_codes number_codes object object_property once +one +one_or_error +one_or_more op open optimize @@ -226,6 +226,7 @@ term_variables this threaded threaded_call +threaded_cancel threaded_engine threaded_engine_create threaded_engine_destroy @@ -250,6 +251,7 @@ type_error undefined_predicates underscore_variables unify_with_occurs_check +uninstantiation_error unknown_entities unknown_predicates uses @@ -260,3 +262,8 @@ write writeq write_canonical xor +zero +zero_or_error +zero_or_more +zero_or_one +zero_or_one_or_error diff --git a/runtime/syntax/logtalk.vim b/runtime/syntax/logtalk.vim index bc70ef41b4..2c6c82aaa0 100644 --- a/runtime/syntax/logtalk.vim +++ b/runtime/syntax/logtalk.vim @@ -1,8 +1,9 @@ " Vim syntax file " " Language: Logtalk -" Maintainer: Paulo Moura -" Last Change: August 3, 2018 +" Maintainer: Paulo Moura +" Last Change: December 16, 2023 + " quit when a syntax file was already loaded @@ -30,7 +31,7 @@ syn match logtalkOperator ":-" " Logtalk quoted atoms and strings -syn region logtalkString start=+"+ skip=+\\"+ end=+"+ +syn region logtalkString start=+"+ skip=+\\"+ end=+"+ contains=logtalkEscapeSequence syn region logtalkAtom start=+'+ skip=+\\'+ end=+'+ contains=logtalkEscapeSequence syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+\|[0-7]\+\)\\\)" @@ -39,7 +40,7 @@ syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+ " Logtalk message sending operators syn match logtalkOperator "::" -syn match logtalkOperator ":" +syn match logtalkOperator "\(0'\)\@" syn match logtalkBuiltIn "\<\(for\|retract\)all\ze(" -syn match logtalkBuiltIn "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkOperator "->" syn match logtalkKeyword "\" -syn match logtalkKeyword "\<\(type\|domain\|existence\|permission\|representation\|evaluation\|resource\|syntax\)_error\ze(" +syn match logtalkKeyword "\<\(uninstantiation\|type\|domain\|existence\|permission\|representation\|evaluation\|resource\|syntax\)_error\ze(" " Term unification -syn match logtalkOperator "=" +syn match logtalkOperator "\(0'\)\@" syn match logtalkOperator "=:=" syn match logtalkOperator "=\\=" -syn match logtalkOperator "<" +syn match logtalkOperator "\(0'\)\@" +syn match logtalkOperator "\(0'\)\@" syn match logtalkOperator ">=" @@ -310,11 +311,11 @@ syn match logtalkKeyword "\<\(key\)\?sort\ze(" " Evaluable functors -syn match logtalkOperator "+" -syn match logtalkOperator "-" -syn match logtalkOperator "\*" +syn match logtalkOperator "\(0'\)\@" @@ -330,7 +331,7 @@ syn match logtalkKeyword "\>" syn match logtalkOperator "<<" syn match logtalkOperator "/\\" syn match logtalkOperator "\\/" -syn match logtalkOperator "\\" +syn match logtalkOperator "0'\@" syn match logtalkNumber "\<\d\+\.\d\+\>" syn match logtalkNumber "\<\d\+[eE][-+]\=\d\+\>" syn match logtalkNumber "\<\d\+\.\d\+[eE][-+]\=\d\+\>" -syn match logtalkNumber "\<0'[\\]\?.\|0''\|0'\"\>" +syn match logtalkNumber "0'[\\]\?." syn match logtalkNumber "\<0b[0-1]\+\>" syn match logtalkNumber "\<0o\o\+\>" syn match logtalkNumber "\<0x\x\+\>" @@ -374,13 +375,13 @@ syn match logtalkNumber "\<0x\x\+\>" " Logtalk end-of-clause -syn match logtalkOperator "\." +syn match logtalkOperator "\(0'\)\@ Date: Sat, 16 Dec 2023 15:03:22 +0100 Subject: vim-patch:82f19734bfcb runtime(doc): remove deprecation warning for gdefault Deprecated can be misunderstood as being slated for removal; slightly change wording to be clearer. https://github.com/vim/vim/commit/82f19734bfcbddbaee8d5d837f7b7a7119366020 Co-authored-by: dundargoc --- runtime/doc/options.txt | 6 +++--- runtime/lua/vim/_meta/options.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 970f687c99..b61da92804 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2831,9 +2831,9 @@ A jump table for the options with a short description can be found at |Q_op|. :s///g subst. one subst. all :s///gg subst. all subst. one - DEPRECATED: Setting this option may break plugins that are not aware - of this option. Also, many users get confused that adding the /g flag - has the opposite effect of that it normally does. + NOTE: Setting this option may break plugins that rely on the default + behavior of the 'g' flag. This will also make the 'g' flag have the + opposite effect of that documented in |:s_g|. *'grepformat'* *'gfm'* 'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m") diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index c908d7ae54..f52cea9900 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2595,9 +2595,9 @@ vim.go.fs = vim.go.fsync --- :s///g subst. one subst. all --- :s///gg subst. all subst. one --- ---- DEPRECATED: Setting this option may break plugins that are not aware ---- of this option. Also, many users get confused that adding the /g flag ---- has the opposite effect of that it normally does. +--- NOTE: Setting this option may break plugins that rely on the default +--- behavior of the 'g' flag. This will also make the 'g' flag have the +--- opposite effect of that documented in `:s_g`. --- --- @type boolean vim.o.gdefault = false -- cgit From 7840760776cf8dbaa580ced87aec0222dbb693d7 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 14 Oct 2023 13:12:48 +0200 Subject: build: bump minimum cmake version to 3.13 The benefits are primarily being able to use FetchContent, which allows for a more flexible dependency handling. Other various quality-of-life features such as `-B` and `-S` flags are also included. This also removes broken `--version` generation as it does not work for version 3.10 and 3.11 due to the `JOIN` generator expression. Reference: https://github.com/neovim/neovim/issues/24004 --- runtime/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 0077604141..894e881d95 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -24,12 +24,12 @@ add_custom_command(OUTPUT ${GENERATED_SYN_VIM} ${FUNCS_DATA} ) -glob_wrapper(PACKAGES ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*) +file(GLOB PACKAGES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*) set(GENERATED_PACKAGE_TAGS) foreach(PACKAGE ${PACKAGES}) get_filename_component(PACKNAME ${PACKAGE} NAME) - glob_wrapper("${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt) + file(GLOB "${PACKNAME}_DOC_FILES" CONFIGURE_DEPENDS ${PACKAGE}/doc/*.txt) if(${PACKNAME}_DOC_FILES) file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME}) add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags" @@ -57,7 +57,7 @@ foreach(PACKAGE ${PACKAGES}) endif() endforeach() -glob_wrapper(DOCFILES ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) +file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) set(BUILDDOCFILES) foreach(DF ${DOCFILES}) @@ -119,11 +119,11 @@ install_helper( FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps) -glob_wrapper(RUNTIME_ROOT_FILES *.vim *.lua *.ico) +file(GLOB RUNTIME_ROOT_FILES CONFIGURE_DEPENDS *.vim *.lua *.ico) install_helper(FILES ${RUNTIME_ROOT_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/) -glob_wrapper(RUNTIME_DIRS */) +file(GLOB RUNTIME_DIRS CONFIGURE_DEPENDS */) foreach(D ${RUNTIME_DIRS}) if(IS_DIRECTORY ${D}) install_helper(DIRECTORY ${D} -- cgit From 8fb7419d7c5e2df3b792d18fa56f973088e69be2 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sat, 16 Dec 2023 11:18:45 -0600 Subject: refactor: only reload colorscheme if &bg changed (#26598) Currently, setting &bg at all re-initializes highlights and reloads the active colorscheme, even if the actual value of &bg has not changed. With https://github.com/neovim/neovim/pull/26595 this causes a regression since &bg is set unconditionally based on the value detected from the terminal. Instead, only reload the colorscheme if the actual value of &bg has changed. --- runtime/doc/options.txt | 8 ++------ runtime/doc/vim_diff.txt | 2 ++ runtime/lua/vim/_meta/options.lua | 8 ++------ 3 files changed, 6 insertions(+), 12 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b61da92804..552ee96047 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -774,7 +774,7 @@ A jump table for the options with a short description can be found at |Q_op|. See |:hi-normal| if you want to set the background color explicitly. *g:colors_name* When a color scheme is loaded (the "g:colors_name" variable is set) - setting 'background' will cause the color scheme to be reloaded. If + changing 'background' will cause the color scheme to be reloaded. If the color scheme adjusts to the value of 'background' this will work. However, if the color scheme sets 'background' itself the effect may be undone. First delete the "g:colors_name" variable when needed. @@ -784,13 +784,9 @@ A jump table for the options with a short description can be found at |Q_op|. :if $TERM ==# "xterm" : set background=dark :endif -< When this option is set, the default settings for the highlight groups +< When this option is changed, the default settings for the highlight groups will change. To use other settings, place ":highlight" commands AFTER the setting of the 'background' option. - This option is also used in the "$VIMRUNTIME/syntax/syntax.vim" file - to select the colors for syntax highlighting. After changing this - option, you must load syntax.vim again to see the result. This can be - done with ":syntax on". *'backspace'* *'bs'* 'backspace' 'bs' string (default "indent,eol,start") diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index e0ad0ff0f9..ca260246fc 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -299,6 +299,8 @@ Options: global-local string options work. 'autoread' works in the terminal (if it supports "focus" events) + 'background' colorscheme is only reloaded if value is changed, not every + time it is set 'cpoptions' flags: |cpo-_| 'diffopt' "linematch" feature 'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index f52cea9900..e63c5bb972 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -191,7 +191,7 @@ vim.go.awa = vim.go.autowriteall --- See `:hi-normal` if you want to set the background color explicitly. --- *g:colors_name* --- When a color scheme is loaded (the "g:colors_name" variable is set) ---- setting 'background' will cause the color scheme to be reloaded. If +--- changing 'background' will cause the color scheme to be reloaded. If --- the color scheme adjusts to the value of 'background' this will work. --- However, if the color scheme sets 'background' itself the effect may --- be undone. First delete the "g:colors_name" variable when needed. @@ -203,13 +203,9 @@ vim.go.awa = vim.go.autowriteall --- : set background=dark --- :endif --- ``` ---- When this option is set, the default settings for the highlight groups +--- When this option is changed, the default settings for the highlight groups --- will change. To use other settings, place ":highlight" commands AFTER --- the setting of the 'background' option. ---- This option is also used in the "$VIMRUNTIME/syntax/syntax.vim" file ---- to select the colors for syntax highlighting. After changing this ---- option, you must load syntax.vim again to see the result. This can be ---- done with ":syntax on". --- --- @type string vim.o.background = "dark" -- cgit From 404fdb0f3683094c2d40e1ee7e41d5c491f41a06 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 24 Nov 2023 13:28:15 +0100 Subject: build: cmake fixes - add EXTERNALPROJECT_OPTIONS variable to main build - use `REQUIRED` keyword for IWYU. - remove check_c_compiler_flag checks when `ENABLE_COMPILER_SUGGESTIONS` is `ON`. If we explicitly enable it then we probably want it to give an error if it doesn't exist, rather than silently skip it. - Move dependency interface libraries to their find module and use them as a pseudo-imported target. - Remove BUSTED_OUTPUT_TYPE. It's not used and we can reintroduce it again if something similar is needed. - Use LINK_OPTIONS intead of LINK_FLAGS when generating the `--version` output. --- runtime/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'runtime') diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 894e881d95..aa987fca1e 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -5,8 +5,6 @@ set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags) set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt) set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack) -file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}) -file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax) file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim) get_directory_property(LUA_GEN DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITION LUA_GEN) @@ -77,7 +75,6 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}" ) - # TODO: This doesn't work. wait for "nvim -l" to land? add_custom_target(doc_html COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" -- cgit From 5a2536de0c4beae4eba50a0d2868983c1690ecc7 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sun, 17 Dec 2023 09:54:38 +0000 Subject: refactor(lsp): move changetracking to separate file (#26577) * refactor(lsp): move changetracking to separate file - Prefixed changetracking types with `vim.lsp.` * fixup!: make _reset_timer a local function * fixup!: remove @private annotations * fixup!: changetracking.lua -> _changetracking.lua * fixup! types * fixup! add send_changes_for_group --- runtime/lua/vim/lsp.lua | 364 +------------------------------ runtime/lua/vim/lsp/_changetracking.lua | 373 ++++++++++++++++++++++++++++++++ runtime/lua/vim/lsp/sync.lua | 2 +- 3 files changed, 383 insertions(+), 356 deletions(-) create mode 100644 runtime/lua/vim/lsp/_changetracking.lua (limited to 'runtime') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 31aacd668b..6476335213 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -5,7 +5,7 @@ local lsp_rpc = require('vim.lsp.rpc') local protocol = require('vim.lsp.protocol') local ms = protocol.Methods local util = require('vim.lsp.util') -local sync = require('vim.lsp.sync') +local changetracking = require('vim.lsp._changetracking') local semantic_tokens = require('vim.lsp.semantic_tokens') local api = vim.api @@ -132,9 +132,10 @@ local format_line_ending = { ['mac'] = '\r', } +---@private ---@param bufnr (number) ---@return string -local function buf_get_line_ending(bufnr) +function lsp._buf_get_line_ending(bufnr) return format_line_ending[vim.bo[bufnr].fileformat] or '\n' end @@ -305,12 +306,13 @@ local function validate_client_config(config) return cmd, cmd_args, offset_encoding end +---@private --- Returns full text of buffer {bufnr} as a string. --- ---@param bufnr (number) Buffer handle, or 0 for current. ---@return string # Buffer text as string. -local function buf_get_full_text(bufnr) - local line_ending = buf_get_line_ending(bufnr) +function lsp._buf_get_full_text(bufnr) + local line_ending = lsp._buf_get_line_ending(bufnr) local text = table.concat(nvim_buf_get_lines(bufnr, 0, -1, true), line_ending) if vim.bo[bufnr].eol then text = text .. line_ending @@ -338,354 +340,6 @@ local function once(fn) end end -local changetracking = {} -do - ---@private - --- - --- LSP has 3 different sync modes: - --- - None (Servers will read the files themselves when needed) - --- - Full (Client sends the full buffer content on updates) - --- - Incremental (Client sends only the changed parts) - --- - --- Changes are tracked per buffer. - --- A buffer can have multiple clients attached and each client needs to send the changes - --- To minimize the amount of changesets to compute, computation is grouped: - --- - --- None: One group for all clients - --- Full: One group for all clients - --- Incremental: One group per `offset_encoding` - --- - --- Sending changes can be debounced per buffer. To simplify the implementation the - --- smallest debounce interval is used and we don't group clients by different intervals. - --- - --- @class CTGroup - --- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync - --- @field offset_encoding "utf-8"|"utf-16"|"utf-32" - --- - --- @class CTBufferState - --- @field name string name of the buffer - --- @field lines string[] snapshot of buffer lines from last didChange - --- @field lines_tmp string[] - --- @field pending_changes table[] List of debounced changes in incremental sync mode - --- @field timer nil|uv.uv_timer_t uv_timer - --- @field last_flush nil|number uv.hrtime of the last flush/didChange-notification - --- @field needs_flush boolean true if buffer updates haven't been sent to clients/servers yet - --- @field refs integer how many clients are using this group - --- - --- @class CTGroupState - --- @field buffers table - --- @field debounce integer debounce duration in ms - --- @field clients table clients using this state. {client_id, client} - - ---@param group CTGroup - ---@return string - local function group_key(group) - if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then - return tostring(group.sync_kind) .. '\0' .. group.offset_encoding - end - return tostring(group.sync_kind) - end - - ---@private - ---@type table - local state_by_group = setmetatable({}, { - __index = function(tbl, k) - return rawget(tbl, group_key(k)) - end, - __newindex = function(tbl, k, v) - rawset(tbl, group_key(k), v) - end, - }) - - ---@param client lsp.Client - ---@return CTGroup - local function get_group(client) - local allow_inc_sync = if_nil(client.config.flags.allow_incremental_sync, true) - local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change') - local sync_kind = change_capability or protocol.TextDocumentSyncKind.None - if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then - sync_kind = protocol.TextDocumentSyncKind.Full --[[@as integer]] - end - return { - sync_kind = sync_kind, - offset_encoding = client.offset_encoding, - } - end - - ---@param state CTBufferState - local function incremental_changes(state, encoding, bufnr, firstline, lastline, new_lastline) - local prev_lines = state.lines - local curr_lines = state.lines_tmp - - local changed_lines = nvim_buf_get_lines(bufnr, firstline, new_lastline, true) - for i = 1, firstline do - curr_lines[i] = prev_lines[i] - end - for i = firstline + 1, new_lastline do - curr_lines[i] = changed_lines[i - firstline] - end - for i = lastline + 1, #prev_lines do - curr_lines[i - lastline + new_lastline] = prev_lines[i] - end - if tbl_isempty(curr_lines) then - -- Can happen when deleting the entire contents of a buffer, see https://github.com/neovim/neovim/issues/16259. - curr_lines[1] = '' - end - - local line_ending = buf_get_line_ending(bufnr) - local incremental_change = sync.compute_diff( - state.lines, - curr_lines, - firstline, - lastline, - new_lastline, - encoding, - line_ending - ) - - -- Double-buffering of lines tables is used to reduce the load on the garbage collector. - -- At this point the prev_lines table is useless, but its internal storage has already been allocated, - -- so let's keep it around for the next didChange event, in which it will become the next - -- curr_lines table. Note that setting elements to nil doesn't actually deallocate slots in the - -- internal storage - it merely marks them as free, for the GC to deallocate them. - for i in ipairs(prev_lines) do - prev_lines[i] = nil - end - state.lines = curr_lines - state.lines_tmp = prev_lines - - return incremental_change - end - - ---@private - function changetracking.init(client, bufnr) - assert(client.offset_encoding, 'lsp client must have an offset_encoding') - local group = get_group(client) - local state = state_by_group[group] - if state then - state.debounce = math.min(state.debounce, client.config.flags.debounce_text_changes or 150) - state.clients[client.id] = client - else - state = { - buffers = {}, - debounce = client.config.flags.debounce_text_changes or 150, - clients = { - [client.id] = client, - }, - } - state_by_group[group] = state - end - local buf_state = state.buffers[bufnr] - if buf_state then - buf_state.refs = buf_state.refs + 1 - else - buf_state = { - name = api.nvim_buf_get_name(bufnr), - lines = {}, - lines_tmp = {}, - pending_changes = {}, - needs_flush = false, - refs = 1, - } - state.buffers[bufnr] = buf_state - if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then - buf_state.lines = nvim_buf_get_lines(bufnr, 0, -1, true) - end - end - end - - ---@private - function changetracking._get_and_set_name(client, bufnr, name) - local state = state_by_group[get_group(client)] or {} - local buf_state = (state.buffers or {})[bufnr] - local old_name = buf_state.name - buf_state.name = name - return old_name - end - - ---@private - function changetracking.reset_buf(client, bufnr) - changetracking.flush(client, bufnr) - local state = state_by_group[get_group(client)] - if not state then - return - end - assert(state.buffers, 'CTGroupState must have buffers') - local buf_state = state.buffers[bufnr] - buf_state.refs = buf_state.refs - 1 - assert(buf_state.refs >= 0, 'refcount on buffer state must not get negative') - if buf_state.refs == 0 then - state.buffers[bufnr] = nil - changetracking._reset_timer(buf_state) - end - end - - ---@private - function changetracking.reset(client) - local state = state_by_group[get_group(client)] - if not state then - return - end - state.clients[client.id] = nil - if vim.tbl_count(state.clients) == 0 then - for _, buf_state in pairs(state.buffers) do - changetracking._reset_timer(buf_state) - end - state.buffers = {} - end - end - - -- Adjust debounce time by taking time of last didChange notification into - -- consideration. If the last didChange happened more than `debounce` time ago, - -- debounce can be skipped and otherwise maybe reduced. - -- - -- This turns the debounce into a kind of client rate limiting - -- - ---@param debounce integer - ---@param buf_state CTBufferState - ---@return number - local function next_debounce(debounce, buf_state) - if debounce == 0 then - return 0 - end - local ns_to_ms = 0.000001 - if not buf_state.last_flush then - return debounce - end - local now = uv.hrtime() - local ms_since_last_flush = (now - buf_state.last_flush) * ns_to_ms - return math.max(debounce - ms_since_last_flush, 0) - end - - ---@param bufnr integer - ---@param sync_kind integer protocol.TextDocumentSyncKind - ---@param state CTGroupState - ---@param buf_state CTBufferState - local function send_changes(bufnr, sync_kind, state, buf_state) - if not buf_state.needs_flush then - return - end - buf_state.last_flush = uv.hrtime() - buf_state.needs_flush = false - - if not api.nvim_buf_is_valid(bufnr) then - buf_state.pending_changes = {} - return - end - - local changes --- @type lsp.TextDocumentContentChangeEvent[] - if sync_kind == protocol.TextDocumentSyncKind.None then - return - elseif sync_kind == protocol.TextDocumentSyncKind.Incremental then - changes = buf_state.pending_changes - buf_state.pending_changes = {} - else - changes = { - { text = buf_get_full_text(bufnr) }, - } - end - local uri = vim.uri_from_bufnr(bufnr) - for _, client in pairs(state.clients) do - if not client.is_stopped() and lsp.buf_is_attached(bufnr, client.id) then - client.notify(ms.textDocument_didChange, { - textDocument = { - uri = uri, - version = util.buf_versions[bufnr], - }, - contentChanges = changes, - }) - end - end - end - - ---@private - function changetracking.send_changes(bufnr, firstline, lastline, new_lastline) - local groups = {} ---@type table - for _, client in pairs(lsp.get_clients({ bufnr = bufnr })) do - local group = get_group(client) - groups[group_key(group)] = group - end - for _, group in pairs(groups) do - local state = state_by_group[group] - if not state then - error( - string.format( - 'changetracking.init must have been called for all LSP clients. group=%s states=%s', - vim.inspect(group), - vim.inspect(vim.tbl_keys(state_by_group)) - ) - ) - end - local buf_state = state.buffers[bufnr] - buf_state.needs_flush = true - changetracking._reset_timer(buf_state) - local debounce = next_debounce(state.debounce, buf_state) - if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then - -- This must be done immediately and cannot be delayed - -- The contents would further change and startline/endline may no longer fit - local changes = incremental_changes( - buf_state, - group.offset_encoding, - bufnr, - firstline, - lastline, - new_lastline - ) - table.insert(buf_state.pending_changes, changes) - end - if debounce == 0 then - send_changes(bufnr, group.sync_kind, state, buf_state) - else - local timer = assert(uv.new_timer(), 'Must be able to create timer') - buf_state.timer = timer - timer:start( - debounce, - 0, - vim.schedule_wrap(function() - changetracking._reset_timer(buf_state) - send_changes(bufnr, group.sync_kind, state, buf_state) - end) - ) - end - end - end - - ---@private - ---@param buf_state CTBufferState - function changetracking._reset_timer(buf_state) - local timer = buf_state.timer - if timer then - buf_state.timer = nil - if not timer:is_closing() then - timer:stop() - timer:close() - end - end - end - - --- Flushes any outstanding change notification. - ---@private - ---@param client lsp.Client - ---@param bufnr? integer - function changetracking.flush(client, bufnr) - local group = get_group(client) - local state = state_by_group[group] - if not state then - return - end - if bufnr then - local buf_state = state.buffers[bufnr] or {} - changetracking._reset_timer(buf_state) - send_changes(bufnr, group.sync_kind, state, buf_state) - else - for buf, buf_state in pairs(state.buffers) do - changetracking._reset_timer(buf_state) - send_changes(buf, group.sync_kind, state, buf_state) - end - end - end -end - --- Default handler for the 'textDocument/didOpen' LSP notification. --- ---@param bufnr integer Number of the buffer, or 0 for current @@ -705,7 +359,7 @@ local function text_document_did_open_handler(bufnr, client) version = 0, uri = vim.uri_from_bufnr(bufnr), languageId = client.config.get_language_id(bufnr, filetype), - text = buf_get_full_text(bufnr), + text = lsp._buf_get_full_text(bufnr), }, } client.notify(ms.textDocument_didOpen, params) @@ -1792,7 +1446,7 @@ end local function text_document_did_save_handler(bufnr) bufnr = resolve_bufnr(bufnr) local uri = vim.uri_from_bufnr(bufnr) - local text = once(buf_get_full_text) + local text = once(lsp._buf_get_full_text) for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do local name = api.nvim_buf_get_name(bufnr) local old_name = changetracking._get_and_set_name(client, bufnr, name) @@ -1807,7 +1461,7 @@ local function text_document_did_save_handler(bufnr) version = 0, uri = uri, languageId = client.config.get_language_id(bufnr, vim.bo[bufnr].filetype), - text = buf_get_full_text(bufnr), + text = lsp._buf_get_full_text(bufnr), }, }) util.buf_versions[bufnr] = 0 diff --git a/runtime/lua/vim/lsp/_changetracking.lua b/runtime/lua/vim/lsp/_changetracking.lua new file mode 100644 index 0000000000..67c74f069d --- /dev/null +++ b/runtime/lua/vim/lsp/_changetracking.lua @@ -0,0 +1,373 @@ +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 + +local M = {} + +--- LSP has 3 different sync modes: +--- - None (Servers will read the files themselves when needed) +--- - Full (Client sends the full buffer content on updates) +--- - Incremental (Client sends only the changed parts) +--- +--- Changes are tracked per buffer. +--- A buffer can have multiple clients attached and each client needs to send the changes +--- To minimize the amount of changesets to compute, computation is grouped: +--- +--- None: One group for all clients +--- Full: One group for all clients +--- Incremental: One group per `offset_encoding` +--- +--- Sending changes can be debounced per buffer. To simplify the implementation the +--- smallest debounce interval is used and we don't group clients by different intervals. +--- +--- @class vim.lsp.CTGroup +--- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync +--- @field offset_encoding "utf-8"|"utf-16"|"utf-32" +--- +--- @class vim.lsp.CTBufferState +--- @field name string name of the buffer +--- @field lines string[] snapshot of buffer lines from last didChange +--- @field lines_tmp string[] +--- @field pending_changes table[] List of debounced changes in incremental sync mode +--- @field timer uv.uv_timer_t? uv_timer +--- @field last_flush nil|number uv.hrtime of the last flush/didChange-notification +--- @field needs_flush boolean true if buffer updates haven't been sent to clients/servers yet +--- @field refs integer how many clients are using this group +--- +--- @class vim.lsp.CTGroupState +--- @field buffers table +--- @field debounce integer debounce duration in ms +--- @field clients table clients using this state. {client_id, client} + +---@param group vim.lsp.CTGroup +---@return string +local function group_key(group) + if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then + return tostring(group.sync_kind) .. '\0' .. group.offset_encoding + end + return tostring(group.sync_kind) +end + +---@type table +local state_by_group = setmetatable({}, { + __index = function(tbl, k) + return rawget(tbl, group_key(k)) + end, + __newindex = function(tbl, k, v) + rawset(tbl, group_key(k), v) + end, +}) + +---@param client lsp.Client +---@return vim.lsp.CTGroup +local function get_group(client) + local allow_inc_sync = vim.F.if_nil(client.config.flags.allow_incremental_sync, true) + local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change') + local sync_kind = change_capability or protocol.TextDocumentSyncKind.None + if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then + sync_kind = protocol.TextDocumentSyncKind.Full --[[@as integer]] + end + return { + sync_kind = sync_kind, + offset_encoding = client.offset_encoding, + } +end + +---@param state vim.lsp.CTBufferState +---@param encoding string +---@param bufnr integer +---@param firstline integer +---@param lastline integer +---@param new_lastline integer +---@return lsp.TextDocumentContentChangeEvent +local function incremental_changes(state, encoding, bufnr, firstline, lastline, new_lastline) + local prev_lines = state.lines + local curr_lines = state.lines_tmp + + local changed_lines = api.nvim_buf_get_lines(bufnr, firstline, new_lastline, true) + for i = 1, firstline do + curr_lines[i] = prev_lines[i] + end + for i = firstline + 1, new_lastline do + curr_lines[i] = changed_lines[i - firstline] + end + for i = lastline + 1, #prev_lines do + curr_lines[i - lastline + new_lastline] = prev_lines[i] + end + if vim.tbl_isempty(curr_lines) then + -- Can happen when deleting the entire contents of a buffer, see https://github.com/neovim/neovim/issues/16259. + curr_lines[1] = '' + end + + local line_ending = vim.lsp._buf_get_line_ending(bufnr) + local incremental_change = sync.compute_diff( + state.lines, + curr_lines, + firstline, + lastline, + new_lastline, + encoding, + line_ending + ) + + -- Double-buffering of lines tables is used to reduce the load on the garbage collector. + -- At this point the prev_lines table is useless, but its internal storage has already been allocated, + -- so let's keep it around for the next didChange event, in which it will become the next + -- curr_lines table. Note that setting elements to nil doesn't actually deallocate slots in the + -- internal storage - it merely marks them as free, for the GC to deallocate them. + for i in ipairs(prev_lines) do + prev_lines[i] = nil + end + state.lines = curr_lines + state.lines_tmp = prev_lines + + return incremental_change +end + +---@param client lsp.Client +---@param bufnr integer +function M.init(client, bufnr) + assert(client.offset_encoding, 'lsp client must have an offset_encoding') + local group = get_group(client) + local state = state_by_group[group] + if state then + state.debounce = math.min(state.debounce, client.config.flags.debounce_text_changes or 150) + state.clients[client.id] = client + else + state = { + buffers = {}, + debounce = client.config.flags.debounce_text_changes or 150, + clients = { + [client.id] = client, + }, + } + state_by_group[group] = state + end + local buf_state = state.buffers[bufnr] + if buf_state then + buf_state.refs = buf_state.refs + 1 + else + buf_state = { + name = api.nvim_buf_get_name(bufnr), + lines = {}, + lines_tmp = {}, + pending_changes = {}, + needs_flush = false, + refs = 1, + } + state.buffers[bufnr] = buf_state + if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then + buf_state.lines = api.nvim_buf_get_lines(bufnr, 0, -1, true) + end + end +end + +--- @param client lsp.Client +--- @param bufnr integer +--- @param name string +--- @return string +function M._get_and_set_name(client, bufnr, name) + local state = state_by_group[get_group(client)] or {} + local buf_state = (state.buffers or {})[bufnr] + local old_name = buf_state.name + buf_state.name = name + return old_name +end + +---@param buf_state vim.lsp.CTBufferState +local function reset_timer(buf_state) + local timer = buf_state.timer + if timer then + buf_state.timer = nil + if not timer:is_closing() then + timer:stop() + timer:close() + end + end +end + +--- @param client lsp.Client +--- @param bufnr integer +function M.reset_buf(client, bufnr) + M.flush(client, bufnr) + local state = state_by_group[get_group(client)] + if not state then + return + end + assert(state.buffers, 'CTGroupState must have buffers') + local buf_state = state.buffers[bufnr] + buf_state.refs = buf_state.refs - 1 + assert(buf_state.refs >= 0, 'refcount on buffer state must not get negative') + if buf_state.refs == 0 then + state.buffers[bufnr] = nil + reset_timer(buf_state) + end +end + +--- @param client lsp.Client +function M.reset(client) + local state = state_by_group[get_group(client)] + if not state then + return + end + state.clients[client.id] = nil + if vim.tbl_count(state.clients) == 0 then + for _, buf_state in pairs(state.buffers) do + reset_timer(buf_state) + end + state.buffers = {} + end +end + +-- Adjust debounce time by taking time of last didChange notification into +-- consideration. If the last didChange happened more than `debounce` time ago, +-- debounce can be skipped and otherwise maybe reduced. +-- +-- This turns the debounce into a kind of client rate limiting +-- +---@param debounce integer +---@param buf_state vim.lsp.CTBufferState +---@return number +local function next_debounce(debounce, buf_state) + if debounce == 0 then + return 0 + end + local ns_to_ms = 0.000001 + if not buf_state.last_flush then + return debounce + end + local now = uv.hrtime() + local ms_since_last_flush = (now - buf_state.last_flush) * ns_to_ms + return math.max(debounce - ms_since_last_flush, 0) +end + +---@param bufnr integer +---@param sync_kind integer protocol.TextDocumentSyncKind +---@param state vim.lsp.CTGroupState +---@param buf_state vim.lsp.CTBufferState +local function send_changes(bufnr, sync_kind, state, buf_state) + if not buf_state.needs_flush then + return + end + buf_state.last_flush = uv.hrtime() + buf_state.needs_flush = false + + if not api.nvim_buf_is_valid(bufnr) then + buf_state.pending_changes = {} + return + end + + local changes --- @type lsp.TextDocumentContentChangeEvent[] + if sync_kind == protocol.TextDocumentSyncKind.None then + return + elseif sync_kind == protocol.TextDocumentSyncKind.Incremental then + changes = buf_state.pending_changes + buf_state.pending_changes = {} + else + changes = { + { text = vim.lsp._buf_get_full_text(bufnr) }, + } + end + local uri = vim.uri_from_bufnr(bufnr) + for _, client in pairs(state.clients) do + if not client.is_stopped() and vim.lsp.buf_is_attached(bufnr, client.id) then + client.notify(protocol.Methods.textDocument_didChange, { + textDocument = { + uri = uri, + version = util.buf_versions[bufnr], + }, + contentChanges = changes, + }) + end + end +end + +--- @param bufnr integer +--- @param firstline integer +--- @param lastline integer +--- @param new_lastline integer +--- @param group vim.lsp.CTGroup +local function send_changes_for_group(bufnr, firstline, lastline, new_lastline, group) + local state = state_by_group[group] + if not state then + error( + string.format( + 'changetracking.init must have been called for all LSP clients. group=%s states=%s', + vim.inspect(group), + vim.inspect(vim.tbl_keys(state_by_group)) + ) + ) + end + local buf_state = state.buffers[bufnr] + buf_state.needs_flush = true + reset_timer(buf_state) + local debounce = next_debounce(state.debounce, buf_state) + if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then + -- This must be done immediately and cannot be delayed + -- The contents would further change and startline/endline may no longer fit + local changes = incremental_changes( + buf_state, + group.offset_encoding, + bufnr, + firstline, + lastline, + new_lastline + ) + table.insert(buf_state.pending_changes, changes) + end + if debounce == 0 then + send_changes(bufnr, group.sync_kind, state, buf_state) + else + local timer = assert(uv.new_timer(), 'Must be able to create timer') + buf_state.timer = timer + timer:start( + debounce, + 0, + vim.schedule_wrap(function() + reset_timer(buf_state) + send_changes(bufnr, group.sync_kind, state, buf_state) + end) + ) + end +end + +--- @param bufnr integer +--- @param firstline integer +--- @param lastline integer +--- @param new_lastline integer +function M.send_changes(bufnr, firstline, lastline, new_lastline) + local groups = {} ---@type table + for _, client in pairs(vim.lsp.get_clients({ bufnr = bufnr })) do + local group = get_group(client) + groups[group_key(group)] = group + end + for _, group in pairs(groups) do + send_changes_for_group(bufnr, firstline, lastline, new_lastline, group) + end +end + +--- Flushes any outstanding change notification. +---@param client lsp.Client +---@param bufnr? integer +function M.flush(client, bufnr) + local group = get_group(client) + local state = state_by_group[group] + if not state then + return + end + if bufnr then + local buf_state = state.buffers[bufnr] or {} + reset_timer(buf_state) + send_changes(bufnr, group.sync_kind, state, buf_state) + else + for buf, buf_state in pairs(state.buffers) do + reset_timer(buf_state) + send_changes(buf, group.sync_kind, state, buf_state) + end + end +end + +return M diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua index c2b5b54cb0..7ebe2dbb88 100644 --- a/runtime/lua/vim/lsp/sync.lua +++ b/runtime/lua/vim/lsp/sync.lua @@ -397,7 +397,7 @@ end ---@param new_lastline integer line to begin search in new_lines for last difference ---@param offset_encoding string encoding requested by language server ---@param line_ending string ----@return table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent +---@return lsp.TextDocumentContentChangeEvent : see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent function M.compute_diff( prev_lines, curr_lines, -- cgit From c0cb1e8e9437b738c8d3232ec4594113d2221bb2 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sun, 17 Dec 2023 15:25:15 +0900 Subject: perf(treesitter): filter out trees outside the visible range early Problem: Treesitter highlighter's on_line was iterating all the parsed trees, which can be quite a lot when injection is used. This may slow down scrolling and cursor movement in big files with many comment injections (e.g., lsp/_meta/protocol.lua). Solution: In on_win, collect trees inside the visible range, and use them in on_line. NOTE: This optimization depends on the correctness of on_win's botline_guess parameter (i.e., it's always greater than or equal to the line numbers passed to on_line). The documentation does not guarantee this, but I have never noticed a problem so far. --- runtime/lua/vim/treesitter/highlighter.lua | 74 +++++++++++++++++++----------- 1 file changed, 47 insertions(+), 27 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 496193c6ed..17543bc787 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -5,14 +5,16 @@ local Range = require('vim.treesitter._range') ---@alias TSHlIter fun(end_line: integer|nil): integer, TSNode, TSMetadata ---@class TSHighlightState +---@field tstree TSTree ---@field next_row integer ---@field iter TSHlIter|nil +---@field highlighter_query TSHighlighterQuery ---@class TSHighlighter ---@field active table ---@field bufnr integer ---@field orig_spelloptions string ----@field _highlight_states table +---@field _highlight_states TSHighlightState[] ---@field _queries table ---@field tree LanguageTree ---@field redraw_count integer @@ -157,18 +159,47 @@ function TSHighlighter:destroy() end end ----@package ----@param tstree TSTree ----@return TSHighlightState -function TSHighlighter:get_highlight_state(tstree) - if not self._highlight_states[tstree] then - self._highlight_states[tstree] = { +---@param srow integer +---@param erow integer exclusive +---@private +function TSHighlighter:prepare_highlight_states(srow, erow) + self.tree:for_each_tree(function(tstree, tree) + if not tstree then + return + end + + local root_node = tstree:root() + local root_start_row, _, root_end_row, _ = root_node:range() + + -- Only worry about trees within the visible range + if root_start_row > erow or root_end_row < srow then + return + end + + local highlighter_query = self:get_query(tree:lang()) + + -- Some injected languages may not have highlight queries. + if not highlighter_query:query() then + return + end + + -- _highlight_states should be a list so that the highlights are added in the same order as + -- for_each_tree traversal. This ensures that parents' highlight don't override children's. + table.insert(self._highlight_states, { + tstree = tstree, next_row = 0, iter = nil, - } - end + highlighter_query = highlighter_query, + }) + end) +end - return self._highlight_states[tstree] +---@param fn fun(state: TSHighlightState) +---@package +function TSHighlighter:for_each_highlight_state(fn) + for _, state in ipairs(self._highlight_states) do + fn(state) + end end ---@private @@ -214,12 +245,8 @@ end ---@param line integer ---@param is_spell_nav boolean local function on_line_impl(self, buf, line, is_spell_nav) - self.tree:for_each_tree(function(tstree, tree) - if not tstree then - return - end - - local root_node = tstree:root() + self:for_each_highlight_state(function(state) + local root_node = state.tstree:root() local root_start_row, _, root_end_row, _ = root_node:range() -- Only worry about trees within the line range @@ -227,17 +254,9 @@ local function on_line_impl(self, buf, line, is_spell_nav) return end - local state = self:get_highlight_state(tstree) - local highlighter_query = self:get_query(tree:lang()) - - -- Some injected languages may not have highlight queries. - if not highlighter_query:query() then - return - end - if state.iter == nil or state.next_row < line then state.iter = - highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1) + state.highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1) end while line >= state.next_row do @@ -250,9 +269,9 @@ local function on_line_impl(self, buf, line, is_spell_nav) local start_row, start_col, end_row, end_col = Range.unpack4(range) if capture then - local hl = highlighter_query.hl_cache[capture] + local hl = state.highlighter_query.hl_cache[capture] - local capture_name = highlighter_query:query().captures[capture] + local capture_name = state.highlighter_query:query().captures[capture] local spell = nil ---@type boolean? if capture_name == 'spell' then spell = true @@ -327,6 +346,7 @@ function TSHighlighter._on_win(_, _win, buf, topline, botline) end self.tree:parse({ topline, botline + 1 }) self:reset_highlight_state() + self:prepare_highlight_states(topline, botline + 1) self.redraw_count = self.redraw_count + 1 return true end -- cgit From e164f4c2715c97b48607bb6339eac3aff7106c47 Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Mon, 18 Dec 2023 08:11:47 +0800 Subject: docs(diagnostic): add return value of `vim.diagnostic.config()` (#26615) --- runtime/doc/diagnostic.txt | 3 +++ runtime/lua/vim/diagnostic.lua | 2 ++ 2 files changed, 5 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 4cf8fef7c4..94ed578823 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -466,6 +466,9 @@ config({opts}, {namespace}) *vim.diagnostic.config()* • {namespace} (integer|nil) Update the options for the given namespace. When omitted, update the global diagnostic options. + Return: ~ + (table|nil) table of current diagnostic config if `opts` is omitted. + disable({bufnr}, {namespace}) *vim.diagnostic.disable()* Disable diagnostics in the given buffer. diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 2171ae14e6..e4f694b8a2 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -617,6 +617,8 @@ end --- ---@param namespace integer|nil Update the options for the given namespace. When omitted, update the --- global diagnostic options. +--- +---@return table|nil table of current diagnostic config if `opts` is omitted. function M.config(opts, namespace) vim.validate({ opts = { opts, 't', true }, -- cgit From 8abae7c2e438c5a2f72f849e760b64c6c80ac5e1 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 18 Dec 2023 10:05:40 +0100 Subject: vim-patch:71cbe8e17a8c runtime(fortan): update fortran syntax rules and doc notes Update to the Fortran 2023 standard. Reorganize some code to reflect the dropping of dialect support in the previous commit. Minor improvements. closes: vim/vim#13712 https://github.com/vim/vim/commit/71cbe8e17a8c0c29b91943a7e9da596d718c79cf Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/doc/syntax.txt | 33 ++--- runtime/syntax/fortran.vim | 299 +++++++++++++++++++++------------------------ 2 files changed, 157 insertions(+), 175 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6b5f0393ea..1ca01a09e3 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1552,13 +1552,14 @@ edit F# or Fortran at all, use this in your startup vimrc: > FORTRAN *fortran.vim* *ft-fortran-syntax* Default highlighting and dialect ~ -Highlighting appropriate for Fortran 2008 is used by default. This choice -should be appropriate for most users most of the time because Fortran 2008 is -almost a superset of previous versions (Fortran 2003, 95, 90, and 77). A -small number of features new to Fortran 2018 and Fortran 2023 are supported -and the complete transition to Fortran 2023 will be completed in the future. -A few legacy constructs deleted or declared obsolescent in recent Fortran -standards are highlighted as todo items. +Vim highlights according to Fortran 2023 (the most recent standard) by +default. This choice should be appropriate for most users most of the time +because Fortran 2023 is almost a superset of previous versions (Fortran 2018, +2008, 2003, 95, 90, and 77). A small number of features new to Fortran 2018 +and Fortran 2023 may have been omitted at present; the transition to Fortran +2023 will be completed in the near future. A few legacy constructs deleted or +declared obsolescent in recent Fortran standards are highlighted as todo +items. The syntax script no longer supports Fortran dialects. The variable fortran_dialect is now silently ignored. Since computers are much faster now, @@ -1568,7 +1569,7 @@ Fortran source code form ~ Fortran code can be in either fixed or free source form. Note that the syntax highlighting will not be correct if the form is incorrectly set. -When you create a new fortran file, the syntax script assumes fixed source +When you create a new Fortran file, the syntax script assumes fixed source form. If you always use free source form, then > :let fortran_free_source=1 If you always use fixed source form, then > @@ -1581,10 +1582,10 @@ will work only if the "filetype plugin indent on" command precedes the "syntax on" command in your .vimrc file. -When you edit an existing fortran file, the syntax script will assume free +When you edit an existing Fortran file, the syntax script will assume free source form if the fortran_free_source variable has been set, and assumes -fixed source form if the fortran_fixed_source variable has been set. If -neither of these variables have been set, the syntax script attempts to +fixed source form if the fortran_fixed_source variable has been set. Suppose +neither of these variables have been set. In that case, the syntax script attempts to determine which source form has been used by examining the file extension using conventions common to the ifort, gfortran, Cray, NAG, and PathScale compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for @@ -1616,17 +1617,17 @@ intrinsics, you should set the variable fortran_vendor_intrinsics with a command such as > :let fortran_vendor_intrinsics=1 -Tabs in fortran files ~ +Tabs in Fortran files ~ Tabs are not recognized by the Fortran standards. Tabs are not a good idea in -fixed format fortran source code which requires fixed column boundaries. +fixed format Fortran source code which requires fixed column boundaries. Therefore, tabs are marked as errors. Nevertheless, some programmers like -using tabs. If your fortran files contain tabs, then you should set the +using tabs. If your Fortran files contain tabs, then you should set the variable fortran_have_tabs in your vimrc with a command such as > :let fortran_have_tabs=1 Unfortunately, the use of tabs will mean that the syntax file will not be able to detect incorrect margins. -Syntax folding of fortran files ~ +Syntax folding of Fortran files ~ If you wish to use foldmethod=syntax, then you must first set the variable fortran_fold with a command such as > :let fortran_fold=1 @@ -1659,7 +1660,7 @@ Parenthesis checking does not catch too few closing parentheses. Hollerith strings are not recognized. Some keywords may be highlighted incorrectly because Fortran90 has no reserved words. -For further information related to fortran, see |ft-fortran-indent| and +For further information related to Fortran, see |ft-fortran-indent| and |ft-fortran-plugin|. FREEBASIC *freebasic.vim* *ft-freebasic-syntax* diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 971a2b633d..7ed4f8a268 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,6 +1,6 @@ " Vim syntax file -" Language: Fortran 2008 (and Fortran 2003, 95, 90, and 77) -" Version: (v106) 2023 December 4 +" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, and 77) +" Version: (v107) 2023 December 17 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-syntax from Vim @@ -71,24 +71,73 @@ endif syn match fortranConstructName "\(\" -syn match fortranUserUnit "\(\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\|block\)\s\+\)\@12<=\a\w\+" - -syn match fortranType "\" -syn match fortranType "\" -syn keyword fortranType intrinsic -syn match fortranType "\\s\+\(none\(\s\+\\)\?\)\?" -syn keyword fortranStructure dimension -syn keyword fortranStorageClass parameter save -syn match fortranCall "call\s\+\a\w*" -syn match fortranUnitHeader "\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\|block\)" -syn keyword fortranKeyword return -syn match fortranKeyword "\(error\s\+\)\=stop" -syn keyword fortranConditional else then -syn match fortranConditional "\" -syn match fortranConditionalDel "\\ze\s*(' +syn match fortranIntrinsic "\" +syn match fortranType "^\s*implicit\s\+none" +syn match fortranType "\(class\|type\)\(of\)\?" +syn match fortranType "\(end\s*\)\?\" +syn match fortranType "\" +syn match fortranType "\(end\s*\)\?enumeration\s\+type" +syn match fortranType "\(end\s*\)\?\(\" +syn match fortranTypeR display "double\s*precision" +syn match fortranTypeR display "double\s\+complex" +syn keyword fortranAttribute value bind deferred contiguous intrinsic non_intrinsic +syn keyword fortranAttribute asynchronous nopass non_overridable pass volatile extends +syn keyword fortranAttribute abstract external private public protected intent optional +syn keyword fortranAttribute pointer target allocatable dimension codimension sequence parameter save + +syn keyword fortranUnitHeader result operator assignment +syn match fortranUnitHeader "\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\>" +syn match fortranBlock "\(end\s*\)\?\(block\|critical\|associate\)\>" +syn match fortranCalled "\(call\s\+\)\@7<=\a\w*" syn match fortranRepeat "\" +syn keyword fortranRepeat concurrent +syn keyword fortranRepeatR while +syn match fortranRepeat "\" syn keyword fortranTodo contained bug note debug todo fixme @@ -99,11 +148,13 @@ syn match fortranParenError ")" syn match fortranOperator "\.\s*n\=eqv\s*\." syn match fortranOperator "\.\s*\(and\|or\|not\)\s*\." syn match fortranOperator "\(+\|-\|/\|\*\)" -syn match fortranTypeOb "\\|<\)=\=\|==\|/=\|=\)" +syn match fortranOperator "\(%\|?\|=>\)" +syn match fortranOperator "\([\|]\)" +syn match fortranOperatorR "\.\s*[gl][et]\s*\." +syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." -syn keyword fortranReadWrite print +syn keyword fortranReadWrite print flush syn match fortranReadWrite '\<\(backspace\|close\|endfile\|inquire\|open\|read\|rewind\|write\)\ze\s*(' "If tabs are allowed then the left margin checks do not work @@ -113,24 +164,6 @@ else syn match fortranTab "\t" endif -syn match fortranIO '\%(\((\|,\|, *&\n\)\s*\)\@<=\(access\|blank\|direct\|exist\|file\|fmt\|form\|formatted\|iostat\|name\|named\|nextrec\|number\|opened\|rec\|recl\|sequential\|status\|unformatted\|unit\)\ze\s*=' - -" Intrinsics provided by some vendors -syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh - -syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh -syn match fortranIntrinsic "\\(\s\+is\>\)\?" -syn match fortranType "^\s*\(type\s\+\(is\)\? \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" -syn match fortranType "^\s*\(implicit \)\?\s*\(real\|integer\|logical\|complex\|character\)\>" - "Numbers of various sorts " Integers syn match fortranNumber display "\<\d\+\(_\a\w*\)\=\>" @@ -157,129 +190,75 @@ syn match fortranFormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\=" syn match fortranFormatSpec display "\d\+x\>" " The next match cannot be used because it would pick up identifiers as well " syn match fortranFormatSpec display "\<\(a\|i\)\d\+" - " Numbers as labels syn match fortranLabelNumber display "^\d\{1,5}\s"me=e-1 syn match fortranLabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1 syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1 syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1 syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1 - " Numbers as targets syn match fortranTarget display "\(\" syn match fortranTarget display "\(\" syn match fortranTarget display "\(\" -syn keyword fortranTypeR external -syn keyword fortranIOR format +syn match fortranBoolean "\.\s*\(true\|false\)\s*\." + +syn match fortranKeyword "call" +syn keyword fortranKeyword use only contains +syn match fortranKeyword "fail\s\+image\>" +syn match fortranKeyword "\(error\s\+\)\=stop" syn match fortranKeyword "\" syn match fortranKeyword "^\s*\d\+\s\+continue\>" syn match fortranKeyword "\" syn match fortranKeywordDel "\" -syn match fortranStorageClass "\" -syn keyword fortranKeyword allocate deallocate nullify cycle exit -syn match fortranConditional "\" -syn match fortranConditional "\" -syn keyword fortranConditional where elsewhere - -syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" -syn match fortranOperator "\(%\|?\|=>\)" - +syn region fortranString start=+'+ end=+'+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber + +syn match fortranIO '\%(\((\|,\|, *&\n\)\s*\)\@<=\(access\|blank\|direct\|exist\|file\|fmt\|form\|formatted\|iostat\|name\|named\|nextrec\|number\|opened\|rec\|recl\|sequential\|status\|unformatted\|unit\)\ze\s*=' +syn keyword fortranIOR format namelist syn keyword fortranIO pad position action delim readwrite syn keyword fortranIO eor advance nml +syn keyword fortranIO newunit decimal round iomsg +syn match fortranIO contains=fortranOperator "\\ze\s*(' -syn match fortranIntrinsic "\\(\s*\.\)\@!"me=s+3 -syn match fortranIntrinsic "\\s*[(,]"me=s+4 - -syn match fortranUnitHeader "\" -syn keyword fortranIOR namelist -syn keyword fortranConditionalR while -syn keyword fortranIntrinsicR achar iachar transfer dble dprod dim lge lgt lle llt mod -syn keyword fortranIntrinsicOb alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl +syn keyword fortranConditional else then where elsewhere +syn match fortranConditional "\" +syn match fortranConditional "\" +syn match fortranConditional "\(case\|rank\)\(\s\+default\)\?" +syn match fortranConditionalDel "\" +syn match fortranImageControl "\(change\|form\|end\)\s\+team\>" +syn match fortranImageControl "event\s\+\(post\|wait\)" +syn match fortranImageControl "\(un\)\?lock\ze\s*(" +syn match fortranImageControl "notify\s\+wait\ze\s*(" syn keyword fortranUnitHeaderOb entry -syn match fortranTypeR display "double\s\+precision" -syn match fortranTypeR display "double\s\+complex" -syn match fortranUnitHeaderOb display "block\s\+data" -syn match fortranStorageClass "^\s*data\>\(\s\+\a\w*\s*/\)\@=" -syn match fortranStorageClassOb "^\s*common\>\(\s*/\)\@=" +syn match fortranUnitHeaderOb display "block\s*data" + +syn keyword fortranStorageClass in out +syn match fortranStorageClass "\" +syn match fortranStorageClass "\\(\s\+\a\w*\s*/\)\@=" +syn match fortranStorageClassOb "^\s*common\>" +syn match fortranStorageClassOb "^\s*common\>\(\s*/\)\@=" syn keyword fortranStorageClassOb equivalence -syn match fortranOperatorR "\.\s*[gl][et]\s*\." -syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." - -syn keyword fortranRepeatOb forall -syn match fortranRepeatOb "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranConstructNameOb "\(\" - -" F2003 -syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of -" ISO_C_binding + syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr -syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer -syn keyword fortranType c_ptr c_funptr -" ISO_Fortran_env -syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit -" IEEE_arithmetic -syn keyword fortranIntrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode - -syn keyword fortranReadWrite flush wait -syn keyword fortranIO decimal round iomsg -syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import -syn keyword fortranType non_intrinsic value bind deferred generic final enumerator -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranType "\" -syn match fortranConditional "\" -syn match fortranUnitHeader "\" -syn match fortranOperator "\([\|]\)" - -" F2008 -syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 -syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits -syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image -syn keyword fortranIO newunit -syn keyword fortranType contiguous -syn keyword fortranRepeat concurrent +syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit stat_failed_image stat_unlocked_failed_image +syn keyword fortranConstant int8 int16 int32 int64 real16 real32 real64 real128 character_kinds integer_kinds logical_kinds real_kinds iostat_inquire_internal_unit +syn keyword fortranConstant ieee_negative_subnormal ieee_positive_subnormal " CUDA fortran if exists("fortran_CUDA") @@ -322,14 +301,13 @@ syn cluster fortranCommentGroup contains=fortranTodo if (b:fortran_fixed_source == 1) if !exists("fortran_have_tabs") - " Fixed format requires a textwidth of 72 for code, - " but some vendor extensions allow longer lines if exists("fortran_extended_line_length") + " Vendor extensions allow lines with a text width of 132 syn match fortranSerialNumber excludenl "^.\{133,}$"lc=132 - elseif exists("fortran_cardimage_line_length") - syn match fortranSerialNumber excludenl "^.\{81,}$"lc=80 else - syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72 + " Standard requires fixed format to have a text width of 72, + " but all current compilers use 80 instead + syn match fortranSerialNumber excludenl "^.\{81,}$"lc=80 endif "Flag left margin errors syn match fortranLabelError "^.\{-,4}[^0-9 ]" contains=fortranTab @@ -344,6 +322,7 @@ endif syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell syn match fortranOpenMP excludenl "^\s*!\$\(OMP\)\=&\=\s.*$" +syn match fortranEndStatement display ";" "cpp is often used with Fortran syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*" @@ -390,15 +369,15 @@ if exists("fortran_fold") if exists("fortran_fold_conditionals") if (b:fortran_fixed_source == 1) - syn region fortran77Loop transparent fold keepend start="\ Date: Mon, 18 Dec 2023 10:09:57 +0100 Subject: vim-patch:b42703a662e8 runtime(tmux): Update tmux syntax rules (vim/vim#13708) https://github.com/vim/vim/commit/b42703a662e87ef0ab643f417869851f065eaac4 Co-authored-by: Eric Pruitt --- runtime/syntax/tmux.vim | 160 +++++++++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 71 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim index 042b96e872..d2b31e874c 100644 --- a/runtime/syntax/tmux.vim +++ b/runtime/syntax/tmux.vim @@ -1,5 +1,5 @@ " Language: tmux(1) configuration file -" Version: 3.3-rc (git-964deae4) +" Version: 3.3a (git-e7c829fc) " URL: https://github.com/ericpruitt/tmux.vim/ " Maintainer: Eric Pruitt " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) @@ -17,8 +17,9 @@ let b:current_syntax = "tmux" syntax iskeyword @,48-57,_,192-255,- syntax case match -syn keyword tmuxAction none any current other -syn keyword tmuxBoolean off on yes no +" The values "yes" and "no" are synonyms for "on" and "off", so they do not +" appear in the option table file. +syn keyword tmuxEnums yes no syn keyword tmuxTodo FIXME NOTE TODO XXX contained @@ -27,12 +28,20 @@ syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display syn match tmuxNumber /\<\d\+\>/ display syn match tmuxFlags /\s-\a\+/ display syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display -syn match tmuxControl /^\s*%\(if\|elif\|else\|endif\)\>/ +syn match tmuxControl /\(^\|\s\)%\(if\|elif\|else\|endif\)\($\|\s\)/ display syn match tmuxEscape /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display +" Missing closing bracket. +syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display +" Starts with invalid character. +syn match tmuxInvalidVariableExpansion /\${[^A-Za-z_][^}]*}/ display +syn match tmuxInvalidVariableExpansion /\$[^A-Za-z_{ \t]/ display +" Contains invalid character. +syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_][^}]*}/ display + syn region tmuxComment start=/#/ skip=/\\\@ Date: Sat, 16 Dec 2023 22:14:28 +0100 Subject: docs: add style rule regarding initialization Specifically, specify that each initialization should be done on a separate line. --- runtime/doc/dev_style.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index 02fd07ce24..ee8a2a3c3b 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -73,6 +73,24 @@ should be used instead of declaration and assignment, e.g. >c int j = g(); // GOOD: declaration has initialization. +Initialization ~ + +Multiple declarations can be defined in one line if they aren't initialized, +but each initialization should be done on a separate line. + +>c + int i; + int j; // GOOD + + int i, j; // GOOD: multiple declarations, no initialization. + + int i = 0; + int j = 0; // GOOD: one initialization per line. + + int i = 0, j; // BAD: multiple declarations with initialization. + + int i = 0, j = 0; // BAD: multiple declarations with initialization. + ============================================================================== Nvim-Specific Magic -- cgit From cd1b14f027f375a9de17fdf106016470f52035f7 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Tue, 19 Dec 2023 00:47:01 +0900 Subject: feat(termdebug): improve `:Evaluate` floating window (#26621) Problem: - The :Evaluate result window is not cleaned up when the cursor moves. - This window is not focusable. Solution: Replace the old implementation from autozimu/LanguageClient-neovim with vim.lsp.util.open_floating_preview and implement custom focusing logic. Also remove g:termdebug_useFloatingHover option now that it's working correctly. --- runtime/doc/nvim_terminal_emulator.txt | 8 +- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 165 ++++----------------- 2 files changed, 28 insertions(+), 145 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 67e5e53c95..557e714ddc 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -240,7 +240,7 @@ gdb window and use a "print" command, e.g.: > If mouse pointer movements are working, Vim will also show a balloon when the mouse rests on text that can be evaluated by gdb. You can also use the "K" mapping that will either use Nvim floating windows -if available to show the results or print below the status bar. +to show the results. Now go back to the source window and put the cursor on the first line after the for loop, then type: > @@ -320,6 +320,8 @@ Inspecting variables ~ This is similar to using "print" in the gdb window. You can usually shorten `:Evaluate` to `:Ev`. +The result is displayed in a floating window. +You can move the cursor to this window by running `:Evaluate` (or `K`) again. Navigating stack frames ~ @@ -475,10 +477,6 @@ If the command needs an argument use a List: >vim If there is no g:termdebug_config you can use: >vim let g:termdebugger = ['rr', 'replay', '--'] -To not use Nvim floating windows for previewing variable evaluation, set the -`g:termdebug_useFloatingHover` variable like this: >vim - let g:termdebug_useFloatingHover = 0 - If you are a mouse person, you can also define a mapping using your right click to one of the terminal command like evaluate the variable under the cursor: >vim diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index ee2dc4478e..a253acc63f 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -35,21 +35,14 @@ " The communication with gdb uses GDB/MI. See: " https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html " -" For neovim compatibility, the vim specific calls were replaced with neovim -" specific calls: -" term_start -> termopen -" term_sendkeys -> chansend -" term_getline -> getbufline -" job_info && term_getjob -> using linux command ps to get the tty -" balloon -> nvim floating window +" NEOVIM COMPATIBILITY " -" The code for opening the floating window was taken from the beautiful -" implementation of LanguageClient-Neovim: -" https://github.com/autozimu/LanguageClient-neovim/blob/0ed9b69dca49c415390a8317b19149f97ae093fa/autoload/LanguageClient.vim#L304 -" -" Neovim terminal also works seamlessly on windows, which is why the ability -" Author: Bram Moolenaar -" Copyright: Vim license applies, see ":help license" +" The vim specific functionalities were replaced with neovim specific calls: +" - term_start -> termopen +" - term_sendkeys -> chansend +" - term_getline -> getbufline +" - job_info && term_getjob -> nvim_get_chan_info +" - balloon -> vim.lsp.util.open_floating_preview " In case this gets sourced twice. if exists(':Termdebug') @@ -1313,7 +1306,14 @@ endfunc " :Evaluate - evaluate what is specified / under the cursor func s:Evaluate(range, arg) + if s:eval_float_win_id > 0 && nvim_win_is_valid(s:eval_float_win_id) + \ && a:range == 0 && empty(a:arg) + call nvim_set_current_win(s:eval_float_win_id) + return + endif let expr = s:GetEvaluationExpression(a:range, a:arg) + let s:evalFromBalloonExpr = 1 + let s:evalFromBalloonExprResult = '' let s:ignoreEvalError = 0 call s:SendEval(expr) endfunc @@ -1370,6 +1370,8 @@ let s:ignoreEvalError = 0 let s:evalFromBalloonExpr = 0 let s:evalFromBalloonExprResult = '' +let s:eval_float_win_id = -1 + " Handle the result of data-evaluate-expression func s:HandleEvaluate(msg) let value = a:msg @@ -1392,9 +1394,15 @@ func s:HandleEvaluate(msg) else let s:evalFromBalloonExprResult .= ' = ' . value endif - let s:evalFromBalloonExprResult = split(s:evalFromBalloonExprResult, '\\n') - call s:OpenHoverPreview(s:evalFromBalloonExprResult, v:null) - let s:evalFromBalloonExprResult = '' + " NEOVIM: + " - Result pretty-printing is not implemented. Vim prettifies the result + " with balloon_split(), which is not ported to nvim. + " - Manually implement window focusing. Sometimes the result of pointer + " evaluation arrives in two separate messages, one for the address + " itself and the other for the value in that address. So with the stock + " focus option, the second message will focus the window containing the + " first message. + let s:eval_float_win_id = luaeval('select(2, vim.lsp.util.open_floating_preview(_A))', [s:evalFromBalloonExprResult]) else echomsg '"' . s:evalexpr . '": ' . value endif @@ -1403,132 +1411,9 @@ func s:HandleEvaluate(msg) " Looks like a pointer, also display what it points to. let s:ignoreEvalError = 1 call s:SendEval('*' . s:evalexpr) - else - let s:evalFromBalloonExprResult = '' endif endfunc -function! s:ShouldUseFloatWindow() abort - if exists('*nvim_open_win') && (get(g:, 'termdebug_useFloatingHover', 1) == 1) - return v:true - else - return v:false - endif -endfunction - -function! s:CloseFloatingHoverOnCursorMove(win_id, opened) abort - if getpos('.') == a:opened - " Just after opening floating window, CursorMoved event is run. - " To avoid closing floating window immediately, check the cursor - " was really moved - return - endif - autocmd! nvim_termdebug_close_hover - let winnr = win_id2win(a:win_id) - if winnr == 0 - return - endif - call nvim_win_close(a:win_id, v:true) -endfunction - -function! s:CloseFloatingHoverOnBufEnter(win_id, bufnr) abort - let winnr = win_id2win(a:win_id) - if winnr == 0 - " Float window was already closed - autocmd! nvim_termdebug_close_hover - return - endif - if winnr == winnr() - " Cursor is moving into floating window. Do not close it - return - endif - if bufnr('%') == a:bufnr - " When current buffer opened hover window, it's not another buffer. Skipped - return - endif - autocmd! nvim_termdebug_close_hover - call nvim_win_close(a:win_id, v:true) -endfunction - -" Open preview window. Window is open in: -" - Floating window on Neovim (0.4.0 or later) -" - Preview window on Neovim (0.3.0 or earlier) or Vim -function! s:OpenHoverPreview(lines, filetype) abort - " Use local variable since parameter is not modifiable - let lines = a:lines - let bufnr = bufnr('%') - - let use_float_win = s:ShouldUseFloatWindow() - if use_float_win - let pos = getpos('.') - - " Calculate width and height - let width = 0 - for index in range(len(lines)) - let line = lines[index] - let lw = strdisplaywidth(line) - if lw > width - let width = lw - endif - let lines[index] = line - endfor - - let height = len(lines) - - " Calculate anchor - " Prefer North, but if there is no space, fallback into South - let bottom_line = line('w0') + winheight(0) - 1 - if pos[1] + height <= bottom_line - let vert = 'N' - let row = 1 - else - let vert = 'S' - let row = 0 - endif - - " Prefer West, but if there is no space, fallback into East - if pos[2] + width <= &columns - let hor = 'W' - let col = 0 - else - let hor = 'E' - let col = 1 - endif - - let buf = nvim_create_buf(v:false, v:true) - call nvim_buf_set_lines(buf, 0, -1, v:true, lines) - " using v:true for second argument of nvim_open_win make the floating - " window disappear - let float_win_id = nvim_open_win(buf, v:false, { - \ 'relative': 'cursor', - \ 'anchor': vert . hor, - \ 'row': row, - \ 'col': col, - \ 'width': width, - \ 'height': height, - \ 'style': 'minimal', - \ }) - - if a:filetype isnot v:null - call nvim_set_option_value('filetype', a:filetype, { 'win' : float_win_id }) - endif - - call nvim_set_option_value('modified', v:false, { 'buf' : buf }) - call nvim_set_option_value('modifiable', v:false, { 'buf' : buf }) - - " Unlike preview window, :pclose does not close window. Instead, close - " hover window automatically when cursor is moved. - let call_after_move = printf('CloseFloatingHoverOnCursorMove(%d, %s)', float_win_id, string(pos)) - let call_on_bufenter = printf('CloseFloatingHoverOnBufEnter(%d, %d)', float_win_id, bufnr) - augroup nvim_termdebug_close_hover - execute 'autocmd CursorMoved,CursorMovedI,InsertEnter call ' . call_after_move - execute 'autocmd BufEnter * call ' . call_on_bufenter - augroup END - else - echomsg a:lines[0] - endif -endfunction - " Handle an error. func s:HandleError(msg) if s:ignoreEvalError -- cgit From 3a4aa3fc58f87a295a075fe457bc78805eef7c4d Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 18 Dec 2023 11:04:44 -0600 Subject: refactor: soft-deprecate diagnostic signs configured with :sign-define (#26618) Diagnostic signs should now be configured with vim.diagnostic.config(), but "legacy" sign definitions should go through the standard deprecation process to minimize the impact from breaking changes. --- runtime/doc/deprecated.txt | 3 +++ runtime/doc/diagnostic.txt | 26 ++++++++++++++++------ runtime/doc/news.txt | 3 +++ runtime/lua/vim/diagnostic.lua | 49 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 72 insertions(+), 9 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 0a07f06c75..b0d4b41a98 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -116,6 +116,9 @@ internally and are no longer exposed as part of the API. Instead, use - *vim.lsp.diagnostic.set_underline()* - *vim.lsp.diagnostic.set_virtual_text()* +Configuring |diagnostic-signs| with |:sign-define| or |sign_define()| is no +longer supported. Use the "signs" key of |vim.diagnostic.config()| instead. + LSP FUNCTIONS - *vim.lsp.buf.server_ready()* Use |LspAttach| instead, depending on your use-case. "Server ready" is not diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 94ed578823..fa5ef22e37 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -317,12 +317,24 @@ SIGNS *diagnostic-signs* Signs are defined for each diagnostic severity. The default text for each sign is the first letter of the severity name (for example, "E" for ERROR). Signs -can be customized using the following: >vim +can be customized with |vim.diagnostic.config()|. Example: >lua - sign define DiagnosticSignError text=E texthl=DiagnosticSignError linehl= numhl= - sign define DiagnosticSignWarn text=W texthl=DiagnosticSignWarn linehl= numhl= - sign define DiagnosticSignInfo text=I texthl=DiagnosticSignInfo linehl= numhl= - sign define DiagnosticSignHint text=H texthl=DiagnosticSignHint linehl= numhl= + -- Highlight entire line for errors + -- Highlight the line number for warnings + vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '', + [vim.diagnostic.severity.WARN] = '', + }, + linehl = { + [vim.diagnostic.severity.ERROR] = 'ErrorMsg', + }, + numhl = { + [vim.diagnostic.severity.WARN] = 'WarningMsg', + }, + }, + }) When the "severity_sort" option is set (see |vim.diagnostic.config()|) the priority of each sign depends on the severity of the associated diagnostic. @@ -427,8 +439,8 @@ config({opts}, {namespace}) *vim.diagnostic.config()* end < - • signs: (default true) Use signs for diagnostics. - Options: + • signs: (default true) Use signs for diagnostics + |diagnostic-signs|. Options: • severity: Only show signs for diagnostics matching the given severity |diagnostic-severity| • priority: (number, default 10) Base priority to use diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 925c63f259..7def21941b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -387,6 +387,9 @@ DEPRECATIONS *news-deprecations* The following functions are now deprecated and will be removed in a future release. +• Configuring |diagnostic-signs| using |:sign-define| or |sign_define()|. Use + the "signs" key of |vim.diagnostic.config()| instead. + • Checkhealth functions: - |health#report_error|, |vim.health.report_error()| Use |vim.health.error()| instead. - |health#report_info|, |vim.health.report_info()| Use |vim.health.info()| instead. diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index e4f694b8a2..6d2c212dfc 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -588,7 +588,7 @@ end --- return diagnostic.message --- end --- ---- - signs: (default true) Use signs for diagnostics. Options: +--- - signs: (default true) Use signs for diagnostics |diagnostic-signs|. Options: --- * severity: Only show signs for diagnostics matching the given --- severity |diagnostic-severity| --- * priority: (number, default 10) Base priority to use for signs. When @@ -883,7 +883,52 @@ M.handlers.signs = { api.nvim_create_namespace(string.format('%s/diagnostic/signs', ns.name)) end - local text = {} + --- Handle legacy diagnostic sign definitions + --- These were deprecated in 0.10 and will be removed in 0.12 + if opts.signs and not opts.signs.text and not opts.signs.numhl and not opts.signs.texthl then + for _, v in ipairs({ 'Error', 'Warn', 'Info', 'Hint' }) do + local name = string.format('DiagnosticSign%s', v) + local sign = vim.fn.sign_getdefined(name)[1] + if sign then + local severity = M.severity[v:upper()] + if vim.fn.has('nvim-0.11') == 1 then + vim.deprecate( + 'Defining diagnostic signs with :sign-define or sign_define()', + 'vim.diagnostic.config()', + '0.12', + nil, + false + ) + end + + if not opts.signs.text then + opts.signs.text = {} + end + + if not opts.signs.numhl then + opts.signs.numhl = {} + end + + if not opts.signs.linehl then + opts.signs.linehl = {} + end + + if opts.signs.text[severity] == nil then + opts.signs.text[severity] = sign.text or '' + end + + if opts.signs.numhl[severity] == nil then + opts.signs.numhl[severity] = sign.numhl + end + + if opts.signs.linehl[severity] == nil then + opts.signs.linehl[severity] = sign.linehl + end + end + end + end + + local text = {} ---@type table for k in pairs(M.severity) do if opts.signs.text and opts.signs.text[k] then text[k] = opts.signs.text[k] -- cgit From 428edcde7068ab44040e19b43343741e5ca59770 Mon Sep 17 00:00:00 2001 From: Amanda Graven Date: Tue, 28 Nov 2023 21:05:33 +0100 Subject: feat(api): add forward and back mouse buttons --- runtime/doc/api.txt | 2 +- runtime/doc/news.txt | 2 ++ runtime/lua/vim/_meta/api.lua | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 72ac357ac0..7cb6051020 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1145,7 +1145,7 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col}) Parameters: ~ • {button} Mouse button: one of "left", "right", "middle", "wheel", - "move". + "move", "x1", "x2". • {action} For ordinary buttons, one of "press", "drag", "release". For the wheel, one of "up", "down", "left", "right". Ignored for "move". diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7def21941b..90065349ef 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -268,6 +268,8 @@ The following new APIs and features were added. • 'completeopt' option supports "popup" flags to show extra information in in floating window. +• Added `x1` and `x2` mouse buttons as possible arguments to |nvim_input_mouse()| + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c8afbd58dd..c8c3e1c3af 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1375,7 +1375,7 @@ function vim.api.nvim_input(keys) end --- processed soon by the event loop. --- --- @param button string Mouse button: one of "left", "right", "middle", "wheel", ---- "move". +--- "move", "x1", "x2". --- @param action string For ordinary buttons, one of "press", "drag", "release". --- For the wheel, one of "up", "down", "left", "right". --- Ignored for "move". -- cgit From 693aea0e9e1032aee85d56c1a3f33e0811dbdc18 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 19 Dec 2023 06:29:13 +0100 Subject: docs: small fixes (#26448) Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Jordan Mandel --- runtime/doc/deprecated.txt | 1 - runtime/doc/news.txt | 17 +++++++---------- runtime/doc/nvim_terminal_emulator.txt | 6 +++--- runtime/doc/options.txt | 4 ++-- runtime/lua/vim/_meta/options.lua | 4 ++-- 5 files changed, 14 insertions(+), 18 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index b0d4b41a98..9d32f64aef 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -174,7 +174,6 @@ NORMAL COMMANDS OPTIONS - *cpo-<* *:menu-* *:menu-special* *:map-* *:map-special* `<>` notation is always enabled. -- 'gdefault' Enables the |:substitute| flag 'g' by default. - *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. - *'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed. - *'langnoremap'* Deprecated alias to 'nolangremap'. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 90065349ef..f8d1dea78f 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -15,7 +15,7 @@ BREAKING CHANGES *news-breaking* The following changes may require adaptations in user config or plugins. -• In some cases, the cursor in the Nvim |TUI| would blink even without +• In some cases, the cursor in the Nvim |TUI| used to blink even without configuring 'guicursor' as mentioned in |cursor-blinking|. This was a bug that has now been fixed. If your cursor has stopped blinking, add the following (or similar, adapted to user preference) to your |config| file: >vim @@ -238,7 +238,7 @@ The following new APIs and features were added. • Floating windows can now be hidden by setting `hide` in |nvim_open_win()| or |nvim_win_set_config()|. -• The |:terminal| command now accepts some |:command-modifiers| (specifically +• |:terminal| command now accepts some |:command-modifiers| (specifically |:horizontal| and those that affect splitting a window). • |$NVIM_APPNAME| can be set to a relative path instead of only a name. @@ -259,16 +259,16 @@ The following new APIs and features were added. clipboard is now bundled by default and will be automatically enabled under certain conditions. |clipboard-osc52| -• The 'termsync' option asks the terminal emulator to buffer screen updates - until the redraw cycle is complete. Requires support from the terminal. +• 'termsync' option asks the terminal emulator to buffer screen updates until + the redraw cycle is complete. Requires support from the terminal. • |vim.text.hexencode()| and |vim.text.hexdecode()| convert strings to and from byte representations. -• 'completeopt' option supports "popup" flags to show extra information in - in floating window. +• 'completeopt' option supports "popup" flag to show extra information in a + floating window. -• Added `x1` and `x2` mouse buttons as possible arguments to |nvim_input_mouse()| +• |nvim_input_mouse()| supports mouse buttons "x1" and "x2". ============================================================================== CHANGED FEATURES *news-changed* @@ -359,9 +359,6 @@ The following changes to existing APIs or features add new behavior. • Vimscript function |exists()| supports checking |v:lua| functions. -• Diagnostic sign text is no longer configured with |sign_define()|. - Use |vim.diagnostic.config()| instead. - • Added "force_crlf" option field in |nvim_open_term()|. • Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 557e714ddc..1b42892249 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -140,9 +140,9 @@ Example: >vim - |'channel'| Terminal PTY |job-id|. Can be used with |chansend()| to send input to the terminal. - The |TermClose| event gives the terminal job exit code in the |v:event| - "status" field. For example, this autocmd closes terminal buffers if the job - exited without error: >vim - autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('') | endif + "status" field. For example, this autocommand outputs the terminal's exit + code to |:messages|: >vim + autocmd TermClose * echom 'Terminal exited with status '..v:event.status Use |jobwait()| to check if the terminal job has finished: >vim let running = jobwait([&channel], 0)[0] == -1 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 552ee96047..a3723f7459 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1504,11 +1504,11 @@ 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". - noinsert Do not insert any text for a match until the user selects + 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. - noselect Do not select a match in the menu, force the user to + noselect Do not select a match in the menu, force the user to select one from the menu. Only works in combination with "menu" or "menuone". diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index e63c5bb972..6b7cfa79b3 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1049,11 +1049,11 @@ vim.bo.cfu = vim.bo.completefunc --- completion in the preview window. Only works in --- combination with "menu" or "menuone". --- ---- noinsert Do not insert any text for a match until the user selects +--- 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. --- ---- noselect Do not select a match in the menu, force the user to +--- noselect Do not select a match in the menu, force the user to --- select one from the menu. Only works in combination with --- "menu" or "menuone". --- -- cgit From 90a12d4a164315628c01043108b6aaa8f3afb102 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Mon, 18 Dec 2023 21:02:32 +0900 Subject: fix(treesitter): prepare highlight states for [s, ]s --- runtime/lua/vim/treesitter/highlighter.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 17543bc787..b2cc334bdc 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -163,6 +163,8 @@ end ---@param erow integer exclusive ---@private function TSHighlighter:prepare_highlight_states(srow, erow) + self._highlight_states = {} + self.tree:for_each_tree(function(tstree, tree) if not tstree then return @@ -202,11 +204,6 @@ function TSHighlighter:for_each_highlight_state(fn) end end ----@private -function TSHighlighter:reset_highlight_state() - self._highlight_states = {} -end - ---@package ---@param start_row integer ---@param new_end integer @@ -327,7 +324,7 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _) return end - self:reset_highlight_state() + self:prepare_highlight_states(srow, erow) for row = srow, erow do on_line_impl(self, buf, row, true) @@ -345,7 +342,6 @@ function TSHighlighter._on_win(_, _win, buf, topline, botline) return false end self.tree:parse({ topline, botline + 1 }) - self:reset_highlight_state() self:prepare_highlight_states(topline, botline + 1) self.redraw_count = self.redraw_count + 1 return true -- cgit From f7bc8bd4d1071e824eee21a2ac8ab87965f4a7c6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Dec 2023 23:19:54 +0100 Subject: vim-patch:379df7c1dbb2 runtime(8th): updated 8th syntax (vim/vim#13720) * updated 8th.vim * removed obsolete code https://github.com/vim/vim/commit/379df7c1dbb23d44918c7fbf102c4a0f7bdc2132 Co-authored-by: ronaaron --- runtime/syntax/8th.vim | 683 ++++++++++++++++++++++++++----------------------- 1 file changed, 369 insertions(+), 314 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/8th.vim b/runtime/syntax/8th.vim index 643c9cb095..a88a5a294a 100644 --- a/runtime/syntax/8th.vim +++ b/runtime/syntax/8th.vim @@ -1,26 +1,26 @@ " Vim syntax file " Language: 8th -" Version: 21.08 -" Last Change: 2021 Sep 20 +" Version: 23.09.01 +" Last Change: 2023 Dec 19 " Maintainer: Ron Aaron " URL: https://8th-dev.com/ " Filetypes: *.8th " NOTE: You should also have the ftplugin/8th.vim file to set 'isk' -if version < 600 - syntax clear - finish -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim syn clear -" Synchronization method + syn sync ccomment -syn sync maxlines=100 +syn sync maxlines=200 + syn case match +syn iskeyword 33-255 + syn match eighthColonName "\S\+" contained syn match eighthColonDef ":\s\+\S\+" contains=eighthColonName @@ -34,230 +34,257 @@ syn keyword eighthDefine var var, " Built in words: com! -nargs=+ Builtin syn keyword eighthBuiltin -Builtin args #:args b #:b dhm #:dhm exec# #:exec# id2ns #:id2ns id? #:id? idd #:idd key #:key oa #:oa -Builtin oid #:oid okey #:okey with #:with with! #:with! zip #:zip gen-secret 2fa:gen-secret gen-url 2fa:gen-url -Builtin validate-code 2fa:validate-code ! G:! #! G:#! ## G:## #> G:#> #if G:#if ' G:' ( G:( (* G:(* -Builtin (:) G:(:) (code) G:(code) (defer) G:(defer) (dump) G:(dump) (getc) G:(getc) (gets) G:(gets) + +Builtin gen-secret 2fa:gen-secret gen-url 2fa:gen-url validate-code 2fa:validate-code cb AWS:cb cli AWS:cli +Builtin cmd AWS:cmd cp AWS:cp rc AWS:rc call DBUS:call init DBUS:init + DOM:+ - DOM:- attr! DOM:attr! +Builtin attr@ DOM:attr@ attrs DOM:attrs children DOM:children css-parse DOM:css-parse each DOM:each +Builtin find DOM:find new DOM:new type DOM:type ! G:! !if G:!if #! G:#! ## G:## #if G:#if ' G:' ( G:( +Builtin (* G:(* (:) G:(:) (code) G:(code) (defer) G:(defer) (dump) G:(dump) (getc) G:(getc) (gets) G:(gets) Builtin (interp) G:(interp) (log) G:(log) (needs) G:(needs) (parseln) G:(parseln) (putc) G:(putc) (puts) G:(puts) -Builtin (putslim) G:(putslim) (stat) G:(stat) (with) G:(with) ) G:) +hook G:+hook +listener G:+listener -Builtin +ref G:+ref ,# G:,# -- G:-- -----BEGIN G:-----BEGIN -Inf G:-Inf -Inf? G:-Inf? -hook G:-hook -Builtin -listener G:-listener -ref G:-ref -rot G:-rot . G:. .# G:.# .hook G:.hook .needs G:.needs .r G:.r -Builtin .s G:.s .s-truncate G:.s-truncate .stats G:.stats .ver G:.ver .with G:.with 0; G:0; 2dip G:2dip -Builtin 2drop G:2drop 2dup G:2dup 2over G:2over 2swap G:2swap 3drop G:3drop 3rev G:3rev 4drop G:4drop -Builtin 8thdt? G:8thdt? 8thsku G:8thsku 8thver? G:8thver? 8thvernum? G:8thvernum? : G:: ; G:; ;; G:;; -Builtin ;;; G:;;; ;with G:;with <# G:<# <#> G:<#> >clip G:>clip >json G:>json >kind G:>kind >n G:>n -Builtin >r G:>r >s G:>s ?: G:?: @ G:@ BITMAP: G:BITMAP: ENUM: G:ENUM: FLAG: G:FLAG: Inf G:Inf Inf? G:Inf? -Builtin NaN G:NaN NaN? G:NaN? SED-CHECK G:SED-CHECK SED: G:SED: SED: G:SED: \ G:\ _dup G:_dup _swap G:_swap -Builtin actor: G:actor: again G:again ahead G:ahead and G:and appname G:appname apropos G:apropos argc G:argc -Builtin args G:args array? G:array? assert G:assert base G:base bi G:bi bits G:bits break G:break break? G:break? -Builtin breakif G:breakif build? G:build? buildver? G:buildver? bye G:bye c# G:c# c/does G:c/does case: G:case: -Builtin catch G:catch chdir G:chdir clip> G:clip> clone G:clone clone-shallow G:clone-shallow cold G:cold -Builtin compile G:compile compile? G:compile? compiling? G:compiling? conflict G:conflict const G:const -Builtin container? G:container? counting-allocations G:counting-allocations cr G:cr curlang G:curlang -Builtin curry G:curry curry: G:curry: decimal G:decimal default: G:default: defer: G:defer: deferred: G:deferred: -Builtin deg>rad G:deg>rad depth G:depth die G:die dip G:dip drop G:drop dstack G:dstack dump G:dump -Builtin dup G:dup dup>r G:dup>r dup? G:dup? e# G:e# enum: G:enum: error? G:error? eval G:eval eval! G:eval! -Builtin eval0 G:eval0 execnull G:execnull expect G:expect extra! G:extra! extra@ G:extra@ false G:false -Builtin fnv G:fnv fourth G:fourth free G:free func: G:func: getc G:getc getcwd G:getcwd getenv G:getenv -Builtin gets G:gets handler G:handler header G:header help G:help hex G:hex i: G:i: i; G:i; isa? G:isa? -Builtin items-used G:items-used jcall G:jcall jclass G:jclass jmethod G:jmethod json! G:json! json-8th> G:json-8th> -Builtin json-nesting G:json-nesting json-pretty G:json-pretty json-throw G:json-throw json> G:json> -Builtin json@ G:json@ k32 G:k32 keep G:keep l: G:l: last G:last lib G:lib libbin G:libbin libc G:libc -Builtin listener@ G:listener@ literal G:literal locals: G:locals: lock G:lock lock-to G:lock-to locked? G:locked? -Builtin log G:log log-syslog G:log-syslog log-task G:log-task log-time G:log-time log-time-local G:log-time-local -Builtin long-days G:long-days long-months G:long-months longjmp G:longjmp lookup G:lookup loop G:loop -Builtin loop- G:loop- map? G:map? mark G:mark mark? G:mark? memfree G:memfree mobile? G:mobile? n# G:n# -Builtin name>os G:name>os name>sem G:name>sem ndrop G:ndrop needs G:needs new G:new next-arg G:next-arg -Builtin nip G:nip noop G:noop not G:not nothrow G:nothrow ns G:ns ns: G:ns: ns>ls G:ns>ls ns>s G:ns>s -Builtin ns? G:ns? null G:null null; G:null; null? G:null? number? G:number? of: G:of: off G:off on G:on -Builtin onexit G:onexit only G:only op! G:op! or G:or os G:os os-names G:os-names os>long-name G:os>long-name -Builtin os>name G:os>name over G:over p: G:p: pack G:pack parse G:parse parse-csv G:parse-csv parsech G:parsech -Builtin parseln G:parseln parsews G:parsews pick G:pick poke G:poke pool-clear G:pool-clear pool-clear-all G:pool-clear-all +Builtin (stat) G:(stat) (with) G:(with) ) G:) +hook G:+hook +ref G:+ref ,# G:,# -- G:-- -----BEGIN G:-----BEGIN +Builtin -Inf G:-Inf -Inf? G:-Inf? -hook G:-hook -ref G:-ref -rot G:-rot . G:. .# G:.# .hook G:.hook +Builtin .needs G:.needs .r G:.r .s G:.s .s-truncate G:.s-truncate .stats G:.stats .ver G:.ver .with G:.with +Builtin 0; G:0; 2dip G:2dip 2drop G:2drop 2dup G:2dup 2nip G:2nip 2over G:2over 2swap G:2swap 2tuck G:2tuck +Builtin 3drop G:3drop 3drop G:3drop 3dup G:3dup 3rev G:3rev 4drop G:4drop 8thdt? G:8thdt? 8thsku G:8thsku +Builtin 8thver? G:8thver? 8thvernum? G:8thvernum? : G:: ; G:; ;; G:;; ;;; G:;;; ;with G:;with >clip G:>clip +Builtin >json G:>json >kind G:>kind >n G:>n >r G:>r >s G:>s ?: G:?: ?@ G:?@ @ G:@ BITMAP: G:BITMAP: +Builtin ENUM: G:ENUM: FLAG: G:FLAG: I G:I Inf G:Inf Inf? G:Inf? J G:J K G:K NaN G:NaN NaN? G:NaN? SED-CHECK G:SED-CHECK +Builtin SED: G:SED: SED: G:SED: X G:X \ G:\ _dup G:_dup _swap G:_swap actor: G:actor: again G:again +Builtin ahead G:ahead and G:and apropos G:apropos argc G:argc args G:args array? G:array? assert G:assert +Builtin base G:base base>n G:base>n bi G:bi bits G:bits break G:break break? G:break? breakif G:breakif +Builtin build? G:build? buildver? G:buildver? bye G:bye c/does G:c/does case: G:case: catch G:catch +Builtin chdir G:chdir clip> G:clip> clone G:clone clone-shallow G:clone-shallow cold G:cold compile G:compile +Builtin compile? G:compile? compiling? G:compiling? conflict G:conflict const G:const container? G:container? +Builtin counting-allocations G:counting-allocations cr G:cr critical: G:critical: critical; G:critical; +Builtin curlang G:curlang curry G:curry curry: G:curry: decimal G:decimal default: G:default: defer: G:defer: +Builtin deferred: G:deferred: deg>rad G:deg>rad depth G:depth die G:die dip G:dip drop G:drop dstack G:dstack +Builtin dump G:dump dup G:dup dup>r G:dup>r dup? G:dup? e# G:e# enum: G:enum: error? G:error? eval G:eval +Builtin eval! G:eval! eval0 G:eval0 expect G:expect extra! G:extra! extra@ G:extra@ false G:false fnv G:fnv +Builtin fourth G:fourth free G:free func: G:func: getc G:getc getcwd G:getcwd getenv G:getenv gets G:gets +Builtin handler G:handler header G:header help G:help hex G:hex i: G:i: i; G:i; isa? G:isa? items-used G:items-used +Builtin jcall G:jcall jclass G:jclass jmethod G:jmethod json! G:json! json-8th> G:json-8th> json-nesting G:json-nesting +Builtin json-pretty G:json-pretty json-throw G:json-throw json> G:json> json@ G:json@ k32 G:k32 keep G:keep +Builtin l: G:l: last G:last lib G:lib libbin G:libbin libc G:libc literal G:literal locals: G:locals: +Builtin lock G:lock lock-to G:lock-to locked? G:locked? log G:log log-syslog G:log-syslog log-task G:log-task +Builtin log-time G:log-time log-time-local G:log-time-local long-days G:long-days long-months G:long-months +Builtin longjmp G:longjmp lookup G:lookup loop G:loop loop- G:loop- map? G:map? mark G:mark mark? G:mark? +Builtin mobile? G:mobile? n# G:n# name>os G:name>os name>sem G:name>sem ndrop G:ndrop needs G:needs +Builtin new G:new next-arg G:next-arg nip G:nip noop G:noop not G:not nothrow G:nothrow ns G:ns ns: G:ns: +Builtin ns>ls G:ns>ls ns>s G:ns>s ns? G:ns? null G:null null; G:null; null? G:null? nullvar G:nullvar +Builtin number? G:number? of: G:of: off G:off on G:on onexit G:onexit only G:only op! G:op! or G:or +Builtin os G:os os-names G:os-names os>long-name G:os>long-name os>name G:os>name over G:over p: G:p: +Builtin pack G:pack parse G:parse parse-csv G:parse-csv parse-date G:parse-date parsech G:parsech parseln G:parseln +Builtin parsews G:parsews pick G:pick poke G:poke pool-clear G:pool-clear pool-clear-all G:pool-clear-all Builtin prior G:prior private G:private process-args G:process-args process-args-fancy G:process-args-fancy Builtin process-args-help G:process-args-help process-args-vars G:process-args-vars prompt G:prompt -Builtin public G:public putc G:putc puts G:puts putslim G:putslim quote G:quote r! G:r! r> G:r> r@ G:r@ -Builtin rad>deg G:rad>deg rand-jit G:rand-jit rand-jsf G:rand-jsf rand-native G:rand-native rand-normal G:rand-normal +Builtin public G:public putc G:putc puts G:puts quote G:quote r! G:r! r> G:r> r@ G:r@ rad>deg G:rad>deg +Builtin rand-jit G:rand-jit rand-jsf G:rand-jsf rand-native G:rand-native rand-normal G:rand-normal Builtin rand-pcg G:rand-pcg rand-pcg-seed G:rand-pcg-seed rand-range G:rand-range rand-select G:rand-select Builtin randbuf-pcg G:randbuf-pcg random G:random rdrop G:rdrop recurse G:recurse recurse-stack G:recurse-stack Builtin ref@ G:ref@ reg! G:reg! reg@ G:reg@ regbin@ G:regbin@ remaining-args G:remaining-args repeat G:repeat Builtin required? G:required? requires G:requires reset G:reset roll G:roll rop! G:rop! rot G:rot rpick G:rpick -Builtin rroll G:rroll rstack G:rstack rswap G:rswap rusage G:rusage s>ns G:s>ns same? G:same? scriptdir G:scriptdir -Builtin scriptfile G:scriptfile sem G:sem sem-post G:sem-post sem-rm G:sem-rm sem-wait G:sem-wait sem-wait? G:sem-wait? -Builtin sem>name G:sem>name semi-throw G:semi-throw set-wipe G:set-wipe setenv G:setenv setjmp G:setjmp -Builtin settings! G:settings! settings![] G:settings![] settings@ G:settings@ settings@? G:settings@? -Builtin settings@[] G:settings@[] sh G:sh sh$ G:sh$ short-days G:short-days short-months G:short-months -Builtin sleep G:sleep sleep-until G:sleep-until slog G:slog space G:space stack-check G:stack-check -Builtin stack-size G:stack-size step G:step sthrow G:sthrow string? G:string? struct: G:struct: swap G:swap -Builtin tab-hook G:tab-hook tell-conflict G:tell-conflict tempdir G:tempdir tempfilename G:tempfilename -Builtin third G:third throw G:throw thrownull G:thrownull times G:times tlog G:tlog tri G:tri true G:true -Builtin tuck G:tuck type-check G:type-check typeassert G:typeassert uid G:uid uname G:uname unlock G:unlock -Builtin unpack G:unpack until G:until until! G:until! while G:while while! G:while! with: G:with: word? G:word? -Builtin words G:words words-like G:words-like words/ G:words/ xchg G:xchg xor G:xor >auth HTTP:>auth -Builtin (curry) I:(curry) notimpl I:notimpl sh I:sh trace-word I:trace-word call JSONRPC:call auth-string OAuth:auth-string -Builtin gen-nonce OAuth:gen-nonce params OAuth:params call SOAP:call ! a:! + a:+ - a:- / a:/ 2each a:2each -Builtin 2map a:2map 2map+ a:2map+ 2map= a:2map= = a:= @ a:@ @? a:@? _@ a:_@ all a:all any a:any bsearch a:bsearch -Builtin centroid a:centroid clear a:clear close a:close diff a:diff dot a:dot each a:each each! a:each! -Builtin each-slice a:each-slice exists? a:exists? filter a:filter generate a:generate group a:group -Builtin indexof a:indexof insert a:insert intersect a:intersect join a:join len a:len map a:map map+ a:map+ -Builtin map= a:map= mean a:mean mean&variance a:mean&variance merge a:merge new a:new op! a:op! open a:open -Builtin pop a:pop push a:push qsort a:qsort randeach a:randeach reduce a:reduce reduce+ a:reduce+ remove a:remove -Builtin rev a:rev shift a:shift shuffle a:shuffle slice a:slice slice+ a:slice+ slide a:slide smear a:smear -Builtin sort a:sort union a:union x a:x x-each a:x-each xchg a:xchg y a:y zip a:zip 8thdir app:8thdir -Builtin asset app:asset atrun app:atrun atrun app:atrun atrun app:atrun basedir app:basedir current app:current -Builtin datadir app:datadir exename app:exename lowmem app:lowmem main app:main name app:name oncrash app:oncrash +Builtin rreset G:rreset rroll G:rroll rstack G:rstack rswap G:rswap rusage G:rusage s>ns G:s>ns same? G:same? +Builtin scriptdir G:scriptdir scriptfile G:scriptfile sem G:sem sem-post G:sem-post sem-rm G:sem-rm +Builtin sem-wait G:sem-wait sem-wait? G:sem-wait? sem>name G:sem>name semi-throw G:semi-throw set-wipe G:set-wipe +Builtin setenv G:setenv setjmp G:setjmp settings! G:settings! settings![] G:settings![] settings@ G:settings@ +Builtin settings@? G:settings@? settings@[] G:settings@[] sh G:sh sh$ G:sh$ short-days G:short-days +Builtin short-months G:short-months sleep G:sleep sleep-msec G:sleep-msec sleep-until G:sleep-until +Builtin slog G:slog space G:space stack-check G:stack-check stack-size G:stack-size step G:step sthrow G:sthrow +Builtin string? G:string? struct: G:struct: swap G:swap tab-hook G:tab-hook tell-conflict G:tell-conflict +Builtin tempdir G:tempdir tempfilename G:tempfilename third G:third throw G:throw thrownull G:thrownull +Builtin times G:times tlog G:tlog tri G:tri true G:true tuck G:tuck type-check G:type-check typeassert G:typeassert +Builtin uid G:uid uname G:uname unlock G:unlock unpack G:unpack until G:until until! G:until! while G:while +Builtin while! G:while! with: G:with: word? G:word? words G:words words-like G:words-like words/ G:words/ +Builtin xchg G:xchg xor G:xor >auth HTTP:>auth (curry) I:(curry) notimpl I:notimpl sh I:sh trace-word I:trace-word +Builtin call JSONRPC:call auth-string OAuth:auth-string gen-nonce OAuth:gen-nonce params OAuth:params +Builtin call SOAP:call ! a:! + a:+ - a:- / a:/ 2each a:2each 2map a:2map 2map+ a:2map+ 2map= a:2map= +Builtin <> a:<> = a:= @ a:@ @? a:@? _@ a:_@ all a:all any a:any bsearch a:bsearch centroid a:centroid +Builtin clear a:clear close a:close cmp a:cmp diff a:diff dot a:dot each a:each each! a:each! each-par a:each-par +Builtin each-slice a:each-slice exists? a:exists? filter a:filter filter-par a:filter-par generate a:generate +Builtin group a:group indexof a:indexof insert a:insert intersect a:intersect join a:join len a:len +Builtin map a:map map+ a:map+ map-par a:map-par map= a:map= maxlen a:maxlen mean a:mean mean&variance a:mean&variance +Builtin merge a:merge new a:new op! a:op! open a:open pigeon a:pigeon pivot a:pivot pop a:pop push a:push +Builtin qsort a:qsort randeach a:randeach reduce a:reduce reduce+ a:reduce+ remove a:remove rev a:rev +Builtin rindexof a:rindexof shift a:shift shuffle a:shuffle slice a:slice slice+ a:slice+ slide a:slide +Builtin smear a:smear sort a:sort split a:split squash a:squash switch a:switch union a:union uniq a:uniq +Builtin unzip a:unzip x a:x x-each a:x-each xchg a:xchg y a:y zip a:zip 8thdir app:8thdir asset app:asset +Builtin atrun app:atrun atrun app:atrun atrun app:atrun basedir app:basedir basename app:basename config-file-name app:config-file-name +Builtin current app:current datadir app:datadir display-moved app:display-moved exename app:exename +Builtin localechanged app:localechanged lowmem app:lowmem main app:main name app:name oncrash app:oncrash Builtin opts! app:opts! opts@ app:opts@ orientation app:orientation orientation! app:orientation! pid app:pid -Builtin post-main app:post-main pre-main app:pre-main raise app:raise request-perm app:request-perm +Builtin post-main app:post-main pre-main app:pre-main privdir app:privdir raise app:raise read-config app:read-config +Builtin read-config-map app:read-config-map read-config-var app:read-config-var request-perm app:request-perm Builtin restart app:restart resumed app:resumed signal app:signal standalone app:standalone subdir app:subdir -Builtin suspended app:suspended sysquit app:sysquit terminated app:terminated trap app:trap (here) asm:(here) -Builtin >n asm:>n avail asm:avail c, asm:c, here! asm:here! n> asm:n> used asm:used w, asm:w, ! b:! -Builtin + b:+ / b:/ 1+ b:1+ 1- b:1- = b:= >base16 b:>base16 >base32 b:>base32 >base64 b:>base64 >base85 b:>base85 -Builtin >hex b:>hex >mpack b:>mpack @ b:@ append b:append base16> b:base16> base32> b:base32> base64> b:base64> -Builtin base85> b:base85> bit! b:bit! bit@ b:bit@ clear b:clear compress b:compress conv b:conv each b:each -Builtin each! b:each! each-slice b:each-slice expand b:expand fill b:fill getb b:getb hex> b:hex> len b:len -Builtin mem> b:mem> move b:move mpack-compat b:mpack-compat mpack-date b:mpack-date mpack-ignore b:mpack-ignore -Builtin mpack> b:mpack> n! b:n! n+ b:n+ n@ b:n@ new b:new op b:op pad b:pad rev b:rev search b:search -Builtin shmem b:shmem slice b:slice splice b:splice ungetb b:ungetb unpad b:unpad writable b:writable -Builtin xor b:xor +block bc:+block .blocks bc:.blocks add-block bc:add-block block-hash bc:block-hash -Builtin block@ bc:block@ first-block bc:first-block hash bc:hash last-block bc:last-block load bc:load -Builtin new bc:new save bc:save set-sql bc:set-sql validate bc:validate validate-block bc:validate-block -Builtin add bloom:add filter bloom:filter in? bloom:in? accept bt:accept ch! bt:ch! ch@ bt:ch@ connect bt:connect -Builtin disconnect bt:disconnect init bt:init leconnect bt:leconnect lescan bt:lescan listen bt:listen -Builtin on? bt:on? read bt:read scan bt:scan service? bt:service? services? bt:services? write bt:write -Builtin * c:* * c:* + c:+ + c:+ = c:= = c:= >ri c:>ri >ri c:>ri abs c:abs abs c:abs arg c:arg arg c:arg -Builtin conj c:conj conj c:conj im c:im n> c:n> new c:new new c:new re c:re >redir con:>redir accept con:accept -Builtin accept-pwd con:accept-pwd ansi? con:ansi? black con:black blue con:blue clreol con:clreol cls con:cls -Builtin cyan con:cyan down con:down free con:free getxy con:getxy gotoxy con:gotoxy green con:green -Builtin key con:key key? con:key? left con:left load-history con:load-history magenta con:magenta onBlack con:onBlack -Builtin onBlue con:onBlue onCyan con:onCyan onGreen con:onGreen onMagenta con:onMagenta onRed con:onRed -Builtin onWhite con:onWhite onYellow con:onYellow print con:print red con:red redir> con:redir> redir? con:redir? -Builtin right con:right save-history con:save-history size? con:size? up con:up white con:white yellow con:yellow -Builtin >aes128gcm cr:>aes128gcm >aes256gcm cr:>aes256gcm >cp cr:>cp >cpe cr:>cpe >decrypt cr:>decrypt -Builtin >edbox cr:>edbox >encrypt cr:>encrypt >nbuf cr:>nbuf >rsabox cr:>rsabox >uuid cr:>uuid CBC cr:CBC -Builtin CFB cr:CFB CTR cr:CTR ECB cr:ECB GCM cr:GCM OFB cr:OFB aad? cr:aad? aes128box-sig cr:aes128box-sig -Builtin aes128gcm> cr:aes128gcm> aes256box-sig cr:aes256box-sig aes256gcm> cr:aes256gcm> aesgcm cr:aesgcm -Builtin blakehash cr:blakehash chacha20box-sig cr:chacha20box-sig chachapoly cr:chachapoly cipher! cr:cipher! -Builtin cipher@ cr:cipher@ cp> cr:cp> cpe> cr:cpe> decrypt cr:decrypt decrypt+ cr:decrypt+ decrypt> cr:decrypt> -Builtin dh-genkey cr:dh-genkey dh-secret cr:dh-secret dh-sign cr:dh-sign dh-verify cr:dh-verify ebox-sig cr:ebox-sig -Builtin ecc-genkey cr:ecc-genkey ecc-secret cr:ecc-secret ecc-sign cr:ecc-sign ecc-verify cr:ecc-verify -Builtin edbox-sig cr:edbox-sig edbox> cr:edbox> encrypt cr:encrypt encrypt+ cr:encrypt+ encrypt> cr:encrypt> -Builtin ensurekey cr:ensurekey gcm-tag-size cr:gcm-tag-size genkey cr:genkey hash cr:hash hash! cr:hash! -Builtin hash+ cr:hash+ hash>b cr:hash>b hash>s cr:hash>s hash@ cr:hash@ hmac cr:hmac hotp cr:hotp iv? cr:iv? -Builtin mode cr:mode mode@ cr:mode@ rand cr:rand randbuf cr:randbuf randkey cr:randkey restore cr:restore +Builtin suspended app:suspended sysquit app:sysquit terminated app:terminated timeout app:timeout trap app:trap +Builtin dawn astro:dawn do-dawn astro:do-dawn do-dusk astro:do-dusk do-rise astro:do-rise dusk astro:dusk +Builtin latitude astro:latitude location! astro:location! longitude astro:longitude sunrise astro:sunrise +Builtin genkeys auth:genkeys secret auth:secret session-id auth:session-id session-key auth:session-key +Builtin validate auth:validate ! b:! + b:+ / b:/ 1+ b:1+ 1- b:1- <> b:<> = b:= >base16 b:>base16 >base32 b:>base32 +Builtin >base64 b:>base64 >base85 b:>base85 >hex b:>hex >mpack b:>mpack @ b:@ append b:append base16> b:base16> +Builtin base32> b:base32> base64> b:base64> base85> b:base85> bit! b:bit! bit@ b:bit@ clear b:clear +Builtin compress b:compress conv b:conv each b:each each! b:each! each-slice b:each-slice expand b:expand +Builtin fill b:fill getb b:getb hex> b:hex> len b:len mem> b:mem> move b:move mpack-compat b:mpack-compat +Builtin mpack-date b:mpack-date mpack-ignore b:mpack-ignore mpack> b:mpack> n! b:n! n+ b:n+ n@ b:n@ +Builtin new b:new op b:op op! b:op! pad b:pad rev b:rev search b:search shmem b:shmem slice b:slice +Builtin splice b:splice ungetb b:ungetb unpad b:unpad writable b:writable xor b:xor +block bc:+block +Builtin .blocks bc:.blocks add-block bc:add-block block-hash bc:block-hash block@ bc:block@ first-block bc:first-block +Builtin hash bc:hash last-block bc:last-block load bc:load new bc:new save bc:save set-sql bc:set-sql +Builtin validate bc:validate validate-block bc:validate-block add bloom:add filter bloom:filter in? bloom:in? +Builtin parse bson:parse accept bt:accept ch! bt:ch! ch@ bt:ch@ connect bt:connect disconnect bt:disconnect +Builtin init bt:init leconnect bt:leconnect lescan bt:lescan listen bt:listen on? bt:on? read bt:read +Builtin scan bt:scan service? bt:service? services? bt:services? write bt:write * c:* * c:* + c:+ + c:+ +Builtin = c:= = c:= >ri c:>ri >ri c:>ri abs c:abs abs c:abs arg c:arg arg c:arg conj c:conj conj c:conj +Builtin im c:im n> c:n> new c:new new c:new re c:re (.hebrew) cal:(.hebrew) (.islamic) cal:(.islamic) +Builtin .hebrew cal:.hebrew .islamic cal:.islamic >hebepoch cal:>hebepoch >jdn cal:>jdn Adar cal:Adar +Builtin Adar2 cal:Adar2 Adar2 cal:Adar2 Av cal:Av Elul cal:Elul Heshvan cal:Heshvan Iyar cal:Iyar Kislev cal:Kislev +Builtin Nissan cal:Nissan Shevat cal:Shevat Sivan cal:Sivan Tammuz cal:Tammuz Tevet cal:Tevet Tishrei cal:Tishrei +Builtin days-in-hebrew-year cal:days-in-hebrew-year displaying-hebrew cal:displaying-hebrew fixed>hebrew cal:fixed>hebrew +Builtin fixed>islamic cal:fixed>islamic gershayim cal:gershayim hanukkah cal:hanukkah hebrew-epoch cal:hebrew-epoch +Builtin hebrew>fixed cal:hebrew>fixed hebrewtoday cal:hebrewtoday hmonth-name cal:hmonth-name islamic.epoch cal:islamic.epoch +Builtin islamic>fixed cal:islamic>fixed islamictoday cal:islamictoday jdn> cal:jdn> last-day-of-hebrew-month cal:last-day-of-hebrew-month +Builtin number>hebrew cal:number>hebrew omer cal:omer pesach cal:pesach purim cal:purim rosh-chodesh? cal:rosh-chodesh? +Builtin rosh-hashanah cal:rosh-hashanah shavuot cal:shavuot taanit-esther cal:taanit-esther tisha-beav cal:tisha-beav +Builtin yom-haatsmaut cal:yom-haatsmaut yom-kippur cal:yom-kippur >redir con:>redir accept con:accept +Builtin accept-nl con:accept-nl accept-pwd con:accept-pwd alert con:alert ansi? con:ansi? black con:black +Builtin blue con:blue clreol con:clreol cls con:cls ctrld-empty con:ctrld-empty cyan con:cyan down con:down +Builtin file>history con:file>history free con:free getxy con:getxy gotoxy con:gotoxy green con:green +Builtin history-handler con:history-handler history>file con:history>file key con:key key? con:key? +Builtin left con:left load-history con:load-history magenta con:magenta max-history con:max-history +Builtin onBlack con:onBlack onBlue con:onBlue onCyan con:onCyan onGreen con:onGreen onMagenta con:onMagenta +Builtin onRed con:onRed onWhite con:onWhite onYellow con:onYellow print con:print red con:red redir> con:redir> +Builtin redir? con:redir? right con:right save-history con:save-history size? con:size? up con:up white con:white +Builtin yellow con:yellow >aes128gcm cr:>aes128gcm >aes256gcm cr:>aes256gcm >cp cr:>cp >cpe cr:>cpe +Builtin >decrypt cr:>decrypt >edbox cr:>edbox >encrypt cr:>encrypt >nbuf cr:>nbuf >rsabox cr:>rsabox +Builtin >uuid cr:>uuid aad? cr:aad? aes128box-sig cr:aes128box-sig aes128gcm> cr:aes128gcm> aes256box-sig cr:aes256box-sig +Builtin aes256gcm> cr:aes256gcm> aesgcm cr:aesgcm blakehash cr:blakehash chacha20box-sig cr:chacha20box-sig +Builtin chachapoly cr:chachapoly cipher! cr:cipher! cipher@ cr:cipher@ ciphers cr:ciphers cp> cr:cp> +Builtin cpe> cr:cpe> decrypt cr:decrypt decrypt+ cr:decrypt+ decrypt> cr:decrypt> ebox-sig cr:ebox-sig +Builtin ecc-curves cr:ecc-curves ecc-genkey cr:ecc-genkey ecc-secret cr:ecc-secret ecc-sign cr:ecc-sign +Builtin ecc-verify cr:ecc-verify ed25519 cr:ed25519 ed25519-secret cr:ed25519-secret ed25519-sign cr:ed25519-sign +Builtin ed25519-verify cr:ed25519-verify edbox-sig cr:edbox-sig edbox> cr:edbox> encrypt cr:encrypt +Builtin encrypt+ cr:encrypt+ encrypt> cr:encrypt> ensurekey cr:ensurekey genkey cr:genkey hash cr:hash +Builtin hash! cr:hash! hash+ cr:hash+ hash>b cr:hash>b hash>s cr:hash>s hash@ cr:hash@ hashes cr:hashes +Builtin hmac cr:hmac hotp cr:hotp iv? cr:iv? pem-read cr:pem-read pem-write cr:pem-write pwd-valid? cr:pwd-valid? +Builtin pwd/ cr:pwd/ pwd>hash cr:pwd>hash rand cr:rand randbuf cr:randbuf randkey cr:randkey restore cr:restore Builtin root-certs cr:root-certs rsa_decrypt cr:rsa_decrypt rsa_encrypt cr:rsa_encrypt rsa_sign cr:rsa_sign Builtin rsa_verify cr:rsa_verify rsabox-sig cr:rsabox-sig rsabox> cr:rsabox> rsagenkey cr:rsagenkey Builtin save cr:save sbox-sig cr:sbox-sig sha1-hmac cr:sha1-hmac shard cr:shard tag? cr:tag? totp cr:totp Builtin totp-epoch cr:totp-epoch totp-time-step cr:totp-time-step unshard cr:unshard uuid cr:uuid uuid> cr:uuid> -Builtin validate-pgp-sig cr:validate-pgp-sig (.hebrew) d:(.hebrew) (.islamic) d:(.islamic) + d:+ +day d:+day -Builtin +hour d:+hour +min d:+min +msec d:+msec - d:- .hebrew d:.hebrew .islamic d:.islamic .time d:.time -Builtin / d:/ = d:= >fixed d:>fixed >hebepoch d:>hebepoch >jdn d:>jdn >msec d:>msec >unix d:>unix >ymd d:>ymd -Builtin ?= d:?= Adar d:Adar Adar2 d:Adar2 Adar2 d:Adar2 Av d:Av Elul d:Elul Fri d:Fri Heshvan d:Heshvan -Builtin Iyar d:Iyar Kislev d:Kislev Mon d:Mon Nissan d:Nissan Sat d:Sat Shevat d:Shevat Sivan d:Sivan -Builtin Sun d:Sun Tammuz d:Tammuz Tevet d:Tevet Thu d:Thu Tishrei d:Tishrei Tue d:Tue Wed d:Wed adjust-dst d:adjust-dst -Builtin approx! d:approx! approx? d:approx? approximates! d:approximates! between d:between d. d:d. -Builtin dawn d:dawn days-in-hebrew-year d:days-in-hebrew-year displaying-hebrew d:displaying-hebrew -Builtin do-dawn d:do-dawn do-dusk d:do-dusk do-rise d:do-rise doy d:doy dst? d:dst? dstquery d:dstquery -Builtin dstzones? d:dstzones? dusk d:dusk elapsed-timer d:elapsed-timer elapsed-timer-seconds d:elapsed-timer-seconds -Builtin first-dow d:first-dow fixed> d:fixed> fixed>dow d:fixed>dow fixed>hebrew d:fixed>hebrew fixed>islamic d:fixed>islamic -Builtin format d:format hanukkah d:hanukkah hebrew-epoch d:hebrew-epoch hebrew>fixed d:hebrew>fixed -Builtin hebrewtoday d:hebrewtoday hmonth-name d:hmonth-name islamic.epoch d:islamic.epoch islamic>fixed d:islamic>fixed -Builtin islamictoday d:islamictoday jdn> d:jdn> join d:join last-day-of-hebrew-month d:last-day-of-hebrew-month -Builtin last-dow d:last-dow last-month d:last-month last-week d:last-week last-year d:last-year latitude d:latitude -Builtin longitude d:longitude longitude d:longitude msec d:msec msec> d:msec> new d:new next-dow d:next-dow -Builtin next-month d:next-month next-week d:next-week next-year d:next-year number>hebrew d:number>hebrew -Builtin omer d:omer parse d:parse parse-approx d:parse-approx parse-range d:parse-range pesach d:pesach -Builtin prev-dow d:prev-dow purim d:purim rosh-chodesh? d:rosh-chodesh? rosh-hashanah d:rosh-hashanah -Builtin shavuot d:shavuot start-timer d:start-timer sunrise d:sunrise taanit-esther d:taanit-esther -Builtin ticks d:ticks ticks/sec d:ticks/sec timer d:timer timer-ctrl d:timer-ctrl tisha-beav d:tisha-beav -Builtin tzadjust d:tzadjust unix> d:unix> unknown d:unknown unknown? d:unknown? updatetz d:updatetz -Builtin year@ d:year@ ymd d:ymd ymd> d:ymd> yom-haatsmaut d:yom-haatsmaut yom-kippur d:yom-kippur add-func db:add-func -Builtin aes! db:aes! begin db:begin bind db:bind bind-exec db:bind-exec bind-exec[] db:bind-exec[] -Builtin close db:close col db:col col[] db:col[] col{} db:col{} commit db:commit each db:each exec db:exec -Builtin exec-cb db:exec-cb exec-name db:exec-name get db:get get-sub db:get-sub key db:key kind? db:kind? -Builtin last-rowid db:last-rowid mysql? db:mysql? odbc? db:odbc? open db:open open? db:open? prep-name db:prep-name -Builtin prepare db:prepare query db:query query-all db:query-all rekey db:rekey rollback db:rollback -Builtin set db:set set-sub db:set-sub sql@ db:sql@ bp dbg:bp except-task@ dbg:except-task@ go dbg:go -Builtin line-info dbg:line-info prompt dbg:prompt stop dbg:stop trace dbg:trace trace-enter dbg:trace-enter -Builtin trace-leave dbg:trace-leave / f:/ abspath f:abspath absrel f:absrel append f:append associate f:associate -Builtin atime f:atime canwrite? f:canwrite? chmod f:chmod close f:close copy f:copy copydir f:copydir +Builtin validate-pgp-sig cr:validate-pgp-sig validate-pwd cr:validate-pwd + d:+ +day d:+day +hour d:+hour +Builtin +min d:+min +msec d:+msec - d:- .time d:.time / d:/ = d:= >fixed d:>fixed >hmds d:>hmds >hmds: d:>hmds: +Builtin >msec d:>msec >unix d:>unix >ymd d:>ymd ?= d:?= Fri d:Fri Mon d:Mon Sat d:Sat Sun d:Sun Thu d:Thu +Builtin Tue d:Tue Wed d:Wed adjust-dst d:adjust-dst alarm d:alarm approx! d:approx! approx? d:approx? +Builtin approximates! d:approximates! between d:between cmp d:cmp d. d:d. default-now d:default-now +Builtin doy d:doy dst-ofs d:dst-ofs dst? d:dst? dstinfo d:dstinfo dstquery d:dstquery dstzones? d:dstzones? +Builtin elapsed-timer d:elapsed-timer elapsed-timer-hmds d:elapsed-timer-hmds elapsed-timer-msec d:elapsed-timer-msec +Builtin elapsed-timer-seconds d:elapsed-timer-seconds first-dow d:first-dow fixed> d:fixed> fixed>dow d:fixed>dow +Builtin format d:format join d:join last-dow d:last-dow last-month d:last-month last-week d:last-week +Builtin last-year d:last-year msec d:msec msec> d:msec> new d:new next-dow d:next-dow next-month d:next-month +Builtin next-week d:next-week next-year d:next-year parse d:parse parse-approx d:parse-approx parse-range d:parse-range +Builtin prev-dow d:prev-dow rfc5322 d:rfc5322 start-timer d:start-timer ticks d:ticks ticks/sec d:ticks/sec +Builtin timer d:timer timer-ctrl d:timer-ctrl tzadjust d:tzadjust unix> d:unix> unknown d:unknown unknown? d:unknown? +Builtin updatetz d:updatetz year@ d:year@ ymd d:ymd ymd> d:ymd> add-func db:add-func aes! db:aes! again? db:again? +Builtin begin db:begin bind db:bind bind-exec db:bind-exec bind-exec{} db:bind-exec{} close db:close +Builtin col db:col col{} db:col{} commit db:commit db db:db dbpush db:dbpush disuse db:disuse each db:each +Builtin err-handler db:err-handler exec db:exec exec-cb db:exec-cb exec-name db:exec-name exec{} db:exec{} +Builtin get db:get get-sub db:get-sub key db:key kind? db:kind? last-rowid db:last-rowid mysql? db:mysql? +Builtin odbc? db:odbc? open db:open open? db:open? prep-name db:prep-name prepare db:prepare query db:query +Builtin query-all db:query-all rekey db:rekey rollback db:rollback set db:set set-sub db:set-sub sql@ db:sql@ +Builtin sql[] db:sql[] sql[np] db:sql[np] sql{np} db:sql{np} sql{} db:sql{} use db:use zip db:zip bp dbg:bp +Builtin bt dbg:bt except-task@ dbg:except-task@ go dbg:go line-info dbg:line-info prompt dbg:prompt +Builtin stop dbg:stop trace dbg:trace trace-enter dbg:trace-enter trace-leave dbg:trace-leave / f:/ +Builtin >posix f:>posix abspath f:abspath absrel f:absrel append f:append associate f:associate atime f:atime +Builtin autodel f:autodel canwrite? f:canwrite? chmod f:chmod close f:close copy f:copy copydir f:copydir Builtin create f:create ctime f:ctime dir? f:dir? dname f:dname eachbuf f:eachbuf eachline f:eachline -Builtin enssep f:enssep eof? f:eof? exists? f:exists? flush f:flush fname f:fname getb f:getb getc f:getc -Builtin getline f:getline getmod f:getmod glob f:glob glob-nocase f:glob-nocase homedir f:homedir homedir! f:homedir! -Builtin include f:include ioctl f:ioctl join f:join launch f:launch link f:link link> f:link> link? f:link? -Builtin mkdir f:mkdir mmap f:mmap mmap-range f:mmap-range mmap-range? f:mmap-range? mtime f:mtime mv f:mv -Builtin name@ f:name@ open f:open open-ro f:open-ro popen f:popen print f:print read f:read read? f:read? -Builtin relpath f:relpath rglob f:rglob rm f:rm rmdir f:rmdir seek f:seek sep f:sep size f:size slurp f:slurp -Builtin sparse? f:sparse? spit f:spit stderr f:stderr stdin f:stdin stdout f:stdout tell f:tell times f:times -Builtin tmpspit f:tmpspit trash f:trash truncate f:truncate ungetb f:ungetb ungetc f:ungetc unzip f:unzip -Builtin unzip-entry f:unzip-entry watch f:watch write f:write writen f:writen zip+ f:zip+ zip@ f:zip@ -Builtin zipentry f:zipentry zipnew f:zipnew zipopen f:zipopen zipsave f:zipsave atlas! font:atlas! -Builtin atlas@ font:atlas@ default-size font:default-size info font:info ls font:ls measure font:measure -Builtin new font:new oversample font:oversample pixels font:pixels pixels? font:pixels? +edge gr:+edge -Builtin +edge+w gr:+edge+w +node gr:+node connect gr:connect edges gr:edges edges! gr:edges! m! gr:m! -Builtin m@ gr:m@ neighbors gr:neighbors new gr:new node-edges gr:node-edges nodes gr:nodes traverse gr:traverse -Builtin weight! gr:weight! + h:+ clear h:clear cmp! h:cmp! len h:len max! h:max! new h:new peek h:peek -Builtin pop h:pop push h:push unique h:unique arm? hw:arm? camera hw:camera camera-img hw:camera-img -Builtin camera-limits hw:camera-limits camera? hw:camera? cpu? hw:cpu? device? hw:device? displays? hw:displays? -Builtin displaysize? hw:displaysize? finger-match hw:finger-match finger-support hw:finger-support -Builtin gpio hw:gpio gpio! hw:gpio! gpio-mmap hw:gpio-mmap gpio@ hw:gpio@ i2c hw:i2c i2c! hw:i2c! i2c!reg hw:i2c!reg -Builtin i2c@ hw:i2c@ i2c@reg hw:i2c@reg isround? hw:isround? iswatch? hw:iswatch? mac? hw:mac? mem? hw:mem? -Builtin model? hw:model? poll hw:poll sensor hw:sensor start hw:start stop hw:stop uid? hw:uid? fetch-full imap:fetch-full -Builtin fetch-uid-mail imap:fetch-uid-mail login imap:login logout imap:logout new imap:new search imap:search -Builtin select-inbox imap:select-inbox >file img:>file >fmt img:>fmt copy img:copy crop img:crop data img:data -Builtin desat img:desat fill img:fill fillrect img:fillrect filter img:filter flip img:flip from-svg img:from-svg -Builtin new img:new pix! img:pix! pix@ img:pix@ qr-gen img:qr-gen qr-parse img:qr-parse rotate img:rotate -Builtin scale img:scale scroll img:scroll size img:size countries iso:countries find loc:find sort loc:sort -Builtin ! m:! !? m:!? + m:+ +? m:+? - m:- >arr m:>arr @ m:@ @? m:@? _! m:_! _@ m:_@ arr> m:arr> bitmap m:bitmap -Builtin clear m:clear data m:data each m:each exists? m:exists? filter m:filter iter m:iter iter-all m:iter-all -Builtin keys m:keys len m:len map m:map merge m:merge new m:new op! m:op! open m:open slice m:slice -Builtin vals m:vals xchg m:xchg zip m:zip ! mat:! * mat:* + mat:+ = mat:= @ mat:@ affine mat:affine -Builtin col mat:col data mat:data det mat:det dim? mat:dim? get-n mat:get-n ident mat:ident inv mat:inv -Builtin m. mat:m. minor mat:minor n* mat:n* new mat:new new-minor mat:new-minor rotate mat:rotate row mat:row -Builtin same-size? mat:same-size? scale mat:scale shear mat:shear trans mat:trans translate mat:translate -Builtin xform mat:xform 2console md:2console 2html md:2html 2nk md:2nk bounds meta:bounds color meta:color -Builtin console meta:console end meta:end ffi meta:ffi ! n:! * n:* */ n:*/ + n:+ +! n:+! - n:- / n:/ -Builtin /mod n:/mod 1+ n:1+ 1- n:1- < n:< = n:= > n:> BIGE n:BIGE BIGPI n:BIGPI E n:E PI n:PI ^ n:^ -Builtin _mod n:_mod abs n:abs acos n:acos acos n:acos asin n:asin asin n:asin atan n:atan atan n:atan -Builtin atan2 n:atan2 band n:band between n:between bfloat n:bfloat bic n:bic bint n:bint binv n:binv -Builtin bnot n:bnot bor n:bor bxor n:bxor cast n:cast ceil n:ceil clamp n:clamp cmp n:cmp comb n:comb -Builtin cos n:cos cosd n:cosd emod n:emod exp n:exp expm1 n:expm1 expmod n:expmod float n:float floor n:floor -Builtin fmod n:fmod frac n:frac gcd n:gcd int n:int invmod n:invmod kind? n:kind? lcm n:lcm ln n:ln -Builtin ln1p n:ln1p max n:max median n:median min n:min mod n:mod neg n:neg odd? n:odd? perm n:perm -Builtin prime? n:prime? quantize n:quantize quantize! n:quantize! r+ n:r+ range n:range rot32l n:rot32l -Builtin rot32r n:rot32r round n:round round2 n:round2 rounding n:rounding running-variance n:running-variance -Builtin running-variance-finalize n:running-variance-finalize sgn n:sgn shl n:shl shr n:shr sin n:sin -Builtin sind n:sind sqr n:sqr sqrt n:sqrt tan n:tan tand n:tand trunc n:trunc ~= n:~= ! net:! !? net:!? -Builtin - net:- >url net:>url @ net:@ @? net:@? DGRAM net:DGRAM INET4 net:INET4 INET6 net:INET6 PROTO_TCP net:PROTO_TCP -Builtin PROTO_UDP net:PROTO_UDP STREAM net:STREAM accept net:accept addrinfo>o net:addrinfo>o again? net:again? -Builtin alloc-and-read net:alloc-and-read alloc-buf net:alloc-buf bind net:bind close net:close closed? net:closed? -Builtin connect net:connect debug? net:debug? delete net:delete get net:get getaddrinfo net:getaddrinfo -Builtin getpeername net:getpeername head net:head ifaces? net:ifaces? listen net:listen map>url net:map>url -Builtin net-socket net:net-socket opts net:opts port-is-ssl? net:port-is-ssl? post net:post proxy! net:proxy! -Builtin put net:put read net:read read-all net:read-all recvfrom net:recvfrom s>url net:s>url sendto net:sendto -Builtin server net:server setsockopt net:setsockopt socket net:socket tlshello net:tlshello url> net:url> -Builtin user-agent net:user-agent wait net:wait write net:write (begin) nk:(begin) (chart-begin) nk:(chart-begin) -Builtin (chart-begin-colored) nk:(chart-begin-colored) (chart-end) nk:(chart-end) (end) nk:(end) (group-begin) nk:(group-begin) -Builtin (group-end) nk:(group-end) (property) nk:(property) >img nk:>img addfont nk:addfont anti-alias nk:anti-alias -Builtin any-clicked? nk:any-clicked? bounds nk:bounds bounds! nk:bounds! button nk:button button-color nk:button-color -Builtin button-label nk:button-label button-set-behavior nk:button-set-behavior button-symbol nk:button-symbol -Builtin button-symbol-label nk:button-symbol-label chart-add-slot nk:chart-add-slot chart-add-slot-colored nk:chart-add-slot-colored -Builtin chart-push nk:chart-push chart-push-slot nk:chart-push-slot checkbox nk:checkbox clicked? nk:clicked? -Builtin close-this! nk:close-this! close-this? nk:close-this? close? nk:close? color-picker nk:color-picker -Builtin combo nk:combo combo-begin-color nk:combo-begin-color combo-begin-label nk:combo-begin-label +Builtin enssep f:enssep eof? f:eof? exec f:exec exists? f:exists? flush f:flush fname f:fname getb f:getb +Builtin getc f:getc getline f:getline getmod f:getmod glob f:glob glob-links f:glob-links glob-nocase f:glob-nocase +Builtin gunz f:gunz homedir f:homedir homedir! f:homedir! include f:include ioctl f:ioctl join f:join +Builtin launch f:launch link f:link link> f:link> link? f:link? lock f:lock mkdir f:mkdir mmap f:mmap +Builtin mmap-range f:mmap-range mmap-range? f:mmap-range? mtime f:mtime mv f:mv name@ f:name@ open f:open +Builtin open! f:open! open-ro f:open-ro popen f:popen popen3 f:popen3 print f:print read f:read read-buf f:read-buf +Builtin read? f:read? relpath f:relpath rglob f:rglob rm f:rm rmdir f:rmdir seek f:seek sep f:sep size f:size +Builtin slurp f:slurp sparse? f:sparse? spit f:spit stderr f:stderr stdin f:stdin stdout f:stdout tell f:tell +Builtin tempfile f:tempfile times f:times tmpspit f:tmpspit trash f:trash truncate f:truncate ungetb f:ungetb +Builtin ungetc f:ungetc unzip f:unzip unzip-entry f:unzip-entry watch f:watch write f:write writen f:writen +Builtin zip+ f:zip+ zip@ f:zip@ zipentry f:zipentry zipnew f:zipnew zipopen f:zipopen zipsave f:zipsave +Builtin atlas! font:atlas! atlas@ font:atlas@ default-size font:default-size default-size@ font:default-size@ +Builtin info font:info ls font:ls measure font:measure new font:new oversample font:oversample pixels font:pixels +Builtin pixels? font:pixels? system font:system system font:system distance geo:distance km/deg-lat geo:km/deg-lat +Builtin km/deg-lon geo:km/deg-lon nearest geo:nearest +edge gr:+edge +edge+w gr:+edge+w +node gr:+node +Builtin connect gr:connect edges gr:edges edges! gr:edges! m! gr:m! m@ gr:m@ neighbors gr:neighbors +Builtin new gr:new node-edges gr:node-edges nodes gr:nodes traverse gr:traverse weight! gr:weight! +Builtin + h:+ clear h:clear cmp! h:cmp! len h:len max! h:max! new h:new peek h:peek pop h:pop push h:push +Builtin unique h:unique parse html:parse arm? hw:arm? camera hw:camera camera-img hw:camera-img camera-limits hw:camera-limits +Builtin camera? hw:camera? cpu? hw:cpu? device? hw:device? displays? hw:displays? displaysize? hw:displaysize? +Builtin finger-match hw:finger-match finger-support hw:finger-support gpio hw:gpio gpio! hw:gpio! gpio-mmap hw:gpio-mmap +Builtin gpio@ hw:gpio@ i2c hw:i2c i2c! hw:i2c! i2c!reg hw:i2c!reg i2c@ hw:i2c@ i2c@reg hw:i2c@reg isround? hw:isround? +Builtin iswatch? hw:iswatch? mac? hw:mac? mem? hw:mem? model? hw:model? poll hw:poll sensor hw:sensor +Builtin start hw:start stop hw:stop uid? hw:uid? fetch-full imap:fetch-full fetch-uid-mail imap:fetch-uid-mail +Builtin login imap:login logout imap:logout new imap:new search imap:search select-inbox imap:select-inbox +Builtin >file img:>file >fmt img:>fmt copy img:copy crop img:crop data img:data desat img:desat draw img:draw +Builtin draw-sub img:draw-sub fill img:fill fillrect img:fillrect filter img:filter flip img:flip from-svg img:from-svg +Builtin line img:line new img:new pikchr img:pikchr pix! img:pix! pix@ img:pix@ qr-gen img:qr-gen qr-parse img:qr-parse +Builtin rect img:rect rotate img:rotate scale img:scale scroll img:scroll size img:size countries iso:countries +Builtin languages iso:languages utils/help library:utils/help find loc:find sort loc:sort ! m:! !? m:!? +Builtin + m:+ +? m:+? - m:- <> m:<> = m:= >arr m:>arr @ m:@ @? m:@? _! m:_! _@ m:_@ alias m:alias arr> m:arr> +Builtin bitmap m:bitmap clear m:clear data m:data each m:each exists? m:exists? filter m:filter ic m:ic +Builtin iter m:iter iter-all m:iter-all keys m:keys len m:len map m:map merge m:merge new m:new op! m:op! +Builtin open m:open slice m:slice vals m:vals xchg m:xchg zip m:zip ! mat:! * mat:* + mat:+ = mat:= +Builtin @ mat:@ affine mat:affine col mat:col data mat:data det mat:det dim? mat:dim? get-n mat:get-n +Builtin ident mat:ident inv mat:inv m. mat:m. minor mat:minor n* mat:n* new mat:new new-minor mat:new-minor +Builtin rotate mat:rotate row mat:row same-size? mat:same-size? scale mat:scale shear mat:shear trans mat:trans +Builtin translate mat:translate xform mat:xform 2console md:2console 2html md:2html 2nk md:2nk color meta:color +Builtin console meta:console gui meta:gui meta meta:meta ! n:! * n:* */ n:*/ + n:+ +! n:+! - n:- / n:/ +Builtin /mod n:/mod 1+ n:1+ 1- n:1- < n:< = n:= > n:> >bool n:>bool BIGE n:BIGE BIGPI n:BIGPI E n:E +Builtin PI n:PI ^ n:^ _mod n:_mod abs n:abs acos n:acos acos n:acos andor n:andor asin n:asin asin n:asin +Builtin atan n:atan atan n:atan atan2 n:atan2 band n:band between n:between bfloat n:bfloat bic n:bic +Builtin bint n:bint binv n:binv bnot n:bnot bor n:bor bxor n:bxor cast n:cast ceil n:ceil clamp n:clamp +Builtin cmp n:cmp comb n:comb cos n:cos cosd n:cosd emod n:emod exp n:exp expm1 n:expm1 expmod n:expmod +Builtin float n:float floor n:floor fmod n:fmod frac n:frac gcd n:gcd int n:int invmod n:invmod kind? n:kind? +Builtin lcm n:lcm lerp n:lerp ln n:ln ln1p n:ln1p lnerp n:lnerp max n:max median n:median min n:min +Builtin mod n:mod neg n:neg odd? n:odd? perm n:perm prime? n:prime? quantize n:quantize quantize! n:quantize! +Builtin r+ n:r+ range n:range rot32l n:rot32l rot32r n:rot32r round n:round round2 n:round2 rounding n:rounding +Builtin running-variance n:running-variance running-variance-finalize n:running-variance-finalize sgn n:sgn +Builtin shl n:shl shr n:shr sin n:sin sind n:sind sqr n:sqr sqrt n:sqrt tan n:tan tand n:tand trunc n:trunc +Builtin ~= n:~= ! net:! !? net:!? - net:- >base64url net:>base64url >url net:>url @ net:@ @? net:@? +Builtin CGI net:CGI DGRAM net:DGRAM INET4 net:INET4 INET6 net:INET6 PROTO_TCP net:PROTO_TCP PROTO_UDP net:PROTO_UDP +Builtin REMOTE_IP net:REMOTE_IP STREAM net:STREAM accept net:accept active? net:active? addrinfo>o net:addrinfo>o +Builtin again? net:again? alloc-and-read net:alloc-and-read alloc-buf net:alloc-buf base64url> net:base64url> +Builtin bind net:bind cgi-get net:cgi-get cgi-http-header net:cgi-http-header cgi-init net:cgi-init +Builtin cgi-init-stunnel net:cgi-init-stunnel cgi-out net:cgi-out close net:close closed? net:closed? +Builtin connect net:connect curnet net:curnet debug? net:debug? delete net:delete get net:get getaddrinfo net:getaddrinfo +Builtin getpeername net:getpeername head net:head ifaces? net:ifaces? ipv6? net:ipv6? listen net:listen +Builtin map>url net:map>url mime-type net:mime-type net-socket net:net-socket opts net:opts port-is-ssl? net:port-is-ssl? +Builtin post net:post proxy! net:proxy! put net:put read net:read read-all net:read-all read-buf net:read-buf +Builtin recvfrom net:recvfrom s>url net:s>url sendto net:sendto server net:server setsockopt net:setsockopt +Builtin socket net:socket tcp-connect net:tcp-connect tlserr net:tlserr tlshello net:tlshello udp-connect net:udp-connect +Builtin url> net:url> user-agent net:user-agent vpncheck net:vpncheck wait net:wait webserver net:webserver +Builtin write net:write (begin) nk:(begin) (chart-begin) nk:(chart-begin) (chart-begin-colored) nk:(chart-begin-colored) +Builtin (chart-end) nk:(chart-end) (end) nk:(end) (group-begin) nk:(group-begin) (group-end) nk:(group-end) +Builtin (property) nk:(property) >img nk:>img addfont nk:addfont anti-alias nk:anti-alias any-clicked? nk:any-clicked? +Builtin bounds nk:bounds bounds! nk:bounds! button nk:button button-color nk:button-color button-label nk:button-label +Builtin button-set-behavior nk:button-set-behavior button-symbol nk:button-symbol button-symbol-label nk:button-symbol-label +Builtin center-rect nk:center-rect chart-add-slot nk:chart-add-slot chart-add-slot-colored nk:chart-add-slot-colored +Builtin chart-push nk:chart-push chart-push-slot nk:chart-push-slot checkbox nk:checkbox circle nk:circle +Builtin clicked? nk:clicked? close-this! nk:close-this! close-this? nk:close-this? close? nk:close? +Builtin color-picker nk:color-picker combo nk:combo combo-begin-color nk:combo-begin-color combo-begin-label nk:combo-begin-label Builtin combo-cb nk:combo-cb combo-end nk:combo-end contextual-begin nk:contextual-begin contextual-close nk:contextual-close Builtin contextual-end nk:contextual-end contextual-item-image-text nk:contextual-item-image-text contextual-item-symbol-text nk:contextual-item-symbol-text -Builtin contextual-item-text nk:contextual-item-text cp! nk:cp! cp@ nk:cp@ display-info nk:display-info -Builtin display@ nk:display@ do nk:do down? nk:down? draw-image nk:draw-image draw-image-at nk:draw-image-at -Builtin draw-image-centered nk:draw-image-centered draw-sub-image nk:draw-sub-image draw-text nk:draw-text -Builtin draw-text-high nk:draw-text-high draw-text-wrap nk:draw-text-wrap edit-focus nk:edit-focus +Builtin contextual-item-text nk:contextual-item-text cp! nk:cp! cp@ nk:cp@ curpos nk:curpos cursor-load nk:cursor-load +Builtin cursor-set nk:cursor-set cursor-show nk:cursor-show display-info nk:display-info display@ nk:display@ +Builtin do nk:do down? nk:down? draw-image nk:draw-image draw-image-at nk:draw-image-at draw-image-centered nk:draw-image-centered +Builtin draw-sub-image nk:draw-sub-image draw-text nk:draw-text draw-text-centered nk:draw-text-centered +Builtin draw-text-high nk:draw-text-high draw-text-wrap nk:draw-text-wrap drivers nk:drivers edit-focus nk:edit-focus Builtin edit-string nk:edit-string event nk:event event-boost nk:event-boost event-msec nk:event-msec -Builtin event-wait nk:event-wait fill-arc nk:fill-arc fill-circle nk:fill-circle fill-poly nk:fill-poly -Builtin fill-rect nk:fill-rect fill-rect-color nk:fill-rect-color fill-triangle nk:fill-triangle flags! nk:flags! -Builtin flags@ nk:flags@ fullscreen nk:fullscreen get nk:get get-row-height nk:get-row-height getfont nk:getfont -Builtin getmap nk:getmap gl? nk:gl? grid nk:grid grid-push nk:grid-push group-scroll-ofs nk:group-scroll-ofs -Builtin group-scroll-ofs! nk:group-scroll-ofs! hovered? nk:hovered? image nk:image init nk:init input-button nk:input-button -Builtin input-key nk:input-key input-motion nk:input-motion input-scroll nk:input-scroll input-string nk:input-string -Builtin key-down? nk:key-down? key-pressed? nk:key-pressed? key-released? nk:key-released? label nk:label -Builtin label-colored nk:label-colored label-wrap nk:label-wrap label-wrap-colored nk:label-wrap-colored +Builtin event-wait nk:event-wait event? nk:event? fill-arc nk:fill-arc fill-circle nk:fill-circle fill-color nk:fill-color +Builtin fill-poly nk:fill-poly fill-rect nk:fill-rect fill-rect-color nk:fill-rect-color fill-triangle nk:fill-triangle +Builtin finger nk:finger flags! nk:flags! flags@ nk:flags@ flash nk:flash fullscreen nk:fullscreen +Builtin gesture nk:gesture get nk:get get-row-height nk:get-row-height getfont nk:getfont getmap nk:getmap +Builtin getmap! nk:getmap! gl? nk:gl? grid nk:grid grid-push nk:grid-push group-scroll-ofs nk:group-scroll-ofs +Builtin group-scroll-ofs! nk:group-scroll-ofs! hovered? nk:hovered? hrule nk:hrule image nk:image init nk:init +Builtin input-button nk:input-button input-key nk:input-key input-motion nk:input-motion input-scroll nk:input-scroll +Builtin input-string nk:input-string key-down? nk:key-down? key-pressed? nk:key-pressed? key-released? nk:key-released? +Builtin label nk:label label-colored nk:label-colored label-wrap nk:label-wrap label-wrap-colored nk:label-wrap-colored Builtin layout-bounds nk:layout-bounds layout-grid-begin nk:layout-grid-begin layout-grid-end nk:layout-grid-end Builtin layout-push-dynamic nk:layout-push-dynamic layout-push-static nk:layout-push-static layout-push-variable nk:layout-push-variable Builtin layout-ratio-from-pixel nk:layout-ratio-from-pixel layout-reset-row-height nk:layout-reset-row-height @@ -266,79 +293,94 @@ Builtin layout-row-end nk:layout-row-end layout-row-height nk:layout-row-height Builtin layout-row-static nk:layout-row-static layout-row-template-begin nk:layout-row-template-begin Builtin layout-row-template-end nk:layout-row-template-end layout-space-begin nk:layout-space-begin Builtin layout-space-end nk:layout-space-end layout-space-push nk:layout-space-push layout-widget-bounds nk:layout-widget-bounds -Builtin list-begin nk:list-begin list-end nk:list-end list-new nk:list-new list-range nk:list-range -Builtin m! nk:m! m@ nk:m@ make-style nk:make-style max-vertex-element nk:max-vertex-element measure nk:measure -Builtin measure-font nk:measure-font menu-begin nk:menu-begin menu-close nk:menu-close menu-end nk:menu-end -Builtin menu-item-image nk:menu-item-image menu-item-label nk:menu-item-label menu-item-symbol nk:menu-item-symbol -Builtin menubar-begin nk:menubar-begin menubar-end nk:menubar-end mouse-pos nk:mouse-pos msgdlg nk:msgdlg -Builtin option nk:option plot nk:plot plot-fn nk:plot-fn pop-font nk:pop-font popup-begin nk:popup-begin -Builtin popup-close nk:popup-close popup-end nk:popup-end popup-scroll-ofs nk:popup-scroll-ofs popup-scroll-ofs! nk:popup-scroll-ofs! -Builtin progress nk:progress prop-int nk:prop-int pt>local nk:pt>local pt>screen nk:pt>screen pts>rect nk:pts>rect -Builtin push-font nk:push-font rect-center nk:rect-center rect-intersect nk:rect-intersect rect-ofs nk:rect-ofs -Builtin rect-pad nk:rect-pad rect-shrink nk:rect-shrink rect-union nk:rect-union rect/high nk:rect/high -Builtin rect/wide nk:rect/wide rect>center nk:rect>center rect>local nk:rect>local rect>pos nk:rect>pos -Builtin rect>pts nk:rect>pts rect>screen nk:rect>screen rect>size nk:rect>size released? nk:released? -Builtin render nk:render restore nk:restore rotate nk:rotate save nk:save scale nk:scale scancode? nk:scancode? -Builtin screen-saver nk:screen-saver screen-size nk:screen-size screen-win-close nk:screen-win-close -Builtin selectable nk:selectable set nk:set set-font nk:set-font set-num-vertices nk:set-num-vertices -Builtin setpos nk:setpos setwin nk:setwin slider nk:slider slider-int nk:slider-int space nk:space -Builtin spacing nk:spacing stroke-arc nk:stroke-arc stroke-circle nk:stroke-circle stroke-curve nk:stroke-curve -Builtin stroke-line nk:stroke-line stroke-polygon nk:stroke-polygon stroke-polyline nk:stroke-polyline -Builtin stroke-rect nk:stroke-rect stroke-tri nk:stroke-tri style-from-table nk:style-from-table sw-gl nk:sw-gl -Builtin text? nk:text? tooltip nk:tooltip translate nk:translate tree-pop nk:tree-pop tree-state-push nk:tree-state-push -Builtin use-style nk:use-style vsync nk:vsync widget nk:widget widget-bounds nk:widget-bounds widget-fitting nk:widget-fitting -Builtin widget-high nk:widget-high widget-hovered? nk:widget-hovered? widget-mouse-click-down? nk:widget-mouse-click-down? -Builtin widget-mouse-clicked? nk:widget-mouse-clicked? widget-pos nk:widget-pos widget-size nk:widget-size -Builtin widget-wide nk:widget-wide win nk:win win-bounds nk:win-bounds win-bounds! nk:win-bounds! win-close nk:win-close -Builtin win-closed? nk:win-closed? win-collapse nk:win-collapse win-collapsed? nk:win-collapsed? win-content-bounds nk:win-content-bounds +Builtin line-rel nk:line-rel line-to nk:line-to list-begin nk:list-begin list-end nk:list-end list-new nk:list-new +Builtin list-range nk:list-range m! nk:m! m@ nk:m@ make-style nk:make-style max-vertex-element nk:max-vertex-element +Builtin maximize nk:maximize measure nk:measure measure-font nk:measure-font menu-begin nk:menu-begin +Builtin menu-close nk:menu-close menu-end nk:menu-end menu-item-image nk:menu-item-image menu-item-label nk:menu-item-label +Builtin menu-item-symbol nk:menu-item-symbol menubar-begin nk:menubar-begin menubar-end nk:menubar-end +Builtin minimize nk:minimize mouse-pos nk:mouse-pos move-back nk:move-back move-rel nk:move-rel move-to nk:move-to +Builtin msg nk:msg msgdlg nk:msgdlg ontop nk:ontop option nk:option pen-color nk:pen-color pen-width nk:pen-width +Builtin plot nk:plot plot-fn nk:plot-fn pop-font nk:pop-font popup-begin nk:popup-begin popup-close nk:popup-close +Builtin popup-end nk:popup-end popup-scroll-ofs nk:popup-scroll-ofs popup-scroll-ofs! nk:popup-scroll-ofs! +Builtin progress nk:progress prop-int nk:prop-int pt-in? nk:pt-in? pt-open nk:pt-open pt>local nk:pt>local +Builtin pt>rect nk:pt>rect pt>screen nk:pt>screen pt>x nk:pt>x pts>rect nk:pts>rect push-font nk:push-font +Builtin raise nk:raise rect! nk:rect! rect-center nk:rect-center rect-intersect nk:rect-intersect rect-ofs nk:rect-ofs +Builtin rect-open nk:rect-open rect-pad nk:rect-pad rect-rel nk:rect-rel rect-shrink nk:rect-shrink +Builtin rect-to nk:rect-to rect-union nk:rect-union rect/high nk:rect/high rect/wide nk:rect/wide rect= nk:rect= +Builtin rect>local nk:rect>local rect>pos nk:rect>pos rect>pts nk:rect>pts rect>pts4 nk:rect>pts4 rect>screen nk:rect>screen +Builtin rect>size nk:rect>size rect>x nk:rect>x rect@ nk:rect@ released? nk:released? render nk:render +Builtin render-timed nk:render-timed restore nk:restore rotate nk:rotate rotate-rel nk:rotate-rel save nk:save +Builtin scale nk:scale scancode? nk:scancode? screen-saver nk:screen-saver screen-size nk:screen-size +Builtin screen-win-close nk:screen-win-close selectable nk:selectable set nk:set set-font nk:set-font +Builtin set-num-vertices nk:set-num-vertices set-radius nk:set-radius setpos nk:setpos setwin nk:setwin +Builtin show nk:show slider nk:slider slider-int nk:slider-int space nk:space spacing nk:spacing stroke-arc nk:stroke-arc +Builtin stroke-circle nk:stroke-circle stroke-curve nk:stroke-curve stroke-line nk:stroke-line stroke-polygon nk:stroke-polygon +Builtin stroke-polyline nk:stroke-polyline stroke-rect nk:stroke-rect stroke-tri nk:stroke-tri style-from-table nk:style-from-table +Builtin swipe nk:swipe swipe-dir-threshold nk:swipe-dir-threshold swipe-threshold nk:swipe-threshold +Builtin text nk:text text-align nk:text-align text-font nk:text-font text-pad nk:text-pad text? nk:text? +Builtin timer-delay nk:timer-delay timer? nk:timer? tooltip nk:tooltip translate nk:translate tree-pop nk:tree-pop +Builtin tree-state-push nk:tree-state-push use-style nk:use-style vsync nk:vsync widget nk:widget widget-bounds nk:widget-bounds +Builtin widget-disable nk:widget-disable widget-fitting nk:widget-fitting widget-high nk:widget-high +Builtin widget-hovered? nk:widget-hovered? widget-mouse-click-down? nk:widget-mouse-click-down? widget-mouse-clicked? nk:widget-mouse-clicked? +Builtin widget-pos nk:widget-pos widget-size nk:widget-size widget-size nk:widget-size widget-wide nk:widget-wide +Builtin win nk:win win-bounds nk:win-bounds win-bounds! nk:win-bounds! win-close nk:win-close win-closed? nk:win-closed? +Builtin win-collapse nk:win-collapse win-collapsed? nk:win-collapsed? win-content-bounds nk:win-content-bounds Builtin win-focus nk:win-focus win-focused? nk:win-focused? win-hidden? nk:win-hidden? win-high nk:win-high Builtin win-hovered? nk:win-hovered? win-pos nk:win-pos win-scroll-ofs nk:win-scroll-ofs win-scroll-ofs! nk:win-scroll-ofs! -Builtin win-show nk:win-show win-size nk:win-size win-wide nk:win-wide win? nk:win? MAX ns:MAX ! o:! -Builtin + o:+ +? o:+? ??? o:??? @ o:@ class o:class exec o:exec isa o:isa method o:method mutate o:mutate -Builtin new o:new super o:super devname os:devname env os:env lang os:lang mem-arenas os:mem-arenas -Builtin notify os:notify region os:region cast ptr:cast len ptr:len null? ptr:null? pack ptr:pack unpack ptr:unpack -Builtin unpack_orig ptr:unpack_orig publish pubsub:publish qsize pubsub:qsize subscribe pubsub:subscribe -Builtin + q:+ clear q:clear len q:len new q:new notify q:notify overwrite q:overwrite peek q:peek pick q:pick -Builtin pop q:pop push q:push remove q:remove shift q:shift size q:size slide q:slide throwing q:throwing -Builtin wait q:wait ++match r:++match +/ r:+/ +match r:+match / r:/ @ r:@ len r:len match r:match new r:new -Builtin rx r:rx str r:str * rat:* + rat:+ - rat:- / rat:/ >n rat:>n >s rat:>s new rat:new proper rat:proper -Builtin ! s:! * s:* + s:+ - s:- / s:/ /scripts s:/scripts <+ s:<+ = s:= =ic s:=ic >base64 s:>base64 -Builtin >ucs2 s:>ucs2 @ s:@ append s:append base64> s:base64> clear s:clear cmp s:cmp cmpi s:cmpi compress s:compress -Builtin days! s:days! dist s:dist each s:each each! s:each! eachline s:eachline escape s:escape expand s:expand -Builtin fill s:fill fmt s:fmt fold s:fold gershayim s:gershayim globmatch s:globmatch hexupr s:hexupr -Builtin insert s:insert intl s:intl intl! s:intl! lang s:lang lc s:lc lc? s:lc? len s:len lsub s:lsub -Builtin ltrim s:ltrim map s:map months! s:months! new s:new norm s:norm reduce s:reduce repinsert s:repinsert -Builtin replace s:replace replace! s:replace! rev s:rev rsearch s:rsearch rsub s:rsub rtrim s:rtrim -Builtin script? s:script? search s:search size s:size slice s:slice soundex s:soundex strfmap s:strfmap -Builtin strfmt s:strfmt text-wrap s:text-wrap trim s:trim tsub s:tsub uc s:uc uc? s:uc? ucs2> s:ucs2> -Builtin utf8? s:utf8? zt s:zt close sio:close enum sio:enum open sio:open opts! sio:opts! opts@ sio:opts@ -Builtin read sio:read write sio:write @ slv:@ auto slv:auto build slv:build constraint slv:constraint +Builtin win-show nk:win-show win-size nk:win-size win-wide nk:win-wide win? nk:win? x>pt nk:x>pt x>rect nk:x>rect +Builtin MAX ns:MAX ! o:! + o:+ +? o:+? ??? o:??? @ o:@ class o:class exec o:exec isa o:isa method o:method +Builtin mutate o:mutate new o:new super o:super chroot os:chroot devname os:devname docker? os:docker? +Builtin env os:env lang os:lang locales os:locales notify os:notify power-state os:power-state region os:region +Builtin waitpid os:waitpid bezier pdf:bezier bezierq pdf:bezierq circle pdf:circle color pdf:color +Builtin ellipse pdf:ellipse font pdf:font img pdf:img line pdf:line new pdf:new page pdf:page page-size pdf:page-size +Builtin rect pdf:rect save pdf:save size pdf:size text pdf:text text-rotate pdf:text-rotate text-size pdf:text-size +Builtin text-width pdf:text-width text-wrap pdf:text-wrap text-wrap-rotate pdf:text-wrap-rotate cast ptr:cast +Builtin len ptr:len null? ptr:null? pack ptr:pack unpack ptr:unpack unpack_orig ptr:unpack_orig publish pubsub:publish +Builtin qsize pubsub:qsize subscribe pubsub:subscribe + q:+ clear q:clear len q:len new q:new notify q:notify +Builtin overwrite q:overwrite peek q:peek pick q:pick pop q:pop push q:push remove q:remove shift q:shift +Builtin size q:size slide q:slide throwing q:throwing wait q:wait ++match r:++match +/ r:+/ +match r:+match +Builtin / r:/ @ r:@ len r:len match r:match new r:new rx r:rx str r:str * rat:* + rat:+ - rat:- / rat:/ +Builtin >n rat:>n >s rat:>s new rat:new proper rat:proper ! s:! * s:* + s:+ - s:- / s:/ /scripts s:/scripts +Builtin <+ s:<+ <> s:<> = s:= =ic s:=ic >base64 s:>base64 >ucs2 s:>ucs2 @ s:@ append s:append base64> s:base64> +Builtin clear s:clear cmp s:cmp cmpi s:cmpi compress s:compress count-match s:count-match days! s:days! +Builtin dist s:dist each s:each each! s:each! eachline s:eachline escape s:escape expand s:expand fill s:fill +Builtin fold s:fold globmatch s:globmatch hexupr s:hexupr insert s:insert intl s:intl intl! s:intl! +Builtin lang s:lang lc s:lc lc? s:lc? len s:len lsub s:lsub ltrim s:ltrim map s:map months! s:months! +Builtin n> s:n> new s:new norm s:norm reduce s:reduce repinsert s:repinsert replace s:replace replace! s:replace! +Builtin rev s:rev rsearch s:rsearch rsub s:rsub rtrim s:rtrim scan-match s:scan-match script? s:script? +Builtin search s:search size s:size slice s:slice soundex s:soundex strfmap s:strfmap strfmt s:strfmt +Builtin term s:term text-wrap s:text-wrap tr s:tr translate s:translate trim s:trim tsub s:tsub uc s:uc +Builtin uc? s:uc? ucs2> s:ucs2> utf8? s:utf8? zt s:zt close sio:close enum sio:enum open sio:open opts! sio:opts! +Builtin opts@ sio:opts@ read sio:read write sio:write @ slv:@ auto slv:auto build slv:build constraint slv:constraint Builtin dump slv:dump edit slv:edit named-variable slv:named-variable new slv:new relation slv:relation Builtin reset slv:reset suggest slv:suggest term slv:term update slv:update v[] slv:v[] variable slv:variable Builtin v{} slv:v{} new smtp:new send smtp:send apply-filter snd:apply-filter devices? snd:devices? -Builtin end-record snd:end-record filter snd:filter formats? snd:formats? freq snd:freq gain snd:gain -Builtin gain? snd:gain? init snd:init len snd:len loop snd:loop loop? snd:loop? mix snd:mix new snd:new -Builtin pause snd:pause play snd:play played snd:played rate snd:rate ready? snd:ready? record snd:record -Builtin resume snd:resume seek snd:seek stop snd:stop stopall snd:stopall volume snd:volume volume? snd:volume? -Builtin + st:+ . st:. clear st:clear len st:len ndrop st:ndrop new st:new op! st:op! peek st:peek pick st:pick -Builtin pop st:pop push st:push roll st:roll shift st:shift size st:size slide st:slide swap st:swap -Builtin throwing st:throwing >buf struct:>buf arr> struct:arr> buf struct:buf buf> struct:buf> byte struct:byte -Builtin double struct:double field! struct:field! field@ struct:field@ float struct:float ignore struct:ignore -Builtin int struct:int long struct:long struct; struct:struct; word struct:word ! t:! @ t:@ by-name t:by-name -Builtin cor t:cor cor-drop t:cor-drop curtask t:curtask def-queue t:def-queue def-stack t:def-stack -Builtin done? t:done? err! t:err! err? t:err? errno? t:errno? getq t:getq handler t:handler handler@ t:handler@ +Builtin end-record snd:end-record filter snd:filter freq snd:freq gain snd:gain gain? snd:gain? init snd:init +Builtin len snd:len loop snd:loop loop? snd:loop? mix snd:mix new snd:new pause snd:pause play snd:play +Builtin played snd:played rate snd:rate ready? snd:ready? record snd:record resume snd:resume seek snd:seek +Builtin stop snd:stop stopall snd:stopall volume snd:volume volume? snd:volume? + st:+ . st:. clear st:clear +Builtin len st:len ndrop st:ndrop new st:new op! st:op! peek st:peek pick st:pick pop st:pop push st:push +Builtin roll st:roll shift st:shift size st:size slide st:slide swap st:swap throwing st:throwing >buf struct:>buf +Builtin arr> struct:arr> buf struct:buf buf> struct:buf> byte struct:byte double struct:double field! struct:field! +Builtin field@ struct:field@ float struct:float ignore struct:ignore int struct:int long struct:long +Builtin struct; struct:struct; word struct:word ! t:! @ t:@ by-name t:by-name cor t:cor cor-drop t:cor-drop +Builtin curtask t:curtask def-queue t:def-queue def-stack t:def-stack done? t:done? dtor t:dtor err! t:err! +Builtin err? t:err? errno? t:errno? extra t:extra getq t:getq handler t:handler handler@ t:handler@ Builtin kill t:kill list t:list main t:main max-exceptions t:max-exceptions name! t:name! name@ t:name@ -Builtin notify t:notify parent t:parent pop t:pop priority t:priority push t:push q-notify t:q-notify +Builtin notify t:notify parent t:parent pop t:pop priority t:priority push t:push push! t:push! q-notify t:q-notify Builtin q-wait t:q-wait qlen t:qlen result t:result set-affinity t:set-affinity setq t:setq start t:start -Builtin task t:task task-n t:task-n task-stop t:task-stop wait t:wait yield t:yield yield! t:yield! +Builtin task t:task task-n t:task-n task-stop t:task-stop ticks t:ticks wait t:wait yield t:yield yield! t:yield! Builtin add tree:add binary tree:binary bk tree:bk btree tree:btree cmp! tree:cmp! data tree:data del tree:del Builtin find tree:find iter tree:iter next tree:next nodes tree:nodes parent tree:parent parse tree:parse Builtin prev tree:prev root tree:root search tree:search trie tree:trie ! w:! (is) w:(is) @ w:@ alias: w:alias: Builtin cb w:cb deprecate w:deprecate dlcall w:dlcall dlopen w:dlopen dlsym w:dlsym exec w:exec exec? w:exec? -Builtin ffifail w:ffifail find w:find forget w:forget is w:is name w:name undo w:undo >s xml:>s >txt xml:>txt -Builtin md-init xml:md-init md-parse xml:md-parse parse xml:parse parse-html xml:parse-html parse-stream xml:parse-stream +Builtin ffifail w:ffifail find w:find forget w:forget is w:is name w:name undo w:undo close ws:close +Builtin decode ws:decode encode ws:encode encode-nomask ws:encode-nomask gen-accept-header ws:gen-accept-header +Builtin gen-accept-key ws:gen-accept-key opcodes ws:opcodes open ws:open >s xml:>s >txt xml:>txt md-init xml:md-init +Builtin md-parse xml:md-parse parse xml:parse parse-html xml:parse-html parse-stream xml:parse-stream Builtin getmsg[] zmq:getmsg[] sendmsg[] zmq:sendmsg[] + " numbers syn keyword eighthMath decimal hex base@ base! syn match eighthInteger '\<-\=[0-9.]*[0-9.]\+\>' @@ -349,6 +391,11 @@ syn match eighthInteger '\<\x*\d\x*\>' " *2* --- this order! syn match eighthInteger '\<%[0-1]*[0-1]\+\>' syn match eighthInteger "\<'.\>" +syn include @SQL syntax/sql.vim +syn region eightSQL matchgroup=Define start=/\/ contains=@SQL keepend +syn region eightSQL matchgroup=Define start=/\/ contains=@SQL keepend +syn region eightSQL matchgroup=Define start=/\/ contains=@SQL keepend + " Strings syn region eighthString start=+\.\?\"+ skip=+"+ end=+$+ syn keyword jsonNull null @@ -356,49 +403,57 @@ syn keyword jsonBool /\(true\|false\)/ syn region eighthString start=/\<"/ end=/"\>/ syn match jsonObjEntry /"\"[^"]\+\"\ze\s*:/ -" Include files -syn region eighthComment start="\zs\\" end="$" contains=eighthTodo +syn region eighthNeeds start=+needs\[+ end=+]+ matchgroup=eighthNeeds2 transparent +syn match eighthNeeds2 /\/ -" Define the default highlighting. -if !exists("did_eighth_syntax_inits") - let did_eighth_syntax_inits=1 +syn match eighthBuiltin /m:\[]!/ +syn match eighthBuiltin /v:\[]/ +syn match eighthBuiltin /db:bind-exec\[]/ +syn match eighthBuiltin /db:exec\[]/ +syn match eighthBuiltin /db:col\[]/ - " The default methods for highlighting. Can be overridden later. - hi def link eighthTodo Todo - hi def link eighthOperators Operator - hi def link eighthMath Number - hi def link eighthInteger Number - hi def link eighthStack Special - hi def link eighthFStack Special - hi def link eighthSP Special - hi def link eighthColonDef Define - hi def link eighthColonName Operator - hi def link eighthEndOfColonDef Define - hi def link eighthDefine Define - hi def link eighthDebug Debug - hi def link eighthCharOps Character - hi def link eighthConversion String - hi def link eighthForth Statement - hi def link eighthVocs Statement - hi def link eighthString String - hi def link eighthComment Comment - hi def link eighthClassDef Define - hi def link eighthEndOfClassDef Define - hi def link eighthObjectDef Define - hi def link eighthEndOfObjectDef Define - hi def link eighthInclude Include - hi def link eighthBuiltin Define - hi def link eighthClasses Define - hi def link eighthClassWord Keyword - hi def link jsonObject Delimiter - hi def link jsonObjEntry Label - hi def link jsonArray Special - hi def link jsonNull Function - hi def link jsonBool Boolean -endif +" TODO +syn region eighthComment start="\zs\\" end="$" contains=eighthTodo + +" The default methods for highlighting. Can be overriden later. +hi def link eighthTodo Todo +hi def link eighthNeeds2 Include +hi def link eighthNeeds Error +hi def link eighthOperators Operator +hi def link eighthMath Number +hi def link eighthInteger Number +hi def link eighthStack Special +hi def link eighthFStack Special +hi def link eighthFname Operator +hi def link eighthSP Special +hi def link eighthColonDef Define +hi def link eighthColonName Operator +hi def link eighthEndOfColonDef Define +hi def link eighthDefine Define +hi def link eighthDebug Debug +hi def link eighthCharOps Character +hi def link eighthConversion String +hi def link eighthForth Statement +hi def link eighthVocs Statement +hi def link eighthString String +hi def link eighthComment Comment +hi def link eighthClassDef Define +hi def link eighthEndOfClassDef Define +hi def link eighthObjectDef Define +hi def link eighthEndOfObjectDef Define +hi def link eighthInclude Include +hi def link eighthBuiltin Define +hi def link eighthClasses Define +hi def link eighthClassWord Keyword +hi def link jsonObject Delimiter +hi def link jsonObjEntry Label +hi def link jsonArray Special +hi def link jsonNull Function +hi def link jsonBool Boolean let b:current_syntax = "8th" let &cpo = s:cpo_save unlet s:cpo_save -" vim: ft=vim:ts=8:sw=4:nocindent:smartindent: +" vim: ft=vim ts=4 sw=4 nocin:si -- cgit From 18933fc47febb3056d6591529d07444a77338c27 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Dec 2023 23:20:27 +0100 Subject: vim-patch:fbd72d2d4725 runtime(netrw): prevent E11 on FocusGained autocommand (vim/vim#13718) https://github.com/vim/vim/commit/fbd72d2d47257267bc6e3fe093ef8c225369ab79 Co-authored-by: Christian Brabandt --- runtime/autoload/netrw.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 30964ae80d..a4d6c41b78 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -10853,6 +10853,10 @@ fun! s:LocalBrowseRefresh() " call Dret("s:LocalBrowseRefresh : don't refresh when focus not on netrw window") return endif + if !empty(getcmdwintype()) + " cannot move away from cmdline window, see :h E11 + return + endif if exists("s:netrw_events") && s:netrw_events == 1 " s:LocalFastBrowser gets called (indirectly) from a let s:netrw_events= 2 -- cgit From 2ed784f3859bb0e70ae4ba79a99866cddd54219b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Dec 2023 23:21:07 +0100 Subject: vim-patch:9.0.2179: no filetype detection for execline scripts Problem: no filetype detection for execline scripts Solution: Add filetype detection for execline as a prior to adding syntax support for execline (see https://github.com/djpohly/vim-execline/issues/2), i went ahead and made the filetype detection for execline scripts. closes: vim/vim#13689 Signed-Off-By: Mazunki Hoksaas https://github.com/vim/vim/commit/63210c214afa6589b6132bd060908a8711f4567f Co-authored-by: Mazunki Hoksaas --- runtime/lua/vim/filetype.lua | 5 +++++ runtime/lua/vim/filetype/detect.lua | 1 + 2 files changed, 6 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index e64923ab54..9141b1e4c6 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1656,6 +1656,11 @@ local pattern = { ['.*/dtrace/.*%.d'] = 'dtrace', ['.*esmtprc'] = 'esmtprc', ['.*Eterm/.*%.cfg'] = 'eterm', + ['.*s6.*/up'] = 'execline', + ['.*s6.*/down'] = 'execline', + ['.*s6.*/run'] = 'execline', + ['.*s6.*/finish'] = 'execline', + ['s6%-.*'] = 'execline', ['[a-zA-Z0-9].*Dict'] = detect.foam, ['[a-zA-Z0-9].*Dict%..*'] = detect.foam, ['[a-zA-Z].*Properties'] = detect.foam, diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 9d0f1bd3ab..a1c5ac73b4 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1661,6 +1661,7 @@ local patterns_hashbang = { ['^\\%(rexx\\|regina\\)\\>'] = { 'rexx', { vim_regex = true } }, ['^janet\\>'] = { 'janet', { vim_regex = true } }, ['^dart\\>'] = { 'dart', { vim_regex = true } }, + ['^execlineb\\>'] = { 'execline', { vim_regex = true } }, } ---@private -- cgit From 184f8423492f62b67b499efc53582dad4917ca5a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 20 Dec 2023 07:02:48 +0800 Subject: vim-patch:955652f6df9c (#26667) runtime(doc): Update change.txt (vim/vim#13725) Fix-up and clarify commit e06f2b498ccca921f34a1bec4464f042a5a2cabd https://github.com/vim/vim/commit/955652f6df9c4a1048fde8028c5c7f7871b5f71a Co-authored-by: K.Takata --- runtime/doc/change.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 61e7c0c6e0..703addf51a 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -424,9 +424,12 @@ octal number. Note that when 'nrformats' includes "octal", decimal numbers with leading zeros cause mistakes, because they can be confused with octal numbers. -Note similarly, when 'nrformats' includes "bin", binary numbers with a leading -'0b' or '0B' can be interpreted as hexadecimal rather than binary since '0b' -are valid hexadecimal digits. +Note similarly, when 'nrformats' includes both "bin" and "hex", binary numbers +with a leading '0x' or '0X' can be interpreted as hexadecimal rather than +binary since '0b' are valid hexadecimal digits. CTRL-A on "0x0b11" results in +"0x0b12", not "0x0b100". +When 'nrformats' includes "bin" and doesn't include "hex", CTRL-A on "0b11" in +"0x0b11" results in "0x0b100". When the number under the cursor is too big to fit into 64 bits, it will be rounded off to the nearest number that can be represented, and the -- cgit From 365e185606a8bb14841e7d21c7855deaaf35693f Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 18 Dec 2023 00:06:18 +0100 Subject: docs: document header structure Reference: https://github.com/neovim/neovim/issues/6371 --- runtime/doc/dev_style.txt | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index ee8a2a3c3b..05dc727130 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -41,6 +41,43 @@ All header files should start with `#pragma once` to prevent multiple inclusion. #pragma once < +Headers system ~ + +Nvim uses two types of headers. There are "normal" headers and "defs" headers. +Typically, each normal header will have a corresponding defs header, e.g. +`fileio.h` and `fileio_defs.h`. This distinction is done to minimize +recompilation on change. The goal is to achieve the following: + +- All headers (defs and normal) must include only defs headers, system + headers, and generated declarations. In other words, headers must not + include normal headers. + +- Source (.c) files may include all headers, but should only include normal + headers if they need symbols and not types. + +Use the following guideline to determine what to put where: + +Symbols: + - regular function declarations + - `extern` variables (including the `EXTERN` macro) + +Non-symbols: + - macros, i.e. `#define`. + - static inline functions, but only if its function declaration has a + `REAL_FATTR_ALWAYS_INLINE` attribute. + - typedefs + - structs + - enums + + +- All symbols must be moved to normal headers. + +- Non-symbols used by multiple headers should be moved to defs headers. This + is to ensure headers only include defs headers. Conversely, non-symbols used + by only a single header should be moved to that header. + +- EXCEPTION: if the macro calls a function, then it must be moved to a normal + header. Constants ~ -- cgit From 2498747addaf96dacba2000e6fbdf05572d129a3 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 20 Dec 2023 10:48:39 +0000 Subject: refactor(treesitter): cleanup highlighter - Remove some unused fields - Prefix classes with `vim.` - Move around some functions so the query stuff is at the top. - Improve type hints - Rework how hl_cache is implemented --- runtime/lua/vim/treesitter/highlighter.lua | 120 +++++++++++++++-------------- 1 file changed, 63 insertions(+), 57 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index b2cc334bdc..5ffdd79326 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -2,52 +2,25 @@ local api = vim.api local query = vim.treesitter.query local Range = require('vim.treesitter._range') ----@alias TSHlIter fun(end_line: integer|nil): integer, TSNode, TSMetadata - ----@class TSHighlightState ----@field tstree TSTree ----@field next_row integer ----@field iter TSHlIter|nil ----@field highlighter_query TSHighlighterQuery - ----@class TSHighlighter ----@field active table ----@field bufnr integer ----@field orig_spelloptions string ----@field _highlight_states TSHighlightState[] ----@field _queries table ----@field tree LanguageTree ----@field redraw_count integer -local TSHighlighter = rawget(vim.treesitter, 'TSHighlighter') or {} -TSHighlighter.__index = TSHighlighter +local ns = api.nvim_create_namespace('treesitter/highlighter') ---- @nodoc -TSHighlighter.active = TSHighlighter.active or {} +---@alias vim.TSHlIter fun(end_line: integer|nil): integer, TSNode, TSMetadata ----@class TSHighlighterQuery ----@field _query Query|nil ----@field hl_cache table +---@class vim.TSHighlighterQuery +---@field private _query Query? +---@field private lang string +---@field private hl_cache table local TSHighlighterQuery = {} TSHighlighterQuery.__index = TSHighlighterQuery -local ns = api.nvim_create_namespace('treesitter/highlighter') - ---@private +---@param lang string +---@param query_string string? +---@return vim.TSHighlighterQuery function TSHighlighterQuery.new(lang, query_string) - local self = setmetatable({}, { __index = TSHighlighterQuery }) - - self.hl_cache = setmetatable({}, { - __index = function(table, capture) - local name = self._query.captures[capture] - local id = 0 - if not vim.startswith(name, '_') then - id = api.nvim_get_hl_id_by_name('@' .. name .. '.' .. lang) - end - - rawset(table, capture, id) - return id - end, - }) + local self = setmetatable({}, TSHighlighterQuery) + self.lang = lang + self.hl_cache = {} if query_string then self._query = query.parse(lang, query_string) @@ -58,11 +31,49 @@ function TSHighlighterQuery.new(lang, query_string) return self end +---@package +---@param capture integer +---@return integer? +function TSHighlighterQuery:get_hl_from_capture(capture) + if not self.hl_cache[capture] then + local name = self._query.captures[capture] + local id = 0 + if not vim.startswith(name, '_') then + id = api.nvim_get_hl_id_by_name('@' .. name .. '.' .. self.lang) + end + self.hl_cache[capture] = id + end + + return self.hl_cache[capture] +end + ---@package function TSHighlighterQuery:query() return self._query end +---@class vim.TSHighlightState +---@field tstree TSTree +---@field next_row integer +---@field iter vim.TSHlIter? +---@field highlighter_query vim.TSHighlighterQuery + +---@class vim.TSHighlighter +---@field active table +---@field bufnr integer +---@field orig_spelloptions string +--- A map of highlight states. +--- This state is kept during rendering across each line update. +---@field _highlight_states vim.TSHighlightState[] +---@field _queries table +---@field tree LanguageTree +---@field redraw_count integer +local TSHighlighter = { + active = {}, +} + +TSHighlighter.__index = TSHighlighter + ---@package --- --- Creates a highlighter for `tree`. @@ -70,7 +81,7 @@ end ---@param tree LanguageTree parser object to use for highlighting ---@param opts (table|nil) Configuration of the highlighter: --- - queries table overwrite queries used by the highlighter ----@return TSHighlighter Created highlighter object +---@return vim.TSHighlighter Created highlighter object function TSHighlighter.new(tree, opts) local self = setmetatable({}, TSHighlighter) @@ -100,15 +111,12 @@ function TSHighlighter.new(tree, opts) end, }, true) - self.bufnr = tree:source() --[[@as integer]] - self.edit_count = 0 + local source = tree:source() + assert(type(source) == 'number') + + self.bufnr = source self.redraw_count = 0 - self.line_count = {} - -- A map of highlight states. - -- This state is kept during rendering across each line update. self._highlight_states = {} - - ---@type table self._queries = {} -- Queries for a specific language can be overridden by a custom @@ -146,11 +154,9 @@ end --- @nodoc --- Removes all internal references to the highlighter function TSHighlighter:destroy() - if TSHighlighter.active[self.bufnr] then - TSHighlighter.active[self.bufnr] = nil - end + TSHighlighter.active[self.bufnr] = nil - if vim.api.nvim_buf_is_loaded(self.bufnr) then + if api.nvim_buf_is_loaded(self.bufnr) then vim.bo[self.bufnr].spelloptions = self.orig_spelloptions vim.b[self.bufnr].ts_highlight = nil if vim.g.syntax_on == 1 then @@ -173,7 +179,7 @@ function TSHighlighter:prepare_highlight_states(srow, erow) local root_node = tstree:root() local root_start_row, _, root_end_row, _ = root_node:range() - -- Only worry about trees within the visible range + -- Only consider trees within the visible range if root_start_row > erow or root_end_row < srow then return end @@ -196,7 +202,7 @@ function TSHighlighter:prepare_highlight_states(srow, erow) end) end ----@param fn fun(state: TSHighlightState) +---@param fn fun(state: vim.TSHighlightState) ---@package function TSHighlighter:for_each_highlight_state(fn) for _, state in ipairs(self._highlight_states) do @@ -228,7 +234,7 @@ end -- ---@package ---@param lang string Language used by the highlighter. ----@return TSHighlighterQuery +---@return vim.TSHighlighterQuery function TSHighlighter:get_query(lang) if not self._queries[lang] then self._queries[lang] = TSHighlighterQuery.new(lang) @@ -237,7 +243,7 @@ function TSHighlighter:get_query(lang) return self._queries[lang] end ----@param self TSHighlighter +---@param self vim.TSHighlighter ---@param buf integer ---@param line integer ---@param is_spell_nav boolean @@ -246,7 +252,7 @@ local function on_line_impl(self, buf, line, is_spell_nav) local root_node = state.tstree:root() local root_start_row, _, root_end_row, _ = root_node:range() - -- Only worry about trees within the line range + -- Only consider trees that contain this line if root_start_row > line or root_end_row < line then return end @@ -266,7 +272,7 @@ local function on_line_impl(self, buf, line, is_spell_nav) local start_row, start_col, end_row, end_col = Range.unpack4(range) if capture then - local hl = state.highlighter_query.hl_cache[capture] + local hl = state.highlighter_query:get_hl_from_capture(capture) local capture_name = state.highlighter_query:query().captures[capture] local spell = nil ---@type boolean? -- cgit From db4b0aeb928461a058e59969e07df886cbd990c1 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 19 Dec 2023 13:36:42 +0100 Subject: docs: remove section on constants in style guide It is needlessly restrictive and specific without good reason. --- runtime/doc/dev_style.txt | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index 05dc727130..9e00210f8c 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -79,17 +79,6 @@ Non-symbols: - EXCEPTION: if the macro calls a function, then it must be moved to a normal header. -Constants ~ - -Do not use macros to define constants in headers. - -Macro constants in header files cannot be used by unit tests. - -However, you are allowed to define a macro that holds the same value as a -non-enum constant (defined in the same header) if the value of the constant -represents the size of an array. - - ============================================================================== Scoping *dev-style-scope* -- cgit From cc6a257c8cad8051b6f7e9287249293ab0a929d9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 18 Dec 2023 16:49:44 +0100 Subject: docs: apply current colorscheme to default highlight groups Problem: Not all default highlight groups show their actual colors. Solution: Refactor `vimhelp.lua` and apply it to all relevant lists (UI groups, syntax groups, treesitter groups, LSP groups, diagnostic groups). --- runtime/doc/lsp.txt | 34 +++++++-------- runtime/doc/syntax.txt | 92 +++++++++++++++++++-------------------- runtime/doc/treesitter.txt | 104 ++++++++++++++++++++++---------------------- runtime/ftplugin/help.lua | 25 ++++++++++- runtime/lua/vim/vimhelp.lua | 36 +++++++-------- 5 files changed, 157 insertions(+), 134 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 40889f4255..65890953e0 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -480,23 +480,23 @@ Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more complex highlighting. The following groups are linked by default to standard |group-name|s: -> - @lsp.type.class Structure - @lsp.type.decorator Function - @lsp.type.enum Structure - @lsp.type.enumMember Constant - @lsp.type.function Function - @lsp.type.interface Structure - @lsp.type.macro Macro - @lsp.type.method Function - @lsp.type.namespace Structure - @lsp.type.parameter Identifier - @lsp.type.property Identifier - @lsp.type.struct Structure - @lsp.type.type Type - @lsp.type.typeParameter TypeDef - @lsp.type.variable Identifier -< + +@lsp.type.class Structure +@lsp.type.decorator Function +@lsp.type.enum Structure +@lsp.type.enumMember Constant +@lsp.type.function Function +@lsp.type.interface Structure +@lsp.type.macro Macro +@lsp.type.method Function +@lsp.type.namespace Structure +@lsp.type.parameter Identifier +@lsp.type.property Identifier +@lsp.type.struct Structure +@lsp.type.type Type +@lsp.type.typeParameter TypeDef +@lsp.type.variable Identifier + ============================================================================== EVENTS *lsp-events* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1ca01a09e3..e859ddcadc 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -196,52 +196,52 @@ be preferred names for highlight groups that are common for many languages. These are the suggested group names (if syntax highlighting works properly you can see the actual color, except for "Ignore"): - Comment any comment - - Constant any constant - String a string constant: "this is a string" - Character a character constant: 'c', '\n' - Number a number constant: 234, 0xff - Boolean a boolean constant: TRUE, false - Float a floating point constant: 2.3e10 - - Identifier any variable name - Function function name (also: methods for classes) - - Statement any statement - Conditional if, then, else, endif, switch, etc. - Repeat for, do, while, etc. - Label case, default, etc. - Operator "sizeof", "+", "*", etc. - Keyword any other keyword - Exception try, catch, throw - - PreProc generic Preprocessor - Include preprocessor #include - Define preprocessor #define - Macro same as Define - PreCondit preprocessor #if, #else, #endif, etc. - - Type int, long, char, etc. - StorageClass static, register, volatile, etc. - Structure struct, union, enum, etc. - Typedef A typedef - - Special any special symbol - SpecialChar special character in a constant - Tag you can use CTRL-] on this - Delimiter character that needs attention - SpecialComment special things inside a comment - Debug debugging statements - - Underlined text that stands out, HTML links - - Ignore left blank, hidden |hl-Ignore| - - Error any erroneous construct - - Todo anything that needs extra attention; mostly the - keywords TODO FIXME and XXX +Comment any comment + +Constant any constant +String a string constant: "this is a string" +Character a character constant: 'c', '\n' +Number a number constant: 234, 0xff +Boolean a boolean constant: TRUE, false +Float a floating point constant: 2.3e10 + +Identifier any variable name +Function function name (also: methods for classes) + +Statement any statement +Conditional if, then, else, endif, switch, etc. +Repeat for, do, while, etc. +Label case, default, etc. +Operator "sizeof", "+", "*", etc. +Keyword any other keyword +Exception try, catch, throw + +PreProc generic Preprocessor +Include preprocessor #include +Define preprocessor #define +Macro same as Define +PreCondit preprocessor #if, #else, #endif, etc. + +Type int, long, char, etc. +StorageClass static, register, volatile, etc. +Structure struct, union, enum, etc. +Typedef a typedef + +Special any special symbol +SpecialChar special character in a constant +Tag you can use CTRL-] on this +Delimiter character that needs attention +SpecialComment special things inside a comment +Debug debugging statements + +Underlined text that stands out, HTML links + +Ignore left blank, hidden |hl-Ignore| + +Error any erroneous construct + +Todo anything that needs extra attention; mostly the + keywords TODO FIXME and XXX The names marked with * are the preferred groups; the others are minor groups. For the preferred groups, the "syntax.vim" file contains default highlighting. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index e3836a357b..44d644f945 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -393,58 +393,58 @@ instance, to highlight comments differently per language: >vim hi link @comment.doc.java String < The following captures are linked by default to standard |group-name|s: -> - @text.literal Comment - @text.reference Identifier - @text.title Title - @text.uri Underlined - @text.underline Underlined - @text.todo Todo - - @comment Comment - @punctuation Delimiter - - @constant Constant - @constant.builtin Special - @constant.macro Define - @define Define - @macro Macro - @string String - @string.escape SpecialChar - @string.special SpecialChar - @character Character - @character.special SpecialChar - @number Number - @boolean Boolean - @float Float - - @function Function - @function.builtin Special - @function.macro Macro - @parameter Identifier - @method Function - @field Identifier - @property Identifier - @constructor Special - - @conditional Conditional - @repeat Repeat - @label Label - @operator Operator - @keyword Keyword - @exception Exception - - @variable Identifier - @type Type - @type.definition Typedef - @storageclass StorageClass - @structure Structure - @namespace Identifier - @include Include - @preproc PreProc - @debug Debug - @tag Tag -< + +@text.literal Comment +@text.reference Identifier +@text.title Title +@text.uri Underlined +@text.underline Underlined +@text.todo Todo + +@comment Comment +@punctuation Delimiter + +@constant Constant +@constant.builtin Special +@constant.macro Define +@define Define +@macro Macro +@string String +@string.escape SpecialChar +@string.special SpecialChar +@character Character +@character.special SpecialChar +@number Number +@boolean Boolean +@float Float + +@function Function +@function.builtin Special +@function.macro Macro +@parameter Identifier +@method Function +@field Identifier +@property Identifier +@constructor Special + +@conditional Conditional +@repeat Repeat +@label Label +@operator Operator +@keyword Keyword +@exception Exception + +@variable Identifier +@type Type +@type.definition Typedef +@storageclass StorageClass +@structure Structure +@namespace Identifier +@include Include +@preproc PreProc +@debug Debug +@tag Tag + *treesitter-highlight-spell* The special `@spell` capture can be used to indicate that a node should be spell checked by Nvim's builtin |spell| checker. For example, the following diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua index bf3408c2d9..67c417b1be 100644 --- a/runtime/ftplugin/help.lua +++ b/runtime/ftplugin/help.lua @@ -2,6 +2,27 @@ vim.treesitter.start() -- add custom highlights for list in `:h highlight-groups` -if vim.endswith(vim.fs.normalize(vim.api.nvim_buf_get_name(0)), '/doc/syntax.txt') then - require('vim.vimhelp').highlight_groups() +local bufname = vim.fs.normalize(vim.api.nvim_buf_get_name(0)) +if vim.endswith(bufname, '/doc/syntax.txt') then + require('vim.vimhelp').highlight_groups({ + { start = [[\*group-name\*]], stop = '^======', match = '^(%w+)\t' }, + { start = [[\*highlight-groups\*]], stop = '^======', match = '^(%w+)\t' }, + }) +elseif vim.endswith(bufname, '/doc/treesitter.txt') then + require('vim.vimhelp').highlight_groups({ + { + start = [[\*treesitter-highlight-groups\*]], + stop = [[\*treesitter-highlight-spell\*]], + match = '^@[%w%p]+', + }, + }) +elseif vim.endswith(bufname, '/doc/diagnostic.txt') then + require('vim.vimhelp').highlight_groups({ + { start = [[\*diagnostic-highlights\*]], stop = '^======', match = '^(%w+)' }, + }) +elseif vim.endswith(bufname, '/doc/lsp.txt') then + require('vim.vimhelp').highlight_groups({ + { start = [[\*lsp-highlight\*]], stop = '^------', match = '^(%w+)' }, + { start = [[\*lsp-semantic-highlight\*]], stop = '^======', match = '^@[%w%p]+' }, + }) end diff --git a/runtime/lua/vim/vimhelp.lua b/runtime/lua/vim/vimhelp.lua index a4d6a50b12..4af6866d48 100644 --- a/runtime/lua/vim/vimhelp.lua +++ b/runtime/lua/vim/vimhelp.lua @@ -2,26 +2,28 @@ local M = {} --- Called when editing the doc/syntax.txt file -function M.highlight_groups() - local save_cursor = vim.fn.getcurpos() - - local start_lnum = vim.fn.search([[\*highlight-groups\*]], 'c') - if start_lnum == 0 then - return - end - local end_lnum = vim.fn.search('^======') - if end_lnum == 0 then - return - end - +--- Apply current colorscheme to lists of default highlight groups +--- +--- Note: {patterns} is assumed to be sorted by occurrence in the file. +--- @param patterns {start:string,stop:string,match:string}[] +function M.highlight_groups(patterns) local ns = vim.api.nvim_create_namespace('vimhelp') vim.api.nvim_buf_clear_namespace(0, ns, 0, -1) - for lnum = start_lnum, end_lnum do - local word = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, true)[1]:match('^(%w+)\t') - if vim.fn.hlexists(word) ~= 0 then - vim.api.nvim_buf_set_extmark(0, ns, lnum - 1, 0, { end_col = #word, hl_group = word }) + local save_cursor = vim.fn.getcurpos() + + for _, pat in pairs(patterns) do + local start_lnum = vim.fn.search(pat.start, 'c') + local end_lnum = vim.fn.search(pat.stop) + if start_lnum == 0 or end_lnum == 0 then + break + end + + for lnum = start_lnum, end_lnum do + local word = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, true)[1]:match(pat.match) + if vim.fn.hlexists(word) ~= 0 then + vim.api.nvim_buf_set_extmark(0, ns, lnum - 1, 0, { end_col = #word, hl_group = word }) + end end end -- cgit From 104565909798eff57d0bd46c56d149055b8a739b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Dec 2023 11:47:04 +0800 Subject: fix(osc52): use nvim_chan_send() to stderr for copying (#26690) The data to be written can be very long, so use nvim_chan_send() instead of io.stdout:write() as the latter doesn't handle EAGAIN. A difference of these two approaches is that nvim_chan_send() writes to stderr, not stdout, so it won't work if client stderr is redirected. --- runtime/lua/vim/ui/clipboard/osc52.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/ui/clipboard/osc52.lua b/runtime/lua/vim/ui/clipboard/osc52.lua index 6483f0387d..50afbe63a5 100644 --- a/runtime/lua/vim/ui/clipboard/osc52.lua +++ b/runtime/lua/vim/ui/clipboard/osc52.lua @@ -13,7 +13,9 @@ function M.copy(reg) local clipboard = reg == '+' and 'c' or 'p' return function(lines) local s = table.concat(lines, '\n') - io.stdout:write(osc52(clipboard, vim.base64.encode(s))) + -- The data to be written here can be quite long. + -- Use nvim_chan_send() as io.stdout:write() doesn't handle EAGAIN. #26688 + vim.api.nvim_chan_send(2, osc52(clipboard, vim.base64.encode(s))) end end -- cgit From 720a3518e3d2eee745bee1d856c92e7c1d84549f Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Tue, 19 Dec 2023 18:20:03 +0200 Subject: refactor(runtime): rewrite 'vim' color scheme in Lua Problem: Bundled 'vim' color scheme is written in Vimscript which implicitly assumes that the file is ported from Vim. This is not the case, at it is currently the Neovim's way of providing backward compatibility for color schemes. Solution: Rewrite it in Lua to indicate that this runtime file comes from Neovim. --- runtime/colors/vim.lua | 286 +++++++++++++++++++++++++++++++++++++++++++++++++ runtime/colors/vim.vim | 269 ---------------------------------------------- 2 files changed, 286 insertions(+), 269 deletions(-) create mode 100644 runtime/colors/vim.lua delete mode 100644 runtime/colors/vim.vim (limited to 'runtime') diff --git a/runtime/colors/vim.lua b/runtime/colors/vim.lua new file mode 100644 index 0000000000..4e16b6e036 --- /dev/null +++ b/runtime/colors/vim.lua @@ -0,0 +1,286 @@ +-- Name: vim +-- Description: Vim's default color scheme +-- Author: Bram Moolenaar +-- Maintainer: The Vim Project +-- Website: https://github.com/vim/vim +-- License: Same as Vim +-- Last Updated: 2023 Aug 10 + +-- This is Vim's default color scheme. It doesn't define the Normal +-- highlighting, it uses whatever the colors used to be. + +vim.cmd.highlight('clear') +vim.g.colors_name = 'vim' + +local hi = function(name, val) + -- Force links + val.force = true + + -- Make sure that `cterm` attribute is not populated from `gui` + val.cterm = val.cterm or {} + + -- Define global highlight + vim.api.nvim_set_hl(0, name, val) +end + +--stylua: ignore start +-- General +hi('Normal', {}) + +hi('Conceal', { fg = 'LightGrey', bg = 'DarkGrey', ctermfg = 'LightGrey', ctermbg = 'DarkGrey' }) +hi('Cursor', {}) +hi('lCursor', {}) +hi('DiffText', { bg = 'Red', bold = true, ctermbg = 'Red', cterm = { bold = true } }) +hi('ErrorMsg', { fg = 'White', bg = 'Red', ctermfg = 'White', ctermbg = 'DarkRed' }) +hi('IncSearch', { reverse = true, cterm = { reverse = true } }) +hi('ModeMsg', { bold = true, cterm = { bold = true } }) +hi('NonText', { fg = 'Blue', bold = true, ctermfg = 'Blue' }) +hi('PmenuSbar', { bg = 'Grey', ctermbg = 'Grey' }) +hi('StatusLine', { reverse = true, bold = true, cterm = { reverse = true, bold = true }}) +hi('StatusLineNC', { reverse = true, cterm = { reverse = true } }) +hi('TabLineFill', { reverse = true, cterm = { reverse = true } }) +hi('TabLineSel', { bold = true, cterm = { bold = true } }) +hi('TermCursor', { reverse = true, cterm = { reverse = true } }) +hi('WinBar', { bold = true, cterm = { bold = true } }) +hi('WildMenu', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' }) + +hi('VertSplit', { link = 'Normal' }) +hi('WinSeparator', { link = 'VertSplit' }) +hi('WinBarNC', { link = 'WinBar' }) +hi('EndOfBuffer', { link = 'NonText' }) +hi('LineNrAbove', { link = 'LineNr' }) +hi('LineNrBelow', { link = 'LineNr' }) +hi('QuickFixLine', { link = 'Search' }) +hi('CursorLineSign', { link = 'SignColumn' }) +hi('CursorLineFold', { link = 'FoldColumn' }) +hi('CurSearch', { link = 'Search' }) +hi('PmenuKind', { link = 'Pmenu' }) +hi('PmenuKindSel', { link = 'PmenuSel' }) +hi('PmenuExtra', { link = 'Pmenu' }) +hi('PmenuExtraSel', { link = 'PmenuSel' }) +hi('Substitute', { link = 'Search' }) +hi('Whitespace', { link = 'NonText' }) +hi('MsgSeparator', { link = 'StatusLine' }) +hi('NormalFloat', { link = 'Pmenu' }) +hi('FloatBorder', { link = 'WinSeparator' }) +hi('FloatTitle', { link = 'Title' }) +hi('FloatFooter', { link = 'Title' }) + +hi('FloatShadow', { bg = 'Black', blend=80 }) +hi('FloatShadowThrough', { bg = 'Black', blend=100 }) +hi('RedrawDebugNormal', { reverse = true, cterm = { reverse = true } }) +hi('RedrawDebugClear', { bg = 'Yellow', ctermbg = 'Yellow' }) +hi('RedrawDebugComposed', { bg = 'Green', ctermbg = 'Green' }) +hi('RedrawDebugRecompose', { bg = 'Red', ctermbg = 'Red' }) +hi('Error', { fg = 'White', bg = 'Red', ctermfg = 'White', ctermbg = 'Red' }) +hi('Todo', { fg = 'Blue', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' }) + +hi('String', { link = 'Constant' }) +hi('Character', { link = 'Constant' }) +hi('Number', { link = 'Constant' }) +hi('Boolean', { link = 'Constant' }) +hi('Float', { link = 'Number' }) +hi('Function', { link = 'Identifier' }) +hi('Conditional', { link = 'Statement' }) +hi('Repeat', { link = 'Statement' }) +hi('Label', { link = 'Statement' }) +hi('Operator', { link = 'Statement' }) +hi('Keyword', { link = 'Statement' }) +hi('Exception', { link = 'Statement' }) +hi('Include', { link = 'PreProc' }) +hi('Define', { link = 'PreProc' }) +hi('Macro', { link = 'PreProc' }) +hi('PreCondit', { link = 'PreProc' }) +hi('StorageClass', { link = 'Type' }) +hi('Structure', { link = 'Type' }) +hi('Typedef', { link = 'Type' }) +hi('Tag', { link = 'Special' }) +hi('SpecialChar', { link = 'Special' }) +hi('Delimiter', { link = 'Special' }) +hi('SpecialComment', { link = 'Special' }) +hi('Debug', { link = 'Special' }) + +hi('DiagnosticError', { fg = 'Red', ctermfg = 1 }) +hi('DiagnosticWarn', { fg = 'Orange', ctermfg = 3 }) +hi('DiagnosticInfo', { fg = 'LightBlue', ctermfg = 4 }) +hi('DiagnosticHint', { fg = 'LightGrey', ctermfg = 7 }) +hi('DiagnosticOk', { fg = 'LightGreen', ctermfg = 10 }) +hi('DiagnosticUnderlineError', { sp = 'Red', underline = true, cterm = { underline = true } }) +hi('DiagnosticUnderlineWarn', { sp = 'Orange', underline = true, cterm = { underline = true } }) +hi('DiagnosticUnderlineInfo', { sp = 'LightBlue', underline = true, cterm = { underline = true } }) +hi('DiagnosticUnderlineHint', { sp = 'LightGrey', underline = true, cterm = { underline = true } }) +hi('DiagnosticUnderlineOk', { sp = 'LightGreen', underline = true, cterm = { underline = true } }) +hi('DiagnosticVirtualTextError', { link = 'DiagnosticError' }) +hi('DiagnosticVirtualTextWarn', { link = 'DiagnosticWarn' }) +hi('DiagnosticVirtualTextInfo', { link = 'DiagnosticInfo' }) +hi('DiagnosticVirtualTextHint', { link = 'DiagnosticHint' }) +hi('DiagnosticVirtualTextOk', { link = 'DiagnosticOk' }) +hi('DiagnosticFloatingError', { link = 'DiagnosticError' }) +hi('DiagnosticFloatingWarn', { link = 'DiagnosticWarn' }) +hi('DiagnosticFloatingInfo', { link = 'DiagnosticInfo' }) +hi('DiagnosticFloatingHint', { link = 'DiagnosticHint' }) +hi('DiagnosticFloatingOk', { link = 'DiagnosticOk' }) +hi('DiagnosticSignError', { link = 'DiagnosticError' }) +hi('DiagnosticSignWarn', { link = 'DiagnosticWarn' }) +hi('DiagnosticSignInfo', { link = 'DiagnosticInfo' }) +hi('DiagnosticSignHint', { link = 'DiagnosticHint' }) +hi('DiagnosticSignOk', { link = 'DiagnosticOk' }) +hi('DiagnosticDeprecated', { sp = 'Red', strikethrough = true, cterm = { strikethrough = true } }) + +hi('DiagnosticUnnecessary', { link = 'Comment' }) +hi('LspInlayHint', { link = 'NonText' }) +hi('SnippetTabstop', { link = 'Visual' }) + +-- Text +hi('@text.literal', { link = 'Comment' }) +hi('@text.reference', { link = 'Identifier' }) +hi('@text.title', { link = 'Title' }) +hi('@text.uri', { link = 'Underlined' }) +hi('@text.underline', { link = 'Underlined' }) +hi('@text.todo', { link = 'Todo' }) + +-- Miscs +hi('@comment', { link = 'Comment' }) +hi('@punctuation', { link = 'Delimiter' }) + +-- Constants +hi('@constant', { link = 'Constant' }) +hi('@constant.builtin', { link = 'Special' }) +hi('@constant.macro', { link = 'Define' }) +hi('@define', { link = 'Define' }) +hi('@macro', { link = 'Macro' }) +hi('@string', { link = 'String' }) +hi('@string.escape', { link = 'SpecialChar' }) +hi('@string.special', { link = 'SpecialChar' }) +hi('@character', { link = 'Character' }) +hi('@character.special', { link = 'SpecialChar' }) +hi('@number', { link = 'Number' }) +hi('@boolean', { link = 'Boolean' }) +hi('@float', { link = 'Float' }) + +-- Functions +hi('@function', { link = 'Function' }) +hi('@function.builtin', { link = 'Special' }) +hi('@function.macro', { link = 'Macro' }) +hi('@parameter', { link = 'Identifier' }) +hi('@method', { link = 'Function' }) +hi('@field', { link = 'Identifier' }) +hi('@property', { link = 'Identifier' }) +hi('@constructor', { link = 'Special' }) + +-- Keywords +hi('@conditional', { link = 'Conditional' }) +hi('@repeat', { link = 'Repeat' }) +hi('@label', { link = 'Label' }) +hi('@operator', { link = 'Operator' }) +hi('@keyword', { link = 'Keyword' }) +hi('@exception', { link = 'Exception' }) + +hi('@variable', { link = 'Identifier' }) +hi('@type', { link = 'Type' }) +hi('@type.definition', { link = 'Typedef' }) +hi('@storageclass', { link = 'StorageClass' }) +hi('@namespace', { link = 'Identifier' }) +hi('@include', { link = 'Include' }) +hi('@preproc', { link = 'PreProc' }) +hi('@debug', { link = 'Debug' }) +hi('@tag', { link = 'Tag' }) + +-- LSP semantic tokens +hi('@lsp.type.class', { link = 'Structure' }) +hi('@lsp.type.comment', { link = 'Comment' }) +hi('@lsp.type.decorator', { link = 'Function' }) +hi('@lsp.type.enum', { link = 'Structure' }) +hi('@lsp.type.enumMember', { link = 'Constant' }) +hi('@lsp.type.function', { link = 'Function' }) +hi('@lsp.type.interface', { link = 'Structure' }) +hi('@lsp.type.macro', { link = 'Macro' }) +hi('@lsp.type.method', { link = 'Function' }) +hi('@lsp.type.namespace', { link = 'Structure' }) +hi('@lsp.type.parameter', { link = 'Identifier' }) +hi('@lsp.type.property', { link = 'Identifier' }) +hi('@lsp.type.struct', { link = 'Structure' }) +hi('@lsp.type.type', { link = 'Type' }) +hi('@lsp.type.typeParameter', { link = 'TypeDef' }) +hi('@lsp.type.variable', { link = 'Identifier' }) + +if vim.o.background == 'light' then + -- Default colors only used with a light background. + hi('ColorColumn', { bg = 'LightRed', ctermbg = 'LightRed' }) + hi('CursorColumn', { bg = 'Grey90', ctermbg = 'LightGrey' }) + hi('CursorLine', { bg = 'Grey90', cterm = { underline = true } }) + hi('CursorLineNr', { fg = 'Brown', bold = true, ctermfg = 'Brown', cterm = { underline = true } }) + hi('DiffAdd', { bg = 'LightBlue', ctermbg = 'LightBlue' }) + hi('DiffChange', { bg = 'LightMagenta', ctermbg = 'LightMagenta' }) + hi('DiffDelete', { fg = 'Blue', bg = 'LightCyan', bold = true, ctermfg = 'Blue', ctermbg = 'LightCyan' }) + hi('Directory', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('FoldColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('Folded', { fg = 'DarkBlue', bg = 'LightGrey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('LineNr', { fg = 'Brown', ctermfg = 'Brown' }) + hi('MatchParen', { bg = 'Cyan', ctermbg = 'Cyan' }) + hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Pmenu', { bg = 'LightMagenta', ctermfg = 'Black', ctermbg = 'LightMagenta' }) + hi('PmenuSel', { bg = 'Grey', ctermfg = 'Black', ctermbg = 'LightGrey' }) + hi('PmenuThumb', { bg = 'Black', ctermbg = 'Black' }) + hi('Question', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Search', { bg = 'Yellow', ctermbg = 'Yellow' }) + hi('SignColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('SpecialKey', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'LightRed' }) + hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'LightBlue' }) + hi('SpellLocal', { sp = 'DarkCyan', undercurl = true, ctermbg = 'Cyan' }) + hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'LightMagenta' }) + hi('TabLine', { bg = 'LightGrey', underline = true, ctermfg = 'Black', ctermbg = 'LightGrey', cterm = { underline = true } }) + hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'DarkMagenta' }) + hi('Visual', { bg = 'LightGrey', ctermbg = 'LightGrey' }) + hi('WarningMsg', { fg = 'Red', ctermfg = 'DarkRed' }) + hi('Comment', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('Constant', { fg = 'Magenta', ctermfg = 'DarkRed' }) + hi('Special', { fg = '#6a5acd', ctermfg = 'DarkMagenta' }) + hi('Identifier', { fg = 'DarkCyan', ctermfg = 'DarkCyan' }) + hi('Statement', { fg = 'Brown', bold = true, ctermfg = 'Brown' }) + hi('PreProc', { fg = '#6a0dad', ctermfg = 'DarkMagenta' }) + hi('Type', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Underlined', { fg = 'SlateBlue', underline = true, ctermfg = 'DarkMagenta', cterm = { underline = true } }) + hi('Ignore', { ctermfg = 'White' }) +else + -- Default colors only used with a dark background. + hi('ColorColumn', { bg = 'DarkRed', ctermbg = 'DarkRed' }) + hi('CursorColumn', { bg = 'Grey40', ctermbg = 'DarkGrey' }) + hi('CursorLine', { bg = 'Grey40', cterm = { underline = true } }) + hi('CursorLineNr', { fg = 'Yellow', bold = true, ctermfg = 'Yellow', cterm = { underline = true } }) + hi('DiffAdd', { bg = 'DarkBlue', ctermbg = 'DarkBlue' }) + hi('DiffChange', { bg = 'DarkMagenta', ctermbg = 'DarkMagenta' }) + hi('DiffDelete', { fg = 'Blue', bg = 'DarkCyan', bold = true, ctermfg = 'Blue', ctermbg = 'DarkCyan' }) + hi('Directory', { fg = 'Cyan', ctermfg = 'LightCyan' }) + hi('FoldColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('Folded', { fg = 'Cyan', bg = 'DarkGrey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('LineNr', { fg = 'Yellow', ctermfg = 'Yellow' }) + hi('MatchParen', { bg = 'DarkCyan', ctermbg = 'DarkCyan' }) + hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'LightGreen' }) + hi('Pmenu', { bg = 'Magenta', ctermfg = 'Black', ctermbg = 'Magenta' }) + hi('PmenuSel', { bg = 'DarkGrey', ctermfg = 'DarkGrey', ctermbg = 'Black' }) + hi('PmenuThumb', { bg = 'White', ctermbg = 'White' }) + hi('Question', { fg = 'Green', bold = true, ctermfg = 'LightGreen' }) + hi('Search', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' }) + hi('SignColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('SpecialKey', { fg = 'Cyan', ctermfg = 'LightBlue' }) + hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'Red' }) + hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'Blue' }) + hi('SpellLocal', { sp = 'Cyan', undercurl = true, ctermbg = 'Cyan' }) + hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'Magenta' }) + hi('TabLine', { bg = 'DarkGrey', underline = true, ctermfg = 'White', ctermbg = 'DarkGrey', cterm = { underline = true } }) + hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'LightMagenta' }) + hi('Visual', { bg = 'DarkGrey', ctermbg = 'DarkGrey' }) + hi('WarningMsg', { fg = 'Red', ctermfg = 'LightRed' }) + hi('Comment', { fg = '#80a0ff', ctermfg = 'Cyan' }) + hi('Constant', { fg = '#ffa0a0', ctermfg = 'Magenta' }) + hi('Special', { fg = 'Orange', ctermfg = 'LightRed' }) + hi('Identifier', { fg = '#40ffff', ctermfg = 'Cyan', cterm = { bold = true } }) + hi('Statement', { fg = '#ffff60', bold = true, ctermfg = 'Yellow' }) + hi('PreProc', { fg = '#ff80ff', ctermfg = 'LightBlue' }) + hi('Type', { fg = '#60ff60', bold = true, ctermfg = 'LightGreen' }) + hi('Underlined', { fg = '#80a0ff', underline = true, ctermfg = 'LightBlue', cterm = { underline = true } }) + hi('Ignore', { ctermfg = 'Black' }) +end +--stylua: ignore end diff --git a/runtime/colors/vim.vim b/runtime/colors/vim.vim deleted file mode 100644 index 0d02477ba7..0000000000 --- a/runtime/colors/vim.vim +++ /dev/null @@ -1,269 +0,0 @@ -" Name: vim -" Description: Vim's default color scheme -" Author: Bram Moolenaar -" Maintainer: The Vim Project -" Website: https://github.com/vim/vim -" License: Same as Vim -" Last Updated: 2023 Aug 10 - -" This is Vim's default color scheme. It doesn't define the Normal -" highlighting, it uses whatever the colors used to be. - -hi clear -let g:colors_name = 'vim' - -" General -hi Conceal guifg=LightGrey guibg=DarkGrey guisp=NONE gui=NONE ctermfg=LightGrey ctermbg=DarkGrey cterm=NONE -hi Cursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi lCursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi DiffText guifg=NONE guibg=Red guisp=NONE gui=bold ctermfg=NONE ctermbg=Red cterm=bold -hi ErrorMsg guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=DarkRed cterm=NONE -hi IncSearch guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse -hi ModeMsg guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold -hi NonText guifg=Blue guibg=NONE guisp=NONE gui=bold ctermfg=Blue ctermbg=NONE cterm=NONE -hi Normal guifg=NONE guibg=NONE guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi PmenuSbar guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=NONE ctermbg=Grey cterm=NONE -hi StatusLine guifg=NONE guibg=NONE guisp=NONE gui=reverse,bold ctermfg=NONE ctermbg=NONE cterm=reverse,bold -hi StatusLineNC guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse -hi TabLineFill guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse -hi TabLineSel guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold -hi TermCursor guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse -hi WinBar guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold -hi WildMenu guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE -hi! link VertSplit Normal -hi! link WinSeparator VertSplit -hi! link WinBarNC WinBar -hi! link EndOfBuffer NonText -hi! link LineNrAbove LineNr -hi! link LineNrBelow LineNr -hi! link QuickFixLine Search -hi! link CursorLineSign SignColumn -hi! link CursorLineFold FoldColumn -hi! link CurSearch Search -hi! link PmenuKind Pmenu -hi! link PmenuKindSel PmenuSel -hi! link PmenuExtra Pmenu -hi! link PmenuExtraSel PmenuSel -hi! link Substitute Search -hi! link Whitespace NonText -hi! link MsgSeparator StatusLine -hi! link NormalFloat Pmenu -hi! link FloatBorder WinSeparator -hi! link FloatTitle Title -hi! link FloatFooter Title -hi FloatShadow guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=80 -hi FloatShadowThrough guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=100 -hi RedrawDebugNormal guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse -hi RedrawDebugClear guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE -hi RedrawDebugComposed guifg=NONE guibg=Green guisp=NONE gui=NONE ctermfg=NONE ctermbg=Green cterm=NONE -hi RedrawDebugRecompose guifg=NONE guibg=Red guisp=NONE gui=NONE ctermfg=NONE ctermbg=Red cterm=NONE -hi Error guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=Red cterm=NONE term=reverse -hi Todo guifg=Blue guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE term=standout -hi! link String Constant -hi! link Character Constant -hi! link Number Constant -hi! link Boolean Constant -hi! link Float Number -hi! link Function Identifier -hi! link Conditional Statement -hi! link Repeat Statement -hi! link Label Statement -hi! link Operator Statement -hi! link Keyword Statement -hi! link Exception Statement -hi! link Include PreProc -hi! link Define PreProc -hi! link Macro PreProc -hi! link PreCondit PreProc -hi! link StorageClass Type -hi! link Structure Type -hi! link Typedef Type -hi! link Tag Special -hi! link SpecialChar Special -hi! link Delimiter Special -hi! link SpecialComment Special -hi! link Debug Special -hi DiagnosticError guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=1 ctermbg=NONE cterm=NONE -hi DiagnosticWarn guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=3 ctermbg=NONE cterm=NONE -hi DiagnosticInfo guifg=LightBlue guibg=NONE guisp=NONE gui=NONE ctermfg=4 ctermbg=NONE cterm=NONE -hi DiagnosticHint guifg=LightGrey guibg=NONE guisp=NONE gui=NONE ctermfg=7 ctermbg=NONE cterm=NONE -hi DiagnosticOk guifg=LightGreen guibg=NONE guisp=NONE gui=NONE ctermfg=10 ctermbg=NONE cterm=NONE -hi DiagnosticUnderlineError guifg=NONE guibg=NONE guisp=Red gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi DiagnosticUnderlineWarn guifg=NONE guibg=NONE guisp=Orange gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi DiagnosticUnderlineInfo guifg=NONE guibg=NONE guisp=LightBlue gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi DiagnosticUnderlineHint guifg=NONE guibg=NONE guisp=LightGrey gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi DiagnosticUnderlineOk guifg=NONE guibg=NONE guisp=LightGreen gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi! link DiagnosticVirtualTextError DiagnosticError -hi! link DiagnosticVirtualTextWarn DiagnosticWarn -hi! link DiagnosticVirtualTextInfo DiagnosticInfo -hi! link DiagnosticVirtualTextHint DiagnosticHint -hi! link DiagnosticVirtualTextOk DiagnosticOk -hi! link DiagnosticFloatingError DiagnosticError -hi! link DiagnosticFloatingWarn DiagnosticWarn -hi! link DiagnosticFloatingInfo DiagnosticInfo -hi! link DiagnosticFloatingHint DiagnosticHint -hi! link DiagnosticFloatingOk DiagnosticOk -hi! link DiagnosticSignError DiagnosticError -hi! link DiagnosticSignWarn DiagnosticWarn -hi! link DiagnosticSignInfo DiagnosticInfo -hi! link DiagnosticSignHint DiagnosticHint -hi! link DiagnosticSignOk DiagnosticOk -hi DiagnosticDeprecated guifg=NONE guibg=NONE guisp=Red gui=strikethrough ctermfg=NONE ctermbg=NONE cterm=strikethrough -hi! link DiagnosticUnnecessary Comment -hi! link LspInlayHint NonText -hi! link SnippetTabstop Visual - -" Text -hi! link @text.literal Comment -hi! link @text.reference Identifier -hi! link @text.title Title -hi! link @text.uri Underlined -hi! link @text.underline Underlined -hi! link @text.todo Todo - -" Miscs -hi! link @comment Comment -hi! link @punctuation Delimiter - -" Constants -hi! link @constant Constant -hi! link @constant.builtin Special -hi! link @constant.macro Define -hi! link @define Define -hi! link @macro Macro -hi! link @string String -hi! link @string.escape SpecialChar -hi! link @string.special SpecialChar -hi! link @character Character -hi! link @character.special SpecialChar -hi! link @number Number -hi! link @boolean Boolean -hi! link @float Float - -" Functions -hi! link @function Function -hi! link @function.builtin Special -hi! link @function.macro Macro -hi! link @parameter Identifier -hi! link @method Function -hi! link @field Identifier -hi! link @property Identifier -hi! link @constructor Special - -" Keywords -hi! link @conditional Conditional -hi! link @repeat Repeat -hi! link @label Label -hi! link @operator Operator -hi! link @keyword Keyword -hi! link @exception Exception - -hi! link @variable Identifier -hi! link @type Type -hi! link @type.definition Typedef -hi! link @storageclass StorageClass -hi! link @namespace Identifier -hi! link @include Include -hi! link @preproc PreProc -hi! link @debug Debug -hi! link @tag Tag - -" LSP semantic tokens -hi! link @lsp.type.class Structure -hi! link @lsp.type.comment Comment -hi! link @lsp.type.decorator Function -hi! link @lsp.type.enum Structure -hi! link @lsp.type.enumMember Constant -hi! link @lsp.type.function Function -hi! link @lsp.type.interface Structure -hi! link @lsp.type.macro Macro -hi! link @lsp.type.method Function -hi! link @lsp.type.namespace Structure -hi! link @lsp.type.parameter Identifier -hi! link @lsp.type.property Identifier -hi! link @lsp.type.struct Structure -hi! link @lsp.type.type Type -hi! link @lsp.type.typeParameter TypeDef -hi! link @lsp.type.variable Identifier - -if &background ==# 'light' - " Default colors only used with a light background. - hi ColorColumn guifg=NONE guibg=LightRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightRed cterm=NONE - hi CursorColumn guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightGrey cterm=NONE - hi CursorLine guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline - hi CursorLineNr guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=underline - hi DiffAdd guifg=NONE guibg=LightBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightBlue cterm=NONE - hi DiffChange guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightMagenta cterm=NONE - hi DiffDelete guifg=Blue guibg=LightCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=LightCyan cterm=NONE - hi Directory guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE - hi FoldColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE - hi Folded guifg=DarkBlue guibg=LightGrey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE - hi LineNr guifg=Brown guibg=NONE guisp=NONE gui=NONE ctermfg=Brown ctermbg=NONE cterm=NONE - hi MatchParen guifg=NONE guibg=Cyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=Cyan cterm=NONE - hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE - hi Pmenu guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=Black ctermbg=LightMagenta cterm=NONE - hi PmenuSel guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=Black ctermbg=LightGrey cterm=NONE blend=NONE - hi PmenuThumb guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=Black cterm=NONE - hi Question guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE - hi Search guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE - hi SignColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE - hi SpecialKey guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE - hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=LightRed cterm=NONE - hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=LightBlue cterm=NONE - hi SpellLocal guifg=NONE guibg=NONE guisp=DarkCyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE - hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=LightMagenta cterm=NONE - hi TabLine guifg=NONE guibg=LightGrey guisp=NONE gui=underline ctermfg=black ctermbg=LightGrey cterm=underline - hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=DarkMagenta ctermbg=NONE cterm=NONE - hi Visual guifg=NONE guibg=LightGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightGrey cterm=NONE - hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE - hi Comment guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE term=bold - hi Constant guifg=Magenta guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE term=underline - hi Special guifg=#6a5acd guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=bold - hi Identifier guifg=DarkCyan guibg=NONE guisp=NONE gui=NONE ctermfg=DarkCyan ctermbg=NONE cterm=NONE term=underline - hi Statement guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=NONE term=bold - hi PreProc guifg=#6a0dad guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=underline - hi Type guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE term=underline - hi Underlined guifg=SlateBlue guibg=NONE guisp=NONE gui=underline ctermfg=DarkMagenta ctermbg=NONE cterm=underline term=underline - hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE term=NONE -else - " Default colors only used with a dark background. - hi ColorColumn guifg=NONE guibg=DarkRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkRed cterm=NONE - hi CursorColumn guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkGrey cterm=NONE - hi CursorLine guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline - hi CursorLineNr guifg=Yellow guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=underline - hi DiffAdd guifg=NONE guibg=DarkBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkBlue cterm=NONE - hi DiffChange guifg=NONE guibg=DarkMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkMagenta cterm=NONE - hi DiffDelete guifg=Blue guibg=DarkCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=DarkCyan cterm=NONE - hi Directory guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightCyan ctermbg=NONE cterm=NONE - hi FoldColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE - hi Folded guifg=Cyan guibg=DarkGrey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE - hi LineNr guifg=Yellow guibg=NONE guisp=NONE gui=NONE ctermfg=Yellow ctermbg=NONE cterm=NONE - hi MatchParen guifg=NONE guibg=DarkCyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkCyan cterm=NONE - hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE - hi Pmenu guifg=NONE guibg=Magenta guisp=NONE gui=NONE ctermfg=Black ctermbg=Magenta cterm=NONE - hi PmenuSel guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=DarkGrey ctermbg=Black cterm=NONE blend=NONE - hi PmenuThumb guifg=NONE guibg=White guisp=NONE gui=NONE ctermfg=NONE ctermbg=White cterm=NONE - hi Question guifg=Green guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE - hi Search guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE - hi SignColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE - hi SpecialKey guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE - hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=Red cterm=NONE - hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=Blue cterm=NONE - hi SpellLocal guifg=NONE guibg=NONE guisp=Cyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE - hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=Magenta cterm=NONE - hi TabLine guifg=NONE guibg=DarkGrey guisp=NONE gui=underline ctermfg=white ctermbg=DarkGrey cterm=underline - hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=LightMagenta ctermbg=NONE cterm=NONE - hi Visual guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkGrey cterm=NONE - hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE - hi Comment guifg=#80a0ff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=NONE term=bold - hi Constant guifg=#ffa0a0 guibg=NONE guisp=NONE gui=NONE ctermfg=Magenta ctermbg=NONE cterm=NONE term=underline - hi Special guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE term=bold - hi Identifier guifg=#40ffff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=bold term=underline - hi Statement guifg=#ffff60 guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=NONE term=bold - hi PreProc guifg=#ff80ff guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE term=underline - hi Type guifg=#60ff60 guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE term=underline - hi Underlined guifg=#80a0ff guibg=NONE guisp=NONE gui=underline ctermfg=LightBlue ctermbg=NONE cterm=underline term=underline - hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=black ctermbg=NONE cterm=NONE term=NONE -endif - -" vim: sw=2 -- cgit From d431a4d410f02af2039d7c98e4e33136fd1e4849 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Thu, 21 Dec 2023 14:53:43 +0200 Subject: fix(runtime): source old color scheme in bundled color schemes (#26641) Problem: Bundled color schemes use `:hi clear` and only define Vim's highlight groups. This results into Nvim-specific highlight groups using definitions from Nvim's default color scheme, which are not always linked to a Vim's highlight group. Solution: Restore links to Vim's highlight groups which were present before Nvim's default color scheme update. --- runtime/colors/blue.vim | 3 ++- runtime/colors/darkblue.vim | 3 ++- runtime/colors/delek.vim | 3 ++- runtime/colors/desert.vim | 3 ++- runtime/colors/elflord.vim | 3 ++- runtime/colors/evening.vim | 3 ++- runtime/colors/habamax.vim | 3 ++- runtime/colors/industry.vim | 3 ++- runtime/colors/koehler.vim | 3 ++- runtime/colors/lunaperche.vim | 3 ++- runtime/colors/morning.vim | 3 ++- runtime/colors/murphy.vim | 3 ++- runtime/colors/pablo.vim | 3 ++- runtime/colors/peachpuff.vim | 3 ++- runtime/colors/quiet.vim | 3 ++- runtime/colors/retrobox.vim | 3 ++- runtime/colors/ron.vim | 3 ++- runtime/colors/shine.vim | 3 ++- runtime/colors/slate.vim | 3 ++- runtime/colors/sorbet.vim | 3 ++- runtime/colors/torte.vim | 3 ++- runtime/colors/wildcharm.vim | 3 ++- runtime/colors/zaibatsu.vim | 3 ++- runtime/colors/zellner.vim | 3 ++- runtime/doc/news.txt | 3 ++- runtime/doc/vim_diff.txt | 5 +++-- 26 files changed, 53 insertions(+), 27 deletions(-) (limited to 'runtime') diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index f0009d1000..2d0e48f448 100644 --- a/runtime/colors/blue.vim +++ b/runtime/colors/blue.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'blue' let s:t_Co = &t_Co diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index ec8d03ed22..05b3fa4199 100644 --- a/runtime/colors/darkblue.vim +++ b/runtime/colors/darkblue.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'darkblue' let s:t_Co = &t_Co diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim index e8152e3e39..1919526760 100644 --- a/runtime/colors/delek.vim +++ b/runtime/colors/delek.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'delek' let s:t_Co = &t_Co diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim index 627394df3e..453e966899 100644 --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'desert' let s:t_Co = &t_Co diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim index 4808f1158f..001368861f 100644 --- a/runtime/colors/elflord.vim +++ b/runtime/colors/elflord.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'elflord' let s:t_Co = &t_Co diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index fd689461f0..01fc0d8354 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'evening' let s:t_Co = &t_Co diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim index fd372b9e73..1073ba3d93 100644 --- a/runtime/colors/habamax.vim +++ b/runtime/colors/habamax.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'habamax' let s:t_Co = &t_Co diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim index 28d410be65..449bf3b676 100644 --- a/runtime/colors/industry.vim +++ b/runtime/colors/industry.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'industry' let s:t_Co = &t_Co diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index c1eb425d7e..8a63f91a94 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'koehler' let s:t_Co = &t_Co diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim index e9a4e8ecf6..3c8682737e 100644 --- a/runtime/colors/lunaperche.vim +++ b/runtime/colors/lunaperche.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'lunaperche' let s:t_Co = &t_Co diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index def4f9ef65..12f1efe9a6 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'morning' let s:t_Co = &t_Co diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index 434fafc058..66b994a6c7 100644 --- a/runtime/colors/murphy.vim +++ b/runtime/colors/murphy.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'murphy' let s:t_Co = &t_Co diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim index b4335eedec..f53739bc6d 100644 --- a/runtime/colors/pablo.vim +++ b/runtime/colors/pablo.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'pablo' let s:t_Co = &t_Co diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim index 3ae756f682..f4c1e21697 100644 --- a/runtime/colors/peachpuff.vim +++ b/runtime/colors/peachpuff.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'peachpuff' let s:t_Co = &t_Co diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim index 52d49ba258..d7f8582888 100644 --- a/runtime/colors/quiet.vim +++ b/runtime/colors/quiet.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'quiet' let s:t_Co = &t_Co diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim index f9d8d329e4..b4a194d885 100644 --- a/runtime/colors/retrobox.vim +++ b/runtime/colors/retrobox.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'retrobox' let s:t_Co = &t_Co diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index 1ea8d71143..4d55f9978f 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'ron' let s:t_Co = &t_Co diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim index 4e2e4bc3d9..b4a8793589 100644 --- a/runtime/colors/shine.vim +++ b/runtime/colors/shine.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'shine' let s:t_Co = &t_Co diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim index 225a845de3..aab6208b26 100644 --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'slate' let s:t_Co = &t_Co diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim index 77e2223dca..e4ef42469c 100644 --- a/runtime/colors/sorbet.vim +++ b/runtime/colors/sorbet.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'sorbet' let s:t_Co = &t_Co diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim index bcba7258da..36da28e596 100644 --- a/runtime/colors/torte.vim +++ b/runtime/colors/torte.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'torte' let s:t_Co = &t_Co diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim index f41e5379f0..ae0489e259 100644 --- a/runtime/colors/wildcharm.vim +++ b/runtime/colors/wildcharm.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'wildcharm' let s:t_Co = &t_Co diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim index 50c5122989..726843345b 100644 --- a/runtime/colors/zaibatsu.vim +++ b/runtime/colors/zaibatsu.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'zaibatsu' let s:t_Co = &t_Co diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim index a998033566..37f012e92d 100644 --- a/runtime/colors/zellner.vim +++ b/runtime/colors/zellner.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'zellner' let s:t_Co = &t_Co diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index f8d1dea78f..b85cbe7b95 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -106,7 +106,8 @@ The following changes may require adaptations in user config or plugins. This also might result into some color schemes looking differently due to them relying on an implicit assumptions about how highlight groups are defined by default. To account for this, define all attributes of highlight - groups explicitly or use `:colorscheme vim` to restore previous definitions. + groups explicitly. Alternatively, use `:colorscheme vim` or + `:source $VIMRUNTIME/colors/vim.lua` to restore previous definitions. • 'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index ca260246fc..0552689860 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -32,8 +32,9 @@ Defaults *nvim-defaults* ":syntax off" to |init.vim|. - Default color scheme has been updated. This can result in color schemes looking differently due to them relying on how highlight groups are defined - by default. Add ":colorscheme vim" to |init.vim| or your color scheme file to - restore the old default links and colors. + by default. Add ":colorscheme vim" to |init.vim| or + ":source $VIMRUNTIME/colors/vim.lua" to your color scheme file to restore + the old default links and colors. - 'autoindent' is enabled - 'autoread' is enabled (works in all UIs, including terminal) -- cgit From a8935d97acfd2453789ba6fdba9bc4d12f19e9c6 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 20 Dec 2023 15:12:31 +0000 Subject: docs: move vim-variables to separate file --- runtime/doc/eval.txt | 619 +------------------------------------------------ runtime/doc/vvars.txt | 630 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 632 insertions(+), 617 deletions(-) create mode 100644 runtime/doc/vvars.txt (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a3ba098740..076d324b60 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1765,624 +1765,9 @@ variables for each buffer. Use local buffer variables instead |b:var|. PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:* *E963* -Some variables can be set by the user, but the type cannot be changed. - - *v:argv* *argv-variable* -v:argv The command line arguments Vim was invoked with. This is a - list of strings. The first item is the Vim command. - See |v:progpath| for the command with full path. - - *v:char* *char-variable* -v:char Argument for evaluating 'formatexpr' and used for the typed - character when using in an abbreviation |:map-|. - It is also used by the |InsertCharPre| and |InsertEnter| events. - - *v:charconvert_from* *charconvert_from-variable* -v:charconvert_from - The name of the character encoding of a file to be converted. - Only valid while evaluating the 'charconvert' option. - - *v:charconvert_to* *charconvert_to-variable* -v:charconvert_to - The name of the character encoding of a file after conversion. - Only valid while evaluating the 'charconvert' option. - - *v:cmdarg* *cmdarg-variable* -v:cmdarg - The extra arguments ("++p", "++enc=", "++ff=") given to a file - read/write command. This is set before an autocommand event - for a file read/write command is triggered. There is a - leading space to make it possible to append this variable - directly after the read/write command. Note: "+cmd" isn't - included here, because it will be executed anyway. - - *v:collate* *collate-variable* -v:collate The current locale setting for collation order of the runtime - environment. This allows Vim scripts to be aware of the - current locale encoding. Technical: it's the value of - LC_COLLATE. When not using a locale the value is "C". - This variable can not be set directly, use the |:language| - command. - See |multi-lang|. - - *v:cmdbang* *cmdbang-variable* -v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" - was used the value is 1, otherwise it is 0. Note that this - can only be used in autocommands. For user commands || - can be used. - - *v:completed_item* *completed_item-variable* -v:completed_item - Dictionary containing the most recent |complete-items| after - |CompleteDone|. Empty if the completion failed, or after - leaving and re-entering insert mode. - Note: Plugins can modify the value to emulate the builtin - |CompleteDone| event behavior. - - *v:count* *count-variable* -v:count The count given for the last Normal mode command. Can be used - to get the count before a mapping. Read-only. Example: > - :map _x :echo "the count is " .. v:count -< Note: The is required to remove the line range that you - get when typing ':' after a count. - When there are two counts, as in "3d2w", they are multiplied, - just like what happens in the command, "d6w" for the example. - Also used for evaluating the 'formatexpr' option. - - *v:count1* *count1-variable* -v:count1 Just like "v:count", but defaults to one when no count is - used. - - *v:ctype* *ctype-variable* -v:ctype The current locale setting for characters of the runtime - environment. This allows Vim scripts to be aware of the - current locale encoding. Technical: it's the value of - LC_CTYPE. When not using a locale the value is "C". - This variable can not be set directly, use the |:language| - command. - See |multi-lang|. - - *v:dying* *dying-variable* -v:dying Normally zero. When a deadly signal is caught it's set to - one. When multiple signals are caught the number increases. - Can be used in an autocommand to check if Vim didn't - terminate normally. - Example: > - :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif -< Note: if another deadly signal is caught when v:dying is one, - VimLeave autocommands will not be executed. - - *v:exiting* *exiting-variable* -v:exiting Exit code, or |v:null| before invoking the |VimLeavePre| - and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. - Example: > - :au VimLeave * echo "Exit value is " .. v:exiting -< - *v:echospace* *echospace-variable* -v:echospace Number of screen cells that can be used for an `:echo` message - in the last screen line before causing the |hit-enter-prompt|. - Depends on 'showcmd', 'ruler' and 'columns'. You need to - check 'cmdheight' for whether there are full-width lines - available above the last line. - - *v:errmsg* *errmsg-variable* -v:errmsg Last given error message. - Modifiable (can be set). - Example: > - :let v:errmsg = "" - :silent! next - :if v:errmsg != "" - : ... handle error -< - *v:errors* *errors-variable* *assert-return* -v:errors Errors found by assert functions, such as |assert_true()|. - This is a list of strings. - The assert functions append an item when an assert fails. - The return value indicates this: a one is returned if an item - was added to v:errors, otherwise zero is returned. - To remove old results make it empty: > - :let v:errors = [] -< If v:errors is set to anything but a list it is made an empty - list by the assert function. - - *v:event* *event-variable* -v:event Dictionary of event data for the current |autocommand|. Valid - only during the event lifetime; storing or passing v:event is - invalid! Copy it instead: > - au TextYankPost * let g:foo = deepcopy(v:event) -< Keys vary by event; see the documentation for the specific - event, e.g. |DirChanged| or |TextYankPost|. - KEY DESCRIPTION ~ - abort Whether the event triggered during - an aborting condition (e.g. |c_Esc| or - |c_CTRL-C| for |CmdlineLeave|). - chan |channel-id| - cmdlevel Level of cmdline. - cmdtype Type of cmdline, |cmdline-char|. - cwd Current working directory. - inclusive Motion is |inclusive|, else exclusive. - scope Event-specific scope name. - operator Current |operator|. Also set for Ex - commands (unlike |v:operator|). For - example if |TextYankPost| is triggered - by the |:yank| Ex command then - `v:event.operator` is "y". - regcontents Text stored in the register as a - |readfile()|-style list of lines. - regname Requested register (e.g "x" for "xyy) - or the empty string for an unnamed - operation. - regtype Type of register as returned by - |getregtype()|. - visual Selection is visual (as opposed to, - e.g., via motion). - completed_item Current selected complete item on - |CompleteChanged|, Is `{}` when no complete - item selected. - height Height of popup menu on |CompleteChanged| - width width of popup menu on |CompleteChanged| - row Row count of popup menu on |CompleteChanged|, - relative to screen. - col Col count of popup menu on |CompleteChanged|, - relative to screen. - size Total number of completion items on - |CompleteChanged|. - scrollbar Is |v:true| if popup menu have scrollbar, or - |v:false| if not. - changed_window Is |v:true| if the event fired while - changing window (or tab) on |DirChanged|. - status Job status or exit code, -1 means "unknown". |TermClose| - - *v:exception* *exception-variable* -v:exception The value of the exception most recently caught and not - finished. See also |v:throwpoint| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "caught " .. v:exception - :endtry -< Output: "caught oops". - - *v:false* *false-variable* -v:false Special value used to put "false" in JSON and msgpack. See - |json_encode()|. This value is converted to "v:false" when used - as a String (e.g. in |expr5| with string concatenation - operator) and to zero when used as a Number (e.g. in |expr5| - or |expr7| when used with numeric operators). Read-only. - - *v:fcs_reason* *fcs_reason-variable* -v:fcs_reason The reason why the |FileChangedShell| event was triggered. - Can be used in an autocommand to decide what to do and/or what - to set v:fcs_choice to. Possible values: - deleted file no longer exists - conflict file contents, mode or timestamp was - changed and buffer is modified - changed file contents has changed - mode mode of file changed - time only file timestamp changed - - *v:fcs_choice* *fcs_choice-variable* -v:fcs_choice What should happen after a |FileChangedShell| event was - triggered. Can be used in an autocommand to tell Vim what to - do with the affected buffer: - reload Reload the buffer (does not work if - the file was deleted). - edit Reload the buffer and detect the - values for options such as - 'fileformat', 'fileencoding', 'binary' - (does not work if the file was - deleted). - ask Ask the user what to do, as if there - was no autocommand. Except that when - only the timestamp changed nothing - will happen. - Nothing, the autocommand should do - everything that needs to be done. - The default is empty. If another (invalid) value is used then - Vim behaves like it is empty, there is no warning message. - - *v:fname* *fname-variable* -v:fname When evaluating 'includeexpr': the file name that was - detected. Empty otherwise. - - *v:fname_in* *fname_in-variable* -v:fname_in The name of the input file. Valid while evaluating: - option used for ~ - 'charconvert' file to be converted - 'diffexpr' original file - 'patchexpr' original file - And set to the swap file name for |SwapExists|. - - *v:fname_out* *fname_out-variable* -v:fname_out The name of the output file. Only valid while - evaluating: - option used for ~ - 'charconvert' resulting converted file [1] - 'diffexpr' output of diff - 'patchexpr' resulting patched file - [1] When doing conversion for a write command (e.g., ":w - file") it will be equal to v:fname_in. When doing conversion - for a read command (e.g., ":e file") it will be a temporary - file and different from v:fname_in. - - *v:fname_new* *fname_new-variable* -v:fname_new The name of the new version of the file. Only valid while - evaluating 'diffexpr'. - - *v:fname_diff* *fname_diff-variable* -v:fname_diff The name of the diff (patch) file. Only valid while - evaluating 'patchexpr'. - - *v:folddashes* *folddashes-variable* -v:folddashes Used for 'foldtext': dashes representing foldlevel of a closed - fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldlevel* *foldlevel-variable* -v:foldlevel Used for 'foldtext': foldlevel of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldend* *foldend-variable* -v:foldend Used for 'foldtext': last line of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldstart* *foldstart-variable* -v:foldstart Used for 'foldtext': first line of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that indicates whether search highlighting is on. - Setting it makes sense only if 'hlsearch' is enabled. Setting - this variable to zero acts like the |:nohlsearch| command, - setting it to one acts like > - let &hlsearch = &hlsearch -< Note that the value is restored when returning from a - function. |function-search-undo|. - - *v:insertmode* *insertmode-variable* -v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand - events. Values: - i Insert mode - r Replace mode - v Virtual Replace mode - - *v:key* *key-variable* -v:key Key of the current item of a |Dictionary|. Only valid while - evaluating the expression used with |map()| and |filter()|. - Read-only. - - *v:lang* *lang-variable* -v:lang The current locale setting for messages of the runtime - environment. This allows Vim scripts to be aware of the - current language. Technical: it's the value of LC_MESSAGES. - The value is system dependent. - This variable can not be set directly, use the |:language| - command. - It can be different from |v:ctype| when messages are desired - in a different language than what is used for character - encoding. See |multi-lang|. - - *v:lc_time* *lc_time-variable* -v:lc_time The current locale setting for time messages of the runtime - environment. This allows Vim scripts to be aware of the - current language. Technical: it's the value of LC_TIME. - This variable can not be set directly, use the |:language| - command. See |multi-lang|. - - *v:lnum* *lnum-variable* -v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr', - 'indentexpr' and 'statuscolumn' expressions, tab page number - for 'guitablabel' and 'guitabtooltip'. Only valid while one of - these expressions is being evaluated. Read-only when in the - |sandbox|. - - *v:lua* *lua-variable* -v:lua Prefix for calling Lua functions from expressions. - See |v:lua-call| for more information. - - *v:maxcol* *maxcol-variable* -v:maxcol Maximum line length. Depending on where it is used it can be - screen columns, characters or bytes. The value currently is - 2147483647 on all systems. - - *v:mouse_win* *mouse_win-variable* -v:mouse_win Window number for a mouse click obtained with |getchar()|. - First window has number 1, like with |winnr()|. The value is - zero when there was no mouse button click. - - *v:mouse_winid* *mouse_winid-variable* -v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|. - The value is zero when there was no mouse button click. - - *v:mouse_lnum* *mouse_lnum-variable* -v:mouse_lnum Line number for a mouse click obtained with |getchar()|. - This is the text line number, not the screen line number. The - value is zero when there was no mouse button click. - - *v:mouse_col* *mouse_col-variable* -v:mouse_col Column number for a mouse click obtained with |getchar()|. - This is the screen column number, like with |virtcol()|. The - value is zero when there was no mouse button click. - - *v:msgpack_types* *msgpack_types-variable* -v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| - and |msgpackdump()|. All types inside dictionary are fixed - (not editable) empty lists. To check whether some list is one - of msgpack types, use |is| operator. - - *v:null* *null-variable* -v:null Special value used to put "null" in JSON and NIL in msgpack. - See |json_encode()|. This value is converted to "v:null" when - used as a String (e.g. in |expr5| with string concatenation - operator) and to zero when used as a Number (e.g. in |expr5| - or |expr7| when used with numeric operators). Read-only. - In some places `v:null` can be used for a List, Dict, etc. - that is not set. That is slightly different than an empty - List, Dict, etc. - - *v:numbermax* *numbermax-variable* -v:numbermax Maximum value of a number. - - *v:numbermin* *numbermin-variable* -v:numbermin Minimum value of a number (negative). - - *v:numbersize* *numbersize-variable* -v:numbersize Number of bits in a Number. This is normally 64, but on some - systems it may be 32. - - *v:oldfiles* *oldfiles-variable* -v:oldfiles List of file names that is loaded from the |shada| file on - startup. These are the files that Vim remembers marks for. - The length of the List is limited by the ' argument of the - 'shada' option (default is 100). - When the |shada| file is not used the List is empty. - Also see |:oldfiles| and |c_#<|. - The List can be modified, but this has no effect on what is - stored in the |shada| file later. If you use values other - than String this will cause trouble. - - *v:option_new* -v:option_new New value of the option. Valid while executing an |OptionSet| - autocommand. - *v:option_old* -v:option_old Old value of the option. Valid while executing an |OptionSet| - autocommand. Depending on the command used for setting and the - kind of option this is either the local old value or the - global old value. - *v:option_oldlocal* -v:option_oldlocal - Old local value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_oldglobal* -v:option_oldglobal - Old global value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_type* -v:option_type Scope of the set command. Valid while executing an - |OptionSet| autocommand. Can be either "global" or "local" - *v:option_command* -v:option_command - Command used to set the option. Valid while executing an - |OptionSet| autocommand. - value option was set via ~ - "setlocal" |:setlocal| or ":let l:xxx" - "setglobal" |:setglobal| or ":let g:xxx" - "set" |:set| or |:let| - "modeline" |modeline| - *v:operator* *operator-variable* -v:operator The last operator given in Normal mode. This is a single - character except for commands starting with or , - in which case it is two characters. Best used alongside - |v:prevcount| and |v:register|. Useful if you want to cancel - Operator-pending mode and then use the operator, e.g.: > - :omap O :call MyMotion(v:operator) -< The value remains set until another operator is entered, thus - don't expect it to be empty. - v:operator is not set for |:delete|, |:yank| or other Ex - commands. - Read-only. - - *v:prevcount* *prevcount-variable* -v:prevcount The count given for the last but one Normal mode command. - This is the v:count value of the previous command. Useful if - you want to cancel Visual or Operator-pending mode and then - use the count, e.g.: > - :vmap % :call MyFilter(v:prevcount) -< Read-only. - - *v:profiling* *profiling-variable* -v:profiling Normally zero. Set to one after using ":profile start". - See |profiling|. - - *v:progname* *progname-variable* -v:progname The name by which Nvim was invoked (with path removed). - Read-only. - - *v:progpath* *progpath-variable* -v:progpath Absolute path to the current running Nvim. - Read-only. - - *v:register* *register-variable* -v:register The name of the register in effect for the current normal mode - command (regardless of whether that command actually used a - register). Or for the currently executing normal mode mapping - (use this in custom commands that take a register). - If none is supplied it is the default register '"', unless - 'clipboard' contains "unnamed" or "unnamedplus", then it is - "*" or '+'. - Also see |getreg()| and |setreg()| - - *v:relnum* *relnum-variable* -v:relnum Relative line number for the 'statuscolumn' expression. - Read-only. - - *v:scrollstart* *scrollstart-variable* -v:scrollstart String describing the script or function that caused the - screen to scroll up. It's only set when it is empty, thus the - first reason is remembered. It is set to "Unknown" for a - typed command. - This can be used to find out why your script causes the - hit-enter prompt. - - *v:servername* *servername-variable* -v:servername Primary listen-address of Nvim, the first item returned by - |serverlist()|. Usually this is the named pipe created by Nvim - at |startup| or given by |--listen| (or the deprecated - |$NVIM_LISTEN_ADDRESS| env var). - - See also |serverstart()| |serverstop()|. - Read-only. - - *$NVIM* - $NVIM is set by |terminal| and |jobstart()|, and is thus - a hint that the current environment is a subprocess of Nvim. - Example: > - if $NVIM - echo nvim_get_chan_info(v:parent) - endif - -< Note the contents of $NVIM may change in the future. - -v:searchforward *v:searchforward* *searchforward-variable* - Search direction: 1 after a forward search, 0 after a - backward search. It is reset to forward when directly setting - the last search pattern, see |quote/|. - Note that the value is restored when returning from a - function. |function-search-undo|. - Read-write. - - *v:shell_error* *shell_error-variable* -v:shell_error Result of the last shell command. When non-zero, the last - shell command had an error. When zero, there was no problem. - This only works when the shell returns the error code to Vim. - The value -1 is often used when the command could not be - executed. Read-only. - Example: > - :!mv foo bar - :if v:shell_error - : echo 'could not rename "foo" to "bar"!' - :endif -< - *v:statusmsg* *statusmsg-variable* -v:statusmsg Last given status message. - Modifiable (can be set). - - *v:stderr* *stderr-variable* -v:stderr |channel-id| corresponding to stderr. The value is always 2; - use this variable to make your code more descriptive. - Unlike stdin and stdout (see |stdioopen()|), stderr is always - open for writing. Example: > - :call chansend(v:stderr, "error: toaster empty\n") -< - *v:swapname* *swapname-variable* -v:swapname Name of the swapfile found. - Only valid during |SwapExists| event. - Read-only. - - *v:swapchoice* *swapchoice-variable* -v:swapchoice |SwapExists| autocommands can set this to the selected choice - for handling an existing swapfile: - 'o' Open read-only - 'e' Edit anyway - 'r' Recover - 'd' Delete swapfile - 'q' Quit - 'a' Abort - The value should be a single-character string. An empty value - results in the user being asked, as would happen when there is - no SwapExists autocommand. The default is empty. - - *v:swapcommand* *swapcommand-variable* -v:swapcommand Normal mode command to be executed after a file has been - opened. Can be used for a |SwapExists| autocommand to have - another Vim open the file and jump to the right place. For - example, when jumping to a tag the value is ":tag tagname\r". - For ":edit +cmd file" the value is ":cmd\r". - - *v:t_TYPE* *v:t_bool* *t_bool-variable* -v:t_bool Value of |Boolean| type. Read-only. See: |type()| - *v:t_dict* *t_dict-variable* -v:t_dict Value of |Dictionary| type. Read-only. See: |type()| - *v:t_float* *t_float-variable* -v:t_float Value of |Float| type. Read-only. See: |type()| - *v:t_func* *t_func-variable* -v:t_func Value of |Funcref| type. Read-only. See: |type()| - *v:t_list* *t_list-variable* -v:t_list Value of |List| type. Read-only. See: |type()| - *v:t_number* *t_number-variable* -v:t_number Value of |Number| type. Read-only. See: |type()| - *v:t_string* *t_string-variable* -v:t_string Value of |String| type. Read-only. See: |type()| - *v:t_blob* *t_blob-variable* -v:t_blob Value of |Blob| type. Read-only. See: |type()| - - *v:termresponse* *termresponse-variable* -v:termresponse The value of the most recent OSC or DCS escape sequence - received by Nvim from the terminal. This can be read in a - |TermResponse| event handler after querying the terminal using - another escape sequence. - - *v:testing* *testing-variable* -v:testing Must be set before using `test_garbagecollect_now()`. - - *v:this_session* *this_session-variable* -v:this_session Full filename of the last loaded or saved session file. - Empty when no session file has been saved. See |:mksession|. - Modifiable (can be set). - - *v:throwpoint* *throwpoint-variable* -v:throwpoint The point where the exception most recently caught and not - finished was thrown. Not set when commands are typed. See - also |v:exception| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "Exception from" v:throwpoint - :endtry -< Output: "Exception from test.vim, line 2" - - *v:true* *true-variable* -v:true Special value used to put "true" in JSON and msgpack. See - |json_encode()|. This value is converted to "v:true" when used - as a String (e.g. in |expr5| with string concatenation - operator) and to one when used as a Number (e.g. in |expr5| or - |expr7| when used with numeric operators). Read-only. - - *v:val* *val-variable* -v:val Value of the current item of a |List| or |Dictionary|. Only - valid while evaluating the expression used with |map()| and - |filter()|. Read-only. - - *v:version* *version-variable* -v:version Vim version number: major version times 100 plus minor - version. Vim 5.0 is 500, Vim 5.1 is 501. - Read-only. - Use |has()| to check the Nvim (not Vim) version: > - :if has("nvim-0.2.1") -< - *v:virtnum* *virtnum-variable* -v:virtnum Virtual line number for the 'statuscolumn' expression. - Negative when drawing the status column for virtual lines, zero - when drawing an actual buffer line, and positive when drawing - the wrapped part of a buffer line. - Read-only. - - *v:vim_did_enter* *vim_did_enter-variable* -v:vim_did_enter 0 during startup, 1 just before |VimEnter|. - Read-only. - - *v:warningmsg* *warningmsg-variable* -v:warningmsg Last given warning message. - Modifiable (can be set). - - *v:windowid* *windowid-variable* -v:windowid Application-specific window "handle" which may be set by any - attached UI. Defaults to zero. - Note: For Nvim |windows| use |winnr()| or |win_getid()|, see - |window-ID|. +The alphabetic list of all builtin variables and details are in a separate +help file: |vvars|. ============================================================================== 4. Builtin Functions *vim-function* *functions* diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt new file mode 100644 index 0000000000..73812d3ef4 --- /dev/null +++ b/runtime/doc/vvars.txt @@ -0,0 +1,630 @@ +*vvars.txt* Nvim + + + NVIM REFERENCE MANUAL + + +Predefined variables *vvars* + +Some variables can be set by the user, but the type cannot be changed. + + Type |gO| to see the table of contents. + + *v:argv* *argv-variable* +v:argv The command line arguments Vim was invoked with. This is a + list of strings. The first item is the Vim command. + See |v:progpath| for the command with full path. + + *v:char* *char-variable* +v:char Argument for evaluating 'formatexpr' and used for the typed + character when using in an abbreviation |:map-|. + It is also used by the |InsertCharPre| and |InsertEnter| events. + + *v:charconvert_from* *charconvert_from-variable* +v:charconvert_from + The name of the character encoding of a file to be converted. + Only valid while evaluating the 'charconvert' option. + + *v:charconvert_to* *charconvert_to-variable* +v:charconvert_to + The name of the character encoding of a file after conversion. + Only valid while evaluating the 'charconvert' option. + + *v:cmdarg* *cmdarg-variable* +v:cmdarg + The extra arguments ("++p", "++enc=", "++ff=") given to a file + read/write command. This is set before an autocommand event + for a file read/write command is triggered. There is a + leading space to make it possible to append this variable + directly after the read/write command. Note: "+cmd" isn't + included here, because it will be executed anyway. + + *v:collate* *collate-variable* +v:collate The current locale setting for collation order of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_COLLATE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + + *v:cmdbang* *cmdbang-variable* +v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" + was used the value is 1, otherwise it is 0. Note that this + can only be used in autocommands. For user commands || + can be used. + + *v:completed_item* *completed_item-variable* +v:completed_item + Dictionary containing the most recent |complete-items| after + |CompleteDone|. Empty if the completion failed, or after + leaving and re-entering insert mode. + Note: Plugins can modify the value to emulate the builtin + |CompleteDone| event behavior. + + *v:count* *count-variable* +v:count The count given for the last Normal mode command. Can be used + to get the count before a mapping. Read-only. Example: > + :map _x :echo "the count is " .. v:count +< Note: The is required to remove the line range that you + get when typing ':' after a count. + When there are two counts, as in "3d2w", they are multiplied, + just like what happens in the command, "d6w" for the example. + Also used for evaluating the 'formatexpr' option. + + *v:count1* *count1-variable* +v:count1 Just like "v:count", but defaults to one when no count is + used. + + *v:ctype* *ctype-variable* +v:ctype The current locale setting for characters of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_CTYPE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + + *v:dying* *dying-variable* +v:dying Normally zero. When a deadly signal is caught it's set to + one. When multiple signals are caught the number increases. + Can be used in an autocommand to check if Vim didn't + terminate normally. + Example: > + :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif +< Note: if another deadly signal is caught when v:dying is one, + VimLeave autocommands will not be executed. + + *v:exiting* *exiting-variable* +v:exiting Exit code, or |v:null| before invoking the |VimLeavePre| + and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. + Example: > + :au VimLeave * echo "Exit value is " .. v:exiting +< + *v:echospace* *echospace-variable* +v:echospace Number of screen cells that can be used for an `:echo` message + in the last screen line before causing the |hit-enter-prompt|. + Depends on 'showcmd', 'ruler' and 'columns'. You need to + check 'cmdheight' for whether there are full-width lines + available above the last line. + + *v:errmsg* *errmsg-variable* +v:errmsg Last given error message. + Modifiable (can be set). + Example: > + :let v:errmsg = "" + :silent! next + :if v:errmsg != "" + : ... handle error +< + *v:errors* *errors-variable* *assert-return* +v:errors Errors found by assert functions, such as |assert_true()|. + This is a list of strings. + The assert functions append an item when an assert fails. + The return value indicates this: a one is returned if an item + was added to v:errors, otherwise zero is returned. + To remove old results make it empty: > + :let v:errors = [] +< If v:errors is set to anything but a list it is made an empty + list by the assert function. + + *v:event* *event-variable* +v:event Dictionary of event data for the current |autocommand|. Valid + only during the event lifetime; storing or passing v:event is + invalid! Copy it instead: > + au TextYankPost * let g:foo = deepcopy(v:event) +< Keys vary by event; see the documentation for the specific + event, e.g. |DirChanged| or |TextYankPost|. + KEY DESCRIPTION ~ + abort Whether the event triggered during + an aborting condition (e.g. |c_Esc| or + |c_CTRL-C| for |CmdlineLeave|). + chan |channel-id| + cmdlevel Level of cmdline. + cmdtype Type of cmdline, |cmdline-char|. + cwd Current working directory. + inclusive Motion is |inclusive|, else exclusive. + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For + example if |TextYankPost| is triggered + by the |:yank| Ex command then + `v:event.operator` is "y". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + visual Selection is visual (as opposed to, + e.g., via motion). + completed_item Current selected complete item on + |CompleteChanged|, Is `{}` when no complete + item selected. + height Height of popup menu on |CompleteChanged| + width width of popup menu on |CompleteChanged| + row Row count of popup menu on |CompleteChanged|, + relative to screen. + col Col count of popup menu on |CompleteChanged|, + relative to screen. + size Total number of completion items on + |CompleteChanged|. + scrollbar Is |v:true| if popup menu have scrollbar, or + |v:false| if not. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. + status Job status or exit code, -1 means "unknown". |TermClose| + + *v:exception* *exception-variable* +v:exception The value of the exception most recently caught and not + finished. See also |v:throwpoint| and |throw-variables|. + Example: > + :try + : throw "oops" + :catch /.*/ + : echo "caught " .. v:exception + :endtry +< Output: "caught oops". + + *v:false* *false-variable* +v:false Special value used to put "false" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:false" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + + *v:fcs_reason* *fcs_reason-variable* +v:fcs_reason The reason why the |FileChangedShell| event was triggered. + Can be used in an autocommand to decide what to do and/or what + to set v:fcs_choice to. Possible values: + deleted file no longer exists + conflict file contents, mode or timestamp was + changed and buffer is modified + changed file contents has changed + mode mode of file changed + time only file timestamp changed + + *v:fcs_choice* *fcs_choice-variable* +v:fcs_choice What should happen after a |FileChangedShell| event was + triggered. Can be used in an autocommand to tell Vim what to + do with the affected buffer: + reload Reload the buffer (does not work if + the file was deleted). + edit Reload the buffer and detect the + values for options such as + 'fileformat', 'fileencoding', 'binary' + (does not work if the file was + deleted). + ask Ask the user what to do, as if there + was no autocommand. Except that when + only the timestamp changed nothing + will happen. + Nothing, the autocommand should do + everything that needs to be done. + The default is empty. If another (invalid) value is used then + Vim behaves like it is empty, there is no warning message. + + *v:fname* *fname-variable* +v:fname When evaluating 'includeexpr': the file name that was + detected. Empty otherwise. + + *v:fname_in* *fname_in-variable* +v:fname_in The name of the input file. Valid while evaluating: + option used for ~ + 'charconvert' file to be converted + 'diffexpr' original file + 'patchexpr' original file + And set to the swap file name for |SwapExists|. + + *v:fname_out* *fname_out-variable* +v:fname_out The name of the output file. Only valid while + evaluating: + option used for ~ + 'charconvert' resulting converted file [1] + 'diffexpr' output of diff + 'patchexpr' resulting patched file + [1] When doing conversion for a write command (e.g., ":w + file") it will be equal to v:fname_in. When doing conversion + for a read command (e.g., ":e file") it will be a temporary + file and different from v:fname_in. + + *v:fname_new* *fname_new-variable* +v:fname_new The name of the new version of the file. Only valid while + evaluating 'diffexpr'. + + *v:fname_diff* *fname_diff-variable* +v:fname_diff The name of the diff (patch) file. Only valid while + evaluating 'patchexpr'. + + *v:folddashes* *folddashes-variable* +v:folddashes Used for 'foldtext': dashes representing foldlevel of a closed + fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldlevel* *foldlevel-variable* +v:foldlevel Used for 'foldtext': foldlevel of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldend* *foldend-variable* +v:foldend Used for 'foldtext': last line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldstart* *foldstart-variable* +v:foldstart Used for 'foldtext': first line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:hlsearch* *hlsearch-variable* +v:hlsearch Variable that indicates whether search highlighting is on. + Setting it makes sense only if 'hlsearch' is enabled. Setting + this variable to zero acts like the |:nohlsearch| command, + setting it to one acts like > + let &hlsearch = &hlsearch +< Note that the value is restored when returning from a + function. |function-search-undo|. + + *v:insertmode* *insertmode-variable* +v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand + events. Values: + i Insert mode + r Replace mode + v Virtual Replace mode + + *v:key* *key-variable* +v:key Key of the current item of a |Dictionary|. Only valid while + evaluating the expression used with |map()| and |filter()|. + Read-only. + + *v:lang* *lang-variable* +v:lang The current locale setting for messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_MESSAGES. + The value is system dependent. + This variable can not be set directly, use the |:language| + command. + It can be different from |v:ctype| when messages are desired + in a different language than what is used for character + encoding. See |multi-lang|. + + *v:lc_time* *lc_time-variable* +v:lc_time The current locale setting for time messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_TIME. + This variable can not be set directly, use the |:language| + command. See |multi-lang|. + + *v:lnum* *lnum-variable* +v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr', + 'indentexpr' and 'statuscolumn' expressions, tab page number + for 'guitablabel' and 'guitabtooltip'. Only valid while one of + these expressions is being evaluated. Read-only when in the + |sandbox|. + + *v:lua* *lua-variable* +v:lua Prefix for calling Lua functions from expressions. + See |v:lua-call| for more information. + + *v:maxcol* *maxcol-variable* +v:maxcol Maximum line length. Depending on where it is used it can be + screen columns, characters or bytes. The value currently is + 2147483647 on all systems. + + *v:mouse_win* *mouse_win-variable* +v:mouse_win Window number for a mouse click obtained with |getchar()|. + First window has number 1, like with |winnr()|. The value is + zero when there was no mouse button click. + + *v:mouse_winid* *mouse_winid-variable* +v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. + + *v:mouse_lnum* *mouse_lnum-variable* +v:mouse_lnum Line number for a mouse click obtained with |getchar()|. + This is the text line number, not the screen line number. The + value is zero when there was no mouse button click. + + *v:mouse_col* *mouse_col-variable* +v:mouse_col Column number for a mouse click obtained with |getchar()|. + This is the screen column number, like with |virtcol()|. The + value is zero when there was no mouse button click. + + *v:msgpack_types* *msgpack_types-variable* +v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| + and |msgpackdump()|. All types inside dictionary are fixed + (not editable) empty lists. To check whether some list is one + of msgpack types, use |is| operator. + + *v:null* *null-variable* +v:null Special value used to put "null" in JSON and NIL in msgpack. + See |json_encode()|. This value is converted to "v:null" when + used as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + In some places `v:null` can be used for a List, Dict, etc. + that is not set. That is slightly different than an empty + List, Dict, etc. + + *v:numbermax* *numbermax-variable* +v:numbermax Maximum value of a number. + + *v:numbermin* *numbermin-variable* +v:numbermin Minimum value of a number (negative). + + *v:numbersize* *numbersize-variable* +v:numbersize Number of bits in a Number. This is normally 64, but on some + systems it may be 32. + + *v:oldfiles* *oldfiles-variable* +v:oldfiles List of file names that is loaded from the |shada| file on + startup. These are the files that Vim remembers marks for. + The length of the List is limited by the ' argument of the + 'shada' option (default is 100). + When the |shada| file is not used the List is empty. + Also see |:oldfiles| and |c_#<|. + The List can be modified, but this has no effect on what is + stored in the |shada| file later. If you use values other + than String this will cause trouble. + + *v:option_new* +v:option_new New value of the option. Valid while executing an |OptionSet| + autocommand. + *v:option_old* +v:option_old Old value of the option. Valid while executing an |OptionSet| + autocommand. Depending on the command used for setting and the + kind of option this is either the local old value or the + global old value. + *v:option_oldlocal* +v:option_oldlocal + Old local value of the option. Valid while executing an + |OptionSet| autocommand. + *v:option_oldglobal* +v:option_oldglobal + Old global value of the option. Valid while executing an + |OptionSet| autocommand. + *v:option_type* +v:option_type Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" + *v:option_command* +v:option_command + Command used to set the option. Valid while executing an + |OptionSet| autocommand. + value option was set via ~ + "setlocal" |:setlocal| or ":let l:xxx" + "setglobal" |:setglobal| or ":let g:xxx" + "set" |:set| or |:let| + "modeline" |modeline| + *v:operator* *operator-variable* +v:operator The last operator given in Normal mode. This is a single + character except for commands starting with or , + in which case it is two characters. Best used alongside + |v:prevcount| and |v:register|. Useful if you want to cancel + Operator-pending mode and then use the operator, e.g.: > + :omap O :call MyMotion(v:operator) +< The value remains set until another operator is entered, thus + don't expect it to be empty. + v:operator is not set for |:delete|, |:yank| or other Ex + commands. + Read-only. + + *v:prevcount* *prevcount-variable* +v:prevcount The count given for the last but one Normal mode command. + This is the v:count value of the previous command. Useful if + you want to cancel Visual or Operator-pending mode and then + use the count, e.g.: > + :vmap % :call MyFilter(v:prevcount) +< Read-only. + + *v:profiling* *profiling-variable* +v:profiling Normally zero. Set to one after using ":profile start". + See |profiling|. + + *v:progname* *progname-variable* +v:progname The name by which Nvim was invoked (with path removed). + Read-only. + + *v:progpath* *progpath-variable* +v:progpath Absolute path to the current running Nvim. + Read-only. + + *v:register* *register-variable* +v:register The name of the register in effect for the current normal mode + command (regardless of whether that command actually used a + register). Or for the currently executing normal mode mapping + (use this in custom commands that take a register). + If none is supplied it is the default register '"', unless + 'clipboard' contains "unnamed" or "unnamedplus", then it is + "*" or '+'. + Also see |getreg()| and |setreg()| + + *v:relnum* *relnum-variable* +v:relnum Relative line number for the 'statuscolumn' expression. + Read-only. + + *v:scrollstart* *scrollstart-variable* +v:scrollstart String describing the script or function that caused the + screen to scroll up. It's only set when it is empty, thus the + first reason is remembered. It is set to "Unknown" for a + typed command. + This can be used to find out why your script causes the + hit-enter prompt. + + *v:servername* *servername-variable* +v:servername Primary listen-address of Nvim, the first item returned by + |serverlist()|. Usually this is the named pipe created by Nvim + at |startup| or given by |--listen| (or the deprecated + |$NVIM_LISTEN_ADDRESS| env var). + + See also |serverstart()| |serverstop()|. + Read-only. + + *$NVIM* + $NVIM is set by |terminal| and |jobstart()|, and is thus + a hint that the current environment is a subprocess of Nvim. + Example: > + if $NVIM + echo nvim_get_chan_info(v:parent) + endif + +< Note the contents of $NVIM may change in the future. + +v:searchforward *v:searchforward* *searchforward-variable* + Search direction: 1 after a forward search, 0 after a + backward search. It is reset to forward when directly setting + the last search pattern, see |quote/|. + Note that the value is restored when returning from a + function. |function-search-undo|. + Read-write. + + *v:shell_error* *shell_error-variable* +v:shell_error Result of the last shell command. When non-zero, the last + shell command had an error. When zero, there was no problem. + This only works when the shell returns the error code to Vim. + The value -1 is often used when the command could not be + executed. Read-only. + Example: > + :!mv foo bar + :if v:shell_error + : echo 'could not rename "foo" to "bar"!' + :endif +< + *v:statusmsg* *statusmsg-variable* +v:statusmsg Last given status message. + Modifiable (can be set). + + *v:stderr* *stderr-variable* +v:stderr |channel-id| corresponding to stderr. The value is always 2; + use this variable to make your code more descriptive. + Unlike stdin and stdout (see |stdioopen()|), stderr is always + open for writing. Example: > + :call chansend(v:stderr, "error: toaster empty\n") +< + *v:swapname* *swapname-variable* +v:swapname Name of the swapfile found. + Only valid during |SwapExists| event. + Read-only. + + *v:swapchoice* *swapchoice-variable* +v:swapchoice |SwapExists| autocommands can set this to the selected choice + for handling an existing swapfile: + 'o' Open read-only + 'e' Edit anyway + 'r' Recover + 'd' Delete swapfile + 'q' Quit + 'a' Abort + The value should be a single-character string. An empty value + results in the user being asked, as would happen when there is + no SwapExists autocommand. The default is empty. + + *v:swapcommand* *swapcommand-variable* +v:swapcommand Normal mode command to be executed after a file has been + opened. Can be used for a |SwapExists| autocommand to have + another Vim open the file and jump to the right place. For + example, when jumping to a tag the value is ":tag tagname\r". + For ":edit +cmd file" the value is ":cmd\r". + + *v:t_TYPE* *v:t_bool* *t_bool-variable* +v:t_bool Value of |Boolean| type. Read-only. See: |type()| + *v:t_dict* *t_dict-variable* +v:t_dict Value of |Dictionary| type. Read-only. See: |type()| + *v:t_float* *t_float-variable* +v:t_float Value of |Float| type. Read-only. See: |type()| + *v:t_func* *t_func-variable* +v:t_func Value of |Funcref| type. Read-only. See: |type()| + *v:t_list* *t_list-variable* +v:t_list Value of |List| type. Read-only. See: |type()| + *v:t_number* *t_number-variable* +v:t_number Value of |Number| type. Read-only. See: |type()| + *v:t_string* *t_string-variable* +v:t_string Value of |String| type. Read-only. See: |type()| + *v:t_blob* *t_blob-variable* +v:t_blob Value of |Blob| type. Read-only. See: |type()| + + *v:termresponse* *termresponse-variable* +v:termresponse The value of the most recent OSC or DCS escape sequence + received by Nvim from the terminal. This can be read in a + |TermResponse| event handler after querying the terminal using + another escape sequence. + + *v:testing* *testing-variable* +v:testing Must be set before using `test_garbagecollect_now()`. + + *v:this_session* *this_session-variable* +v:this_session Full filename of the last loaded or saved session file. + Empty when no session file has been saved. See |:mksession|. + Modifiable (can be set). + + *v:throwpoint* *throwpoint-variable* +v:throwpoint The point where the exception most recently caught and not + finished was thrown. Not set when commands are typed. See + also |v:exception| and |throw-variables|. + Example: > + :try + : throw "oops" + :catch /.*/ + : echo "Exception from" v:throwpoint + :endtry +< Output: "Exception from test.vim, line 2" + + *v:true* *true-variable* +v:true Special value used to put "true" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:true" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to one when used as a Number (e.g. in |expr5| or + |expr7| when used with numeric operators). Read-only. + + *v:val* *val-variable* +v:val Value of the current item of a |List| or |Dictionary|. Only + valid while evaluating the expression used with |map()| and + |filter()|. Read-only. + + *v:version* *version-variable* +v:version Vim version number: major version times 100 plus minor + version. Vim 5.0 is 500, Vim 5.1 is 501. + Read-only. + Use |has()| to check the Nvim (not Vim) version: > + :if has("nvim-0.2.1") +< + + *v:virtnum* *virtnum-variable* +v:virtnum Virtual line number for the 'statuscolumn' expression. + Negative when drawing the status column for virtual lines, zero + when drawing an actual buffer line, and positive when drawing + the wrapped part of a buffer line. + Read-only. + + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter 0 during startup, 1 just before |VimEnter|. + Read-only. + + *v:warningmsg* *warningmsg-variable* +v:warningmsg Last given warning message. + Modifiable (can be set). + + *v:windowid* *windowid-variable* +v:windowid Application-specific window "handle" which may be set by any + attached UI. Defaults to zero. + Note: For Nvim |windows| use |winnr()| or |win_getid()|, see + |window-ID|. + + vim:tw=78:ts=8:noet:ft=help:norl: -- cgit From e8d3c4cccb9d362952a09216a5a114ee6d024c14 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 20 Dec 2023 16:34:17 +0000 Subject: feat: generate types and docs for v variables --- runtime/doc/news.txt | 1 + runtime/doc/vvars.txt | 718 +++++++++++++++++++++---------------- runtime/lua/vim/_meta/vvars.lua | 765 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 1166 insertions(+), 318 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index b85cbe7b95..75ef2c245b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -224,6 +224,7 @@ The following new APIs and features were added. • `vim.*` • `vim.fn.*` • `vim.api.*` + • `vim.v.*` • Improved messages for type errors in `vim.api.*` calls (including `opts` params) diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt index 73812d3ef4..7e96d356d0 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -10,13 +10,15 @@ Some variables can be set by the user, but the type cannot be changed. Type |gO| to see the table of contents. - *v:argv* *argv-variable* -v:argv The command line arguments Vim was invoked with. This is a + *v:argv* *argv-variable* +v:argv + The command line arguments Vim was invoked with. This is a list of strings. The first item is the Vim command. See |v:progpath| for the command with full path. - *v:char* *char-variable* -v:char Argument for evaluating 'formatexpr' and used for the typed + *v:char* *char-variable* +v:char + Argument for evaluating 'formatexpr' and used for the typed character when using in an abbreviation |:map-|. It is also used by the |InsertCharPre| and |InsertEnter| events. @@ -39,8 +41,16 @@ v:cmdarg directly after the read/write command. Note: "+cmd" isn't included here, because it will be executed anyway. - *v:collate* *collate-variable* -v:collate The current locale setting for collation order of the runtime + *v:cmdbang* *cmdbang-variable* +v:cmdbang + Set like v:cmdarg for a file read/write command. When a "!" + was used the value is 1, otherwise it is 0. Note that this + can only be used in autocommands. For user commands || + can be used. + + *v:collate* *collate-variable* +v:collate + The current locale setting for collation order of the runtime environment. This allows Vim scripts to be aware of the current locale encoding. Technical: it's the value of LC_COLLATE. When not using a locale the value is "C". @@ -48,13 +58,7 @@ v:collate The current locale setting for collation order of the runtime command. See |multi-lang|. - *v:cmdbang* *cmdbang-variable* -v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" - was used the value is 1, otherwise it is 0. Note that this - can only be used in autocommands. For user commands || - can be used. - - *v:completed_item* *completed_item-variable* + *v:completed_item* *completed_item-variable* v:completed_item Dictionary containing the most recent |complete-items| after |CompleteDone|. Empty if the completion failed, or after @@ -63,21 +67,25 @@ v:completed_item |CompleteDone| event behavior. *v:count* *count-variable* -v:count The count given for the last Normal mode command. Can be used - to get the count before a mapping. Read-only. Example: > - :map _x :echo "the count is " .. v:count -< Note: The is required to remove the line range that you +v:count + The count given for the last Normal mode command. Can be used + to get the count before a mapping. Read-only. Example: >vim + :map _x :echo "the count is " .. v:count +< + Note: The is required to remove the line range that you get when typing ':' after a count. When there are two counts, as in "3d2w", they are multiplied, just like what happens in the command, "d6w" for the example. Also used for evaluating the 'formatexpr' option. *v:count1* *count1-variable* -v:count1 Just like "v:count", but defaults to one when no count is +v:count1 + Just like "v:count", but defaults to one when no count is used. - *v:ctype* *ctype-variable* -v:ctype The current locale setting for characters of the runtime + *v:ctype* *ctype-variable* +v:ctype + The current locale setting for characters of the runtime environment. This allows Vim scripts to be aware of the current locale encoding. Technical: it's the value of LC_CTYPE. When not using a locale the value is "C". @@ -86,217 +94,247 @@ v:ctype The current locale setting for characters of the runtime See |multi-lang|. *v:dying* *dying-variable* -v:dying Normally zero. When a deadly signal is caught it's set to +v:dying + Normally zero. When a deadly signal is caught it's set to one. When multiple signals are caught the number increases. Can be used in an autocommand to check if Vim didn't terminate normally. - Example: > - :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif -< Note: if another deadly signal is caught when v:dying is one, + Example: >vim + :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif +< + Note: if another deadly signal is caught when v:dying is one, VimLeave autocommands will not be executed. - *v:exiting* *exiting-variable* -v:exiting Exit code, or |v:null| before invoking the |VimLeavePre| - and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. - Example: > - :au VimLeave * echo "Exit value is " .. v:exiting -< - *v:echospace* *echospace-variable* -v:echospace Number of screen cells that can be used for an `:echo` message + *v:echospace* *echospace-variable* +v:echospace + Number of screen cells that can be used for an `:echo` message in the last screen line before causing the |hit-enter-prompt|. Depends on 'showcmd', 'ruler' and 'columns'. You need to check 'cmdheight' for whether there are full-width lines available above the last line. *v:errmsg* *errmsg-variable* -v:errmsg Last given error message. +v:errmsg + Last given error message. Modifiable (can be set). - Example: > - :let v:errmsg = "" - :silent! next - :if v:errmsg != "" - : ... handle error + Example: >vim + let v:errmsg = "" + silent! next + if v:errmsg != "" + " ... handle error < - *v:errors* *errors-variable* *assert-return* -v:errors Errors found by assert functions, such as |assert_true()|. + + *v:errors* *errors-variable* *assert-return* +v:errors + Errors found by assert functions, such as |assert_true()|. This is a list of strings. The assert functions append an item when an assert fails. The return value indicates this: a one is returned if an item was added to v:errors, otherwise zero is returned. - To remove old results make it empty: > - :let v:errors = [] -< If v:errors is set to anything but a list it is made an empty + To remove old results make it empty: >vim + let v:errors = [] +< + If v:errors is set to anything but a list it is made an empty list by the assert function. *v:event* *event-variable* -v:event Dictionary of event data for the current |autocommand|. Valid +v:event + Dictionary of event data for the current |autocommand|. Valid only during the event lifetime; storing or passing v:event is - invalid! Copy it instead: > - au TextYankPost * let g:foo = deepcopy(v:event) -< Keys vary by event; see the documentation for the specific + invalid! Copy it instead: >vim + au TextYankPost * let g:foo = deepcopy(v:event) +< + Keys vary by event; see the documentation for the specific event, e.g. |DirChanged| or |TextYankPost|. - KEY DESCRIPTION ~ - abort Whether the event triggered during - an aborting condition (e.g. |c_Esc| or - |c_CTRL-C| for |CmdlineLeave|). - chan |channel-id| - cmdlevel Level of cmdline. - cmdtype Type of cmdline, |cmdline-char|. - cwd Current working directory. - inclusive Motion is |inclusive|, else exclusive. - scope Event-specific scope name. - operator Current |operator|. Also set for Ex - commands (unlike |v:operator|). For - example if |TextYankPost| is triggered - by the |:yank| Ex command then - `v:event.operator` is "y". - regcontents Text stored in the register as a - |readfile()|-style list of lines. - regname Requested register (e.g "x" for "xyy) - or the empty string for an unnamed - operation. - regtype Type of register as returned by - |getregtype()|. - visual Selection is visual (as opposed to, - e.g., via motion). - completed_item Current selected complete item on - |CompleteChanged|, Is `{}` when no complete - item selected. - height Height of popup menu on |CompleteChanged| - width width of popup menu on |CompleteChanged| - row Row count of popup menu on |CompleteChanged|, - relative to screen. - col Col count of popup menu on |CompleteChanged|, - relative to screen. - size Total number of completion items on - |CompleteChanged|. - scrollbar Is |v:true| if popup menu have scrollbar, or - |v:false| if not. - changed_window Is |v:true| if the event fired while - changing window (or tab) on |DirChanged|. - status Job status or exit code, -1 means "unknown". |TermClose| - - *v:exception* *exception-variable* -v:exception The value of the exception most recently caught and not + KEY DESCRIPTION ~ + abort Whether the event triggered during + an aborting condition (e.g. |c_Esc| or + |c_CTRL-C| for |CmdlineLeave|). + chan |channel-id| + cmdlevel Level of cmdline. + cmdtype Type of cmdline, |cmdline-char|. + cwd Current working directory. + inclusive Motion is |inclusive|, else exclusive. + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For + example if |TextYankPost| is triggered + by the |:yank| Ex command then + `v:event.operator` is "y". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + visual Selection is visual (as opposed to, + e.g., via motion). + completed_item Current selected complete item on + |CompleteChanged|, Is `{}` when no complete + item selected. + height Height of popup menu on |CompleteChanged| + width Width of popup menu on |CompleteChanged| + row Row count of popup menu on |CompleteChanged|, + relative to screen. + col Col count of popup menu on |CompleteChanged|, + relative to screen. + size Total number of completion items on + |CompleteChanged|. + scrollbar Is |v:true| if popup menu have scrollbar, or + |v:false| if not. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. + status Job status or exit code, -1 means "unknown". |TermClose| + + *v:exception* *exception-variable* +v:exception + The value of the exception most recently caught and not finished. See also |v:throwpoint| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "caught " .. v:exception - :endtry -< Output: "caught oops". + Example: >vim + try + throw "oops" + catch /.*/ + echo "caught " .. v:exception + endtry +< + Output: "caught oops". + + *v:exiting* *exiting-variable* +v:exiting + Exit code, or |v:null| before invoking the |VimLeavePre| + and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. + Example: >vim + :au VimLeave * echo "Exit value is " .. v:exiting +< *v:false* *false-variable* -v:false Special value used to put "false" in JSON and msgpack. See +v:false + Special value used to put "false" in JSON and msgpack. See |json_encode()|. This value is converted to "v:false" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). Read-only. - *v:fcs_reason* *fcs_reason-variable* -v:fcs_reason The reason why the |FileChangedShell| event was triggered. - Can be used in an autocommand to decide what to do and/or what - to set v:fcs_choice to. Possible values: - deleted file no longer exists - conflict file contents, mode or timestamp was - changed and buffer is modified - changed file contents has changed - mode mode of file changed - time only file timestamp changed - - *v:fcs_choice* *fcs_choice-variable* -v:fcs_choice What should happen after a |FileChangedShell| event was + *v:fcs_choice* *fcs_choice-variable* +v:fcs_choice + What should happen after a |FileChangedShell| event was triggered. Can be used in an autocommand to tell Vim what to do with the affected buffer: - reload Reload the buffer (does not work if - the file was deleted). - edit Reload the buffer and detect the - values for options such as - 'fileformat', 'fileencoding', 'binary' - (does not work if the file was - deleted). - ask Ask the user what to do, as if there - was no autocommand. Except that when - only the timestamp changed nothing - will happen. - Nothing, the autocommand should do - everything that needs to be done. + reload Reload the buffer (does not work if + the file was deleted). + edit Reload the buffer and detect the + values for options such as + 'fileformat', 'fileencoding', 'binary' + (does not work if the file was + deleted). + ask Ask the user what to do, as if there + was no autocommand. Except that when + only the timestamp changed nothing + will happen. + Nothing, the autocommand should do + everything that needs to be done. The default is empty. If another (invalid) value is used then Vim behaves like it is empty, there is no warning message. + *v:fcs_reason* *fcs_reason-variable* +v:fcs_reason + The reason why the |FileChangedShell| event was triggered. + Can be used in an autocommand to decide what to do and/or what + to set v:fcs_choice to. Possible values: + deleted file no longer exists + conflict file contents, mode or timestamp was + changed and buffer is modified + changed file contents has changed + mode mode of file changed + time only file timestamp changed + *v:fname* *fname-variable* -v:fname When evaluating 'includeexpr': the file name that was +v:fname + When evaluating 'includeexpr': the file name that was detected. Empty otherwise. + *v:fname_diff* *fname_diff-variable* +v:fname_diff + The name of the diff (patch) file. Only valid while + evaluating 'patchexpr'. + *v:fname_in* *fname_in-variable* -v:fname_in The name of the input file. Valid while evaluating: - option used for ~ - 'charconvert' file to be converted - 'diffexpr' original file - 'patchexpr' original file +v:fname_in + The name of the input file. Valid while evaluating: + option used for ~ + 'charconvert' file to be converted + 'diffexpr' original file + 'patchexpr' original file And set to the swap file name for |SwapExists|. - *v:fname_out* *fname_out-variable* -v:fname_out The name of the output file. Only valid while + *v:fname_new* *fname_new-variable* +v:fname_new + The name of the new version of the file. Only valid while + evaluating 'diffexpr'. + + *v:fname_out* *fname_out-variable* +v:fname_out + The name of the output file. Only valid while evaluating: - option used for ~ - 'charconvert' resulting converted file [1] - 'diffexpr' output of diff - 'patchexpr' resulting patched file + option used for ~ + 'charconvert' resulting converted file [1] + 'diffexpr' output of diff + 'patchexpr' resulting patched file [1] When doing conversion for a write command (e.g., ":w file") it will be equal to v:fname_in. When doing conversion for a read command (e.g., ":e file") it will be a temporary file and different from v:fname_in. - *v:fname_new* *fname_new-variable* -v:fname_new The name of the new version of the file. Only valid while - evaluating 'diffexpr'. - - *v:fname_diff* *fname_diff-variable* -v:fname_diff The name of the diff (patch) file. Only valid while - evaluating 'patchexpr'. - - *v:folddashes* *folddashes-variable* -v:folddashes Used for 'foldtext': dashes representing foldlevel of a closed + *v:folddashes* *folddashes-variable* +v:folddashes + Used for 'foldtext': dashes representing foldlevel of a closed fold. Read-only in the |sandbox|. |fold-foldtext| - *v:foldlevel* *foldlevel-variable* -v:foldlevel Used for 'foldtext': foldlevel of closed fold. + *v:foldend* *foldend-variable* +v:foldend + Used for 'foldtext': last line of closed fold. Read-only in the |sandbox|. |fold-foldtext| - *v:foldend* *foldend-variable* -v:foldend Used for 'foldtext': last line of closed fold. + *v:foldlevel* *foldlevel-variable* +v:foldlevel + Used for 'foldtext': foldlevel of closed fold. Read-only in the |sandbox|. |fold-foldtext| - *v:foldstart* *foldstart-variable* -v:foldstart Used for 'foldtext': first line of closed fold. + *v:foldstart* *foldstart-variable* +v:foldstart + Used for 'foldtext': first line of closed fold. Read-only in the |sandbox|. |fold-foldtext| *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that indicates whether search highlighting is on. +v:hlsearch + Variable that indicates whether search highlighting is on. Setting it makes sense only if 'hlsearch' is enabled. Setting this variable to zero acts like the |:nohlsearch| command, - setting it to one acts like > - let &hlsearch = &hlsearch -< Note that the value is restored when returning from a + setting it to one acts like >vim + let &hlsearch = &hlsearch +< + Note that the value is restored when returning from a function. |function-search-undo|. - *v:insertmode* *insertmode-variable* -v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand + *v:insertmode* *insertmode-variable* +v:insertmode + Used for the |InsertEnter| and |InsertChange| autocommand events. Values: - i Insert mode - r Replace mode - v Virtual Replace mode + i Insert mode + r Replace mode + v Virtual Replace mode *v:key* *key-variable* -v:key Key of the current item of a |Dictionary|. Only valid while +v:key + Key of the current item of a |Dictionary|. Only valid while evaluating the expression used with |map()| and |filter()|. Read-only. *v:lang* *lang-variable* -v:lang The current locale setting for messages of the runtime +v:lang + The current locale setting for messages of the runtime environment. This allows Vim scripts to be aware of the current language. Technical: it's the value of LC_MESSAGES. The value is system dependent. @@ -306,56 +344,66 @@ v:lang The current locale setting for messages of the runtime in a different language than what is used for character encoding. See |multi-lang|. - *v:lc_time* *lc_time-variable* -v:lc_time The current locale setting for time messages of the runtime + *v:lc_time* *lc_time-variable* +v:lc_time + The current locale setting for time messages of the runtime environment. This allows Vim scripts to be aware of the current language. Technical: it's the value of LC_TIME. This variable can not be set directly, use the |:language| command. See |multi-lang|. *v:lnum* *lnum-variable* -v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr', +v:lnum + Line number for the 'foldexpr' |fold-expr|, 'formatexpr', 'indentexpr' and 'statuscolumn' expressions, tab page number for 'guitablabel' and 'guitabtooltip'. Only valid while one of these expressions is being evaluated. Read-only when in the |sandbox|. *v:lua* *lua-variable* -v:lua Prefix for calling Lua functions from expressions. +v:lua + Prefix for calling Lua functions from expressions. See |v:lua-call| for more information. - *v:maxcol* *maxcol-variable* -v:maxcol Maximum line length. Depending on where it is used it can be + *v:maxcol* *maxcol-variable* +v:maxcol + Maximum line length. Depending on where it is used it can be screen columns, characters or bytes. The value currently is 2147483647 on all systems. - *v:mouse_win* *mouse_win-variable* -v:mouse_win Window number for a mouse click obtained with |getchar()|. - First window has number 1, like with |winnr()|. The value is - zero when there was no mouse button click. - - *v:mouse_winid* *mouse_winid-variable* -v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|. - The value is zero when there was no mouse button click. + *v:mouse_col* *mouse_col-variable* +v:mouse_col + Column number for a mouse click obtained with |getchar()|. + This is the screen column number, like with |virtcol()|. The + value is zero when there was no mouse button click. - *v:mouse_lnum* *mouse_lnum-variable* -v:mouse_lnum Line number for a mouse click obtained with |getchar()|. + *v:mouse_lnum* *mouse_lnum-variable* +v:mouse_lnum + Line number for a mouse click obtained with |getchar()|. This is the text line number, not the screen line number. The value is zero when there was no mouse button click. - *v:mouse_col* *mouse_col-variable* -v:mouse_col Column number for a mouse click obtained with |getchar()|. - This is the screen column number, like with |virtcol()|. The - value is zero when there was no mouse button click. + *v:mouse_win* *mouse_win-variable* +v:mouse_win + Window number for a mouse click obtained with |getchar()|. + First window has number 1, like with |winnr()|. The value is + zero when there was no mouse button click. + + *v:mouse_winid* *mouse_winid-variable* +v:mouse_winid + |window-ID| for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. - *v:msgpack_types* *msgpack_types-variable* -v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| + *v:msgpack_types* *msgpack_types-variable* +v:msgpack_types + Dictionary containing msgpack types used by |msgpackparse()| and |msgpackdump()|. All types inside dictionary are fixed (not editable) empty lists. To check whether some list is one of msgpack types, use |is| operator. - *v:null* *null-variable* -v:null Special value used to put "null" in JSON and NIL in msgpack. + *v:null* *null-variable* +v:null + Special value used to put "null" in JSON and NIL in msgpack. See |json_encode()|. This value is converted to "v:null" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| @@ -364,18 +412,20 @@ v:null Special value used to put "null" in JSON and NIL in msgpack. that is not set. That is slightly different than an empty List, Dict, etc. - *v:numbermax* *numbermax-variable* + *v:numbermax* *numbermax-variable* v:numbermax Maximum value of a number. - *v:numbermin* *numbermin-variable* + *v:numbermin* *numbermin-variable* v:numbermin Minimum value of a number (negative). - *v:numbersize* *numbersize-variable* -v:numbersize Number of bits in a Number. This is normally 64, but on some + *v:numbersize* *numbersize-variable* +v:numbersize + Number of bits in a Number. This is normally 64, but on some systems it may be 32. *v:oldfiles* *oldfiles-variable* -v:oldfiles List of file names that is loaded from the |shada| file on +v:oldfiles + List of file names that is loaded from the |shada| file on startup. These are the files that Vim remembers marks for. The length of the List is limited by the ' argument of the 'shada' option (default is 100). @@ -385,69 +435,86 @@ v:oldfiles List of file names that is loaded from the |shada| file on stored in the |shada| file later. If you use values other than String this will cause trouble. - *v:option_new* -v:option_new New value of the option. Valid while executing an |OptionSet| - autocommand. - *v:option_old* -v:option_old Old value of the option. Valid while executing an |OptionSet| - autocommand. Depending on the command used for setting and the - kind of option this is either the local old value or the - global old value. - *v:option_oldlocal* -v:option_oldlocal - Old local value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_oldglobal* -v:option_oldglobal - Old global value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_type* -v:option_type Scope of the set command. Valid while executing an - |OptionSet| autocommand. Can be either "global" or "local" - *v:option_command* -v:option_command - Command used to set the option. Valid while executing an - |OptionSet| autocommand. - value option was set via ~ - "setlocal" |:setlocal| or ":let l:xxx" - "setglobal" |:setglobal| or ":let g:xxx" - "set" |:set| or |:let| - "modeline" |modeline| *v:operator* *operator-variable* -v:operator The last operator given in Normal mode. This is a single +v:operator + The last operator given in Normal mode. This is a single character except for commands starting with or , in which case it is two characters. Best used alongside |v:prevcount| and |v:register|. Useful if you want to cancel - Operator-pending mode and then use the operator, e.g.: > - :omap O :call MyMotion(v:operator) -< The value remains set until another operator is entered, thus + Operator-pending mode and then use the operator, e.g.: >vim + :omap O :call MyMotion(v:operator) +< + The value remains set until another operator is entered, thus don't expect it to be empty. v:operator is not set for |:delete|, |:yank| or other Ex commands. Read-only. - *v:prevcount* *prevcount-variable* -v:prevcount The count given for the last but one Normal mode command. + *v:option_command* *option_command-variable* +v:option_command + Command used to set the option. Valid while executing an + |OptionSet| autocommand. + value option was set via ~ + "setlocal" |:setlocal| or `:let l:xxx` + "setglobal" |:setglobal| or `:let g:xxx` + "set" |:set| or |:let| + "modeline" |modeline| + + *v:option_new* *option_new-variable* +v:option_new + New value of the option. Valid while executing an |OptionSet| + autocommand. + + *v:option_old* *option_old-variable* +v:option_old + Old value of the option. Valid while executing an |OptionSet| + autocommand. Depending on the command used for setting and the + kind of option this is either the local old value or the + global old value. + + *v:option_oldglobal* *option_oldglobal-variable* +v:option_oldglobal + Old global value of the option. Valid while executing an + |OptionSet| autocommand. + + *v:option_oldlocal* *option_oldlocal-variable* +v:option_oldlocal + Old local value of the option. Valid while executing an + |OptionSet| autocommand. + + *v:option_type* *option_type-variable* +v:option_type + Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" + + *v:prevcount* *prevcount-variable* +v:prevcount + The count given for the last but one Normal mode command. This is the v:count value of the previous command. Useful if you want to cancel Visual or Operator-pending mode and then - use the count, e.g.: > - :vmap % :call MyFilter(v:prevcount) -< Read-only. + use the count, e.g.: >vim + :vmap % :call MyFilter(v:prevcount) +< + Read-only. - *v:profiling* *profiling-variable* -v:profiling Normally zero. Set to one after using ":profile start". + *v:profiling* *profiling-variable* +v:profiling + Normally zero. Set to one after using ":profile start". See |profiling|. *v:progname* *progname-variable* -v:progname The name by which Nvim was invoked (with path removed). +v:progname + The name by which Nvim was invoked (with path removed). Read-only. *v:progpath* *progpath-variable* -v:progpath Absolute path to the current running Nvim. +v:progpath + Absolute path to the current running Nvim. Read-only. *v:register* *register-variable* -v:register The name of the register in effect for the current normal mode +v:register + The name of the register in effect for the current normal mode command (regardless of whether that command actually used a register). Or for the currently executing normal mode mapping (use this in custom commands that take a register). @@ -457,19 +524,31 @@ v:register The name of the register in effect for the current normal mode Also see |getreg()| and |setreg()| *v:relnum* *relnum-variable* -v:relnum Relative line number for the 'statuscolumn' expression. +v:relnum + Relative line number for the 'statuscolumn' expression. Read-only. - *v:scrollstart* *scrollstart-variable* -v:scrollstart String describing the script or function that caused the + *v:scrollstart* *scrollstart-variable* +v:scrollstart + String describing the script or function that caused the screen to scroll up. It's only set when it is empty, thus the first reason is remembered. It is set to "Unknown" for a typed command. This can be used to find out why your script causes the hit-enter prompt. - *v:servername* *servername-variable* -v:servername Primary listen-address of Nvim, the first item returned by + *v:searchforward* *searchforward-variable* +v:searchforward + Search direction: 1 after a forward search, 0 after a + backward search. It is reset to forward when directly setting + the last search pattern, see |quote/|. + Note that the value is restored when returning from a + function. |function-search-undo|. + Read-write. + + *v:servername* *servername-variable* +v:servername + Primary listen-address of Nvim, the first item returned by |serverlist()|. Usually this is the named pipe created by Nvim at |startup| or given by |--listen| (or the deprecated |$NVIM_LISTEN_ADDRESS| env var). @@ -477,91 +556,100 @@ v:servername Primary listen-address of Nvim, the first item returned by See also |serverstart()| |serverstop()|. Read-only. - *$NVIM* + *$NVIM* $NVIM is set by |terminal| and |jobstart()|, and is thus a hint that the current environment is a subprocess of Nvim. - Example: > - if $NVIM - echo nvim_get_chan_info(v:parent) - endif - -< Note the contents of $NVIM may change in the future. + Example: >vim + if $NVIM + echo nvim_get_chan_info(v:parent) + endif +< -v:searchforward *v:searchforward* *searchforward-variable* - Search direction: 1 after a forward search, 0 after a - backward search. It is reset to forward when directly setting - the last search pattern, see |quote/|. - Note that the value is restored when returning from a - function. |function-search-undo|. - Read-write. + Note the contents of $NVIM may change in the future. - *v:shell_error* *shell_error-variable* -v:shell_error Result of the last shell command. When non-zero, the last + *v:shell_error* *shell_error-variable* +v:shell_error + Result of the last shell command. When non-zero, the last shell command had an error. When zero, there was no problem. This only works when the shell returns the error code to Vim. The value -1 is often used when the command could not be executed. Read-only. - Example: > - :!mv foo bar - :if v:shell_error - : echo 'could not rename "foo" to "bar"!' - :endif + Example: >vim + !mv foo bar + if v:shell_error + echo 'could not rename "foo" to "bar"!' + endif < - *v:statusmsg* *statusmsg-variable* -v:statusmsg Last given status message. + + *v:statusmsg* *statusmsg-variable* +v:statusmsg + Last given status message. Modifiable (can be set). *v:stderr* *stderr-variable* -v:stderr |channel-id| corresponding to stderr. The value is always 2; +v:stderr + |channel-id| corresponding to stderr. The value is always 2; use this variable to make your code more descriptive. Unlike stdin and stdout (see |stdioopen()|), stderr is always - open for writing. Example: > - :call chansend(v:stderr, "error: toaster empty\n") + open for writing. Example: >vim + :call chansend(v:stderr, "error: toaster empty\n") < - *v:swapname* *swapname-variable* -v:swapname Name of the swapfile found. - Only valid during |SwapExists| event. - Read-only. - *v:swapchoice* *swapchoice-variable* -v:swapchoice |SwapExists| autocommands can set this to the selected choice + *v:swapchoice* *swapchoice-variable* +v:swapchoice + |SwapExists| autocommands can set this to the selected choice for handling an existing swapfile: - 'o' Open read-only - 'e' Edit anyway - 'r' Recover - 'd' Delete swapfile - 'q' Quit - 'a' Abort + 'o' Open read-only + 'e' Edit anyway + 'r' Recover + 'd' Delete swapfile + 'q' Quit + 'a' Abort The value should be a single-character string. An empty value results in the user being asked, as would happen when there is no SwapExists autocommand. The default is empty. - *v:swapcommand* *swapcommand-variable* -v:swapcommand Normal mode command to be executed after a file has been + *v:swapcommand* *swapcommand-variable* +v:swapcommand + Normal mode command to be executed after a file has been opened. Can be used for a |SwapExists| autocommand to have another Vim open the file and jump to the right place. For example, when jumping to a tag the value is ":tag tagname\r". For ":edit +cmd file" the value is ":cmd\r". - *v:t_TYPE* *v:t_bool* *t_bool-variable* + *v:swapname* *swapname-variable* +v:swapname + Name of the swapfile found. + Only valid during |SwapExists| event. + Read-only. + + *v:t_blob* *t_blob-variable* *v:t_TYPE* +v:t_blob Value of |Blob| type. Read-only. See: |type()| + + *v:t_bool* *t_bool-variable* v:t_bool Value of |Boolean| type. Read-only. See: |type()| + *v:t_dict* *t_dict-variable* v:t_dict Value of |Dictionary| type. Read-only. See: |type()| + *v:t_float* *t_float-variable* v:t_float Value of |Float| type. Read-only. See: |type()| + *v:t_func* *t_func-variable* v:t_func Value of |Funcref| type. Read-only. See: |type()| + *v:t_list* *t_list-variable* v:t_list Value of |List| type. Read-only. See: |type()| + *v:t_number* *t_number-variable* v:t_number Value of |Number| type. Read-only. See: |type()| + *v:t_string* *t_string-variable* v:t_string Value of |String| type. Read-only. See: |type()| - *v:t_blob* *t_blob-variable* -v:t_blob Value of |Blob| type. Read-only. See: |type()| *v:termresponse* *termresponse-variable* -v:termresponse The value of the most recent OSC or DCS escape sequence +v:termresponse + The value of the most recent OSC or DCS escape sequence received by Nvim from the terminal. This can be read in a |TermResponse| event handler after querying the terminal using another escape sequence. @@ -570,59 +658,69 @@ v:termresponse The value of the most recent OSC or DCS escape sequence v:testing Must be set before using `test_garbagecollect_now()`. *v:this_session* *this_session-variable* -v:this_session Full filename of the last loaded or saved session file. +v:this_session + Full filename of the last loaded or saved session file. Empty when no session file has been saved. See |:mksession|. Modifiable (can be set). - *v:throwpoint* *throwpoint-variable* -v:throwpoint The point where the exception most recently caught and not + *v:throwpoint* *throwpoint-variable* +v:throwpoint + The point where the exception most recently caught and not finished was thrown. Not set when commands are typed. See also |v:exception| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "Exception from" v:throwpoint - :endtry -< Output: "Exception from test.vim, line 2" - - *v:true* *true-variable* -v:true Special value used to put "true" in JSON and msgpack. See + Example: >vim + try + throw "oops" + catch /.*/ + echo "Exception from" v:throwpoint + endtry +< + Output: "Exception from test.vim, line 2" + + *v:true* *true-variable* +v:true + Special value used to put "true" in JSON and msgpack. See |json_encode()|. This value is converted to "v:true" when used as a String (e.g. in |expr5| with string concatenation operator) and to one when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). Read-only. *v:val* *val-variable* -v:val Value of the current item of a |List| or |Dictionary|. Only +v:val + Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and |filter()|. Read-only. *v:version* *version-variable* -v:version Vim version number: major version times 100 plus minor +v:version + Vim version number: major version times 100 plus minor version. Vim 5.0 is 500, Vim 5.1 is 501. Read-only. - Use |has()| to check the Nvim (not Vim) version: > - :if has("nvim-0.2.1") + Use |has()| to check the Nvim (not Vim) version: >vim + :if has("nvim-0.2.1") < - *v:virtnum* *virtnum-variable* -v:virtnum Virtual line number for the 'statuscolumn' expression. - Negative when drawing the status column for virtual lines, zero - when drawing an actual buffer line, and positive when drawing - the wrapped part of a buffer line. + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter + 0 during startup, 1 just before |VimEnter|. Read-only. - *v:vim_did_enter* *vim_did_enter-variable* -v:vim_did_enter 0 during startup, 1 just before |VimEnter|. + *v:virtnum* *virtnum-variable* +v:virtnum + Virtual line number for the 'statuscolumn' expression. + Negative when drawing the status column for virtual lines, zero + when drawing an actual buffer line, and positive when drawing + the wrapped part of a buffer line. Read-only. - *v:warningmsg* *warningmsg-variable* -v:warningmsg Last given warning message. + *v:warningmsg* *warningmsg-variable* +v:warningmsg + Last given warning message. Modifiable (can be set). *v:windowid* *windowid-variable* -v:windowid Application-specific window "handle" which may be set by any +v:windowid + Application-specific window "handle" which may be set by any attached UI. Defaults to zero. Note: For Nvim |windows| use |winnr()| or |win_getid()|, see |window-ID|. diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index 059ef04203..e3b89aeff7 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -1,23 +1,772 @@ --- @meta _ - --- TODO(lewis6991): generate this and `:help vim-variable` +-- THIS FILE IS GENERATED +-- DO NOT EDIT +error('Cannot require a meta file') --- @class vim.v +vim.v = ... + +--- The command line arguments Vim was invoked with. This is a +--- list of strings. The first item is the Vim command. +--- See `v:progpath` for the command with full path. +--- @type string[] +vim.v.argv = ... + +--- Argument for evaluating 'formatexpr' and used for the typed +--- character when using in an abbreviation `:map-`. +--- It is also used by the `InsertCharPre` and `InsertEnter` events. +--- @type any +vim.v.char = ... + +--- The name of the character encoding of a file to be converted. +--- Only valid while evaluating the 'charconvert' option. +--- @type string +vim.v.charconvert_from = ... + +--- The name of the character encoding of a file after conversion. +--- Only valid while evaluating the 'charconvert' option. +--- @type string +vim.v.charconvert_to = ... + +--- The extra arguments ("++p", "++enc=", "++ff=") given to a file +--- read/write command. This is set before an autocommand event +--- for a file read/write command is triggered. There is a +--- leading space to make it possible to append this variable +--- directly after the read/write command. Note: "+cmd" isn't +--- included here, because it will be executed anyway. +--- @type string[] +vim.v.cmdarg = ... + +--- Set like v:cmdarg for a file read/write command. When a "!" +--- was used the value is 1, otherwise it is 0. Note that this +--- can only be used in autocommands. For user commands `` +--- can be used. +--- @type any +vim.v.cmdbang = ... + +--- The current locale setting for collation order of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current locale encoding. Technical: it's the value of +--- LC_COLLATE. When not using a locale the value is "C". +--- This variable can not be set directly, use the `:language` +--- command. +--- See `multi-lang`. +--- @type string +vim.v.collate = ... + +--- Dictionary containing the most recent `complete-items` after +--- `CompleteDone`. Empty if the completion failed, or after +--- leaving and re-entering insert mode. +--- Note: Plugins can modify the value to emulate the builtin +--- `CompleteDone` event behavior. +--- @type any +vim.v.completed_item = ... + --- The count given for the last Normal mode command. Can be used --- to get the count before a mapping. Read-only. Example: +--- --- ```vim ---- :map _x :echo "the count is " .. v:count +--- :map _x :echo "the count is " .. v:count --- ``` +--- --- Note: The is required to remove the line range that you --- get when typing ':' after a count. --- When there are two counts, as in "3d2w", they are multiplied, --- just like what happens in the command, "d6w" for the example. --- Also used for evaluating the 'formatexpr' option. ---- @field count integer +--- @type integer +vim.v.count = ... + +--- Just like "v:count", but defaults to one when no count is +--- used. +--- @type integer +vim.v.count1 = ... + +--- The current locale setting for characters of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current locale encoding. Technical: it's the value of +--- LC_CTYPE. When not using a locale the value is "C". +--- This variable can not be set directly, use the `:language` +--- command. +--- See `multi-lang`. +--- @type any +vim.v.ctype = ... + +--- Normally zero. When a deadly signal is caught it's set to +--- one. When multiple signals are caught the number increases. +--- Can be used in an autocommand to check if Vim didn't +--- terminate normally. +--- Example: +--- +--- ```vim +--- :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif +--- ``` --- ---- Line number for the 'foldexpr' |fold-expr|, 'formatexpr', +--- Note: if another deadly signal is caught when v:dying is one, +--- VimLeave autocommands will not be executed. +--- @type integer +vim.v.dying = ... + +--- Number of screen cells that can be used for an `:echo` message +--- in the last screen line before causing the `hit-enter-prompt`. +--- Depends on 'showcmd', 'ruler' and 'columns'. You need to +--- check 'cmdheight' for whether there are full-width lines +--- available above the last line. +--- @type integer +vim.v.echospace = ... + +--- Last given error message. +--- Modifiable (can be set). +--- Example: +--- +--- ```vim +--- let v:errmsg = "" +--- silent! next +--- if v:errmsg != "" +--- " ... handle error +--- ``` +--- @type string +vim.v.errmsg = ... + +--- Errors found by assert functions, such as `assert_true()`. +--- This is a list of strings. +--- The assert functions append an item when an assert fails. +--- The return value indicates this: a one is returned if an item +--- was added to v:errors, otherwise zero is returned. +--- To remove old results make it empty: +--- +--- ```vim +--- let v:errors = [] +--- ``` +--- +--- If v:errors is set to anything but a list it is made an empty +--- list by the assert function. +--- @type any +vim.v.errors = ... + +--- Dictionary of event data for the current `autocommand`. Valid +--- only during the event lifetime; storing or passing v:event is +--- invalid! Copy it instead: +--- +--- ```vim +--- au TextYankPost * let g:foo = deepcopy(v:event) +--- ``` +--- +--- Keys vary by event; see the documentation for the specific +--- event, e.g. `DirChanged` or `TextYankPost`. +--- KEY DESCRIPTION ~ +--- abort Whether the event triggered during +--- an aborting condition (e.g. `c_Esc` or +--- `c_CTRL-C` for `CmdlineLeave`). +--- chan `channel-id` +--- cmdlevel Level of cmdline. +--- cmdtype Type of cmdline, `cmdline-char`. +--- cwd Current working directory. +--- inclusive Motion is `inclusive`, else exclusive. +--- scope Event-specific scope name. +--- operator Current `operator`. Also set for Ex +--- commands (unlike `v:operator`). For +--- example if `TextYankPost` is triggered +--- by the `:yank` Ex command then +--- `v:event.operator` is "y". +--- regcontents Text stored in the register as a +--- `readfile()`-style list of lines. +--- regname Requested register (e.g "x" for "xyy) +--- or the empty string for an unnamed +--- operation. +--- regtype Type of register as returned by +--- `getregtype()`. +--- visual Selection is visual (as opposed to, +--- e.g., via motion). +--- completed_item Current selected complete item on +--- `CompleteChanged`, Is `{}` when no complete +--- item selected. +--- height Height of popup menu on `CompleteChanged` +--- width Width of popup menu on `CompleteChanged` +--- row Row count of popup menu on `CompleteChanged`, +--- relative to screen. +--- col Col count of popup menu on `CompleteChanged`, +--- relative to screen. +--- size Total number of completion items on +--- `CompleteChanged`. +--- scrollbar Is `v:true` if popup menu have scrollbar, or +--- `v:false` if not. +--- changed_window Is `v:true` if the event fired while +--- changing window (or tab) on `DirChanged`. +--- status Job status or exit code, -1 means "unknown". `TermClose` +--- @type any +vim.v.event = ... + +--- The value of the exception most recently caught and not +--- finished. See also `v:throwpoint` and `throw-variables`. +--- Example: +--- +--- ```vim +--- try +--- throw "oops" +--- catch /.*/ +--- echo "caught " .. v:exception +--- endtry +--- ``` +--- +--- Output: "caught oops". +--- @type any +vim.v.exception = ... + +--- Exit code, or `v:null` before invoking the `VimLeavePre` +--- and `VimLeave` autocmds. See `:q`, `:x` and `:cquit`. +--- Example: +--- +--- ```vim +--- :au VimLeave * echo "Exit value is " .. v:exiting +--- ``` +--- @type any +vim.v.exiting = ... + +--- Special value used to put "false" in JSON and msgpack. See +--- `json_encode()`. This value is converted to "v:false" when used +--- as a String (e.g. in `expr5` with string concatenation +--- operator) and to zero when used as a Number (e.g. in `expr5` +--- or `expr7` when used with numeric operators). Read-only. +--- @type any +vim.v['false'] = ... + +--- What should happen after a `FileChangedShell` event was +--- triggered. Can be used in an autocommand to tell Vim what to +--- do with the affected buffer: +--- reload Reload the buffer (does not work if +--- the file was deleted). +--- edit Reload the buffer and detect the +--- values for options such as +--- 'fileformat', 'fileencoding', 'binary' +--- (does not work if the file was +--- deleted). +--- ask Ask the user what to do, as if there +--- was no autocommand. Except that when +--- only the timestamp changed nothing +--- will happen. +--- Nothing, the autocommand should do +--- everything that needs to be done. +--- The default is empty. If another (invalid) value is used then +--- Vim behaves like it is empty, there is no warning message. +--- @type string +vim.v.fcs_choice = ... + +--- The reason why the `FileChangedShell` event was triggered. +--- Can be used in an autocommand to decide what to do and/or what +--- to set v:fcs_choice to. Possible values: +--- deleted file no longer exists +--- conflict file contents, mode or timestamp was +--- changed and buffer is modified +--- changed file contents has changed +--- mode mode of file changed +--- time only file timestamp changed +--- @type string +vim.v.fcs_reason = ... + +--- When evaluating 'includeexpr': the file name that was +--- detected. Empty otherwise. +--- @type string +vim.v.fname = ... + +--- The name of the diff (patch) file. Only valid while +--- evaluating 'patchexpr'. +--- @type string +vim.v.fname_diff = ... + +--- The name of the input file. Valid while evaluating: +--- option used for ~ +--- 'charconvert' file to be converted +--- 'diffexpr' original file +--- 'patchexpr' original file +--- And set to the swap file name for `SwapExists`. +--- @type string +vim.v.fname_in = ... + +--- The name of the new version of the file. Only valid while +--- evaluating 'diffexpr'. +--- @type string +vim.v.fname_new = ... + +--- The name of the output file. Only valid while +--- evaluating: +--- option used for ~ +--- 'charconvert' resulting converted file [1] +--- 'diffexpr' output of diff +--- 'patchexpr' resulting patched file +--- [1] When doing conversion for a write command (e.g., ":w +--- file") it will be equal to v:fname_in. When doing conversion +--- for a read command (e.g., ":e file") it will be a temporary +--- file and different from v:fname_in. +--- @type string +vim.v.fname_out = ... + +--- Used for 'foldtext': dashes representing foldlevel of a closed +--- fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type string +vim.v.folddashes = ... + +--- Used for 'foldtext': last line of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldend = ... + +--- Used for 'foldtext': foldlevel of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldlevel = ... + +--- Used for 'foldtext': first line of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldstart = ... + +--- Variable that indicates whether search highlighting is on. +--- Setting it makes sense only if 'hlsearch' is enabled. Setting +--- this variable to zero acts like the `:nohlsearch` command, +--- setting it to one acts like +--- +--- ```vim +--- let &hlsearch = &hlsearch +--- ``` +--- +--- Note that the value is restored when returning from a +--- function. `function-search-undo`. +--- @type integer +vim.v.hlsearch = ... + +--- Used for the `InsertEnter` and `InsertChange` autocommand +--- events. Values: +--- i Insert mode +--- r Replace mode +--- v Virtual Replace mode +--- @type string +vim.v.insertmode = ... + +--- Key of the current item of a `Dictionary`. Only valid while +--- evaluating the expression used with `map()` and `filter()`. +--- Read-only. +--- @type string +vim.v.key = ... + +--- The current locale setting for messages of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current language. Technical: it's the value of LC_MESSAGES. +--- The value is system dependent. +--- This variable can not be set directly, use the `:language` +--- command. +--- It can be different from `v:ctype` when messages are desired +--- in a different language than what is used for character +--- encoding. See `multi-lang`. +--- @type string +vim.v.lang = ... + +--- The current locale setting for time messages of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current language. Technical: it's the value of LC_TIME. +--- This variable can not be set directly, use the `:language` +--- command. See `multi-lang`. +--- @type string +vim.v.lc_time = ... + +--- Line number for the 'foldexpr' `fold-expr`, 'formatexpr', --- 'indentexpr' and 'statuscolumn' expressions, tab page number --- for 'guitablabel' and 'guitabtooltip'. Only valid while one of ---- these expressions is being evaluated. Read-only when in the |sandbox|. ---- @field lnum integer -vim.v = ... +--- these expressions is being evaluated. Read-only when in the +--- `sandbox`. +--- @type integer +vim.v.lnum = ... + +--- Prefix for calling Lua functions from expressions. +--- See `v:lua-call` for more information. +--- @type any +vim.v.lua = ... + +--- Maximum line length. Depending on where it is used it can be +--- screen columns, characters or bytes. The value currently is +--- 2147483647 on all systems. +--- @type integer +vim.v.maxcol = ... + +--- Column number for a mouse click obtained with `getchar()`. +--- This is the screen column number, like with `virtcol()`. The +--- value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_col = ... + +--- Line number for a mouse click obtained with `getchar()`. +--- This is the text line number, not the screen line number. The +--- value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_lnum = ... + +--- Window number for a mouse click obtained with `getchar()`. +--- First window has number 1, like with `winnr()`. The value is +--- zero when there was no mouse button click. +--- @type integer +vim.v.mouse_win = ... + +--- `window-ID` for a mouse click obtained with `getchar()`. +--- The value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_winid = ... + +--- Dictionary containing msgpack types used by `msgpackparse()` +--- and `msgpackdump()`. All types inside dictionary are fixed +--- (not editable) empty lists. To check whether some list is one +--- of msgpack types, use `is` operator. +--- @type any +vim.v.msgpack_types = ... + +--- Special value used to put "null" in JSON and NIL in msgpack. +--- See `json_encode()`. This value is converted to "v:null" when +--- used as a String (e.g. in `expr5` with string concatenation +--- operator) and to zero when used as a Number (e.g. in `expr5` +--- or `expr7` when used with numeric operators). Read-only. +--- In some places `v:null` can be used for a List, Dict, etc. +--- that is not set. That is slightly different than an empty +--- List, Dict, etc. +--- @type any +vim.v.null = ... + +--- Maximum value of a number. +--- @type integer +vim.v.numbermax = ... + +--- Minimum value of a number (negative). +--- @type integer +vim.v.numbermin = ... + +--- Number of bits in a Number. This is normally 64, but on some +--- systems it may be 32. +--- @type integer +vim.v.numbersize = ... + +--- List of file names that is loaded from the `shada` file on +--- startup. These are the files that Vim remembers marks for. +--- The length of the List is limited by the ' argument of the +--- 'shada' option (default is 100). +--- When the `shada` file is not used the List is empty. +--- Also see `:oldfiles` and `c_#<`. +--- The List can be modified, but this has no effect on what is +--- stored in the `shada` file later. If you use values other +--- than String this will cause trouble. +--- @type string[] +vim.v.oldfiles = ... + +--- The last operator given in Normal mode. This is a single +--- character except for commands starting with or , +--- in which case it is two characters. Best used alongside +--- `v:prevcount` and `v:register`. Useful if you want to cancel +--- Operator-pending mode and then use the operator, e.g.: +--- +--- ```vim +--- :omap O :call MyMotion(v:operator) +--- ``` +--- +--- The value remains set until another operator is entered, thus +--- don't expect it to be empty. +--- v:operator is not set for `:delete`, `:yank` or other Ex +--- commands. +--- Read-only. +--- @type string +vim.v.operator = ... + +--- Command used to set the option. Valid while executing an +--- `OptionSet` autocommand. +--- value option was set via ~ +--- "setlocal" `:setlocal` or `:let l:xxx` +--- "setglobal" `:setglobal` or `:let g:xxx` +--- "set" `:set` or `:let` +--- "modeline" `modeline` +--- @type string +vim.v.option_command = ... + +--- New value of the option. Valid while executing an `OptionSet` +--- autocommand. +--- @type any +vim.v.option_new = ... + +--- Old value of the option. Valid while executing an `OptionSet` +--- autocommand. Depending on the command used for setting and the +--- kind of option this is either the local old value or the +--- global old value. +--- @type any +vim.v.option_old = ... + +--- Old global value of the option. Valid while executing an +--- `OptionSet` autocommand. +--- @type any +vim.v.option_oldglobal = ... + +--- Old local value of the option. Valid while executing an +--- `OptionSet` autocommand. +--- @type any +vim.v.option_oldlocal = ... + +--- Scope of the set command. Valid while executing an +--- `OptionSet` autocommand. Can be either "global" or "local" +--- @type string +vim.v.option_type = ... + +--- The count given for the last but one Normal mode command. +--- This is the v:count value of the previous command. Useful if +--- you want to cancel Visual or Operator-pending mode and then +--- use the count, e.g.: +--- +--- ```vim +--- :vmap % :call MyFilter(v:prevcount) +--- ``` +--- +--- Read-only. +--- @type integer +vim.v.prevcount = ... + +--- Normally zero. Set to one after using ":profile start". +--- See `profiling`. +--- @type integer +vim.v.profiling = ... + +--- The name by which Nvim was invoked (with path removed). +--- Read-only. +--- @type string +vim.v.progname = ... + +--- Absolute path to the current running Nvim. +--- Read-only. +--- @type string +vim.v.progpath = ... + +--- The name of the register in effect for the current normal mode +--- command (regardless of whether that command actually used a +--- register). Or for the currently executing normal mode mapping +--- (use this in custom commands that take a register). +--- If none is supplied it is the default register '"', unless +--- 'clipboard' contains "unnamed" or "unnamedplus", then it is +--- "*" or '+'. +--- Also see `getreg()` and `setreg()` +--- @type string +vim.v.register = ... + +--- Relative line number for the 'statuscolumn' expression. +--- Read-only. +--- @type integer +vim.v.relnum = ... + +--- String describing the script or function that caused the +--- screen to scroll up. It's only set when it is empty, thus the +--- first reason is remembered. It is set to "Unknown" for a +--- typed command. +--- This can be used to find out why your script causes the +--- hit-enter prompt. +--- @type any +vim.v.scrollstart = ... + +--- Search direction: 1 after a forward search, 0 after a +--- backward search. It is reset to forward when directly setting +--- the last search pattern, see `quote/`. +--- Note that the value is restored when returning from a +--- function. `function-search-undo`. +--- Read-write. +--- @type integer +vim.v.searchforward = ... + +--- Primary listen-address of Nvim, the first item returned by +--- `serverlist()`. Usually this is the named pipe created by Nvim +--- at `startup` or given by `--listen` (or the deprecated +--- `$NVIM_LISTEN_ADDRESS` env var). +--- +--- See also `serverstart()` `serverstop()`. +--- Read-only. +--- +--- *$NVIM* +--- $NVIM is set by `terminal` and `jobstart()`, and is thus +--- a hint that the current environment is a subprocess of Nvim. +--- Example: +--- +--- ```vim +--- if $NVIM +--- echo nvim_get_chan_info(v:parent) +--- endif +--- ``` +--- +--- Note the contents of $NVIM may change in the future. +--- @type string +vim.v.servername = ... + +--- Result of the last shell command. When non-zero, the last +--- shell command had an error. When zero, there was no problem. +--- This only works when the shell returns the error code to Vim. +--- The value -1 is often used when the command could not be +--- executed. Read-only. +--- Example: +--- +--- ```vim +--- !mv foo bar +--- if v:shell_error +--- echo 'could not rename "foo" to "bar"!' +--- endif +--- ``` +--- @type string +vim.v.shell_error = ... + +--- Last given status message. +--- Modifiable (can be set). +--- @type string +vim.v.statusmsg = ... + +--- `channel-id` corresponding to stderr. The value is always 2; +--- use this variable to make your code more descriptive. +--- Unlike stdin and stdout (see `stdioopen()`), stderr is always +--- open for writing. Example: +--- +--- ```vim +--- :call chansend(v:stderr, "error: toaster empty\n") +--- ``` +--- @type string +vim.v.stderr = ... + +--- `SwapExists` autocommands can set this to the selected choice +--- for handling an existing swapfile: +--- 'o' Open read-only +--- 'e' Edit anyway +--- 'r' Recover +--- 'd' Delete swapfile +--- 'q' Quit +--- 'a' Abort +--- The value should be a single-character string. An empty value +--- results in the user being asked, as would happen when there is +--- no SwapExists autocommand. The default is empty. +--- @type string +vim.v.swapchoice = ... + +--- Normal mode command to be executed after a file has been +--- opened. Can be used for a `SwapExists` autocommand to have +--- another Vim open the file and jump to the right place. For +--- example, when jumping to a tag the value is ":tag tagname\r". +--- For ":edit +cmd file" the value is ":cmd\r". +--- @type string +vim.v.swapcommand = ... + +--- Name of the swapfile found. +--- Only valid during `SwapExists` event. +--- Read-only. +--- @type string +vim.v.swapname = ... + +--- Value of `Blob` type. Read-only. See: `type()` +--- @type integer +vim.v.t_blob = ... + +--- Value of `Boolean` type. Read-only. See: `type()` +--- @type integer +vim.v.t_bool = ... + +--- Value of `Dictionary` type. Read-only. See: `type()` +--- @type integer +vim.v.t_dict = ... + +--- Value of `Float` type. Read-only. See: `type()` +--- @type integer +vim.v.t_float = ... + +--- Value of `Funcref` type. Read-only. See: `type()` +--- @type integer +vim.v.t_func = ... + +--- Value of `List` type. Read-only. See: `type()` +--- @type integer +vim.v.t_list = ... + +--- Value of `Number` type. Read-only. See: `type()` +--- @type integer +vim.v.t_number = ... + +--- Value of `String` type. Read-only. See: `type()` +--- @type integer +vim.v.t_string = ... + +--- The value of the most recent OSC or DCS escape sequence +--- received by Nvim from the terminal. This can be read in a +--- `TermResponse` event handler after querying the terminal using +--- another escape sequence. +--- @type any +vim.v.termresponse = ... + +--- Must be set before using `test_garbagecollect_now()`. +--- @type any +vim.v.testing = ... + +--- Full filename of the last loaded or saved session file. +--- Empty when no session file has been saved. See `:mksession`. +--- Modifiable (can be set). +--- @type any +vim.v.this_session = ... + +--- The point where the exception most recently caught and not +--- finished was thrown. Not set when commands are typed. See +--- also `v:exception` and `throw-variables`. +--- Example: +--- +--- ```vim +--- try +--- throw "oops" +--- catch /.*/ +--- echo "Exception from" v:throwpoint +--- endtry +--- ``` +--- +--- Output: "Exception from test.vim, line 2" +--- @type any +vim.v.throwpoint = ... + +--- Special value used to put "true" in JSON and msgpack. See +--- `json_encode()`. This value is converted to "v:true" when used +--- as a String (e.g. in `expr5` with string concatenation +--- operator) and to one when used as a Number (e.g. in `expr5` or +--- `expr7` when used with numeric operators). Read-only. +--- @type any +vim.v['true'] = ... + +--- Value of the current item of a `List` or `Dictionary`. Only +--- valid while evaluating the expression used with `map()` and +--- `filter()`. Read-only. +--- @type any +vim.v.val = ... + +--- Vim version number: major version times 100 plus minor +--- version. Vim 5.0 is 500, Vim 5.1 is 501. +--- Read-only. +--- Use `has()` to check the Nvim (not Vim) version: +--- +--- ```vim +--- :if has("nvim-0.2.1") +--- ``` +--- @type integer +vim.v.version = ... + +--- 0 during startup, 1 just before `VimEnter`. +--- Read-only. +--- @type integer +vim.v.vim_did_enter = ... + +--- Virtual line number for the 'statuscolumn' expression. +--- Negative when drawing the status column for virtual lines, zero +--- when drawing an actual buffer line, and positive when drawing +--- the wrapped part of a buffer line. +--- Read-only. +--- @type integer +vim.v.virtnum = ... + +--- Last given warning message. +--- Modifiable (can be set). +--- @type string +vim.v.warningmsg = ... + +--- Application-specific window "handle" which may be set by any +--- attached UI. Defaults to zero. +--- Note: For Nvim `windows` use `winnr()` or `win_getid()`, see +--- `window-ID`. +--- @type integer +vim.v.windowid = ... -- cgit From 1a230d77fe1c744fb69452d05783a85de56160d2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 21 Dec 2023 16:45:52 +0100 Subject: vim-patch:cc944b145254 runtime(json5): Add TODO support to syntax script (vim/vim#13743) https://github.com/vim/vim/commit/cc944b1452547145cdd947a37c75fce695d8571e Co-authored-by: Danek Duvall --- runtime/syntax/json5.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/json5.vim b/runtime/syntax/json5.vim index 5b01d33aad..dc0d11b2a1 100644 --- a/runtime/syntax/json5.vim +++ b/runtime/syntax/json5.vim @@ -49,9 +49,11 @@ syn match json5Key /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@Spell syn match json5Key /"\([^"]\|\\"\)\{-}"\ze\s*:/ contains=json5Escape,@Spell " Comment -syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell -syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell -syn region json5Comment start="/\*" end="\*/" fold contains=@Spell +syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell,json5Todo +syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell,json5Todo +syn region json5Comment start="/\*" end="\*/" fold contains=@Spell,json5Todo + +syn keyword json5Todo contained TODO FIXME XXX " Define the default highlighting hi def link json5String String @@ -66,6 +68,7 @@ hi def link json5Boolean Boolean hi def link json5LineComment Comment hi def link json5Comment Comment hi def link json5NumError Error +hi def link json5Todo Todo if !exists('b:current_syntax') let b:current_syntax = 'json5' -- cgit From 417148f7fd6dac6cbd2d97bc91246f5ec0a78a7d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 21 Dec 2023 16:56:43 +0100 Subject: vim-patch:21064ebcd609 runtime(vim): Update syntax file (vim/vim#13739) Match all ex commands after ":" and the "|" command separator. Exceptions are not handled yet and :insert/:change/:append are still not matched after the command separator bar. https://github.com/vim/vim/commit/21064ebcd609b1dfcf63c55dca32e6465102d461 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 8f239a6888..e494e40204 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -149,7 +149,7 @@ syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vi syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment " All vimCommands are contained by vimIsCommand. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd syn match vimIsCommand "\<\h\w*\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" @@ -187,7 +187,7 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. -syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption +syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimOption if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' syn region vimAugroup fold matchgroup=vimAugroupKey start="\\ze\s\+\K\k*" end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList else -- cgit From a24d8188401299503a48c7cc6acc699eb06cfd68 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 21 Dec 2023 17:13:37 +0100 Subject: vim-patch:37468879977a runtime(masm): add variants of opcodes (vim/vim#13734) that can actually be generated by compilers https://github.com/vim/vim/commit/37468879977ae32ab49f8fb15c4c458eb3efcdb8 Co-authored-by: Wu Yongwei --- runtime/syntax/masm.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/masm.vim b/runtime/syntax/masm.vim index 85e457106d..dc9a292cce 100644 --- a/runtime/syntax/masm.vim +++ b/runtime/syntax/masm.vim @@ -2,7 +2,7 @@ " Language: Microsoft Macro Assembler (80x86) " Orig Author: Rob Brady " Maintainer: Wu Yongwei -" Last Change: 2023-09-09 20:48:26 +0800 +" Last Change: 2023-12-20 10:20:04 +0800 " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -459,8 +459,9 @@ syn keyword masmOpcode VMOVAPD VMOVAPS VMOVD VMOVQ VMOVDDUP syn keyword masmOpcode VMOVHLPS VMOVHPD VMOVHPS VMOVLHPS VMOVLPD syn keyword masmOpcode VMOVLPS VMOVNTDQA VMOVNTDQ VMOVNTPD VMOVNTPS syn keyword masmOpcode VMOVSD VMOVSHDUP VMOVSLDUP VMOVSS VMOVUPD -syn keyword masmOpcode VMOVUPS VMOVDQA32 VMOVDQA64 VMOVDQU8 -syn keyword masmOpcode VMOVDQU16 VMOVDQU32 VMOVDQU64 VMULPD VMULPS +syn keyword masmOpcode VMOVUPS VMOVDQA VMOVDQA32 VMOVDQA64 +syn keyword masmOpcode VMOVDQU VMOVDQU8 VMOVDQU16 VMOVDQU32 VMOVDQU64 +syn keyword masmOpcode VMULPD VMULPS syn keyword masmOpcode VMULSD VMULSS VORPD VORPS VSQRTPD VSQRTPS syn keyword masmOpcode VSQRTSD VSQRTSS VSUBPD VSUBPS VSUBSD VSUBSS syn keyword masmOpcode VUCOMISD VUCOMISS VUNPCKHPD VUNPCKHPS VUNPCKLPD @@ -468,8 +469,8 @@ syn keyword masmOpcode VUNPCKLPS VXORPD VXORPS VEXTRACTPS VINSERTPS syn keyword masmOpcode VPEXTRB VPEXTRW VPEXTRD VPEXTRQ VPINSRB VPINSRW syn keyword masmOpcode VPINSRD VPINSRQ VPACKSSWB VPACKSSDW VPACKUSDW syn keyword masmOpcode VPACKUSWB VPADDB VPADDW VPADDD VPADDQ VPADDSB -syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPANDD VPANDQ VPANDND -syn keyword masmOpcode VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW +syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPAND VPANDD VPANDQ +syn keyword masmOpcode VPANDND VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW syn keyword masmOpcode VPCMPEQD VPCMPEQQ VPCMPGTB VPCMPGTW VPCMPGTD syn keyword masmOpcode VPCMPGTQ VPMAXSB VPMAXSW VPMAXSD VPMAXSQ syn keyword masmOpcode VPMAXUB VPMAXUW VPMAXUD VPMAXUQ VPMINSB VPMINSW @@ -482,7 +483,8 @@ syn keyword masmOpcode VPMULLQ VPMULLW VPORD VPORQ VPSUBB VPSUBW syn keyword masmOpcode VPSUBD VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW syn keyword masmOpcode VPUNPCKHBW VPUNPCKHWD VPUNPCKHDQ VPUNPCKHQDQ syn keyword masmOpcode VPUNPCKLBW VPUNPCKLWD VPUNPCKLDQ VPUNPCKLQDQ -syn keyword masmOpcode VPXORD VPXORQ VPSADBW VPSHUFB VPSHUFHW VPSHUFLW +syn keyword masmOpcode VPXOR VPXORD VPXORQ +syn keyword masmOpcode VPSADBW VPSHUFB VPSHUFHW VPSHUFLW syn keyword masmOpcode VPSHUFD VPSLLDQ VPSLLW VPSLLD VPSLLQ VPSRAW syn keyword masmOpcode VPSRAD VPSRAQ VPSRLDQ VPSRLW VPSRLD VPSRLQ syn keyword masmOpcode VPSLLVW VPSRLVW VPSHUFPD VPSHUFPS VEXTRACTF32X4 @@ -516,7 +518,7 @@ syn keyword masmOpcode VFNMSUB132SS VFNMSUB213SS VFNMSUB231SS syn keyword masmOpcode VPSRAVW VPSRAVQ " Other opcodes in Pentium and later processors -syn keyword masmOpcode CMPXCHG8B CPUID UD2 +syn keyword masmOpcode CMPXCHG8B CPUID UD2 MOVSXD syn keyword masmOpcode RSM RDMSR WRMSR RDPMC RDTSC SYSENTER SYSEXIT syn match masmOpcode "CMOV\(P[EO]\|\(N\?\([ABGL]E\?\|[CEOPSZ]\)\)\)\>" -- cgit From 2a173c0669764ff35023e5e3566eb4eeebf11a72 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 21 Dec 2023 17:17:17 +0100 Subject: vim-patch:18ab6c3392ef runtime(erlang): add support for matchit plugin (vim/vim#13713) This commit updates the Erlang runtime files to be in sync with the `vim-erlang-runtime` repository. In particular, it adds the following commit (with some cleanup and simplification afterwards): https://github.com/vim-erlang/vim-erlang-runtime/commit/6ea8b85bc9c93b94c68ec53489a74f5687d898b0 https://github.com/vim/vim/commit/18ab6c3392ef83abf078042e233d085fe80b6c06 Co-authored-by: Csaba Hoch --- runtime/ftplugin/erlang.vim | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim index 31fa0c3213..1cb57f4c85 100644 --- a/runtime/ftplugin/erlang.vim +++ b/runtime/ftplugin/erlang.vim @@ -5,7 +5,8 @@ " Contributors: Ricardo Catalinas Jiménez " Eduardo Lopez (http://github.com/tapichu) " Arvid Bjurklint (http://github.com/slarwise) -" Last Update: 2021-Nov-22 +" Paweł Zacharek (http://github.com/subc2) +" Last Update: 2023-Dec-20 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -57,7 +58,7 @@ setlocal suffixesadd=.erl,.hrl let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' let &l:define = '^\s*-\%(define\|record\|type\|opaque\)' -let s:erlang_fun_begin = '^\a\w*(.*$' +let s:erlang_fun_begin = '^\l[A-Za-z0-9_@]*(.*$' let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' if !exists('*GetErlangFold') @@ -95,9 +96,22 @@ if !exists('*ErlangFoldText') endfunction endif +" The following lines enable the macros/matchit.vim plugin for extended +" matching with the % key. +let b:match_ignorecase = 0 +let b:match_words = + \ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' . + \ ':\<\%(after\|catch\|else\|of\)\>' . + \ ':\,' . + \ '^\l[A-Za-z0-9_@]*' . + \ ':^\%(\%(\t\| \{' . shiftwidth() . + \ '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$' +let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom' + let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<" \ . " comments< commentstring< formatoptions< suffixesadd< include<" \ . " define<" + \ . " | unlet b:match_ignorecase b:match_words b:match_skip" let &cpo = s:cpo_save unlet s:cpo_save -- cgit From 2b3d1e18545ab9d2853f802c6d5adf54b5bf189c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Dec 2023 08:58:51 +0800 Subject: vim-patch:0630080bbd3e (#26704) runtime(doc): reformat and align :h ft-c-syntax (vim/vim#13738) https://github.com/vim/vim/commit/0630080bbd3ece71737daf657d51f6a4ebc19906 Co-authored-by: Christian Brabandt --- runtime/doc/syntax.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index e859ddcadc..cf345d9c96 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -964,21 +964,21 @@ An alternative is to switch to the C++ highlighting: > Variable Highlight ~ *c_gnu* GNU gcc specific items *c_comment_strings* strings and numbers inside a comment -*c_space_errors* trailing white space and spaces before a -*c_no_trail_space_error* ... but no trailing spaces +*c_space_errors* trailing white space and spaces before a +*c_no_trail_space_error* ... but no trailing spaces *c_no_tab_space_error* ... but no spaces before a *c_no_bracket_error* don't highlight {}; inside [] as errors *c_no_curly_error* don't highlight {}; inside [] and () as errors; - except { and } in first column - Default is to highlight them, otherwise you - can't spot a missing ")". + ...except { and } in first column + Default is to highlight them, otherwise you + can't spot a missing ")". *c_curly_error* highlight a missing } by finding all pairs; this forces syncing from the start of the file, can be slow *c_no_ansi* don't do standard ANSI types and constants -*c_ansi_typedefs* ... but do standard ANSI types +*c_ansi_typedefs* ... but do standard ANSI types *c_ansi_constants* ... but do standard ANSI constants *c_no_utf* don't highlight \u and \U in strings -*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc +*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc syntax instead of objcpp *c_no_if0* don't highlight "#if 0" blocks as comments *c_no_cformat* don't highlight %-formats in strings -- cgit From 6700127b30d55e6ddf70495e7b886464172d7ac6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Dec 2023 10:33:34 +0800 Subject: vim-patch:9.0.2183: Maximum callback depth is not configurable (#26703) Problem: Maximum callback depth is not configurable. Solution: Revert patch 9.0.2103. Set 'maxfuncdepth' in test. fixes: vim/vim#13732 closes: vim/vim#13736 https://github.com/vim/vim/commit/fe583b1e5987fbfdb5f2141c133dbff9665ed301 --- runtime/doc/message.txt | 2 -- runtime/doc/options.txt | 1 + runtime/lua/vim/_meta/options.lua | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 9f06e8c931..c3154fc372 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -127,8 +127,6 @@ This happens when an Ex command executes an Ex command that executes an Ex command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is larger. When it's more there probably is an endless loop. Probably a |:execute| or |:source| command is involved. -Can also happen with a recursive callback function (|channel-callback|). -A limit of 20 is used here. *E254* > Cannot allocate color {name} diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a3723f7459..63f24c8bd4 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4027,6 +4027,7 @@ A jump table for the options with a short description can be found at |Q_op|. Increasing this limit above 200 also changes the maximum for Ex command recursion, see |E169|. See also |:function|. + Also used for maximum depth of callback functions. *'maxmapdepth'* *'mmd'* *E223* 'maxmapdepth' 'mmd' number (default 1000) diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 6b7cfa79b3..38ab66c96d 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -4037,6 +4037,7 @@ vim.go.mat = vim.go.matchtime --- Increasing this limit above 200 also changes the maximum for Ex --- command recursion, see `E169`. --- See also `:function`. +--- Also used for maximum depth of callback functions. --- --- @type integer vim.o.maxfuncdepth = 100 -- cgit From 19aba5916a4064b503894185072fb1c47a41e023 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 22 Dec 2023 10:55:39 +0100 Subject: docs(options): add codeblock annotations to options.lua (#26696) Also consistently remove leading colons in examples Co-authored-by: zeertzjq --- runtime/doc/options.txt | 526 +++++++++++++++--------------- runtime/lua/vim/_meta/options.lua | 652 ++++++++++++++++++++++---------------- 2 files changed, 648 insertions(+), 530 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 63f24c8bd4..8ba801e6f2 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -732,8 +732,8 @@ A jump table for the options with a short description can be found at |Q_op|. from before it was deleted. When it appears again then it is read. |timestamp| If this option has a local value, use this command to switch back to - using the global value: > - :set autoread< + using the global value: >vim + set autoread< < *'autowrite'* *'aw'* *'noautowrite'* *'noaw'* @@ -780,10 +780,10 @@ A jump table for the options with a short description can be found at |Q_op|. be undone. First delete the "g:colors_name" variable when needed. Normally this option would be set in the vimrc file. Possibly - depending on the terminal name. Example: > - :if $TERM ==# "xterm" - : set background=dark - :endif + depending on the terminal name. Example: >vim + if $TERM ==# "xterm" + set background=dark + endif < When this option is changed, the default settings for the highlight groups will change. To use other settings, place ":highlight" commands AFTER the setting of the 'background' option. @@ -914,12 +914,12 @@ A jump table for the options with a short description can be found at |Q_op|. use '//', instead of '\\'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < See also 'backup' and 'writebackup' options. - If you want to hide your backup files on Unix, consider this value: > - :set backupdir=./.backup,~/.backup,.,/tmp + If you want to hide your backup files on Unix, consider this value: >vim + set backupdir=./.backup,~/.backup,.,/tmp < You must create a ".backup" directory in each directory and in your home directory for this to work properly. The use of |:set+=| and |:set-=| is preferred when adding or removing @@ -940,8 +940,8 @@ A jump table for the options with a short description can be found at |Q_op|. If you like to keep a lot of backups, you could use a BufWritePre autocommand to change 'backupext' just before writing the file to - include a timestamp. > - :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' + include a timestamp. >vim + au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* @@ -964,7 +964,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note that environment variables are not expanded. If you want to use $HOME you must expand it explicitly, e.g.: >vim - :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' + let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' < Note that the default also makes sure that "crontab -e" works (when a backup would be made by renaming the original file crontab won't see @@ -1227,8 +1227,8 @@ A jump table for the options with a short description can be found at |Q_op|. in the current directory first. If the default value taken from $CDPATH is not what you want, include a modified version of the following command in your vimrc file to - override it: > - :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') + override it: >vim + let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. (parts of 'cdpath' can be passed to the shell to expand file names). @@ -1239,9 +1239,9 @@ A jump table for the options with a short description can be found at |Q_op|. The key used in Command-line Mode to open the command-line window. Only non-printable keys are allowed. The key can be specified as a single character, but it is difficult to - type. The preferred way is to use the <> notation. Examples: > - :exe "set cedit=\" - :exe "set cedit=\" + type. The preferred way is to use the <> notation. Examples: >vim + exe "set cedit=\" + exe "set cedit=\" < |Nvi| also has this option, but it only uses the first character. See |cmdwin|. @@ -1271,7 +1271,7 @@ A jump table for the options with a short description can be found at |Q_op|. Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8" is done internally by Vim, 'charconvert' is not used for this. Also used for Unicode conversion. - Example: > + Example: >vim set charconvert=CharConvert() fun CharConvert() system("recode " @@ -1323,7 +1323,7 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer Keywords that are interpreted as a C++ scope declaration by |cino-g|. Useful e.g. for working with the Qt framework that defines additional - scope declarations "signals", "public slots" and "private slots": > + scope declarations "signals", "public slots" and "private slots": >vim set cinscopedecls+=signals,public\ slots,private\ slots < @@ -1393,11 +1393,11 @@ A jump table for the options with a short description can be found at |Q_op|. highlighted with ColorColumn |hl-ColorColumn|. Useful to align text. Will make screen redrawing slower. The screen column can be an absolute number, or a number preceded with - '+' or '-', which is added to or subtracted from 'textwidth'. > + '+' or '-', which is added to or subtracted from 'textwidth'. >vim - :set cc=+1 " highlight column after 'textwidth' - :set cc=+1,+2,+3 " highlight three columns after 'textwidth' - :hi ColorColumn ctermbg=lightgrey guibg=lightgrey + set cc=+1 " highlight column after 'textwidth' + set cc=+1,+2,+3 " highlight three columns after 'textwidth' + hi ColorColumn ctermbg=lightgrey guibg=lightgrey < When 'textwidth' is zero then the items with '-' and '+' are not used. A maximum of 256 columns are highlighted. @@ -1414,8 +1414,8 @@ A jump table for the options with a short description can be found at |Q_op|. number of columns of the display, the display may be messed up. For the GUI it is always possible and Vim limits the number of columns to what fits on the screen. You can use this command to get the widest - window possible: > - :set columns=9999 + window possible: >vim + set columns=9999 < Minimum value is 12, maximum value is 10000. *'comments'* *'com'* *E524* *E525* @@ -1447,8 +1447,8 @@ A jump table for the options with a short description can be found at |Q_op|. k scan the files given with the 'dictionary' option kspell use the currently active spell checking |spell| k{dict} scan the file {dict}. Several "k" flags can be given, - patterns are valid too. For example: > - :set cpt=k/usr/dict/*,k~/spanish + patterns are valid too. For example: >vim + set cpt=k/usr/dict/*,k~/spanish < s scan the files given with the 'thesaurus' option s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns are valid too. @@ -1849,7 +1849,7 @@ A jump table for the options with a short description can be found at |Q_op|. |hl-CursorColumn|. Useful to align text. Will make screen redrawing slower. If you only want the highlighting in the current window you can use - these autocommands: > + these autocommands: >vim au WinLeave * set nocursorline nocursorcolumn au WinEnter * set cursorline cursorcolumn < @@ -1912,7 +1912,7 @@ A jump table for the options with a short description can be found at |Q_op|. < If the function is defined with `func_name : function() {...`: > ^\s*\ze\i\+\s*[:]\s*(*function\s*( < When using the ":set" command, you need to double the backslashes! - To avoid that use `:let` with a single quote string: > + To avoid that use `:let` with a single quote string: >vim let &l:define = '^\s*\ze\k\+\s*=\s*function(' < @@ -2072,11 +2072,11 @@ A jump table for the options with a short description can be found at |Q_op|. patience patience diff algorithm histogram histogram diff algorithm - Examples: > - :set diffopt=internal,filler,context:4 - :set diffopt= - :set diffopt=internal,filler,foldcolumn:3 - :set diffopt-=internal " do NOT use the internal diff parser + Examples: >vim + set diffopt=internal,filler,context:4 + set diffopt= + set diffopt=internal,filler,foldcolumn:3 + set diffopt-=internal " do NOT use the internal diff parser < *'digraph'* *'dg'* *'nodigraph'* *'nodg'* @@ -2119,8 +2119,8 @@ A jump table for the options with a short description can be found at |Q_op|. - A directory name may end in an ':' or '/'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < Editing the same file twice will result in a warning. Using "/tmp" on is discouraged: if the system crashes you lose the swap file. And @@ -2265,8 +2265,8 @@ A jump table for the options with a short description can be found at |Q_op|. A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. - Otherwise this is a comma-separated list of event names. Example: > - :set ei=WinEnter,WinLeave + Otherwise this is a comma-separated list of event names. Example: >vim + set ei=WinEnter,WinLeave < *'expandtab'* *'et'* *'noexpandtab'* *'noet'* @@ -2348,7 +2348,7 @@ A jump table for the options with a short description can be found at |Q_op|. will work and the first entry of 'fileencodings' will be used (except "ucs-bom", which requires the BOM to be present). If you prefer another encoding use an BufReadPost autocommand event to test if your - preferred encoding is to be used. Example: > + preferred encoding is to be used. Example: >vim au BufReadPost * if search('\S', 'w') == 0 | \ set fenc=iso-2022-jp | endif < This sets 'fileencoding' to "iso-2022-jp" if the file does not contain @@ -2356,8 +2356,8 @@ A jump table for the options with a short description can be found at |Q_op|. When the |++enc| argument is used then the value of 'fileencodings' is not used. Note that 'fileencodings' is not used for a new file, the global value - of 'fileencoding' is used instead. You can set it with: > - :setglobal fenc=iso-8859-2 + of 'fileencoding' is used instead. You can set it with: >vim + setglobal fenc=iso-8859-2 < This means that a non-existing file may get a different encoding than an empty file. The special value "ucs-bom" can be used to check for a Unicode BOM @@ -2469,11 +2469,11 @@ A jump table for the options with a short description can be found at |Q_op|. this use the ":filetype on" command. |:filetype| Setting this option to a different value is most useful in a modeline, for a file for which the file type is not automatically recognized. - Example, for in an IDL file: > + Example, for in an IDL file: >c /* vim: set filetype=idl : */ < |FileType| |filetypes| When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set filetype=c.doxygen : */ < This will use the "c" filetype first, then the "doxygen" filetype. This works both for filetype plugins and for syntax files. More than @@ -2521,8 +2521,8 @@ A jump table for the options with a short description can be found at |Q_op|. "vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold" default to single-byte alternatives. - Example: > - :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- + Example: >vim + set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- < For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items single-byte and multibyte characters are supported. But double-width @@ -2731,8 +2731,8 @@ A jump table for the options with a short description can be found at |Q_op|. automatic formatting. This can be empty. Don't insert it yet! - Example: > - :set formatexpr=mylang#Format() + Example: >vim + set formatexpr=mylang#Format() < This will invoke the mylang#Format() function in the autoload/mylang.vim file in 'runtimepath'. |autoload| @@ -2746,7 +2746,7 @@ A jump table for the options with a short description can be found at |Q_op|. the internal format mechanism. If the expression starts with s: or ||, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set formatexpr=s:MyFormatExpr() set formatexpr=SomeFormatExpr() < Otherwise, the expression is evaluated in the context of the script @@ -2848,8 +2848,8 @@ A jump table for the options with a short description can be found at |Q_op|. will be included. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. When your "grep" accepts the "-H" argument, use this to make ":grep" - also work well with a single file: > - :set grepprg=grep\ -nH + also work well with a single file: >vim + set grepprg=grep\ -nH < Special value: When 'grepprg' is set to "internal" the |:grep| command works like |:vimgrep|, |:lgrep| like |:lvimgrep|, |:grepadd| like |:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|. @@ -2864,11 +2864,11 @@ A jump table for the options with a short description can be found at |Q_op|. Configures the cursor style for each mode. Works in the GUI and many terminals. See |tui-cursor-shape|. - To disable cursor-styling, reset the option: > - :set guicursor= + To disable cursor-styling, reset the option: >vim + set guicursor= -< To enable mode shapes, "Cursor" highlight, and blinking: > - :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 +< To enable mode shapes, "Cursor" highlight, and blinking: >vim + set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor \,sm:block-blinkwait175-blinkoff150-blinkon175 @@ -2901,8 +2901,8 @@ A jump table for the options with a short description can be found at |Q_op|. the cursor starts blinking, blinkon is the time that the cursor is shown and blinkoff is the time that the cursor is not shown. Times are in msec. When one of - the numbers is zero, there is no blinking. E.g.: > - :set guicursor=n:blinkon0 + the numbers is zero, there is no blinking. E.g.: >vim + set guicursor=n:blinkon0 < - Default is "blinkon0" for each mode. {group-name} Highlight group that decides the color and font of the @@ -2940,9 +2940,9 @@ A jump table for the options with a short description can be found at |Q_op|. to do a common setting for all modes. For example, to switch off blinking: "a:blinkon0" - Examples of cursor highlighting: > - :highlight Cursor gui=reverse guifg=NONE guibg=NONE - :highlight Cursor gui=NONE guifg=bg guibg=fg + Examples of cursor highlighting: >vim + highlight Cursor gui=reverse guifg=NONE guibg=NONE + highlight Cursor gui=NONE guifg=bg guibg=fg < *'guifont'* *'gfn'* *E235* *E596* @@ -2957,8 +2957,8 @@ A jump table for the options with a short description can be found at |Q_op|. Spaces after a comma are ignored. To include a comma in a font name precede it with a backslash. Setting an option requires an extra backslash before a space and a backslash. See also - |option-backslash|. For example: > - :set guifont=Screen15,\ 7x13,font\\,with\\,commas + |option-backslash|. For example: >vim + set guifont=Screen15,\ 7x13,font\\,with\\,commas < will make Vim try to use the font "Screen15" first, and if it fails it will try to use "7x13" and then "font,with,commas" instead. @@ -2969,14 +2969,14 @@ A jump table for the options with a short description can be found at |Q_op|. the case of X). The font names given should be "normal" fonts. Vim will try to find the related bold and italic fonts. - For Win32 and Mac OS: > - :set guifont=* + For Win32 and Mac OS: >vim + set guifont=* < will bring up a font requester, where you can pick the font you want. The font name depends on the GUI used. - For Mac OSX you can use something like this: > - :set guifont=Monaco:h10 + For Mac OSX you can use something like this: >vim + set guifont=Monaco:h10 < *E236* Note that the fonts must be mono-spaced (all characters have the same width). @@ -3001,9 +3001,9 @@ A jump table for the options with a short description can be found at |Q_op|. Use a ':' to separate the options. - A '_' can be used in the place of a space, so you don't need to use backslashes to escape the spaces. - - Examples: > - :set guifont=courier_new:h12:w5:b:cRUSSIAN - :set guifont=Andale_Mono:h7.5:w4.5 + - Examples: >vim + set guifont=courier_new:h12:w5:b:cRUSSIAN + set guifont=Andale_Mono:h7.5:w4.5 < *'guifontwide'* *'gfw'* *E231* *E533* *E534* @@ -3143,8 +3143,8 @@ A jump table for the options with a short description can be found at |Q_op|. When non-empty describes the text to use in a tooltip for the GUI tab pages line. When empty Vim will use a default tooltip. This option is otherwise just like 'guitablabel' above. - You can include a line break. Simplest method is to use |:let|: > - :let &guitabtooltip = "line one\nline two" + You can include a line break. Simplest method is to use |:let|: >vim + let &guitabtooltip = "line one\nline two" < *'helpfile'* *'hf'* @@ -3178,8 +3178,8 @@ A jump table for the options with a short description can be found at |Q_op|. be used as a last resort. You can add "en" to prefer English over another language, but that will only find tags that exist in that language and not in the English help. - Example: > - :set helplang=de,it + Example: >vim + set helplang=de,it < This will first search German, then Italian and finally English help files. When using |CTRL-]| and ":help!" in a non-English help file Vim will @@ -3290,8 +3290,8 @@ A jump table for the options with a short description can be found at |Q_op|. 1 :lmap is ON and IM is off 2 :lmap is off and IM is ON To always reset the option to zero when leaving Insert mode with - this can be used: > - :inoremap :set iminsert=0 + this can be used: >vim + inoremap :set iminsert=0 < This makes :lmap and IM turn off automatically when leaving Insert mode. Note that this option changes when using CTRL-^ in Insert mode @@ -3349,20 +3349,20 @@ A jump table for the options with a short description can be found at |Q_op|. 'includeexpr' 'inex' string (default "") local to buffer Expression to be used to transform the string found with the 'include' - option to a file name. Mostly useful to change "." to "/" for Java: > - :setlocal includeexpr=substitute(v:fname,'\\.','/','g') + option to a file name. Mostly useful to change "." to "/" for Java: >vim + setlocal includeexpr=substitute(v:fname,'\\.','/','g') < The "v:fname" variable will be set to the file name that was detected. Note the double backslash: the `:set` command first halves them, then one remains in the value, where "\." matches a dot literally. For - simple character replacements `tr()` avoids the need for escaping: > - :setlocal includeexpr=tr(v:fname,'.','/') + simple character replacements `tr()` avoids the need for escaping: >vim + setlocal includeexpr=tr(v:fname,'.','/') < Also used for the |gf| command if an unmodified file name can't be found. Allows doing "gf" on the name after an 'include' statement. Also used for ||. If the expression starts with s: or ||, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim setlocal includeexpr=s:MyIncludeExpr(v:fname) setlocal includeexpr=SomeIncludeExpr(v:fname) < Otherwise, the expression is evaluated in the context of the script @@ -3396,7 +3396,7 @@ A jump table for the options with a short description can be found at |Q_op|. typing a search command. See also: 'hlsearch'. If you don't want to turn 'hlsearch' on, but want to highlight all matches while searching, you can turn on and off 'hlsearch' with - autocmd. Example: > + autocmd. Example: >vim augroup vimrc-incsearch-highlight autocmd! autocmd CmdlineEnter /,\? :set hlsearch @@ -3424,7 +3424,7 @@ A jump table for the options with a short description can be found at |Q_op|. when the expression is evaluated (but it may be moved around). If the expression starts with s: or ||, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set indentexpr=s:MyIndentExpr() set indentexpr=SomeIndentExpr() < Otherwise, the expression is evaluated in the context of the script @@ -3438,8 +3438,8 @@ A jump table for the options with a short description can be found at |Q_op|. The evaluation of the expression must not have side effects! It must not change the text, jump to another window, etc. Afterwards the cursor position is always restored, thus the cursor may be moved. - Normally this option would be set to call a function: > - :set indentexpr=GetMyIndent() + Normally this option would be set to call a function: >vim + set indentexpr=GetMyIndent() < Error messages will be suppressed, unless the 'debug' option contains "msg". See |indent-expression|. @@ -3636,9 +3636,9 @@ A jump table for the options with a short description can be found at |Q_op|. When "man" or "man -s" is used, Vim will automatically translate a [count] for the "K" command to a section number. See |option-backslash| about including spaces and backslashes. - Example: > - :set keywordprg=man\ -s - :set keywordprg=:Man + Example: >vim + set keywordprg=man\ -s + set keywordprg=:Man < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -3658,10 +3658,10 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - Example (for Greek, in UTF-8): *greek* > - :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz -< Example (exchanges meaning of z and y for commands): > - :set langmap=zy,yz,ZY,YZ + Example (for Greek, in UTF-8): *greek* >vim + set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz +< Example (exchanges meaning of z and y for commands): >vim + set langmap=zy,yz,ZY,YZ < The 'langmap' option is a list of parts, separated with commas. Each part can be in one of two forms: @@ -3689,22 +3689,22 @@ A jump table for the options with a short description can be found at |Q_op|. 'langmenu' 'lm' string (default "") global Language to use for menu translation. Tells which file is loaded - from the "lang" directory in 'runtimepath': > + from the "lang" directory in 'runtimepath': >vim "lang/menu_" .. &langmenu .. ".vim" < (without the spaces). For example, to always use the Dutch menus, no - matter what $LANG is set to: > - :set langmenu=nl_NL.ISO_8859-1 + matter what $LANG is set to: >vim + set langmenu=nl_NL.ISO_8859-1 < When 'langmenu' is empty, |v:lang| is used. Only normal file name characters can be used, `/\*?[|<>` are illegal. If your $LANG is set to a non-English language but you do want to use - the English menus: > - :set langmenu=none + the English menus: >vim + set langmenu=none < This option must be set before loading menus, switching on filetype detection or syntax highlighting. Once the menus are defined setting - this option has no effect. But you could do this: > - :source $VIMRUNTIME/delmenu.vim - :set langmenu=de_DE.ISO_8859-1 - :source $VIMRUNTIME/menu.vim + this option has no effect. But you could do this: >vim + source $VIMRUNTIME/delmenu.vim + set langmenu=de_DE.ISO_8859-1 + source $VIMRUNTIME/menu.vim < Warning: This deletes all menus that you defined yourself! *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'* @@ -3760,8 +3760,8 @@ A jump table for the options with a short description can be found at |Q_op|. option will cause the window size to be changed. When you only want to use the size for the GUI, put the command in your |gvimrc| file. Vim limits the number of lines to what fits on the screen. You can - use this command to get the tallest window possible: > - :set lines=999 + use this command to get the tallest window possible: >vim + set lines=999 < Minimum value is 2, maximum value is 1000. *'linespace'* *'lsp'* @@ -3815,8 +3815,8 @@ A jump table for the options with a short description can be found at |Q_op|. The cursor is displayed at the start of the space a Tab character occupies, not at the end as usual in Normal mode. To get this cursor - position while displaying Tabs with spaces, use: > - :set list lcs=tab:\ \ + position while displaying Tabs with spaces, use: >vim + set list lcs=tab:\ \ < Note that list mode will also affect formatting (set with 'textwidth' or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for @@ -3870,8 +3870,8 @@ A jump table for the options with a short description can be found at |Q_op|. lead:c Character to show for leading spaces. When omitted, leading spaces are blank. Overrides the "space" and "multispace" settings for leading spaces. You can - combine it with "tab:", for example: > - :set listchars+=tab:>-,lead:. + combine it with "tab:", for example: >vim + set listchars+=tab:>-,lead:. < *lcs-leadmultispace* leadmultispace:c... @@ -3907,17 +3907,17 @@ A jump table for the options with a short description can be found at |Q_op|. The characters ':' and ',' should not be used. UTF-8 characters can be used. All characters must be single width. - Each character can be specified as hex: > + Each character can be specified as hex: >vim set listchars=eol:\\x24 set listchars=eol:\\u21b5 set listchars=eol:\\U000021b5 < Note that a double backslash is used. The number of hex characters must be exactly 2 for \\x, 4 for \\u and 8 for \\U. - Examples: > - :set lcs=tab:>-,trail:- - :set lcs=tab:>-,eol:<,nbsp:% - :set lcs=extends:>,precedes:< + Examples: >vim + set lcs=tab:>-,trail:- + set lcs=tab:>-,eol:<,nbsp:% + set lcs=extends:>,precedes:< < |hl-NonText| highlighting will be used for "eol", "extends" and "precedes". |hl-Whitespace| for "nbsp", "space", "tab", "multispace", "lead" and "trail". @@ -3968,8 +3968,8 @@ A jump table for the options with a short description can be found at |Q_op|. This would be mostly useful when you use MS-Windows. If iconv is enabled, setting 'makeencoding' to "char" has the same effect as - setting to the system locale encoding. Example: > - :set makeencoding=char " system locale is used + setting to the system locale encoding. Example: >vim + set makeencoding=char " system locale is used < *'makeprg'* *'mp'* @@ -3983,11 +3983,11 @@ A jump table for the options with a short description can be found at |Q_op|. about including spaces and backslashes. Note that a '|' must be escaped twice: once for ":set" and once for the interpretation of a command. When you use a filter called - "myfilter" do it like this: > - :set makeprg=gmake\ \\\|\ myfilter + "myfilter" do it like this: >vim + set makeprg=gmake\ \\\|\ myfilter < The placeholder "$*" can be given (even multiple times) to specify - where the arguments will be included, for example: > - :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} + where the arguments will be included, for example: >vim + set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -4000,12 +4000,12 @@ A jump table for the options with a short description can be found at |Q_op|. jump between two double quotes. The characters must be separated by a colon. The pairs must be separated by a comma. Example for including '<' and - '>' (for HTML): > - :set mps+=<:> + '>' (for HTML): >vim + set mps+=<:> < A more exotic example, to jump between the '=' and ';' in an - assignment, useful for languages like C and Java: > - :au FileType c,cpp,java set mps+==:; + assignment, useful for languages like C and Java: >vim + au FileType c,cpp,java set mps+==:; < For a more advanced way of using "%", see the matchit.vim plugin in the $VIMRUNTIME/plugin directory. |add-local-help| @@ -4092,8 +4092,8 @@ A jump table for the options with a short description can be found at |Q_op|. The languages for which these numbers are important are Italian and Hungarian. The default works for when you have about 512 Mbyte. If - you have 1 Gbyte you could use: > - :set mkspellmem=900000,3000,800 + you have 1 Gbyte you could use: >vim + set mkspellmem=900000,3000,800 < If you have less than 512 Mbyte |:mkspell| may fail for some languages, no matter what you set 'mkspellmem' to. @@ -4167,8 +4167,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'mouse' string (default "nvi") global Enables mouse support. For example, to enable the mouse in Normal mode - and Visual mode: > - :set mouse=nv + and Visual mode: >vim + set mouse=nv < To temporarily disable mouse support, hold the shift key while using the mouse. @@ -4251,19 +4251,19 @@ A jump table for the options with a short description can be found at |Q_op|. Note that you can further refine the meaning of buttons with mappings. See |mouse-overview|. But mappings are NOT used for modeless selection. - Example: > - :map - :map - :map - :map <2-S-LeftMouse> <2-RightMouse> - :map <2-S-LeftDrag> <2-RightDrag> - :map <2-S-LeftRelease> <2-RightRelease> - :map <3-S-LeftMouse> <3-RightMouse> - :map <3-S-LeftDrag> <3-RightDrag> - :map <3-S-LeftRelease> <3-RightRelease> - :map <4-S-LeftMouse> <4-RightMouse> - :map <4-S-LeftDrag> <4-RightDrag> - :map <4-S-LeftRelease> <4-RightRelease> + Example: >vim + map + map + map + map <2-S-LeftMouse> <2-RightMouse> + map <2-S-LeftDrag> <2-RightDrag> + map <2-S-LeftRelease> <2-RightRelease> + map <3-S-LeftMouse> <3-RightMouse> + map <3-S-LeftDrag> <3-RightDrag> + map <3-S-LeftRelease> <3-RightRelease> + map <4-S-LeftMouse> <4-RightMouse> + map <4-S-LeftDrag> <4-RightDrag> + map <4-S-LeftRelease> <4-RightRelease> < Mouse commands requiring the CTRL modifier can be simulated by typing the "g" key before using the mouse: @@ -4295,8 +4295,8 @@ A jump table for the options with a short description can be found at |Q_op|. for vertical scrolling). You can disable mouse scrolling by using a count of 0. - Example: > - :set mousescroll=ver:5,hor:2 + Example: >vim + set mousescroll=ver:5,hor:2 < Will make Nvim scroll 5 lines at a time when scrolling vertically, and scroll 2 columns at a time when scrolling horizontally. @@ -4357,8 +4357,8 @@ A jump table for the options with a short description can be found at |Q_op|. Any modes not specified or shapes not available use the normal mouse pointer. - Example: > - :set mouseshape=s:udsizing,m:no + Example: >vim + set mouseshape=s:udsizing,m:no < will make the mouse turn to a sizing arrow over the status lines and indicate no input when the hit-enter prompt is displayed (since clicking the mouse has no effect in this state.) @@ -4523,30 +4523,30 @@ A jump table for the options with a short description can be found at |Q_op|. provided that the file being searched for has a relative path (not starting with "/", "./" or "../"). The directories in the 'path' option may be relative or absolute. - - Use commas to separate directory names: > - :set path=.,/usr/local/include,/usr/include + - Use commas to separate directory names: >vim + set path=.,/usr/local/include,/usr/include < - Spaces can also be used to separate directory names. To have a space in a directory name, precede it with an extra backslash, and - escape the space: > - :set path=.,/dir/with\\\ space + escape the space: >vim + set path=.,/dir/with\\\ space < - To include a comma in a directory name precede it with an extra - backslash: > - :set path=.,/dir/with\\,comma -< - To search relative to the directory of the current file, use: > - :set path=. + backslash: >vim + set path=.,/dir/with\\,comma +< - To search relative to the directory of the current file, use: >vim + set path=. < - To search in the current directory use an empty string between two - commas: > - :set path=,, + commas: >vim + set path=,, < - A directory name may end in a ':' or '/'. - Environment variables are expanded |:set_env|. - When using |netrw.vim| URLs can be used. For example, adding "https://www.vim.org" will make ":find index.html" work. - Search upwards and downwards in a directory tree using "*", "**" and ";". See |file-searching| for info and syntax. - - Careful with '\' characters, type two to get one in the option: > - :set path=.,c:\\include -< Or just use '/' instead: > - :set path=.,c:/include + - Careful with '\' characters, type two to get one in the option: >vim + set path=.,c:\\include +< Or just use '/' instead: >vim + set path=.,c:/include < Don't forget "." or files won't even be found in the same directory as the file! The maximum length is limited. How much depends on the system, mostly @@ -4555,14 +4555,14 @@ A jump table for the options with a short description can be found at |Q_op|. 'path', see |:checkpath|. The use of |:set+=| and |:set-=| is preferred when adding or removing directories from the list. This avoids problems when a future version - uses another default. To remove the current directory use: > - :set path-= -< To add the current directory use: > - :set path+= + uses another default. To remove the current directory use: >vim + set path-= +< To add the current directory use: >vim + set path+= < To use an environment variable, you probably need to replace the separator. Here is an example to append $INCL, in which directory - names are separated with a semi-colon: > - :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') + names are separated with a semi-colon: >vim + let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') < Replace the ';' with a ':' or whatever separator is used. Note that this doesn't work when $INCL contains a comma or white space. @@ -4604,10 +4604,10 @@ A jump table for the options with a short description can be found at |Q_op|. It is possible to override the level for individual highlights within the popupmenu using |highlight-blend|. For instance, to enable - transparency but force the current selected element to be fully opaque: > + transparency but force the current selected element to be fully opaque: >vim - :set pumblend=15 - :hi PmenuSel blend=0 + set pumblend=15 + hi PmenuSel blend=0 < UI-dependent. Works best with RGB colors. 'termguicolors' @@ -4830,8 +4830,8 @@ A jump table for the options with a short description can be found at |Q_op|. The default ruler width is 17 characters. To make the ruler 15 characters wide, put "%15(" at the start and "%)" at the end. - Example: > - :set rulerformat=%15(%c%V\ %p%%%) + Example: >vim + set rulerformat=%15(%c%V\ %p%%%) < *'runtimepath'* *'rtp'* *vimfiles* @@ -4909,8 +4909,8 @@ A jump table for the options with a short description can be found at |Q_op|. runtime files. For speed, use as few items as possible and avoid wildcards. See |:runtime|. - Example: > - :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME + Example: >vim + set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME < This will use the directory "~/vimruntime" first (containing your personal Nvim runtime files), then "/mygroup/vim", and finally "$VIMRUNTIME" (the default runtime files). @@ -4974,7 +4974,7 @@ A jump table for the options with a short description can be found at |Q_op|. in the middle of the window (except at the start or end of the file or when long lines wrap). After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal scrolloff< setlocal scrolloff=-1 < For scrolling horizontally see 'sidescrolloff'. @@ -5183,8 +5183,8 @@ A jump table for the options with a short description can be found at |Q_op|. 2^8 < 10240 < 2^16) + 10240 bytes (requested maximum item contents size) = 10253 bytes. - Example: > - :set shada='50,<1000,s100,:0,n~/nvim/shada + Example: >vim + set shada='50,<1000,s100,:0,n~/nvim/shada < '50 Marks will be remembered for the last 50 files you edited. @@ -5227,12 +5227,12 @@ A jump table for the options with a short description can be found at |Q_op|. Environment variables are expanded |:set_env|. If the name of the shell contains a space, you need to enclose it in - quotes. Example with quotes: > - :set shell=\"c:\program\ files\unix\sh.exe\"\ -f + quotes. Example with quotes: >vim + set shell=\"c:\program\ files\unix\sh.exe\"\ -f < Note the backslash before each quote (to avoid starting a comment) and each space (to avoid ending the option value), so better use |:let-&| - like this: > - :let &shell='"C:\Program Files\unix\sh.exe" -f' + like this: >vim + let &shell='"C:\Program Files\unix\sh.exe" -f' < Also note that the "-f" is not inside the quotes, because it is not part of the command name. *shell-unquoting* @@ -5255,7 +5255,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note that such processing is done after |:set| did its own round of unescaping, so to keep yourself sane use |:let-&| like shown above. *shell-powershell* - To use PowerShell: > + To use PowerShell: >vim let &shell = executable('pwsh') ? 'pwsh' : 'powershell' let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' @@ -5365,7 +5365,7 @@ A jump table for the options with a short description can be found at |Q_op|. existing file names, thus this option needs to be set before opening any file for best results. This might change in the future. 'shellslash' only works when a backslash can be used as a path - separator. To test if this is so use: > + separator. To test if this is so use: >vim if exists('+shellslash') < Also see 'completeslash'. @@ -5478,9 +5478,9 @@ A jump table for the options with a short description can be found at |Q_op|. 'showbreak' 'sbr' string (default "") global or local to window |global-local| String to put at the start of lines that have been wrapped. Useful - values are "> " or "+++ ": > - :let &showbreak = "> " - :let &showbreak = '+++ ' + values are "> " or "+++ ": >vim + let &showbreak = "> " + let &showbreak = '+++ ' < Only printable single-cell characters are allowed, excluding and comma (in a future version the comma might be used to separate the part that is shown at the end and at the start of a line). @@ -5489,8 +5489,8 @@ A jump table for the options with a short description can be found at |Q_op|. If you want the 'showbreak' to appear in between line numbers, add the "n" flag to 'cpoptions'. A window-local value overrules a global value. If the global value is - set and you want no value in the current window use NONE: > - :setlocal showbreak=NONE + set and you want no value in the current window use NONE: >vim + setlocal showbreak=NONE < *'showcmd'* *'sc'* *'noshowcmd'* *'nosc'* @@ -5594,16 +5594,16 @@ A jump table for the options with a short description can be found at |Q_op|. horizontally centered in the window, as long as one does not come too close to the beginning of the line. After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal sidescrolloff< setlocal sidescrolloff=-1 < Example: Try this together with 'sidescroll' and 'listchars' as in the following example to never allow the cursor to move - onto the "extends" character: > + onto the "extends" character: >vim - :set nowrap sidescroll=1 listchars=extends:>,precedes:< - :set sidescrolloff=1 + set nowrap sidescroll=1 listchars=extends:>,precedes:< + set sidescrolloff=1 < *'signcolumn'* *'scl'* @@ -5752,7 +5752,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'spelllang' 'spl' string (default "en") local to buffer A comma-separated list of word list names. When the 'spell' option is - on spellchecking will be done for these languages. Example: > + on spellchecking will be done for these languages. Example: >vim set spelllang=en_us,nl,medical < This means US English, Dutch and medical words are recognized. Words that are not recognized will be highlighted. @@ -5862,8 +5862,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'verbose' option to a non-zero value. Only one of "best", "double" or "fast" may be used. The others may - appear several times in any order. Example: > - :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() + appear several times in any order. Example: >vim + set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5943,21 +5943,21 @@ A jump table for the options with a short description can be found at |Q_op|. Examples: >vim " Relative number with bar separator and click handlers: - :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T + set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T " Right aligned relative cursor line number: - :let &stc='%=%{v:relnum?v:relnum:v:lnum} ' + let &stc='%=%{v:relnum?v:relnum:v:lnum} ' " Line numbers in hexadecimal for non wrapped part of lines: - :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' + let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' " Human readable line numbers with thousands separator: - :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' + let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' . '%(\\d\\d\\d\\)\\+$",",","g")}' " Both relative and absolute line numbers with different " highlighting for odd and even relative numbers: - :let &stc='%#NonText#%{&nu?v:lnum:""}' . + let &stc='%#NonText#%{&nu?v:lnum:""}' . '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' . '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' @@ -5977,8 +5977,8 @@ A jump table for the options with a short description can be found at |Q_op|. be given as "%%". When the option starts with "%!" then it is used as an expression, - evaluated and the result is used as the option value. Example: > - :set statusline=%!MyStatusLine() + evaluated and the result is used as the option value. Example: >vim + set statusline=%!MyStatusLine() < The *g:statusline_winid* variable will be set to the |window-ID| of the window that the status line belongs to. The result can contain %{} items that will be evaluated too. @@ -6059,7 +6059,7 @@ A jump table for the options with a short description can be found at |Q_op|. return value of expr contains "%" items they will get expanded. The expression can contain the "}" character, the end of expression is denoted by "%}". - For example: > + For example: >vim func! Stl_filename() abort return "%t" endfunc @@ -6126,8 +6126,8 @@ A jump table for the options with a short description can be found at |Q_op|. When all items in a group becomes an empty string (i.e. flags that are not set) and a minwid is not set for the group, the whole group will become empty. This will make a group like the following disappear - completely from the statusline when none of the flags are set. > - :set statusline=...%(\ [%M%R%H]%)... + completely from the statusline when none of the flags are set. >vim + set statusline=...%(\ [%M%R%H]%)... < Beware that an expression is evaluated each and every time the status line is displayed. *stl-%{* *g:actual_curbuf* *g:actual_curwin* @@ -6158,23 +6158,23 @@ A jump table for the options with a short description can be found at |Q_op|. edit your vimrc or whatever with "vim --clean" to get it right. Examples: - Emulate standard status line with 'ruler' set > - :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P -< Similar, but add ASCII value of char under the cursor (like "ga") > - :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P -< Display byte count and byte value, modified flag in red. > - :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' - :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red -< Display a ,GZ flag if a compressed file is loaded > - :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... -< In the |:autocmd|'s: > - :let b:gzflag = 1 -< And: > - :unlet b:gzflag -< And define this function: > - :function VarExists(var, val) - : if exists(a:var) | return a:val | else | return '' | endif - :endfunction + Emulate standard status line with 'ruler' set >vim + set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +< Similar, but add ASCII value of char under the cursor (like "ga") >vim + set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P +< Display byte count and byte value, modified flag in red. >vim + set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' + hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red +< Display a ,GZ flag if a compressed file is loaded >vim + set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... +< In the |:autocmd|'s: >vim + let b:gzflag = 1 +< And: >vim + unlet b:gzflag +< And define this function: >vim + function VarExists(var, val) + if exists(a:var) | return a:val | else | return '' | endif + endfunction < *'suffixes'* *'su'* @@ -6195,8 +6195,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'suffixesadd' 'sua' string (default "") local to buffer Comma-separated list of suffixes, which are used when searching for a - file for the "gf", "[I", etc. commands. Example: > - :set suffixesadd=.java + file for the "gf", "[I", etc. commands. Example: >vim + set suffixesadd=.java < *'swapfile'* *'swf'* *'noswapfile'* *'noswf'* @@ -6268,19 +6268,19 @@ A jump table for the options with a short description can be found at |Q_op|. Otherwise this option does not always reflect the current syntax (the b:current_syntax variable does). This option is most useful in a modeline, for a file which syntax is - not automatically recognized. Example, in an IDL file: > + not automatically recognized. Example, in an IDL file: >c /* vim: set syntax=idl : */ < When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set syntax=c.doxygen : */ < This will use the "c" syntax first, then the "doxygen" syntax. Note that the second one must be prepared to be loaded as an addition, otherwise it will be skipped. More than one dot may appear. - To switch off syntax highlighting for the current file, use: > - :set syntax=OFF + To switch off syntax highlighting for the current file, use: >vim + set syntax=OFF < To switch syntax highlighting on according to the current value of the - 'filetype' option: > - :set syntax=ON + 'filetype' option: >vim + set syntax=ON < What actually happens when setting the 'syntax' option is that the Syntax autocommand event is triggered with the value as argument. This option is not copied to another buffer, independent of the 's' or @@ -6634,13 +6634,13 @@ A jump table for the options with a short description can be found at |Q_op|. expanded according to the rules used for 'statusline'. This option cannot be set in a modeline when 'modelineexpr' is off. - Example: > - :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") - :set title titlestring=%<%F%=%l/%L-%P titlelen=70 + Example: >vim + auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") + set title titlestring=%<%F%=%l/%L-%P titlelen=70 < The value of 'titlelen' is used to align items in the middle or right of the available space. - Some people prefer to have the file name first: > - :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) + Some people prefer to have the file name first: >vim + set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) < Note the use of "%{ }" and an expression to get the path of the file, without the file name. The "%( %)" constructs are used to add a separating space only when needed. @@ -6712,13 +6712,13 @@ A jump table for the options with a short description can be found at |Q_op|. is kept in memory, higher numbers will cause more memory to be used. Nevertheless, a single change can already use a large amount of memory. Set to 0 for Vi compatibility: One level of undo and "u" undoes - itself: > + itself: >vim set ul=0 < But you can also get Vi compatibility by including the 'u' flag in 'cpoptions', and still be able to use CTRL-R to repeat undo. Also see |undo-two-ways|. Set to -1 for no undo at all. You might want to do this only for the - current buffer: > + current buffer: >vim setlocal ul=-1 < This helps when you run out of memory for a single change. @@ -6774,8 +6774,8 @@ A jump table for the options with a short description can be found at |Q_op|. For example, when editing assembly language files where statements start in the 9th column and comments in the 41st, it may be useful - to use the following: > - :set varsofttabstop=8,32,8 + to use the following: >vim + set varsofttabstop=8,32,8 < This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more for every column thereafter. @@ -6787,8 +6787,8 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer A list of the number of spaces that a in the file counts for, separated by commas. Each value corresponds to one tab, with the - final value applying to all subsequent tabs. For example: > - :set vartabstop=4,20,10,8 + final value applying to all subsequent tabs. For example: >vim + set vartabstop=4,20,10,8 < This will make the first tab 4 spaces wide, the second 20 spaces, the third 10 spaces, and all following tabs 8 spaces. @@ -6917,8 +6917,8 @@ A jump table for the options with a short description can be found at |Q_op|. ~ "~" Normal [ Insert and Replace ] Insert and Replace - For example: > - :set ww=<,>,[,] + For example: >vim + set ww=<,>,[,] < allows wrap only when cursor keys are used. When the movement keys are used in combination with a delete or change operator, the also counts for a character. This makes "3h" @@ -6942,8 +6942,8 @@ A jump table for the options with a short description can be found at |Q_op|. Some keys will not work, such as CTRL-C, and Enter. can be used, but hitting it twice in a row will still exit command-line as a failsafe measure. - Although 'wc' is a number option, you can set it to a special key: > - :set wc= + Although 'wc' is a number option, you can set it to a special key: >vim + set wc= < *'wildcharm'* *'wcm'* @@ -6953,9 +6953,9 @@ A jump table for the options with a short description can be found at |Q_op|. recognized when used inside a macro. You can find "spare" command-line keys suitable for this option by looking at |ex-edit-index|. Normally you'll never actually type 'wildcharm', just use it in mappings that - automatically invoke completion mode, e.g.: > - :set wcm= - :cnoremap ss so $vim/sessions/*.vim + automatically invoke completion mode, e.g.: >vim + set wcm= + cnoremap ss so $vim/sessions/*.vim < Then after typing :ss you can use CTRL-P & CTRL-N. *'wildignore'* *'wig'* @@ -6967,8 +6967,8 @@ A jump table for the options with a short description can be found at |Q_op|. |globpath()| unless a flag is passed to disable this. The pattern is used like with |:autocmd|, see |autocmd-pattern|. Also see 'suffixes'. - Example: > - :set wildignore=*.o,*.obj + Example: >vim + set wildignore=*.o,*.obj < The use of |:set+=| and |:set-=| is preferred when adding or removing a pattern from the list. This avoids problems when a future version uses another default. @@ -7016,9 +7016,9 @@ A jump table for the options with a short description can be found at |Q_op|. completion. If you want and to move the cursor instead of selecting - a different match, use this: > - :cnoremap - :cnoremap + a different match, use this: >vim + cnoremap + cnoremap < |hl-WildMenu| highlights the current match. @@ -7056,16 +7056,16 @@ A jump table for the options with a short description can be found at |Q_op|. and sort buffers by time last used (other than the current buffer). - Examples: > - :set wildmode=full -< Complete first full match, next match, etc. (the default) > - :set wildmode=longest,full -< Complete longest common string, then each full match > - :set wildmode=list:full -< List all matches and complete each full match > - :set wildmode=list,full -< List all matches without completing, then each full match > - :set wildmode=longest,list + Examples: >vim + set wildmode=full +< Complete first full match, next match, etc. (the default) >vim + set wildmode=longest,full +< Complete longest common string, then each full match >vim + set wildmode=list:full +< List all matches and complete each full match >vim + set wildmode=list,full +< List all matches without completing, then each full match >vim + set wildmode=longest,list < Complete longest common string, then list alternatives. More info here: |cmdline-completion|. @@ -7175,7 +7175,7 @@ A jump table for the options with a short description can be found at |Q_op|. Other windows will be only 'winminheight' high. This has the drawback that ":all" will create only two windows. To avoid "vim -o 1 2 3 4" to create only two windows, set the option after startup is done, - using the |VimEnter| event: > + using the |VimEnter| event: >vim au VimEnter * set winheight=999 < Minimum value is 1. The height is not adjusted after one of the commands that change the @@ -7200,7 +7200,7 @@ A jump table for the options with a short description can be found at |Q_op|. the popupmenu are determined by the current window. Highlights in the message area cannot be overridden. - Example: show a different color for non-current windows: > + Example: show a different color for non-current windows: >vim set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC < @@ -7256,9 +7256,9 @@ A jump table for the options with a short description can be found at |Q_op|. horizontally. The line will be broken in the middle of a word if necessary. See 'linebreak' to get the break at a word boundary. - To make scrolling horizontally a bit more useful, try this: > - :set sidescroll=5 - :set listchars+=precedes:<,extends:> + To make scrolling horizontally a bit more useful, try this: >vim + set sidescroll=5 + set listchars+=precedes:<,extends:> < See 'sidescroll', 'listchars' and |wrap-off|. This option can't be set from a |modeline| when the 'diff' option is on. diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 38ab66c96d..209c27cfd8 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -137,8 +137,9 @@ vim.bo.ai = vim.bo.autoindent --- `timestamp` --- If this option has a local value, use this command to switch back to --- using the global value: ---- ``` ---- :set autoread< +--- +--- ```vim +--- set autoread< --- ``` --- --- @@ -198,10 +199,11 @@ vim.go.awa = vim.go.autowriteall --- --- Normally this option would be set in the vimrc file. Possibly --- depending on the terminal name. Example: ---- ``` ---- :if $TERM ==# "xterm" ---- : set background=dark ---- :endif +--- +--- ```vim +--- if $TERM ==# "xterm" +--- set background=dark +--- endif --- ``` --- When this option is changed, the default settings for the highlight groups --- will change. To use other settings, place ":highlight" commands AFTER @@ -348,14 +350,16 @@ vim.go.bkc = vim.go.backupcopy --- - Environment variables are expanded `:set_env`. --- - Careful with '\' characters, type one before a space, type two to --- get one in the option (see `option-backslash`), for example: ---- ``` ---- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces +--- +--- ```vim +--- set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` --- --- See also 'backup' and 'writebackup' options. --- If you want to hide your backup files on Unix, consider this value: ---- ``` ---- :set backupdir=./.backup,~/.backup,.,/tmp +--- +--- ```vim +--- set backupdir=./.backup,~/.backup,.,/tmp --- ``` --- You must create a ".backup" directory in each directory and in your --- home directory for this to work properly. @@ -381,8 +385,9 @@ vim.go.bdir = vim.go.backupdir --- If you like to keep a lot of backups, you could use a BufWritePre --- autocommand to change 'backupext' just before writing the file to --- include a timestamp. ---- ``` ---- :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' +--- +--- ```vim +--- au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' --- ``` --- Use 'backupdir' to put the backup in a different directory. --- @@ -409,7 +414,7 @@ vim.go.bex = vim.go.backupext --- $HOME you must expand it explicitly, e.g.: --- --- ```vim ---- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' +--- let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' --- ``` --- Note that the default also makes sure that "crontab -e" works (when a --- backup would be made by renaming the original file crontab won't see @@ -710,8 +715,9 @@ vim.go.cdh = vim.go.cdhome --- If the default value taken from $CDPATH is not what you want, include --- a modified version of the following command in your vimrc file to --- override it: ---- ``` ---- :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') +--- +--- ```vim +--- let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -727,9 +733,10 @@ vim.go.cd = vim.go.cdpath --- Only non-printable keys are allowed. --- The key can be specified as a single character, but it is difficult to --- type. The preferred way is to use the <> notation. Examples: ---- ``` ---- :exe "set cedit=\\" ---- :exe "set cedit=\\" +--- +--- ```vim +--- exe "set cedit=\\" +--- exe "set cedit=\\" --- ``` --- `Nvi` also has this option, but it only uses the first character. --- See `cmdwin`. @@ -763,7 +770,8 @@ vim.bo.channel = vim.o.channel --- is done internally by Vim, 'charconvert' is not used for this. --- Also used for Unicode conversion. --- Example: ---- ``` +--- +--- ```vim --- set charconvert=CharConvert() --- fun CharConvert() --- system("recode " @@ -829,7 +837,8 @@ vim.bo.cino = vim.bo.cinoptions --- Keywords that are interpreted as a C++ scope declaration by `cino-g`. --- Useful e.g. for working with the Qt framework that defines additional --- scope declarations "signals", "public slots" and "private slots": ---- ``` +--- +--- ```vim --- set cinscopedecls+=signals,public\ slots,private\ slots --- ``` --- @@ -916,10 +925,12 @@ vim.go.cwh = vim.go.cmdwinheight --- text. Will make screen redrawing slower. --- The screen column can be an absolute number, or a number preceded with --- '+' or '-', which is added to or subtracted from 'textwidth'. ---- ``` ---- :set cc=+1 " highlight column after 'textwidth' ---- :set cc=+1,+2,+3 " highlight three columns after 'textwidth' ---- :hi ColorColumn ctermbg=lightgrey guibg=lightgrey +--- +--- ```vim +--- +--- set cc=+1 " highlight column after 'textwidth' +--- set cc=+1,+2,+3 " highlight three columns after 'textwidth' +--- hi ColorColumn ctermbg=lightgrey guibg=lightgrey --- ``` --- --- When 'textwidth' is zero then the items with '-' and '+' are not used. @@ -941,8 +952,9 @@ vim.wo.cc = vim.wo.colorcolumn --- the GUI it is always possible and Vim limits the number of columns to --- what fits on the screen. You can use this command to get the widest --- window possible: ---- ``` ---- :set columns=9999 +--- +--- ```vim +--- set columns=9999 --- ``` --- Minimum value is 12, maximum value is 10000. --- @@ -985,8 +997,9 @@ vim.bo.cms = vim.bo.commentstring --- kspell use the currently active spell checking `spell` --- k{dict} scan the file {dict}. Several "k" flags can be given, --- patterns are valid too. For example: ---- ``` ---- :set cpt=k/usr/dict/*,k~/spanish +--- +--- ```vim +--- set cpt=k/usr/dict/*,k~/spanish --- ``` --- s scan the files given with the 'thesaurus' option --- s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns @@ -1419,7 +1432,8 @@ vim.wo.crb = vim.wo.cursorbind --- slower. --- If you only want the highlighting in the current window you can use --- these autocommands: ---- ``` +--- +--- ```vim --- au WinLeave * set nocursorline nocursorcolumn --- au WinEnter * set cursorline cursorcolumn --- ``` @@ -1502,7 +1516,8 @@ vim.go.debug = vim.o.debug --- ``` --- When using the ":set" command, you need to double the backslashes! --- To avoid that use `:let` with a single quote string: ---- ``` +--- +--- ```vim --- let &l:define = '^\s*\ze\k\+\s*=\s*function(' --- ``` --- @@ -1681,11 +1696,12 @@ vim.go.dex = vim.go.diffexpr --- histogram histogram diff algorithm --- --- Examples: ---- ``` ---- :set diffopt=internal,filler,context:4 ---- :set diffopt= ---- :set diffopt=internal,filler,foldcolumn:3 ---- :set diffopt-=internal " do NOT use the internal diff parser +--- +--- ```vim +--- set diffopt=internal,filler,context:4 +--- set diffopt= +--- set diffopt=internal,filler,foldcolumn:3 +--- set diffopt-=internal " do NOT use the internal diff parser --- ``` --- --- @@ -1736,8 +1752,9 @@ vim.go.dg = vim.go.digraph --- - Environment variables are expanded `:set_env`. --- - Careful with '\' characters, type one before a space, type two to --- get one in the option (see `option-backslash`), for example: ---- ``` ---- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces +--- +--- ```vim +--- set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` --- --- Editing the same file twice will result in a warning. Using "/tmp" on @@ -1924,8 +1941,9 @@ vim.go.efm = vim.go.errorformat --- When set to "all" or when "all" is one of the items, all autocommand --- events are ignored, autocommands will not be executed. --- Otherwise this is a comma-separated list of event names. Example: ---- ``` ---- :set ei=WinEnter,WinLeave +--- +--- ```vim +--- set ei=WinEnter,WinLeave --- ``` --- --- @@ -2021,7 +2039,8 @@ vim.bo.fenc = vim.bo.fileencoding --- "ucs-bom", which requires the BOM to be present). If you prefer --- another encoding use an BufReadPost autocommand event to test if your --- preferred encoding is to be used. Example: ---- ``` +--- +--- ```vim --- au BufReadPost * if search('\S', 'w') == 0 | --- \ set fenc=iso-2022-jp | endif --- ``` @@ -2031,8 +2050,9 @@ vim.bo.fenc = vim.bo.fileencoding --- not used. --- Note that 'fileencodings' is not used for a new file, the global value --- of 'fileencoding' is used instead. You can set it with: ---- ``` ---- :setglobal fenc=iso-8859-2 +--- +--- ```vim +--- setglobal fenc=iso-8859-2 --- ``` --- This means that a non-existing file may get a different encoding than --- an empty file. @@ -2156,14 +2176,12 @@ vim.go.fic = vim.go.fileignorecase --- this use the ":filetype on" command. `:filetype` --- Setting this option to a different value is most useful in a modeline, --- for a file for which the file type is not automatically recognized. ---- Example, for in an IDL file: ---- ``` +--- Example, for in an IDL file: >c --- /* vim: set filetype=idl : */ --- ``` --- `FileType` `filetypes` --- When a dot appears in the value then this separates two filetype ---- names. Example: ---- ``` +--- names. Example: >c --- /* vim: set filetype=c.doxygen : */ --- ``` --- This will use the "c" filetype first, then the "doxygen" filetype. @@ -2216,8 +2234,9 @@ vim.bo.ft = vim.bo.filetype --- default to single-byte alternatives. --- --- Example: ---- ``` ---- :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- +--- +--- ```vim +--- set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- --- ``` --- --- For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items @@ -2475,8 +2494,9 @@ vim.wo.fdt = vim.wo.foldtext --- it yet! --- --- Example: ---- ``` ---- :set formatexpr=mylang#Format() +--- +--- ```vim +--- set formatexpr=mylang#Format() --- ``` --- This will invoke the mylang#Format() function in the --- autoload/mylang.vim file in 'runtimepath'. `autoload` @@ -2492,7 +2512,8 @@ vim.wo.fdt = vim.wo.foldtext --- --- If the expression starts with s: or ``, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- set formatexpr=s:MyFormatExpr() --- set formatexpr=SomeFormatExpr() --- ``` @@ -2618,8 +2639,9 @@ vim.go.gfm = vim.go.grepformat --- `option-backslash` about including spaces and backslashes. --- When your "grep" accepts the "-H" argument, use this to make ":grep" --- also work well with a single file: ---- ``` ---- :set grepprg=grep\ -nH +--- +--- ```vim +--- set grepprg=grep\ -nH --- ``` --- Special value: When 'grepprg' is set to "internal" the `:grep` command --- works like `:vimgrep`, `:lgrep` like `:lvimgrep`, `:grepadd` like @@ -2641,12 +2663,14 @@ vim.go.gp = vim.go.grepprg --- terminals. See `tui-cursor-shape`. --- --- To disable cursor-styling, reset the option: ---- ``` ---- :set guicursor= +--- +--- ```vim +--- set guicursor= --- ``` --- To enable mode shapes, "Cursor" highlight, and blinking: ---- ``` ---- :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 +--- +--- ```vim +--- set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 --- \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor --- \,sm:block-blinkwait175-blinkoff150-blinkon175 --- ``` @@ -2680,8 +2704,9 @@ vim.go.gp = vim.go.grepprg --- the cursor is shown and blinkoff is the time that the --- cursor is not shown. Times are in msec. When one of --- the numbers is zero, there is no blinking. E.g.: ---- ``` ---- :set guicursor=n:blinkon0 +--- +--- ```vim +--- set guicursor=n:blinkon0 --- ``` --- - Default is "blinkon0" for each mode. --- {group-name} @@ -2721,9 +2746,10 @@ vim.go.gp = vim.go.grepprg --- blinking: "a:blinkon0" --- --- Examples of cursor highlighting: ---- ``` ---- :highlight Cursor gui=reverse guifg=NONE guibg=NONE ---- :highlight Cursor gui=NONE guifg=bg guibg=fg +--- +--- ```vim +--- highlight Cursor gui=reverse guifg=NONE guibg=NONE +--- highlight Cursor gui=NONE guifg=bg guibg=fg --- ``` --- --- @@ -2743,8 +2769,9 @@ vim.go.gcr = vim.go.guicursor --- precede it with a backslash. Setting an option requires an extra --- backslash before a space and a backslash. See also --- `option-backslash`. For example: ---- ``` ---- :set guifont=Screen15,\ 7x13,font\\,with\\,commas +--- +--- ```vim +--- set guifont=Screen15,\ 7x13,font\\,with\\,commas --- ``` --- will make Vim try to use the font "Screen15" first, and if it fails it --- will try to use "7x13" and then "font,with,commas" instead. @@ -2757,16 +2784,18 @@ vim.go.gcr = vim.go.guicursor --- will try to find the related bold and italic fonts. --- --- For Win32 and Mac OS: ---- ``` ---- :set guifont=* +--- +--- ```vim +--- set guifont=* --- ``` --- will bring up a font requester, where you can pick the font you want. --- --- The font name depends on the GUI used. --- --- For Mac OSX you can use something like this: ---- ``` ---- :set guifont=Monaco:h10 +--- +--- ```vim +--- set guifont=Monaco:h10 --- ``` --- *E236* --- Note that the fonts must be mono-spaced (all characters have the same @@ -2793,9 +2822,10 @@ vim.go.gcr = vim.go.guicursor --- - A '_' can be used in the place of a space, so you don't need to use --- backslashes to escape the spaces. --- - Examples: ---- ``` ---- :set guifont=courier_new:h12:w5:b:cRUSSIAN ---- :set guifont=Andale_Mono:h7.5:w4.5 +--- +--- ```vim +--- set guifont=courier_new:h12:w5:b:cRUSSIAN +--- set guifont=Andale_Mono:h7.5:w4.5 --- ``` --- --- @@ -2949,8 +2979,9 @@ vim.go.gtl = vim.go.guitablabel --- pages line. When empty Vim will use a default tooltip. --- This option is otherwise just like 'guitablabel' above. --- You can include a line break. Simplest method is to use `:let`: ---- ``` ---- :let &guitabtooltip = "line one\nline two" +--- +--- ```vim +--- let &guitabtooltip = "line one\nline two" --- ``` --- --- @@ -2994,8 +3025,9 @@ vim.go.hh = vim.go.helpheight --- another language, but that will only find tags that exist in that --- language and not in the English help. --- Example: ---- ``` ---- :set helplang=de,it +--- +--- ```vim +--- set helplang=de,it --- ``` --- This will first search German, then Italian and finally English help --- files. @@ -3131,8 +3163,9 @@ vim.go.imd = vim.go.imdisable --- 2 :lmap is off and IM is ON --- To always reset the option to zero when leaving Insert mode with --- this can be used: ---- ``` ---- :inoremap :set iminsert=0 +--- +--- ```vim +--- inoremap :set iminsert=0 --- ``` --- This makes :lmap and IM turn off automatically when leaving Insert --- mode. @@ -3206,15 +3239,17 @@ vim.go.inc = vim.go.include --- Expression to be used to transform the string found with the 'include' --- option to a file name. Mostly useful to change "." to "/" for Java: ---- ``` ---- :setlocal includeexpr=substitute(v:fname,'\\.','/','g') +--- +--- ```vim +--- setlocal includeexpr=substitute(v:fname,'\\.','/','g') --- ``` --- The "v:fname" variable will be set to the file name that was detected. --- Note the double backslash: the `:set` command first halves them, then --- one remains in the value, where "\." matches a dot literally. For --- simple character replacements `tr()` avoids the need for escaping: ---- ``` ---- :setlocal includeexpr=tr(v:fname,'.','/') +--- +--- ```vim +--- setlocal includeexpr=tr(v:fname,'.','/') --- ``` --- --- Also used for the `gf` command if an unmodified file name can't be @@ -3223,7 +3258,8 @@ vim.go.inc = vim.go.include --- --- If the expression starts with s: or ``, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- setlocal includeexpr=s:MyIncludeExpr(v:fname) --- setlocal includeexpr=SomeIncludeExpr(v:fname) --- ``` @@ -3262,7 +3298,8 @@ vim.bo.inex = vim.bo.includeexpr --- If you don't want to turn 'hlsearch' on, but want to highlight all --- matches while searching, you can turn on and off 'hlsearch' with --- autocmd. Example: ---- ``` +--- +--- ```vim --- augroup vimrc-incsearch-highlight --- autocmd! --- autocmd CmdlineEnter /,\? :set hlsearch @@ -3295,7 +3332,8 @@ vim.go.is = vim.go.incsearch --- --- If the expression starts with s: or ``, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- set indentexpr=s:MyIndentExpr() --- set indentexpr=SomeIndentExpr() --- ``` @@ -3311,8 +3349,9 @@ vim.go.is = vim.go.incsearch --- not change the text, jump to another window, etc. Afterwards the --- cursor position is always restored, thus the cursor may be moved. --- Normally this option would be set to call a function: ---- ``` ---- :set indentexpr=GetMyIndent() +--- +--- ```vim +--- set indentexpr=GetMyIndent() --- ``` --- Error messages will be suppressed, unless the 'debug' option contains --- "msg". @@ -3540,9 +3579,10 @@ vim.go.km = vim.go.keymodel --- a [count] for the "K" command to a section number. --- See `option-backslash` about including spaces and backslashes. --- Example: ---- ``` ---- :set keywordprg=man\ -s ---- :set keywordprg=:Man +--- +--- ```vim +--- set keywordprg=man\ -s +--- set keywordprg=:Man --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -3569,12 +3609,14 @@ vim.go.kp = vim.go.keywordprg --- security reasons. --- --- Example (for Greek, in UTF-8): *greek* ---- ``` ---- :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz +--- +--- ```vim +--- set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz --- ``` --- Example (exchanges meaning of z and y for commands): ---- ``` ---- :set langmap=zy,yz,ZY,YZ +--- +--- ```vim +--- set langmap=zy,yz,ZY,YZ --- ``` --- --- The 'langmap' option is a list of parts, separated with commas. Each @@ -3607,28 +3649,32 @@ vim.go.lmap = vim.go.langmap --- Language to use for menu translation. Tells which file is loaded --- from the "lang" directory in 'runtimepath': ---- ``` +--- +--- ```vim --- "lang/menu_" .. &langmenu .. ".vim" --- ``` --- (without the spaces). For example, to always use the Dutch menus, no --- matter what $LANG is set to: ---- ``` ---- :set langmenu=nl_NL.ISO_8859-1 +--- +--- ```vim +--- set langmenu=nl_NL.ISO_8859-1 --- ``` --- When 'langmenu' is empty, `v:lang` is used. --- Only normal file name characters can be used, `/\*?[|<>` are illegal. --- If your $LANG is set to a non-English language but you do want to use --- the English menus: ---- ``` ---- :set langmenu=none +--- +--- ```vim +--- set langmenu=none --- ``` --- This option must be set before loading menus, switching on filetype --- detection or syntax highlighting. Once the menus are defined setting --- this option has no effect. But you could do this: ---- ``` ---- :source $VIMRUNTIME/delmenu.vim ---- :set langmenu=de_DE.ISO_8859-1 ---- :source $VIMRUNTIME/menu.vim +--- +--- ```vim +--- source $VIMRUNTIME/delmenu.vim +--- set langmenu=de_DE.ISO_8859-1 +--- source $VIMRUNTIME/menu.vim --- ``` --- Warning: This deletes all menus that you defined yourself! --- @@ -3701,8 +3747,9 @@ vim.wo.lbr = vim.wo.linebreak --- to use the size for the GUI, put the command in your `gvimrc` file. --- Vim limits the number of lines to what fits on the screen. You can --- use this command to get the tallest window possible: ---- ``` ---- :set lines=999 +--- +--- ```vim +--- set lines=999 --- ``` --- Minimum value is 2, maximum value is 1000. --- @@ -3771,8 +3818,9 @@ vim.go.lw = vim.go.lispwords --- The cursor is displayed at the start of the space a Tab character --- occupies, not at the end as usual in Normal mode. To get this cursor --- position while displaying Tabs with spaces, use: ---- ``` ---- :set list lcs=tab:\ \ +--- +--- ```vim +--- set list lcs=tab:\ \ --- ``` --- --- Note that list mode will also affect formatting (set with 'textwidth' @@ -3837,8 +3885,9 @@ vim.wo.list = vim.o.list --- leading spaces are blank. Overrides the "space" and --- "multispace" settings for leading spaces. You can --- combine it with "tab:", for example: ---- ``` ---- :set listchars+=tab:>-,lead:. +--- +--- ```vim +--- set listchars+=tab:>-,lead:. --- ``` --- --- *lcs-leadmultispace* @@ -3878,7 +3927,8 @@ vim.wo.list = vim.o.list --- be used. All characters must be single width. --- --- Each character can be specified as hex: ---- ``` +--- +--- ```vim --- set listchars=eol:\\x24 --- set listchars=eol:\\u21b5 --- set listchars=eol:\\U000021b5 @@ -3887,10 +3937,11 @@ vim.wo.list = vim.o.list --- must be exactly 2 for \\x, 4 for \\u and 8 for \\U. --- --- Examples: ---- ``` ---- :set lcs=tab:>-,trail:- ---- :set lcs=tab:>-,eol:<,nbsp:% ---- :set lcs=extends:>,precedes:< +--- +--- ```vim +--- set lcs=tab:>-,trail:- +--- set lcs=tab:>-,eol:<,nbsp:% +--- set lcs=extends:>,precedes:< --- ``` --- `hl-NonText` highlighting will be used for "eol", "extends" and --- "precedes". `hl-Whitespace` for "nbsp", "space", "tab", "multispace", @@ -3955,8 +4006,9 @@ vim.go.mef = vim.go.makeef --- This would be mostly useful when you use MS-Windows. If iconv is --- enabled, setting 'makeencoding' to "char" has the same effect as --- setting to the system locale encoding. Example: ---- ``` ---- :set makeencoding=char " system locale is used +--- +--- ```vim +--- set makeencoding=char " system locale is used --- ``` --- --- @@ -3977,13 +4029,15 @@ vim.go.menc = vim.go.makeencoding --- Note that a '|' must be escaped twice: once for ":set" and once for --- the interpretation of a command. When you use a filter called --- "myfilter" do it like this: ---- ``` ---- :set makeprg=gmake\ \\\|\ myfilter +--- +--- ```vim +--- set makeprg=gmake\ \\\|\ myfilter --- ``` --- The placeholder "$*" can be given (even multiple times) to specify --- where the arguments will be included, for example: ---- ``` ---- :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} +--- +--- ```vim +--- set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -4003,13 +4057,15 @@ vim.go.mp = vim.go.makeprg --- The characters must be separated by a colon. --- The pairs must be separated by a comma. Example for including '<' and --- '>' (for HTML): ---- ``` ---- :set mps+=<:> +--- +--- ```vim +--- set mps+=<:> --- ``` --- A more exotic example, to jump between the '=' and ';' in an --- assignment, useful for languages like C and Java: ---- ``` ---- :au FileType c,cpp,java set mps+==:; +--- +--- ```vim +--- au FileType c,cpp,java set mps+==:; --- ``` --- For a more advanced way of using "%", see the matchit.vim plugin in --- the $VIMRUNTIME/plugin directory. `add-local-help` @@ -4117,8 +4173,9 @@ vim.go.mis = vim.go.menuitems --- The languages for which these numbers are important are Italian and --- Hungarian. The default works for when you have about 512 Mbyte. If --- you have 1 Gbyte you could use: ---- ``` ---- :set mkspellmem=900000,3000,800 +--- +--- ```vim +--- set mkspellmem=900000,3000,800 --- ``` --- If you have less than 512 Mbyte `:mkspell` may fail for some --- languages, no matter what you set 'mkspellmem' to. @@ -4213,8 +4270,9 @@ vim.go.more = vim.o.more --- Enables mouse support. For example, to enable the mouse in Normal mode --- and Visual mode: ---- ``` ---- :set mouse=nv +--- +--- ```vim +--- set mouse=nv --- ``` --- --- To temporarily disable mouse support, hold the shift key while using @@ -4306,19 +4364,20 @@ vim.go.mh = vim.go.mousehide --- See `mouse-overview`. But mappings are NOT used for modeless selection. --- --- Example: ---- ``` ---- :map ---- :map ---- :map ---- :map <2-S-LeftMouse> <2-RightMouse> ---- :map <2-S-LeftDrag> <2-RightDrag> ---- :map <2-S-LeftRelease> <2-RightRelease> ---- :map <3-S-LeftMouse> <3-RightMouse> ---- :map <3-S-LeftDrag> <3-RightDrag> ---- :map <3-S-LeftRelease> <3-RightRelease> ---- :map <4-S-LeftMouse> <4-RightMouse> ---- :map <4-S-LeftDrag> <4-RightDrag> ---- :map <4-S-LeftRelease> <4-RightRelease> +--- +--- ```vim +--- map +--- map +--- map +--- map <2-S-LeftMouse> <2-RightMouse> +--- map <2-S-LeftDrag> <2-RightDrag> +--- map <2-S-LeftRelease> <2-RightRelease> +--- map <3-S-LeftMouse> <3-RightMouse> +--- map <3-S-LeftDrag> <3-RightDrag> +--- map <3-S-LeftRelease> <3-RightRelease> +--- map <4-S-LeftMouse> <4-RightMouse> +--- map <4-S-LeftDrag> <4-RightDrag> +--- map <4-S-LeftRelease> <4-RightRelease> --- ``` --- --- Mouse commands requiring the CTRL modifier can be simulated by typing @@ -4358,8 +4417,9 @@ vim.go.mousemev = vim.go.mousemoveevent --- a count of 0. --- --- Example: ---- ``` ---- :set mousescroll=ver:5,hor:2 +--- +--- ```vim +--- set mousescroll=ver:5,hor:2 --- ``` --- Will make Nvim scroll 5 lines at a time when scrolling vertically, and --- scroll 2 columns at a time when scrolling horizontally. @@ -4422,8 +4482,9 @@ vim.go.mousescroll = vim.o.mousescroll --- pointer. --- --- Example: ---- ``` ---- :set mouseshape=s:udsizing,m:no +--- +--- ```vim +--- set mouseshape=s:udsizing,m:no --- ``` --- will make the mouse turn to a sizing arrow over the status lines and --- indicate no input when the hit-enter prompt is displayed (since @@ -4627,28 +4688,33 @@ vim.go.pm = vim.go.patchmode --- starting with "/", "./" or "../"). The directories in the 'path' --- option may be relative or absolute. --- - Use commas to separate directory names: ---- ``` ---- :set path=.,/usr/local/include,/usr/include +--- +--- ```vim +--- set path=.,/usr/local/include,/usr/include --- ``` --- - Spaces can also be used to separate directory names. To have a --- space in a directory name, precede it with an extra backslash, and --- escape the space: ---- ``` ---- :set path=.,/dir/with\\\ space +--- +--- ```vim +--- set path=.,/dir/with\\\ space --- ``` --- - To include a comma in a directory name precede it with an extra --- backslash: ---- ``` ---- :set path=.,/dir/with\\,comma +--- +--- ```vim +--- set path=.,/dir/with\\,comma --- ``` --- - To search relative to the directory of the current file, use: ---- ``` ---- :set path=. +--- +--- ```vim +--- set path=. --- ``` --- - To search in the current directory use an empty string between two --- commas: ---- ``` ---- :set path=,, +--- +--- ```vim +--- set path=,, --- ``` --- - A directory name may end in a ':' or '/'. --- - Environment variables are expanded `:set_env`. @@ -4657,12 +4723,14 @@ vim.go.pm = vim.go.patchmode --- - Search upwards and downwards in a directory tree using "*", "**" and --- ";". See `file-searching` for info and syntax. --- - Careful with '\' characters, type two to get one in the option: ---- ``` ---- :set path=.,c:\\include +--- +--- ```vim +--- set path=.,c:\\include --- ``` --- Or just use '/' instead: ---- ``` ---- :set path=.,c:/include +--- +--- ```vim +--- set path=.,c:/include --- ``` --- Don't forget "." or files won't even be found in the same directory as --- the file! @@ -4673,18 +4741,21 @@ vim.go.pm = vim.go.patchmode --- The use of `:set+=` and `:set-=` is preferred when adding or removing --- directories from the list. This avoids problems when a future version --- uses another default. To remove the current directory use: ---- ``` ---- :set path-= +--- +--- ```vim +--- set path-= --- ``` --- To add the current directory use: ---- ``` ---- :set path+= +--- +--- ```vim +--- set path+= --- ``` --- To use an environment variable, you probably need to replace the --- separator. Here is an example to append $INCL, in which directory --- names are separated with a semi-colon: ---- ``` ---- :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') +--- +--- ```vim +--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') --- ``` --- Replace the ';' with a ':' or whatever separator is used. Note that --- this doesn't work when $INCL contains a comma or white space. @@ -4742,9 +4813,11 @@ vim.wo.pvw = vim.wo.previewwindow --- It is possible to override the level for individual highlights within --- the popupmenu using `highlight-blend`. For instance, to enable --- transparency but force the current selected element to be fully opaque: ---- ``` ---- :set pumblend=15 ---- :hi PmenuSel blend=0 +--- +--- ```vim +--- +--- set pumblend=15 +--- hi PmenuSel blend=0 --- ``` --- --- UI-dependent. Works best with RGB colors. 'termguicolors' @@ -5015,8 +5088,9 @@ vim.go.ru = vim.go.ruler --- The default ruler width is 17 characters. To make the ruler 15 --- characters wide, put "%15(" at the start and "%)" at the end. --- Example: ---- ``` ---- :set rulerformat=%15(%c%V\ %p%%%) +--- +--- ```vim +--- set rulerformat=%15(%c%V\ %p%%%) --- ``` --- --- @@ -5083,8 +5157,9 @@ vim.go.ruf = vim.go.rulerformat --- wildcards. --- See `:runtime`. --- Example: ---- ``` ---- :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME +--- +--- ```vim +--- set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME --- ``` --- This will use the directory "~/vimruntime" first (containing your --- personal Nvim runtime files), then "/mygroup/vim", and finally @@ -5165,7 +5240,8 @@ vim.go.sj = vim.go.scrolljump --- when long lines wrap). --- After using the local value, go back the global value with one of --- these two: ---- ``` +--- +--- ```vim --- setlocal scrolloff< --- setlocal scrolloff=-1 --- ``` @@ -5394,8 +5470,9 @@ vim.go.ssop = vim.go.sessionoptions --- contents size) = 10253 bytes. --- --- Example: ---- ``` ---- :set shada='50,<1000,s100,:0,n~/nvim/shada +--- +--- ```vim +--- set shada='50,<1000,s100,:0,n~/nvim/shada --- ``` --- --- '50 Marks will be remembered for the last 50 files you @@ -5446,14 +5523,16 @@ vim.go.sdf = vim.go.shadafile --- --- If the name of the shell contains a space, you need to enclose it in --- quotes. Example with quotes: ---- ``` ---- :set shell=\"c:\program\ files\unix\sh.exe\"\ -f +--- +--- ```vim +--- set shell=\"c:\program\ files\unix\sh.exe\"\ -f --- ``` --- Note the backslash before each quote (to avoid starting a comment) and --- each space (to avoid ending the option value), so better use `:let-&` --- like this: ---- ``` ---- :let &shell='"C:\Program Files\unix\sh.exe" -f' +--- +--- ```vim +--- let &shell='"C:\Program Files\unix\sh.exe" -f' --- ``` --- Also note that the "-f" is not inside the quotes, because it is not --- part of the command name. @@ -5478,7 +5557,8 @@ vim.go.sdf = vim.go.shadafile --- unescaping, so to keep yourself sane use `:let-&` like shown above. --- *shell-powershell* --- To use PowerShell: ---- ``` +--- +--- ```vim --- let &shell = executable('pwsh') ? 'pwsh' : 'powershell' --- let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' --- let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' @@ -5603,7 +5683,8 @@ vim.go.srr = vim.go.shellredir --- any file for best results. This might change in the future. --- 'shellslash' only works when a backslash can be used as a path --- separator. To test if this is so use: ---- ``` +--- +--- ```vim --- if exists('+shellslash') --- ``` --- Also see 'completeslash'. @@ -5739,9 +5820,10 @@ vim.go.shm = vim.go.shortmess --- String to put at the start of lines that have been wrapped. Useful --- values are "> " or "+++ ": ---- ``` ---- :let &showbreak = "> " ---- :let &showbreak = '+++ ' +--- +--- ```vim +--- let &showbreak = "> " +--- let &showbreak = '+++ ' --- ``` --- Only printable single-cell characters are allowed, excluding and --- comma (in a future version the comma might be used to separate the @@ -5752,8 +5834,9 @@ vim.go.shm = vim.go.shortmess --- "n" flag to 'cpoptions'. --- A window-local value overrules a global value. If the global value is --- set and you want no value in the current window use NONE: ---- ``` ---- :setlocal showbreak=NONE +--- +--- ```vim +--- setlocal showbreak=NONE --- ``` --- --- @@ -5885,7 +5968,8 @@ vim.go.ss = vim.go.sidescroll --- close to the beginning of the line. --- After using the local value, go back the global value with one of --- these two: ---- ``` +--- +--- ```vim --- setlocal sidescrolloff< --- setlocal sidescrolloff=-1 --- ``` @@ -5893,9 +5977,11 @@ vim.go.ss = vim.go.sidescroll --- Example: Try this together with 'sidescroll' and 'listchars' as --- in the following example to never allow the cursor to move --- onto the "extends" character: ---- ``` ---- :set nowrap sidescroll=1 listchars=extends:>,precedes:< ---- :set sidescrolloff=1 +--- +--- ```vim +--- +--- set nowrap sidescroll=1 listchars=extends:>,precedes:< +--- set sidescrolloff=1 --- ``` --- --- @@ -6076,7 +6162,8 @@ vim.bo.spf = vim.bo.spellfile --- A comma-separated list of word list names. When the 'spell' option is --- on spellchecking will be done for these languages. Example: ---- ``` +--- +--- ```vim --- set spelllang=en_us,nl,medical --- ``` --- This means US English, Dutch and medical words are recognized. Words @@ -6194,8 +6281,9 @@ vim.bo.spo = vim.bo.spelloptions --- --- Only one of "best", "double" or "fast" may be used. The others may --- appear several times in any order. Example: ---- ``` ---- :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() +--- +--- ```vim +--- set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() --- ``` --- --- This option cannot be set from a `modeline` or in the `sandbox`, for @@ -6293,21 +6381,21 @@ vim.go.sol = vim.go.startofline --- --- ```vim --- " Relative number with bar separator and click handlers: ---- :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T +--- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T --- --- " Right aligned relative cursor line number: ---- :let &stc='%=%{v:relnum?v:relnum:v:lnum} ' +--- let &stc='%=%{v:relnum?v:relnum:v:lnum} ' --- --- " Line numbers in hexadecimal for non wrapped part of lines: ---- :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' +--- let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' --- --- " Human readable line numbers with thousands separator: ---- :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' +--- let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' --- . '%(\\d\\d\\d\\)\\+$",",","g")}' --- --- " Both relative and absolute line numbers with different --- " highlighting for odd and even relative numbers: ---- :let &stc='%#NonText#%{&nu?v:lnum:""}' . +--- let &stc='%#NonText#%{&nu?v:lnum:""}' . --- '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' . --- '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' --- ``` @@ -6331,8 +6419,9 @@ vim.wo.stc = vim.wo.statuscolumn --- --- When the option starts with "%!" then it is used as an expression, --- evaluated and the result is used as the option value. Example: ---- ``` ---- :set statusline=%!MyStatusLine() +--- +--- ```vim +--- set statusline=%!MyStatusLine() --- ``` --- The *g:statusline_winid* variable will be set to the `window-ID` of the --- window that the status line belongs to. @@ -6415,7 +6504,8 @@ vim.wo.stc = vim.wo.statuscolumn --- The expression can contain the "}" character, the end of --- expression is denoted by "%}". --- For example: ---- ``` +--- +--- ```vim --- func! Stl_filename() abort --- return "%t" --- endfunc @@ -6484,8 +6574,9 @@ vim.wo.stc = vim.wo.statuscolumn --- not set) and a minwid is not set for the group, the whole group will --- become empty. This will make a group like the following disappear --- completely from the statusline when none of the flags are set. ---- ``` ---- :set statusline=...%(\ [%M%R%H]%)... +--- +--- ```vim +--- set statusline=...%(\ [%M%R%H]%)... --- ``` --- Beware that an expression is evaluated each and every time the status --- line is displayed. @@ -6518,35 +6609,42 @@ vim.wo.stc = vim.wo.statuscolumn --- --- Examples: --- Emulate standard status line with 'ruler' set ---- ``` ---- :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +--- +--- ```vim +--- set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P --- ``` --- Similar, but add ASCII value of char under the cursor (like "ga") ---- ``` ---- :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P +--- +--- ```vim +--- set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P --- ``` --- Display byte count and byte value, modified flag in red. ---- ``` ---- :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' ---- :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red +--- +--- ```vim +--- set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' +--- hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red --- ``` --- Display a ,GZ flag if a compressed file is loaded ---- ``` ---- :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... +--- +--- ```vim +--- set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... --- ``` --- In the `:autocmd`'s: ---- ``` ---- :let b:gzflag = 1 +--- +--- ```vim +--- let b:gzflag = 1 --- ``` --- And: ---- ``` ---- :unlet b:gzflag +--- +--- ```vim +--- unlet b:gzflag --- ``` --- And define this function: ---- ``` ---- :function VarExists(var, val) ---- : if exists(a:var) | return a:val | else | return '' | endif ---- :endfunction +--- +--- ```vim +--- function VarExists(var, val) +--- if exists(a:var) | return a:val | else | return '' | endif +--- endfunction --- ``` --- --- @@ -6577,8 +6675,9 @@ vim.go.su = vim.go.suffixes --- Comma-separated list of suffixes, which are used when searching for a --- file for the "gf", "[I", etc. commands. Example: ---- ``` ---- :set suffixesadd=.java +--- +--- ```vim +--- set suffixesadd=.java --- ``` --- --- @@ -6663,26 +6762,26 @@ vim.bo.smc = vim.bo.synmaxcol --- Otherwise this option does not always reflect the current syntax (the --- b:current_syntax variable does). --- This option is most useful in a modeline, for a file which syntax is ---- not automatically recognized. Example, in an IDL file: ---- ``` +--- not automatically recognized. Example, in an IDL file: >c --- /* vim: set syntax=idl : */ --- ``` --- When a dot appears in the value then this separates two filetype ---- names. Example: ---- ``` +--- names. Example: >c --- /* vim: set syntax=c.doxygen : */ --- ``` --- This will use the "c" syntax first, then the "doxygen" syntax. --- Note that the second one must be prepared to be loaded as an addition, --- otherwise it will be skipped. More than one dot may appear. --- To switch off syntax highlighting for the current file, use: ---- ``` ---- :set syntax=OFF +--- +--- ```vim +--- set syntax=OFF --- ``` --- To switch syntax highlighting on according to the current value of the --- 'filetype' option: ---- ``` ---- :set syntax=ON +--- +--- ```vim +--- set syntax=ON --- ``` --- What actually happens when setting the 'syntax' option is that the --- Syntax autocommand event is triggered with the value as argument. @@ -7112,15 +7211,17 @@ vim.go.titleold = vim.o.titleold --- This option cannot be set in a modeline when 'modelineexpr' is off. --- --- Example: ---- ``` ---- :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") ---- :set title titlestring=%<%F%=%l/%L-%P titlelen=70 +--- +--- ```vim +--- auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") +--- set title titlestring=%<%F%=%l/%L-%P titlelen=70 --- ``` --- The value of 'titlelen' is used to align items in the middle or right --- of the available space. --- Some people prefer to have the file name first: ---- ``` ---- :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) +--- +--- ```vim +--- set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) --- ``` --- Note the use of "%{ }" and an expression to get the path of the file, --- without the file name. The "%( %)" constructs are used to add a @@ -7205,7 +7306,8 @@ vim.bo.udf = vim.bo.undofile --- Nevertheless, a single change can already use a large amount of memory. --- Set to 0 for Vi compatibility: One level of undo and "u" undoes --- itself: ---- ``` +--- +--- ```vim --- set ul=0 --- ``` --- But you can also get Vi compatibility by including the 'u' flag in @@ -7213,7 +7315,8 @@ vim.bo.udf = vim.bo.undofile --- Also see `undo-two-ways`. --- Set to -1 for no undo at all. You might want to do this only for the --- current buffer: ---- ``` +--- +--- ```vim --- setlocal ul=-1 --- ``` --- This helps when you run out of memory for a single change. @@ -7285,8 +7388,9 @@ vim.go.ut = vim.go.updatetime --- For example, when editing assembly language files where statements --- start in the 9th column and comments in the 41st, it may be useful --- to use the following: ---- ``` ---- :set varsofttabstop=8,32,8 +--- +--- ```vim +--- set varsofttabstop=8,32,8 --- ``` --- This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more --- for every column thereafter. @@ -7303,8 +7407,9 @@ vim.bo.vsts = vim.bo.varsofttabstop --- A list of the number of spaces that a in the file counts for, --- separated by commas. Each value corresponds to one tab, with the --- final value applying to all subsequent tabs. For example: ---- ``` ---- :set vartabstop=4,20,10,8 +--- +--- ```vim +--- set vartabstop=4,20,10,8 --- ``` --- This will make the first tab 4 spaces wide, the second 20 spaces, --- the third 10 spaces, and all following tabs 8 spaces. @@ -7459,8 +7564,9 @@ vim.go.warn = vim.o.warn --- [ Insert and Replace --- ] Insert and Replace --- For example: ---- ``` ---- :set ww=<,>,[,] +--- +--- ```vim +--- set ww=<,>,[,] --- ``` --- allows wrap only when cursor keys are used. --- When the movement keys are used in combination with a delete or change @@ -7489,8 +7595,9 @@ vim.go.ww = vim.go.whichwrap --- can be used, but hitting it twice in a row will still exit --- command-line as a failsafe measure. --- Although 'wc' is a number option, you can set it to a special key: ---- ``` ---- :set wc= +--- +--- ```vim +--- set wc= --- ``` --- --- @@ -7505,9 +7612,10 @@ vim.go.wc = vim.go.wildchar --- keys suitable for this option by looking at `ex-edit-index`. Normally --- you'll never actually type 'wildcharm', just use it in mappings that --- automatically invoke completion mode, e.g.: ---- ``` ---- :set wcm= ---- :cnoremap ss so $vim/sessions/*.vim +--- +--- ```vim +--- set wcm= +--- cnoremap ss so $vim/sessions/*.vim --- ``` --- Then after typing :ss you can use CTRL-P & CTRL-N. --- @@ -7524,8 +7632,9 @@ vim.go.wcm = vim.go.wildcharm --- The pattern is used like with `:autocmd`, see `autocmd-pattern`. --- Also see 'suffixes'. --- Example: ---- ``` ---- :set wildignore=*.o,*.obj +--- +--- ```vim +--- set wildignore=*.o,*.obj --- ``` --- The use of `:set+=` and `:set-=` is preferred when adding or removing --- a pattern from the list. This avoids problems when a future version @@ -7581,9 +7690,10 @@ vim.go.wic = vim.go.wildignorecase --- --- If you want and to move the cursor instead of selecting --- a different match, use this: ---- ``` ---- :cnoremap ---- :cnoremap +--- +--- ```vim +--- cnoremap +--- cnoremap --- ``` --- --- `hl-WildMenu` highlights the current match. @@ -7626,24 +7736,29 @@ vim.go.wmnu = vim.go.wildmenu --- current buffer). --- --- Examples: ---- ``` ---- :set wildmode=full +--- +--- ```vim +--- set wildmode=full --- ``` --- Complete first full match, next match, etc. (the default) ---- ``` ---- :set wildmode=longest,full +--- +--- ```vim +--- set wildmode=longest,full --- ``` --- Complete longest common string, then each full match ---- ``` ---- :set wildmode=list:full +--- +--- ```vim +--- set wildmode=list:full --- ``` --- List all matches and complete each full match ---- ``` ---- :set wildmode=list,full +--- +--- ```vim +--- set wildmode=list,full --- ``` --- List all matches without completing, then each full match ---- ``` ---- :set wildmode=longest,list +--- +--- ```vim +--- set wildmode=longest,list --- ``` --- Complete longest common string, then list alternatives. --- More info here: `cmdline-completion`. @@ -7781,7 +7896,8 @@ vim.wo.wfw = vim.wo.winfixwidth --- that ":all" will create only two windows. To avoid "vim -o 1 2 3 4" --- to create only two windows, set the option after startup is done, --- using the `VimEnter` event: ---- ``` +--- +--- ```vim --- au VimEnter * set winheight=999 --- ``` --- Minimum value is 1. @@ -7811,7 +7927,8 @@ vim.go.wh = vim.go.winheight --- message area cannot be overridden. --- --- Example: show a different color for non-current windows: ---- ``` +--- +--- ```vim --- set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC --- ``` --- @@ -7881,9 +7998,10 @@ vim.go.wiw = vim.go.winwidth --- The line will be broken in the middle of a word if necessary. See --- 'linebreak' to get the break at a word boundary. --- To make scrolling horizontally a bit more useful, try this: ---- ``` ---- :set sidescroll=5 ---- :set listchars+=precedes:<,extends:> +--- +--- ```vim +--- set sidescroll=5 +--- set listchars+=precedes:<,extends:> --- ``` --- See 'sidescroll', 'listchars' and `wrap-off`. --- This option can't be set from a `modeline` when the 'diff' option is -- cgit From db0ec84fb46b8235f8651d5aa25eb56a9b117eb5 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Fri, 22 Dec 2023 11:38:02 +0100 Subject: feat(lsp): add type annotations for lsp.util.locations_to_items (#26694) Problem: luals reported many warnings Solution: Add type annotations --- runtime/doc/lsp.txt | 4 ++-- runtime/lua/vim/lsp/util.lua | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 65890953e0..436cbd1cee 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1803,13 +1803,13 @@ locations_to_items({locations}, {offset_encoding}) |setloclist()|. Parameters: ~ - • {locations} (table) list of `Location`s or `LocationLink`s + • {locations} lsp.Location[]|lsp.LocationLink[] • {offset_encoding} (string) offset_encoding for locations utf-8|utf-16|utf-32 default to first client of buffer Return: ~ - (table) list of items + vim.lsp.util.LocationItem [] list of items lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()* Helper function to return nested values in language server settings diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index dc8fb25563..63c4c1e7fc 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1754,6 +1754,13 @@ local position_sort = sort_by_key(function(v) return { v.start.line, v.start.character } end) +---@class vim.lsp.util.LocationItem +---@field filename string +---@field lnum integer 1-indexed line number +---@field col integer 1-indexed column +---@field text string +---@field user_data lsp.Location|lsp.LocationLink + --- Returns the items with the byte position calculated correctly and in sorted --- order, for display in quickfix and location lists. --- @@ -1763,10 +1770,10 @@ end) --- The result can be passed to the {list} argument of |setqflist()| or --- |setloclist()|. --- ----@param locations table list of `Location`s or `LocationLink`s +---@param locations lsp.Location[]|lsp.LocationLink[] ---@param offset_encoding string offset_encoding for locations utf-8|utf-16|utf-32 --- default to first client of buffer ----@return table list of items +---@return vim.lsp.util.LocationItem[] list of items function M.locations_to_items(locations, offset_encoding) if offset_encoding == nil then vim.notify_once( @@ -1777,6 +1784,7 @@ function M.locations_to_items(locations, offset_encoding) end local items = {} + ---@type table local grouped = setmetatable({}, { __index = function(t, k) local v = {} @@ -1791,6 +1799,7 @@ function M.locations_to_items(locations, offset_encoding) table.insert(grouped[uri], { start = range.start, location = d }) end + ---@type string[] local keys = vim.tbl_keys(grouped) table.sort(keys) -- TODO(ashkan) I wish we could do this lazily. @@ -1799,16 +1808,13 @@ function M.locations_to_items(locations, offset_encoding) table.sort(rows, position_sort) local filename = vim.uri_to_fname(uri) - -- list of row numbers - local uri_rows = {} + local line_numbers = {} for _, temp in ipairs(rows) do - local pos = temp.start - local row = pos.line - table.insert(uri_rows, row) + table.insert(line_numbers, temp.start.line) end -- get all the lines for this uri - local lines = get_lines(vim.uri_to_bufnr(uri), uri_rows) + local lines = get_lines(vim.uri_to_bufnr(uri), line_numbers) for _, temp in ipairs(rows) do local pos = temp.start -- cgit From 92204b06e7365cf4c68e6ea8258dce801f0a5df9 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli <506791+stevearc@users.noreply.github.com> Date: Fri, 22 Dec 2023 02:40:01 -0800 Subject: refactor(lsp): move glob parsing to util (#26519) refactor(lsp): move glob parsing to vim.glob Moving the logic for using vim.lpeg to create a match pattern from a glob into `vim.glob`. There are several places in the LSP spec that use globs, and it's very useful to have glob matching as a generally-available utility. --- runtime/lua/vim/_init_packages.lua | 1 + runtime/lua/vim/_meta.lua | 1 + runtime/lua/vim/glob.lua | 81 ++++++++++++++++++++++++++++++++ runtime/lua/vim/lsp/_dynamic.lua | 4 +- runtime/lua/vim/lsp/_watchfiles.lua | 93 +++---------------------------------- 5 files changed, 91 insertions(+), 89 deletions(-) create mode 100644 runtime/lua/vim/glob.lua (limited to 'runtime') diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua index 4a961970cc..f8710f7fd7 100644 --- a/runtime/lua/vim/_init_packages.lua +++ b/runtime/lua/vim/_init_packages.lua @@ -55,6 +55,7 @@ vim._submodules = { inspect = true, version = true, fs = true, + glob = true, iter = true, re = true, text = true, diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index bb9ed722e2..4c50627fe4 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -11,6 +11,7 @@ vim.diagnostic = require('vim.diagnostic') vim.filetype = require('vim.filetype') vim.fs = require('vim.fs') vim.func = require('vim.func') +vim.glob = require('vim.glob') vim.health = require('vim.health') vim.highlight = require('vim.highlight') vim.iter = require('vim.iter') diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua new file mode 100644 index 0000000000..731179d727 --- /dev/null +++ b/runtime/lua/vim/glob.lua @@ -0,0 +1,81 @@ +local lpeg = vim.lpeg + +local M = {} + +--- Parses a raw glob into an |lpeg| pattern. +--- +--- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern +--- Glob patterns can have the following syntax: +--- `*` to match one or more characters in a path segment +--- `?` to match on one character in a path segment +--- `**` to match any number of path segments, including none +--- `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +--- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +--- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +---@param pattern string The raw glob pattern +---@return vim.lpeg.Pattern pattern An |lpeg| representation of the pattern +function M.to_lpeg(pattern) + local l = lpeg + + local P, S, V = lpeg.P, lpeg.S, lpeg.V + local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf + + local pathsep = '/' + + local function class(inv, ranges) + for i, r in ipairs(ranges) do + ranges[i] = r[1] .. r[2] + end + local patt = l.R(unpack(ranges)) + if inv == '!' then + patt = P(1) - patt + end + return patt + end + + local function add(acc, a) + return acc + a + end + + local function mul(acc, m) + return acc * m + end + + local function star(stars, after) + return (-after * (l.P(1) - pathsep)) ^ #stars * after + end + + local function dstar(after) + return (-after * l.P(1)) ^ 0 * after + end + + local p = P({ + 'Pattern', + Pattern = V('Elem') ^ -1 * V('End'), + Elem = Cf( + (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal')) + * (V('Elem') + V('End')), + mul + ), + DStar = P('**') * (P(pathsep) * (V('Elem') + V('End')) + V('End')) / dstar, + Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star, + Ques = P('?') * Cc(l.P(1) - pathsep), + Class = P('[') * C(P('!') ^ -1) * Ct(Ct(C(1) * '-' * C(P(1) - ']')) ^ 1 * ']') / class, + CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * '}', + -- 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(l.P(0)), + Literal = P(1) / l.P, + End = P(-1) * Cc(l.P(-1)), + }) + + local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]] + return assert(lpeg_pattern, 'Invalid glob') +end + +return M diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua index 04040e8e28..4bee58559f 100644 --- a/runtime/lua/vim/lsp/_dynamic.lua +++ b/runtime/lua/vim/lsp/_dynamic.lua @@ -1,4 +1,4 @@ -local wf = require('vim.lsp._watchfiles') +local glob = require('vim.glob') --- @class lsp.DynamicCapabilities --- @field capabilities table @@ -97,7 +97,7 @@ function M.match(bufnr, documentSelector) if matches and filter.scheme and not vim.startswith(uri, filter.scheme .. ':') then matches = false end - if matches and filter.pattern and not wf._match(filter.pattern, fname) then + if matches and filter.pattern and not glob.to_lpeg(filter.pattern):match(fname) then matches = false end if matches then diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index 1fd112631d..af4cc65f71 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -1,4 +1,5 @@ local bit = require('bit') +local glob = require('vim.glob') local watch = require('vim._watch') local protocol = require('vim.lsp.protocol') local ms = protocol.Methods @@ -6,88 +7,6 @@ local lpeg = vim.lpeg local M = {} ---- Parses the raw pattern into an |lpeg| pattern. LPeg patterns natively support the "this" or "that" ---- alternative constructions described in the LSP spec that cannot be expressed in a standard Lua pattern. ---- ----@param pattern string The raw glob pattern ----@return vim.lpeg.Pattern? pattern An |lpeg| representation of the pattern, or nil if the pattern is invalid. -local function parse(pattern) - local l = lpeg - - local P, S, V = lpeg.P, lpeg.S, lpeg.V - local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf - - local pathsep = '/' - - local function class(inv, ranges) - for i, r in ipairs(ranges) do - ranges[i] = r[1] .. r[2] - end - local patt = l.R(unpack(ranges)) - if inv == '!' then - patt = P(1) - patt - end - return patt - end - - local function add(acc, a) - return acc + a - end - - local function mul(acc, m) - return acc * m - end - - local function star(stars, after) - return (-after * (l.P(1) - pathsep)) ^ #stars * after - end - - local function dstar(after) - return (-after * l.P(1)) ^ 0 * after - end - - local p = P({ - 'Pattern', - Pattern = V('Elem') ^ -1 * V('End'), - Elem = Cf( - (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal')) - * (V('Elem') + V('End')), - mul - ), - DStar = P('**') * (P(pathsep) * (V('Elem') + V('End')) + V('End')) / dstar, - Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star, - Ques = P('?') * Cc(l.P(1) - pathsep), - Class = P('[') * C(P('!') ^ -1) * Ct(Ct(C(1) * '-' * C(P(1) - ']')) ^ 1 * ']') / class, - CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * '}', - -- 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(l.P(0)), - Literal = P(1) / l.P, - End = P(-1) * Cc(l.P(-1)), - }) - - return p:match(pattern) --[[@as vim.lpeg.Pattern?]] -end - ----@private ---- Implementation of LSP 3.17.0's pattern matching: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern ---- ----@param pattern string|vim.lpeg.Pattern The glob pattern (raw or parsed) to match. ----@param s string The string to match against pattern. ----@return boolean Whether or not pattern matches s. -function M._match(pattern, s) - if type(pattern) == 'string' then - local p = assert(parse(pattern)) - return p:match(s) ~= nil - end - return pattern:match(s) ~= nil -end - M._watchfunc = (vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1) and watch.watch or watch.poll ---@type table> client id -> registration id -> cancel function @@ -112,9 +31,9 @@ local to_lsp_change_type = { --- Default excludes the same as VSCode's `files.watcherExclude` setting. --- https://github.com/microsoft/vscode/blob/eef30e7165e19b33daa1e15e92fa34ff4a5df0d3/src/vs/workbench/contrib/files/browser/files.contribution.ts#L261 ---@type vim.lpeg.Pattern parsed Lpeg pattern -M._poll_exclude_pattern = parse('**/.git/{objects,subtree-cache}/**') - + parse('**/node_modules/*/**') - + parse('**/.hg/store/**') +M._poll_exclude_pattern = glob.to_lpeg('**/.git/{objects,subtree-cache}/**') + + glob.to_lpeg('**/node_modules/*/**') + + glob.to_lpeg('**/.hg/store/**') --- Registers the workspace/didChangeWatchedFiles capability dynamically. --- @@ -143,7 +62,7 @@ function M.register(reg, ctx) local glob_pattern = w.globPattern if type(glob_pattern) == 'string' then - local pattern = parse(glob_pattern) + local pattern = glob.to_lpeg(glob_pattern) if not pattern then error('Cannot parse pattern: ' .. glob_pattern) end @@ -155,7 +74,7 @@ function M.register(reg, ctx) local base_uri = glob_pattern.baseUri local uri = type(base_uri) == 'string' and base_uri or base_uri.uri local base_dir = vim.uri_to_fname(uri) - local pattern = parse(glob_pattern.pattern) + local pattern = glob.to_lpeg(glob_pattern.pattern) if not pattern then error('Cannot parse pattern: ' .. glob_pattern.pattern) end -- cgit From 031088fc0afffe4af6fa90d68d5b93ca09992ef1 Mon Sep 17 00:00:00 2001 From: Michal Liszcz Date: Fri, 22 Dec 2023 15:03:13 +0100 Subject: fix(lsp): filetype matching to documentSelector in dynamic capabilities (#25425) Use the get_language_id client option to resolve the filetype when matching the document selector in a dynamic capability. Co-authored-by: Mathias Fussenegger --- runtime/lua/vim/lsp.lua | 2 +- runtime/lua/vim/lsp/_dynamic.lua | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 6476335213..ca7222a8f3 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1073,7 +1073,7 @@ function lsp.start_client(config) end --- @param method string - --- @param opts? {bufnr?: number} + --- @param opts? {bufnr: integer?} client.supports_method = function(method, opts) opts = opts or {} local required_capability = lsp._request_name_to_capability[method] diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua index 4bee58559f..5edb27b498 100644 --- a/runtime/lua/vim/lsp/_dynamic.lua +++ b/runtime/lua/vim/lsp/_dynamic.lua @@ -55,7 +55,7 @@ function M:unregister(unregisterations) end --- @param method string ---- @param opts? {bufnr?: number} +--- @param opts? {bufnr: integer?} --- @return lsp.Registration? (table|nil) the registration if found --- @private function M:get(method, opts) @@ -69,14 +69,14 @@ function M:get(method, opts) if not documentSelector then return reg end - if M.match(opts.bufnr, documentSelector) then + if self:match(opts.bufnr, documentSelector) then return reg end end end --- @param method string ---- @param opts? {bufnr?: number} +--- @param opts? {bufnr: integer?} --- @private function M:supports(method, opts) return self:get(method, opts) ~= nil @@ -85,13 +85,17 @@ end --- @param bufnr number --- @param documentSelector lsp.DocumentSelector --- @private -function M.match(bufnr, documentSelector) - local ft = vim.bo[bufnr].filetype +function M:match(bufnr, documentSelector) + local client = vim.lsp.get_client_by_id(self.client_id) + if not client then + return false + end + local language = client.config.get_language_id(bufnr, vim.bo[bufnr].filetype) local uri = vim.uri_from_bufnr(bufnr) local fname = vim.uri_to_fname(uri) for _, filter in ipairs(documentSelector) do local matches = true - if filter.language and ft ~= filter.language then + if filter.language and language ~= filter.language then matches = false end if matches and filter.scheme and not vim.startswith(uri, filter.scheme .. ':') then -- cgit From 373eb7b799190eb3982258cbc7f850e32db1e8a2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 23 Dec 2023 11:37:59 +0100 Subject: vim-patch:ec97edcbb9f6 runtime(debcontrol): Add loong64 arch (vim/vim#13754) https://github.com/vim/vim/commit/ec97edcbb9f6c0b751b03b981fd8191dbef0a5bb Co-authored-by: James McCoy Co-authored-by: zhangjialing@loongson.cn --- runtime/syntax/debcontrol.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim index af78ebc3ae..b173a7b3f7 100644 --- a/runtime/syntax/debcontrol.vim +++ b/runtime/syntax/debcontrol.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2023 Jan 16 +" Last Change: 2023 Dec 22 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debcontrol.vim " Standard syntax initialization @@ -29,7 +29,7 @@ syn match debControlSpace "[ \t]" let s:kernels = ['linux', 'hurd', 'kfreebsd', 'knetbsd', 'kopensolaris', 'netbsd'] let s:archs = [ \ 'alpha', 'amd64', 'armeb', 'armel', 'armhf', 'arm64', 'avr32', 'hppa' - \, 'i386', 'ia64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips' + \, 'i386', 'ia64', 'loong64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips' \, 'powerpcspe', 'powerpc', 'ppc64el', 'ppc64', 'riscv64', 's390x', 's390', 'sh3eb' \, 'sh3', 'sh4eb', 'sh4', 'sh', 'sparc64', 'sparc', 'x32' \ ] -- cgit From 7121241e5cecbd741795aec37a3cb1203c8e9f34 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 23 Dec 2023 11:38:18 +0100 Subject: vim-patch:ea9964a36f94 Runtime(fortran): updates to indent, syntax and ftplugin (vim/vim#13752) * runtime update fortran.vim Add folding for newer features of Fortran * Runtime Update fortran.vim Add indent support for newer features of Fortran * Runtime Update fortran.vim Add newer features of Fortran to matchit patterns https://github.com/vim/vim/commit/ea9964a36f948c1266d43dd8b3890c6f3bdd243d Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/ftplugin/fortran.vim | 11 ++++++++--- runtime/indent/fortran.vim | 21 +++++++++++---------- runtime/syntax/fortran.vim | 30 +++++++++++++++++++----------- 3 files changed, 38 insertions(+), 24 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim index a057db9a4b..d714a4ac4f 100644 --- a/runtime/ftplugin/fortran.vim +++ b/runtime/ftplugin/fortran.vim @@ -1,6 +1,6 @@ " Vim settings file -" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66) -" Version: (v54) 2023 December 5 +" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, 77, 66) +" Version: (v55) 2023 December 22 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-plugin from Vim @@ -110,7 +110,9 @@ if !exists("b:match_words") let b:match_ignorecase = 1 let b:match_words = \ '(:),' . - \ '\:' . s:notselect. '\:\,' . + \ s:notend .'\:' . s:notselect. '\:\,' . + \ s:notend .'\:' . s:notselect. '\:\,' . + \ s:notend .'\:' . s:notselect. '\:\,' . \ s:notelse . '\:' . \ s:nothash . '\:' . s:nothash . '\,'. \ 'do\s\+\(\d\+\):\%(^\s*\)\@<=\1\s,'. @@ -119,6 +121,9 @@ if !exists("b:match_words") \ s:notend . '\,'. \ s:notend . '\:\,'. \ s:notend . '\:\,'. + \ s:notend . '\:\,'. + \ s:notend . '\:\,'. + \ s:notend . '\:\,'. \ s:notend . '\:\,'. \ s:notend . '\:\,'. \ s:notend . '\:\,'. diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index 7130658f59..392b2d29d5 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,6 +1,6 @@ " Vim indent file -" Language: Fortran 2008 (and Fortran 2003, 95, 90, and 77) -" Version: (v49) 2023 December 1 +" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, 77, 66) +" Version: (v50) 2023 December 22 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-indent from Vim @@ -22,8 +22,8 @@ let b:undo_indent = "setl inde< indk<" setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect,=~elseif -setlocal indentkeys+==~type,=~interface,=~forall,=~associate,=~block,=~enum -setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum +setlocal indentkeys+==~interface,=~forall,=~associate,=~block,=~enum,=~critical +setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum,=~endcritical if exists("b:fortran_indent_more") || exists("g:fortran_indent_more") setlocal indentkeys+==~function,=~subroutine,=~module,=~contains,=~program setlocal indentkeys+==~endfunction,=~endsubroutine,=~endmodule @@ -49,7 +49,7 @@ if !exists("b:fortran_fixed_source") " Fixed-form file extension defaults let b:fortran_fixed_source = 1 else - " Modern fortran still allows both fixed and free source form + " Modern fortran compilers still allow both fixed and free source form " Assume fixed source form unless signs of free source form " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines @@ -109,8 +109,9 @@ function FortranGetIndent(lnum) "Add a shiftwidth to statements following if, else, else if, case, class, "where, else where, forall, type, interface and associate statements - if prevstat =~? '^\s*\(case\|class\|else\|else\s*if\|else\s*where\)\>' - \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>' + if prevstat =~? '^\s*\(case\|class\s\+is\|else\|else\s*if\|else\s*where\)\>' + \ ||prevstat=~? '^\s*\(type\|rank\|interface\|associate\|enum\|critical\)\>' + \ ||prevstat=~? '^\s*change\s\+team\>' \ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>' \ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' let ind = ind + shiftwidth() @@ -145,10 +146,10 @@ function FortranGetIndent(lnum) "Subtract a shiftwidth from else, else if, elsewhere, case, class, end if, " end where, end select, end forall, end interface, end associate, - " end enum, end type, end block and end type statements + " end enum, end type, end block, end team and end type statements if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*' - \. '\(else\|else\s*if\|else\s*where\|case\|class\|' - \. 'end\s*\(if\|where\|select\|interface\|' + \. '\(else\|else\s*if\|else\s*where\|case\|class\|rank\|type\s\+is\|' + \. 'end\s*\(if\|where\|select\|interface\|critical\|team\|' \. 'type\|forall\|associate\|enum\|block\)\)\>' let ind = ind - shiftwidth() " Fix indent for case statement immediately after select diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 7ed4f8a268..b7fae54d99 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, and 77) -" Version: (v107) 2023 December 17 +" Version: (v108) 2023 December 22 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-syntax from Vim @@ -75,6 +75,8 @@ syn match fortranConstructName "\(\" +syn match fortranConstructName "\(\" +syn match fortranConstructName "\(\" syn match fortranUnitName "\(\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\s\+\)\@12<=\a\w\+" syn match fortranUnitHeader "\\ze\s*(' +syn keyword fortranIntrinsic spread system_clock transpose trim ubound unpack verify syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image syn keyword fortranIntrinsic null cpu_time failed_images stopped_images image_status co_broadcast co_max co_min co_sum co_reduce @@ -99,7 +104,6 @@ syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_sizeof c_associat syn keyword fortranIntrinsic out_of_range reduce random_init coshape syn keyword fortranIntrinsic acosd asind atand atan2d cosd sind tand acospi asinpi atanpi atan2pi cospi sinpi tanpi syn keyword fortranIntrinsic compiler_options compiler_version get_team team_number -"syn match fortranIntrinsic '\<\(count\|dot_product\|epsilon\|exponent\|fraction\|matmul\|maxval\|minval\|modulo\|nearest\|pack\|precision\|product\|radix\|random_number\|random_seed\|range\|repeat\|reshape\|rrspacing\|scale\|scan\|set_exponent\|shape\|size\|sum\|tiny\|transpose\)\>\ze\s*(' syn match fortranIntrinsic "\ Date: Sat, 23 Dec 2023 19:45:19 +0900 Subject: fix(treesitter): outdated highlight due to tree with outdated region Problem: A region managed by an injected parser may shrink after re-running the injection query. If the updated region goes out of the range to be parsed, then the corresponding tree will remain outdated, possibly retaining the nodes that shouldn't exist anymore. This results in outdated highlights. Solution: Re-parse an invalid tree if its region intersects the range to be parsed. --- runtime/lua/vim/treesitter/languagetree.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index 0171b416cd..a249a10f47 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -348,7 +348,13 @@ function LanguageTree:_parse_regions(range) -- If there are no ranges, set to an empty list -- so the included ranges in the parser are cleared. for i, ranges in pairs(self:included_regions()) do - if not self._valid[i] and intercepts_region(ranges, range) then + if + not self._valid[i] + and ( + intercepts_region(ranges, range) + or (self._trees[i] and intercepts_region(self._trees[i]:included_ranges(false), range)) + ) + then self._parser:set_included_ranges(ranges) local parse_time, tree, tree_changes = tcall(self._parser.parse, self._parser, self._trees[i], self._source, true) -- cgit From 675522af18f59918a64e6dbe5f0ba3b1d3b4eb65 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 24 Dec 2023 13:26:28 +0100 Subject: build: remove clint checks and style text covered by uncrustify --- runtime/doc/dev_style.txt | 66 ----------------------------------------------- 1 file changed, 66 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index 9e00210f8c..c8b7729318 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -817,47 +817,6 @@ example, `"\uFEFF"`, is the Unicode zero-width no-break space character, which would be invisible if included in the source as straight UTF-8. -Function Calls ~ - -On one line if it fits; otherwise, wrap arguments at the parenthesis. - -Function calls have the following format: >c - - bool retval = do_something(argument1, argument2, argument3); - -If the arguments do not all fit on one line, they should be broken up onto -multiple lines, with each subsequent line aligned with the first argument. Do -not add spaces after the open paren or before the close paren: >c - - bool retval = do_something(averyveryveryverylongargument1, - argument2, argument3); - -If the function has many arguments, consider having one per line if this makes -the code more readable: >c - - bool retval = do_something(argument1, - argument2, - argument3, - argument4); - -Arguments may optionally all be placed on subsequent lines, with one line per -argument: >c - - if (...) { - ... - ... - if (...) { - do_something( - argument1, // 4 space indent - argument2, - argument3, - argument4); - } - -In particular, this should be done if the function signature is so long that -it cannot fit within the maximum line length. - - Braced Initializer Lists ~ Format a braced list exactly like you would format a function call in its @@ -959,11 +918,6 @@ Horizontal Whitespace ~ Use of horizontal whitespace depends on location. - General ~ ->c - int x[] = { 0 }; // Spaces inside braces for braced-init-list. -< - Variables ~ >c int long_variable = 0; // Don't align assignments. @@ -980,26 +934,6 @@ Use of horizontal whitespace depends on location. }; < - - Operators ~ ->c - x = 0; // Assignment operators always have spaces around - // them. - x = -5; // No spaces separating unary operators and their - x++; // arguments. - if (x && !y) -< - -Vertical Whitespace ~ - -Minimize use of vertical whitespace. - -The basic principle is: The more code that fits on one screen, the easier it -is to follow and understand the control flow of the program. Of course, -readability can suffer from code being too dense as well as too spread out, so -use your judgment. But in general, minimize use of vertical whitespace. - - ============================================================================== Parting Words -- cgit From 2ff2785c396e66c285fecf5b151d8f8863f9d4e6 Mon Sep 17 00:00:00 2001 From: Pablo Arias Date: Mon, 25 Dec 2023 01:30:56 +0100 Subject: feat(health): checkhealth buffer can show in a split window (#26714) :checkhealth now respects :vertical and :horizontal. For example: :vertical checkhealth foo bar will open the healthcheck buffer in a vertical split. --- runtime/doc/news.txt | 2 ++ runtime/lua/vim/health.lua | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 75ef2c245b..9b40c4a596 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -366,6 +366,8 @@ The following changes to existing APIs or features add new behavior. • Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error. +• |:checkhealth| buffer can now be opened in a split window using |:vertical| or |:horizontal|. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 6e47a22d03..4659ab1694 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -268,14 +268,27 @@ end -- Runs the specified healthchecks. -- Runs all discovered healthchecks if plugin_names is empty. -function M._check(plugin_names) +-- splitmod controls how the healthcheck window opens: "vertical", "horizontal" or "tab" +function M._check(splitmod, plugin_names) local healthchecks = plugin_names == '' and get_healthcheck('*') or get_healthcheck(plugin_names) - -- Create buffer and open in a tab, unless this is the default buffer when Nvim starts. local emptybuf = vim.fn.bufnr('$') == 1 and vim.fn.getline(1) == '' and 1 == vim.fn.line('$') - local mod = emptybuf and 'buffer' or 'tab sbuffer' + local mod = function() + if splitmod == 'vertical' then + return 'vertical sbuffer' + elseif splitmod == 'horizontal' then + return 'horizontal sbuffer' + elseif emptybuf then + -- if this is the default buffer when Nvim starts, open healthcheck directly + return 'buffer' + else + -- if not specified otherwise open healthcheck in a tab + return 'tab sbuffer' + end + end + local bufnr = vim.api.nvim_create_buf(true, true) - vim.cmd(mod .. ' ' .. bufnr) + vim.cmd(mod() .. ' ' .. bufnr) if vim.fn.bufexists('health://') == 1 then vim.cmd.bwipe('health://') -- cgit From 2877672d70e76f71ae1190090b8aea7044d458be Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Dec 2023 10:21:13 +0800 Subject: feat(health): make :checkhealth support more split modifiers (#26731) --- runtime/doc/news.txt | 3 ++- runtime/doc/windows.txt | 7 ++++--- runtime/lua/vim/health.lua | 29 +++++++++++------------------ 3 files changed, 17 insertions(+), 22 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 9b40c4a596..454c9becc5 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -366,7 +366,8 @@ The following changes to existing APIs or features add new behavior. • Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error. -• |:checkhealth| buffer can now be opened in a split window using |:vertical| or |:horizontal|. +• |:checkhealth| buffer can now be opened in a split window using modifiers like + |:vertical|, |:horizontal| and |:botright|. ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index d6fce89f23..b71e7c80ab 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -242,9 +242,10 @@ and 'winminwidth' are relevant. *:hor* *:horizontal* :hor[izontal] {cmd} Execute {cmd}. Currently only makes a difference for - `horizontal wincmd =`, which will equalize windows only - horizontally, and |:terminal|, which will open a |terminal| - buffer in a split window. + the following commands: + - `:wincmd =`: equalize windows only horizontally. + - |:terminal|: open a |terminal| buffer in a split window. + - |:checkhealth|: open a healthcheck buffer in a split window. :lefta[bove] {cmd} *:lefta* *:leftabove* :abo[veleft] {cmd} *:abo* *:aboveleft* diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 4659ab1694..6c96a703bb 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -266,29 +266,22 @@ M._complete = function() return vim.tbl_keys(unique) end --- Runs the specified healthchecks. --- Runs all discovered healthchecks if plugin_names is empty. --- splitmod controls how the healthcheck window opens: "vertical", "horizontal" or "tab" -function M._check(splitmod, plugin_names) +--- Runs the specified healthchecks. +--- Runs all discovered healthchecks if plugin_names is empty. +--- +--- @param mods string command modifiers that affect splitting a window. +function M._check(mods, plugin_names) local healthchecks = plugin_names == '' and get_healthcheck('*') or get_healthcheck(plugin_names) local emptybuf = vim.fn.bufnr('$') == 1 and vim.fn.getline(1) == '' and 1 == vim.fn.line('$') - local mod = function() - if splitmod == 'vertical' then - return 'vertical sbuffer' - elseif splitmod == 'horizontal' then - return 'horizontal sbuffer' - elseif emptybuf then - -- if this is the default buffer when Nvim starts, open healthcheck directly - return 'buffer' - else - -- if not specified otherwise open healthcheck in a tab - return 'tab sbuffer' - end - end + + -- When no command modifiers are used: + -- - If the current buffer is empty, open healthcheck directly. + -- - If not specified otherwise open healthcheck in a tab. + local buf_cmd = #mods > 0 and (mods .. ' sbuffer') or emptybuf and 'buffer' or 'tab sbuffer' local bufnr = vim.api.nvim_create_buf(true, true) - vim.cmd(mod() .. ' ' .. bufnr) + vim.cmd(buf_cmd .. ' ' .. bufnr) if vim.fn.bufexists('health://') == 1 then vim.cmd.bwipe('health://') -- cgit From e8acbc1ade5082563a9464ed3d1225414723390d Mon Sep 17 00:00:00 2001 From: bfredl Date: Fri, 6 Oct 2023 23:01:24 +0200 Subject: refactor(cpoptions): remove 'p' Deleting a cpo flag a day keeps the doctor away We don't need two different ways to indent LISP code --- runtime/doc/options.txt | 3 --- runtime/doc/vim_diff.txt | 2 +- runtime/lua/vim/_meta/options.lua | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8ba801e6f2..176c8ca3db 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1720,9 +1720,6 @@ A jump table for the options with a short description can be found at |Q_op|. when it didn't exist when editing it. This is a protection against a file unexpectedly created by someone else. Vi didn't complain about this. - *cpo-p* - p Vi compatible Lisp indenting. When not present, a - slightly better algorithm is used. *cpo-P* P When included, a ":write" command that appends to a file will set the file name for the current buffer, if diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 0552689860..77b9ff6864 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -675,7 +675,7 @@ Options: bioskey (MS-DOS) conskey (MS-DOS) *'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".) - 'cpoptions' (gjkHw<*- and all POSIX flags were removed) + 'cpoptions' (gjpkHw<*- and all POSIX flags were removed) *'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation) cscopepathcomp cscopeprg diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 209c27cfd8..46497179ac 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1296,9 +1296,6 @@ vim.bo.ci = vim.bo.copyindent --- when it didn't exist when editing it. This is a --- protection against a file unexpectedly created by --- someone else. Vi didn't complain about this. ---- *cpo-p* ---- p Vi compatible Lisp indenting. When not present, a ---- slightly better algorithm is used. --- *cpo-P* --- P When included, a ":write" command that appends to a --- file will set the file name for the current buffer, if -- cgit From 0a598c13b1863ba1aff378027c4376e3ab7048ee Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 25 Dec 2023 16:31:38 +0100 Subject: feat(vim.deprecate): only issue warning if neovim version is high enough As specified by MAINTAIN.md, features should be soft deprecated at first (meaning no warnings) to give people a chance to adjust. The problem with this approach is that deprecating a feature becomes harder than usual as during the soft deprecation period you need to remember not to issue a warning, and during the hard deprecation period you need to remember to start issuing a warning. This behavior is only enforced if the `plugin` parameter is `nil` as plugins may not want this specific behavior. --- runtime/lua/vim/_editor.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 0bb1becf58..dda89e2bdb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -1019,6 +1019,18 @@ end --- ---@return string|nil # Deprecated message, or nil if no message was shown. function vim.deprecate(name, alternative, version, plugin, backtrace) + -- Only issue warning if feature is hard-deprecated as specified by MAINTAIN.md. + if plugin == nil then + local current_version = vim.version() + local deprecated_version = assert(vim.version.parse(version)) + local soft_deprecated_version = + { deprecated_version.major, deprecated_version.minor - 1, deprecated_version.patch } + local deprecate = vim.version.lt(current_version, soft_deprecated_version) + if deprecate then + return + end + end + local msg = ('%s is deprecated'):format(name) plugin = plugin or 'Nvim' msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or msg -- cgit From bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 26 Dec 2023 00:16:03 +0100 Subject: feat(extmarks): add virt_text_repeat_linebreak flag (#26625) Problem: Unable to predict which byte-offset to place virtual text to make it repeat visually in the wrapped part of a line. Solution: Add a flag to nvim_buf_set_extmark() that causes virtual text to repeat in wrapped lines. --- runtime/doc/api.txt | 2 ++ runtime/doc/news.txt | 9 ++++----- runtime/lua/vim/_meta/api.lua | 2 ++ runtime/lua/vim/_meta/api_keysets.lua | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7cb6051020..6a69bf7b41 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2696,6 +2696,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts}) text is selected or hidden because of scrolling with 'nowrap' or 'smoothscroll'. Currently only affects "overlay" virt_text. + • virt_text_repeat_linebreak : repeat the virtual text on + wrapped lines. • hl_mode : control how highlights are combined with the highlights of the text. Currently only affects virt_text highlights, but might affect `hl_group` in later versions. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 454c9becc5..bc3902bc4c 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -339,11 +339,10 @@ The following changes to existing APIs or features add new behavior. In addition, |nvim_buf_get_extmarks()| has gained an "overlap" option to return such ranges even if they started before the specified position. -• Extmarks can opt-out of precise undo tracking using the new "undo_restore" - flag to |nvim_buf_set_extmark()| - -• Extmarks can be automatically hidden or removed using the new "invalidate" - flag to |nvim_buf_set_extmark()| +• The following flags were added to |nvim_buf_set_extmark()|: + - "undo_restore": opt-out extmarks of precise undo tracking. + - "invalidate": automatically hide or delete extmarks. + - "virt_text_repeat_linebreak": repeat virtual text on wrapped lines. • LSP hover and signature help now use Treesitter for highlighting of Markdown content. diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c8c3e1c3af..ba18a16488 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -519,6 +519,8 @@ function vim.api.nvim_buf_line_count(buffer) end --- text is selected or hidden because of scrolling with --- 'nowrap' or 'smoothscroll'. Currently only affects --- "overlay" virt_text. +--- • virt_text_repeat_linebreak : repeat the virtual text on +--- wrapped lines. --- • hl_mode : control how highlights are combined with the --- highlights of the text. Currently only affects virt_text --- highlights, but might affect `hl_group` in later versions. diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 4ec8b03d30..bb1031b2fa 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -251,6 +251,7 @@ error('Cannot require a meta file') --- @field virt_text_pos? string --- @field virt_text_win_col? integer --- @field virt_text_hide? boolean +--- @field virt_text_repeat_linebreak? boolean --- @field hl_eol? boolean --- @field hl_mode? string --- @field invalidate? boolean -- cgit From 5f9d4d8afeb5dc3d5df4965c24cbb4c6e01694f7 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 25 Dec 2023 21:28:28 +0100 Subject: refactor: use vim.deprecate on all deprecated functions --- runtime/lua/vim/_editor.lua | 2 +- runtime/lua/vim/diagnostic.lua | 16 +++++++--------- runtime/lua/vim/lsp.lua | 8 +++++++- runtime/lua/vim/lsp/buf.lua | 2 +- runtime/lua/vim/lsp/util.lua | 11 +++++++---- runtime/lua/vim/treesitter/language.lua | 5 +++++ 6 files changed, 28 insertions(+), 16 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index dda89e2bdb..0b338fa86f 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -888,7 +888,7 @@ end ---@private function vim.pretty_print(...) - vim.deprecate('vim.pretty_print', 'vim.print', '0.10') + vim.deprecate('vim.pretty_print()', 'vim.print()', '0.10') return vim.print(...) end diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 6d2c212dfc..a82a61eeb7 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -891,15 +891,13 @@ M.handlers.signs = { local sign = vim.fn.sign_getdefined(name)[1] if sign then local severity = M.severity[v:upper()] - if vim.fn.has('nvim-0.11') == 1 then - vim.deprecate( - 'Defining diagnostic signs with :sign-define or sign_define()', - 'vim.diagnostic.config()', - '0.12', - nil, - false - ) - end + vim.deprecate( + 'Defining diagnostic signs with :sign-define or sign_define()', + 'vim.diagnostic.config()', + '0.12', + nil, + false + ) if not opts.signs.text then opts.signs.text = {} diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index ca7222a8f3..1310239a5b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1740,7 +1740,7 @@ end ---@private ---@deprecated function lsp.get_active_clients(filter) - -- TODO: add vim.deprecate call after 0.10 is out for removal in 0.12 + vim.deprecate('vim.lsp.get_active_clients()', 'vim.lsp.get_clients()', '0.12') return lsp.get_clients(filter) end @@ -2051,6 +2051,7 @@ end ---@return table result is table of (client_id, client) pairs ---@deprecated Use |vim.lsp.get_clients()| instead. function lsp.buf_get_clients(bufnr) + vim.deprecate('vim.lsp.buf_get_clients()', 'vim.lsp.get_clients()', '0.12') local result = {} --- @type table for _, client in ipairs(lsp.get_clients({ bufnr = resolve_bufnr(bufnr) })) do result[client.id] = client @@ -2101,6 +2102,11 @@ end --- buffer number as arguments. ---@deprecated use lsp.get_clients({ bufnr = bufnr }) with regular loop function lsp.for_each_buffer_client(bufnr, fn) + vim.deprecate( + 'vim.lsp.for_each_buffer_client()', + 'lsp.get_clients({ bufnr = bufnr }) with regular loop', + '0.12' + ) return for_each_buffer_client(bufnr, fn) end diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 2f754444e9..051b9d4550 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -34,7 +34,7 @@ end ---@return boolean if server responds. ---@deprecated function M.server_ready() - vim.deprecate('vim.lsp.buf.server_ready', nil, '0.10.0') + vim.deprecate('vim.lsp.buf.server_ready()', nil, '0.10') return not not vim.lsp.buf_notify(0, 'window/progress', {}) end diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 63c4c1e7fc..ba7ce3c2b6 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -180,6 +180,7 @@ local _str_byteindex_enc = M._str_byteindex_enc ---@param new_lines (table) list of strings to replace the original ---@return table 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 local i_0 = A[1] + 1 -- If it extends past the end, truncate it to the end. This is because the @@ -346,7 +347,7 @@ end ---@private ---@deprecated Use vim.lsp.status() or access client.progress directly function M.get_progress_messages() - vim.deprecate('vim.lsp.util.get_progress_messages', 'vim.lsp.status', '0.11.0') + vim.deprecate('vim.lsp.util.get_progress_messages()', 'vim.lsp.status()', '0.11') local new_messages = {} local progress_remove = {} @@ -552,7 +553,7 @@ end ---@return lsp.CompletionItem[] List of completion items ---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion function M.extract_completion_items(result) - vim.deprecate('vim.lsp.util.extract_completion_items', nil, '0.11') + vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.11') if type(result) == 'table' and result.items then -- result is a `CompletionList` return result.items @@ -612,7 +613,7 @@ end ---@param input string unparsed snippet ---@return string parsed snippet function M.parse_snippet(input) - vim.deprecate('vim.lsp.util.parse_snippet', nil, '0.11') + vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.11') local ok, parsed = pcall(function() return snippet.parse(input) end) @@ -634,7 +635,7 @@ end ---@return table[] items ---@see complete-items function M.text_document_completion_list_to_complete_items(result, prefix) - vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items', nil, '0.11') + vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11') return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix) end @@ -1885,6 +1886,7 @@ end ---@param lines table list of lines to trim ---@return table trimmed list of lines function M.trim_empty_lines(lines) + vim.deprecate('vim.lsp.util.trim_empty_lines()', 'vim.split() with `trimempty`', '0.12') local start = 1 for i = 1, #lines do if lines[i] ~= nil and #lines[i] > 0 then @@ -1911,6 +1913,7 @@ end ---@param lines table 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') local language_id = lines[1]:match('^```(.*)') if language_id then local has_inner_code_fence = false diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua index 15bf666a1e..2056c337c8 100644 --- a/runtime/lua/vim/treesitter/language.lua +++ b/runtime/lua/vim/treesitter/language.lua @@ -37,6 +37,11 @@ end ---@deprecated function M.require_language(lang, path, silent, symbol_name) + vim.deprecate( + 'vim.treesitter.language.require_language()', + 'vim.treesitter.language.add()', + '0.12' + ) local opts = { silent = silent, path = path, -- cgit From 5cb906e91cb56302d0737aa80e2d890dde452029 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 26 Dec 2023 15:16:45 +0100 Subject: fix: correct versions in deprecation warnings The following functions should be removed in 0.12 according to the deprecation strategy in MAINTAIN.md: - vim.lsp.util.extract_completion_items() - vim.lsp.util.parse_snippet() - vim.lsp.util.text_document_completion_list_to_complete_items() --- runtime/lua/vim/lsp/util.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index ba7ce3c2b6..90e2f28ef4 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -553,7 +553,7 @@ end ---@return lsp.CompletionItem[] List of completion items ---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion function M.extract_completion_items(result) - vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.11') + vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.12') if type(result) == 'table' and result.items then -- result is a `CompletionList` return result.items @@ -613,7 +613,7 @@ end ---@param input string unparsed snippet ---@return string parsed snippet function M.parse_snippet(input) - vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.11') + vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.12') local ok, parsed = pcall(function() return snippet.parse(input) end) @@ -635,7 +635,7 @@ end ---@return table[] items ---@see complete-items function M.text_document_completion_list_to_complete_items(result, prefix) - vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11') + vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.12') return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix) end -- cgit From c26dc1f77c792fe5cbefd578dc8d1e23c80d3688 Mon Sep 17 00:00:00 2001 From: Nacho Nieva <83428506+NachoNievaG@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:26:18 -0300 Subject: feat(defaults): map Q and @x to repeat in Visual mode (#26495) --- runtime/doc/news.txt | 3 +++ runtime/doc/repeat.txt | 10 ++++++++++ runtime/doc/vim_diff.txt | 2 ++ runtime/doc/visual.txt | 14 ++++++++++++++ runtime/lua/vim/_defaults.lua | 15 +++++++++++++++ 5 files changed, 44 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index bc3902bc4c..a256db76d6 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -112,6 +112,9 @@ The following changes may require adaptations in user config or plugins. • 'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color. +• `Q` now repeats a macro for each line of a visual selection. +• `@` now repeats the indicated macro for each line of a visual selection. + ============================================================================== BREAKING CHANGES IN HEAD *news-breaking-dev* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 53f6904170..726d7a9591 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -148,10 +148,20 @@ q Stops recording. *@@* *E748* @@ Repeat the previous @{0-9a-z":*} [count] times. + *v_@-default* +{Visual}@{0-9a-z".=*+} In Visual mode, execute the contents of the register +{Visual}@@ but for each selected line. + See |visual-repeat|, |default-mappings|. + *Q* Q Repeat the last recorded register [count] times. See |reg_recorded()|. + *v_Q-default* +{Visual}Q In Visual mode, repeat the last recorded register for + each selected line. + See |visual-repeat|, |default-mappings|. + *:@* :[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex command. First set cursor at line [addr] (default is diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 77b9ff6864..5b0b5655b4 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -129,6 +129,8 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y". - |i_CTRL-W-default| - |CTRL-L-default| - & |&-default| +- Q |v_Q-default| +- @ |v_@-default| - # |v_#-default| - * |v_star-default| - Nvim LSP client defaults |lsp-defaults| diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 0d1ea937c0..a20fb6d31e 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -366,6 +366,20 @@ one of the last commands to extend the highlighted text, the repeating will be applied up to the rightmost column of the longest line. Any count passed to the `.` command is not used. +Visual mode |default-mappings| "@" and "Q" can repeat commands in a register +for all selected lines. See |v_@-default| and |v_Q-default| for details. For +example, given the text: + + 123(hello)321 + 456(world)654 + 456(NOT THIS)654 + +With register "x" containing the commands `yi(VP`, Visually selecting the +first two lines and typing `@x` produces: + + hello + world + 456(NOT THIS)654 ============================================================================== 7. Examples *visual-examples* diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 2627cbcd0d..0d756b8701 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -67,6 +67,21 @@ do --- See |&-default| vim.keymap.set('n', '&', ':&&', { desc = ':help &-default' }) + --- Use Q in visual mode to execute a macro on each line of the selection. #21422 + --- + --- Applies to @x and includes @@ too. + vim.keymap.set( + 'x', + 'Q', + ':normal! @=reg_recorded()', + { silent = true, desc = ':help v_Q-default' } + ) + vim.keymap.set( + 'x', + '@', + "':normal! @'.getcharstr().''", + { silent = true, expr = true, desc = ':help v_@-default' } + ) --- Map |gx| to call |vim.ui.open| on the identifier under the cursor do -- TODO: use vim.region() when it lands... #13896 #16843 -- cgit From 3767468b9615b617e252e9e9498e070087fe570f Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Mon, 11 Dec 2023 00:05:24 -0500 Subject: docs(gen_lsp.lua): re-generate vim.lsp._meta.protocol type annotations The purpose of this commit is to make diff clean and easy to read; to see the diff resulted from actual changes in gen_lsp.lua, not from the updated LSP protocol JSON data. Ran: `nvim -l scripts/gen_lsp.lua gen --methods` Based on 3.18.0 (2023-12-23) --- runtime/doc/lsp.txt | 2 +- runtime/lua/vim/lsp/_meta/protocol.lua | 127 ++++++++++++++++++++++++++------- runtime/lua/vim/lsp/protocol.lua | 44 ++++++------ 3 files changed, 123 insertions(+), 50 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 436cbd1cee..aaec58633f 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2181,7 +2181,7 @@ Methods *vim.lsp.protocol.Methods* LSP method names. See also: ~ - • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel + • https://microsoft.github.io/language-server-protocol/specification/#metaModel *vim.lsp.protocol.resolve_capabilities()* resolve_capabilities({server_capabilities}) diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua index 979dad84fd..dc7970c1b4 100644 --- a/runtime/lua/vim/lsp/_meta/protocol.lua +++ b/runtime/lua/vim/lsp/_meta/protocol.lua @@ -472,6 +472,9 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@class lsp.InlayHint ---The position of this hint. +--- +---If multiple hints have the same position, they will be shown in the order +---they appear in the response. ---@field position lsp.Position ---The label of this hint. A human readable string or an array of ---InlayHintLabelPart label parts. @@ -614,12 +617,16 @@ error('Cannot require a meta file') ---A parameter literal used in inline completion requests. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams ---Additional information about the context in which inline completions were ---requested. ---@field context lsp.InlineCompletionContext ---Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor. +--- +---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionList ---The inline completion items ---@field items lsp.InlineCompletionItem[] @@ -627,11 +634,10 @@ error('Cannot require a meta file') ---An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionItem ---The text to replace the range with. Must be set. ----@field insertText string ----The format of the insert text. The format applies to the `insertText`. If omitted defaults to `InsertTextFormat.PlainText`. ----@field insertTextFormat? lsp.InsertTextFormat +---@field insertText string|lsp.StringValue ---A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used. ---@field filterText? string ---The range to replace. Must begin and end on the same line. @@ -642,6 +648,7 @@ error('Cannot require a meta file') ---Inline completion options used during static or dynamic registration. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionRegistrationOptions: lsp.InlineCompletionOptions, lsp.StaticRegistrationOptions ---@class lsp.RegistrationParams @@ -981,14 +988,23 @@ error('Cannot require a meta file') ---In future version of the protocol this property might become ---mandatory to better express this. ---@field activeSignature? uinteger ----The active parameter of the active signature. If omitted or the value ----lies outside the range of `signatures[activeSignature].parameters` ----defaults to 0 if the active signature has parameters. If ----the active signature has no parameters it is ignored. +---The active parameter of the active signature. +--- +---If `null`, no parameter of the signature is active (for example a named +---argument that does not match any declared parameters). This is only valid +---since 3.18.0 and if the client specifies the client capability +---`textDocument.signatureHelp.noActiveParameterSupport === true` +--- +---If omitted or the value lies outside the range of +---`signatures[activeSignature].parameters` defaults to 0 if the active +---signature has parameters. +--- +---If the active signature has no parameters it is ignored. +--- ---In future version of the protocol this property might become ----mandatory to better express the active parameter if the ----active signature does have any. ----@field activeParameter? uinteger +---mandatory (but still nullable) to better express the active parameter if +---the active signature does have any. +---@field activeParameter? uinteger|lsp.null ---Registration options for a {@link SignatureHelpRequest}. ---@class lsp.SignatureHelpRegistrationOptions: lsp.TextDocumentRegistrationOptions @@ -1192,8 +1208,7 @@ error('Cannot require a meta file') ---The command this code lens represents. ---@field command? lsp.Command ---A data entry field that is preserved on a code lens item between ----a {@link CodeLensRequest} and a [CodeLensResolveRequest] ----(#CodeLensResolveRequest) +---a {@link CodeLensRequest} and a {@link CodeLensResolveRequest} ---@field data? lsp.LSPAny ---Registration options for a {@link CodeLensRequest}. @@ -1470,7 +1485,7 @@ error('Cannot require a meta file') ---@class lsp.ConfigurationItem ---The scope to get the configuration section for. ----@field scopeUri? string +---@field scopeUri? lsp.URI ---The configuration section asked for. ---@field section? string @@ -1503,14 +1518,14 @@ error('Cannot require a meta file') ---offset of b is 3 since `𐐀` is represented using two code units in UTF-16. ---Since 3.17 clients and servers can agree on a different string encoding ---representation (e.g. UTF-8). The client announces it's supported encoding ----via the client capability [`general.positionEncodings`](#clientCapabilities). +---via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities). ---The value is an array of position encodings the client supports, with ---decreasing preference (e.g. the encoding at index `0` is the most preferred ---one). To stay backwards compatible the only mandatory encoding is UTF-16 ---represented via the string `utf-16`. The server can pick one of the ---encodings offered by the client and signals that encoding back to the ---client via the initialize result's property ----[`capabilities.positionEncoding`](#serverCapabilities). If the string value +---[`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value ---`utf-16` is missing from the client's capability `general.positionEncodings` ---servers can safely assume that the client supports UTF-16. If the server ---omits the position encoding in its initialize result the encoding defaults @@ -1915,18 +1930,36 @@ error('Cannot require a meta file') ---Provides information about the context in which an inline completion was requested. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionContext ---Describes how the inline completion was triggered. ---@field triggerKind lsp.InlineCompletionTriggerKind ---Provides information about the currently selected item in the autocomplete widget if it is visible. ---@field selectedCompletionInfo? lsp.SelectedCompletionInfo +---A string value used as a snippet is a template which allows to insert text +---and to control the editor cursor when insertion happens. +--- +---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. Variables are defined with `$name` and +---`${name:default value}`. +--- +---@since 3.18.0 +---@proposed +---@class lsp.StringValue +---The kind of string value. +---@field kind "snippet" +---The snippet string. +---@field value string + ---Inline completion options used during static registration. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionOptions ----General parameters to to register for an notification or to register a provider. +---General parameters to register for a notification or to register a provider. ---@class lsp.Registration ---The id used to register the request. The id can be used to deregister ---the request again. @@ -2097,6 +2130,7 @@ error('Cannot require a meta file') ---Inline completion options used during static registration. --- ---@since 3.18.0 +---@proposed ---@field inlineCompletionProvider? boolean|lsp.InlineCompletionOptions ---Workspace specific server capabilities. ---@field workspace? anonym12 @@ -2261,10 +2295,16 @@ error('Cannot require a meta file') ---@field parameters? lsp.ParameterInformation[] ---The index of the active parameter. --- ----If provided, this is used in place of `SignatureHelp.activeParameter`. +---If `null`, no parameter of the signature is active (for example a named +---argument that does not match any declared parameters). This is only valid +---since 3.18.0 and if the client specifies the client capability +---`textDocument.signatureHelp.noActiveParameterSupport === true` +--- +---If provided (or `null`), this is used in place of +---`SignatureHelp.activeParameter`. --- ---@since 3.16.0 ----@field activeParameter? uinteger +---@field activeParameter? uinteger|lsp.null ---Server Capabilities for a {@link SignatureHelpRequest}. ---@class lsp.SignatureHelpOptions @@ -2545,6 +2585,7 @@ error('Cannot require a meta file') ---Describes the currently selected completion item. --- ---@since 3.18.0 +---@proposed ---@class lsp.SelectedCompletionInfo ---The range that will be replaced if this completion item is accepted. ---@field range lsp.Range @@ -2758,6 +2799,11 @@ error('Cannot require a meta file') --- ---@since 3.17.0. ---@field diagnostics? lsp.DiagnosticWorkspaceClientCapabilities +---Capabilities specific to the folding range requests scoped to the workspace. +--- +---@since 3.18.0 +---@proposed +---@field foldingRange? lsp.FoldingRangeWorkspaceClientCapabilities ---Text document specific client capabilities. ---@class lsp.TextDocumentClientCapabilities @@ -2853,6 +2899,7 @@ error('Cannot require a meta file') ---Client capabilities specific to inline completions. --- ---@since 3.18.0 +---@proposed ---@field inlineCompletion? lsp.InlineCompletionClientCapabilities ---Capabilities specific to the notebook document support. @@ -3083,6 +3130,23 @@ error('Cannot require a meta file') ---change that requires such a calculation. ---@field refreshSupport? boolean +---Client workspace capabilities specific to folding ranges +--- +---@since 3.18.0 +---@proposed +---@class lsp.FoldingRangeWorkspaceClientCapabilities +---Whether the client implementation supports a refresh request sent from the +---server to the client. +--- +---Note that this event is global and will force the client to refresh all +---folding ranges currently shown. It should be used with absolute care and is +---useful for situation where a server for example detects a project wide +---change that requires such a calculation. +--- +---@since 3.18.0 +---@proposed +---@field refreshSupport? boolean + ---@class lsp.TextDocumentSyncClientCapabilities ---Whether text document synchronization supports dynamic registration. ---@field dynamicRegistration? boolean @@ -3474,6 +3538,7 @@ error('Cannot require a meta file') ---Client capabilities specific to inline completions. --- ---@since 3.18.0 +---@proposed ---@class lsp.InlineCompletionClientCapabilities ---Whether implementation supports dynamic registration for inline completion providers. ---@field dynamicRegistration? boolean @@ -3662,18 +3727,13 @@ error('Cannot require a meta file') ---| 1 # Type ---| 2 # Parameter ----Defines whether the insert text in a completion item should be interpreted as ----plain text or a snippet. ----@alias lsp.InsertTextFormat ----| 1 # PlainText ----| 2 # Snippet - ---The message type ---@alias lsp.MessageType ---| 1 # Error ---| 2 # Warning ---| 3 # Info ---| 4 # Log +---| 5 # Debug ---Defines how the host (editor) should sync ---document changes to the language server. @@ -3723,6 +3783,12 @@ error('Cannot require a meta file') ---@alias lsp.CompletionItemTag ---| 1 # Deprecated +---Defines whether the insert text in a completion item should be interpreted as +---plain text or a snippet. +---@alias lsp.InsertTextFormat +---| 1 # PlainText +---| 2 # Snippet + ---How whitespace and indentation is handled during completion ---item insertion. --- @@ -3766,6 +3832,7 @@ error('Cannot require a meta file') ---Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. --- ---@since 3.18.0 +---@proposed ---@alias lsp.InlineCompletionTriggerKind ---| 0 # Invoked ---| 1 # Automatic @@ -4247,6 +4314,12 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@field activeParameterSupport? boolean +---The client supports the `activeParameter` property on +---`SignatureInformation` being set to `null` to indicate that no +---parameter should be active. +--- +---@since 3.18.0 +---@field noActiveParameterSupport? boolean ---@class anonym31 ---The symbol kind values the client supports. When this @@ -4352,7 +4425,7 @@ error('Cannot require a meta file') ---@field language string ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string ----A glob pattern, like `*.{ts,js}`. +---A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern? string ---@class anonym50 @@ -4360,7 +4433,7 @@ error('Cannot require a meta file') ---@field language? string ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme string ----A glob pattern, like `*.{ts,js}`. +---A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern? string ---@class anonym51 @@ -4368,7 +4441,7 @@ error('Cannot require a meta file') ---@field language? string ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string ----A glob pattern, like `*.{ts,js}`. +---A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern string ---@class anonym52 diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index b2a92cd1ee..df12c36396 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -934,7 +934,7 @@ end -- Generated by gen_lsp.lua, keep at end of file. --- LSP method names. --- ----@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel +---@see https://microsoft.github.io/language-server-protocol/specification/#metaModel protocol.Methods = { --- A request to resolve the incoming calls for a given `CallHierarchyItem`. --- @since 3.16.0 @@ -1021,16 +1021,14 @@ protocol.Methods = { --- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. textDocument_completion = 'textDocument/completion', --- A request to resolve the type definition locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Declaration} - --- or a typed array of {@link DeclarationLink} or a Thenable that resolves - --- to such. + --- document position. The request's parameter is of type {@link TextDocumentPositionParams} + --- the response is of type {@link Declaration} or a typed array of {@link DeclarationLink} + --- or a Thenable that resolves to such. textDocument_declaration = 'textDocument/declaration', --- A request to resolve the definition location of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPosition] - --- (#TextDocumentPosition) the response is of either type {@link Definition} - --- or a typed array of {@link DefinitionLink} or a Thenable that resolves - --- to such. + --- document position. The request's parameter is of type {@link TextDocumentPosition} + --- the response is of either type {@link Definition} or a typed array of + --- {@link DefinitionLink} or a Thenable that resolves to such. textDocument_definition = 'textDocument/definition', --- The document diagnostic request definition. --- @since 3.17.0 @@ -1064,9 +1062,9 @@ protocol.Methods = { --- that resolves to such. textDocument_documentColor = 'textDocument/documentColor', --- Request to resolve a {@link DocumentHighlight} for a given - --- text document position. The request's parameter is of type [TextDocumentPosition] - --- (#TextDocumentPosition) the request response is of type [DocumentHighlight[]] - --- (#DocumentHighlight) or a Thenable that resolves to such. + --- text document position. The request's parameter is of type {@link TextDocumentPosition} + --- the request response is an array of type {@link DocumentHighlight} + --- or a Thenable that resolves to such. textDocument_documentHighlight = 'textDocument/documentHighlight', --- A request to provide document links textDocument_documentLink = 'textDocument/documentLink', @@ -1080,16 +1078,15 @@ protocol.Methods = { --- response is of type {@link FoldingRangeList} or a Thenable --- that resolves to such. textDocument_foldingRange = 'textDocument/foldingRange', - --- A request to to format a whole document. + --- A request to format a whole document. textDocument_formatting = 'textDocument/formatting', --- Request to request hover information at a given text document position. The request's --- parameter is of type {@link TextDocumentPosition} the response is of --- type {@link Hover} or a Thenable that resolves to such. textDocument_hover = 'textDocument/hover', --- A request to resolve the implementation locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a - --- Thenable that resolves to such. + --- document position. The request's parameter is of type {@link TextDocumentPositionParams} + --- the response is of type {@link Definition} or a Thenable that resolves to such. textDocument_implementation = 'textDocument/implementation', --- A request to provide inlay hints in a document. The request's parameter is of --- type {@link InlayHintsParams}, the response is of type @@ -1100,6 +1097,7 @@ protocol.Methods = { --- type {@link InlineCompletionParams}, the response is of type --- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. --- @since 3.18.0 + --- @proposed textDocument_inlineCompletion = 'textDocument/inlineCompletion', --- A request to provide inline values in a document. The request's parameter is of --- type {@link InlineValueParams}, the response is of type @@ -1155,9 +1153,8 @@ protocol.Methods = { textDocument_semanticTokens_range = 'textDocument/semanticTokens/range', textDocument_signatureHelp = 'textDocument/signatureHelp', --- A request to resolve the type definition locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a - --- Thenable that resolves to such. + --- document position. The request's parameter is of type {@link TextDocumentPositionParams} + --- the response is of type {@link Definition} or a Thenable that resolves to such. textDocument_typeDefinition = 'textDocument/typeDefinition', --- A document will save notification is sent from the client to the server before --- the document is actually saved. @@ -1200,14 +1197,14 @@ protocol.Methods = { --- symbol's location. --- @since 3.17.0 workspaceSymbol_resolve = 'workspaceSymbol/resolve', - --- A request sent from the server to the client to modified certain resources. + --- A request sent from the server to the client to modify certain resources. workspace_applyEdit = 'workspace/applyEdit', --- A request to refresh all code actions --- @since 3.16.0 workspace_codeLens_refresh = 'workspace/codeLens/refresh', --- The 'workspace/configuration' request is sent from the server to the client to fetch a certain --- configuration setting. - --- This pull model replaces the old push model were the client signaled configuration change via an + --- This pull model replaces the old push model where the client signaled configuration change via an --- event. If the server still needs to react to configuration changes (since the server caches the --- result of `workspace/configuration` requests) the server should register for an empty configuration --- change event and empty the cache if such an event is received. @@ -1240,9 +1237,12 @@ protocol.Methods = { --- files were renamed from within the client. --- @since 3.16.0 workspace_didRenameFiles = 'workspace/didRenameFiles', - --- A request send from the client to the server to execute a command. The request might return + --- A request sent from the client to the server to execute a command. The request might return --- a workspace edit which the client will apply to the workspace. workspace_executeCommand = 'workspace/executeCommand', + --- @since 3.18.0 + --- @proposed + workspace_foldingRange_refresh = 'workspace/foldingRange/refresh', --- @since 3.17.0 workspace_inlayHint_refresh = 'workspace/inlayHint/refresh', --- @since 3.17.0 -- cgit From 6c35fb421e888d0cbdfac07a5ff4579c9be7f0ec Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Mon, 11 Dec 2023 02:25:17 -0500 Subject: fix(gen_lsp.lua): improve type name, and fix wrong type inheritance Style improvements: 1. Anonymous classes derived from `StructureLiteralType` should have a better name. The class name can be also nested. Examples: ```diff ----@field serverInfo? anonym1 +---@field serverInfo? lsp._anonym1.serverInfo ``` ```diff ----@field insertTextModeSupport? anonym26 +---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport ``` 2. Add one separate empty line before each `@field` definition. Without these, empty lines the doc can look confusing because descriptions also may contain empty lines. See `lsp.CompletionItem` for example: ```lua ---The kind of this completion item. Based of the kind ---an icon is chosen by the editor. ---@field kind? lsp.CompletionItemKind ---Tags for this completion item. --- ---@since 3.15.0 ---@field tags? lsp.CompletionItemTag[] ``` It might feel like "Tags for this completion item" belongs to `kind`, not `tags` due to the lack of separator blank lines. The following (after this commit) should look much better: ```diff ---The kind of this completion item. Based of the kind ---an icon is chosen by the editor. ---@field kind? lsp.CompletionItemKind +--- ---Tags for this completion item. --- ---@since 3.15.0 ---@field tags? lsp.CompletionItemTag[] ``` 3. Escape some LSP-specific annotations that can't be recognized by lua-ls. It'd be better to make them visible in LSP hover doc windows. Example: `@sample ...`. Fixes: 1. A type may extend from more than one base types (as well as mixin types). Previously only the first base class was being considered, resulting incomplete base classes for `@class` definitions. Example: `InlayHintOptions` (should have both of `resolveProvider` and `workDoneProgress`, the latter is from `WorkDoneProgressOptions`) ```diff ----@class lsp.InlayHintOptions +---@class lsp.InlayHintOptions: lsp.WorkDoneProgressOptions ``` 2. Remove `<200b>` (zero-width space) unicode characters. 3. Add the missing newline at EOF. --- runtime/lua/vim/lsp/_meta/protocol.lua | 1182 ++++++++++++++++++++++++++------ 1 file changed, 985 insertions(+), 197 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua index dc7970c1b4..4c053cb57e 100644 --- a/runtime/lua/vim/lsp/_meta/protocol.lua +++ b/runtime/lua/vim/lsp/_meta/protocol.lua @@ -21,99 +21,123 @@ error('Cannot require a meta file') ---Represents a location inside a resource, such as a line ---inside a text file. ---@class lsp.Location +--- ---@field uri lsp.DocumentUri +--- ---@field range lsp.Range ----@class lsp.ImplementationRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.ImplementationRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.ImplementationOptions, lsp.StaticRegistrationOptions ---@class lsp.TypeDefinitionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams ----@class lsp.TypeDefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.TypeDefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.TypeDefinitionOptions, lsp.StaticRegistrationOptions ---A workspace folder inside a client. ---@class lsp.WorkspaceFolder +--- ---The associated URI for this workspace folder. ---@field uri lsp.URI +--- ---The name of the workspace folder. Used to refer to this ---workspace folder in the user interface. ---@field name string ---The parameters of a `workspace/didChangeWorkspaceFolders` notification. ---@class lsp.DidChangeWorkspaceFoldersParams +--- ---The actual workspace folder change event. ---@field event lsp.WorkspaceFoldersChangeEvent ---The parameters of a configuration request. ---@class lsp.ConfigurationParams +--- ---@field items lsp.ConfigurationItem[] ---Parameters for a {@link DocumentColorRequest}. ----@class lsp.DocumentColorParams +---@class lsp.DocumentColorParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier ---Represents a color range from a document. ---@class lsp.ColorInformation +--- ---The range in the document where this color appears. ---@field range lsp.Range +--- ---The actual color value for this color range. ---@field color lsp.Color ----@class lsp.DocumentColorRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.DocumentColorRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentColorOptions, lsp.StaticRegistrationOptions ---Parameters for a {@link ColorPresentationRequest}. ----@class lsp.ColorPresentationParams +---@class lsp.ColorPresentationParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The color to request presentations for. ---@field color lsp.Color +--- ---The range where the color would be inserted. Serves as a context. ---@field range lsp.Range ---@class lsp.ColorPresentation +--- ---The label of this color presentation. It will be shown on the color ---picker header. By default this is also the text that is inserted when selecting ---this color presentation. ---@field label string +--- ---An {@link TextEdit edit} which is applied to a document when selecting ---this presentation for the color. When `falsy` the {@link ColorPresentation.label label} ---is used. ---@field textEdit? lsp.TextEdit +--- ---An optional array of additional {@link TextEdit text edits} that are applied when ---selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. ---@field additionalTextEdits? lsp.TextEdit[] ---@class lsp.WorkDoneProgressOptions +--- ---@field workDoneProgress? boolean ---General text document registration options. ---@class lsp.TextDocumentRegistrationOptions +--- ---A document selector to identify the scope of the registration. If set to null ---the document selector provided on the client side will be used. ---@field documentSelector lsp.DocumentSelector|lsp.null ---Parameters for a {@link FoldingRangeRequest}. ----@class lsp.FoldingRangeParams +---@class lsp.FoldingRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier ---Represents a folding range. To be valid, start and end line must be bigger than zero and smaller ---than the number of lines in the document. Clients are free to ignore invalid ranges. ---@class lsp.FoldingRange +--- ---The zero-based start line of the range to fold. The folded area starts after the line's last character. ---To be valid, the end must be zero or larger and smaller than the number of lines in the document. ---@field startLine uinteger +--- ---The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. ---@field startCharacter? uinteger +--- ---The zero-based end line of the range to fold. The folded area ends with the line's last character. ---To be valid, the end must be zero or larger and smaller than the number of lines in the document. ---@field endLine uinteger +--- ---The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. ---@field endCharacter? uinteger +--- ---Describes the kind of the folding range such as `comment' or 'region'. The kind ---is used to categorize folding ranges and used by commands like 'Fold all comments'. ---See {@link FoldingRangeKind} for an enumeration of standardized kinds. ---@field kind? lsp.FoldingRangeKind +--- ---The text that the client should show when the specified range is ---collapsed. If not defined or not supported by the client, a default ---will be chosen by the client. @@ -121,34 +145,40 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@field collapsedText? string ----@class lsp.FoldingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.FoldingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.FoldingRangeOptions, lsp.StaticRegistrationOptions ---@class lsp.DeclarationParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams ----@class lsp.DeclarationRegistrationOptions: lsp.DeclarationOptions, lsp.StaticRegistrationOptions +---@class lsp.DeclarationRegistrationOptions: lsp.DeclarationOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions ---A parameter literal used in selection range requests. ----@class lsp.SelectionRangeParams +---@class lsp.SelectionRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The positions inside the text document. ---@field positions lsp.Position[] ---A selection range represents a part of a selection hierarchy. A selection range ---may have a parent selection range that contains it. ---@class lsp.SelectionRange +--- ---The {@link Range range} of this selection range. ---@field range lsp.Range +--- ---The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. ---@field parent? lsp.SelectionRange ----@class lsp.SelectionRangeRegistrationOptions: lsp.SelectionRangeOptions, lsp.StaticRegistrationOptions +---@class lsp.SelectionRangeRegistrationOptions: lsp.SelectionRangeOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions ---@class lsp.WorkDoneProgressCreateParams +--- ---The token to be used to report progress. ---@field token lsp.ProgressToken ---@class lsp.WorkDoneProgressCancelParams +--- ---The token to be used to report progress. ---@field token lsp.ProgressToken @@ -162,21 +192,29 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.CallHierarchyItem +--- ---The name of this item. ---@field name string +--- ---The kind of this item. ---@field kind lsp.SymbolKind +--- ---Tags for this item. ---@field tags? lsp.SymbolTag[] +--- ---More detail for this item, e.g. the signature of a function. ---@field detail? string +--- ---The resource identifier of this item. ---@field uri lsp.DocumentUri +--- ---The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. ---@field range lsp.Range +--- ---The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. ---Must be contained by the {@link CallHierarchyItem.range `range`}. ---@field selectionRange lsp.Range +--- ---A data entry field that is preserved between a call hierarchy prepare and ---incoming calls or outgoing calls requests. ---@field data? lsp.LSPAny @@ -184,20 +222,23 @@ error('Cannot require a meta file') ---Call hierarchy options used during static or dynamic registration. --- ---@since 3.16.0 ----@class lsp.CallHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.CallHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CallHierarchyOptions, lsp.StaticRegistrationOptions ---The parameter of a `callHierarchy/incomingCalls` request. --- ---@since 3.16.0 ----@class lsp.CallHierarchyIncomingCallsParams +---@class lsp.CallHierarchyIncomingCallsParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---@field item lsp.CallHierarchyItem ---Represents an incoming call, e.g. a caller of a method or constructor. --- ---@since 3.16.0 ---@class lsp.CallHierarchyIncomingCall +--- ---The item that makes the call. ---@field from lsp.CallHierarchyItem +--- ---The ranges at which the calls appear. This is relative to the caller ---denoted by {@link CallHierarchyIncomingCall.from `this.from`}. ---@field fromRanges lsp.Range[] @@ -205,64 +246,78 @@ error('Cannot require a meta file') ---The parameter of a `callHierarchy/outgoingCalls` request. --- ---@since 3.16.0 ----@class lsp.CallHierarchyOutgoingCallsParams +---@class lsp.CallHierarchyOutgoingCallsParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---@field item lsp.CallHierarchyItem ---Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. --- ---@since 3.16.0 ---@class lsp.CallHierarchyOutgoingCall +--- ---The item that is called. ---@field to lsp.CallHierarchyItem +--- ---The range at which this item is called. This is the range relative to the caller, e.g the item ---passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} ---and not {@link CallHierarchyOutgoingCall.to `this.to`}. ---@field fromRanges lsp.Range[] ---@since 3.16.0 ----@class lsp.SemanticTokensParams +---@class lsp.SemanticTokensParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier ---@since 3.16.0 ---@class lsp.SemanticTokens +--- ---An optional result id. If provided and clients support delta updating ---the client will include the result id in the next semantic token request. ---A server can then instead of computing all semantic tokens again simply ---send a delta. ---@field resultId? string +--- ---The actual tokens. ---@field data uinteger[] ---@since 3.16.0 ---@class lsp.SemanticTokensPartialResult +--- ---@field data uinteger[] ---@since 3.16.0 ----@class lsp.SemanticTokensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.SemanticTokensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SemanticTokensOptions, lsp.StaticRegistrationOptions ---@since 3.16.0 ----@class lsp.SemanticTokensDeltaParams +---@class lsp.SemanticTokensDeltaParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The result id of a previous response. The result Id can either point to a full response ---or a delta response depending on what was received last. ---@field previousResultId string ---@since 3.16.0 ---@class lsp.SemanticTokensDelta +--- ---@field resultId? string +--- ---The semantic token edits to transform a previous result into a new result. ---@field edits lsp.SemanticTokensEdit[] ---@since 3.16.0 ---@class lsp.SemanticTokensDeltaPartialResult +--- ---@field edits lsp.SemanticTokensEdit[] ---@since 3.16.0 ----@class lsp.SemanticTokensRangeParams +---@class lsp.SemanticTokensRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The range the semantic tokens are requested for. ---@field range lsp.Range @@ -270,17 +325,21 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.ShowDocumentParams +--- ---The uri to show. ---@field uri lsp.URI +--- ---Indicates to show the resource in an external program. ---To show, for example, `https://code.visualstudio.com/` ---in the default WEB browser set `external` to `true`. ---@field external? boolean +--- ---An optional property to indicate whether the editor ---showing the document should take focus or not. ---Clients might ignore this property if an external ---program is started. ---@field takeFocus? boolean +--- ---An optional selection range if the document is a text ---document. Clients might ignore the property if an ---external program is started or the file is not a text @@ -291,6 +350,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.ShowDocumentResult +--- ---A boolean indicating if the show was successful. ---@field success boolean @@ -300,21 +360,24 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.LinkedEditingRanges +--- ---A list of ranges that can be edited together. The ranges must have ---identical length and contain identical text content. The ranges cannot overlap. ---@field ranges lsp.Range[] +--- ---An optional word pattern (regular expression) that describes valid contents for ---the given ranges. If no pattern is provided, the client configuration's word ---pattern will be used. ---@field wordPattern? string ----@class lsp.LinkedEditingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.LinkedEditingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.LinkedEditingRangeOptions, lsp.StaticRegistrationOptions ---The parameters sent in notifications/requests for user-initiated creation of ---files. --- ---@since 3.16.0 ---@class lsp.CreateFilesParams +--- ---An array of all files/folders created in this operation. ---@field files lsp.FileCreate[] @@ -331,8 +394,10 @@ error('Cannot require a meta file') ---cause failure of the operation. How the client recovers from the failure is described by ---the client capability: `workspace.workspaceEdit.failureHandling` ---@class lsp.WorkspaceEdit +--- ---Holds changes to existing resources. ---@field changes? table +--- ---Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes ---are either an array of `TextDocumentEdit`s to express changes to n different text documents ---where each text document edit addresses a specific version of a text document. Or it can contain @@ -344,6 +409,7 @@ error('Cannot require a meta file') ---If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then ---only plain `TextEdit`s using the `changes` property are supported. ---@field documentChanges? lsp.TextDocumentEdit|lsp.CreateFile|lsp.RenameFile|lsp.DeleteFile[] +--- ---A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and ---delete file / folder operations. --- @@ -356,6 +422,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationRegistrationOptions +--- ---The actual filters. ---@field filters lsp.FileOperationFilter[] @@ -364,6 +431,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.RenameFilesParams +--- ---An array of all files/folders renamed in this operation. When a folder is renamed, only ---the folder will be included, and not its children. ---@field files lsp.FileRename[] @@ -373,6 +441,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.DeleteFilesParams +--- ---An array of all files/folders deleted in this operation. ---@field files lsp.FileDelete[] @@ -382,17 +451,21 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.Moniker +--- ---The scheme of the moniker. For example tsc or .Net ---@field scheme string +--- ---The identifier of the moniker. The value is opaque in LSIF however ---schema owners are allowed to define the structure if they want. ---@field identifier string +--- ---The scope in which the moniker is unique ---@field unique lsp.UniquenessLevel +--- ---The moniker kind if known. ---@field kind? lsp.MonikerKind ----@class lsp.MonikerRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.MonikerRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.MonikerOptions ---The parameter of a `textDocument/prepareTypeHierarchy` request. --- @@ -401,23 +474,31 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@class lsp.TypeHierarchyItem +--- ---The name of this item. ---@field name string +--- ---The kind of this item. ---@field kind lsp.SymbolKind +--- ---Tags for this item. ---@field tags? lsp.SymbolTag[] +--- ---More detail for this item, e.g. the signature of a function. ---@field detail? string +--- ---The resource identifier of this item. ---@field uri lsp.DocumentUri +--- ---The range enclosing this symbol not including leading/trailing whitespace ---but everything else, e.g. comments and code. ---@field range lsp.Range +--- ---The range that should be selected and revealed when this symbol is being ---picked, e.g. the name of a function. Must be contained by the ---{@link TypeHierarchyItem.range `range`}. ---@field selectionRange lsp.Range +--- ---A data entry field that is preserved between a type hierarchy prepare and ---supertypes or subtypes requests. It could also be used to identify the ---type hierarchy in the server, helping improve the performance on @@ -427,28 +508,33 @@ error('Cannot require a meta file') ---Type hierarchy options used during static or dynamic registration. --- ---@since 3.17.0 ----@class lsp.TypeHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.TypeHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.TypeHierarchyOptions, lsp.StaticRegistrationOptions ---The parameter of a `typeHierarchy/supertypes` request. --- ---@since 3.17.0 ----@class lsp.TypeHierarchySupertypesParams +---@class lsp.TypeHierarchySupertypesParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---@field item lsp.TypeHierarchyItem ---The parameter of a `typeHierarchy/subtypes` request. --- ---@since 3.17.0 ----@class lsp.TypeHierarchySubtypesParams +---@class lsp.TypeHierarchySubtypesParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---@field item lsp.TypeHierarchyItem ---A parameter literal used in inline value requests. --- ---@since 3.17.0 ----@class lsp.InlineValueParams +---@class lsp.InlineValueParams: lsp.WorkDoneProgressParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The document range for which inline values should be computed. ---@field range lsp.Range +--- ---Additional information about the context in which inline values were ---requested. ---@field context lsp.InlineValueContext @@ -456,14 +542,16 @@ error('Cannot require a meta file') ---Inline value options used during static or dynamic registration. --- ---@since 3.17.0 ----@class lsp.InlineValueRegistrationOptions: lsp.InlineValueOptions, lsp.StaticRegistrationOptions +---@class lsp.InlineValueRegistrationOptions: lsp.InlineValueOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions ---A parameter literal used in inlay hint requests. --- ---@since 3.17.0 ----@class lsp.InlayHintParams +---@class lsp.InlayHintParams: lsp.WorkDoneProgressParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The document range for which inlay hints should be computed. ---@field range lsp.Range @@ -471,39 +559,47 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlayHint +--- ---The position of this hint. --- ---If multiple hints have the same position, they will be shown in the order ---they appear in the response. ---@field position lsp.Position +--- ---The label of this hint. A human readable string or an array of ---InlayHintLabelPart label parts. --- ---*Note* that neither the string nor the label part can be empty. ---@field label string|lsp.InlayHintLabelPart[] +--- ---The kind of this hint. Can be omitted in which case the client ---should fall back to a reasonable default. ---@field kind? lsp.InlayHintKind +--- ---Optional text edits that are performed when accepting this inlay hint. --- ---*Note* that edits are expected to change the document so that the inlay ---hint (or its nearest variant) is now part of the document and the inlay ---hint itself is now obsolete. ---@field textEdits? lsp.TextEdit[] +--- ---The tooltip text when you hover over this item. ---@field tooltip? string|lsp.MarkupContent +--- ---Render padding before the hint. --- ---Note: Padding should use the editor's background color, not the ---background color of the hint itself. That means padding can be used ---to visually align/separate an inlay hint. ---@field paddingLeft? boolean +--- ---Render padding after the hint. --- ---Note: Padding should use the editor's background color, not the ---background color of the hint itself. That means padding can be used ---to visually align/separate an inlay hint. ---@field paddingRight? boolean +--- ---A data entry field that is preserved on an inlay hint between ---a `textDocument/inlayHint` and a `inlayHint/resolve` request. ---@field data? lsp.LSPAny @@ -511,16 +607,19 @@ error('Cannot require a meta file') ---Inlay hint options used during static or dynamic registration. --- ---@since 3.17.0 ----@class lsp.InlayHintRegistrationOptions: lsp.InlayHintOptions, lsp.StaticRegistrationOptions +---@class lsp.InlayHintRegistrationOptions: lsp.InlayHintOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions ---Parameters of the document diagnostic request. --- ---@since 3.17.0 ----@class lsp.DocumentDiagnosticParams +---@class lsp.DocumentDiagnosticParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The additional identifier provided during registration. ---@field identifier? string +--- ---The result id of a previous response if provided. ---@field previousResultId? string @@ -528,25 +627,29 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.DocumentDiagnosticReportPartialResult +--- ---@field relatedDocuments table ---Cancellation data returned from a diagnostic request. --- ---@since 3.17.0 ---@class lsp.DiagnosticServerCancellationData +--- ---@field retriggerRequest boolean ---Diagnostic registration options. --- ---@since 3.17.0 ----@class lsp.DiagnosticRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions +---@class lsp.DiagnosticRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DiagnosticOptions, lsp.StaticRegistrationOptions ---Parameters of the workspace diagnostic request. --- ---@since 3.17.0 ----@class lsp.WorkspaceDiagnosticParams +---@class lsp.WorkspaceDiagnosticParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The additional identifier provided during registration. ---@field identifier? string +--- ---The currently known diagnostic reports with their ---previous result ids. ---@field previousResultIds lsp.PreviousResultId[] @@ -555,20 +658,24 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.WorkspaceDiagnosticReport +--- ---@field items lsp.WorkspaceDocumentDiagnosticReport[] ---A partial result for a workspace diagnostic report. --- ---@since 3.17.0 ---@class lsp.WorkspaceDiagnosticReportPartialResult +--- ---@field items lsp.WorkspaceDocumentDiagnosticReport[] ---The params sent in an open notebook document notification. --- ---@since 3.17.0 ---@class lsp.DidOpenNotebookDocumentParams +--- ---The notebook document that got opened. ---@field notebookDocument lsp.NotebookDocument +--- ---The text documents that represent the content ---of a notebook cell. ---@field cellTextDocuments lsp.TextDocumentItem[] @@ -577,11 +684,13 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.DidChangeNotebookDocumentParams +--- ---The notebook document that did change. The version number points ---to the version after all provided changes have been applied. If ---only the text document content of a cell changes the notebook version ---doesn't necessarily have to change. ---@field notebookDocument lsp.VersionedNotebookDocumentIdentifier +--- ---The actual changes to the notebook document. --- ---The changes describe single state changes to the notebook document. @@ -601,6 +710,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.DidSaveNotebookDocumentParams +--- ---The notebook document that got saved. ---@field notebookDocument lsp.NotebookDocumentIdentifier @@ -608,8 +718,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.DidCloseNotebookDocumentParams +--- ---The notebook document that got closed. ---@field notebookDocument lsp.NotebookDocumentIdentifier +--- ---The text documents that represent the content ---of a notebook cell that got closed. ---@field cellTextDocuments lsp.TextDocumentIdentifier[] @@ -619,6 +731,7 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.InlineCompletionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams +--- ---Additional information about the context in which inline completions were ---requested. ---@field context lsp.InlineCompletionContext @@ -628,6 +741,7 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.InlineCompletionList +--- ---The inline completion items ---@field items lsp.InlineCompletionItem[] @@ -636,12 +750,16 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.InlineCompletionItem +--- ---The text to replace the range with. Must be set. ---@field insertText string|lsp.StringValue +--- ---A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used. ---@field filterText? string +--- ---The range to replace. Must begin and end on the same line. ---@field range? lsp.Range +--- ---An optional {@link Command} that is executed *after* inserting this completion. ---@field command? lsp.Command @@ -649,28 +767,33 @@ error('Cannot require a meta file') --- ---@since 3.18.0 ---@proposed ----@class lsp.InlineCompletionRegistrationOptions: lsp.InlineCompletionOptions, lsp.StaticRegistrationOptions +---@class lsp.InlineCompletionRegistrationOptions: lsp.InlineCompletionOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions ---@class lsp.RegistrationParams +--- ---@field registrations lsp.Registration[] ---@class lsp.UnregistrationParams +--- ---@field unregisterations lsp.Unregistration[] ----@class lsp.InitializeParams: lsp._InitializeParams +---@class lsp.InitializeParams: lsp._InitializeParams, lsp.WorkspaceFoldersInitializeParams ---The result returned from an initialize request. ---@class lsp.InitializeResult +--- ---The capabilities the language server provides. ---@field capabilities lsp.ServerCapabilities +--- ---Information about the server. --- ---@since 3.15.0 ----@field serverInfo? anonym1 +---@field serverInfo? lsp._anonym1.serverInfo ---The data type of the ResponseError if the ---initialize request fails. ---@class lsp.InitializeError +--- ---Indicates whether the client execute the following retry logic: ---(1) show the message provided by the ResponseError to the user ---(2) user selects retry or cancel @@ -681,49 +804,62 @@ error('Cannot require a meta file') ---The parameters of a change configuration notification. ---@class lsp.DidChangeConfigurationParams +--- ---The actual changed settings ---@field settings lsp.LSPAny ---@class lsp.DidChangeConfigurationRegistrationOptions +--- ---@field section? string|string[] ---The parameters of a notification message. ---@class lsp.ShowMessageParams +--- ---The message type. See {@link MessageType} ---@field type lsp.MessageType +--- ---The actual message. ---@field message string ---@class lsp.ShowMessageRequestParams +--- ---The message type. See {@link MessageType} ---@field type lsp.MessageType +--- ---The actual message. ---@field message string +--- ---The message action items to present. ---@field actions? lsp.MessageActionItem[] ---@class lsp.MessageActionItem +--- ---A short title like 'Retry', 'Open Log' etc. ---@field title string ---The log message parameters. ---@class lsp.LogMessageParams +--- ---The message type. See {@link MessageType} ---@field type lsp.MessageType +--- ---The actual message. ---@field message string ---The parameters sent in an open text document notification ---@class lsp.DidOpenTextDocumentParams +--- ---The document that was opened. ---@field textDocument lsp.TextDocumentItem ---The change text document notification's parameters. ---@class lsp.DidChangeTextDocumentParams +--- ---The document that did change. The version number points ---to the version after all provided content changes have ---been applied. ---@field textDocument lsp.VersionedTextDocumentIdentifier +--- ---The actual content changes. The content changes describe single state changes ---to the document. So if there are two content changes c1 (at array index 0) and ---c2 (at array index 1) for a document in state S then c1 moves the document from @@ -739,64 +875,78 @@ error('Cannot require a meta file') ---Describe options to be used when registered for text document change events. ---@class lsp.TextDocumentChangeRegistrationOptions: lsp.TextDocumentRegistrationOptions +--- ---How documents are synced to the server. ---@field syncKind lsp.TextDocumentSyncKind ---The parameters sent in a close text document notification ---@class lsp.DidCloseTextDocumentParams +--- ---The document that was closed. ---@field textDocument lsp.TextDocumentIdentifier ---The parameters sent in a save text document notification ---@class lsp.DidSaveTextDocumentParams +--- ---The document that was saved. ---@field textDocument lsp.TextDocumentIdentifier +--- ---Optional the content when saved. Depends on the includeText value ---when the save notification was requested. ---@field text? string ---Save registration options. ----@class lsp.TextDocumentSaveRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.TextDocumentSaveRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SaveOptions ---The parameters sent in a will save text document notification. ---@class lsp.WillSaveTextDocumentParams +--- ---The document that will be saved. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The 'TextDocumentSaveReason'. ---@field reason lsp.TextDocumentSaveReason ---A text edit applicable to a text document. ---@class lsp.TextEdit +--- ---The range of the text document to be manipulated. To insert ---text into a document create a range where start === end. ---@field range lsp.Range +--- ---The string to be inserted. For delete operations use an ---empty string. ---@field newText string ---The watched files change notification's parameters. ---@class lsp.DidChangeWatchedFilesParams +--- ---The actual file events. ---@field changes lsp.FileEvent[] ---Describe options to be used when registered for text document change events. ---@class lsp.DidChangeWatchedFilesRegistrationOptions +--- ---The watchers to register. ---@field watchers lsp.FileSystemWatcher[] ---The publish diagnostic notification's parameters. ---@class lsp.PublishDiagnosticsParams +--- ---The URI for which diagnostic information is reported. ---@field uri lsp.DocumentUri +--- ---Optional the version number of the document the diagnostics are published for. --- ---@since 3.15.0 ---@field version? integer +--- ---An array of diagnostic information items. ---@field diagnostics lsp.Diagnostic[] ---Completion parameters ---@class lsp.CompletionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The completion context. This is only available it the client specifies ---to send this using the client capability `textDocument.completion.contextSupport === true` ---@field context? lsp.CompletionContext @@ -804,6 +954,7 @@ error('Cannot require a meta file') ---A completion item represents a text snippet that is ---proposed to complete text that is being typed. ---@class lsp.CompletionItem +--- ---The label of this completion item. --- ---The label property is also by default the text that @@ -812,39 +963,49 @@ error('Cannot require a meta file') ---If label details are provided the label itself should ---be an unqualified name of the completion item. ---@field label string +--- ---Additional details for the label --- ---@since 3.17.0 ---@field labelDetails? lsp.CompletionItemLabelDetails +--- ---The kind of this completion item. Based of the kind ---an icon is chosen by the editor. ---@field kind? lsp.CompletionItemKind +--- ---Tags for this completion item. --- ---@since 3.15.0 ---@field tags? lsp.CompletionItemTag[] +--- ---A human-readable string with additional information ---about this item, like type or symbol information. ---@field detail? string +--- ---A human-readable string that represents a doc-comment. ---@field documentation? string|lsp.MarkupContent +--- ---Indicates if this item is deprecated. ---@deprecated Use `tags` instead. ---@field deprecated? boolean +--- ---Select this item when showing. --- ---*Note* that only one completion item can be selected and that the ---tool / client decides which item that is. The rule is that the *first* ---item of those that match best is selected. ---@field preselect? boolean +--- ---A string that should be used when comparing this item ---with other items. When `falsy` the {@link CompletionItem.label label} ---is used. ---@field sortText? string +--- ---A string that should be used when filtering a set of ---completion items. When `falsy` the {@link CompletionItem.label label} ---is used. ---@field filterText? string +--- ---A string that should be inserted into a document when selecting ---this completion. When `falsy` the {@link CompletionItem.label label} ---is used. @@ -857,6 +1018,7 @@ error('Cannot require a meta file') ---recommended to use `textEdit` instead since it avoids additional client ---side interpretation. ---@field insertText? string +--- ---The format of the insert text. The format applies to both the ---`insertText` property and the `newText` property of a provided ---`textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. @@ -864,12 +1026,14 @@ error('Cannot require a meta file') ---Please note that the insertTextFormat doesn't apply to ---`additionalTextEdits`. ---@field insertTextFormat? lsp.InsertTextFormat +--- ---How whitespace and indentation is handled during completion ---item insertion. If not provided the clients default value depends on ---the `textDocument.completion.insertTextMode` client capability. --- ---@since 3.16.0 ---@field insertTextMode? lsp.InsertTextMode +--- ---An {@link TextEdit edit} which is applied to a document when selecting ---this completion. When an edit is provided the value of ---{@link CompletionItem.insertText insertText} is ignored. @@ -891,6 +1055,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 additional type `InsertReplaceEdit` ---@field textEdit? lsp.TextEdit|lsp.InsertReplaceEdit +--- ---The edit text used if the completion item is part of a CompletionList and ---CompletionList defines an item default for the text edit range. --- @@ -902,6 +1067,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@field textEditText? string +--- ---An optional array of additional {@link TextEdit text edits} that are applied when ---selecting this completion. Edits must not overlap (including the same insert position) ---with the main {@link CompletionItem.textEdit edit} nor with themselves. @@ -910,14 +1076,17 @@ error('Cannot require a meta file') ---(for example adding an import statement at the top of the file if the completion item will ---insert an unqualified type). ---@field additionalTextEdits? lsp.TextEdit[] +--- ---An optional set of characters that when pressed while this completion is active will accept it first and ---then type that character. *Note* that all commit characters should have `length=1` and that superfluous ---characters will be ignored. ---@field commitCharacters? string[] +--- ---An optional {@link Command command} that is executed *after* inserting this completion. *Note* that ---additional modifications to the current document should be described with the ---{@link CompletionItem.additionalTextEdits additionalTextEdits}-property. ---@field command? lsp.Command +--- ---A data entry field that is preserved on a completion item between a ---{@link CompletionRequest} and a {@link CompletionResolveRequest}. ---@field data? lsp.LSPAny @@ -925,11 +1094,13 @@ error('Cannot require a meta file') ---Represents a collection of {@link CompletionItem completion items} to be presented ---in the editor. ---@class lsp.CompletionList +--- ---This list it not complete. Further typing results in recomputing this list. --- ---Recomputed lists have all their items replaced (not appended) in the ---incomplete completion sessions. ---@field isIncomplete boolean +--- ---In many cases the items of an actual completion result share the same ---value for properties like `commitCharacters` or the range of a text ---edit. A completion list can therefore define item defaults which will @@ -943,29 +1114,33 @@ error('Cannot require a meta file') ---capability. --- ---@since 3.17.0 ----@field itemDefaults? anonym3 +---@field itemDefaults? lsp._anonym2.itemDefaults +--- ---The completion items. ---@field items lsp.CompletionItem[] ---Registration options for a {@link CompletionRequest}. ----@class lsp.CompletionRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.CompletionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CompletionOptions ---Parameters for a {@link HoverRequest}. ---@class lsp.HoverParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams ---The result of a hover request. ---@class lsp.Hover +--- ---The hover's content ---@field contents lsp.MarkupContent|lsp.MarkedString|lsp.MarkedString[] +--- ---An optional range inside the text document that is used to ---visualize the hover, e.g. by changing the background color. ---@field range? lsp.Range ---Registration options for a {@link HoverRequest}. ----@class lsp.HoverRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.HoverRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.HoverOptions ---Parameters for a {@link SignatureHelpRequest}. ---@class lsp.SignatureHelpParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams +--- ---The signature help context. This is only available if the client specifies ---to send this using the client capability `textDocument.signatureHelp.contextSupport === true` --- @@ -976,8 +1151,10 @@ error('Cannot require a meta file') ---callable. There can be multiple signature but only one ---active and only one active parameter. ---@class lsp.SignatureHelp +--- ---One or more signatures. ---@field signatures lsp.SignatureInformation[] +--- ---The active signature. If omitted or the value lies outside the ---range of `signatures` the value defaults to zero or is ignored if ---the `SignatureHelp` has no signatures. @@ -988,6 +1165,7 @@ error('Cannot require a meta file') ---In future version of the protocol this property might become ---mandatory to better express this. ---@field activeSignature? uinteger +--- ---The active parameter of the active signature. --- ---If `null`, no parameter of the signature is active (for example a named @@ -1007,20 +1185,21 @@ error('Cannot require a meta file') ---@field activeParameter? uinteger|lsp.null ---Registration options for a {@link SignatureHelpRequest}. ----@class lsp.SignatureHelpRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.SignatureHelpRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SignatureHelpOptions ---Parameters for a {@link DefinitionRequest}. ---@class lsp.DefinitionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams ---Registration options for a {@link DefinitionRequest}. ----@class lsp.DefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DefinitionOptions ---Parameters for a {@link ReferencesRequest}. ---@class lsp.ReferenceParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---@field context lsp.ReferenceContext ---Registration options for a {@link ReferencesRequest}. ----@class lsp.ReferenceRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.ReferenceRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.ReferenceOptions ---Parameters for a {@link DocumentHighlightRequest}. ---@class lsp.DocumentHighlightParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams @@ -1029,26 +1208,31 @@ error('Cannot require a meta file') ---special attention. Usually a document highlight is visualized by changing ---the background color of its range. ---@class lsp.DocumentHighlight +--- ---The range this highlight applies to. ---@field range lsp.Range +--- ---The highlight kind, default is {@link DocumentHighlightKind.Text text}. ---@field kind? lsp.DocumentHighlightKind ---Registration options for a {@link DocumentHighlightRequest}. ----@class lsp.DocumentHighlightRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentHighlightRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentHighlightOptions ---Parameters for a {@link DocumentSymbolRequest}. ----@class lsp.DocumentSymbolParams +---@class lsp.DocumentSymbolParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier ---Represents information about programming constructs like variables, classes, ---interfaces etc. ---@class lsp.SymbolInformation: lsp.BaseSymbolInformation +--- ---Indicates if this symbol is deprecated. --- ---@deprecated Use tags instead ---@field deprecated? boolean +--- ---The location of this symbol. The location's range is used by a tool ---to reveal the location in the editor. If the symbol is selected in the ---tool the range's start information is used to position the cursor. So @@ -1065,40 +1249,51 @@ error('Cannot require a meta file') ---have two ranges: one that encloses its definition and one that points to ---its most interesting range, e.g. the range of an identifier. ---@class lsp.DocumentSymbol +--- ---The name of this symbol. Will be displayed in the user interface and therefore must not be ---an empty string or a string only consisting of white spaces. ---@field name string +--- ---More detail for this symbol, e.g the signature of a function. ---@field detail? string +--- ---The kind of this symbol. ---@field kind lsp.SymbolKind +--- ---Tags for this document symbol. --- ---@since 3.16.0 ---@field tags? lsp.SymbolTag[] +--- ---Indicates if this symbol is deprecated. --- ---@deprecated Use tags instead ---@field deprecated? boolean +--- ---The range enclosing this symbol not including leading/trailing whitespace but everything else ---like comments. This information is typically used to determine if the clients cursor is ---inside the symbol to reveal in the symbol in the UI. ---@field range lsp.Range +--- ---The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. ---Must be contained by the `range`. ---@field selectionRange lsp.Range +--- ---Children of this symbol, e.g. properties of a class. ---@field children? lsp.DocumentSymbol[] ---Registration options for a {@link DocumentSymbolRequest}. ----@class lsp.DocumentSymbolRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentSymbolRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentSymbolOptions ---The parameters of a {@link CodeActionRequest}. ----@class lsp.CodeActionParams +---@class lsp.CodeActionParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The document in which the command was invoked. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The range for which the command was invoked. ---@field range lsp.Range +--- ---Context carrying additional information. ---@field context lsp.CodeActionContext @@ -1107,10 +1302,13 @@ error('Cannot require a meta file') ---an array of arguments which will be passed to the command handler ---function when invoked. ---@class lsp.Command +--- ---Title of the command, like `save`. ---@field title string +--- ---The identifier of the actual command handler. ---@field command string +--- ---Arguments that the command handler should be ---invoked with. ---@field arguments? lsp.LSPAny[] @@ -1120,14 +1318,18 @@ error('Cannot require a meta file') --- ---A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. ---@class lsp.CodeAction +--- ---A short, human-readable, title for this code action. ---@field title string +--- ---The kind of the code action. --- ---Used to filter code actions. ---@field kind? lsp.CodeActionKind +--- ---The diagnostics that this code action resolves. ---@field diagnostics? lsp.Diagnostic[] +--- ---Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted ---by keybindings. --- @@ -1136,6 +1338,7 @@ error('Cannot require a meta file') --- ---@since 3.15.0 ---@field isPreferred? boolean +--- ---Marks that the code action cannot currently be applied. --- ---Clients should follow the following guidelines regarding disabled code actions: @@ -1151,13 +1354,16 @@ error('Cannot require a meta file') --- error message with `reason` in the editor. --- ---@since 3.16.0 ----@field disabled? anonym4 +---@field disabled? lsp._anonym4.disabled +--- ---The workspace edit this code action performs. ---@field edit? lsp.WorkspaceEdit +--- ---A command this code action executes. If a code action ---provides an edit and a command, first the edit is ---executed and then the command. ---@field command? lsp.Command +--- ---A data entry field that is preserved on a code action between ---a `textDocument/codeAction` and a `codeAction/resolve` request. --- @@ -1165,10 +1371,11 @@ error('Cannot require a meta file') ---@field data? lsp.LSPAny ---Registration options for a {@link CodeActionRequest}. ----@class lsp.CodeActionRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.CodeActionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CodeActionOptions ---The parameters of a {@link WorkspaceSymbolRequest}. ----@class lsp.WorkspaceSymbolParams +---@class lsp.WorkspaceSymbolParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---A query string to filter symbols by. Clients may send an empty ---string here to request all symbols. ---@field query string @@ -1179,12 +1386,14 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.WorkspaceSymbol: lsp.BaseSymbolInformation +--- ---The location of the symbol. Whether a server is allowed to ---return a location without a range depends on the client ---capability `workspace.symbol.resolveSupport`. --- ---See SymbolInformation#location for more details. ----@field location lsp.Location|anonym5 +---@field location lsp.Location|lsp._anonym5.location +--- ---A data entry field that is preserved on a workspace symbol between a ---workspace symbol request and a workspace symbol resolve request. ---@field data? lsp.LSPAny @@ -1193,7 +1402,8 @@ error('Cannot require a meta file') ---@class lsp.WorkspaceSymbolRegistrationOptions: lsp.WorkspaceSymbolOptions ---The parameters of a {@link CodeLensRequest}. ----@class lsp.CodeLensParams +---@class lsp.CodeLensParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The document to request code lens for. ---@field textDocument lsp.TextDocumentIdentifier @@ -1203,29 +1413,36 @@ error('Cannot require a meta file') ---A code lens is _unresolved_ when no command is associated to it. For performance ---reasons the creation of a code lens and resolving should be done in two stages. ---@class lsp.CodeLens +--- ---The range in which this code lens is valid. Should only span a single line. ---@field range lsp.Range +--- ---The command this code lens represents. ---@field command? lsp.Command +--- ---A data entry field that is preserved on a code lens item between ---a {@link CodeLensRequest} and a {@link CodeLensResolveRequest} ---@field data? lsp.LSPAny ---Registration options for a {@link CodeLensRequest}. ----@class lsp.CodeLensRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.CodeLensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CodeLensOptions ---The parameters of a {@link DocumentLinkRequest}. ----@class lsp.DocumentLinkParams +---@class lsp.DocumentLinkParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams +--- ---The document to provide document links for. ---@field textDocument lsp.TextDocumentIdentifier ---A document link is a range in a text document that links to an internal or external resource, like another ---text document or a web site. ---@class lsp.DocumentLink +--- ---The range this link applies to. ---@field range lsp.Range +--- ---The uri this link points to. If missing a resolve request is sent later. ---@field target? lsp.URI +--- ---The tooltip text when you hover over this link. --- ---If a tooltip is provided, is will be displayed in a string that includes instructions on how to @@ -1234,86 +1451,104 @@ error('Cannot require a meta file') --- ---@since 3.15.0 ---@field tooltip? string +--- ---A data entry field that is preserved on a document link between a ---DocumentLinkRequest and a DocumentLinkResolveRequest. ---@field data? lsp.LSPAny ---Registration options for a {@link DocumentLinkRequest}. ----@class lsp.DocumentLinkRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentLinkRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentLinkOptions ---The parameters of a {@link DocumentFormattingRequest}. ----@class lsp.DocumentFormattingParams +---@class lsp.DocumentFormattingParams: lsp.WorkDoneProgressParams +--- ---The document to format. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The format options. ---@field options lsp.FormattingOptions ---Registration options for a {@link DocumentFormattingRequest}. ----@class lsp.DocumentFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentFormattingOptions ---The parameters of a {@link DocumentRangeFormattingRequest}. ----@class lsp.DocumentRangeFormattingParams +---@class lsp.DocumentRangeFormattingParams: lsp.WorkDoneProgressParams +--- ---The document to format. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The range to format ---@field range lsp.Range +--- ---The format options ---@field options lsp.FormattingOptions ---Registration options for a {@link DocumentRangeFormattingRequest}. ----@class lsp.DocumentRangeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentRangeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentRangeFormattingOptions ---The parameters of a {@link DocumentRangesFormattingRequest}. --- ---@since 3.18.0 ---@proposed ----@class lsp.DocumentRangesFormattingParams +---@class lsp.DocumentRangesFormattingParams: lsp.WorkDoneProgressParams +--- ---The document to format. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The ranges to format ---@field ranges lsp.Range[] +--- ---The format options ---@field options lsp.FormattingOptions ---The parameters of a {@link DocumentOnTypeFormattingRequest}. ---@class lsp.DocumentOnTypeFormattingParams +--- ---The document to format. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The position around which the on type formatting should happen. ---This is not necessarily the exact position where the character denoted ---by the property `ch` got typed. ---@field position lsp.Position +--- ---The character that has been typed that triggered the formatting ---on type request. That is not necessarily the last character that ---got inserted into the document since the client could auto insert ---characters as well (e.g. like automatic brace completion). ---@field ch string +--- ---The formatting options. ---@field options lsp.FormattingOptions ---Registration options for a {@link DocumentOnTypeFormattingRequest}. ----@class lsp.DocumentOnTypeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.DocumentOnTypeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentOnTypeFormattingOptions ---The parameters of a {@link RenameRequest}. ----@class lsp.RenameParams +---@class lsp.RenameParams: lsp.WorkDoneProgressParams +--- ---The document to rename. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The position at which this request was sent. ---@field position lsp.Position +--- ---The new name of the symbol. If the given name is not valid the ---request must return a {@link ResponseError} with an ---appropriate message set. ---@field newName string ---Registration options for a {@link RenameRequest}. ----@class lsp.RenameRegistrationOptions: lsp.TextDocumentRegistrationOptions +---@class lsp.RenameRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.RenameOptions ---@class lsp.PrepareRenameParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams ---The parameters of a {@link ExecuteCommandRequest}. ----@class lsp.ExecuteCommandParams +---@class lsp.ExecuteCommandParams: lsp.WorkDoneProgressParams +--- ---The identifier of the actual command handler. ---@field command string +--- ---Arguments that the command should be invoked with. ---@field arguments? lsp.LSPAny[] @@ -1322,10 +1557,12 @@ error('Cannot require a meta file') ---The parameters passed via an apply workspace edit request. ---@class lsp.ApplyWorkspaceEditParams +--- ---An optional label of the workspace edit. This label is ---presented in the user interface for example on an undo ---stack to undo the workspace edit. ---@field label? string +--- ---The edits to apply. ---@field edit lsp.WorkspaceEdit @@ -1333,34 +1570,42 @@ error('Cannot require a meta file') --- ---@since 3.17 renamed from ApplyWorkspaceEditResponse ---@class lsp.ApplyWorkspaceEditResult +--- ---Indicates whether the edit was applied or not. ---@field applied boolean +--- ---An optional textual description for why the edit was not applied. ---This may be used by the server for diagnostic logging or to provide ---a suitable error for a request that triggered the edit. ---@field failureReason? string +--- ---Depending on the client's failure handling strategy `failedChange` might ---contain the index of the change that failed. This property is only available ---if the client signals a `failureHandlingStrategy` in its client capabilities. ---@field failedChange? uinteger ---@class lsp.WorkDoneProgressBegin +--- ---@field kind "begin" +--- ---Mandatory title of the progress operation. Used to briefly inform about ---the kind of operation being performed. --- ---Examples: "Indexing" or "Linking dependencies". ---@field title string +--- ---Controls if a cancel button should show to allow the user to cancel the ---long running operation. Clients that don't support cancellation are allowed ---to ignore the setting. ---@field cancellable? boolean +--- ---Optional, more detailed associated progress message. Contains ---complementary information to the `title`. --- ---Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". ---If unset, the previous progress message (if any) is still valid. ---@field message? string +--- ---Optional progress percentage to display (value 100 is considered 100%). ---If not provided infinite progress is assumed and clients are allowed ---to ignore the `percentage` value in subsequent in report notifications. @@ -1370,18 +1615,22 @@ error('Cannot require a meta file') ---@field percentage? uinteger ---@class lsp.WorkDoneProgressReport +--- ---@field kind "report" +--- ---Controls enablement state of a cancel button. --- ---Clients that don't support cancellation or don't support controlling the button's ---enablement state are allowed to ignore the property. ---@field cancellable? boolean +--- ---Optional, more detailed associated progress message. Contains ---complementary information to the `title`. --- ---Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". ---If unset, the previous progress message (if any) is still valid. ---@field message? string +--- ---Optional progress percentage to display (value 100 is considered 100%). ---If not provided infinite progress is assumed and clients are allowed ---to ignore the `percentage` value in subsequent in report notifications. @@ -1391,41 +1640,53 @@ error('Cannot require a meta file') ---@field percentage? uinteger ---@class lsp.WorkDoneProgressEnd +--- ---@field kind "end" +--- ---Optional, a final message indicating to for example indicate the outcome ---of the operation. ---@field message? string ---@class lsp.SetTraceParams +--- ---@field value lsp.TraceValues ---@class lsp.LogTraceParams +--- ---@field message string +--- ---@field verbose? string ---@class lsp.CancelParams +--- ---The request id to cancel. ---@field id integer|string ---@class lsp.ProgressParams +--- ---The progress token provided by the client or server. ---@field token lsp.ProgressToken +--- ---The progress data. ---@field value lsp.LSPAny ---A parameter literal used in requests to pass a text document and a position inside that ---document. ---@class lsp.TextDocumentPositionParams +--- ---The text document. ---@field textDocument lsp.TextDocumentIdentifier +--- ---The position inside the text document. ---@field position lsp.Position ---@class lsp.WorkDoneProgressParams +--- ---An optional token that a server can use to report work done progress. ---@field workDoneToken? lsp.ProgressToken ---@class lsp.PartialResultParams +--- ---An optional token that a server can use to report partial results (e.g. streaming) to ---the client. ---@field partialResultToken? lsp.ProgressToken @@ -1433,17 +1694,21 @@ error('Cannot require a meta file') ---Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, ---including an origin range. ---@class lsp.LocationLink +--- ---Span of the origin of this link. --- ---Used as the underlined span for mouse interaction. Defaults to the word range at ---the definition position. ---@field originSelectionRange? lsp.Range +--- ---The target resource identifier of this link. ---@field targetUri lsp.DocumentUri +--- ---The full target range of this link. If the target for example is a symbol then target range is the ---range enclosing this symbol not including leading/trailing whitespace but everything else ---like comments. This information is typically used to highlight the range in the editor. ---@field targetRange lsp.Range +--- ---The range that should be selected and revealed when this link is being followed, e.g the name of a function. ---Must be contained by the `targetRange`. See also `DocumentSymbol#range` ---@field targetSelectionRange lsp.Range @@ -1460,56 +1725,68 @@ error('Cannot require a meta file') ---} ---``` ---@class lsp.Range +--- ---The range's start position. ---@field start lsp.Position +--- ---The range's end position. ---@field end lsp.Position ----@class lsp.ImplementationOptions +---@class lsp.ImplementationOptions: lsp.WorkDoneProgressOptions ---Static registration options to be returned in the initialize ---request. ---@class lsp.StaticRegistrationOptions +--- ---The id used to register the request. The id can be used to deregister ---the request again. See also Registration#id. ---@field id? string ----@class lsp.TypeDefinitionOptions +---@class lsp.TypeDefinitionOptions: lsp.WorkDoneProgressOptions ---The workspace folder change event. ---@class lsp.WorkspaceFoldersChangeEvent +--- ---The array of added workspace folders ---@field added lsp.WorkspaceFolder[] +--- ---The array of the removed workspace folders ---@field removed lsp.WorkspaceFolder[] ---@class lsp.ConfigurationItem +--- ---The scope to get the configuration section for. ---@field scopeUri? lsp.URI +--- ---The configuration section asked for. ---@field section? string ---A literal to identify a text document in the client. ---@class lsp.TextDocumentIdentifier +--- ---The text document's uri. ---@field uri lsp.DocumentUri ---Represents a color in RGBA space. ---@class lsp.Color +--- ---The red component of this color in the range [0-1]. ---@field red decimal +--- ---The green component of this color in the range [0-1]. ---@field green decimal +--- ---The blue component of this color in the range [0-1]. ---@field blue decimal +--- ---The alpha component of this color in the range [0-1]. ---@field alpha decimal ----@class lsp.DocumentColorOptions +---@class lsp.DocumentColorOptions: lsp.WorkDoneProgressOptions ----@class lsp.FoldingRangeOptions +---@class lsp.FoldingRangeOptions: lsp.WorkDoneProgressOptions ----@class lsp.DeclarationOptions +---@class lsp.DeclarationOptions: lsp.WorkDoneProgressOptions ---Position in a text document expressed as zero-based line and character ---offset. Prior to 3.17 the offsets were always based on a UTF-16 string @@ -1539,11 +1816,13 @@ error('Cannot require a meta file') --- ---@since 3.17.0 - support for negotiated position encoding. ---@class lsp.Position +--- ---Line position in a document (zero-based). --- ---If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. ---If a line number is negative, it defaults to 0. ---@field line uinteger +--- ---Character offset on a line in a document (zero-based). --- ---The meaning of this offset is determined by the negotiated @@ -1553,38 +1832,45 @@ error('Cannot require a meta file') ---line length. ---@field character uinteger ----@class lsp.SelectionRangeOptions +---@class lsp.SelectionRangeOptions: lsp.WorkDoneProgressOptions ---Call hierarchy options used during static registration. --- ---@since 3.16.0 ----@class lsp.CallHierarchyOptions +---@class lsp.CallHierarchyOptions: lsp.WorkDoneProgressOptions ---@since 3.16.0 ----@class lsp.SemanticTokensOptions +---@class lsp.SemanticTokensOptions: lsp.WorkDoneProgressOptions +--- ---The legend used by the server ---@field legend lsp.SemanticTokensLegend +--- ---Server supports providing semantic tokens for a specific range ---of a document. ----@field range? boolean|anonym6 +---@field range? boolean|lsp._anonym6.range +--- ---Server supports providing semantic tokens for a full document. ----@field full? boolean|anonym7 +---@field full? boolean|lsp._anonym7.full ---@since 3.16.0 ---@class lsp.SemanticTokensEdit +--- ---The start offset of the edit. ---@field start uinteger +--- ---The count of elements to remove. ---@field deleteCount uinteger +--- ---The elements to insert. ---@field data? uinteger[] ----@class lsp.LinkedEditingRangeOptions +---@class lsp.LinkedEditingRangeOptions: lsp.WorkDoneProgressOptions ---Represents information on a file/folder create. --- ---@since 3.16.0 ---@class lsp.FileCreate +--- ---A file:// URI for the location of the file/folder being created. ---@field uri string @@ -1593,8 +1879,10 @@ error('Cannot require a meta file') ---So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any ---kind of ordering. However the edits must be non overlapping. ---@class lsp.TextDocumentEdit +--- ---The text document to change. ---@field textDocument lsp.OptionalVersionedTextDocumentIdentifier +--- ---The edits to be applied. --- ---@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a @@ -1603,30 +1891,40 @@ error('Cannot require a meta file') ---Create file operation. ---@class lsp.CreateFile: lsp.ResourceOperation +--- ---A create ---@field kind "create" +--- ---The resource to create. ---@field uri lsp.DocumentUri +--- ---Additional options ---@field options? lsp.CreateFileOptions ---Rename file operation ---@class lsp.RenameFile: lsp.ResourceOperation +--- ---A rename ---@field kind "rename" +--- ---The old (existing) location. ---@field oldUri lsp.DocumentUri +--- ---The new location. ---@field newUri lsp.DocumentUri +--- ---Rename options. ---@field options? lsp.RenameFileOptions ---Delete file operation ---@class lsp.DeleteFile: lsp.ResourceOperation +--- ---A delete ---@field kind "delete" +--- ---The file to delete. ---@field uri lsp.DocumentUri +--- ---Delete options. ---@field options? lsp.DeleteFileOptions @@ -1634,12 +1932,15 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.ChangeAnnotation +--- ---A human-readable string describing the actual change. The string ---is rendered prominent in the user interface. ---@field label string +--- ---A flag which indicates that user confirmation is needed ---before applying the change. ---@field needsConfirmation? boolean +--- ---A human-readable string which is rendered less prominent in ---the user interface. ---@field description? string @@ -1649,8 +1950,10 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationFilter +--- ---A Uri scheme like `file` or `untitled`. ---@field scheme? string +--- ---The actual file operation pattern. ---@field pattern lsp.FileOperationPattern @@ -1658,8 +1961,10 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileRename +--- ---A file:// URI for the original location of the file/folder being renamed. ---@field oldUri string +--- ---A file:// URI for the new location of the file/folder being renamed. ---@field newUri string @@ -1667,20 +1972,23 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileDelete +--- ---A file:// URI for the location of the file/folder being deleted. ---@field uri string ----@class lsp.MonikerOptions +---@class lsp.MonikerOptions: lsp.WorkDoneProgressOptions ---Type hierarchy options used during static registration. --- ---@since 3.17.0 ----@class lsp.TypeHierarchyOptions +---@class lsp.TypeHierarchyOptions: lsp.WorkDoneProgressOptions ---@since 3.17.0 ---@class lsp.InlineValueContext +--- ---The stack frame (as a DAP Id) where the execution has stopped. ---@field frameId integer +--- ---The document range where execution has stopped. ---Typically the end position of the range denotes the line where the inline values are shown. ---@field stoppedLocation lsp.Range @@ -1689,8 +1997,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlineValueText +--- ---The document range for which the inline value applies. ---@field range lsp.Range +--- ---The text of the inline value. ---@field text string @@ -1700,11 +2010,14 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlineValueVariableLookup +--- ---The document range for which the inline value applies. ---The range is used to extract the variable name from the underlying document. ---@field range lsp.Range +--- ---If specified the name of the variable to look up. ---@field variableName? string +--- ---How to perform the lookup. ---@field caseSensitiveLookup boolean @@ -1714,28 +2027,33 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlineValueEvaluatableExpression +--- ---The document range for which the inline value applies. ---The range is used to extract the evaluatable expression from the underlying document. ---@field range lsp.Range +--- ---If specified the expression overrides the extracted expression. ---@field expression? string ---Inline value options used during static registration. --- ---@since 3.17.0 ----@class lsp.InlineValueOptions +---@class lsp.InlineValueOptions: lsp.WorkDoneProgressOptions ---An inlay hint label part allows for interactive and composite labels ---of inlay hints. --- ---@since 3.17.0 ---@class lsp.InlayHintLabelPart +--- ---The value of this label part. ---@field value string +--- ---The tooltip text when you hover over this label part. Depending on ---the client capability `inlayHint.resolveSupport` clients might resolve ---this property late using the resolve request. ---@field tooltip? string|lsp.MarkupContent +--- ---An optional source code location that represents this ---label part. --- @@ -1748,6 +2066,7 @@ error('Cannot require a meta file') ---Depending on the client capability `inlayHint.resolveSupport` clients ---might resolve this property late using the resolve request. ---@field location? lsp.Location +--- ---An optional command for this label part. --- ---Depending on the client capability `inlayHint.resolveSupport` clients @@ -1777,15 +2096,18 @@ error('Cannot require a meta file') ---*Please Note* that clients might sanitize the return markdown. A client could decide to ---remove HTML from the markdown to avoid script execution. ---@class lsp.MarkupContent +--- ---The type of the Markup ---@field kind lsp.MarkupKind +--- ---The content itself ---@field value string ---Inlay hint options used during static registration. --- ---@since 3.17.0 ----@class lsp.InlayHintOptions +---@class lsp.InlayHintOptions: lsp.WorkDoneProgressOptions +--- ---The server provides support to resolve additional ---information for an inlay hint item. ---@field resolveProvider? boolean @@ -1794,6 +2116,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.RelatedFullDocumentDiagnosticReport: lsp.FullDocumentDiagnosticReport +--- ---Diagnostics of related documents. This information is useful ---in programming languages where code in a file A can generate ---diagnostics in a file B which A depends on. An example of @@ -1807,6 +2130,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.RelatedUnchangedDocumentDiagnosticReport: lsp.UnchangedDocumentDiagnosticReport +--- ---Diagnostics of related documents. This information is useful ---in programming languages where code in a file A can generate ---diagnostics in a file B which A depends on. An example of @@ -1820,12 +2144,15 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.FullDocumentDiagnosticReport +--- ---A full document diagnostic report. ---@field kind "full" +--- ---An optional result id. If provided it will ---be sent on the next diagnostic request for the ---same document. ---@field resultId? string +--- ---The actual items. ---@field items lsp.Diagnostic[] @@ -1834,11 +2161,13 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.UnchangedDocumentDiagnosticReport +--- ---A document diagnostic report indicating ---no changes to the last result. A server can ---only return `unchanged` if result ids are ---provided. ---@field kind "unchanged" +--- ---A result id which will be sent on the next ---diagnostic request for the same document. ---@field resultId string @@ -1846,15 +2175,18 @@ error('Cannot require a meta file') ---Diagnostic options. --- ---@since 3.17.0 ----@class lsp.DiagnosticOptions +---@class lsp.DiagnosticOptions: lsp.WorkDoneProgressOptions +--- ---An optional identifier under which the diagnostics are ---managed by the client. ---@field identifier? string +--- ---Whether the language has inter file dependencies meaning that ---editing code in one file can result in a different diagnostic ---set in another file. Inter file dependencies are common for ---most programming languages and typically uncommon for linters. ---@field interFileDependencies boolean +--- ---The server provides support for workspace diagnostics as well. ---@field workspaceDiagnostics boolean @@ -1862,9 +2194,11 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.PreviousResultId +--- ---The URI for which the client knowns a ---result id. ---@field uri lsp.DocumentUri +--- ---The value of the previous result id. ---@field value string @@ -1872,31 +2206,40 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookDocument +--- ---The notebook document's uri. ---@field uri lsp.URI +--- ---The type of the notebook. ---@field notebookType string +--- ---The version number of this document (it will increase after each ---change, including undo/redo). ---@field version integer +--- ---Additional metadata stored with the notebook ---document. --- ---Note: should always be an object literal (e.g. LSPObject) ---@field metadata? lsp.LSPObject +--- ---The cells of a notebook. ---@field cells lsp.NotebookCell[] ---An item to transfer a text document from the client to the ---server. ---@class lsp.TextDocumentItem +--- ---The text document's uri. ---@field uri lsp.DocumentUri +--- ---The text document's language identifier. ---@field languageId string +--- ---The version number of this document (it will increase after each ---change, including undo/redo). ---@field version integer +--- ---The content of the opened text document. ---@field text string @@ -1904,8 +2247,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.VersionedNotebookDocumentIdentifier +--- ---The version number of this notebook document. ---@field version integer +--- ---The notebook document's uri. ---@field uri lsp.URI @@ -1913,17 +2258,20 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookDocumentChangeEvent +--- ---The changed meta data if any. --- ---Note: should always be an object literal (e.g. LSPObject) ---@field metadata? lsp.LSPObject +--- ---Changes to cells ----@field cells? anonym10 +---@field cells? lsp._anonym8.cells ---A literal to identify a notebook document in the client. --- ---@since 3.17.0 ---@class lsp.NotebookDocumentIdentifier +--- ---The notebook document's uri. ---@field uri lsp.URI @@ -1932,8 +2280,10 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.InlineCompletionContext +--- ---Describes how the inline completion was triggered. ---@field triggerKind lsp.InlineCompletionTriggerKind +--- ---Provides information about the currently selected item in the autocomplete widget if it is visible. ---@field selectedCompletionInfo? lsp.SelectedCompletionInfo @@ -1948,8 +2298,10 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.StringValue +--- ---The kind of string value. ---@field kind "snippet" +--- ---The snippet string. ---@field value string @@ -1957,38 +2309,46 @@ error('Cannot require a meta file') --- ---@since 3.18.0 ---@proposed ----@class lsp.InlineCompletionOptions +---@class lsp.InlineCompletionOptions: lsp.WorkDoneProgressOptions ---General parameters to register for a notification or to register a provider. ---@class lsp.Registration +--- ---The id used to register the request. The id can be used to deregister ---the request again. ---@field id string +--- ---The method / capability to register for. ---@field method string +--- ---Options necessary for the registration. ---@field registerOptions? lsp.LSPAny ---General parameters to unregister a request or notification. ---@class lsp.Unregistration +--- ---The id used to unregister the request or notification. Usually an id ---provided during the register request. ---@field id string +--- ---The method to unregister for. ---@field method string ---The initialize parameters ----@class lsp._InitializeParams +---@class lsp._InitializeParams: lsp.WorkDoneProgressParams +--- ---The process Id of the parent process that started ---the server. --- ---Is `null` if the process has not been started by another process. ---If the parent process is not alive then the server should exit. ---@field processId integer|lsp.null +--- ---Information about the client --- ---@since 3.15.0 ----@field clientInfo? anonym11 +---@field clientInfo? lsp._anonym11.clientInfo +--- ---The locale the client is currently showing the user interface ---in. This must not necessarily be the locale of the operating ---system. @@ -1998,25 +2358,31 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@field locale? string +--- ---The rootPath of the workspace. Is null ---if no folder is open. --- ---@deprecated in favour of rootUri. ---@field rootPath? string|lsp.null +--- ---The rootUri of the workspace. Is null if no ---folder is open. If both `rootPath` and `rootUri` are set ---`rootUri` wins. --- ---@deprecated in favour of workspaceFolders. ---@field rootUri lsp.DocumentUri|lsp.null +--- ---The capabilities provided by the client (editor or tool) ---@field capabilities lsp.ClientCapabilities +--- ---User provided initialization options. ---@field initializationOptions? lsp.LSPAny +--- ---The initial trace setting. If omitted trace is disabled ('off'). ---@field trace? lsp.TraceValues ---@class lsp.WorkspaceFoldersInitializeParams +--- ---The workspace folders configured in the client when the server starts. --- ---This property is only available if the client supports workspace folders. @@ -2029,6 +2395,7 @@ error('Cannot require a meta file') ---Defines the capabilities provided by a language ---server. ---@class lsp.ServerCapabilities +--- ---The position encoding the server picked from the encodings offered ---by the client via the client capability `general.positionEncodings`. --- @@ -2039,126 +2406,167 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@field positionEncoding? lsp.PositionEncodingKind +--- ---Defines how text documents are synced. Is either a detailed structure ---defining each notification or for backwards compatibility the ---TextDocumentSyncKind number. ---@field textDocumentSync? lsp.TextDocumentSyncOptions|lsp.TextDocumentSyncKind +--- ---Defines how notebook documents are synced. --- ---@since 3.17.0 ---@field notebookDocumentSync? lsp.NotebookDocumentSyncOptions|lsp.NotebookDocumentSyncRegistrationOptions +--- ---The server provides completion support. ---@field completionProvider? lsp.CompletionOptions +--- ---The server provides hover support. ---@field hoverProvider? boolean|lsp.HoverOptions +--- ---The server provides signature help support. ---@field signatureHelpProvider? lsp.SignatureHelpOptions +--- ---The server provides Goto Declaration support. ---@field declarationProvider? boolean|lsp.DeclarationOptions|lsp.DeclarationRegistrationOptions +--- ---The server provides goto definition support. ---@field definitionProvider? boolean|lsp.DefinitionOptions +--- ---The server provides Goto Type Definition support. ---@field typeDefinitionProvider? boolean|lsp.TypeDefinitionOptions|lsp.TypeDefinitionRegistrationOptions +--- ---The server provides Goto Implementation support. ---@field implementationProvider? boolean|lsp.ImplementationOptions|lsp.ImplementationRegistrationOptions +--- ---The server provides find references support. ---@field referencesProvider? boolean|lsp.ReferenceOptions +--- ---The server provides document highlight support. ---@field documentHighlightProvider? boolean|lsp.DocumentHighlightOptions +--- ---The server provides document symbol support. ---@field documentSymbolProvider? boolean|lsp.DocumentSymbolOptions +--- ---The server provides code actions. CodeActionOptions may only be ---specified if the client states that it supports ---`codeActionLiteralSupport` in its initial `initialize` request. ---@field codeActionProvider? boolean|lsp.CodeActionOptions +--- ---The server provides code lens. ---@field codeLensProvider? lsp.CodeLensOptions +--- ---The server provides document link support. ---@field documentLinkProvider? lsp.DocumentLinkOptions +--- ---The server provides color provider support. ---@field colorProvider? boolean|lsp.DocumentColorOptions|lsp.DocumentColorRegistrationOptions +--- ---The server provides workspace symbol support. ---@field workspaceSymbolProvider? boolean|lsp.WorkspaceSymbolOptions +--- ---The server provides document formatting. ---@field documentFormattingProvider? boolean|lsp.DocumentFormattingOptions +--- ---The server provides document range formatting. ---@field documentRangeFormattingProvider? boolean|lsp.DocumentRangeFormattingOptions +--- ---The server provides document formatting on typing. ---@field documentOnTypeFormattingProvider? lsp.DocumentOnTypeFormattingOptions +--- ---The server provides rename support. RenameOptions may only be ---specified if the client states that it supports ---`prepareSupport` in its initial `initialize` request. ---@field renameProvider? boolean|lsp.RenameOptions +--- ---The server provides folding provider support. ---@field foldingRangeProvider? boolean|lsp.FoldingRangeOptions|lsp.FoldingRangeRegistrationOptions +--- ---The server provides selection range support. ---@field selectionRangeProvider? boolean|lsp.SelectionRangeOptions|lsp.SelectionRangeRegistrationOptions +--- ---The server provides execute command support. ---@field executeCommandProvider? lsp.ExecuteCommandOptions +--- ---The server provides call hierarchy support. --- ---@since 3.16.0 ---@field callHierarchyProvider? boolean|lsp.CallHierarchyOptions|lsp.CallHierarchyRegistrationOptions +--- ---The server provides linked editing range support. --- ---@since 3.16.0 ---@field linkedEditingRangeProvider? boolean|lsp.LinkedEditingRangeOptions|lsp.LinkedEditingRangeRegistrationOptions +--- ---The server provides semantic tokens support. --- ---@since 3.16.0 ---@field semanticTokensProvider? lsp.SemanticTokensOptions|lsp.SemanticTokensRegistrationOptions +--- ---The server provides moniker support. --- ---@since 3.16.0 ---@field monikerProvider? boolean|lsp.MonikerOptions|lsp.MonikerRegistrationOptions +--- ---The server provides type hierarchy support. --- ---@since 3.17.0 ---@field typeHierarchyProvider? boolean|lsp.TypeHierarchyOptions|lsp.TypeHierarchyRegistrationOptions +--- ---The server provides inline values. --- ---@since 3.17.0 ---@field inlineValueProvider? boolean|lsp.InlineValueOptions|lsp.InlineValueRegistrationOptions +--- ---The server provides inlay hints. --- ---@since 3.17.0 ---@field inlayHintProvider? boolean|lsp.InlayHintOptions|lsp.InlayHintRegistrationOptions +--- ---The server has support for pull model diagnostics. --- ---@since 3.17.0 ---@field diagnosticProvider? lsp.DiagnosticOptions|lsp.DiagnosticRegistrationOptions +--- ---Inline completion options used during static registration. --- ---@since 3.18.0 ---@proposed ---@field inlineCompletionProvider? boolean|lsp.InlineCompletionOptions +--- ---Workspace specific server capabilities. ----@field workspace? anonym12 +---@field workspace? lsp._anonym12.workspace +--- ---Experimental server capabilities. ---@field experimental? lsp.LSPAny ---A text document identifier to denote a specific version of a text document. ---@class lsp.VersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier +--- ---The version number of this document. ---@field version integer ---Save options. ---@class lsp.SaveOptions +--- ---The client is supposed to include the content on save. ---@field includeText? boolean ---An event describing a file change. ---@class lsp.FileEvent +--- ---The file's uri. ---@field uri lsp.DocumentUri +--- ---The change type. ---@field type lsp.FileChangeType ---@class lsp.FileSystemWatcher +--- ---The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. --- ---@since 3.17.0 support for relative patterns. ---@field globPattern lsp.GlobPattern +--- ---The kind of events of interest. If omitted it defaults ---to WatchKind.Create | WatchKind.Change | WatchKind.Delete ---which is 7. @@ -2167,31 +2575,40 @@ error('Cannot require a meta file') ---Represents a diagnostic, such as a compiler error or warning. Diagnostic objects ---are only valid in the scope of a resource. ---@class lsp.Diagnostic +--- ---The range at which the message applies ---@field range lsp.Range +--- ---The diagnostic's severity. Can be omitted. If omitted it is up to the ---client to interpret diagnostics as error, warning, info or hint. ---@field severity? lsp.DiagnosticSeverity +--- ---The diagnostic's code, which usually appear in the user interface. ---@field code? integer|string +--- ---An optional property to describe the error code. ---Requires the code field (above) to be present/not null. --- ---@since 3.16.0 ---@field codeDescription? lsp.CodeDescription +--- ---A human-readable string describing the source of this ---diagnostic, e.g. 'typescript' or 'super lint'. It usually ---appears in the user interface. ---@field source? string +--- ---The diagnostic's message. It usually appears in the user interface ---@field message string +--- ---Additional metadata about the diagnostic. --- ---@since 3.15.0 ---@field tags? lsp.DiagnosticTag[] +--- ---An array of related diagnostic information, e.g. when symbol-names within ---a scope collide all definitions can be marked via this property. ---@field relatedInformation? lsp.DiagnosticRelatedInformation[] +--- ---A data entry field that is preserved between a `textDocument/publishDiagnostics` ---notification and `textDocument/codeAction` request. --- @@ -2200,8 +2617,10 @@ error('Cannot require a meta file') ---Contains additional information about the context in which a completion request is triggered. ---@class lsp.CompletionContext +--- ---How the completion was triggered. ---@field triggerKind lsp.CompletionTriggerKind +--- ---The trigger character (a single character) that has trigger code complete. ---Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` ---@field triggerCharacter? string @@ -2210,9 +2629,11 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.CompletionItemLabelDetails +--- ---An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, ---without any spacing. Should be used for function signatures and type annotations. ---@field detail? string +--- ---An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used ---for fully qualified names and file paths. ---@field description? string @@ -2221,15 +2642,19 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.InsertReplaceEdit +--- ---The string to be inserted. ---@field newText string +--- ---The range if the insert is requested ---@field insert lsp.Range +--- ---The range if the replace is requested. ---@field replace lsp.Range ---Completion options. ----@class lsp.CompletionOptions +---@class lsp.CompletionOptions: lsp.WorkDoneProgressOptions +--- ---Most tools trigger completion request automatically without explicitly requesting ---it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user ---starts to type an identifier. For example if the user types `c` in a JavaScript file @@ -2239,6 +2664,7 @@ error('Cannot require a meta file') ---If code complete should automatically be trigger on characters not being valid inside ---an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. ---@field triggerCharacters? string[] +--- ---The list of all possible characters that commit a completion. This field can be used ---if clients don't support individual commit characters per completion item. See ---`ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` @@ -2248,33 +2674,39 @@ error('Cannot require a meta file') --- ---@since 3.2.0 ---@field allCommitCharacters? string[] +--- ---The server provides support to resolve additional ---information for a completion item. ---@field resolveProvider? boolean +--- ---The server supports the following `CompletionItem` specific ---capabilities. --- ---@since 3.17.0 ----@field completionItem? anonym13 +---@field completionItem? lsp._anonym13.completionItem ---Hover options. ----@class lsp.HoverOptions +---@class lsp.HoverOptions: lsp.WorkDoneProgressOptions ---Additional information about the context in which a signature help request was triggered. --- ---@since 3.15.0 ---@class lsp.SignatureHelpContext +--- ---Action that caused signature help to be triggered. ---@field triggerKind lsp.SignatureHelpTriggerKind +--- ---Character that caused signature help to be triggered. --- ---This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` ---@field triggerCharacter? string +--- ---`true` if signature help was already showing when it was triggered. --- ---Retriggers occurs when the signature help is already active and can be caused by actions such as ---typing a trigger character, a cursor move, or document content changes. ---@field isRetrigger boolean +--- ---The currently active `SignatureHelp`. --- ---The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on @@ -2285,14 +2717,18 @@ error('Cannot require a meta file') ---can have a label, like a function-name, a doc-comment, and ---a set of parameters. ---@class lsp.SignatureInformation +--- ---The label of this signature. Will be shown in ---the UI. ---@field label string +--- ---The human-readable doc-comment of this signature. Will be shown ---in the UI but can be omitted. ---@field documentation? string|lsp.MarkupContent +--- ---The parameters of this signature. ---@field parameters? lsp.ParameterInformation[] +--- ---The index of the active parameter. --- ---If `null`, no parameter of the signature is active (for example a named @@ -2307,9 +2743,11 @@ error('Cannot require a meta file') ---@field activeParameter? uinteger|lsp.null ---Server Capabilities for a {@link SignatureHelpRequest}. ----@class lsp.SignatureHelpOptions +---@class lsp.SignatureHelpOptions: lsp.WorkDoneProgressOptions +--- ---List of characters that trigger signature help automatically. ---@field triggerCharacters? string[] +--- ---List of characters that re-trigger signature help. --- ---These trigger characters are only active when signature help is already showing. All trigger characters @@ -2319,30 +2757,35 @@ error('Cannot require a meta file') ---@field retriggerCharacters? string[] ---Server Capabilities for a {@link DefinitionRequest}. ----@class lsp.DefinitionOptions +---@class lsp.DefinitionOptions: lsp.WorkDoneProgressOptions ---Value-object that contains additional information when ---requesting references. ---@class lsp.ReferenceContext +--- ---Include the declaration of the current symbol. ---@field includeDeclaration boolean ---Reference options. ----@class lsp.ReferenceOptions +---@class lsp.ReferenceOptions: lsp.WorkDoneProgressOptions ---Provider options for a {@link DocumentHighlightRequest}. ----@class lsp.DocumentHighlightOptions +---@class lsp.DocumentHighlightOptions: lsp.WorkDoneProgressOptions ---A base for all symbol information. ---@class lsp.BaseSymbolInformation +--- ---The name of this symbol. ---@field name string +--- ---The kind of this symbol. ---@field kind lsp.SymbolKind +--- ---Tags for this symbol. --- ---@since 3.16.0 ---@field tags? lsp.SymbolTag[] +--- ---The name of the symbol containing this symbol. This information is for ---user interface purposes (e.g. to render a qualifier in the user interface ---if necessary). It can't be used to re-infer a hierarchy for the document @@ -2350,7 +2793,8 @@ error('Cannot require a meta file') ---@field containerName? string ---Provider options for a {@link DocumentSymbolRequest}. ----@class lsp.DocumentSymbolOptions +---@class lsp.DocumentSymbolOptions: lsp.WorkDoneProgressOptions +--- ---A human-readable string that is shown when multiple outlines trees ---are shown for the same document. --- @@ -2360,29 +2804,34 @@ error('Cannot require a meta file') ---Contains additional diagnostic information about the context in which ---a {@link CodeActionProvider.provideCodeActions code action} is run. ---@class lsp.CodeActionContext +--- ---An array of diagnostics known on the client side overlapping the range provided to the ---`textDocument/codeAction` request. They are provided so that the server knows which ---errors are currently presented to the user for the given range. There is no guarantee ---that these accurately reflect the error state of the resource. The primary parameter ---to compute code actions is the provided range. ---@field diagnostics lsp.Diagnostic[] +--- ---Requested kind of actions to return. --- ---Actions not of this kind are filtered out by the client before being shown. So servers ---can omit computing them. ---@field only? lsp.CodeActionKind[] +--- ---The reason why code actions were requested. --- ---@since 3.17.0 ---@field triggerKind? lsp.CodeActionTriggerKind ---Provider options for a {@link CodeActionRequest}. ----@class lsp.CodeActionOptions +---@class lsp.CodeActionOptions: lsp.WorkDoneProgressOptions +--- ---CodeActionKinds that this server may return. --- ---The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server ---may list out every specific kind they provide. ---@field codeActionKinds? lsp.CodeActionKind[] +--- ---The server provides support to resolve additional ---information for a code action. --- @@ -2390,7 +2839,8 @@ error('Cannot require a meta file') ---@field resolveProvider? boolean ---Server capabilities for a {@link WorkspaceSymbolRequest}. ----@class lsp.WorkspaceSymbolOptions +---@class lsp.WorkspaceSymbolOptions: lsp.WorkDoneProgressOptions +--- ---The server provides support to resolve additional ---information for a workspace symbol. --- @@ -2398,39 +2848,47 @@ error('Cannot require a meta file') ---@field resolveProvider? boolean ---Code Lens provider options of a {@link CodeLensRequest}. ----@class lsp.CodeLensOptions +---@class lsp.CodeLensOptions: lsp.WorkDoneProgressOptions +--- ---Code lens has a resolve provider as well. ---@field resolveProvider? boolean ---Provider options for a {@link DocumentLinkRequest}. ----@class lsp.DocumentLinkOptions +---@class lsp.DocumentLinkOptions: lsp.WorkDoneProgressOptions +--- ---Document links have a resolve provider as well. ---@field resolveProvider? boolean ---Value-object describing what options formatting should use. ---@class lsp.FormattingOptions +--- ---Size of a tab in spaces. ---@field tabSize uinteger +--- ---Prefer spaces over tabs. ---@field insertSpaces boolean +--- ---Trim trailing whitespace on a line. --- ---@since 3.15.0 ---@field trimTrailingWhitespace? boolean +--- ---Insert a newline character at the end of the file if one does not exist. --- ---@since 3.15.0 ---@field insertFinalNewline? boolean +--- ---Trim all newlines after the final newline at the end of the file. --- ---@since 3.15.0 ---@field trimFinalNewlines? boolean ---Provider options for a {@link DocumentFormattingRequest}. ----@class lsp.DocumentFormattingOptions +---@class lsp.DocumentFormattingOptions: lsp.WorkDoneProgressOptions ---Provider options for a {@link DocumentRangeFormattingRequest}. ----@class lsp.DocumentRangeFormattingOptions +---@class lsp.DocumentRangeFormattingOptions: lsp.WorkDoneProgressOptions +--- ---Whether the server supports formatting multiple ranges at once. --- ---@since 3.18.0 @@ -2439,32 +2897,39 @@ error('Cannot require a meta file') ---Provider options for a {@link DocumentOnTypeFormattingRequest}. ---@class lsp.DocumentOnTypeFormattingOptions +--- ---A character on which formatting should be triggered, like `{`. ---@field firstTriggerCharacter string +--- ---More trigger characters. ---@field moreTriggerCharacter? string[] ---Provider options for a {@link RenameRequest}. ----@class lsp.RenameOptions +---@class lsp.RenameOptions: lsp.WorkDoneProgressOptions +--- ---Renames should be checked and tested before being executed. --- ---@since version 3.12.0 ---@field prepareProvider? boolean ---The server capabilities of a {@link ExecuteCommandRequest}. ----@class lsp.ExecuteCommandOptions +---@class lsp.ExecuteCommandOptions: lsp.WorkDoneProgressOptions +--- ---The commands to be executed on the server ---@field commands string[] ---@since 3.16.0 ---@class lsp.SemanticTokensLegend +--- ---The token types a server uses. ---@field tokenTypes string[] +--- ---The token modifiers a server uses. ---@field tokenModifiers string[] ---A text document identifier to optionally denote a specific version of a text document. ---@class lsp.OptionalVersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier +--- ---The version number of this document. If a versioned text document identifier ---is sent from the server to the client and the file is not open in the editor ---(the server has not received an open notification before) the server can send @@ -2476,13 +2941,16 @@ error('Cannot require a meta file') --- ---@since 3.16.0. ---@class lsp.AnnotatedTextEdit: lsp.TextEdit +--- ---The actual identifier of the change annotation ---@field annotationId lsp.ChangeAnnotationIdentifier ---A generic resource operation. ---@class lsp.ResourceOperation +--- ---The resource operation kind. ---@field kind string +--- ---An optional annotation identifier describing the operation. --- ---@since 3.16.0 @@ -2490,22 +2958,28 @@ error('Cannot require a meta file') ---Options to create a file. ---@class lsp.CreateFileOptions +--- ---Overwrite existing file. Overwrite wins over `ignoreIfExists` ---@field overwrite? boolean +--- ---Ignore if exists. ---@field ignoreIfExists? boolean ---Rename file options ---@class lsp.RenameFileOptions +--- ---Overwrite target if existing. Overwrite wins over `ignoreIfExists` ---@field overwrite? boolean +--- ---Ignores if target exists. ---@field ignoreIfExists? boolean ---Delete file options ---@class lsp.DeleteFileOptions +--- ---Delete the content recursively if a folder is denoted. ---@field recursive? boolean +--- ---Ignore the operation if the file doesn't exist. ---@field ignoreIfNotExists? boolean @@ -2514,18 +2988,21 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationPattern +--- ---The glob pattern to match. Glob patterns can have the following syntax: ---- `*` to match one or more characters in a path segment ---- `?` to match on one character in a path segment ---- `**` to match any number of path segments, including none ----- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +---- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) ---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) ---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) ---@field glob string +--- ---Whether to match files or folders with this pattern. --- ---Matches both if undefined. ---@field matches? lsp.FileOperationPatternKind +--- ---Additional options used during matching. ---@field options? lsp.FileOperationPatternOptions @@ -2533,8 +3010,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.WorkspaceFullDocumentDiagnosticReport: lsp.FullDocumentDiagnosticReport +--- ---The URI for which diagnostic information is reported. ---@field uri lsp.DocumentUri +--- ---The version number for which the diagnostics are reported. ---If the document is not marked as open `null` can be provided. ---@field version integer|lsp.null @@ -2543,8 +3022,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.WorkspaceUnchangedDocumentDiagnosticReport: lsp.UnchangedDocumentDiagnosticReport +--- ---The URI for which diagnostic information is reported. ---@field uri lsp.DocumentUri +--- ---The version number for which the diagnostics are reported. ---If the document is not marked as open `null` can be provided. ---@field version integer|lsp.null @@ -2557,15 +3038,19 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookCell +--- ---The cell's kind ---@field kind lsp.NotebookCellKind +--- ---The URI of the cell's text document ---content. ---@field document lsp.DocumentUri +--- ---Additional metadata stored with the cell. --- ---Note: should always be an object literal (e.g. LSPObject) ---@field metadata? lsp.LSPObject +--- ---Additional execution summary information ---if supported by the client. ---@field executionSummary? lsp.ExecutionSummary @@ -2575,10 +3060,13 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookCellArrayChange +--- ---The start oftest of the cell that changed. ---@field start uinteger +--- ---The deleted cells ---@field deleteCount uinteger +--- ---The new cells, if any ---@field cells? lsp.NotebookCell[] @@ -2587,43 +3075,56 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.SelectedCompletionInfo +--- ---The range that will be replaced if this completion item is accepted. ---@field range lsp.Range +--- ---The text the range will be replaced with if this completion is accepted. ---@field text string ---Defines the capabilities provided by the client. ---@class lsp.ClientCapabilities +--- ---Workspace specific client capabilities. ---@field workspace? lsp.WorkspaceClientCapabilities +--- ---Text document specific client capabilities. ---@field textDocument? lsp.TextDocumentClientCapabilities +--- ---Capabilities specific to the notebook document support. --- ---@since 3.17.0 ---@field notebookDocument? lsp.NotebookDocumentClientCapabilities +--- ---Window specific client capabilities. ---@field window? lsp.WindowClientCapabilities +--- ---General client capabilities. --- ---@since 3.16.0 ---@field general? lsp.GeneralClientCapabilities +--- ---Experimental client capabilities. ---@field experimental? lsp.LSPAny ---@class lsp.TextDocumentSyncOptions +--- ---Open and close notifications are sent to the server. If omitted open close notification should not ---be sent. ---@field openClose? boolean +--- ---Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full ---and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. ---@field change? lsp.TextDocumentSyncKind +--- ---If present will save notifications are sent to the server. If omitted the notification should not be ---sent. ---@field willSave? boolean +--- ---If present will save wait until requests are sent to the server. If omitted the request should not be ---sent. ---@field willSaveWaitUntil? boolean +--- ---If present save notifications are sent to the server. If omitted the notification should not be ---sent. ---@field save? boolean|lsp.SaveOptions @@ -2642,8 +3143,10 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookDocumentSyncOptions +--- ---The notebooks to be synced ----@field notebookSelector anonym15|anonym17[] +---@field notebookSelector lsp._anonym14.notebookSelector|lsp._anonym16.notebookSelector[] +--- ---Whether save notification should be forwarded to ---the server. Will only be honored if mode === `notebook`. ---@field save? boolean @@ -2654,8 +3157,10 @@ error('Cannot require a meta file') ---@class lsp.NotebookDocumentSyncRegistrationOptions: lsp.NotebookDocumentSyncOptions, lsp.StaticRegistrationOptions ---@class lsp.WorkspaceFoldersServerCapabilities +--- ---The server has support for workspace folders ---@field supported? boolean +--- ---Whether the server wants to receive workspace folder ---change notifications. --- @@ -2669,16 +3174,22 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationOptions +--- ---The server is interested in receiving didCreateFiles notifications. ---@field didCreate? lsp.FileOperationRegistrationOptions +--- ---The server is interested in receiving willCreateFiles requests. ---@field willCreate? lsp.FileOperationRegistrationOptions +--- ---The server is interested in receiving didRenameFiles notifications. ---@field didRename? lsp.FileOperationRegistrationOptions +--- ---The server is interested in receiving willRenameFiles requests. ---@field willRename? lsp.FileOperationRegistrationOptions +--- ---The server is interested in receiving didDeleteFiles file notifications. ---@field didDelete? lsp.FileOperationRegistrationOptions +--- ---The server is interested in receiving willDeleteFiles file requests. ---@field willDelete? lsp.FileOperationRegistrationOptions @@ -2686,6 +3197,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.CodeDescription +--- ---An URI to open with more information about the diagnostic error. ---@field href lsp.URI @@ -2693,14 +3205,17 @@ error('Cannot require a meta file') ---used to point to code locations that cause or related to a diagnostics, e.g when duplicating ---a symbol in a scope. ---@class lsp.DiagnosticRelatedInformation +--- ---The location of this related diagnostic information. ---@field location lsp.Location +--- ---The message of this related diagnostic information. ---@field message string ---Represents a parameter of a callable-signature. A parameter can ---have a label and a doc-comment. ---@class lsp.ParameterInformation +--- ---The label of this parameter information. --- ---Either a string or an inclusive start and exclusive end offsets within its containing @@ -2710,6 +3225,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 } +--- ---The human-readable doc-comment of this parameter. Will be shown ---in the UI but can be omitted. ---@field documentation? string|lsp.MarkupContent @@ -2719,11 +3235,13 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookCellTextDocumentFilter +--- ---A filter that matches against the notebook ---containing the notebook cell. If a string ---value is provided it matches against the ---notebook type. '*' matches every notebook. ---@field notebook string|lsp.NotebookDocumentFilter +--- ---A language id like `python`. --- ---Will be matched against the language id of the @@ -2734,71 +3252,89 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationPatternOptions +--- ---The pattern should be matched ignoring casing. ---@field ignoreCase? boolean ---@class lsp.ExecutionSummary +--- ---A strict monotonically increasing value ---indicating the execution order of a cell ---inside a notebook. ---@field executionOrder uinteger +--- ---Whether the execution was successful or ---not if known by the client. ---@field success? boolean ---Workspace specific client capabilities. ---@class lsp.WorkspaceClientCapabilities +--- ---The client supports applying batch edits ---to the workspace by supporting the request ---'workspace/applyEdit' ---@field applyEdit? boolean +--- ---Capabilities specific to `WorkspaceEdit`s. ---@field workspaceEdit? lsp.WorkspaceEditClientCapabilities +--- ---Capabilities specific to the `workspace/didChangeConfiguration` notification. ---@field didChangeConfiguration? lsp.DidChangeConfigurationClientCapabilities +--- ---Capabilities specific to the `workspace/didChangeWatchedFiles` notification. ---@field didChangeWatchedFiles? lsp.DidChangeWatchedFilesClientCapabilities +--- ---Capabilities specific to the `workspace/symbol` request. ---@field symbol? lsp.WorkspaceSymbolClientCapabilities +--- ---Capabilities specific to the `workspace/executeCommand` request. ---@field executeCommand? lsp.ExecuteCommandClientCapabilities +--- ---The client has support for workspace folders. --- ---@since 3.6.0 ---@field workspaceFolders? boolean +--- ---The client supports `workspace/configuration` requests. --- ---@since 3.6.0 ---@field configuration? boolean +--- ---Capabilities specific to the semantic token requests scoped to the ---workspace. --- ---@since 3.16.0. ---@field semanticTokens? lsp.SemanticTokensWorkspaceClientCapabilities +--- ---Capabilities specific to the code lens requests scoped to the ---workspace. --- ---@since 3.16.0. ---@field codeLens? lsp.CodeLensWorkspaceClientCapabilities +--- ---The client has support for file notifications/requests for user operations on files. --- ---Since 3.16.0 ---@field fileOperations? lsp.FileOperationClientCapabilities +--- ---Capabilities specific to the inline values requests scoped to the ---workspace. --- ---@since 3.17.0. ---@field inlineValue? lsp.InlineValueWorkspaceClientCapabilities +--- ---Capabilities specific to the inlay hint requests scoped to the ---workspace. --- ---@since 3.17.0. ---@field inlayHint? lsp.InlayHintWorkspaceClientCapabilities +--- ---Capabilities specific to the diagnostic requests scoped to the ---workspace. --- ---@since 3.17.0. ---@field diagnostics? lsp.DiagnosticWorkspaceClientCapabilities +--- ---Capabilities specific to the folding range requests scoped to the workspace. --- ---@since 3.18.0 @@ -2807,95 +3343,126 @@ error('Cannot require a meta file') ---Text document specific client capabilities. ---@class lsp.TextDocumentClientCapabilities +--- ---Defines which synchronization capabilities the client supports. ---@field synchronization? lsp.TextDocumentSyncClientCapabilities +--- ---Capabilities specific to the `textDocument/completion` request. ---@field completion? lsp.CompletionClientCapabilities +--- ---Capabilities specific to the `textDocument/hover` request. ---@field hover? lsp.HoverClientCapabilities +--- ---Capabilities specific to the `textDocument/signatureHelp` request. ---@field signatureHelp? lsp.SignatureHelpClientCapabilities +--- ---Capabilities specific to the `textDocument/declaration` request. --- ---@since 3.14.0 ---@field declaration? lsp.DeclarationClientCapabilities +--- ---Capabilities specific to the `textDocument/definition` request. ---@field definition? lsp.DefinitionClientCapabilities +--- ---Capabilities specific to the `textDocument/typeDefinition` request. --- ---@since 3.6.0 ---@field typeDefinition? lsp.TypeDefinitionClientCapabilities +--- ---Capabilities specific to the `textDocument/implementation` request. --- ---@since 3.6.0 ---@field implementation? lsp.ImplementationClientCapabilities +--- ---Capabilities specific to the `textDocument/references` request. ---@field references? lsp.ReferenceClientCapabilities +--- ---Capabilities specific to the `textDocument/documentHighlight` request. ---@field documentHighlight? lsp.DocumentHighlightClientCapabilities +--- ---Capabilities specific to the `textDocument/documentSymbol` request. ---@field documentSymbol? lsp.DocumentSymbolClientCapabilities +--- ---Capabilities specific to the `textDocument/codeAction` request. ---@field codeAction? lsp.CodeActionClientCapabilities +--- ---Capabilities specific to the `textDocument/codeLens` request. ---@field codeLens? lsp.CodeLensClientCapabilities +--- ---Capabilities specific to the `textDocument/documentLink` request. ---@field documentLink? lsp.DocumentLinkClientCapabilities +--- ---Capabilities specific to the `textDocument/documentColor` and the ---`textDocument/colorPresentation` request. --- ---@since 3.6.0 ---@field colorProvider? lsp.DocumentColorClientCapabilities +--- ---Capabilities specific to the `textDocument/formatting` request. ---@field formatting? lsp.DocumentFormattingClientCapabilities +--- ---Capabilities specific to the `textDocument/rangeFormatting` request. ---@field rangeFormatting? lsp.DocumentRangeFormattingClientCapabilities +--- ---Capabilities specific to the `textDocument/onTypeFormatting` request. ---@field onTypeFormatting? lsp.DocumentOnTypeFormattingClientCapabilities +--- ---Capabilities specific to the `textDocument/rename` request. ---@field rename? lsp.RenameClientCapabilities +--- ---Capabilities specific to the `textDocument/foldingRange` request. --- ---@since 3.10.0 ---@field foldingRange? lsp.FoldingRangeClientCapabilities +--- ---Capabilities specific to the `textDocument/selectionRange` request. --- ---@since 3.15.0 ---@field selectionRange? lsp.SelectionRangeClientCapabilities +--- ---Capabilities specific to the `textDocument/publishDiagnostics` notification. ---@field publishDiagnostics? lsp.PublishDiagnosticsClientCapabilities +--- ---Capabilities specific to the various call hierarchy requests. --- ---@since 3.16.0 ---@field callHierarchy? lsp.CallHierarchyClientCapabilities +--- ---Capabilities specific to the various semantic token request. --- ---@since 3.16.0 ---@field semanticTokens? lsp.SemanticTokensClientCapabilities +--- ---Capabilities specific to the `textDocument/linkedEditingRange` request. --- ---@since 3.16.0 ---@field linkedEditingRange? lsp.LinkedEditingRangeClientCapabilities +--- ---Client capabilities specific to the `textDocument/moniker` request. --- ---@since 3.16.0 ---@field moniker? lsp.MonikerClientCapabilities +--- ---Capabilities specific to the various type hierarchy requests. --- ---@since 3.17.0 ---@field typeHierarchy? lsp.TypeHierarchyClientCapabilities +--- ---Capabilities specific to the `textDocument/inlineValue` request. --- ---@since 3.17.0 ---@field inlineValue? lsp.InlineValueClientCapabilities +--- ---Capabilities specific to the `textDocument/inlayHint` request. --- ---@since 3.17.0 ---@field inlayHint? lsp.InlayHintClientCapabilities +--- ---Capabilities specific to the diagnostic pull model. --- ---@since 3.17.0 ---@field diagnostic? lsp.DiagnosticClientCapabilities +--- ---Client capabilities specific to inline completions. --- ---@since 3.18.0 @@ -2906,12 +3473,14 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookDocumentClientCapabilities +--- ---Capabilities specific to notebook document synchronization --- ---@since 3.17.0 ---@field synchronization lsp.NotebookDocumentSyncClientCapabilities ---@class lsp.WindowClientCapabilities +--- ---It indicates whether the client supports server initiated ---progress using the `window/workDoneProgress/create` request. --- @@ -2922,10 +3491,12 @@ error('Cannot require a meta file') --- ---@since 3.15.0 ---@field workDoneProgress? boolean +--- ---Capabilities specific to the showMessage request. --- ---@since 3.16.0 ---@field showMessage? lsp.ShowMessageRequestClientCapabilities +--- ---Capabilities specific to the showDocument request. --- ---@since 3.16.0 @@ -2935,21 +3506,25 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.GeneralClientCapabilities +--- ---Client capability that signals how the client ---handles stale requests (e.g. a request ---for which the client will not process the response ---anymore since the information is outdated). --- ---@since 3.17.0 ----@field staleRequestSupport? anonym18 +---@field staleRequestSupport? lsp._anonym18.staleRequestSupport +--- ---Client capabilities specific to regular expressions. --- ---@since 3.16.0 ---@field regularExpressions? lsp.RegularExpressionsClientCapabilities +--- ---Client capabilities specific to the client's markdown parser. --- ---@since 3.16.0 ---@field markdown? lsp.MarkdownClientCapabilities +--- ---The position encodings supported by the client. Client and server ---have to agree on the same position encoding to ensure that offsets ---(e.g. character position in a line) are interpreted the same on both @@ -2976,25 +3551,31 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.RelativePattern +--- ---A workspace folder or a base URI to which this pattern will be matched ---against relatively. ---@field baseUri lsp.WorkspaceFolder|lsp.URI +--- ---The actual glob pattern; ---@field pattern lsp.Pattern ---@class lsp.WorkspaceEditClientCapabilities +--- ---The client supports versioned document changes in `WorkspaceEdit`s ---@field documentChanges? boolean +--- ---The resource operations the client supports. Clients should at least ---support 'create', 'rename' and 'delete' files and folders. --- ---@since 3.13.0 ---@field resourceOperations? lsp.ResourceOperationKind[] +--- ---The failure handling strategy of a client if applying the workspace edit ---fails. --- ---@since 3.13.0 ---@field failureHandling? lsp.FailureHandlingKind +--- ---Whether the client normalizes line endings to the client specific ---setting. ---If set to `true` the client will normalize line ending characters @@ -3003,21 +3584,25 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@field normalizesLineEndings? boolean +--- ---Whether the client in general supports change annotations on text edits, ---create file, rename file and delete file changes. --- ---@since 3.16.0 ----@field changeAnnotationSupport? anonym19 +---@field changeAnnotationSupport? lsp._anonym19.changeAnnotationSupport ---@class lsp.DidChangeConfigurationClientCapabilities +--- ---Did change configuration notification supports dynamic registration. ---@field dynamicRegistration? boolean ---@class lsp.DidChangeWatchedFilesClientCapabilities +--- ---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. ---@field dynamicRegistration? boolean +--- ---Whether the client has support for {@link RelativePattern relative pattern} ---or not. --- @@ -3026,29 +3611,35 @@ error('Cannot require a meta file') ---Client capabilities for a {@link WorkspaceSymbolRequest}. ---@class lsp.WorkspaceSymbolClientCapabilities +--- ---Symbol request supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. ----@field symbolKind? anonym20 +---@field symbolKind? lsp._anonym20.symbolKind +--- ---The client supports tags on `SymbolInformation`. ---Clients supporting tags have to handle unknown tags gracefully. --- ---@since 3.16.0 ----@field tagSupport? anonym21 +---@field tagSupport? lsp._anonym21.tagSupport +--- ---The client support partial workspace symbols. The client will send the ---request `workspaceSymbol/resolve` to the server to resolve additional ---properties. --- ---@since 3.17.0 ----@field resolveSupport? anonym22 +---@field resolveSupport? lsp._anonym22.resolveSupport ---The client capabilities of a {@link ExecuteCommandRequest}. ---@class lsp.ExecuteCommandClientCapabilities +--- ---Execute command supports dynamic registration. ---@field dynamicRegistration? boolean ---@since 3.16.0 ---@class lsp.SemanticTokensWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from ---the server to the client. --- @@ -3060,6 +3651,7 @@ error('Cannot require a meta file') ---@since 3.16.0 ---@class lsp.CodeLensWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from the ---server to the client. --- @@ -3076,18 +3668,25 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.FileOperationClientCapabilities +--- ---Whether the client supports dynamic registration for file requests/notifications. ---@field dynamicRegistration? boolean +--- ---The client has support for sending didCreateFiles notifications. ---@field didCreate? boolean +--- ---The client has support for sending willCreateFiles requests. ---@field willCreate? boolean +--- ---The client has support for sending didRenameFiles notifications. ---@field didRename? boolean +--- ---The client has support for sending willRenameFiles requests. ---@field willRename? boolean +--- ---The client has support for sending didDeleteFiles notifications. ---@field didDelete? boolean +--- ---The client has support for sending willDeleteFiles requests. ---@field willDelete? boolean @@ -3095,6 +3694,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlineValueWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from the ---server to the client. --- @@ -3108,6 +3708,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlayHintWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from ---the server to the client. --- @@ -3121,6 +3722,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.DiagnosticWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from ---the server to the client. --- @@ -3135,6 +3737,7 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.FoldingRangeWorkspaceClientCapabilities +--- ---Whether the client implementation supports a refresh request sent from the ---server to the client. --- @@ -3148,54 +3751,69 @@ error('Cannot require a meta file') ---@field refreshSupport? boolean ---@class lsp.TextDocumentSyncClientCapabilities +--- ---Whether text document synchronization supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---The client supports sending will save notifications. ---@field 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. ---@field willSaveWaitUntil? boolean +--- ---The client supports did save notifications. ---@field didSave? boolean ---Completion client capabilities ---@class lsp.CompletionClientCapabilities +--- ---Whether completion supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---The client supports the following `CompletionItem` specific ---capabilities. ----@field completionItem? anonym26 ----@field completionItemKind? anonym27 +---@field completionItem? lsp._anonym23.completionItem +--- +---@field completionItemKind? lsp._anonym27.completionItemKind +--- ---Defines how the client handles whitespace and indentation ---when accepting a completion item that uses multi line ---text in either `insertText` or `textEdit`. --- ---@since 3.17.0 ---@field insertTextMode? lsp.InsertTextMode +--- ---The client supports to send additional context information for a ---`textDocument/completion` request. ---@field contextSupport? boolean +--- ---The client supports the following `CompletionList` specific ---capabilities. --- ---@since 3.17.0 ----@field completionList? anonym28 +---@field completionList? lsp._anonym28.completionList ---@class lsp.HoverClientCapabilities +--- ---Whether hover supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Client supports the following content formats for the content ---property. The order describes the preferred format of the client. ---@field contentFormat? lsp.MarkupKind[] ---Client Capabilities for a {@link SignatureHelpRequest}. ---@class lsp.SignatureHelpClientCapabilities +--- ---Whether signature help supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---The client supports the following `SignatureInformation` ---specific properties. ----@field signatureInformation? anonym30 +---@field signatureInformation? lsp._anonym29.signatureInformation +--- ---The client supports to send additional context information for a ---`textDocument/signatureHelp` request. A client that opts into ---contextSupport will also support the `retriggerCharacters` on @@ -3206,17 +3824,21 @@ error('Cannot require a meta file') ---@since 3.14.0 ---@class lsp.DeclarationClientCapabilities +--- ---Whether declaration supports dynamic registration. If this is set to `true` ---the client supports the new `DeclarationRegistrationOptions` return value ---for the corresponding server capability as well. ---@field dynamicRegistration? boolean +--- ---The client supports additional metadata in the form of declaration links. ---@field linkSupport? boolean ---Client Capabilities for a {@link DefinitionRequest}. ---@class lsp.DefinitionClientCapabilities +--- ---Whether definition supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---The client supports additional metadata in the form of definition links. --- ---@since 3.14.0 @@ -3224,10 +3846,12 @@ error('Cannot require a meta file') ---Since 3.6.0 ---@class lsp.TypeDefinitionClientCapabilities +--- ---Whether implementation supports dynamic registration. If this is set to `true` ---the client supports the new `TypeDefinitionRegistrationOptions` return value ---for the corresponding server capability as well. ---@field dynamicRegistration? boolean +--- ---The client supports additional metadata in the form of definition links. --- ---Since 3.14.0 @@ -3235,10 +3859,12 @@ error('Cannot require a meta file') ---@since 3.6.0 ---@class lsp.ImplementationClientCapabilities +--- ---Whether implementation supports dynamic registration. If this is set to `true` ---the client supports the new `ImplementationRegistrationOptions` return value ---for the corresponding server capability as well. ---@field dynamicRegistration? boolean +--- ---The client supports additional metadata in the form of definition links. --- ---@since 3.14.0 @@ -3246,29 +3872,36 @@ error('Cannot require a meta file') ---Client Capabilities for a {@link ReferencesRequest}. ---@class lsp.ReferenceClientCapabilities +--- ---Whether references supports dynamic registration. ---@field dynamicRegistration? boolean ---Client Capabilities for a {@link DocumentHighlightRequest}. ---@class lsp.DocumentHighlightClientCapabilities +--- ---Whether document highlight supports dynamic registration. ---@field dynamicRegistration? boolean ---Client Capabilities for a {@link DocumentSymbolRequest}. ---@class lsp.DocumentSymbolClientCapabilities +--- ---Whether document symbol supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Specific capabilities for the `SymbolKind` in the ---`textDocument/documentSymbol` request. ----@field symbolKind? anonym31 +---@field symbolKind? lsp._anonym31.symbolKind +--- ---The client supports hierarchical document symbols. ---@field hierarchicalDocumentSymbolSupport? boolean +--- ---The client supports tags on `SymbolInformation`. Tags are supported on ---`DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. ---Clients supporting tags have to handle unknown tags gracefully. --- ---@since 3.16.0 ----@field tagSupport? anonym32 +---@field tagSupport? lsp._anonym32.tagSupport +--- ---The client supports an additional label presented in the UI when ---registering a document symbol provider. --- @@ -3277,33 +3910,40 @@ error('Cannot require a meta file') ---The Client Capabilities of a {@link CodeActionRequest}. ---@class lsp.CodeActionClientCapabilities +--- ---Whether code action supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---The client support code action literals of type `CodeAction` as a valid ---response of the `textDocument/codeAction` request. If the property is not ---set the request can only return `Command` literals. --- ---@since 3.8.0 ----@field codeActionLiteralSupport? anonym34 +---@field codeActionLiteralSupport? lsp._anonym33.codeActionLiteralSupport +--- ---Whether code action supports the `isPreferred` property. --- ---@since 3.15.0 ---@field isPreferredSupport? boolean +--- ---Whether code action supports the `disabled` property. --- ---@since 3.16.0 ---@field disabledSupport? boolean +--- ---Whether code action supports the `data` property which is ---preserved between a `textDocument/codeAction` and a ---`codeAction/resolve` request. --- ---@since 3.16.0 ---@field dataSupport? boolean +--- ---Whether the client supports resolving additional code action ---properties via a separate `codeAction/resolve` request. --- ---@since 3.16.0 ----@field resolveSupport? anonym35 +---@field resolveSupport? lsp._anonym35.resolveSupport +--- ---Whether the client honors the change annotations in ---text edits and resource operations returned via the ---`CodeAction#edit` property by for example presenting @@ -3315,19 +3955,23 @@ error('Cannot require a meta file') ---The client capabilities of a {@link CodeLensRequest}. ---@class lsp.CodeLensClientCapabilities +--- ---Whether code lens supports dynamic registration. ---@field dynamicRegistration? boolean ---The client capabilities of a {@link DocumentLinkRequest}. ---@class lsp.DocumentLinkClientCapabilities +--- ---Whether document link supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Whether the client supports the `tooltip` property on `DocumentLink`. --- ---@since 3.15.0 ---@field tooltipSupport? boolean ---@class lsp.DocumentColorClientCapabilities +--- ---Whether implementation supports dynamic registration. If this is set to `true` ---the client supports the new `DocumentColorRegistrationOptions` return value ---for the corresponding server capability as well. @@ -3335,13 +3979,16 @@ error('Cannot require a meta file') ---Client capabilities of a {@link DocumentFormattingRequest}. ---@class lsp.DocumentFormattingClientCapabilities +--- ---Whether formatting supports dynamic registration. ---@field dynamicRegistration? boolean ---Client capabilities of a {@link DocumentRangeFormattingRequest}. ---@class lsp.DocumentRangeFormattingClientCapabilities +--- ---Whether range formatting supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Whether the client supports formatting multiple ranges at once. --- ---@since 3.18.0 @@ -3350,17 +3997,21 @@ error('Cannot require a meta file') ---Client capabilities of a {@link DocumentOnTypeFormattingRequest}. ---@class lsp.DocumentOnTypeFormattingClientCapabilities +--- ---Whether on type formatting supports dynamic registration. ---@field dynamicRegistration? boolean ---@class lsp.RenameClientCapabilities +--- ---Whether rename supports dynamic registration. ---@field dynamicRegistration? boolean +--- ---Client supports testing for validity of rename operations ---before execution. --- ---@since 3.12.0 ---@field prepareSupport? boolean +--- ---Client supports the default behavior result. --- ---The value indicates the default behavior used by the @@ -3368,6 +4019,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@field prepareSupportDefaultBehavior? lsp.PrepareSupportDefaultBehavior +--- ---Whether the client honors the change annotations in ---text edits and resource operations returned via the ---rename request's workspace edit by for example presenting @@ -3378,29 +4030,35 @@ error('Cannot require a meta file') ---@field honorsChangeAnnotations? boolean ---@class lsp.FoldingRangeClientCapabilities +--- ---Whether implementation supports dynamic registration for folding range ---providers. If this is set to `true` the client supports the new ---`FoldingRangeRegistrationOptions` return value for the corresponding ---server capability as well. ---@field 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. ---@field rangeLimit? uinteger +--- ---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. ---@field lineFoldingOnly? boolean +--- ---Specific options for the folding range kind. --- ---@since 3.17.0 ----@field foldingRangeKind? anonym36 +---@field foldingRangeKind? lsp._anonym36.foldingRangeKind +--- ---Specific options for the folding range. --- ---@since 3.17.0 ----@field foldingRange? anonym37 +---@field foldingRange? lsp._anonym37.foldingRange ---@class lsp.SelectionRangeClientCapabilities +--- ---Whether implementation supports dynamic registration for selection range providers. If this is set to `true` ---the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server ---capability as well. @@ -3408,22 +4066,27 @@ error('Cannot require a meta file') ---The publish diagnostic client capabilities. ---@class lsp.PublishDiagnosticsClientCapabilities +--- ---Whether the clients accepts diagnostics with related information. ---@field 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 ----@field tagSupport? anonym38 +---@field tagSupport? lsp._anonym38.tagSupport +--- ---Whether the client interprets the version property of the ---`textDocument/publishDiagnostics` notification's parameter. --- ---@since 3.15.0 ---@field versionSupport? boolean +--- ---Client supports a codeDescription property --- ---@since 3.16.0 ---@field codeDescriptionSupport? boolean +--- ---Whether code action supports the `data` property which is ---preserved between a `textDocument/publishDiagnostics` and ---`textDocument/codeAction` request. @@ -3433,6 +4096,7 @@ error('Cannot require a meta file') ---@since 3.16.0 ---@class lsp.CallHierarchyClientCapabilities +--- ---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. @@ -3440,10 +4104,12 @@ error('Cannot require a meta file') ---@since 3.16.0 ---@class lsp.SemanticTokensClientCapabilities +--- ---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. ---@field dynamicRegistration? boolean +--- ---Which requests the client supports and might send to the server ---depending on the server's capability. Please note that clients might not ---show semantic tokens or degrade some of the user experience if a range @@ -3452,17 +4118,23 @@ error('Cannot require a meta file') ---`request.range` are both set to true but the server only provides a ---range provider the client might not render a minimap correctly or might ---even decide to not show any semantic tokens at all. ----@field requests anonym41 +---@field requests lsp._anonym39.requests +--- ---The token types that the client supports. ---@field tokenTypes string[] +--- ---The token modifiers that the client supports. ---@field tokenModifiers string[] +--- ---The token formats the clients supports. ---@field formats lsp.TokenFormat[] +--- ---Whether the client supports tokens that can overlap each other. ---@field overlappingTokenSupport? boolean +--- ---Whether the client supports tokens that can span multiple lines. ---@field multilineTokenSupport? boolean +--- ---Whether the client allows the server to actively cancel a ---semantic token request, e.g. supports returning ---LSPErrorCodes.ServerCancelled. If a server does the client @@ -3470,6 +4142,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@field serverCancelSupport? boolean +--- ---Whether the client uses semantic tokens to augment existing ---syntax tokens. If set to `true` client side created syntax ---tokens and semantic tokens are both used for colorization. If @@ -3486,6 +4159,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.LinkedEditingRangeClientCapabilities +--- ---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. @@ -3495,6 +4169,7 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.MonikerClientCapabilities +--- ---Whether moniker supports dynamic registration. If this is set to `true` ---the client supports the new `MonikerRegistrationOptions` return value ---for the corresponding server capability as well. @@ -3502,6 +4177,7 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@class lsp.TypeHierarchyClientCapabilities +--- ---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. @@ -3511,6 +4187,7 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlineValueClientCapabilities +--- ---Whether implementation supports dynamic registration for inline value providers. ---@field dynamicRegistration? boolean @@ -3518,20 +4195,24 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.InlayHintClientCapabilities +--- ---Whether inlay hints support dynamic registration. ---@field dynamicRegistration? boolean +--- ---Indicates which properties a client can resolve lazily on an inlay ---hint. ----@field resolveSupport? anonym42 +---@field resolveSupport? lsp._anonym42.resolveSupport ---Client capabilities specific to diagnostic pull requests. --- ---@since 3.17.0 ---@class lsp.DiagnosticClientCapabilities +--- ---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. ---@field dynamicRegistration? boolean +--- ---Whether the clients supports related documents for document diagnostic pulls. ---@field relatedDocumentSupport? boolean @@ -3540,6 +4221,7 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@proposed ---@class lsp.InlineCompletionClientCapabilities +--- ---Whether implementation supports dynamic registration for inline completion providers. ---@field dynamicRegistration? boolean @@ -3547,23 +4229,27 @@ error('Cannot require a meta file') --- ---@since 3.17.0 ---@class lsp.NotebookDocumentSyncClientCapabilities +--- ---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. ---@field dynamicRegistration? boolean +--- ---The client supports sending execution summary data per cell. ---@field executionSummarySupport? boolean ---Show message request client capabilities ---@class lsp.ShowMessageRequestClientCapabilities +--- ---Capabilities specific to the `MessageActionItem` type. ----@field messageActionItem? anonym43 +---@field messageActionItem? lsp._anonym43.messageActionItem ---Client capabilities for the showDocument request. --- ---@since 3.16.0 ---@class lsp.ShowDocumentClientCapabilities +--- ---The client has support for the showDocument ---request. ---@field support boolean @@ -3572,8 +4258,10 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.RegularExpressionsClientCapabilities +--- ---The engine's name. ---@field engine string +--- ---The engine's version. ---@field version? string @@ -3581,10 +4269,13 @@ error('Cannot require a meta file') --- ---@since 3.16.0 ---@class lsp.MarkdownClientCapabilities +--- ---The name of the parser. ---@field parser string +--- ---The version of the parser. ---@field version? string +--- ---A list of HTML tags that the client allows / supports in ---Markdown. --- @@ -3979,11 +4670,11 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@alias lsp.DocumentDiagnosticReport lsp.RelatedFullDocumentDiagnosticReport|lsp.RelatedUnchangedDocumentDiagnosticReport ----@alias lsp.PrepareRenameResult lsp.Range|anonym44|anonym45 +---@alias lsp.PrepareRenameResult lsp.Range|lsp._anonym44.PrepareRenameResult|lsp._anonym45.PrepareRenameResult ---A document selector is the combination of one or many document filters. --- ----@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; +---\@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; --- ---The use of a string as a document filter is deprecated @since 3.16.0. ---@alias lsp.DocumentSelector lsp.DocumentFilter[] @@ -4000,7 +4691,7 @@ error('Cannot require a meta file') ---An event describing a change to a text document. If only a text is provided ---it is considered to be the full content of the document. ----@alias lsp.TextDocumentContentChangeEvent anonym46|anonym47 +---@alias lsp.TextDocumentContentChangeEvent lsp._anonym46.TextDocumentContentChangeEvent|lsp._anonym47.TextDocumentContentChangeEvent ---MarkedString can be used to render human readable text. It is either a markdown string ---or a code-block that provides a language and a code snippet. The language identifier @@ -4014,7 +4705,7 @@ error('Cannot require a meta file') --- ---Note that markdown strings will be sanitized - that means html will be escaped. ---@deprecated use MarkupContent instead. ----@alias lsp.MarkedString string|anonym48 +---@alias lsp.MarkedString string|lsp._anonym48.MarkedString ---A document filter describes a top level text document or ---a notebook cell document. @@ -4039,120 +4730,145 @@ error('Cannot require a meta file') ---- `*` to match one or more characters in a path segment ---- `?` to match on one character in a path segment ---- `**` to match any number of path segments, including none ----- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +---- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) ---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) ---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) --- ----@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` ----@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` +---\@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` +---\@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` --- ---@since 3.17.0 ----@alias lsp.TextDocumentFilter anonym49|anonym50|anonym51 +---@alias lsp.TextDocumentFilter lsp._anonym49.TextDocumentFilter|lsp._anonym50.TextDocumentFilter|lsp._anonym51.TextDocumentFilter ---A notebook document filter denotes a notebook document by ---different properties. The properties will be match ---against the notebook's URI (same as with documents) --- ---@since 3.17.0 ----@alias lsp.NotebookDocumentFilter anonym52|anonym53|anonym54 +---@alias lsp.NotebookDocumentFilter lsp._anonym52.NotebookDocumentFilter|lsp._anonym53.NotebookDocumentFilter|lsp._anonym54.NotebookDocumentFilter ---The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: ---- `*` to match one or more characters in a path segment ---- `?` to match on one character in a path segment ---- `**` to match any number of path segments, including none ----- `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +---- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) ---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) ---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) --- ---@since 3.17.0 ---@alias lsp.Pattern string ----@class anonym1 +---@class lsp._anonym1.serverInfo +--- ---The name of the server as defined by the server. ---@field name string +--- ---The server's version as defined by the server. ---@field version? string ----@class anonym3 +---@class lsp._anonym3.itemDefaults.editRange +--- ---@field insert lsp.Range +--- ---@field replace lsp.Range ----@class anonym2 +---@class lsp._anonym2.itemDefaults +--- ---A default commit character set. --- ---@since 3.17.0 ---@field commitCharacters? string[] +--- ---A default edit range. --- ---@since 3.17.0 ----@field editRange? lsp.Range|anonym3 +---@field editRange? lsp.Range|lsp._anonym3.itemDefaults.editRange +--- ---A default insert text format. --- ---@since 3.17.0 ---@field insertTextFormat? lsp.InsertTextFormat +--- ---A default insert text mode. --- ---@since 3.17.0 ---@field insertTextMode? lsp.InsertTextMode +--- ---A default data value. --- ---@since 3.17.0 ---@field data? lsp.LSPAny ----@class anonym4 +---@class lsp._anonym4.disabled +--- ---Human readable description of why the code action is currently disabled. --- ---This is displayed in the code actions UI. ---@field reason string ----@class anonym5 +---@class lsp._anonym5.location +--- ---@field uri lsp.DocumentUri ----@class anonym6 +---@class lsp._anonym6.range ----@class anonym7 +---@class lsp._anonym7.full +--- ---The server supports deltas for full documents. ---@field delta? boolean ----@class anonym9 +---@class lsp._anonym9.cells.structure +--- ---The change to the cell array. ---@field array lsp.NotebookCellArrayChange +--- ---Additional opened cell text documents. ---@field didOpen? lsp.TextDocumentItem[] +--- ---Additional closed cell text documents. ---@field didClose? lsp.TextDocumentIdentifier[] ----@class anonym10 +---@class lsp._anonym10.cells.textContent +--- ---@field document lsp.VersionedTextDocumentIdentifier +--- ---@field changes lsp.TextDocumentContentChangeEvent[] ----@class anonym8 +---@class lsp._anonym8.cells +--- ---Changes to the cell structure to add or ---remove cells. ----@field structure? anonym9 +---@field structure? lsp._anonym9.cells.structure +--- ---Changes to notebook cells properties like its ---kind, execution summary or metadata. ---@field data? lsp.NotebookCell[] +--- ---Changes to the text content of notebook cells. ----@field textContent? anonym10[] +---@field textContent? lsp._anonym10.cells.textContent[] ----@class anonym11 +---@class lsp._anonym11.clientInfo +--- ---The name of the client as defined by the client. ---@field name string +--- ---The client's version as defined by the client. ---@field version? string ----@class anonym12 +---@class lsp._anonym12.workspace +--- ---The server supports workspace folder. --- ---@since 3.6.0 ---@field workspaceFolders? lsp.WorkspaceFoldersServerCapabilities +--- ---The server is interested in notifications/requests for operations on files. --- ---@since 3.16.0 ---@field fileOperations? lsp.FileOperationOptions ----@class anonym13 +---@class lsp._anonym13.completionItem +--- ---The server has support for completion item label ---details (see also `CompletionItemLabelDetails`) when ---receiving a completion item in a resolve call. @@ -4160,43 +4876,53 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@field labelDetailsSupport? boolean ----@class anonym15 +---@class lsp._anonym15.notebookSelector.cells +--- ---@field language string ----@class anonym14 +---@class lsp._anonym14.notebookSelector +--- ---The notebook to be synced If a string ---value is provided it matches against the ---notebook type. '*' matches every notebook. ---@field notebook string|lsp.NotebookDocumentFilter +--- ---The cells of the matching notebook to be synced. ----@field cells? anonym15[] +---@field cells? lsp._anonym15.notebookSelector.cells[] ----@class anonym17 +---@class lsp._anonym17.notebookSelector.cells +--- ---@field language string ----@class anonym16 +---@class lsp._anonym16.notebookSelector +--- ---The notebook to be synced If a string ---value is provided it matches against the ---notebook type. '*' matches every notebook. ---@field notebook? string|lsp.NotebookDocumentFilter +--- ---The cells of the matching notebook to be synced. ----@field cells anonym17[] +---@field cells lsp._anonym17.notebookSelector.cells[] ----@class anonym18 +---@class lsp._anonym18.staleRequestSupport +--- ---The client will actively cancel the request. ---@field cancel boolean +--- ---The list of requests for which the client ---will retry the request if it receives a ---response with error code `ContentModified` ---@field retryOnContentModified string[] ----@class anonym19 +---@class lsp._anonym19.changeAnnotationSupport +--- ---Whether the client groups edits with equal labels into tree nodes, ---for instance all edits labelled with "Changes in Strings" would ---be a tree node. ---@field groupsOnLabel? boolean ----@class anonym20 +---@class lsp._anonym20.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 @@ -4207,27 +4933,33 @@ error('Cannot require a meta file') ---the initial version of the protocol. ---@field valueSet? lsp.SymbolKind[] ----@class anonym21 +---@class lsp._anonym21.tagSupport +--- ---The tags supported by the client. ---@field valueSet lsp.SymbolTag[] ----@class anonym22 +---@class lsp._anonym22.resolveSupport +--- ---The properties that a client can resolve lazily. Usually ---`location.range` ---@field properties string[] ----@class anonym24 +---@class lsp._anonym24.completionItem.tagSupport +--- ---The tags supported by the client. ---@field valueSet lsp.CompletionItemTag[] ----@class anonym25 +---@class lsp._anonym25.completionItem.resolveSupport +--- ---The properties that a client can resolve lazily. ---@field properties string[] ----@class anonym26 +---@class lsp._anonym26.completionItem.insertTextModeSupport +--- ---@field valueSet lsp.InsertTextMode[] ----@class anonym23 +---@class lsp._anonym23.completionItem +--- ---Client supports snippets as insert text. --- ---A snippet can define tab stops and placeholders with `$1`, `$2` @@ -4235,46 +4967,56 @@ error('Cannot require a meta file') ---the end of the snippet. Placeholders with equal identifiers are linked, ---that is typing in one will update others too. ---@field snippetSupport? boolean +--- ---Client supports commit characters on a completion item. ---@field commitCharactersSupport? boolean +--- ---Client supports the following content formats for the documentation ---property. The order describes the preferred format of the client. ---@field documentationFormat? lsp.MarkupKind[] +--- ---Client supports the deprecated property on a completion item. ---@field deprecatedSupport? boolean +--- ---Client supports the preselect property on a completion item. ---@field preselectSupport? boolean +--- ---Client supports the tag property on a completion item. Clients supporting ---tags have to handle unknown tags gracefully. Clients especially need to ---preserve unknown tags when sending a completion item back to the server in ---a resolve call. --- ---@since 3.15.0 ----@field tagSupport? anonym24 +---@field tagSupport? lsp._anonym24.completionItem.tagSupport +--- ---Client support insert replace edit to control different behavior if a ---completion item is inserted in the text or should replace text. --- ---@since 3.16.0 ---@field insertReplaceSupport? boolean +--- ---Indicates which properties a client can resolve lazily on a completion ---item. Before version 3.16.0 only the predefined properties `documentation` ---and `details` could be resolved lazily. --- ---@since 3.16.0 ----@field resolveSupport? anonym25 +---@field resolveSupport? lsp._anonym25.completionItem.resolveSupport +--- ---The client supports the `insertTextMode` property on ---a completion item to override the whitespace handling mode ---as defined by the client (see `insertTextMode`). --- ---@since 3.16.0 ----@field insertTextModeSupport? anonym26 +---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport +--- ---The client has support for completion item label ---details (see also `CompletionItemLabelDetails`). --- ---@since 3.17.0 ---@field labelDetailsSupport? boolean ----@class anonym27 +---@class lsp._anonym27.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 @@ -4285,7 +5027,8 @@ error('Cannot require a meta file') ---the initial version of the protocol. ---@field valueSet? lsp.CompletionItemKind[] ----@class anonym28 +---@class lsp._anonym28.completionList +--- ---The client supports the following itemDefaults on ---a completion list. --- @@ -4296,24 +5039,29 @@ error('Cannot require a meta file') ---@since 3.17.0 ---@field itemDefaults? string[] ----@class anonym30 +---@class lsp._anonym30.signatureInformation.parameterInformation +--- ---The client supports processing label offsets instead of a ---simple label string. --- ---@since 3.14.0 ---@field labelOffsetSupport? boolean ----@class anonym29 +---@class lsp._anonym29.signatureInformation +--- ---Client supports the following content formats for the documentation ---property. The order describes the preferred format of the client. ---@field documentationFormat? lsp.MarkupKind[] +--- ---Client capabilities specific to parameter information. ----@field parameterInformation? anonym30 +---@field parameterInformation? lsp._anonym30.signatureInformation.parameterInformation +--- ---The client supports the `activeParameter` property on `SignatureInformation` ---literal. --- ---@since 3.16.0 ---@field activeParameterSupport? boolean +--- ---The client supports the `activeParameter` property on ---`SignatureInformation` being set to `null` to indicate that no ---parameter should be active. @@ -4321,7 +5069,8 @@ error('Cannot require a meta file') ---@since 3.18.0 ---@field noActiveParameterSupport? boolean ----@class anonym31 +---@class lsp._anonym31.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 @@ -4332,138 +5081,177 @@ error('Cannot require a meta file') ---the initial version of the protocol. ---@field valueSet? lsp.SymbolKind[] ----@class anonym32 +---@class lsp._anonym32.tagSupport +--- ---The tags supported by the client. ---@field valueSet lsp.SymbolTag[] ----@class anonym34 +---@class lsp._anonym34.codeActionLiteralSupport.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. ---@field valueSet lsp.CodeActionKind[] ----@class anonym33 +---@class lsp._anonym33.codeActionLiteralSupport +--- ---The code action kind is support with the following value ---set. ----@field codeActionKind anonym34 +---@field codeActionKind lsp._anonym34.codeActionLiteralSupport.codeActionKind ----@class anonym35 +---@class lsp._anonym35.resolveSupport +--- ---The properties that a client can resolve lazily. ---@field properties string[] ----@class anonym36 +---@class lsp._anonym36.foldingRangeKind +--- ---The folding range 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. ---@field valueSet? lsp.FoldingRangeKind[] ----@class anonym37 +---@class lsp._anonym37.foldingRange +--- ---If set, the client signals that it supports setting collapsedText on ---folding ranges to display custom labels instead of the default text. --- ---@since 3.17.0 ---@field collapsedText? boolean ----@class anonym38 +---@class lsp._anonym38.tagSupport +--- ---The tags supported by the client. ---@field valueSet lsp.DiagnosticTag[] ----@class anonym40 +---@class lsp._anonym40.requests.range ----@class anonym41 +---@class lsp._anonym41.requests.full +--- ---The client will send the `textDocument/semanticTokens/full/delta` request if ---the server provides a corresponding handler. ---@field delta? boolean ----@class anonym39 +---@class lsp._anonym39.requests +--- ---The client will send the `textDocument/semanticTokens/range` request if ---the server provides a corresponding handler. ----@field range? boolean|anonym40 +---@field range? boolean|lsp._anonym40.requests.range +--- ---The client will send the `textDocument/semanticTokens/full` request if ---the server provides a corresponding handler. ----@field full? boolean|anonym41 +---@field full? boolean|lsp._anonym41.requests.full ----@class anonym42 +---@class lsp._anonym42.resolveSupport +--- ---The properties that a client can resolve lazily. ---@field properties string[] ----@class anonym43 +---@class lsp._anonym43.messageActionItem +--- ---Whether the client supports additional attributes which ---are preserved and send back to the server in the ---request's response. ---@field additionalPropertiesSupport? boolean ----@class anonym44 +---@class lsp._anonym44.PrepareRenameResult +--- ---@field range lsp.Range +--- ---@field placeholder string ----@class anonym45 +---@class lsp._anonym45.PrepareRenameResult +--- ---@field defaultBehavior boolean ----@class anonym46 +---@class lsp._anonym46.TextDocumentContentChangeEvent +--- ---The range of the document that changed. ---@field range lsp.Range +--- ---The optional length of the range that got replaced. --- ---@deprecated use range instead. ---@field rangeLength? uinteger +--- ---The new text for the provided range. ---@field text string ----@class anonym47 +---@class lsp._anonym47.TextDocumentContentChangeEvent +--- ---The new text of the whole document. ---@field text string ----@class anonym48 +---@class lsp._anonym48.MarkedString +--- ---@field language string +--- ---@field value string ----@class anonym49 +---@class lsp._anonym49.TextDocumentFilter +--- ---A language id, like `typescript`. ---@field language string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string ----A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. +--- +---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern? string ----@class anonym50 +---@class lsp._anonym50.TextDocumentFilter +--- ---A language id, like `typescript`. ---@field language? string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme string ----A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. +--- +---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern? string ----@class anonym51 +---@class lsp._anonym51.TextDocumentFilter +--- ---A language id, like `typescript`. ---@field language? string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string ----A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. +--- +---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. ---@field pattern string ----@class anonym52 +---@class lsp._anonym52.NotebookDocumentFilter +--- ---The type of the enclosing notebook. ---@field notebookType string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string +--- ---A glob pattern. ---@field pattern? string ----@class anonym53 +---@class lsp._anonym53.NotebookDocumentFilter +--- ---The type of the enclosing notebook. ---@field notebookType? string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme string +--- ---A glob pattern. ---@field pattern? string ----@class anonym54 +---@class lsp._anonym54.NotebookDocumentFilter +--- ---The type of the enclosing notebook. ---@field notebookType? string +--- ---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. ---@field scheme? string +--- ---A glob pattern. ---@field pattern string -- cgit From 8492a84bfd4f9f743bd86a34875cc6b82fd0df96 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 26 Dec 2023 19:05:36 +0100 Subject: vim-patch:9042bd8b09ba runtime(r): Update R runtime files and docs (vim/vim#13757) * Update R runtime files - Fix indentation issue with ggplot(). - Setlocal autoindent in indent/r.vim. - New syntax option: rmd_include_latex. - Clear syn iskeyword to recognize _ as keyword. - Document some options. - remove the test has("patch-7.4.1142") - Update changed date of doc files https://github.com/vim/vim/commit/9042bd8b09bae0051fdf8eb5a57fa4b4420c92a0 Co-authored-by: Jakson Alves de Aquino --- runtime/doc/filetype.txt | 8 ++++++ runtime/doc/indent.txt | 4 +-- runtime/doc/syntax.txt | 18 +++++++++--- runtime/indent/r.vim | 75 ++++++++++++++++++++++-------------------------- runtime/syntax/r.vim | 8 ++---- runtime/syntax/rmd.vim | 50 +++++++++++++++++++++++++++----- 6 files changed, 104 insertions(+), 59 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 115fc18cc5..96cd0f8ab0 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -735,6 +735,14 @@ To enable this behavior, set the following variable in your vimrc: > let g:rst_style = 1 +RNOWEB *ft-rnoweb-plugin* + +The 'formatexpr' option is set dynamically with different values for R code +and for LaTeX code. If you prefer that 'formatexpr' is not set, add to your +|vimrc|: > + let rnw_dynamic_comments = 0 + + RPM SPEC *ft-spec-plugin* Since the text for this plugin is rather long it has been put in a separate diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 1cd5c7b5f5..99467e4b03 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1031,8 +1031,8 @@ r_indent_comment_column, as in the example below: let r_indent_comment_column = 30 < Any code after a line that ends with "<-" is indented. Emacs/ESS does not -indent the code if it is a top level function. If you prefer that the -Vim-R-plugin behaves like Emacs/ESS in this regard, put in your |vimrc|: +indent the code if it is a top-level function. If you prefer a behavior like +Emacs/ESS one in this regard, put in your |vimrc|: > let r_indent_ess_compatible = 1 < diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index cf345d9c96..546e2c15cf 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2801,10 +2801,20 @@ To highlight R code in knitr chunk headers: > let rmd_syn_hl_chunk = 1 By default, chunks of R code will be highlighted following the rules of R -language. If you want proper syntax highlighting of chunks of other languages, -you should add them to either `markdown_fenced_languages` or -`rmd_fenced_languages`. For example to properly highlight both R and Python, -you may add this to your |vimrc|: > +language. Moreover, whenever the buffer is saved, Vim scans the buffer and +highlights other languages if they are present in new chunks. LaTeX code also +is automatically recognized and highlighted when the buffer is saved. This +behavior can be controlled with the variables `rmd_dynamic_fenced_languages`, +and `rmd_include_latex` whose valid values are: > + let rmd_dynamic_fenced_languages = 0 " No autodetection of languages + let rmd_dynamic_fenced_languages = 1 " Autodetection of languages + let rmd_include_latex = 0 " Don't highlight LaTeX code + let rmd_include_latex = 1 " Autodetect LaTeX code + let rmd_include_latex = 2 " Always include LaTeX highlighting + +If the value of `rmd_dynamic_fenced_languages` is 0, you still can set the +list of languages whose chunks of code should be properly highlighted, as in +the example: > let rmd_fenced_languages = ['r', 'python'] diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 07dfd13881..f7956e4fe0 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -2,7 +2,7 @@ " Language: R " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon Feb 27, 2023 07:16PM +" Last Change: Sun Oct 08, 2023 10:45AM " Only load this indent file when no other was loaded. @@ -13,6 +13,7 @@ let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRIndent() +setlocal autoindent let b:undo_indent = "setl inde< indk<" @@ -47,27 +48,23 @@ function s:RDelete_quotes(line) if a:line[i] == '"' let i += 1 endif - else + elseif a:line[i] == "'" + let i += 1 + let line1 = line1 . 's' + while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen + let i += 1 + endwhile if a:line[i] == "'" let i += 1 - let line1 = line1 . 's' - while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen - let i += 1 - endwhile - if a:line[i] == "'" - let i += 1 - endif - else - if a:line[i] == "`" - let i += 1 - let line1 = line1 . 's' - while a:line[i] != "`" && i < llen - let i += 1 - endwhile - if a:line[i] == "`" - let i += 1 - endif - endif + endif + elseif a:line[i] == "`" + let i += 1 + let line1 = line1 . 's' + while a:line[i] != "`" && i < llen + let i += 1 + endwhile + if a:line[i] == "`" + let i += 1 endif endif if i == llen @@ -97,10 +94,8 @@ function s:RDelete_parens(line) let i += 1 if a:line[i] == ')' let nop -= 1 - else - if a:line[i] == '(' - let nop += 1 - endif + elseif a:line[i] == '(' + let nop += 1 endif endwhile let line1 = line1 . a:line[i] @@ -174,10 +169,8 @@ function s:Get_last_paren_idx(line, o, c, pb) if blc == 0 let theidx = idx endif - else - if line[idx] == a:c - let blc += 1 - endif + elseif line[idx] == a:c + let blc += 1 endif let idx += 1 endwhile @@ -316,6 +309,11 @@ function GetRIndent() endif if pb < 0 && line =~ '.*[,&|\-\*+<>]$' + if line =~ '.*[\-\*+>]$' + let is_op = v:true + else + let is_op = v:false + endif let lnum = s:Get_prev_line(lnum) while pb < 1 && lnum > 0 let line = SanitizeRLine(getline(lnum)) @@ -324,9 +322,10 @@ function GetRIndent() while ind > 0 if line[ind] == ')' let pb -= 1 - else - if line[ind] == '(' - let pb += 1 + elseif line[ind] == '(' + let pb += 1 + if is_op && pb == 0 + return indent(lnum) endif endif if pb == 1 @@ -367,10 +366,8 @@ function GetRIndent() else return indent(lnum) + shiftwidth() endif - else - if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 - return indent(lnum) - shiftwidth() - endif + elseif substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + return indent(lnum) - shiftwidth() endif elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) + shiftwidth() @@ -404,12 +401,10 @@ function GetRIndent() if cline =~ '^\s*else' if line =~ '<-\s*if\s*()' return indent(lnum) + shiftwidth() + elseif line =~ '\ " Contributor: Johannes Ranke " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Thu Nov 17, 2022 10:13PM +" Last Change: Sun Dec 24, 2023 08:05AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions might be defined in @@ -26,11 +26,7 @@ if exists("b:current_syntax") finish endif -if has("patch-7.4.1142") - syn iskeyword @,48-57,_,. -else - setlocal iskeyword=@,48-57,_,. -endif +syn iskeyword @,48-57,_,. " The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017. if exists("g:r_hl_roxygen") diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 93343dd729..7b8b7fea50 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,7 +1,7 @@ " Language: Markdown with chunks of R, Python and other languages " Maintainer: Jakson Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed May 17, 2023 06:34AM +" Last Change: Sun Dec 24, 2023 07:21AM " " For highlighting pandoc extensions to markdown like citations and TeX and " many other advanced features like folding of markdown sections, it is @@ -16,6 +16,13 @@ endif let s:cpo_save = &cpo set cpo&vim +let g:rmd_include_latex = get(g:, 'rmd_include_latex', 1) +if g:rmd_include_latex == 0 || g:rmd_include_latex == 1 + let b:rmd_has_LaTeX = v:false +elseif g:rmd_include_latex == 2 + let b:rmd_has_LaTeX = v:true +endif + " Highlight the header of the chunks as R code let g:rmd_syn_hl_chunk = get(g:, 'rmd_syn_hl_chunk', 0) @@ -136,7 +143,7 @@ syn match knitrBodyVar '| \zs\S\{-}\ze:' contained containedin=knitrBodyOptions let g:rmd_fenced_languages = get(g:, 'rmd_fenced_languages', ['r']) let s:no_syntax_vim = [] -function IncludeLanguage(lng) +function s:IncludeLanguage(lng) if a:lng =~ '=' let ftpy = substitute(a:lng, '.*=', '', '') let lnm = substitute(a:lng, '=.*', '', '') @@ -171,11 +178,23 @@ function IncludeLanguage(lng) endfunction for s:type in g:rmd_fenced_languages - call IncludeLanguage(s:type) + call s:IncludeLanguage(s:type) endfor unlet! s:type -function CheckRmdFencedLanguages() +let s:LaTeX_included = v:false +function s:IncludeLaTeX() + let s:LaTeX_included = v:true + unlet! b:current_syntax + syn include @RmdLaTeX syntax/tex.vim + " From vim-pandoc-syntax + syn region rmdLaTeXInlineMath start=/\v\\@ 0 || + \ search('\\begin{', 'wn') > 0) || + \ search('\\[[:alpha:]]\+', 'wn') || + \ search('\$[^\$]\+\$', 'wn') + let b:rmd_has_LaTeX = v:true + endif + if b:rmd_has_LaTeX && !s:LaTeX_included + call s:IncludeLaTeX() + endif + endif endfunction if g:rmd_dynamic_fenced_languages - call CheckRmdFencedLanguages() + call s:CheckRmdFencedLanguages() augroup RmdSyntax autocmd! - autocmd BufWritePost call CheckRmdFencedLanguages() + autocmd BufWritePost call s:CheckRmdFencedLanguages() augroup END endif @@ -225,6 +259,8 @@ unlet s:save_pandoc_lngs let &cpo = s:cpo_save unlet s:cpo_save +syntax iskeyword clear + let b:current_syntax = "rmd" " vim: ts=8 sw=2 -- cgit From e0eb4188bfabefac54dd7cdcfe57fbb6ddb724b5 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 27 Dec 2023 09:42:30 +0100 Subject: revert: "fix: correct versions in deprecation warnings" This reverts commit 5cb906e91cb56302d0737aa80e2d890dde452029. They were intentionally fast-tracked. - `parse_snippet()` because of limited scope, and given that it's kinda semi-broken (arbitrary formatting rules, not that useful for what it was used for) - `extract_completion_items()` doesn't work if we want to add the LSP completionlist capability - `text_document_completion_list_to_complete_items()` also doesn't work for completionlist --- runtime/lua/vim/lsp/util.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 90e2f28ef4..ba7ce3c2b6 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -553,7 +553,7 @@ end ---@return lsp.CompletionItem[] List of completion items ---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion function M.extract_completion_items(result) - vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.12') + vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.11') if type(result) == 'table' and result.items then -- result is a `CompletionList` return result.items @@ -613,7 +613,7 @@ end ---@param input string unparsed snippet ---@return string parsed snippet function M.parse_snippet(input) - vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.12') + vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.11') local ok, parsed = pcall(function() return snippet.parse(input) end) @@ -635,7 +635,7 @@ end ---@return table[] items ---@see complete-items function M.text_document_completion_list_to_complete_items(result, prefix) - vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.12') + vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11') return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix) end -- cgit From e0d998dbc8b8e7047e1cc2bb520aea4d0b34f726 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 28 Dec 2023 08:48:03 +0800 Subject: vim-patch:65672ae1189e (#26767) runtime(doc): clarify behaviour of ]m and ]M motions In particular remove the sentence, that a missing '{' (for ]m) or '}' (for ]M) after the cursor is an error, since currently this is not treated as an error. fixes: vim/vim#13777 https://github.com/vim/vim/commit/65672ae1189e0638fb68856598b98a2b7ee2a0a8 Co-authored-by: Christian Brabandt --- runtime/doc/motion.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index aa18e44225..b72dd8d39c 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1292,14 +1292,12 @@ bring you back to the switch statement. ]m Go to [count] next start of a method (for Java or similar structured language). When not before the start of a method, jump to the start or end of the - class. When no '{' is found after the cursor, this is - an error. |exclusive| motion. + class. |exclusive| motion. *]M* ]M Go to [count] next end of a method (for Java or similar structured language). When not before the end of a method, jump to the start or end of the class. - When no '}' is found after the cursor, this is an - error. |exclusive| motion. + |exclusive| motion. *[m* [m Go to [count] previous start of a method (for Java or similar structured language). When not after the -- cgit From 714b075197c02d27d5c05133759ae97bed279b50 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 28 Dec 2023 03:28:48 +0100 Subject: docs: small fixes (#26651) Co-authored-by: Gregory Anders Co-authored-by: WillLillis --- runtime/doc/api.txt | 1 - runtime/doc/news.txt | 6 +++--- runtime/lua/vim/_defaults.lua | 2 +- runtime/lua/vim/_meta/api.lua | 1 - runtime/lua/vim/health.lua | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 6a69bf7b41..b2581c8752 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3110,7 +3110,6 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()* Example (Lua): buffer-relative float (travels as buffer is scrolled) >lua vim.api.nvim_open_win(0, false, {relative='win', width=12, height=3, bufpos={100,10}}) - }) < Attributes: ~ diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index a256db76d6..abba8fbd75 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -112,9 +112,6 @@ The following changes may require adaptations in user config or plugins. • 'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color. -• `Q` now repeats a macro for each line of a visual selection. -• `@` now repeats the indicated macro for each line of a visual selection. - ============================================================================== BREAKING CHANGES IN HEAD *news-breaking-dev* @@ -275,6 +272,9 @@ The following new APIs and features were added. • |nvim_input_mouse()| supports mouse buttons "x1" and "x2". +• |v_Q-default| and |v_@-default| repeat a register for each line of a visual + selection. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 0d756b8701..af962eea5d 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -194,7 +194,7 @@ if tty then --- already set by the user. --- --- @param option string Option name - --- @param value string Option value + --- @param value any Option value local function setoption(option, value) if vim.api.nvim_get_option_info2(option, {}).was_set then -- Don't do anything if option is already set diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index ba18a16488..d94cef481e 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1493,7 +1493,6 @@ function vim.api.nvim_open_term(buffer, opts) end --- ```lua --- vim.api.nvim_open_win(0, false, --- {relative='win', width=12, height=3, bufpos={100,10}}) ---- }) --- ``` --- --- @param buffer integer Buffer to display, or 0 for current buffer diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 6c96a703bb..23771d2807 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -251,7 +251,7 @@ local path2name = function(path) end local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' } --- :checkhealth completion function used by ex_getln.c get_healthcheck_names() +-- :checkhealth completion function used by cmdexpand.c get_healthcheck_names() M._complete = function() local names = vim.tbl_flatten(vim.tbl_map(function(pattern) return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true)) -- cgit From aece3a7f5f15ce364396a0663c870d53110c6fb5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 27 Dec 2023 18:55:47 +0100 Subject: vim-patch:00b470052b71 runtime(diff): Update default links (vim/vim#13776) Problem: Current default links for `diffAdded`, `diffChanged`, and `diffRemoved` do not address the diff nature of the filetype. Solution: Use `DiffAdd`, `DiffChange`, and `DiffDelete`. closes: vim/vim#13759 https://github.com/vim/vim/commit/00b470052b71ca10d663186d99683e8379b21154 Co-authored-by: Evgeni Chasnovski --- runtime/syntax/diff.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index 4cadf5dae8..b5c3f5ecbb 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -378,9 +378,9 @@ hi def link diffBDiffer Constant hi def link diffIsA Constant hi def link diffNoEOL Constant hi def link diffCommon Constant -hi def link diffRemoved Special -hi def link diffChanged PreProc -hi def link diffAdded Identifier +hi def link diffRemoved DiffDelete +hi def link diffChanged DiffChange +hi def link diffAdded DiffAdd hi def link diffLine Statement hi def link diffSubname PreProc hi def link diffComment Comment -- cgit From 44c7833193fb4e851e8c1788855e7abb62a03347 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 27 Dec 2023 19:03:37 +0100 Subject: vim-patch:a03647acc313 runtime(mermaid): Syntax fix (vim/vim#13774) * runtime(mermaid): Fix arrow syntax * runtime(mermaid): Disable syntax for identifier to avoid false match * runtime(mermaid): Add some C++ type syntax highlight * runtime(mermaid): Update last change time in header https://github.com/vim/vim/commit/a03647acc313edfcc4f9cde07efe388762ada436 Co-authored-by: KSR-Yasuda <31273423+KSR-Yasuda@users.noreply.github.com> --- runtime/syntax/mermaid.vim | 52 +++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/mermaid.vim b/runtime/syntax/mermaid.vim index afdbcc3d62..5a9a217337 100644 --- a/runtime/syntax/mermaid.vim +++ b/runtime/syntax/mermaid.vim @@ -2,7 +2,7 @@ " Language: Mermaid " Maintainer: Craig MacEahern " Filenames: *.mmd -" Last Change: 2022 Nov 22 +" Last Change: 2023 Dec 26 if exists("b:current_syntax") finish @@ -85,54 +85,30 @@ syntax keyword mermaidKeyword highlight link mermaidKeyword Keyword syntax match mermaidStatement "|" -syntax match mermaidStatement "--\?[>x)]>\?+\?-\?" syntax match mermaidStatement "\~\~\~" syntax match mermaidStatement "--" -syntax match mermaidStatement "---" -syntax match mermaidStatement "-->" +syntax match mermaidStatement "\%(<|\|[<*o]\)\?\%(--\|\.\.\)\%(|>\|[>*o]\)\?" +syntax match mermaidStatement "-\{2,4}[>ox-]" +syntax match mermaidStatement "\.-[>ox]" syntax match mermaidStatement "-\." -syntax match mermaidStatement "\.->" -syntax match mermaidStatement "-\.-" -syntax match mermaidStatement "-\.\.-" -syntax match mermaidStatement "-\.\.\.-" +syntax match mermaidStatement "-\.\{1,3}-" syntax match mermaidStatement "==" -syntax match mermaidStatement "==>" -syntax match mermaidStatement "===>" -syntax match mermaidStatement "====>" +syntax match mermaidStatement "=\{2,4}[>ox=]" syntax match mermaidStatement "&" -syntax match mermaidStatement "--o" -syntax match mermaidStatement "--x" +syntax match mermaidStatement "--\?[>x)]>\?[+-]\?" syntax match mermaidStatement "x--x" -syntax match mermaidStatement "-----" -syntax match mermaidStatement "---->" -syntax match mermaidStatement "===" -syntax match mermaidStatement "====" -syntax match mermaidStatement "=====" +syntax match mermaidStatement "o--o\?" +syntax match mermaidStatement "<-->\?" syntax match mermaidStatement ":::" -syntax match mermaidStatement "<|--" -syntax match mermaidStatement "\*--" -syntax match mermaidStatement "o--" -syntax match mermaidStatement "o--o" -syntax match mermaidStatement "<--" -syntax match mermaidStatement "<-->" -syntax match mermaidStatement "\.\." -syntax match mermaidStatement "<\.\." -syntax match mermaidStatement "<|\.\." -syntax match mermaidStatement "--|>" -syntax match mermaidStatement "--\*" -syntax match mermaidStatement "--o" -syntax match mermaidStatement "\.\.>" -syntax match mermaidStatement "\.\.|>" -syntax match mermaidStatement "<|--|>" syntax match mermaidStatement "||--o{" highlight link mermaidStatement Statement -syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?" -highlight link mermaidIdentifier Identifier +" FIXME: This unexpectedly matches flow chart node `id1(text)` or others. +"syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?" +"highlight link mermaidIdentifier Identifier -syntax match mermaidType "[\+-\#\~]\?\cint\>" -syntax match mermaidType "[\+-\#\~]\?\cString\>" -syntax match mermaidType "[\+-\#\~]\?\cbool\>" +syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(unsigned\s\+\)\?\%(int\|u\?int\%(8\|16\|32\|64\)_t\|char\|long\|long\s\+long\)\>\%(\s\+const\|\s*[\*&]\)*" +syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(double\|float\|String\|bool\)\>\%(\s\+const\|\s*[\*&]\)*" syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>" syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~" syntax match mermaidType "<<\w\+>>" -- cgit From ecbfff73065b912775182702d051e7438587db75 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 27 Dec 2023 19:06:20 +0100 Subject: vim-patch:7e2741100737 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime(elixir): fix indentation (vim/vim#13771) https://github.com/vim/vim/commit/7e27411007378e005339ef37503697ae7e183da1 Co-authored-by: George Guimarães --- runtime/ftplugin/elixir.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/ftplugin/elixir.vim b/runtime/ftplugin/elixir.vim index 50f63673dc..29be4fa1ee 100644 --- a/runtime/ftplugin/elixir.vim +++ b/runtime/ftplugin/elixir.vim @@ -1,7 +1,7 @@ " Elixir filetype plugin " Language: Elixir " Maintainer: Mitchell Hanberg -" Last Change: 2022 Sep 20 +" Last Change: 2023 Dec 26 if exists("b:did_ftplugin") finish @@ -27,6 +27,12 @@ setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,? setlocal comments=:# setlocal commentstring=#\ %s +setlocal indentkeys=0#,!^F,o,O +" Enable keys for blocks +setlocal indentkeys+=0=after,0=catch,0=do,0=else,0=end,0=rescue +" Enable keys that are usually the first keys in a line +setlocal indentkeys+=0->,0\|>,0},0],0),> + let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms<' let &cpo = s:save_cpo -- cgit From 320c77fa528e96aac0931383160fa9ce3f7a3eec Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 27 Dec 2023 19:34:28 +0100 Subject: vim-patch:d1cea036467c runtime(elixir): missing undo_ftplugin for indentkeys fixup after vim/vim#13771 https://github.com/vim/vim/commit/d1cea036467ca55d7698378679a1e32c9f056d59 Co-authored-by: Christian Brabandt --- runtime/ftplugin/elixir.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/elixir.vim b/runtime/ftplugin/elixir.vim index 29be4fa1ee..d067f472b7 100644 --- a/runtime/ftplugin/elixir.vim +++ b/runtime/ftplugin/elixir.vim @@ -1,7 +1,7 @@ " Elixir filetype plugin " Language: Elixir " Maintainer: Mitchell Hanberg -" Last Change: 2023 Dec 26 +" Last Change: 2023 Dec 27 if exists("b:did_ftplugin") finish @@ -33,7 +33,7 @@ setlocal indentkeys+=0=after,0=catch,0=do,0=else,0=end,0=rescue " Enable keys that are usually the first keys in a line setlocal indentkeys+=0->,0\|>,0},0],0),> -let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms<' +let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< indk<' let &cpo = s:save_cpo unlet s:save_cpo -- cgit From 53a3e6ac879d89039c69d3e44f46ed9bf857a9d9 Mon Sep 17 00:00:00 2001 From: xvzc <45588457+xvzc@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:13:46 +0900 Subject: docs(eval): add parameter type for vim.fn.mode() (#26776) --- runtime/lua/vim/_meta/vimfn.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 59d9836688..02e794ce10 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -5829,8 +5829,9 @@ function vim.fn.mkdir(name, flags, prot) end --- the leading character(s). --- Also see |visualmode()|. --- +--- @param expr? any --- @return any -function vim.fn.mode() end +function vim.fn.mode(expr) end --- Convert a list of Vimscript objects to msgpack. Returned value is a --- |readfile()|-style list. When {type} contains "B", a |Blob| is -- cgit From 31d7007bf745d3f03902b27c2124d473ec2f8906 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 27 Dec 2023 13:43:48 +0100 Subject: docs: convert BACKERS.md to backers.txt There is no reason for this file to be in project root, which is crowded as is. This also fits nicely part of the ongoing work towards gathering as much of the documentation as possible into one place. --- runtime/doc/backers.txt | 656 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 656 insertions(+) create mode 100644 runtime/doc/backers.txt (limited to 'runtime') diff --git a/runtime/doc/backers.txt b/runtime/doc/backers.txt new file mode 100644 index 0000000000..d0cbd94978 --- /dev/null +++ b/runtime/doc/backers.txt @@ -0,0 +1,656 @@ +*backers.txt* Nvim + + + NVIM REFERENCE MANUAL + + +============================================================================== +Fundraiser Backers + +Thank you to everyone who backed the original Neovim Fundraiser. + +LIST OF BACKERS + +- [Bob Breznak](http://brez.io) +- [Tim Uruski](http://timuruski.net) +- @mikker (http://brnbw.com) +- Aaron J. [@metaxis](http://twitter.com/metaxis) Peterson +- Adam George http://www.adamgeorge.com +- Adam Lindberg (http://alind.io) +- Adam McLain http://twitter.com/adammclain +- Adam Piper http://ahri.net +- Adrian Philipp http://adrian-philipp.com +- Alexander Quine +- Alexandru Dabija +- Alexis Hildebrandt http://surryhill.net +- Andrew M. Farrell http://amfarrell.com +- Anton Beloglazov http://beloglazov.info/ +- Arthur Axel fREW Schmidt - https://blog.afoolishmanifesto.com +- Ben Thouret http://benjamin.thouret.com +- Benedikt Böhm http://bb.xnull.de +- bfredl, http://bfredl.github.io +- Brandon Smith, http://reardencode.com +- Brandon Wang, http://brandonwang.me +- Brennen Bearnes http://p1k3.com +- Brock Wilcox (awwaiid) http://thelackthereof.org/ +- Cameron Eagans http://cweagans.net +- Carl Myers http://cmyers.org/ +- Carlos Alves http://www.carlosalves.info +- Chris Chernesky, http://www.tinderglow.com +- Chris Hartjes +- Christoffer Holmstedt (http://www.christofferholmstedt.se) +- Ciaran Downey +- Craig Bane http://standardizedways.co.uk +- Dane Summers http://pinedesk.biz +- Daniel Collin https://twitter.com/daniel_collin +- Daniel Rogers http://remotecodelist.com +- Darshan Sawardekar http://pressing-matters.io +- David Gabriel http://wiki.dest-unreachable.net +- Deepak Kumar www.kreatio.com +- Derek Rodger http://devslant.com +- ebene fünf GmbH www.ebenefuenf.de +- Ehtesh Choudhury +- Emil Hernvall http://emilhernvall.github.io/ +- Eric Siegel https://github.com/esiegel +- Ethan Schoonover http://ethanschoonover.com +- FFunction http://ffctn.com +- Frank http://duckpun.ch +- Gabriele Lana http://github.com/gabrielelana +- Gavin Rogers http://praxeology.co.uk +- Geoff Greer https://floobits.com/ +- Glenn Strauss https://github.com/gstrauss/ +- Gustav Buchholtz http://grod.se +- Henri Bourcereau http://bourcereau.fr +- http://jaredforsyth.com +- http://www.1bsyl.com +- Johann Dahm (http://johanndahm.com) +- Ian Farmer http://farmernet.net +- iauns - http://www.noobtube.com +- Jacob Jewell www.immersiveapplications.com +- James A. Overton http://james.overton.ca +- James Tomasino - http://jamestomasino.com +- Jamiel Almeida http://slashfoo.com +- Jan Christoph Ebersbach http://www.e-jc.de/ +- Jason Peacock http://jasonpeacock.com +- Jason Weathered http://jasoncodes.com/ +- Javier Maestro +- Jeff Craig http://blog.foxxtrot.net/ +- Jeremy Huffman http://jeremyhuffman.com +- Jeremy Morrell http://rathercurio.us +- Jesper Kjeldgaard (thejspr) - http://thejspr.com +- Jim Hester (http://jimhester.com) +- Joe Moon http://joe.xoxomoon.com +- Johan Simonsson, http://fun-tech.se +- John P. Kiffmeyer (http://jpk.is) +- John Szakmeister http://www.szakmeister.net/ +- John W. Long http://wiseheartdesign.com Twitter: @johnwlong GitHub: @jlong +- Jon Yurek http://thoughtbot.com +- jonaias http://jonaias.info +- Josh Davis, http://joshldavis.com +- Joshua Levesque (www.jandyco.com) +- Justin M. Keyes https://github.com/justinmk +- Justin Russell http://jrussell.me +- kbussell +- Kevin Sjöberg, http://kevinsjoberg.com +- Kevin Sumner http://kevinsumner.com +- Kevin Wu http://kevinformatics.com +- Ley Missailidis, http://polymet.is +- Loa https://github.com/loa +- Lowe Schmidt http://loweschmidt.se +- Marcello Barnaba http://sindro.me/ +- Marcin Kulik - http://ku1ik.com +- Marius Rieder http://www.durchmesser.ch/ +- Mark Allen [@bytemeorg](http://twitter.com/bytemeorg) +- Mark Percival http://markpercival.us +- Mark Sprevak +- Martin Ansdell-Smith https://ansdell.net/ +- Martin Kopischke http://martin.kopischke.net +- masukomi http://masukomi.org +- Matt Greer -- http://mattgreer.org +- MetaCosm | #Vim on Freenode +- Michael Ulm www.mulm.at +- Mikael Jansson http://mikaelj.se +- Mikkel Høgh http://mikkel.hoegh.org/ +- Ming Liu http://ming.codes +- Holger Peters http://www.holger-peters.de +- Alexander Myshov http://myshov.com/ +- Darren Cheng http://sanguinerane.com/ +- Felix Rath www.0fx.eu +- Hong Xu http://www.topbug.net +- Slava Kim https://www.meteor.com +- Nate Soares (So8res) http://so8r.es +- neektza http://pltconfusion.com +- Niclas Nilsson, http://niclasnilsson.se +- Nikolay Bachiyski http://extrapolate.me/ +- Nikush Patel http://nikush.co.uk +- Norman Köhring https://koehr.in +- Osamu Komagata +- Øystein E. Krog https://github.com/oysteinkrog +- Pablo Brasero Moreno http://pablobm.com +- Peter Souter http://www.petersouter.co.uk +- Phil Levchenko (http://philslair.com) +- Pierre Douyon https://github.com/pgdouyon +- Prateek Rungta +- Przemysław Pietrzkiewicz, http://ppi.sh +- Rasmus Mattsson http://zzm.se +- Reed Esau https://github.com/reedes +- Richard Harding https://bmark.us +- Rob Warner http://grailbox.com +- Runar Balstad Jensen, http://stdout.no/ +- Ryan Paul http://seg.phault.net +- Saad Malik - https://github.com/saamalik +- Saggi Malachi - http://sagg.im +- Scott Wessels (http://www.usgn.net) +- Sean DuBois (Sean-Der) http://siobud.com +- Sebastian Vetter (http://www.roadside-developer.com) +- Simen Endsjø, http://simendsjo.me +- Stanley Chan (Happy-Dude) +- Stefan Penner +- Steve Vermeulen https://github.com/svermeulen +- Steven Myint (https://github.com/myint) +- Tae Sandoval Murgan +- The Kompanee http://thekompanee.com +- Thomas Cannon +- Tim Oxley http://campjs.com/ +- Timo Schmiade +- Timothy Dahlin +- Tiziano Santoro +- Toban Wiebe http://tobanwiebe.com +- Tobias Sjösten http://vvv.tobiassjosten.net/ +- Tom Cammann http://github.com/takac +- Val Markovic http://val.markovic.io/ +- Víðir Valberg Guðmundsson http://rabotnik.coop +- Weiyi Lou http://parlseygardens.net +- Wesley Moore http://wezm.net/ +- Woody Peterson, http://www.bitsofsignal.com +- Zach Kelling, http://zeekay.io + +### Your name in BACKERS.md. + +- @a13xb +- @d1eg0 +- @derkha +- @georgebashi +- @tmcw +- @xpayn +- Adam Baxter (voltagex) +- Adam Miller (maxamillion) +- Adam Sunderland/iterion +- Adon Metcalfe (adonm) +- Adrian Duyzer +- Aidan Stein +- ak47 +- Aketzu +- Alessandro Gangemi +- Alessandro Pagnin +- Alessandro Proscia +- Alex Genco (alexgenco) +- Alex Heeton +- Alex Roper +- Alex Soto (apsoto@gmail.com) +- Alexander Flatter +- Alexander Jeurissen +- Alexander Shabalin +- Alexander Woerndle +- Alexandru Keszeg +- Allan Hudgins +- Ami Chayun +- Amit Beka +- Anders Fuzz +- Andre Azzolini +- Andre da Palma +- André Santos/andrefs +- Andrea Michi +- Andreas Heider +- Andreas Lappe +- andrej ocenas / aocenas +- Andrew Arminio @5thWall +- Andrew DeMaria ~ muff1nman +- Andrew Fallows +- Andrew Fecheyr (@andruby) +- Andrew Hartford +- Andrey Tarantsov +- Andrey Yurovsky +- Andy Dirnberger +- Andy Gayton +- Andy Lindeman +- Andy Webster +- AngelLeliel +- Anton Egorov / satyrius +- Anton Shemerey +- Arnaud Bétrémieux +- Arne Ehrlich +- Arseny Zarechnev +- Arvind Deshpande +- Astro Jetson Jr +- Attila Maczak +- Avétis KAZARIAN (avetisk) +- BarryKay +- bbinet +- BenBergman +- Bengt Lüers +- Benjamin Bryant +- Bèr "berkes" Kessels +- Bernd Homuth +- Bheesham Persaud +- Bilal Quadri +- Bjorn Tipling +- Bojan Zivanovic +- Boris Searles +- Braden Bruington +- Brandon Liu/thenovices +- Brandon Mathis - @imathis +- Brett Ritter +- Brian Shaver (shakerlxxv) +- Bryan Grohman +- Bryn Edwards +- Calin Iorgulescu +- calind +- Cameron Wood / cewood +- Chris Lopes +- Chris Lord +- Chris Porter +- Chris Sims (@jcsims) +- Christian Anton / fibbs +- Christian Delahousse cdelahousse +- Christian Lange +- Christian Wellenbrock +- Christophe Badoit +- Christopher Lübbemeier +- Christopher Mullins +- Chungha Kim +- ckromero +- Claas-Thido Pfaff +- Claes Mogren +- Clayton Drazner +- claytron +- Colin Cooper +- corytheboyd +- Cristián Alberto Arenas Ulloa / NiñoScript +- Cyril LEPAGNOT/cyrill62 +- D3 Designs +- DAddYE (github: DAddYE) +- Dan Webb +- Daniel C. Henning / danielsdesk +- Daniel Egeberg +- Daniel Egger +- Daniel Hodan/czertbytes +- Daniel Latzer +- Daniel Riti +- Daniel Weisser +- Daniele Polencic +- Dave Dixon +- David Collie +- David Galeano +- David Newell +- David Rappo, Bountysource.com +- David Rasch +- David Stensland - terite +- Davit Samvelyan +- Dean Morin +- deffi420 +- defrex +- Deraen +- Dewdrops +- Dick Seabrook +- Dominik Ritter +- Don Browne +- Donald Walker +- Donna Martz +- dpc +- dperson +- dvidsilva +- Edan Maor +- Eddy Garcia +- Edward Ash/cazador481 +- Elias Tandel Barrionovo +- Elijah Mirecki +- Elliot Winkler (github: mcmire) +- Enric Lluelles +- Eric Fode +- Erik Goldman +- Erik Johnson Github: terminalmage Twitter: @terminalmage +- Erik Nordlund +- Ethan Erchinger/erchn +- Evan Tatarka +- Ewoud van Raamsdonk +- fd0 +- Federico Galassi +- Félix Archambault +- Ferdinand Salis-Samaden +- Florian Bartels +- Florian Sachs +- foca +- forbesmyester +- Frédéric de Villamil +- Fredrik Rambris +- Dapeng Li (luislee818) +- Janko Marohnić (janko-m) +- Jun Wu +- Maurice van der Pot (Griffon26) +- Ory Band (oryband) +- Garrett Dawson +- Gaveen Prabhasara +- George Nikolopoulos +- github username "alandyer" +- Giuseppe Rota +- gkalas +- Gökhan Kocak +- goodgravy +- Göran Gustafsson (GLEG) +- Graham Jans +- Greg Marcil +- Gregory Byrd/GByrd +- Gustavo Barron / Cicloid +- Gyuri Horák +- Harald Hvaal +- Harm Aarts +- Harry Glaser +- Håvard Grimelid +- hencjo +- Henning Hasemann +- Henry "Ingvij" Kupty +- henry4k +- Heryandi +- Hontvári József Levente +- IKEDA, Yoshifumi +- Ilia Choly +- iliis +- Ilya Katz +- Indrek Juhkam / indrekj +- irwand +- Islam Sharabash / ibash +- Ivar Vasara +- Jack Stouffer +- Jacqueline Leykam +- Jakob Landbo +- James Herdman +- James Magness +- James Murty / jmurty +- James Nguyen +- James Orr +- James Pickard +- James Seward +- Jamie Hillman +- Jan Larres +- Jan Weitz +- Janko Luin +- Jannik Nielsen / bitkid +- Jared Tyler Miller +- Jason Imison +- Jason Long / @jasonlong +- Jason Stillwell/dragonfax +- Jasu +- javaguirre +- Jedidiah Hurt +- Jeff Schornick +- Jen Patrick +- Jens Hausherr +- Jess Brown / Jess +- Jesse Cooke/@jc00ke +- Jessica Frazelle/ jfrazelle +- Jesus Alvarez +- Jez Allan +- Jimmie Elvenmark +- Jiří Koten +- JJ Murre +- joe di castro +- Joe Malin/633squadron +- Joel Meyer +- Joey Trapp +- Johan Klokkhammer Helsing +- John Cant +- John K. Paul +- John Krueger +- John Netherdrake +- John Schmidt / schmee +- John Whitley/@jwhitley +- Jon Anhold +- Jon Gosting +- Jonas Rollsby +- Jonathan Buschmann +- Jonathan Gibert +- Jonathan Jacobs +- Jonathan Kinred +- Jorge Gallegos (kad) +- Joris Morger +- Josemar Luedke +- Joshua Brookover +- Joshua Travis +- Jouko Karvonen +- jstemmer +- Juan Campa +- Juan Hernández Babón / jhbabon +- juanolon +- Justin Carter Moy +- Justin Force +- Kamil Slowikowski +- Karl Ove Hufthammer +- Kazuo Teramoto +- Kevin Goslar +- Kevin Hamer +- Kevin Watters +- Kevin Zimmerman / zim44 +- kryft +- Krzysztof Adamski +- Lachlan Brad Easton +- Lance Ulmer +- Larry Riedel (Larry@Riedel.org) +- Lasse Immonen (lasse.immonen@gmail.com) +- Léo Unbekandt / Soulou +- Leszek Swirski +- Levi Brown +- lhl +- linduxed +- Lluis Satorre Gonzalez +- lobachevsky +- Louis Pilfold +- Lucas Stephanou/lucasts +- Lucas Werkmeister +- Luke Sampson +- Luke van der Hoeven / @plukevdh +- Maciej Litwiniuk (@mlitwiniuk) +- Mads Navntoft Noe +- Maik Derstappen / MrTango +- Manuel Salvadores +- Marcus Huntemann/mapclyps +- Marcus Martin/nymaen +- Markus Dobler +- Mat Moore +- Mate Nagy +- Mathias Fußenegger +- Matt Moretti +- Matthew Machuga +- Matthew Sunderland +- Matthias Bilger +- Matthias Lehmann +- Maximilian Gerlach +- Meryn Stol +- Michael "manveru" Fellinger +- Michael "beefsack" Alexander +- Michael Iles +- Michael Irwin/mdi +- Michael Kebe +- Michael Lerch +- Michael R. Jones +- Michael Sanders/msanders +- Michael Schall / schallm +- Michail Denchev +- Michał Bartoszkiewicz +- Mickaël FORTUNATO +- Miguel Santesmases +- Mihir Pendse +- Mike Bissett/paran01d +- Mike Sergio +- Mike Wadsten +- mikedillion +- Mikkel Oscar Lyderik Larsen +- Miles Edland / edlandm +- Miles Frain +- Mirko Grönroos +- Moritz Lotze +- Morten Nygaard Åsnes +- MrException +- Julian Churchill (julianchurchill) +- Nakul Dhotre +- Corey Farwell (frewsxcv) +- Tarrant Rollins (tarrant) +- Naseer Ahmed +- Nate Jones +- Nate Soares (So8res) +- Nate Straz +- Neil Kirsopp +- Nelson Chen/nelsonjchen +- Nicholas Firth-McCoy (nfm) +- Nick Sloan +- Nickolas Means +- Nicolai Ruckel +- Niko Kivelä +- nop +- Nuno Frade +- Olaf Heinemann +- Ole Reifschneider +- Oliver Caldwell +- Olivier Lechevalier +- orangain +- orestis +- pablasso +- Pascal Hartig +- Patrick Berkeley +- Patrick Bihan-Faou, TeamBox SARL +- Patrick Stapfer +- Paul R Alexander +- Pavel Afanasyev +- Pawel Grzech +- Paweł Nowak +- Pedro Rodriguez T +- Per Modin +- Peter Edge +- Peter Fern +- Philipe Farias/philipefarias +- Philipp Millar +- Piotr Mitoraj +- Prithvi Prabhu (prithvi) +- Qingping Hou / houqp +- Quasar Jarosz +- queria +- Rachid Zarouali / Xinity +- Radek Szymczyszyn +- Randy Topliffe / Taar +- Ranko Radonić +- Raphael Henrique Ribas +- Ravi Joseph Pinto +- rekab +- Renato Zannon +- Richard "RichiH" Hartmann +- Richard Mihalovič +- Richard Sotarsh Clark +- Rio Kierkels +- rob allen +- Rob Bevan +- Rob Miller @robmil +- Rob O'Dwyer +- Rodolfo Borges (aka bart9h) +- Rodrigo Souto +- Roland Szabo +- Romans Malinovskis +- Roshan George +- Rostepher +- runar +- Russ Adams / rustushki +- Ryan Phillips +- Ryan Pierce/ fission1110 +- Ryan Schmitt +- Ryan Tarpine +- Sadik Gokhan Caglar +- Sam Stokes +- Sanpi +- Santiago Suarez Ordoñez +- saxman7000 +- Scott D'Aquila +- Scott Mathson +- Sean Copenhaver (@copenhas) +- Sean McCleary +- Sean M. Collins (sc68cal) +- Sean Tegtmeyer +- seanbell +- Sebastian Geiger +- Sergey Alexandrov +- Shane Delmore +- shawndumas +- shazow +- Silvan Jegen +- Simon Ratner (simonratner) +- Song Gao +- Stanimir Angelov Mladenov +- Stanislav B. - zbstof +- Stefan Gojan (hoschi) +- Stefan Hoffmann / stefan991 +- Stefan Wienert +- Steffen Rademacker +- Stephen Oney/soney +- Steve "ryz" Haßenpflug +- Steven Daniel Webb +- Steven Sloss +- Sven Opitz +- Sverre Rabbelier +- Szymon Ząbkiewicz +- Taichi Nakamura +- Takayuki Soga +- Teasp00n +- Terin Stock - @terinjokes +- Thai Pangsakulyanont (dtinth) +- Thameera Senanayaka +- Theo Belaire +- Thomas Ferris Nicolaisen +- Thomas Hirsch +- Thomas Maffia/Szerated +- Thomas Pani +- Thomas Thune Hansen +- Thorbjørn Lindeijer +- Thunder Hu +- Thys Meintjes +- Tim Anema +- Tim Matthews +- Timo Kröger +- Tolstyak +- Tom Panning +- Tom Wadley +- Tony Kemp +- tonyo112 +- Tori "TicViking" Hamblin +- treppo +- Truman Ellis +- Tuomas Vähänen +- Tyler Briles/MrBri +- Tyler Brock +- Tyler Mandry +- Ulf Fischer/ulf +- Vangelis Tsoumenis +- Vítězslav Homolka +- Vladimir Chernis +- Vojtech Jasny +- vvakame +- Vytis Valentinavičius +- Wade Berrier +- warrenv +- whateverhuis +- Will Binns-Smith +- Xavier Antoviaque (xavier@antoviaque.org) +- xsb +- Yann Villessuzanne +- yko +- Youta Harada(cohalz) +- Yrjö Peussa +- Yusuke Kanda(@uskanda) +- Yuval Langer +- zerowidth +- Ziling Zhao +- Zsolt Botykai + +ANONYMOUS SUPPORTERS + +There were also 307 other people who didn't claim any level of reward but +contributed to the fundraiser. Thank you all for the support! + +vim:tw=78:ts=8:et:ft=help:norl: -- cgit From ffb97af88785d8bf5b10ea82d1406f4d6aa6f799 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:27:40 +0100 Subject: vim-patch:48ddc6a6f86f runtime(git): Add small ftplugin https://github.com/vim/vim/commit/48ddc6a6f86f1f42bdb49d308d72c15b0e90ce5a Co-authored-by: Tim Pope --- runtime/ftplugin/git.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 runtime/ftplugin/git.vim (limited to 'runtime') diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim new file mode 100644 index 0000000000..7fcce53056 --- /dev/null +++ b/runtime/ftplugin/git.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin +" Language: generic git output +" Maintainer: Tim Pope +" Last Change: 2023 Mar 26 + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif + +let b:did_ftplugin = 1 + +setlocal nomodeline + +let b:undo_ftplugin = "setl modeline<" -- cgit From 1d71e1d987f330cae33f3d6026c26ffbb6c5b585 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:28:28 +0100 Subject: vim-patch:757714c0cba7 runtime(git): Make diffs foldable https://github.com/vim/vim/commit/757714c0cba7772b987b2513559bcb74ce53ce3f Co-authored-by: Tim Pope --- runtime/syntax/git.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/git.vim b/runtime/syntax/git.vim index bf013ce195..51eb8127dd 100644 --- a/runtime/syntax/git.vim +++ b/runtime/syntax/git.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: generic git output " Maintainer: Tim Pope -" Last Change: 2022 Jan 05 +" Last Change: 2023 Dec 28 if exists("b:current_syntax") finish @@ -38,7 +38,7 @@ syn match gitReflog /^\x\{40,\} \x\{40,\} .\{-\}\d\+\s-\d\{4\}\t.*/ skipwhite c syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff -syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff +syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff -- cgit From 419f0387276f6b1b72ad2cb56366f31d3ad6265e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:28:54 +0100 Subject: vim-patch:fda02d03c0cf runtime(gitcommit): Updates to ftplugin and syntax https://github.com/vim/vim/commit/fda02d03c0cfe017e465c58b3baf8b3106287578 Co-authored-by: Tim Pope --- runtime/ftplugin/gitcommit.vim | 15 +++++++++------ runtime/syntax/gitcommit.vim | 8 ++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index 9342799b56..3749328595 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope -" Last Change: 2022 Jan 05 +" Last Change: 2023 Dec 28 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -12,7 +12,7 @@ let b:did_ftplugin = 1 setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n -setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+ setlocal include=^+++ setlocal includeexpr=substitute(v:fname,'^[bi]/','','') @@ -42,6 +42,11 @@ function! s:diffcomplete(A, L, P) abort return args endfunction +function! s:setupdiff() abort + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git +endfunction + function! s:gitdiffcached(bang, ...) abort let name = tempname() if a:0 @@ -50,8 +55,6 @@ function! s:gitdiffcached(bang, ...) abort let extra = "-p --stat=".&columns endif call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name)) - exe "pedit " . fnameescape(name) - wincmd P - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git + exe 'pedit +call\ s:setupdiff()' fnameescape(name) + silent! wincmd P endfunction diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim index 42c8d4414f..bce6772762 100644 --- a/runtime/syntax/gitcommit.vim +++ b/runtime/syntax/gitcommit.vim @@ -2,7 +2,7 @@ " Language: git commit file " Maintainer: Tim Pope " Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2022 Jan 05 +" Last Change: 2023 Dec 28 if exists("b:current_syntax") finish @@ -21,7 +21,11 @@ endif syn include @gitcommitDiff syntax/diff.vim syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff -syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell +if get(g:, 'gitcommit_summary_length') < 0 + syn match gitcommitSummary "^.*$" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell +elseif get(g:, 'gitcommit_summary_length', 1) > 0 + exe 'syn match gitcommitSummary "^.*\%<' . (get(g:, 'gitcommit_summary_length', 50) + 1) . 'v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell' +endif syn match gitcommitOverflow ".*" contained contains=@Spell syn match gitcommitBlank "^.\+" contained contains=@Spell syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl -- cgit From 7709597a1d79e053587cb01f2a7d7c0f3e72d9ab Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:29:16 +0100 Subject: vim-patch:a907c9199216 runtime(sass): Provide sass_recommended_style option https://github.com/vim/vim/commit/a907c91992167e41da41008d4370e434e324cbf2 Co-authored-by: Tim Pope --- runtime/ftplugin/sass.vim | 7 ++++++- runtime/indent/sass.vim | 6 ++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim index 9ce446137a..e650be9312 100644 --- a/runtime/ftplugin/sass.vim +++ b/runtime/ftplugin/sass.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Sass " Maintainer: Tim Pope -" Last Change: 2019 Dec 05 +" Last Change: 2023 Dec 28 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -23,6 +23,11 @@ if &filetype =~# '\' let b:undo_ftplugin .= ' isk<' endif +if get(g:, 'sass_recommended_style', 1) + setlocal shiftwidth=2 softtabstop=2 expandtab + let b:undo_ftplugin .= ' sw< sts< et<' +endif + let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@=' let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\=' diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim index 8c0ecd0746..45dc869a55 100644 --- a/runtime/indent/sass.vim +++ b/runtime/indent/sass.vim @@ -1,14 +1,14 @@ " Vim indent file " Language: Sass " Maintainer: Tim Pope -" Last Change: 2022 Mar 15 +" Last Change: 2023 Dec 28 if exists("b:did_indent") finish endif let b:did_indent = 1 -setlocal autoindent sw=2 et +setlocal autoindent setlocal indentexpr=GetSassIndent() setlocal indentkeys=o,O,*,<:>,!^F @@ -26,10 +26,8 @@ function! GetSassIndent() let lnum = prevnonblank(v:lnum-1) let line = substitute(getline(lnum),'\s\+$','','') let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') - let lastcol = strlen(line) let line = substitute(line,'^\s\+','','') let indent = indent(lnum) - let cindent = indent(v:lnum) if line !~ s:property && line !~ s:extend && cline =~ s:property return indent + shiftwidth() else -- cgit From 51c22b9321ac22293e6bec898fe9027e8100703e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:29:38 +0100 Subject: vim-patch:244f01658f9c runtime(markdown): Fix folding of code blocks https://github.com/vim/vim/commit/244f01658f9c60c71a776a2162c28ea93e102f12 Co-authored-by: Tim Pope --- runtime/ftplugin/markdown.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim index 2b963f139d..022dd0d601 100644 --- a/runtime/ftplugin/markdown.vim +++ b/runtime/ftplugin/markdown.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Markdown " Maintainer: Tim Pope -" Last Change: 2022 Oct 13 +" Last Change: 2023 Dec 28 if exists("b:did_ftplugin") finish @@ -35,7 +35,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps") endif function! s:NotCodeBlock(lnum) abort - return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCode' + return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCodeBlock' endfunction function! MarkdownFold() abort -- cgit From 1ef60ea6513be72a03958ed6239bfe474c85a7a3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 00:30:07 +0100 Subject: vim-patch:715a8058895f runtime(cucumber): Updates to indent and syntax https://github.com/vim/vim/commit/715a8058895f5908f44ee243fdafa431b6483e47 Co-authored-by: Tim Pope --- runtime/indent/cucumber.vim | 77 +++++++++++++++-------- runtime/syntax/cucumber.vim | 146 ++++++++++++++++++++++++++------------------ 2 files changed, 137 insertions(+), 86 deletions(-) (limited to 'runtime') diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index ad28a67a0d..5d144e426b 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope -" Last Change: 2017 Jun 13 +" Last Change: 2023 Dec 28 if exists("b:did_indent") finish @@ -19,57 +19,80 @@ if exists("*GetCucumberIndent") finish endif -function! s:syn(lnum) - return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name') +let s:headings = { + \ 'Feature': 'feature', + \ 'Rule': 'rule', + \ 'Background': 'bg_or_scenario', + \ 'Scenario': 'bg_or_scenario', + \ 'ScenarioOutline': 'bg_or_scenario', + \ 'Examples': 'examples', + \ 'Scenarios': 'examples'} + +function! s:Line(lnum) abort + if getline(a:lnum) =~# ':' + let group = matchstr(synIDattr(synID(a:lnum,1+indent(a:lnum), 1), 'name'), '^cucumber\zs.*') + if !has_key(s:headings, group) + let group = substitute(matchstr(getline(a:lnum), '^\s*\zs\%([^:]\+\)\ze:\S\@!'), '\s\+', '', 'g') + endif + else + let group = '' + endif + let char = matchstr(getline(a:lnum), '^\s*\zs[[:punct:]]') + return { + \ 'lnum': a:lnum, + \ 'indent': indent(a:lnum), + \ 'heading': get(s:headings, group, ''), + \ 'tag': char ==# '@', + \ 'table': char ==# '|', + \ 'comment': char ==# '#', + \ } endfunction -function! GetCucumberIndent() - let line = getline(prevnonblank(v:lnum-1)) - let cline = getline(v:lnum) - let nline = getline(nextnonblank(v:lnum+1)) - let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() - let syn = s:syn(prevnonblank(v:lnum-1)) - let csyn = s:syn(v:lnum) - let nsyn = s:syn(nextnonblank(v:lnum+1)) - if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:' +function! GetCucumberIndent(...) abort + let lnum = a:0 ? a:1 : v:lnum + let sw = shiftwidth() + let prev = s:Line(prevnonblank(lnum-1)) + let curr = s:Line(lnum) + let next = s:Line(nextnonblank(lnum+1)) + if curr.heading ==# 'feature' " feature heading return 0 - elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):' + elseif curr.heading ==# 'examples' " examples heading return 2 * sw - elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' + elseif curr.heading ==# 'bg_or_scenario' " background, scenario or outline heading return sw - elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:' + elseif prev.heading ==# 'feature' " line after feature heading return sw - elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):' + elseif prev.heading ==# 'examples' " line after examples heading return 3 * sw - elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' + elseif prev.heading ==# 'bg_or_scenario' " line after background, scenario or outline heading return 2 * sw - elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) + elseif (curr.tag || curr.comment) && (next.heading ==# 'feature' || prev.indent <= 0) " tag or comment before a feature heading return 0 - elseif cline =~# '^\s*@' + elseif curr.tag " other tags return sw - elseif cline =~# '^\s*[#|]' && line =~# '^\s*|' + elseif (curr.table || curr.comment) && prev.table " mid-table " preserve indent - return indent(prevnonblank(v:lnum-1)) - elseif cline =~# '^\s*|' && line =~# '^\s*[^|]' + return prev.indent + elseif curr.table && !prev.table " first line of a table, relative indent - return indent(prevnonblank(v:lnum-1)) + sw - elseif cline =~# '^\s*[^|]' && line =~# '^\s*|' + return prev.indent + sw + elseif !curr.table && prev.table " line after a table, relative unindent - return indent(prevnonblank(v:lnum-1)) - sw - elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):') + return prev.indent - sw + elseif curr.comment && getline(v:lnum-1) =~# '^\s*$' && next.heading ==# 'bg_or_scenario' " comments on scenarios return sw endif - return indent(prevnonblank(v:lnum-1)) + return prev.indent < 0 ? 0 : prev.indent endfunction " vim:set sts=2 sw=2: diff --git a/runtime/syntax/cucumber.vim b/runtime/syntax/cucumber.vim index f1ef2992ec..90fdbfaf4f 100644 --- a/runtime/syntax/cucumber.vim +++ b/runtime/syntax/cucumber.vim @@ -2,7 +2,7 @@ " Language: Cucumber " Maintainer: Tim Pope " Filenames: *.feature -" Last Change: 2013 May 30 +" Last Change: 2023 Dec 28 if exists("b:current_syntax") finish @@ -14,60 +14,84 @@ syn case match syn sync minlines=20 let g:cucumber_languages = { - \"en": {"and": "And\\>", "background": "Background\\>", "but": "But\\>", "examples": "Scenarios\\>\\|Examples\\>", "feature": "Business Need\\>\\|Feature\\>\\|Ability\\>", "given": "Given\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Template\\>\\|Scenario Outline\\>", "then": "Then\\>", "when": "When\\>"}, - \"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629\\>", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629\\>", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629\\>", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\>", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637\\>", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"}, - \"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"}, - \"bm": {"and": "Dan\\>", "background": "Latar Belakang\\>", "but": "Tetapi\\>", "examples": "Contoh \\>", "feature": "Fungsi\\>", "given": "Bagi\\>", "scenario": "Senario\\>", "scenario_outline": "Menggariskan Senario \\>", "then": "Kemudian\\>", "when": "Apabila\\>"}, - \"ca": {"and": "I\\>", "background": "Antecedents\\>\\|Rerefons\\>", "but": "Per\\%u00f2\\>", "examples": "Exemples\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalitat\\>", "given": "At\\%u00e8s\\>\\|Donada\\>\\|Donat\\>\\|Atesa\\>", "scenario": "Escenari\\>", "scenario_outline": "Esquema de l'escenari\\>", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"}, - \"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Pozad\\%u00ed\\>\\|Kontext\\>", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady\\>", "feature": "Po\\%u017eadavek\\>", "given": "Za p\\%u0159edpokladu\\>\\|Pokud\\>", "scenario": "Sc\\%u00e9n\\%u00e1\\%u0159\\>", "scenario_outline": "N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e\\>\\|Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\>", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"}, - \"cy-GB": {"and": "A\\>", "background": "Cefndir\\>", "but": "Ond\\>", "examples": "Enghreifftiau\\>", "feature": "Arwedd\\>", "given": "Anrhegedig a\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Amlinellol\\>", "then": "Yna\\>", "when": "Pryd\\>"}, - \"da": {"and": "Og\\>", "background": "Baggrund\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskab\\>", "given": "Givet\\>", "scenario": "Scenarie\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, - \"de": {"and": "Und\\>", "background": "Grundlage\\>", "but": "Aber\\>", "examples": "Beispiele\\>", "feature": "Funktionalit\\%u00e4t\\>", "given": "Gegeben sei\\>\\|Angenommen\\>", "scenario": "Szenario\\>", "scenario_outline": "Szenariogrundriss\\>", "then": "Dann\\>", "when": "Wenn\\>"}, - \"el": {"and": "\\%u039a\\%u03b1\\%u03b9\\>", "background": "\\%u03a5\\%u03c0\\%u03cc\\%u03b2\\%u03b1\\%u03b8\\%u03c1\\%u03bf\\>", "but": "\\%u0391\\%u03bb\\%u03bb\\%u03ac\\>", "examples": "\\%u03a0\\%u03b1\\%u03c1\\%u03b1\\%u03b4\\%u03b5\\%u03af\\%u03b3\\%u03bc\\%u03b1\\%u03c4\\%u03b1\\>\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03b1\\>", "feature": "\\%u0394\\%u03c5\\%u03bd\\%u03b1\\%u03c4\\%u03cc\\%u03c4\\%u03b7\\%u03c4\\%u03b1\\>\\|\\%u039b\\%u03b5\\%u03b9\\%u03c4\\%u03bf\\%u03c5\\%u03c1\\%u03b3\\%u03af\\%u03b1\\>", "given": "\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5 \\%u03cc\\%u03c4\\%u03b9\\>\\|\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5\\>", "scenario": "\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03bf\\>", "scenario_outline": "\\%u03a0\\%u03b5\\%u03c1\\%u03b9\\%u03b3\\%u03c1\\%u03b1\\%u03c6\\%u03ae \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5\\>", "then": "\\%u03a4\\%u03cc\\%u03c4\\%u03b5\\>", "when": "\\%u038c\\%u03c4\\%u03b1\\%u03bd\\>"}, - \"en-Scouse": {"and": "An\\>", "background": "Dis is what went down\\>", "but": "Buh\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Youse know when youse got\\>\\|Givun\\>", "scenario": "The thing of it is\\>", "scenario_outline": "Wharrimean is\\>", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"}, - \"en-au": {"and": "Too right\\>", "background": "First off\\>", "but": "Yeah nah\\>", "examples": "You'll wanna\\>", "feature": "Pretty much\\>", "given": "Y'know\\>", "scenario": "Awww, look mate\\>", "scenario_outline": "Reckon it's like\\>", "then": "But at the end of the day I reckon\\>", "when": "It's just unbelievable\\>"}, - \"en-lol": {"and": "AN\\>", "background": "B4\\>", "but": "BUT\\>", "examples": "EXAMPLZ\\>", "feature": "OH HAI\\>", "given": "I CAN HAZ\\>", "scenario": "MISHUN\\>", "scenario_outline": "MISHUN SRSLY\\>", "then": "DEN\\>", "when": "WEN\\>"}, - \"en-old": {"and": "Ond\\>\\|7\\>", "background": "\\%u00c6r\\>\\|Aer\\>", "but": "Ac\\>", "examples": "Se \\%u00f0e\\>\\|Se \\%u00fee\\>\\|Se the\\>", "feature": "Hw\\%u00e6t\\>\\|Hwaet\\>", "given": "\\%u00d0urh\\>\\|\\%u00deurh\\>\\|Thurh\\>", "scenario": "Swa\\>", "scenario_outline": "Swa hw\\%u00e6r swa\\>\\|Swa hwaer swa\\>", "then": "\\%u00d0a \\%u00f0e\\>\\|\\%u00dea \\%u00fee\\>\\|\\%u00dea\\>\\|\\%u00d0a\\>\\|Tha the\\>\\|Tha\\>", "when": "\\%u00d0a\\>\\|\\%u00dea\\>\\|Tha\\>"}, - \"en-pirate": {"and": "Aye\\>", "background": "Yo-ho-ho\\>", "but": "Avast!\\>", "examples": "Dead men tell no tales\\>", "feature": "Ahoy matey!\\>", "given": "Gangway!\\>", "scenario": "Heave to\\>", "scenario_outline": "Shiver me timbers\\>", "then": "Let go and haul\\>", "when": "Blimey!\\>"}, - \"en-tx": {"and": "And y'all\\>", "background": "Background\\>", "but": "But y'all\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Given y'all\\>", "scenario": "Scenario\\>", "scenario_outline": "All y'all\\>", "then": "Then y'all\\>", "when": "When y'all\\>"}, - \"eo": {"and": "Kaj\\>", "background": "Fono\\>", "but": "Sed\\>", "examples": "Ekzemploj\\>", "feature": "Trajto\\>", "given": "Donita\\%u0135o\\>", "scenario": "Scenaro\\>", "scenario_outline": "Konturo de la scenaro\\>", "then": "Do\\>", "when": "Se\\>"}, - \"es": {"and": "Y\\>", "background": "Antecedentes\\>", "but": "Pero\\>", "examples": "Ejemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esquema del escenario\\>", "then": "Entonces\\>", "when": "Cuando\\>"}, - \"et": {"and": "Ja\\>", "background": "Taust\\>", "but": "Kuid\\>", "examples": "Juhtumid\\>", "feature": "Omadus\\>", "given": "Eeldades\\>", "scenario": "Stsenaarium\\>", "scenario_outline": "Raamstsenaarium\\>", "then": "Siis\\>", "when": "Kui\\>"}, - \"fa": {"and": "\\%u0648\\>", "background": "\\%u0632\\%u0645\\%u06cc\\%u0646\\%u0647\\>", "but": "\\%u0627\\%u0645\\%u0627\\>", "examples": "\\%u0646\\%u0645\\%u0648\\%u0646\\%u0647 \\%u0647\\%u0627\\>", "feature": "\\%u0648\\%u0650\\%u06cc\\%u0698\\%u06af\\%u06cc\\>", "given": "\\%u0628\\%u0627 \\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\>", "scenario_outline": "\\%u0627\\%u0644\\%u06af\\%u0648\\%u06cc \\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\>", "then": "\\%u0622\\%u0646\\%u06af\\%u0627\\%u0647\\>", "when": "\\%u0647\\%u0646\\%u06af\\%u0627\\%u0645\\%u06cc\\>"}, - \"fi": {"and": "Ja\\>", "background": "Tausta\\>", "but": "Mutta\\>", "examples": "Tapaukset\\>", "feature": "Ominaisuus\\>", "given": "Oletetaan\\>", "scenario": "Tapaus\\>", "scenario_outline": "Tapausaihio\\>", "then": "Niin\\>", "when": "Kun\\>"}, - \"fr": {"and": "Et\\>", "background": "Contexte\\>", "but": "Mais\\>", "examples": "Exemples\\>", "feature": "Fonctionnalit\\%u00e9\\>", "given": "\\%u00c9tant donn\\%u00e9es\\>\\|\\%u00c9tant donn\\%u00e9s\\>\\|\\%u00c9tant donn\\%u00e9e\\>\\|\\%u00c9tant donn\\%u00e9\\>\\|Etant donn\\%u00e9es\\>\\|Etant donn\\%u00e9s\\>\\|Etant donn\\%u00e9e\\>\\|Etant donn\\%u00e9\\>\\|Soit\\>", "scenario": "Sc\\%u00e9nario\\>", "scenario_outline": "Plan du sc\\%u00e9nario\\>\\|Plan du Sc\\%u00e9nario\\>", "then": "Alors\\>", "when": "Lorsqu'\\|Lorsque\\>\\|Quand\\>"}, - \"gl": {"and": "E\\>", "background": "Contexto\\>", "but": "Mais\\>\\|Pero\\>", "examples": "Exemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esbozo do escenario\\>", "then": "Ent\\%u00f3n\\>\\|Logo\\>", "when": "Cando\\>"}, - \"he": {"and": "\\%u05d5\\%u05d2\\%u05dd\\>", "background": "\\%u05e8\\%u05e7\\%u05e2\\>", "but": "\\%u05d0\\%u05d1\\%u05dc\\>", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea\\>", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4\\>", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df\\>", "scenario": "\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "then": "\\%u05d0\\%u05d6\\%u05d9\\>\\|\\%u05d0\\%u05d6\\>", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8\\>"}, - \"hi": {"and": "\\%u0924\\%u0925\\%u093e\\>\\|\\%u0914\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u093f\\>", "but": "\\%u092a\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923\\>", "feature": "\\%u0930\\%u0942\\%u092a \\%u0932\\%u0947\\%u0916\\>", "given": "\\%u091a\\%u0942\\%u0902\\%u0915\\%u093f\\>\\|\\%u092f\\%u0926\\%u093f\\>\\|\\%u0905\\%u0917\\%u0930\\>", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f\\>", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e\\>", "then": "\\%u0924\\%u092c\\>", "when": "\\%u091c\\%u092c\\>"}, - \"hr": {"and": "I\\>", "background": "Pozadina\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primjeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadano\\>\\|Zadani\\>\\|Zadan\\>", "scenario": "Scenarij\\>", "scenario_outline": "Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"}, - \"hu": {"and": "\\%u00c9s\\>", "background": "H\\%u00e1tt\\%u00e9r\\>", "but": "De\\>", "examples": "P\\%u00e9ld\\%u00e1k\\>", "feature": "Jellemz\\%u0151\\>", "given": "Amennyiben\\>\\|Adott\\>", "scenario": "Forgat\\%u00f3k\\%u00f6nyv\\>", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat\\>", "then": "Akkor\\>", "when": "Amikor\\>\\|Majd\\>\\|Ha\\>"}, - \"id": {"and": "Dan\\>", "background": "Dasar\\>", "but": "Tapi\\>", "examples": "Contoh\\>", "feature": "Fitur\\>", "given": "Dengan\\>", "scenario": "Skenario\\>", "scenario_outline": "Skenario konsep\\>", "then": "Maka\\>", "when": "Ketika\\>"}, - \"is": {"and": "Og\\>", "background": "Bakgrunnur\\>", "but": "En\\>", "examples": "Atbur\\%u00f0ar\\%u00e1sir\\>\\|D\\%u00e6mi\\>", "feature": "Eiginleiki\\>", "given": "Ef\\>", "scenario": "Atbur\\%u00f0ar\\%u00e1s\\>", "scenario_outline": "L\\%u00fdsing Atbur\\%u00f0ar\\%u00e1sar\\>\\|L\\%u00fdsing D\\%u00e6ma\\>", "then": "\\%u00de\\%u00e1\\>", "when": "\\%u00deegar\\>"}, - \"it": {"and": "E\\>", "background": "Contesto\\>", "but": "Ma\\>", "examples": "Esempi\\>", "feature": "Funzionalit\\%u00e0\\>", "given": "Dato\\>\\|Data\\>\\|Dati\\>\\|Date\\>", "scenario": "Scenario\\>", "scenario_outline": "Schema dello scenario\\>", "then": "Allora\\>", "when": "Quando\\>"}, - \"ja": {"and": "\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\>\\|\\%u4f8b\\>", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\>\\|\\%u6a5f\\%u80fd\\>", "given": "\\%u524d\\%u63d0", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\>", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"}, - \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd\\>", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608\\>", "feature": "\\%uae30\\%ub2a5\\>", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624\\>", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694\\>", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"}, - \"lt": {"and": "Ir\\>", "background": "Kontekstas\\>", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\>\\|Scenarijai\\>\\|Variantai\\>", "feature": "Savyb\\%u0117\\>", "given": "Duota\\>", "scenario": "Scenarijus\\>", "scenario_outline": "Scenarijaus \\%u0161ablonas\\>", "then": "Tada\\>", "when": "Kai\\>"}, - \"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond\\>", "but": "m\\%u00e4\\>\\|awer\\>", "examples": "Beispiller\\>", "feature": "Funktionalit\\%u00e9it\\>", "given": "ugeholl\\>", "scenario": "Szenario\\>", "scenario_outline": "Plang vum Szenario\\>", "then": "dann\\>", "when": "wann\\>"}, - \"lv": {"and": "Un\\>", "background": "Situ\\%u0101cija\\>\\|Konteksts\\>", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\>\\|Paraugs\\>", "feature": "Funkcionalit\\%u0101te\\>\\|F\\%u012b\\%u010da\\>", "given": "Kad\\>", "scenario": "Scen\\%u0101rijs\\>", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga\\>", "then": "Tad\\>", "when": "Ja\\>"}, - \"nl": {"and": "En\\>", "background": "Achtergrond\\>", "but": "Maar\\>", "examples": "Voorbeelden\\>", "feature": "Functionaliteit\\>", "given": "Gegeven\\>\\|Stel\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstract Scenario\\>", "then": "Dan\\>", "when": "Als\\>"}, - \"no": {"and": "Og\\>", "background": "Bakgrunn\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskap\\>", "given": "Gitt\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>\\|Scenariomal\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, - \"pl": {"and": "Oraz\\>\\|I\\>", "background": "Za\\%u0142o\\%u017cenia\\>", "but": "Ale\\>", "examples": "Przyk\\%u0142ady\\>", "feature": "W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\>\\|Potrzeba biznesowa\\>\\|Funkcja\\>\\|Aspekt\\>", "given": "Zak\\%u0142adaj\\%u0105c\\>\\|Maj\\%u0105c\\>", "scenario": "Scenariusz\\>", "scenario_outline": "Szablon scenariusza\\>", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>\\|Je\\%u015bli\\>\\|Kiedy\\>\\|Gdy\\>"}, - \"pt": {"and": "E\\>", "background": "Cen\\%u00e1rio de Fundo\\>\\|Cenario de Fundo\\>\\|Contexto\\>\\|Fundo\\>", "but": "Mas\\>", "examples": "Cen\\%u00e1rios\\>\\|Exemplos\\>\\|Cenarios\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalidade\\>\\|Caracteristica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Cen\\%u00e1rio\\>\\|Cenario\\>", "scenario_outline": "Delinea\\%u00e7\\%u00e3o do Cen\\%u00e1rio\\>\\|Esquema do Cen\\%u00e1rio\\>\\|Delineacao do Cenario\\>\\|Esquema do Cenario\\>", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"}, - \"ro": {"and": "\\%u015ei\\>\\|\\%u0218i\\>\\|Si\\>", "background": "Context\\>", "but": "Dar\\>", "examples": "Exemple\\>", "feature": "Func\\%u0163ionalitate\\>\\|Func\\%u021bionalitate\\>\\|Functionalitate\\>", "given": "Da\\%u0163i fiind\\>\\|Da\\%u021bi fiind\\>\\|Dati fiind\\>\\|Date fiind\\>\\|Dat fiind\\>", "scenario": "Scenariu\\>", "scenario_outline": "Structur\\%u0103 scenariu\\>\\|Structura scenariu\\>", "then": "Atunci\\>", "when": "C\\%u00e2nd\\>\\|Cand\\>"}, - \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0422\\%u0430\\%u043a\\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>\\|\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>", "but": "\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u044b\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>\\|\\%u0421\\%u0432\\%u043e\\%u0439\\%u0441\\%u0442\\%u0432\\%u043e\\>\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u044f\\>", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>\\|\\%u041f\\%u0443\\%u0441\\%u0442\\%u044c\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\>", "then": "\\%u0422\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0415\\%u0441\\%u043b\\%u0438\\>"}, - \"sk": {"and": "A z\\%u00e1rove\\%u0148\\>\\|A taktie\\%u017e\\>\\|A tie\\%u017e\\>\\|A\\>", "background": "Pozadie\\>", "but": "Ale\\>", "examples": "Pr\\%u00edklady\\>", "feature": "Po\\%u017eiadavka\\>\\|Vlastnos\\%u0165\\>\\|Funkcia\\>", "given": "Za predpokladu\\>\\|Pokia\\%u013e\\>", "scenario": "Scen\\%u00e1r\\>", "scenario_outline": "N\\%u00e1\\%u010drt Scen\\%u00e1ru\\>\\|N\\%u00e1\\%u010drt Scen\\%u00e1ra\\>\\|Osnova Scen\\%u00e1ra\\>", "then": "Potom\\>\\|Tak\\>", "when": "Ke\\%u010f\\>\\|Ak\\>"}, - \"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\>\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430\\>", "given": "\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0438\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\>\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\>\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430\\>", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"}, - \"sr-Latn": {"and": "I\\>", "background": "Kontekst\\>\\|Pozadina\\>\\|Osnova\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Funkcionalnost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadato\\>\\|Zadate\\>\\|Zatati\\>", "scenario": "Scenario\\>\\|Primer\\>", "scenario_outline": "Struktura scenarija\\>\\|Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"}, - \"sv": {"and": "Och\\>", "background": "Bakgrund\\>", "but": "Men\\>", "examples": "Exempel\\>", "feature": "Egenskap\\>", "given": "Givet\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>\\|Scenariomall\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"}, - \"th": {"and": "\\%u0e41\\%u0e25\\%u0e30\\>", "background": "\\%u0e41\\%u0e19\\%u0e27\\%u0e04\\%u0e34\\%u0e14\\>", "but": "\\%u0e41\\%u0e15\\%u0e48\\>", "examples": "\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>\\|\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e15\\%u0e31\\%u0e27\\%u0e2d\\%u0e22\\%u0e48\\%u0e32\\%u0e07\\>", "feature": "\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e15\\%u0e49\\%u0e2d\\%u0e07\\%u0e01\\%u0e32\\%u0e23\\%u0e17\\%u0e32\\%u0e07\\%u0e18\\%u0e38\\%u0e23\\%u0e01\\%u0e34\\%u0e08\\>\\|\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e2a\\%u0e32\\%u0e21\\%u0e32\\%u0e23\\%u0e16\\>\\|\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2b\\%u0e25\\%u0e31\\%u0e01\\>", "given": "\\%u0e01\\%u0e33\\%u0e2b\\%u0e19\\%u0e14\\%u0e43\\%u0e2b\\%u0e49\\>", "scenario": "\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>", "scenario_outline": "\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2a\\%u0e23\\%u0e49\\%u0e32\\%u0e07\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>\\|\\%u0e2a\\%u0e23\\%u0e38\\%u0e1b\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>", "then": "\\%u0e14\\%u0e31\\%u0e07\\%u0e19\\%u0e31\\%u0e49\\%u0e19\\>", "when": "\\%u0e40\\%u0e21\\%u0e37\\%u0e48\\%u0e2d\\>"}, - \"tl": {"and": "\\%u0c2e\\%u0c30\\%u0c3f\\%u0c2f\\%u0c41\\>", "background": "\\%u0c28\\%u0c47\\%u0c2a\\%u0c25\\%u0c4d\\%u0c2f\\%u0c02\\>", "but": "\\%u0c15\\%u0c3e\\%u0c28\\%u0c3f\\>", "examples": "\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23\\%u0c32\\%u0c41\\>", "feature": "\\%u0c17\\%u0c41\\%u0c23\\%u0c2e\\%u0c41\\>", "given": "\\%u0c1a\\%u0c46\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c2c\\%u0c21\\%u0c3f\\%u0c28\\%u0c26\\%u0c3f\\>", "scenario": "\\%u0c38\\%u0c28\\%u0c4d\\%u0c28\\%u0c3f\\%u0c35\\%u0c47\\%u0c36\\%u0c02\\>", "scenario_outline": "\\%u0c15\\%u0c25\\%u0c28\\%u0c02\\>", "then": "\\%u0c05\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c41\\%u0c21\\%u0c41\\>", "when": "\\%u0c08 \\%u0c2a\\%u0c30\\%u0c3f\\%u0c38\\%u0c4d\\%u0c25\\%u0c3f\\%u0c24\\%u0c3f\\%u0c32\\%u0c4b\\>"}, - \"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f\\>", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler\\>", "feature": "\\%u00d6zellik\\>", "given": "Diyelim ki\\>", "scenario": "Senaryo\\>", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131\\>", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"}, - \"tt": {"and": "\\%u04ba\\%u04d9\\%u043c\\>\\|\\%u0412\\%u04d9\\>", "background": "\\%u041a\\%u0435\\%u0440\\%u0435\\%u0448\\>", "but": "\\%u041b\\%u04d9\\%u043a\\%u0438\\%u043d\\>\\|\\%u04d8\\%u043c\\%u043c\\%u0430\\>", "examples": "\\%u04ae\\%u0440\\%u043d\\%u04d9\\%u043a\\%u043b\\%u04d9\\%u0440\\>\\|\\%u041c\\%u0438\\%u0441\\%u0430\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u04ae\\%u0437\\%u0435\\%u043d\\%u0447\\%u04d9\\%u043b\\%u0435\\%u043a\\%u043b\\%u0435\\%u043b\\%u0435\\%u043a\\>\\|\\%u041c\\%u04e9\\%u043c\\%u043a\\%u0438\\%u043d\\%u043b\\%u0435\\%u043a\\>", "given": "\\%u04d8\\%u0439\\%u0442\\%u0438\\%u043a\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\%u043d\\%u044b\\%u04a3 \\%u0442\\%u04e9\\%u0437\\%u0435\\%u043b\\%u0435\\%u0448\\%u0435\\>", "then": "\\%u041d\\%u04d9\\%u0442\\%u0438\\%u0497\\%u04d9\\%u0434\\%u04d9\\>", "when": "\\%u04d8\\%u0433\\%u04d9\\%u0440\\>"}, - \"uk": {"and": "\\%u0410 \\%u0442\\%u0430\\%u043a\\%u043e\\%u0436\\>\\|\\%u0422\\%u0430\\>\\|\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e\\>", "then": "\\%u0422\\%u043e\\%u0434\\%u0456\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>\\|\\%u041a\\%u043e\\%u043b\\%u0438\\>"}, - \"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445\\>", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u0410\\%u0433\\%u0430\\%u0440\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438\\>", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"}, - \"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh\\>", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u\\>", "feature": "T\\%u00ednh n\\%u0103ng\\>", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\>\\|K\\%u1ecbch b\\%u1ea3n\\>", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\>\\|Khung k\\%u1ecbch b\\%u1ea3n\\>", "then": "Th\\%u00ec\\>", "when": "Khi\\>"}, - \"zh-CN": {"and": "\\%u800c\\%u4e14\\|\\%u5e76\\%u4e14\\|\\%u540c\\%u65f6", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8bbe\\|\\%u5047\\%u5b9a", "scenario": "\\%u573a\\%u666f\\>\\|\\%u5267\\%u672c\\>", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\>\\|\\%u5267\\%u672c\\%u5927\\%u7eb2\\>", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"}, - \"zh-TW": {"and": "\\%u800c\\%u4e14\\|\\%u4e26\\%u4e14\\|\\%u540c\\%u6642", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8a2d\\|\\%u5047\\%u5b9a", "scenario": "\\%u5834\\%u666f\\>\\|\\%u5287\\%u672c\\>", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1\\>\\|\\%u5287\\%u672c\\%u5927\\%u7db1\\>", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}} + \"en": {"and": "And\\>", "background": "Background", "but": "But\\>", "examples": "Scenarios\\|Examples", "feature": "Business Need\\|Feature\\|Ability", "given": "Given\\>", "rule": "Rule", "scenario": "Scenario\\|Example", "scenario_outline": "Scenario Template\\|Scenario Outline", "then": "Then\\>", "when": "When\\>"}, + \"af": {"and": "En\\>", "background": "Agtergrond", "but": "Maar\\>", "examples": "Voorbeelde", "feature": "Besigheid Behoefte\\|Funksie\\|Vermo\\%u00eb", "given": "Gegewe\\>", "rule": "Regel", "scenario": "Voorbeeld\\|Situasie", "scenario_outline": "Situasie Uiteensetting", "then": "Dan\\>", "when": "Wanneer\\>"}, + \"am": {"and": "\\%u0535\\%u057e\\>", "background": "\\%u053f\\%u0578\\%u0576\\%u057f\\%u0565\\%u0584\\%u057d\\%u057f", "but": "\\%u0532\\%u0561\\%u0575\\%u0581\\>", "examples": "\\%u0555\\%u0580\\%u056b\\%u0576\\%u0561\\%u056f\\%u0576\\%u0565\\%u0580", "feature": "\\%u0556\\%u0578\\%u0582\\%u0576\\%u056f\\%u0581\\%u056b\\%u0578\\%u0576\\%u0561\\%u056c\\%u0578\\%u0582\\%u0569\\%u0575\\%u0578\\%u0582\\%u0576\\|\\%u0540\\%u0561\\%u057f\\%u056f\\%u0578\\%u0582\\%u0569\\%u0575\\%u0578\\%u0582\\%u0576", "given": "\\%u0534\\%u056b\\%u0581\\%u0578\\%u0582\\%u0584\\>", "rule": "Rule", "scenario": "\\%u0555\\%u0580\\%u056b\\%u0576\\%u0561\\%u056f\\|\\%u054d\\%u0581\\%u0565\\%u0576\\%u0561\\%u0580", "scenario_outline": "\\%u054d\\%u0581\\%u0565\\%u0576\\%u0561\\%u0580\\%u056b \\%u056f\\%u0561\\%u057c\\%u0578\\%u0582\\%u0581\\%u057e\\%u0561\\%u0581\\%u0584\\%u0568", "then": "\\%u0531\\%u057a\\%u0561\\>", "when": "\\%u0535\\%u0569\\%u0565\\>\\|\\%u0535\\%u0580\\%u0562\\>"}, + \"amh": {"and": "\\%u12a5\\%u1293\\>", "background": "\\%u1245\\%u12f5\\%u1218 \\%u1201\\%u1294\\%u1273\\|\\%u1218\\%u1290\\%u123b \\%u1200\\%u1233\\%u1265\\|\\%u1218\\%u1290\\%u123b", "but": "\\%u130d\\%u1295\\>", "examples": "\\%u121d\\%u1233\\%u120c\\%u12ce\\%u127d\\|\\%u1201\\%u1293\\%u1274\\%u12ce\\%u127d", "feature": "\\%u12e8\\%u121a\\%u1348\\%u1208\\%u1308\\%u12cd \\%u12f5\\%u122d\\%u130a\\%u1275\\|\\%u12e8\\%u1270\\%u1348\\%u1208\\%u1308\\%u12cd \\%u1235\\%u122b\\|\\%u1235\\%u122b", "given": "\\%u12e8\\%u1270\\%u1230\\%u1320\\>", "rule": "\\%u1205\\%u130d", "scenario": "\\%u121d\\%u1233\\%u120c\\|\\%u1201\\%u1293\\%u1274", "scenario_outline": "\\%u1201\\%u1293\\%u1274 \\%u12dd\\%u122d\\%u12dd\\%u122d\\|\\%u1201\\%u1293\\%u1274 \\%u12a0\\%u1265\\%u1290\\%u1275", "then": "\\%u12a8\\%u12da\\%u12eb\\>", "when": "\\%u1218\\%u127c\\>"}, + \"an": {"and": "Y\\>\\|E\\>", "background": "Antecedents", "but": "Pero\\>", "examples": "Eixemplos", "feature": "Caracteristica", "given": "Dadas\\>\\|Dada\\>\\|Daus\\>\\|Dau\\>", "rule": "Rule", "scenario": "Eixemplo\\|Caso", "scenario_outline": "Esquema del caso", "then": "Antonces\\>\\|Alavez\\>\\|Allora\\>", "when": "Cuan\\>"}, + \"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "rule": "Rule", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\|\\%u0645\\%u062b\\%u0627\\%u0644", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"}, + \"ast": {"and": "Ya\\>\\|Y\\>", "background": "Antecedentes", "but": "Peru\\>", "examples": "Exemplos", "feature": "Carauter\\%u00edstica", "given": "Dada\\>\\|Daos\\>\\|Daes\\>\\|D\\%u00e1u\\>", "rule": "Rule", "scenario": "Exemplo\\|Casu", "scenario_outline": "Esbozu del casu", "then": "Ent\\%u00f3s\\>", "when": "Cuando\\>"}, + \"az": {"and": "H\\%u0259m\\>\\|V\\%u0259\\>", "background": "Kontekst\\|Ke\\%u00e7mi\\%u015f", "but": "Ancaq\\>\\|Amma\\>", "examples": "N\\%u00fcmun\\%u0259l\\%u0259r", "feature": "\\%u00d6z\\%u0259llik", "given": "Tutaq ki\\>\\|Verilir\\>", "rule": "Rule", "scenario": "Ssenari\\|N\\%u00fcmun\\%u0259", "scenario_outline": "Ssenarinin strukturu", "then": "O halda\\>", "when": "N\\%u0259 vaxt ki\\>\\|\\%u018fg\\%u0259r\\>"}, + \"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"}, + \"bm": {"and": "Dan\\>", "background": "Latar Belakang", "but": "Tetapi\\>\\|Tapi\\>", "examples": "Contoh", "feature": "Fungsi", "given": "Diberi\\>\\|Bagi\\>", "rule": "Rule", "scenario": "Senario\\|Situasi\\|Keadaan", "scenario_outline": "Garis Panduan Senario\\|Kerangka Senario\\|Kerangka Situasi\\|Kerangka Keadaan", "then": "Kemudian\\>\\|Maka\\>", "when": "Apabila\\>"}, + \"bs": {"and": "I\\>\\|A\\>", "background": "Pozadina", "but": "Ali\\>", "examples": "Primjeri", "feature": "Karakteristika", "given": "Dato\\>", "rule": "Rule", "scenario": "Scenariju\\|Scenario\\|Primjer", "scenario_outline": "Scenario-outline\\|Scenariju-obris", "then": "Zatim\\>", "when": "Kada\\>"}, + \"ca": {"and": "I\\>", "background": "Antecedents\\|Rerefons", "but": "Per\\%u00f2\\>", "examples": "Exemples", "feature": "Caracter\\%u00edstica\\|Funcionalitat", "given": "Donada\\>\\|Donat\\>\\|Atesa\\>\\|At\\%u00e8s\\>", "rule": "Rule", "scenario": "Escenari\\|Exemple", "scenario_outline": "Esquema de l'escenari", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"}, + \"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Kontext\\|Pozad\\%u00ed", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady", "feature": "Po\\%u017eadavek", "given": "Za p\\%u0159edpokladu\\>\\|Pokud\\>", "rule": "Pravidlo", "scenario": "P\\%u0159\\%u00edklad\\|Sc\\%u00e9n\\%u00e1\\%u0159", "scenario_outline": "Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\|N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"}, + \"cy-GB": {"and": "A\\>", "background": "Cefndir", "but": "Ond\\>", "examples": "Enghreifftiau", "feature": "Arwedd", "given": "Anrhegedig a\\>", "rule": "Rule", "scenario": "Enghraifft\\|Scenario", "scenario_outline": "Scenario Amlinellol", "then": "Yna\\>", "when": "Pryd\\>"}, + \"da": {"and": "Og\\>", "background": "Baggrund", "but": "Men\\>", "examples": "Eksempler", "feature": "Egenskab", "given": "Givet\\>", "rule": "Rule", "scenario": "Eksempel\\|Scenarie", "scenario_outline": "Abstrakt Scenario", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, + \"de": {"and": "Und\\>", "background": "Voraussetzungen\\|Vorbedingungen\\|Hintergrund\\|Grundlage", "but": "Aber\\>", "examples": "Beispiele", "feature": "Funktionalit\\%u00e4t\\|Funktion", "given": "Gegeben seien\\>\\|Gegeben sei\\>\\|Angenommen\\>", "rule": "Regel\\|Rule", "scenario": "Beispiel\\|Szenario", "scenario_outline": "Szenariogrundriss\\|Szenarien", "then": "Dann\\>", "when": "Wenn\\>"}, + \"el": {"and": "\\%u039a\\%u03b1\\%u03b9\\>", "background": "\\%u03a5\\%u03c0\\%u03cc\\%u03b2\\%u03b1\\%u03b8\\%u03c1\\%u03bf", "but": "\\%u0391\\%u03bb\\%u03bb\\%u03ac\\>", "examples": "\\%u03a0\\%u03b1\\%u03c1\\%u03b1\\%u03b4\\%u03b5\\%u03af\\%u03b3\\%u03bc\\%u03b1\\%u03c4\\%u03b1\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03b1", "feature": "\\%u0394\\%u03c5\\%u03bd\\%u03b1\\%u03c4\\%u03cc\\%u03c4\\%u03b7\\%u03c4\\%u03b1\\|\\%u039b\\%u03b5\\%u03b9\\%u03c4\\%u03bf\\%u03c5\\%u03c1\\%u03b3\\%u03af\\%u03b1", "given": "\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5\\>", "rule": "Rule", "scenario": "\\%u03a0\\%u03b1\\%u03c1\\%u03ac\\%u03b4\\%u03b5\\%u03b9\\%u03b3\\%u03bc\\%u03b1\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03bf", "scenario_outline": "\\%u03a0\\%u03b5\\%u03c1\\%u03af\\%u03b3\\%u03c1\\%u03b1\\%u03bc\\%u03bc\\%u03b1 \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5\\|\\%u03a0\\%u03b5\\%u03c1\\%u03b9\\%u03b3\\%u03c1\\%u03b1\\%u03c6\\%u03ae \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5", "then": "\\%u03a4\\%u03cc\\%u03c4\\%u03b5\\>", "when": "\\%u038c\\%u03c4\\%u03b1\\%u03bd\\>"}, + \"em": {"and": "\\%u1f602", "background": "\\%u1f4a4", "but": "\\%u1f614", "examples": "\\%u1f4d3", "feature": "\\%u1f4da", "given": "\\%u1f610", "rule": "Rule", "scenario": "\\%u1f952\\|\\%u1f4d5", "scenario_outline": "\\%u1f4d6", "then": "\\%u1f64f", "when": "\\%u1f3ac"}, + \"en-Scouse": {"and": "An\\>", "background": "Dis is what went down", "but": "Buh\\>", "examples": "Examples", "feature": "Feature", "given": "Youse know when youse got\\>\\|Givun\\>", "rule": "Rule", "scenario": "The thing of it is", "scenario_outline": "Wharrimean is", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"}, + \"en-au": {"and": "Too right\\>", "background": "First off", "but": "Yeah nah\\>", "examples": "You'll wanna", "feature": "Pretty much", "given": "Y'know\\>", "rule": "Rule", "scenario": "Awww, look mate", "scenario_outline": "Reckon it's like", "then": "But at the end of the day I reckon\\>", "when": "It's just unbelievable\\>"}, + \"en-lol": {"and": "AN\\>", "background": "B4", "but": "BUT\\>", "examples": "EXAMPLZ", "feature": "OH HAI", "given": "I CAN HAZ\\>", "rule": "Rule", "scenario": "MISHUN", "scenario_outline": "MISHUN SRSLY", "then": "DEN\\>", "when": "WEN\\>"}, + \"en-old": {"and": "Ond\\>\\|7\\>", "background": "Aer\\|\\%u00c6r", "but": "Ac\\>", "examples": "Se the\\|Se \\%u00fee\\|Se \\%u00f0e", "feature": "Hwaet\\|Hw\\%u00e6t", "given": "Thurh\\>\\|\\%u00deurh\\>\\|\\%u00d0urh\\>", "rule": "Rule", "scenario": "Swa", "scenario_outline": "Swa hwaer swa\\|Swa hw\\%u00e6r swa", "then": "Tha the\\>\\|\\%u00dea \\%u00fee\\>\\|\\%u00d0a \\%u00f0e\\>\\|Tha\\>\\|\\%u00dea\\>\\|\\%u00d0a\\>", "when": "B\\%u00e6\\%u00fesealfa\\>\\|B\\%u00e6\\%u00fesealfe\\>\\|B\\%u00e6\\%u00fesealf\\>\\|Ciric\\%u00e6we\\>\\|Ciric\\%u00e6wa\\>\\|Ciric\\%u00e6w\\>"}, + \"en-pirate": {"and": "Aye\\>", "background": "Yo-ho-ho", "but": "Avast!\\>", "examples": "Dead men tell no tales", "feature": "Ahoy matey!", "given": "Gangway!\\>", "rule": "Rule", "scenario": "Heave to", "scenario_outline": "Shiver me timbers", "then": "Let go and haul\\>", "when": "Blimey!\\>"}, + \"en-tx": {"and": "Come hell or high water\\>", "background": "Lemme tell y'all a story", "but": "Well now hold on, I'll you what\\>", "examples": "Now that's a story longer than a cattle drive in July", "feature": "This ain\\%u2019t my first rodeo\\|All gussied up", "given": "All git out\\>\\|Fixin' to\\>", "rule": "Rule\\>", "scenario": "All hat and no cattle", "scenario_outline": "Busy as a hound in flea season\\|Serious as a snake bite", "then": "There\\%u2019s no tree but bears some fruit\\>", "when": "Quick out of the chute\\>"}, + \"eo": {"and": "Kaj\\>", "background": "Fono", "but": "Sed\\>", "examples": "Ekzemploj", "feature": "Trajto", "given": "Donita\\%u0135o\\>\\|Komence\\>", "rule": "Rule", "scenario": "Ekzemplo\\|Scenaro\\|Kazo", "scenario_outline": "Konturo de la scenaro\\|Kazo-skizo\\|Skizo", "then": "Do\\>", "when": "Se\\>"}, + \"es": {"and": "Y\\>\\|E\\>", "background": "Antecedentes", "but": "Pero\\>", "examples": "Ejemplos", "feature": "Necesidad del negocio\\|Caracter\\%u00edstica\\|Requisito", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Regla de negocio\\|Regla", "scenario": "Escenario\\|Ejemplo", "scenario_outline": "Esquema del escenario", "then": "Entonces\\>", "when": "Cuando\\>"}, + \"et": {"and": "Ja\\>", "background": "Taust", "but": "Kuid\\>", "examples": "Juhtumid", "feature": "Omadus", "given": "Eeldades\\>", "rule": "Reegel", "scenario": "Stsenaarium\\|Juhtum", "scenario_outline": "Raamstsenaarium\\|Raamjuhtum", "then": "Siis\\>", "when": "Kui\\>"}, + \"fa": {"and": "\\%u0648\\>", "background": "\\%u0632\\%u0645\\%u06cc\\%u0646\\%u0647", "but": "\\%u0627\\%u0645\\%u0627\\>", "examples": "\\%u0646\\%u0645\\%u0648\\%u0646\\%u0647 \\%u0647\\%u0627", "feature": "\\%u0648\\%u0650\\%u06cc\\%u0698\\%u06af\\%u06cc", "given": "\\%u0628\\%u0627 \\%u0641\\%u0631\\%u0636\\>", "rule": "Rule", "scenario": "\\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\|\\%u0645\\%u062b\\%u0627\\%u0644", "scenario_outline": "\\%u0627\\%u0644\\%u06af\\%u0648\\%u06cc \\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648", "then": "\\%u0622\\%u0646\\%u06af\\%u0627\\%u0647\\>", "when": "\\%u0647\\%u0646\\%u06af\\%u0627\\%u0645\\%u06cc\\>"}, + \"fi": {"and": "Ja\\>", "background": "Tausta", "but": "Mutta\\>", "examples": "Tapaukset", "feature": "Ominaisuus", "given": "Oletetaan\\>", "rule": "Rule", "scenario": "Tapaus", "scenario_outline": "Tapausaihio", "then": "Niin\\>", "when": "Kun\\>"}, + \"fr": {"and": "Et que\\>\\|Et qu'\\|Et\\>", "background": "Contexte", "but": "Mais que\\>\\|Mais qu'\\|Mais\\>", "examples": "Exemples", "feature": "Fonctionnalit\\%u00e9", "given": "Etant donn\\%u00e9 que\\>\\|\\%u00c9tant donn\\%u00e9 que\\>\\|Etant donn\\%u00e9 qu'\\|\\%u00c9tant donn\\%u00e9 qu'\\|Etant donn\\%u00e9es\\>\\|\\%u00c9tant donn\\%u00e9es\\>\\|Etant donn\\%u00e9e\\>\\|Etant donn\\%u00e9s\\>\\|\\%u00c9tant donn\\%u00e9e\\>\\|\\%u00c9tant donn\\%u00e9s\\>\\|Sachant que\\>\\|Etant donn\\%u00e9\\>\\|\\%u00c9tant donn\\%u00e9\\>\\|Sachant qu'\\|Sachant\\>\\|Soit\\>", "rule": "R\\%u00e8gle", "scenario": "Sc\\%u00e9nario\\|Exemple", "scenario_outline": "Plan du sc\\%u00e9nario\\|Plan du Sc\\%u00e9nario", "then": "Alors\\>\\|Donc\\>", "when": "Lorsque\\>\\|Lorsqu'\\|Quand\\>"}, + \"ga": {"and": "Agus", "background": "C\\%u00falra", "but": "Ach", "examples": "Sampla\\%u00ed", "feature": "Gn\\%u00e9", "given": "Cuir i gc\\%u00e1s nach\\|Cuir i gc\\%u00e1s gur\\|Cuir i gc\\%u00e1s n\\%u00e1r\\|Cuir i gc\\%u00e1s go", "rule": "Rule", "scenario": "Sampla\\|C\\%u00e1s", "scenario_outline": "C\\%u00e1s Achomair", "then": "Ansin", "when": "Nuair nach\\|Nuair n\\%u00e1r\\|Nuair ba\\|Nuair a"}, + \"gj": {"and": "\\%u0a85\\%u0aa8\\%u0ac7\\>", "background": "\\%u0aac\\%u0ac7\\%u0a95\\%u0a97\\%u0acd\\%u0ab0\\%u0abe\\%u0a89\\%u0aa8\\%u0acd\\%u0aa1", "but": "\\%u0aaa\\%u0aa3\\>", "examples": "\\%u0a89\\%u0aa6\\%u0abe\\%u0ab9\\%u0ab0\\%u0aa3\\%u0acb", "feature": "\\%u0ab5\\%u0acd\\%u0aaf\\%u0abe\\%u0aaa\\%u0abe\\%u0ab0 \\%u0a9c\\%u0ab0\\%u0ac2\\%u0ab0\\|\\%u0a95\\%u0acd\\%u0ab7\\%u0aae\\%u0aa4\\%u0abe\\|\\%u0ab2\\%u0a95\\%u0acd\\%u0ab7\\%u0aa3", "given": "\\%u0a86\\%u0aaa\\%u0ac7\\%u0ab2 \\%u0a9b\\%u0ac7\\>", "rule": "Rule", "scenario": "\\%u0a89\\%u0aa6\\%u0abe\\%u0ab9\\%u0ab0\\%u0aa3\\|\\%u0ab8\\%u0acd\\%u0aa5\\%u0abf\\%u0aa4\\%u0abf", "scenario_outline": "\\%u0aaa\\%u0ab0\\%u0abf\\%u0aa6\\%u0acd\\%u0aa6\\%u0ab6\\%u0acd\\%u0aaf \\%u0ab0\\%u0ac2\\%u0aaa\\%u0ab0\\%u0ac7\\%u0a96\\%u0abe\\|\\%u0aaa\\%u0ab0\\%u0abf\\%u0aa6\\%u0acd\\%u0aa6\\%u0ab6\\%u0acd\\%u0aaf \\%u0aa2\\%u0abe\\%u0a82\\%u0a9a\\%u0acb", "then": "\\%u0aaa\\%u0a9b\\%u0ac0\\>", "when": "\\%u0a95\\%u0acd\\%u0aaf\\%u0abe\\%u0ab0\\%u0ac7\\>"}, + \"gl": {"and": "E\\>", "background": "Contexto", "but": "Mais\\>\\|Pero\\>", "examples": "Exemplos", "feature": "Caracter\\%u00edstica", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Rule", "scenario": "Escenario\\|Exemplo", "scenario_outline": "Esbozo do escenario", "then": "Ent\\%u00f3n\\>\\|Logo\\>", "when": "Cando\\>"}, + \"he": {"and": "\\%u05d5\\%u05d2\\%u05dd\\>", "background": "\\%u05e8\\%u05e7\\%u05e2", "but": "\\%u05d0\\%u05d1\\%u05dc\\>", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df\\>", "rule": "\\%u05db\\%u05dc\\%u05dc", "scenario": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\|\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "then": "\\%u05d0\\%u05d6\\%u05d9\\>\\|\\%u05d0\\%u05d6\\>", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8\\>"}, + \"hi": {"and": "\\%u0924\\%u0925\\%u093e\\>\\|\\%u0914\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u093f", "but": "\\%u092a\\%u0930\\%u0928\\%u094d\\%u0924\\%u0941\\>\\|\\%u0915\\%u093f\\%u0928\\%u094d\\%u0924\\%u0941\\>\\|\\%u092a\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0930\\%u0942\\%u092a \\%u0932\\%u0947\\%u0916", "given": "\\%u091a\\%u0942\\%u0902\\%u0915\\%u093f\\>\\|\\%u0905\\%u0917\\%u0930\\>\\|\\%u092f\\%u0926\\%u093f\\>", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u0926\\%u093e\\>\\|\\%u0924\\%u092c\\>", "when": "\\%u0915\\%u0926\\%u093e\\>\\|\\%u091c\\%u092c\\>"}, + \"hr": {"and": "I\\>", "background": "Pozadina", "but": "Ali\\>", "examples": "Scenariji\\|Primjeri", "feature": "Mogu\\%u0107nost\\|Mogucnost\\|Osobina", "given": "Ukoliko\\>\\|Zadani\\>\\|Zadano\\>\\|Zadan\\>", "rule": "Rule", "scenario": "Scenarij\\|Primjer", "scenario_outline": "Koncept\\|Skica", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"}, + \"ht": {"and": "Epi\\>\\|Ak\\>\\|E\\>", "background": "Kont\\%u00e8ks\\|Istorik", "but": "Men\\>", "examples": "Egzanp", "feature": "Karakteristik\\|Fonksyonalite\\|Mak", "given": "Sipoze ke\\>\\|Sipoze Ke\\>\\|Sipoze\\>", "rule": "Rule", "scenario": "Senaryo", "scenario_outline": "Senaryo deskripsyon\\|Senaryo Deskripsyon\\|Dyagram senaryo\\|Dyagram Senaryo\\|Plan senaryo\\|Plan Senaryo", "then": "L\\%u00e8 sa a\\>\\|Le sa a\\>", "when": "L\\%u00e8\\>\\|Le\\>"}, + \"hu": {"and": "\\%u00c9s\\>", "background": "H\\%u00e1tt\\%u00e9r", "but": "De\\>", "examples": "P\\%u00e9ld\\%u00e1k", "feature": "Jellemz\\%u0151", "given": "Amennyiben\\>\\|Adott\\>", "rule": "Szab\\%u00e1ly", "scenario": "Forgat\\%u00f3k\\%u00f6nyv\\|P\\%u00e9lda", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat", "then": "Akkor\\>", "when": "Amikor\\>\\|Majd\\>\\|Ha\\>"}, + \"id": {"and": "Dan\\>", "background": "Latar Belakang\\|Dasar", "but": "Tetapi\\>\\|Tapi\\>", "examples": "Contoh\\|Misal", "feature": "Fitur", "given": "Diasumsikan\\>\\|Diketahui\\>\\|Dengan\\>\\|Bila\\>\\|Jika\\>", "rule": "Aturan\\|Rule", "scenario": "Skenario", "scenario_outline": "Garis-Besar Skenario\\|Skenario konsep", "then": "Kemudian\\>\\|Maka\\>", "when": "Ketika\\>"}, + \"is": {"and": "Og\\>", "background": "Bakgrunnur", "but": "En\\>", "examples": "Atbur\\%u00f0ar\\%u00e1sir\\|D\\%u00e6mi", "feature": "Eiginleiki", "given": "Ef\\>", "rule": "Rule", "scenario": "Atbur\\%u00f0ar\\%u00e1s", "scenario_outline": "L\\%u00fdsing Atbur\\%u00f0ar\\%u00e1sar\\|L\\%u00fdsing D\\%u00e6ma", "then": "\\%u00de\\%u00e1\\>", "when": "\\%u00deegar\\>"}, + \"it": {"and": "E\\>", "background": "Contesto", "but": "Ma\\>", "examples": "Esempi", "feature": "Esigenza di Business\\|Funzionalit\\%u00e0\\|Abilit\\%u00e0", "given": "Dato\\>\\|Data\\>\\|Dati\\>\\|Date\\>", "rule": "Regola", "scenario": "Scenario\\|Esempio", "scenario_outline": "Schema dello scenario", "then": "Allora\\>", "when": "Quando\\>"}, + \"ja": {"and": "\\%u4e14\\%u3064\\|\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u7136\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\|\\%u4f8b", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\|\\%u6a5f\\%u80fd", "given": "\\%u524d\\%u63d0", "rule": "\\%u30eb\\%u30fc\\%u30eb", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"}, + \"jv": {"and": "Lan\\>", "background": "Dasar", "but": "Ananging\\>\\|Nanging\\>\\|Tapi\\>", "examples": "Contone\\|Conto", "feature": "Fitur", "given": "Nalikaning\\>\\|Nalika\\>", "rule": "Rule", "scenario": "Skenario", "scenario_outline": "Konsep skenario", "then": "Banjur\\>\\|Njuk\\>", "when": "Manawa\\>\\|Menawa\\>"}, + \"ka": {"and": "\\%u10d0\\%u10e1\\%u10d4\\%u10d5\\%u10d4\\>\\|\\%u10d3\\%u10d0\\>", "background": "\\%u10d9\\%u10dd\\%u10dc\\%u10e2\\%u10d4\\%u10e5\\%u10e1\\%u10e2\\%u10d8", "but": "\\%u10db\\%u10d0\\%u10d2\\%u10e0\\%u10d0\\%u10db\\>\\|\\%u10d7\\%u10e3\\%u10db\\%u10ea\\%u10d0\\>", "examples": "\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d4\\%u10d1\\%u10d8", "feature": "\\%u10db\\%u10dd\\%u10d7\\%u10ee\\%u10dd\\%u10d5\\%u10dc\\%u10d0\\|\\%u10d7\\%u10d5\\%u10d8\\%u10e1\\%u10d4\\%u10d1\\%u10d0", "given": "\\%u10db\\%u10dd\\%u10ea\\%u10d4\\%u10db\\%u10e3\\%u10da\\%u10d8\\%u10d0\\>\\|\\%u10db\\%u10dd\\%u10ea\\%u10d4\\%u10db\\%u10e3\\%u10da\\%u10d8\\>\\|\\%u10d5\\%u10d7\\%u10e5\\%u10d5\\%u10d0\\%u10d7\\>", "rule": "\\%u10ec\\%u10d4\\%u10e1\\%u10d8", "scenario": "\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d0\\%u10d3\\|\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d8\\|\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\|\\%u10db\\%u10d0\\%u10d2", "scenario_outline": "\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\%u10e1 \\%u10e8\\%u10d0\\%u10d1\\%u10da\\%u10dd\\%u10dc\\%u10d8\\|\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\%u10e1 \\%u10dc\\%u10d8\\%u10db\\%u10e3\\%u10e8\\%u10d8\\|\\%u10e8\\%u10d0\\%u10d1\\%u10da\\%u10dd\\%u10dc\\%u10d8\\|\\%u10dc\\%u10d8\\%u10db\\%u10e3\\%u10e8\\%u10d8", "then": "\\%u10db\\%u10d0\\%u10e8\\%u10d8\\%u10dc\\>", "when": "\\%u10e0\\%u10dd\\%u10d2\\%u10dd\\%u10e0\\%u10ea \\%u10d9\\%u10d8\\>\\|\\%u10e0\\%u10dd\\%u10d3\\%u10d4\\%u10e1\\%u10d0\\%u10ea\\>\\|\\%u10e0\\%u10dd\\%u10ea\\%u10d0\\>\\|\\%u10d7\\%u10e3\\>"}, + \"kn": {"and": "\\%u0cae\\%u0ca4\\%u0ccd\\%u0ca4\\%u0cc1\\>", "background": "\\%u0cb9\\%u0cbf\\%u0ca8\\%u0ccd\\%u0ca8\\%u0cc6\\%u0cb2\\%u0cc6", "but": "\\%u0c86\\%u0ca6\\%u0cb0\\%u0cc6\\>", "examples": "\\%u0c89\\%u0ca6\\%u0cbe\\%u0cb9\\%u0cb0\\%u0ca3\\%u0cc6\\%u0c97\\%u0cb3\\%u0cc1", "feature": "\\%u0cb9\\%u0cc6\\%u0c9a\\%u0ccd\\%u0c9a\\%u0cb3", "given": "\\%u0ca8\\%u0cbf\\%u0cd5\\%u0ca1\\%u0cbf\\%u0ca6\\>", "rule": "Rule", "scenario": "\\%u0c95\\%u0ca5\\%u0cbe\\%u0cb8\\%u0cbe\\%u0cb0\\%u0cbe\\%u0c82\\%u0cb6\\|\\%u0c89\\%u0ca6\\%u0cbe\\%u0cb9\\%u0cb0\\%u0ca3\\%u0cc6", "scenario_outline": "\\%u0cb5\\%u0cbf\\%u0cb5\\%u0cb0\\%u0ca3\\%u0cc6", "then": "\\%u0ca8\\%u0c82\\%u0ca4\\%u0cb0\\>", "when": "\\%u0cb8\\%u0ccd\\%u0ca5\\%u0cbf\\%u0ca4\\%u0cbf\\%u0caf\\%u0ca8\\%u0ccd\\%u0ca8\\%u0cc1\\>"}, + \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608", "feature": "\\%uae30\\%ub2a5", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "rule": "Rule", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"}, + \"lt": {"and": "Ir\\>", "background": "Kontekstas", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\|Scenarijai\\|Variantai", "feature": "Savyb\\%u0117", "given": "Duota\\>", "rule": "Rule", "scenario": "Scenarijus\\|Pavyzdys", "scenario_outline": "Scenarijaus \\%u0161ablonas", "then": "Tada\\>", "when": "Kai\\>"}, + \"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond", "but": "awer\\>\\|m\\%u00e4\\>", "examples": "Beispiller", "feature": "Funktionalit\\%u00e9it", "given": "ugeholl\\>", "rule": "Rule", "scenario": "Beispill\\|Szenario", "scenario_outline": "Plang vum Szenario", "then": "dann\\>", "when": "wann\\>"}, + \"lv": {"and": "Un\\>", "background": "Konteksts\\|Situ\\%u0101cija", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\|Paraugs", "feature": "Funkcionalit\\%u0101te\\|F\\%u012b\\%u010da", "given": "Kad\\>", "rule": "Rule", "scenario": "Scen\\%u0101rijs\\|Piem\\%u0113rs", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga", "then": "Tad\\>", "when": "Ja\\>"}, + \"mk-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\|\\%u0421\\%u043e\\%u0434\\%u0440\\%u0436\\%u0438\\%u043d\\%u0430", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u0411\\%u0438\\%u0437\\%u043d\\%u0438\\%u0441 \\%u043f\\%u043e\\%u0442\\%u0440\\%u0435\\%u0431\\%u0430\\|\\%u041c\\%u043e\\%u0436\\%u043d\\%u043e\\%u0441\\%u0442", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>\\|\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u0430\\>", "rule": "Rule", "scenario": "\\%u041d\\%u0430 \\%u043f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\|\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u041f\\%u0440\\%u0435\\%u0433\\%u043b\\%u0435\\%u0434 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430", "then": "\\%u0422\\%u043e\\%u0433\\%u0430\\%u0448\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\>"}, + \"mk-Latn": {"and": "I\\>", "background": "Sodrzhina\\|Kontekst", "but": "No\\>", "examples": "Scenaria\\|Primeri", "feature": "Funkcionalnost\\|Biznis potreba\\|Mozhnost", "given": "Dadeno\\>\\|Dadena\\>", "rule": "Rule", "scenario": "Na primer\\|Scenario", "scenario_outline": "Pregled na scenarija\\|Koncept\\|Skica", "then": "Togash\\>", "when": "Koga\\>"}, + \"mn": {"and": "\\%u0422\\%u044d\\%u0433\\%u044d\\%u044d\\%u0434\\>\\|\\%u041c\\%u04e9\\%u043d\\>", "background": "\\%u0410\\%u0433\\%u0443\\%u0443\\%u043b\\%u0433\\%u0430", "but": "\\%u0413\\%u044d\\%u0445\\%u0434\\%u044d\\%u044d\\>\\|\\%u0425\\%u0430\\%u0440\\%u0438\\%u043d\\>", "examples": "\\%u0422\\%u0443\\%u0445\\%u0430\\%u0439\\%u043b\\%u0431\\%u0430\\%u043b", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446", "given": "\\%u04e8\\%u0433\\%u04e9\\%u0433\\%u0434\\%u0441\\%u04e9\\%u043d \\%u043d\\%u044c\\>\\|\\%u0410\\%u043d\\%u0445\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u044b\\%u043d \\%u0442\\%u04e9\\%u043b\\%u04e9\\%u0432\\%u043b\\%u04e9\\%u0433\\%u04e9\\%u04e9", "then": "\\%u04ae\\%u04af\\%u043d\\%u0438\\%u0439 \\%u0434\\%u0430\\%u0440\\%u0430\\%u0430\\>\\|\\%u0422\\%u044d\\%u0433\\%u044d\\%u0445\\%u044d\\%u0434\\>", "when": "\\%u0425\\%u044d\\%u0440\\%u044d\\%u0432\\>"}, + \"mr": {"and": "\\%u0924\\%u0938\\%u0947\\%u091a\\>\\|\\%u0906\\%u0923\\%u093f\\>", "background": "\\%u092a\\%u093e\\%u0930\\%u094d\\%u0936\\%u094d\\%u0935\\%u092d\\%u0942\\%u092e\\%u0940", "but": "\\%u092a\\%u0930\\%u0902\\%u0924\\%u0941\\>\\|\\%u092a\\%u0923\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0935\\%u0948\\%u0936\\%u093f\\%u0937\\%u094d\\%u091f\\%u094d\\%u092f\\|\\%u0938\\%u0941\\%u0935\\%u093f\\%u0927\\%u093e", "given": "\\%u0926\\%u093f\\%u0932\\%u0947\\%u0932\\%u094d\\%u092f\\%u093e \\%u092a\\%u094d\\%u0930\\%u092e\\%u093e\\%u0923\\%u0947\\>\\|\\%u091c\\%u0930", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u0947\\%u0935\\%u094d\\%u0939\\%u093e\\>\\|\\%u092e\\%u0917\\>", "when": "\\%u091c\\%u0947\\%u0935\\%u094d\\%u0939\\%u093e\\>"}, + \"ne": {"and": "\\%u0905\\%u0928\\%u093f\\>\\|\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u0940", "but": "\\%u0924\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923\\%u0939\\%u0930\\%u0941\\|\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0935\\%u093f\\%u0936\\%u0947\\%u0937\\%u0924\\%u093e\\|\\%u0938\\%u0941\\%u0935\\%u093f\\%u0927\\%u093e", "given": "\\%u0926\\%u093f\\%u0907\\%u090f\\%u0915\\%u094b\\>\\|\\%u0926\\%u093f\\%u090f\\%u0915\\%u094b\\>\\|\\%u092f\\%u0926\\%u093f\\>", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u094d\\%u092f\\%u0938\\%u092a\\%u091b\\%u093f\\>\\|\\%u0905\\%u0928\\%u0940\\>", "when": "\\%u091c\\%u092c\\>"}, + \"nl": {"and": "En\\>", "background": "Achtergrond", "but": "Maar\\>", "examples": "Voorbeelden", "feature": "Functionaliteit", "given": "Gegeven\\>\\|Stel\\>", "rule": "Rule", "scenario": "Voorbeeld\\|Scenario", "scenario_outline": "Abstract Scenario", "then": "Dan\\>", "when": "Wanneer\\>\\|Als\\>"}, + \"no": {"and": "Og\\>", "background": "Bakgrunn", "but": "Men\\>", "examples": "Eksempler", "feature": "Egenskap", "given": "Gitt\\>", "rule": "Regel", "scenario": "Eksempel\\|Scenario", "scenario_outline": "Abstrakt Scenario\\|Scenariomal", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, + \"pa": {"and": "\\%u0a05\\%u0a24\\%u0a47\\>", "background": "\\%u0a2a\\%u0a3f\\%u0a1b\\%u0a4b\\%u0a15\\%u0a5c", "but": "\\%u0a2a\\%u0a30\\>", "examples": "\\%u0a09\\%u0a26\\%u0a3e\\%u0a39\\%u0a30\\%u0a28\\%u0a3e\\%u0a02", "feature": "\\%u0a28\\%u0a15\\%u0a36 \\%u0a28\\%u0a41\\%u0a39\\%u0a3e\\%u0a30\\|\\%u0a2e\\%u0a41\\%u0a39\\%u0a3e\\%u0a02\\%u0a26\\%u0a30\\%u0a3e\\|\\%u0a16\\%u0a3e\\%u0a38\\%u0a40\\%u0a05\\%u0a24", "given": "\\%u0a1c\\%u0a3f\\%u0a35\\%u0a47\\%u0a02 \\%u0a15\\%u0a3f\\>\\|\\%u0a1c\\%u0a47\\%u0a15\\%u0a30\\>", "rule": "Rule", "scenario": "\\%u0a09\\%u0a26\\%u0a3e\\%u0a39\\%u0a30\\%u0a28\\|\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e", "scenario_outline": "\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e \\%u0a30\\%u0a42\\%u0a2a \\%u0a30\\%u0a47\\%u0a16\\%u0a3e\\|\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e \\%u0a22\\%u0a3e\\%u0a02\\%u0a1a\\%u0a3e", "then": "\\%u0a24\\%u0a26\\>", "when": "\\%u0a1c\\%u0a26\\%u0a4b\\%u0a02\\>"}, + \"pl": {"and": "Oraz\\>\\|I\\>", "background": "Za\\%u0142o\\%u017cenia", "but": "Ale\\>", "examples": "Przyk\\%u0142ady", "feature": "Potrzeba biznesowa\\|W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\|Funkcja\\|Aspekt", "given": "Zak\\%u0142adaj\\%u0105c, \\%u017ce\\>\\|Zak\\%u0142adaj\\%u0105c\\>\\|Maj\\%u0105c\\>", "rule": "Zasada\\|Regu\\%u0142a", "scenario": "Scenariusz\\|Przyk\\%u0142ad", "scenario_outline": "Szablon scenariusza", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>\\|Je\\%u015bli\\>\\|Kiedy\\>\\|Gdy\\>"}, + \"pt": {"and": "E\\>", "background": "Cen\\%u00e1rio de Fundo\\|Cenario de Fundo\\|Contexto\\|Fundo", "but": "Mas\\>", "examples": "Exemplos\\|Cen\\%u00e1rios\\|Cenarios", "feature": "Funcionalidade\\|Caracter\\%u00edstica\\|Caracteristica", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Regra", "scenario": "Exemplo\\|Cen\\%u00e1rio\\|Cenario", "scenario_outline": "Delinea\\%u00e7\\%u00e3o do Cen\\%u00e1rio\\|Delineacao do Cenario\\|Esquema do Cen\\%u00e1rio\\|Esquema do Cenario", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"}, + \"ro": {"and": "Si\\>\\|\\%u0218i\\>\\|\\%u015ei\\>", "background": "Context", "but": "Dar\\>", "examples": "Exemple", "feature": "Functionalitate\\|Func\\%u021bionalitate\\|Func\\%u0163ionalitate", "given": "Date fiind\\>\\|Dati fiind\\>\\|Da\\%u021bi fiind\\>\\|Da\\%u0163i fiind\\>\\|Dat fiind\\>\\|Dat\\%u0103 fiind", "rule": "Rule", "scenario": "Scenariu\\|Exemplu", "scenario_outline": "Structura scenariu\\|Structur\\%u0103 scenariu", "then": "Atunci\\>", "when": "Cand\\>\\|C\\%u00e2nd\\>"}, + \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0422\\%u0430\\%u043a\\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\|\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442", "but": "\\%u0418\\%u043d\\%u0430\\%u0447\\%u0435\\>\\|\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u044b", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u044c\\%u043d\\%u043e\\%u0441\\%u0442\\%u044c\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\|\\%u0421\\%u0432\\%u043e\\%u0439\\%u0441\\%u0442\\%u0432\\%u043e\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u044f\\|\\%u0424\\%u0438\\%u0447\\%u0430", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>\\|\\%u041f\\%u0443\\%u0441\\%u0442\\%u044c\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\|\\%u0428\\%u0430\\%u0431\\%u043b\\%u043e\\%u043d \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f", "then": "\\%u0417\\%u0430\\%u0442\\%u0435\\%u043c\\>\\|\\%u0422\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0415\\%u0441\\%u043b\\%u0438\\>"}, + \"sk": {"and": "A taktie\\%u017e\\>\\|A z\\%u00e1rove\\%u0148\\>\\|A tie\\%u017e\\>\\|A\\>", "background": "Pozadie", "but": "Ale\\>", "examples": "Pr\\%u00edklady", "feature": "Po\\%u017eiadavka\\|Vlastnos\\%u0165\\|Funkcia", "given": "Za predpokladu\\>\\|Pokia\\%u013e\\>", "rule": "Rule", "scenario": "Pr\\%u00edklad\\|Scen\\%u00e1r", "scenario_outline": "Osnova Scen\\%u00e1ra\\|N\\%u00e1\\%u010drt Scen\\%u00e1ru\\|N\\%u00e1\\%u010drt Scen\\%u00e1ra", "then": "Potom\\>\\|Tak\\>", "when": "Ke\\%u010f\\>\\|Ak\\>"}, + \"sl": {"and": "Ter\\>\\|In\\>", "background": "Kontekst\\|Osnova\\|Ozadje", "but": "Vendar\\>\\|Ampak\\>\\|Toda\\>", "examples": "Scenariji\\|Primeri", "feature": "Funkcionalnost\\|Zna\\%u010dilnost\\|Funkcija\\|Mo\\%u017enosti\\|Moznosti\\|Lastnost", "given": "Privzeto\\>\\|Podano\\>\\|Zaradi\\>\\|Dano\\>", "rule": "Rule", "scenario": "Scenarij\\|Primer", "scenario_outline": "Struktura scenarija\\|Oris scenarija\\|Koncept\\|Osnutek\\|Skica", "then": "Takrat\\>\\|Potem\\>\\|Nato\\>", "when": "Kadar\\>\\|Ko\\>\\|Ce\\>\\|\\%u010ce\\>"}, + \"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430", "given": "\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u0438\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"}, + \"sr-Latn": {"and": "I\\>", "background": "Kontekst\\|Pozadina\\|Osnova", "but": "Ali\\>", "examples": "Scenariji\\|Primeri", "feature": "Funkcionalnost\\|Mogu\\%u0107nost\\|Mogucnost\\|Osobina", "given": "Za dato\\>\\|Za date\\>\\|Za dati\\>", "rule": "Pravilo", "scenario": "Scenario\\|Primer", "scenario_outline": "Struktura scenarija\\|Koncept\\|Skica", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"}, + \"sv": {"and": "Och\\>", "background": "Bakgrund", "but": "Men\\>", "examples": "Exempel", "feature": "Egenskap", "given": "Givet\\>", "rule": "Regel", "scenario": "Scenario", "scenario_outline": "Abstrakt Scenario\\|Scenariomall", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"}, + \"ta": {"and": "\\%u0bae\\%u0bc7\\%u0bb2\\%u0bc1\\%u0bae\\%u0bcd \\>\\|\\%u0bae\\%u0bb1\\%u0bcd\\%u0bb1\\%u0bc1\\%u0bae\\%u0bcd\\>", "background": "\\%u0baa\\%u0bbf\\%u0ba9\\%u0bcd\\%u0ba9\\%u0ba3\\%u0bbf", "but": "\\%u0b86\\%u0ba9\\%u0bbe\\%u0bb2\\%u0bcd \\>", "examples": "\\%u0b8e\\%u0b9f\\%u0bc1\\%u0ba4\\%u0bcd\\%u0ba4\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9f\\%u0bc1\\%u0b95\\%u0bb3\\%u0bcd\\|\\%u0ba8\\%u0bbf\\%u0bb2\\%u0bc8\\%u0bae\\%u0bc8\\%u0b95\\%u0bb3\\%u0bbf\\%u0bb2\\%u0bcd\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf\\%u0b95\\%u0bb3\\%u0bcd", "feature": "\\%u0bb5\\%u0ba3\\%u0bbf\\%u0b95 \\%u0ba4\\%u0bc7\\%u0bb5\\%u0bc8\\|\\%u0b85\\%u0bae\\%u0bcd\\%u0b9a\\%u0bae\\%u0bcd\\|\\%u0ba4\\%u0bbf\\%u0bb1\\%u0ba9\\%u0bcd", "given": "\\%u0b95\\%u0bc6\\%u0bbe\\%u0b9f\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0baa\\%u0bcd\\%u0baa\\%u0b9f\\%u0bcd\\%u0b9f\\>", "rule": "Rule", "scenario": "\\%u0b89\\%u0ba4\\%u0bbe\\%u0bb0\\%u0ba3\\%u0bae\\%u0bbe\\%u0b95\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf", "scenario_outline": "\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf \\%u0bb5\\%u0bbe\\%u0bb0\\%u0bcd\\%u0baa\\%u0bcd\\%u0baa\\%u0bc1\\%u0bb0\\%u0bc1\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf \\%u0b9a\\%u0bc1\\%u0bb0\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0bae\\%u0bcd", "then": "\\%u0b85\\%u0baa\\%u0bcd\\%u0baa\\%u0bc6\\%u0bbe\\%u0bb4\\%u0bc1\\%u0ba4\\%u0bc1\\>", "when": "\\%u0b8e\\%u0baa\\%u0bcd\\%u0baa\\%u0bc7\\%u0bbe\\%u0ba4\\%u0bc1\\>"}, + \"te": {"and": "\\%u0c2e\\%u0c30\\%u0c3f\\%u0c2f\\%u0c41\\>", "background": "\\%u0c28\\%u0c47\\%u0c2a\\%u0c25\\%u0c4d\\%u0c2f\\%u0c02", "but": "\\%u0c15\\%u0c3e\\%u0c28\\%u0c3f\\>", "examples": "\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23\\%u0c32\\%u0c41", "feature": "\\%u0c17\\%u0c41\\%u0c23\\%u0c2e\\%u0c41", "given": "\\%u0c1a\\%u0c46\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c2c\\%u0c21\\%u0c3f\\%u0c28\\%u0c26\\%u0c3f\\>", "rule": "Rule", "scenario": "\\%u0c38\\%u0c28\\%u0c4d\\%u0c28\\%u0c3f\\%u0c35\\%u0c47\\%u0c36\\%u0c02\\|\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23", "scenario_outline": "\\%u0c15\\%u0c25\\%u0c28\\%u0c02", "then": "\\%u0c05\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c41\\%u0c21\\%u0c41\\>", "when": "\\%u0c08 \\%u0c2a\\%u0c30\\%u0c3f\\%u0c38\\%u0c4d\\%u0c25\\%u0c3f\\%u0c24\\%u0c3f\\%u0c32\\%u0c4b\\>"}, + \"th": {"and": "\\%u0e41\\%u0e25\\%u0e30\\>", "background": "\\%u0e41\\%u0e19\\%u0e27\\%u0e04\\%u0e34\\%u0e14", "but": "\\%u0e41\\%u0e15\\%u0e48\\>", "examples": "\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\|\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e15\\%u0e31\\%u0e27\\%u0e2d\\%u0e22\\%u0e48\\%u0e32\\%u0e07", "feature": "\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e15\\%u0e49\\%u0e2d\\%u0e07\\%u0e01\\%u0e32\\%u0e23\\%u0e17\\%u0e32\\%u0e07\\%u0e18\\%u0e38\\%u0e23\\%u0e01\\%u0e34\\%u0e08\\|\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e2a\\%u0e32\\%u0e21\\%u0e32\\%u0e23\\%u0e16\\|\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2b\\%u0e25\\%u0e31\\%u0e01", "given": "\\%u0e01\\%u0e33\\%u0e2b\\%u0e19\\%u0e14\\%u0e43\\%u0e2b\\%u0e49\\>", "rule": "Rule", "scenario": "\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c", "scenario_outline": "\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2a\\%u0e23\\%u0e49\\%u0e32\\%u0e07\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\|\\%u0e2a\\%u0e23\\%u0e38\\%u0e1b\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c", "then": "\\%u0e14\\%u0e31\\%u0e07\\%u0e19\\%u0e31\\%u0e49\\%u0e19\\>", "when": "\\%u0e40\\%u0e21\\%u0e37\\%u0e48\\%u0e2d\\>"}, + \"tlh": {"and": "latlh\\>\\|'ej\\>", "background": "mo'", "but": "'ach\\>\\|'a\\>", "examples": "ghantoH\\|lutmey", "feature": "poQbogh malja'\\|Qu'meH 'ut\\|perbogh\\|Qap\\|laH", "given": "DaH ghu' bejlu'\\>\\|ghu' noblu'\\>", "rule": "Rule", "scenario": "lut", "scenario_outline": "lut chovnatlh", "then": "vaj\\>", "when": "qaSDI'\\>"}, + \"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler", "feature": "\\%u00d6zellik", "given": "Diyelim ki\\>", "rule": "Kural", "scenario": "Senaryo\\|\\%u00d6rnek", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"}, + \"tt": {"and": "\\%u04ba\\%u04d9\\%u043c\\>\\|\\%u0412\\%u04d9\\>", "background": "\\%u041a\\%u0435\\%u0440\\%u0435\\%u0448", "but": "\\%u041b\\%u04d9\\%u043a\\%u0438\\%u043d\\>\\|\\%u04d8\\%u043c\\%u043c\\%u0430\\>", "examples": "\\%u04ae\\%u0440\\%u043d\\%u04d9\\%u043a\\%u043b\\%u04d9\\%u0440\\|\\%u041c\\%u0438\\%u0441\\%u0430\\%u043b\\%u043b\\%u0430\\%u0440", "feature": "\\%u04ae\\%u0437\\%u0435\\%u043d\\%u0447\\%u04d9\\%u043b\\%u0435\\%u043a\\%u043b\\%u0435\\%u043b\\%u0435\\%u043a\\|\\%u041c\\%u04e9\\%u043c\\%u043a\\%u0438\\%u043d\\%u043b\\%u0435\\%u043a", "given": "\\%u04d8\\%u0439\\%u0442\\%u0438\\%u043a\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\%u043d\\%u044b\\%u04a3 \\%u0442\\%u04e9\\%u0437\\%u0435\\%u043b\\%u0435\\%u0448\\%u0435", "then": "\\%u041d\\%u04d9\\%u0442\\%u0438\\%u0497\\%u04d9\\%u0434\\%u04d9\\>", "when": "\\%u04d8\\%u0433\\%u04d9\\%u0440\\>"}, + \"uk": {"and": "\\%u0410 \\%u0442\\%u0430\\%u043a\\%u043e\\%u0436\\>\\|\\%u0422\\%u0430\\>\\|\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e", "then": "\\%u0422\\%u043e\\%u0434\\%u0456\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>\\|\\%u041a\\%u043e\\%u043b\\%u0438\\>"}, + \"ur": {"and": "\\%u0627\\%u0648\\%u0631\\>", "background": "\\%u067e\\%u0633 \\%u0645\\%u0646\\%u0638\\%u0631", "but": "\\%u0644\\%u06cc\\%u06a9\\%u0646\\>", "examples": "\\%u0645\\%u062b\\%u0627\\%u0644\\%u06cc\\%u06ba", "feature": "\\%u06a9\\%u0627\\%u0631\\%u0648\\%u0628\\%u0627\\%u0631 \\%u06a9\\%u06cc \\%u0636\\%u0631\\%u0648\\%u0631\\%u062a\\|\\%u0635\\%u0644\\%u0627\\%u062d\\%u06cc\\%u062a\\|\\%u062e\\%u0635\\%u0648\\%u0635\\%u06cc\\%u062a", "given": "\\%u0641\\%u0631\\%u0636 \\%u06a9\\%u06cc\\%u0627\\>\\|\\%u0628\\%u0627\\%u0644\\%u0641\\%u0631\\%u0636\\>\\|\\%u0627\\%u06af\\%u0631\\>", "rule": "Rule", "scenario": "\\%u0645\\%u0646\\%u0638\\%u0631\\%u0646\\%u0627\\%u0645\\%u06c1", "scenario_outline": "\\%u0645\\%u0646\\%u0638\\%u0631 \\%u0646\\%u0627\\%u0645\\%u06d2 \\%u06a9\\%u0627 \\%u062e\\%u0627\\%u06a9\\%u06c1", "then": "\\%u067e\\%u06be\\%u0631\\>\\|\\%u062a\\%u0628\\>", "when": "\\%u062c\\%u0628\\>"}, + \"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b", "given": "Belgilangan\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"}, + \"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u", "feature": "T\\%u00ednh n\\%u0103ng", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "rule": "Rule", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\|K\\%u1ecbch b\\%u1ea3n", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\|Khung k\\%u1ecbch b\\%u1ea3n", "then": "Th\\%u00ec\\>", "when": "Khi\\>"}, + \"zh-CN": {"and": "\\%u800c\\%u4e14\\|\\%u5e76\\%u4e14\\|\\%u540c\\%u65f6", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8bbe\\|\\%u5047\\%u5b9a", "rule": "Rule\\|\\%u89c4\\%u5219", "scenario": "\\%u573a\\%u666f\\|\\%u5267\\%u672c", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\|\\%u5267\\%u672c\\%u5927\\%u7eb2", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"}, + \"zh-TW": {"and": "\\%u800c\\%u4e14\\|\\%u4e26\\%u4e14\\|\\%u540c\\%u6642", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8a2d\\|\\%u5047\\%u5b9a", "rule": "Rule", "scenario": "\\%u5834\\%u666f\\|\\%u5287\\%u672c", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1\\|\\%u5287\\%u672c\\%u5927\\%u7db1", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}} function! s:pattern(key) let language = matchstr(getline(1),'#\s*language:\s*\zs\S\+') @@ -83,16 +107,18 @@ function! s:pattern(key) endfunction function! s:Add(name) - let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","Comment","String","Table"],'"cucumber".a:name.v:val'),",") + let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","StarRegion","Comment","String","Table"],'"cucumber".a:name.v:val'),",") exe "syn region cucumber".a:name.'Region matchgroup=cucumber'.a:name.' start="\%(^\s*\)\@<=\%('.s:pattern(tolower(a:name)).'\)" end="$"'.next exe 'syn region cucumber'.a:name.'AndRegion matchgroup=cucumber'.a:name.'And start="\%(^\s*\)\@<='.s:pattern('and').'" end="$" contained'.next exe 'syn region cucumber'.a:name.'ButRegion matchgroup=cucumber'.a:name.'But start="\%(^\s*\)\@<='.s:pattern('but').'" end="$" contained'.next + exe 'syn region cucumber'.a:name.'StarRegion matchgroup=cucumber'.a:name.'Star start="\%(^\s*\)\@<=\*\S\@!" end="$" contained'.next exe 'syn match cucumber'.a:name.'Comment "\%(^\s*\)\@<=#.*" contained'.next exe 'syn region cucumber'.a:name.'String start=+\%(^\s*\)\@<="""+ end=+"""+ contained'.next exe 'syn match cucumber'.a:name.'Table "\%(^\s*\)\@<=|.*" contained contains=cucumberDelimiter'.next exe 'hi def link cucumber'.a:name.'Comment cucumberComment' exe 'hi def link cucumber'.a:name.'String cucumberString' exe 'hi def link cucumber'.a:name.'But cucumber'.a:name.'And' + exe 'hi def link cucumber'.a:name.'Star cucumber'.a:name.'And' exe 'hi def link cucumber'.a:name.'And cucumber'.a:name exe 'syn cluster cucumberStepRegions add=cucumber'.a:name.'Region,cucumber'.a:name.'AndRegion,cucumber'.a:name.'ButRegion' endfunction @@ -100,12 +126,13 @@ endfunction syn match cucumberComment "\%(^\s*\)\@<=#.*" syn match cucumberComment "\%(\%^\s*\)\@<=#.*" contains=cucumberLanguage syn match cucumberLanguage "\%(#\s*\)\@<=language:" contained -syn match cucumberUnparsed "\S.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained -syn match cucumberUnparsedComment "#.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained +syn match cucumberUnparsed "\S.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained +syn match cucumberUnparsedComment "#.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained -exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty' +exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty' exe 'syn match cucumberBackground "\%(^\s*\)\@<='.s:pattern('background').':"' exe 'syn match cucumberScenario "\%(^\s*\)\@<='.s:pattern('scenario').':"' +exe 'syn match cucumberRule "\%(^\s*\)\@<='.s:pattern('rule').':"' exe 'syn match cucumberScenarioOutline "\%(^\s*\)\@<='.s:pattern('scenario_outline').':"' exe 'syn match cucumberExamples "\%(^\s*\)\@<='.s:pattern('examples').':" nextgroup=cucumberExampleTable skipempty skipwhite' @@ -123,6 +150,7 @@ hi def link cucumberComment Comment hi def link cucumberLanguage SpecialComment hi def link cucumberFeature Macro hi def link cucumberBackground Define +hi def link cucumberRule Define hi def link cucumberScenario Define hi def link cucumberScenarioOutline Define hi def link cucumberExamples Define -- cgit From d634cd5b0bc3ac6bdf285432f74a1c10f12b6031 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Dec 2023 17:35:07 +0100 Subject: vim-patch:d96f25bd69c1 runtime(fortran): update syntax and documentation (vim/vim#13784) * Update Fortran section of indent.txt * Small addition to fortran syntax * Update Fortran section of syntax.txt * Runtime (Fortran) Fix regression * Combine two expressions https://github.com/vim/vim/commit/d96f25bd69c14bc257281a580f344240c72f4999 Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/doc/indent.txt | 19 ++++++++++--------- runtime/doc/syntax.txt | 19 ++++++++++--------- runtime/syntax/fortran.vim | 9 ++++++--- 3 files changed, 26 insertions(+), 21 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 99467e4b03..a79ce41ac1 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -708,15 +708,16 @@ clojure-mode.el: FORTRAN *ft-fortran-indent* -Block if, select case, where, and forall constructs are indented. So are -type, interface, associate, block, and enum constructs. The indenting of -subroutines, functions, modules, and program blocks is optional. Comments, -labeled statements, and continuation lines are indented if the Fortran is in -free source form, whereas they are not indented if the Fortran is in fixed -source form because of the left margin requirements. Hence manual indent -corrections will be necessary for labeled statements and continuation lines -when fixed source form is being used. For further discussion of the method -used for the detection of source format see |ft-fortran-syntax|. +Block if, select case, select type, select rank, where, forall, type, +interface, associate, block, enum, critical, and change team constructs are +indented. The indenting of subroutines, functions, modules, and program blocks +is optional. Comments, labeled statements, and continuation lines are indented +if the Fortran is in free source form, whereas they are not indented if the +Fortran is in fixed source form because of the left margin requirements. Hence +manual indent corrections will be necessary for labeled statements and +continuation lines when fixed source form is being used. For further +discussion of the method used for the detection of source format see +|ft-fortran-syntax|. Do loops ~ All do loops are left unindented by default. Do loops can be unstructured in diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 546e2c15cf..40c102341b 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1633,21 +1633,22 @@ fortran_fold with a command such as > :let fortran_fold=1 to instruct the syntax script to define fold regions for program units, that is main programs starting with a program statement, subroutines, function -subprograms, block data subprograms, interface blocks, and modules. If you -also set the variable fortran_fold_conditionals with a command such as > +subprograms, modules, submodules, and block data units. Block, interface, +associate, critical, type definition, and change team constructs will also be +folded. If you also set the variable fortran_fold_conditionals with a command +such as > :let fortran_fold_conditionals=1 -then fold regions will also be defined for do loops, if blocks, and select -case constructs. If you also set the variable fortran_fold_multilinecomments -with a command such as > +then fold regions will also be defined for do loops, if blocks, select case, +select type, and select rank constructs. If you also set the variable +fortran_fold_multilinecomments with a command such as > :let fortran_fold_multilinecomments=1 then fold regions will also be defined for three or more consecutive comment lines. Note that defining fold regions can be slow for large files. If fortran_fold, and possibly fortran_fold_conditionals and/or -fortran_fold_multilinecomments, have been set, then vim will fold your file if -you set foldmethod=syntax. Comments or blank lines placed between two program -units are not folded because they are seen as not belonging to any program -unit. +fortran_fold_multilinecomments, have been set, then vim will fold your file. +Comments or blank lines placed between two program units are not folded +because they are seen as not belonging to any program unit. The syntax/fortran.vim script contains embedded comments that tell you how to comment and/or uncomment some lines to (a) activate recognition of some diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index b7fae54d99..99e11528de 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, and 77) -" Version: (v108) 2023 December 22 +" Version: (v109) 2023 December 29 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-syntax from Vim @@ -133,8 +133,8 @@ syn keyword fortranAttribute abstract external private public protected inten syn keyword fortranAttribute pointer target allocatable dimension codimension sequence parameter save syn keyword fortranUnitHeader result operator assignment -syn match fortranUnitHeader "\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\>" -syn match fortranBlock "\(end\s*\)\?\(block\|critical\|associate\)\>" +syn match fortranUnitHeader "\<\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\>" +syn match fortranBlock "\<\(end\s*\)\?\(block\|critical\|associate\)\>" syn match fortranCalled "\(call\s\+\)\@7<=\a\w*" syn match fortranRepeat "\" syn keyword fortranRepeat concurrent @@ -349,6 +349,9 @@ endif if exists("fortran_fold") + if has("folding") + setlocal foldmethod=syntax + endif if (b:fortran_fixed_source == 1) syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranModule syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule -- cgit From bf0be0f63e7142675f1376781c128116d12c520d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 17 Dec 2023 15:40:09 +0100 Subject: build: various improvements - Use `#pragma once` for `cmake.config/config.h.in` - Remove unused variable `CACHED_GENERATED_DIR` - Reorganize and sort variables - Introduce `STYLUA_DIRS` variable to ensure the `formatlua` and `lintlua-stylua` operates on the same files. - Adjust variable scope to avoid using hacky directory properties. - Add more necessary runtime files as test dependencies --- runtime/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'runtime') diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index aa987fca1e..a44713d4ce 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -1,9 +1,5 @@ set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/src/nvim/generators/gen_vimvim.lua) -set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime) -set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim) -set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags) set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt) -set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack) file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim) -- cgit From d51b6157473c4830313b566116aa3ad38dc97412 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 13 Dec 2023 14:04:24 +0100 Subject: refactor: fix luals warnings --- runtime/lua/vim/_editor.lua | 29 +++++++---- runtime/lua/vim/_init_packages.lua | 1 + runtime/lua/vim/_watch.lua | 1 + runtime/lua/vim/diagnostic.lua | 1 + runtime/lua/vim/health.lua | 102 ++++++++++++++++++++++++++----------- runtime/lua/vim/iter.lua | 9 +++- runtime/lua/vim/loader.lua | 2 +- runtime/lua/vim/lsp.lua | 4 +- runtime/lua/vim/lsp/buf.lua | 2 +- runtime/lua/vim/shared.lua | 5 -- runtime/lua/vim/ui.lua | 2 +- 11 files changed, 108 insertions(+), 50 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 0b338fa86f..cde61697b6 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -156,10 +156,10 @@ function vim._os_proc_info(pid) elseif r.code ~= 0 then error('command failed: ' .. vim.fn.string(cmd)) end - local ppid = assert(vim.system({ 'ps', '-p', pid, '-o', 'ppid=' }):wait().stdout) + local ppid_string = assert(vim.system({ 'ps', '-p', pid, '-o', 'ppid=' }):wait().stdout) -- Remove trailing whitespace. name = vim.trim(name):gsub('^.*/', '') - ppid = tonumber(ppid) or -1 + local ppid = tonumber(ppid_string) or -1 return { name = name, pid = pid, @@ -533,20 +533,21 @@ function vim.region(bufnr, pos1, pos2, regtype, inclusive) local region = {} for l = pos1[1], pos2[1] do - local c1, c2 + local c1 --- @type number + local c2 --- @type number if regtype:byte() == 22 then -- block selection: take width from regtype c1 = pos1[2] - c2 = c1 + regtype:sub(2) + c2 = c1 + tonumber(regtype:sub(2)) -- and adjust for non-ASCII characters local bufline = vim.api.nvim_buf_get_lines(bufnr, l, l + 1, true)[1] local utflen = vim.str_utfindex(bufline, #bufline) if c1 <= utflen then - c1 = vim.str_byteindex(bufline, c1) + c1 = assert(tonumber(vim.str_byteindex(bufline, c1))) else c1 = #bufline + 1 end if c2 <= utflen then - c2 = vim.str_byteindex(bufline, c2) + c2 = assert(tonumber(vim.str_byteindex(bufline, c2))) else c2 = #bufline + 1 end @@ -576,7 +577,7 @@ end ---@return table timer luv timer object function vim.defer_fn(fn, timeout) vim.validate({ fn = { fn, 'c', true } }) - local timer = vim.uv.new_timer() + local timer = assert(vim.uv.new_timer()) timer:start( timeout, 0, @@ -601,6 +602,7 @@ end ---@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. +---@diagnostic disable-next-line: unused-local function vim.notify(msg, level, opts) -- luacheck: no unused args if level == vim.log.levels.ERROR then vim.api.nvim_err_writeln(msg) @@ -700,6 +702,8 @@ end --- --- 1. Can we get it to just return things in the global namespace with that name prefix --- 2. Can we get it to return things from global namespace even with `print(` in front. +--- +--- @param pat string function vim._expand_pat(pat, env) env = env or _G @@ -801,11 +805,13 @@ function vim._expand_pat(pat, env) return keys, #prefix_match_pat end +--- @param lua_string string vim._expand_pat_get_parts = function(lua_string) local parts = {} local accumulator, search_index = '', 1 - local in_brackets, bracket_end = false, -1 + local in_brackets = false + local bracket_end = -1 --- @type integer? local string_char = nil for idx = 1, #lua_string do local s = lua_string:sub(idx, idx) @@ -938,9 +944,12 @@ function vim.keycode(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end +--- @param server_addr string +--- @param connect_error string function vim._cs_remote(rcid, server_addr, connect_error, args) + --- @return string local function connection_failure_errmsg(consequence) - local explanation + local explanation --- @type string if server_addr == '' then explanation = 'No server specified with --server' else @@ -983,7 +992,7 @@ function vim._cs_remote(rcid, server_addr, connect_error, args) local res = tostring(vim.rpcrequest(rcid, 'nvim_eval', args[2])) return { result = res, should_exit = true, tabbed = false } elseif subcmd ~= '' then - return { errmsg = 'Unknown option argument: ' .. args[1] } + return { errmsg = 'Unknown option argument: ' .. tostring(args[1]) } end if rcid == 0 then diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua index f8710f7fd7..97d483333e 100644 --- a/runtime/lua/vim/_init_packages.lua +++ b/runtime/lua/vim/_init_packages.lua @@ -12,6 +12,7 @@ for s in (package.cpath .. ';'):gmatch('[^;]*;') do end end +--- @param name string function vim._load_package(name) local basename = name:gsub('%.', '/') local paths = { 'lua/' .. basename .. '.lua', 'lua/' .. basename .. '/init.lua' } diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 43fce3bf7f..092781826f 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -51,6 +51,7 @@ function M.watch(path, opts, callback) local uvflags = opts and opts.uvflags or {} local handle, new_err = vim.uv.new_fs_event() assert(not new_err, new_err) + handle = assert(handle) local _, start_err = handle:start(path, uvflags, function(err, filename, events) assert(not err, err) local fullpath = path diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index a82a61eeb7..ad40723737 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -108,6 +108,7 @@ local function filter_by_severity(severity, diagnostics) severities[to_severity(s)] = true end + --- @param t table return vim.tbl_filter(function(t) return severities[t.severity] end, diagnostics) diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 23771d2807..55a451bf56 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -1,8 +1,8 @@ local M = {} -local s_output = {} +local s_output = {} ---@type string[] --- Returns the fold text of the current healthcheck section +--- Returns the fold text of the current healthcheck section function M.foldtext() local foldtext = vim.fn.foldtext() @@ -36,12 +36,13 @@ function M.foldtext() return vim.b.failedchecks[foldtext] and '+WE' .. foldtext:sub(4) or foldtext end --- From a path return a list [{name}, {func}, {type}] representing a healthcheck +--- @param path string path to search for the healthcheck +--- @return string[] { name, func, type } representing a healthcheck local function filepath_to_healthcheck(path) path = vim.fs.normalize(path) - local name - local func - local filetype + local name --- @type string + local func --- @type string + local filetype --- @type string if path:find('vim$') then name = vim.fs.basename(path):gsub('%.vim$', '') func = 'health#' .. name .. '#check' @@ -50,10 +51,10 @@ local function filepath_to_healthcheck(path) local subpath = path:gsub('.*lua/', '') if vim.fs.basename(subpath) == 'health.lua' then -- */health.lua - name = vim.fs.dirname(subpath) + name = assert(vim.fs.dirname(subpath)) else -- */health/init.lua - name = vim.fs.dirname(vim.fs.dirname(subpath)) + name = assert(vim.fs.dirname(assert(vim.fs.dirname(subpath)))) end name = name:gsub('/', '.') @@ -63,11 +64,12 @@ local function filepath_to_healthcheck(path) return { name, func, filetype } end --- Returns { {name, func, type}, ... } representing healthchecks +--- @param plugin_names string +--- @return table { {name, func, type}, ... } representing healthchecks local function get_healthcheck_list(plugin_names) - local healthchecks = {} - plugin_names = vim.split(plugin_names, ' ') - for _, p in pairs(plugin_names) do + local healthchecks = {} --- @type table + local plugin_names_list = vim.split(plugin_names, ' ') + for _, p in pairs(plugin_names_list) do -- support vim/lsp/health{/init/}.lua as :checkhealth vim.lsp p = p:gsub('%.', '/') @@ -83,7 +85,7 @@ local function get_healthcheck_list(plugin_names) if vim.tbl_count(paths) == 0 then healthchecks[#healthchecks + 1] = { p, '', '' } -- healthcheck not found else - local unique_paths = {} + local unique_paths = {} --- @type table for _, v in pairs(paths) do unique_paths[v] = true end @@ -100,10 +102,11 @@ local function get_healthcheck_list(plugin_names) return healthchecks end --- Returns {name: [func, type], ..} representing healthchecks +--- @param plugin_names string +--- @return table {name: [func, type], ..} representing healthchecks local function get_healthcheck(plugin_names) local health_list = get_healthcheck_list(plugin_names) - local healthchecks = {} + local healthchecks = {} --- @type table for _, c in pairs(health_list) do if c[1] ~= 'vim' then healthchecks[c[1]] = { c[2], c[3] } @@ -113,7 +116,11 @@ local function get_healthcheck(plugin_names) return healthchecks end --- Indents lines *except* line 1 of a string if it contains newlines. +--- Indents lines *except* line 1 of a string if it contains newlines. +--- +--- @param s string +--- @param columns integer +--- @return string local function indent_after_line1(s, columns) local lines = vim.split(s, '\n') local indent = string.rep(' ', columns) @@ -123,13 +130,20 @@ local function indent_after_line1(s, columns) return table.concat(lines, '\n') end --- Changes ':h clipboard' to ':help |clipboard|'. +--- Changes ':h clipboard' to ':help |clipboard|'. +--- +--- @param s string +--- @return string local function help_to_link(s) return vim.fn.substitute(s, [[\v:h%[elp] ([^|][^"\r\n ]+)]], [[:help |\1|]], [[g]]) end --- Format a message for a specific report item. --- Variable args: Optional advice (string or list) +--- Format a message for a specific report item. +--- +--- @param status string +--- @param msg string +--- @param ... string|string[] Optional advice +--- @return string local function format_report_message(status, msg, ...) local output = '- ' .. status if status ~= '' then @@ -159,42 +173,54 @@ local function format_report_message(status, msg, ...) return help_to_link(output) end +--- @param output string local function collect_output(output) vim.list_extend(s_output, vim.split(output, '\n')) end --- Starts a new report. +--- Starts a new report. +--- +--- @param name string function M.start(name) local input = string.format('\n%s ~', name) collect_output(input) end --- Reports a message in the current section. +--- Reports a message in the current section. +--- +--- @param msg string function M.info(msg) local input = format_report_message('', msg) collect_output(input) end --- Reports a successful healthcheck. +--- Reports a successful healthcheck. +--- +--- @param msg string function M.ok(msg) local input = format_report_message('OK', msg) collect_output(input) end --- Reports a health warning. --- ...: Optional advice (string or table) +--- Reports a health warning. +--- +--- @param msg string +--- @param ... string|string[] Optional advice function M.warn(msg, ...) local input = format_report_message('WARNING', msg, ...) collect_output(input) end --- Reports a failed healthcheck. --- ...: Optional advice (string or table) +--- Reports a failed healthcheck. +--- +--- @param msg string +--- @param ... string|string[] Optional advice function M.error(msg, ...) local input = format_report_message('ERROR', msg, ...) collect_output(input) end +--- @param type string local function deprecate(type) local before = string.format('vim.health.report_%s()', type) local after = string.format('vim.health.%s()', type) @@ -206,22 +232,36 @@ local function deprecate(type) vim.print('Running healthchecks...') end +--- @deprecated +--- @param name string function M.report_start(name) deprecate('start') M.start(name) end + +--- @deprecated +--- @param msg string function M.report_info(msg) deprecate('info') M.info(msg) end + +--- @deprecated +--- @param msg string function M.report_ok(msg) deprecate('ok') M.ok(msg) end + +--- @deprecated +--- @param msg string function M.report_warn(msg, ...) deprecate('warn') M.warn(msg, ...) end + +--- @deprecated +--- @param msg string function M.report_error(msg, ...) deprecate('error') M.error(msg, ...) @@ -251,7 +291,7 @@ local path2name = function(path) end local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' } --- :checkhealth completion function used by cmdexpand.c get_healthcheck_names() +--- :checkhealth completion function used by cmdexpand.c get_healthcheck_names() M._complete = function() local names = vim.tbl_flatten(vim.tbl_map(function(pattern) return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true)) @@ -270,6 +310,9 @@ end --- Runs all discovered healthchecks if plugin_names is empty. --- --- @param mods string command modifiers that affect splitting a window. +--- @param plugin_names string glob of plugin names, split on whitespace. For example, using +--- `:checkhealth vim.* nvim` will healthcheck `vim.lsp`, `vim.treesitter` +--- and `nvim` modules. function M._check(mods, plugin_names) local healthchecks = plugin_names == '' and get_healthcheck('*') or get_healthcheck(plugin_names) @@ -289,7 +332,8 @@ function M._check(mods, plugin_names) vim.cmd.file('health://') vim.cmd.setfiletype('checkhealth') - if healthchecks == nil or next(healthchecks) == nil then + -- This should only happen when doing `:checkhealth vim` + if next(healthchecks) == nil then vim.fn.setline(1, 'ERROR: No healthchecks found.') return end @@ -325,7 +369,7 @@ function M._check(mods, plugin_names) local header = { string.rep('=', 78), name .. ': ' .. func, '' } -- remove empty line after header from report_start if s_output[1] == '' then - local tmp = {} + local tmp = {} ---@type string[] for i = 2, #s_output do tmp[#tmp + 1] = s_output[i] end diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index 8e602c406a..b658dde099 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -432,6 +432,7 @@ end --- ``` --- ---@return any +---@diagnostic disable-next-line: unused-local function Iter.next(self) -- luacheck: no unused args -- This function is provided by the source iterator in Iter.new. This definition exists only for -- the docstring @@ -489,6 +490,7 @@ end --- ``` --- ---@return any +---@diagnostic disable-next-line: unused-local function Iter.peek(self) -- luacheck: no unused args error('peek() requires a list-like table') end @@ -568,12 +570,13 @@ end ---@see Iter.find --- ---@return any +---@diagnostic disable-next-line: unused-local function Iter.rfind(self, f) -- luacheck: no unused args error('rfind() requires a list-like table') end ---@private -function ListIter.rfind(self, f) -- luacheck: no unused args +function ListIter.rfind(self, f) if type(f) ~= 'function' then local val = f f = function(v) @@ -640,6 +643,7 @@ end --- ``` --- ---@return any +---@diagnostic disable-next-line: unused-local function Iter.nextback(self) -- luacheck: no unused args error('nextback() requires a list-like table') end @@ -669,6 +673,7 @@ end --- ``` --- ---@return any +---@diagnostic disable-next-line: unused-local function Iter.peekback(self) -- luacheck: no unused args error('peekback() requires a list-like table') end @@ -725,6 +730,7 @@ end --- ---@param n number Number of values to skip. ---@return Iter +---@diagnostic disable-next-line: unused-local function Iter.skipback(self, n) -- luacheck: no unused args error('skipback() requires a list-like table') return self @@ -791,6 +797,7 @@ end ---@param first number ---@param last number ---@return Iter +---@diagnostic disable-next-line: unused-local function Iter.slice(self, first, last) -- luacheck: no unused args error('slice() requires a list-like table') return self diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index ee01111337..b77251cf7e 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -1,5 +1,5 @@ local uv = vim.uv -local uri_encode = vim.uri_encode +local uri_encode = vim.uri_encode --- @type function --- @type (fun(modename: string): fun()|string)[] local loaders = package.loaders diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 1310239a5b..3105413b53 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -329,11 +329,11 @@ end ---@param fn (T) Function to run ---@return T local function once(fn) - local value --- @type any + local value --- @type function local ran = false return function(...) if not ran then - value = fn(...) + value = fn(...) --- @type function ran = true end return value diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 051b9d4550..d67b2ac8ea 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -46,7 +46,7 @@ function M.hover() end local function request_with_options(name, params, options) - local req_handler + local req_handler --- @type function? if options then req_handler = function(err, result, ctx, config) local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 9542d93789..bbbc888727 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -617,11 +617,6 @@ function vim.tbl_islist(t) local num_elem = vim.tbl_count(t) if num_elem == 0 then - -- TODO(bfredl): in the future, we will always be inside nvim - -- then this check can be deleted. - if vim._empty_dict_mt == nil then - return nil - end return getmetatable(t) ~= vim._empty_dict_mt else for i = 1, num_elem do diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua index b6ddf337ce..25ced18daf 100644 --- a/runtime/lua/vim/ui.lua +++ b/runtime/lua/vim/ui.lua @@ -133,7 +133,7 @@ function M.open(path) path = vim.fn.expand(path) end - local cmd + local cmd --- @type string[] if vim.fn.has('mac') == 1 then cmd = { 'open', path } -- cgit From 6fa0f303d7f0823bfc5ba6cc7b4e7a7cd76143ac Mon Sep 17 00:00:00 2001 From: altermo Date: Sun, 31 Dec 2023 14:08:16 +0100 Subject: fix(builtin): parameter mismatch between winsaveview and winrestview --- runtime/lua/vim/_meta/builtin_types.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/builtin_types.lua b/runtime/lua/vim/_meta/builtin_types.lua index ef0452c649..e74cf86173 100644 --- a/runtime/lua/vim/_meta/builtin_types.lua +++ b/runtime/lua/vim/_meta/builtin_types.lua @@ -118,7 +118,7 @@ --- @field topfill? integer --- @field topline? integer ---- @class vim.fn.winsaveview.ret +--- @class vim.fn.winsaveview.ret: vim.fn.winrestview.dict --- @field col integer --- @field coladd integer --- @field curswant integer -- cgit From 3faace199583f3a36470b717ce3e386e476f3a30 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Thu, 7 Dec 2023 21:01:50 +0900 Subject: docs: clarify on_bytes arguments based on extmark_splice doc --- runtime/doc/api.txt | 12 ++++++++---- runtime/lua/vim/_meta/api.lua | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index b2581c8752..e3063b0591 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2116,11 +2116,15 @@ nvim_buf_attach({buffer}, {send_buffer}, {*opts}) *nvim_buf_attach()* • start column of the changed text • byte offset of the changed text (from the start of the buffer) - • old end row of the changed text - • old end column of the changed text + • old end row of the changed text (offset from start + row) + • old end column of the changed text (if old end row + = 0, offset from start column) • old end byte length of the changed text - • new end row of the changed text - • new end column of the changed text + • new end row of the changed text (offset from start + row) + • new end column of the changed text (if new end row + = 0, offset from start column) • new end byte length of the changed text • on_changedtick: Lua callback invoked on changedtick diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index d94cef481e..c0dfa7635b 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -173,11 +173,15 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start --- • start column of the changed text --- • byte offset of the changed text (from the start of --- the buffer) ---- • old end row of the changed text ---- • old end column of the changed text +--- • old end row of the changed text (offset from start +--- row) +--- • old end column of the changed text (if old end row +--- = 0, offset from start column) --- • old end byte length of the changed text ---- • new end row of the changed text ---- • new end column of the changed text +--- • new end row of the changed text (offset from start +--- row) +--- • new end column of the changed text (if new end row +--- = 0, offset from start column) --- • new end byte length of the changed text --- --- • on_changedtick: Lua callback invoked on changedtick -- cgit From f69658bc355e130fc2845a8e0edc8baa4f256329 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 Jan 2024 15:37:07 +0100 Subject: feat(treesitter): highlight Lua files by default (#26824) --- runtime/doc/news.txt | 1 + runtime/ftplugin/lua.lua | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 runtime/ftplugin/lua.lua (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index abba8fbd75..112a76c013 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -300,6 +300,7 @@ The following changes to existing APIs or features add new behavior. < • Enabled treesitter highlighting for treesitter query files. • Enabled treesitter highlighting for help files. + • Enabled treesitter highlighting for Lua files. • The `workspace/didChangeWatchedFiles` LSP client capability is now enabled by default. diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua new file mode 100644 index 0000000000..98f218e36e --- /dev/null +++ b/runtime/ftplugin/lua.lua @@ -0,0 +1,2 @@ +-- use treesitter over syntax +vim.treesitter.start() -- cgit From 164f1ea06d17e935f41e178e46bb05bbb676af20 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Mon, 10 Apr 2023 16:48:58 -0600 Subject: refactor(health): refactor provider healthchecks * Prefer pure Lua functions over vim.fn * Split up provider healthchecks into separate modules to help manage complexity --- runtime/lua/provider/clipboard/health.lua | 40 ++ runtime/lua/provider/health.lua | 916 ------------------------------ runtime/lua/provider/node/health.lua | 105 ++++ runtime/lua/provider/perl/health.lua | 95 ++++ runtime/lua/provider/python/health.lua | 503 ++++++++++++++++ runtime/lua/provider/ruby/health.lua | 71 +++ runtime/lua/vim/health.lua | 115 ++++ 7 files changed, 929 insertions(+), 916 deletions(-) create mode 100644 runtime/lua/provider/clipboard/health.lua delete mode 100644 runtime/lua/provider/health.lua create mode 100644 runtime/lua/provider/node/health.lua create mode 100644 runtime/lua/provider/perl/health.lua create mode 100644 runtime/lua/provider/python/health.lua create mode 100644 runtime/lua/provider/ruby/health.lua (limited to 'runtime') diff --git a/runtime/lua/provider/clipboard/health.lua b/runtime/lua/provider/clipboard/health.lua new file mode 100644 index 0000000000..dc33cb0ab0 --- /dev/null +++ b/runtime/lua/provider/clipboard/health.lua @@ -0,0 +1,40 @@ +local health = vim.health +local executable = health.executable + +local M = {} + +function M.check() + health.start('Clipboard (optional)') + + if + os.getenv('TMUX') + and executable('tmux') + and executable('pbpaste') + and not health.cmd_ok('pbpaste') + then + local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+') + local advice = { + 'Install tmux 2.6+. https://superuser.com/q/231130', + 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233', + } + health.error('pbcopy does not work with tmux version: ' .. tmux_version, advice) + end + + local clipboard_tool = vim.fn['provider#clipboard#Executable']() + if vim.g.clipboard ~= nil and clipboard_tool == '' then + local error_message = vim.fn['provider#clipboard#Error']() + health.error( + error_message, + "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all." + ) + elseif clipboard_tool:find('^%s*$') then + health.warn( + 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.', + ':help clipboard' + ) + else + health.ok('Clipboard tool found: ' .. clipboard_tool) + end +end + +return M diff --git a/runtime/lua/provider/health.lua b/runtime/lua/provider/health.lua deleted file mode 100644 index d33f74f6e9..0000000000 --- a/runtime/lua/provider/health.lua +++ /dev/null @@ -1,916 +0,0 @@ -local M = {} - -local start = vim.health.start -local ok = vim.health.ok -local info = vim.health.info -local warn = vim.health.warn -local error = vim.health.error -local iswin = vim.uv.os_uname().sysname == 'Windows_NT' - -local shell_error_code = 0 -local function shell_error() - return shell_error_code ~= 0 -end - --- Returns true if `cmd` exits with success, else false. -local function cmd_ok(cmd) - vim.fn.system(cmd) - return vim.v.shell_error == 0 -end - -local function executable(exe) - return vim.fn.executable(exe) == 1 -end - -local function is_blank(s) - return s:find('^%s*$') ~= nil -end - -local function isdir(path) - if not path then - return false - end - local stat = vim.uv.fs_stat(path) - if not stat then - return false - end - return stat.type == 'directory' -end - -local function isfile(path) - if not path then - return false - end - local stat = vim.uv.fs_stat(path) - if not stat then - return false - end - return stat.type == 'file' -end - --- Handler for s:system() function. -local function system_handler(self, _, data, event) - if event == 'stderr' then - if self.add_stderr_to_output then - self.output = self.output .. vim.fn.join(data, '') - else - self.stderr = self.stderr .. vim.fn.join(data, '') - end - elseif event == 'stdout' then - self.output = self.output .. vim.fn.join(data, '') - elseif event == 'exit' then - shell_error_code = data - end -end - --- Attempts to construct a shell command from an args list. --- Only for display, to help users debug a failed command. -local function shellify(cmd) - if type(cmd) ~= 'table' then - return cmd - end - return vim.fn.join( - vim.fn.map(vim.fn.copy(cmd), [[v:val =~# ''\m[^\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val]]), - ' ' - ) -end - --- Run a system command and timeout after 30 seconds. -local function system(cmd, ...) - local args = { ... } - local args_count = vim.tbl_count(args) - - local stdin = (args_count > 0 and args[1] or '') - local stderr = (args_count > 1 and args[2] or false) - local ignore_error = (args_count > 2 and args[3] or false) - - local opts = { - add_stderr_to_output = stderr, - output = '', - stderr = '', - on_stdout = system_handler, - on_stderr = system_handler, - on_exit = system_handler, - } - local jobid = vim.fn.jobstart(cmd, opts) - - if jobid < 1 then - local message = 'Command error (job=' - .. jobid - .. '): `' - .. shellify(cmd) - .. '` (in ' - .. vim.fn.string(vim.fn.getcwd()) - .. ')' - - error(message) - shell_error_code = 1 - return opts.output - end - - if not is_blank(stdin) then - vim.api.nvim_chan_send(jobid, stdin) - end - - local res = vim.fn.jobwait({ jobid }, 30000) - if res[1] == -1 then - error('Command timed out: ' .. shellify(cmd)) - vim.fn.jobstop(jobid) - elseif shell_error() and not ignore_error then - local emsg = 'Command error (job=' - .. jobid - .. ', exit code ' - .. shell_error_code - .. '): `' - .. shellify(cmd) - .. '` (in ' - .. vim.fn.string(vim.fn.getcwd()) - .. ')' - if not is_blank(opts.output) then - emsg = emsg .. '\noutput: ' .. opts.output - end - if not is_blank(opts.stderr) then - emsg = emsg .. '\nstderr: ' .. opts.stderr - end - error(emsg) - end - - -- return opts.output - local _ = ... - return vim.trim(vim.fn.system(cmd)) -end - -local function clipboard() - start('Clipboard (optional)') - - if - os.getenv('TMUX') - and executable('tmux') - and executable('pbpaste') - and not cmd_ok('pbpaste') - then - local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+') - local advice = { - 'Install tmux 2.6+. https://superuser.com/q/231130', - 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233', - } - error('pbcopy does not work with tmux version: ' .. tmux_version, advice) - end - - local clipboard_tool = vim.fn['provider#clipboard#Executable']() - if vim.g.clipboard and is_blank(clipboard_tool) then - local error_message = vim.fn['provider#clipboard#Error']() - error( - error_message, - "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all." - ) - elseif is_blank(clipboard_tool) then - warn( - 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.', - ':help clipboard' - ) - else - ok('Clipboard tool found: ' .. clipboard_tool) - end -end - -local function disabled_via_loaded_var(provider) - local loaded_var = 'loaded_' .. provider .. '_provider' - local v = vim.g[loaded_var] - if v == 0 then - info('Disabled (' .. loaded_var .. '=' .. v .. ').') - return true - end - return false -end - --- Check if pyenv is available and a valid pyenv root can be found, then return --- their respective paths. If either of those is invalid, return two empty --- strings, effectively ignoring pyenv. -local function check_for_pyenv() - local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv')) - - if is_blank(pyenv_path) then - return { '', '' } - end - - info('pyenv: Path: ' .. pyenv_path) - - local pyenv_root = os.getenv('PYENV_ROOT') and vim.fn.resolve(os.getenv('PYENV_ROOT')) or '' - - if is_blank(pyenv_root) then - pyenv_root = vim.trim(system({ pyenv_path, 'root' })) - info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.') - end - - if not isdir(pyenv_root) then - local message = 'pyenv: Root does not exist: ' - .. pyenv_root - .. '. Ignoring pyenv for all following checks.' - warn(message) - return { '', '' } - end - - info('pyenv: Root: ' .. pyenv_root) - - return { pyenv_path, pyenv_root } -end - --- Check the Python interpreter's usability. -local function check_bin(bin) - if not isfile(bin) and (not iswin or not isfile(bin .. '.exe')) then - error('"' .. bin .. '" was not found.') - return false - elseif not executable(bin) then - error('"' .. bin .. '" is not executable.') - return false - end - return true -end - --- Fetch the contents of a URL. -local function download(url) - local has_curl = executable('curl') - if has_curl and vim.fn.system({ 'curl', '-V' }):find('Protocols:.*https') then - local rv = system({ 'curl', '-sL', url }, '', 1, 1) - if shell_error() then - return 'curl error with ' .. url .. ': ' .. shell_error_code - else - return rv - end - elseif executable('python') then - local script = "try:\n\ - from urllib.request import urlopen\n\ - except ImportError:\n\ - from urllib2 import urlopen\n\ - response = urlopen('" .. url .. "')\n\ - print(response.read().decode('utf8'))\n" - local rv = system({ 'python', '-c', script }) - if is_blank(rv) and shell_error() then - return 'python urllib.request error: ' .. shell_error_code - else - return rv - end - end - - local message = 'missing `curl` ' - - if has_curl then - message = message .. '(with HTTPS support) ' - end - message = message .. 'and `python`, cannot make web request' - - return message -end - --- Get the latest Nvim Python client (pynvim) version from PyPI. -local function latest_pypi_version() - local pypi_version = 'unable to get pypi response' - local pypi_response = download('https://pypi.python.org/pypi/pynvim/json') - if not is_blank(pypi_response) then - local pcall_ok, output = pcall(vim.fn.json_decode, pypi_response) - local pypi_data - if pcall_ok then - pypi_data = output - else - return 'error: ' .. pypi_response - end - - local pypi_element = pypi_data['info'] or {} - pypi_version = pypi_element['version'] or 'unable to parse' - end - return pypi_version -end - -local function is_bad_response(s) - local lower = s:lower() - return vim.startswith(lower, 'unable') - or vim.startswith(lower, 'error') - or vim.startswith(lower, 'outdated') -end - --- Get version information using the specified interpreter. The interpreter is --- used directly in case breaking changes were introduced since the last time --- Nvim's Python client was updated. --- --- Returns: { --- {python executable version}, --- {current nvim version}, --- {current pypi nvim status}, --- {installed version status} --- } -local function version_info(python) - local pypi_version = latest_pypi_version() - - local python_version = vim.trim(system({ - python, - '-c', - 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))', - })) - - if is_blank(python_version) then - python_version = 'unable to parse ' .. python .. ' response' - end - - local nvim_path = vim.trim(system({ - python, - '-c', - 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)', - })) - if shell_error() or is_blank(nvim_path) then - return { python_version, 'unable to load neovim Python module', pypi_version, nvim_path } - end - - -- Assuming that multiple versions of a package are installed, sort them - -- numerically in descending order. - local function compare(metapath1, metapath2) - local a = vim.fn.matchstr(vim.fn.fnamemodify(metapath1, ':p:h:t'), [[[0-9.]\+]]) - local b = vim.fn.matchstr(vim.fn.fnamemodify(metapath2, ':p:h:t'), [[[0-9.]\+]]) - if a == b then - return 0 - elseif a > b then - return 1 - else - return -1 - end - end - - -- Try to get neovim.VERSION (added in 0.1.11dev). - local nvim_version = system({ - python, - '-c', - 'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))', - }, '', 1, 1) - if is_blank(nvim_version) then - nvim_version = 'unable to find pynvim module version' - local base = vim.fs.basename(nvim_path, ':h') - local metas = vim.fn.glob(base .. '-*/METADATA', 1, 1) - vim.list_extend(metas, vim.fn.glob(base .. '-*/PKG-INFO', 1, 1)) - vim.list_extend(metas, vim.fn.glob(base .. '.egg-info/PKG-INFO', 1, 1)) - metas = table.sort(metas, compare) - - if metas and next(metas) ~= nil then - for _, meta_line in ipairs(vim.fn.readfile(metas[1])) do - if vim.startswith(meta_line, 'Version:') then - nvim_version = vim.fn.matchstr(meta_line, [[^Version: \zs\S\+]]) - break - end - end - end - end - - local nvim_path_base = vim.fn.fnamemodify(nvim_path, [[:~:h]]) - local version_status = 'unknown; ' .. nvim_path_base - if is_bad_response(nvim_version) and is_bad_response(pypi_version) then - if vim.version.lt(nvim_version, pypi_version) then - version_status = 'outdated; from ' .. nvim_path_base - else - version_status = 'up to date' - end - end - - return { python_version, nvim_version, pypi_version, version_status } -end - --- Resolves Python executable path by invoking and checking `sys.executable`. -local function python_exepath(invocation) - return vim.fs.normalize( - system(vim.fn.fnameescape(invocation) .. ' -c "import sys; sys.stdout.write(sys.executable)"') - ) -end - -local function python() - start('Python 3 provider (optional)') - - local pyname = 'python3' - local python_exe = '' - local virtual_env = os.getenv('VIRTUAL_ENV') - local venv = virtual_env and vim.fn.resolve(virtual_env) or '' - local host_prog_var = pyname .. '_host_prog' - local python_multiple = {} - - if disabled_via_loaded_var(pyname) then - return - end - - local pyenv_table = check_for_pyenv() - local pyenv = pyenv_table[1] - local pyenv_root = pyenv_table[2] - - if vim.g[host_prog_var] then - local message = 'Using: g:' .. host_prog_var .. ' = "' .. vim.g[host_prog_var] .. '"' - info(message) - end - - local python_table = vim.fn['provider#pythonx#Detect'](3) - pyname = python_table[1] - local pythonx_warnings = python_table[2] - - if is_blank(pyname) then - warn( - 'No Python executable found that can `import neovim`. ' - .. 'Using the first available executable for diagnostics.' - ) - elseif vim.g[host_prog_var] then - python_exe = pyname - end - - -- No Python executable could `import neovim`, or host_prog_var was used. - if not is_blank(pythonx_warnings) then - warn(pythonx_warnings, { - 'See :help provider-python for more information.', - 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim', - }) - elseif not is_blank(pyname) and is_blank(python_exe) then - if not vim.g[host_prog_var] then - local message = '`g:' - .. host_prog_var - .. '` is not set. Searching for ' - .. pyname - .. ' in the environment.' - info(message) - end - - if not is_blank(pyenv) then - python_exe = vim.trim(system({ pyenv, 'which', pyname }, '', 1)) - if is_blank(python_exe) then - warn('pyenv could not find ' .. pyname .. '.') - end - end - - if is_blank(python_exe) then - python_exe = vim.fn.exepath(pyname) - - if os.getenv('PATH') then - local path_sep = iswin and ';' or ':' - local paths = vim.split(os.getenv('PATH') or '', path_sep) - - for _, path in ipairs(paths) do - local path_bin = vim.fs.normalize(path .. '/' .. pyname) - if - path_bin ~= vim.fs.normalize(python_exe) - and vim.list_contains(python_multiple, path_bin) - and executable(path_bin) - then - python_multiple[#python_multiple + 1] = path_bin - end - end - - if vim.tbl_count(python_multiple) > 0 then - -- This is worth noting since the user may install something - -- that changes $PATH, like homebrew. - local message = 'Multiple ' - .. pyname - .. ' executables found. ' - .. 'Set `g:' - .. host_prog_var - .. '` to avoid surprises.' - info(message) - end - - if python_exe:find('shims') then - local message = '`' .. python_exe .. '` appears to be a pyenv shim.' - local advice = '`pyenv` is not in $PATH, your pyenv installation is broken. Set `g:' - .. host_prog_var - .. '` to avoid surprises.' - - warn(message, advice) - end - end - end - end - - if not is_blank(python_exe) and not vim.g[host_prog_var] then - if - is_blank(venv) - and not is_blank(pyenv) - and not is_blank(pyenv_root) - and vim.startswith(vim.fn.resolve(python_exe), pyenv_root .. '/') - then - local advice = 'Create a virtualenv specifically for Nvim using pyenv, and set `g:' - .. host_prog_var - .. '`. This will avoid the need to install the pynvim module in each version/virtualenv.' - warn('pyenv is not set up optimally.', advice) - elseif not is_blank(venv) then - local venv_root - if not is_blank(pyenv_root) then - venv_root = pyenv_root - else - venv_root = vim.fs.dirname(venv) - end - - if vim.startswith(vim.fn.resolve(python_exe), venv_root .. '/') then - local advice = 'Create a virtualenv specifically for Nvim and use `g:' - .. host_prog_var - .. '`. This will avoid the need to install the pynvim module in each virtualenv.' - warn('Your virtualenv is not set up optimally.', advice) - end - end - end - - if is_blank(python_exe) and not is_blank(pyname) then - -- An error message should have already printed. - error('`' .. pyname .. '` was not found.') - elseif not is_blank(python_exe) and not check_bin(python_exe) then - python_exe = '' - end - - -- Diagnostic output - info('Executable: ' .. (is_blank(python_exe) and 'Not found' or python_exe)) - if vim.tbl_count(python_multiple) > 0 then - for _, path_bin in ipairs(python_multiple) do - info('Other python executable: ' .. path_bin) - end - end - - if is_blank(python_exe) then - -- No Python executable can import 'neovim'. Check if any Python executable - -- can import 'pynvim'. If so, that Python failed to import 'neovim' as - -- well, which is most probably due to a failed pip upgrade: - -- https://github.com/neovim/neovim/wiki/Following-HEAD#20181118 - local pynvim_table = vim.fn['provider#pythonx#DetectByModule']('pynvim', 3) - local pynvim_exe = pynvim_table[1] - if not is_blank(pynvim_exe) then - local message = 'Detected pip upgrade failure: Python executable can import "pynvim" but not "neovim": ' - .. pynvim_exe - local advice = { - 'Use that Python version to reinstall "pynvim" and optionally "neovim".', - pynvim_exe .. ' -m pip uninstall pynvim neovim', - pynvim_exe .. ' -m pip install pynvim', - pynvim_exe .. ' -m pip install neovim # only if needed by third-party software', - } - error(message, advice) - end - else - local version_info_table = version_info(python_exe) - local majorpyversion = version_info_table[1] - local current = version_info_table[2] - local latest = version_info_table[3] - local status = version_info_table[4] - - if vim.fn.str2nr(majorpyversion) ~= 3 then - warn('Unexpected Python version. This could lead to confusing error messages.') - end - - info('Python version: ' .. majorpyversion) - - if is_bad_response(status) then - info('pynvim version: ' .. current .. ' (' .. status .. ')') - else - info('pynvim version: ' .. current) - end - - if is_bad_response(current) then - error( - 'pynvim is not installed.\nError: ' .. current, - 'Run in shell: ' .. python_exe .. ' -m pip install pynvim' - ) - end - - if is_bad_response(latest) then - warn('Could not contact PyPI to get latest version.') - error('HTTP request failed: ' .. latest) - elseif is_bad_response(status) then - warn('Latest pynvim is NOT installed: ' .. latest) - elseif not is_bad_response(current) then - ok('Latest pynvim is installed.') - end - end - - start('Python virtualenv') - if not virtual_env then - ok('no $VIRTUAL_ENV') - return - end - local errors = {} - -- Keep hints as dict keys in order to discard duplicates. - local hints = {} - -- The virtualenv should contain some Python executables, and those - -- executables should be first both on Nvim's $PATH and the $PATH of - -- subshells launched from Nvim. - local bin_dir = iswin and 'Scripts' or 'bin' - local venv_bins = vim.tbl_filter(function(v) - -- XXX: Remove irrelevant executables found in bin/. - return not v:match('python%-config') - end, vim.fn.glob(string.format('%s/%s/python*', virtual_env, bin_dir), true, true)) - if vim.tbl_count(venv_bins) > 0 then - for _, venv_bin in pairs(venv_bins) do - venv_bin = vim.fs.normalize(venv_bin) - local py_bin_basename = vim.fs.basename(venv_bin) - local nvim_py_bin = python_exepath(vim.fn.exepath(py_bin_basename)) - local subshell_py_bin = python_exepath(py_bin_basename) - if venv_bin ~= nvim_py_bin then - errors[#errors + 1] = '$PATH yields this ' - .. py_bin_basename - .. ' executable: ' - .. nvim_py_bin - local hint = '$PATH ambiguities arise if the virtualenv is not ' - .. 'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, ' - .. 'check that invoking Python from the command line launches the correct one, ' - .. 'then relaunch Nvim.' - hints[hint] = true - end - if venv_bin ~= subshell_py_bin then - errors[#errors + 1] = '$PATH in subshells yields this ' - .. py_bin_basename - .. ' executable: ' - .. subshell_py_bin - local hint = '$PATH ambiguities in subshells typically are ' - .. 'caused by your shell config overriding the $PATH previously set by the ' - .. 'virtualenv. Either prevent them from doing so, or use this workaround: ' - .. 'https://vi.stackexchange.com/a/34996' - hints[hint] = true - end - end - else - errors[#errors + 1] = 'no Python executables found in the virtualenv ' - .. bin_dir - .. ' directory.' - end - - local msg = '$VIRTUAL_ENV is set to: ' .. virtual_env - if vim.tbl_count(errors) > 0 then - if vim.tbl_count(venv_bins) > 0 then - msg = msg - .. '\nAnd its ' - .. bin_dir - .. ' directory contains: ' - .. vim.fn.join(vim.fn.map(venv_bins, [[fnamemodify(v:val, ':t')]]), ', ') - end - local conj = '\nBut ' - for _, err in ipairs(errors) do - msg = msg .. conj .. err - conj = '\nAnd ' - end - msg = msg .. '\nSo invoking Python may lead to unexpected results.' - warn(msg, vim.fn.keys(hints)) - else - info(msg) - info( - 'Python version: ' - .. system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"') - ) - ok('$VIRTUAL_ENV provides :!python.') - end -end - -local function ruby() - start('Ruby provider (optional)') - - if disabled_via_loaded_var('ruby') then - return - end - - if not executable('ruby') or not executable('gem') then - warn( - '`ruby` and `gem` must be in $PATH.', - 'Install Ruby and verify that `ruby` and `gem` commands work.' - ) - return - end - info('Ruby: ' .. system({ 'ruby', '-v' })) - - local ruby_detect_table = vim.fn['provider#ruby#Detect']() - local host = ruby_detect_table[1] - if is_blank(host) then - warn('`neovim-ruby-host` not found.', { - 'Run `gem install neovim` to ensure the neovim RubyGem is installed.', - 'Run `gem environment` to ensure the gem bin directory is in $PATH.', - 'If you are using rvm/rbenv/chruby, try "rehashing".', - 'See :help g:ruby_host_prog for non-standard gem installations.', - 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim', - }) - return - end - info('Host: ' .. host) - - local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$') - local latest_gem = system(vim.fn.split(latest_gem_cmd)) - if shell_error() or is_blank(latest_gem) then - error( - 'Failed to run: ' .. latest_gem_cmd, - { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } - ) - return - end - local gem_split = vim.split(latest_gem, [[neovim (\|, \|)$]]) - latest_gem = gem_split[1] or 'not found' - - local current_gem_cmd = { host, '--version' } - local current_gem = system(current_gem_cmd) - if shell_error() then - error( - 'Failed to run: ' .. table.concat(current_gem_cmd, ' '), - { 'Report this issue with the output of: ', table.concat(current_gem_cmd, ' ') } - ) - return - end - - if vim.version.lt(current_gem, latest_gem) then - local message = 'Gem "neovim" is out-of-date. Installed: ' - .. current_gem - .. ', latest: ' - .. latest_gem - warn(message, 'Run in shell: gem update neovim') - else - ok('Latest "neovim" gem is installed: ' .. current_gem) - end -end - -local function node() - start('Node.js provider (optional)') - - if disabled_via_loaded_var('node') then - return - end - - if - not executable('node') - or (not executable('npm') and not executable('yarn') and not executable('pnpm')) - then - warn( - '`node` and `npm` (or `yarn`, `pnpm`) must be in $PATH.', - 'Install Node.js and verify that `node` and `npm` (or `yarn`, `pnpm`) commands work.' - ) - return - end - - -- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or '' - local node_v = system({ 'node', '-v' }) - info('Node.js: ' .. node_v) - if shell_error() or vim.version.lt(node_v, '6.0.0') then - warn('Nvim node.js host does not support Node ' .. node_v) - -- Skip further checks, they are nonsense if nodejs is too old. - return - end - if vim.fn['provider#node#can_inspect']() == 0 then - warn( - 'node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.' - ) - end - - local node_detect_table = vim.fn['provider#node#Detect']() - local host = node_detect_table[1] - if is_blank(host) then - warn('Missing "neovim" npm (or yarn, pnpm) package.', { - 'Run in shell: npm install -g neovim', - 'Run in shell (if you use yarn): yarn global add neovim', - 'Run in shell (if you use pnpm): pnpm install -g neovim', - 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim', - }) - return - end - info('Nvim node.js host: ' .. host) - - local manager = 'npm' - if executable('yarn') then - manager = 'yarn' - elseif executable('pnpm') then - manager = 'pnpm' - end - - local latest_npm_cmd = ( - iswin and 'cmd /c ' .. manager .. ' info neovim --json' or manager .. ' info neovim --json' - ) - local latest_npm = system(vim.fn.split(latest_npm_cmd)) - if shell_error() or is_blank(latest_npm) then - error( - 'Failed to run: ' .. latest_npm_cmd, - { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } - ) - return - end - - local pcall_ok, output = pcall(vim.fn.json_decode, latest_npm) - local pkg_data - if pcall_ok then - pkg_data = output - else - return 'error: ' .. latest_npm - end - local latest_npm_subtable = pkg_data['dist-tags'] or {} - latest_npm = latest_npm_subtable['latest'] or 'unable to parse' - - local current_npm_cmd = { 'node', host, '--version' } - local current_npm = system(current_npm_cmd) - if shell_error() then - error( - 'Failed to run: ' .. table.concat(current_npm_cmd, ' '), - { 'Report this issue with the output of: ', table.concat(current_npm_cmd, ' ') } - ) - return - end - - if latest_npm ~= 'unable to parse' and vim.version.lt(current_npm, latest_npm) then - local message = 'Package "neovim" is out-of-date. Installed: ' - .. current_npm - .. ' latest: ' - .. latest_npm - warn(message, { - 'Run in shell: npm install -g neovim', - 'Run in shell (if you use yarn): yarn global add neovim', - 'Run in shell (if you use pnpm): pnpm install -g neovim', - }) - else - ok('Latest "neovim" npm/yarn/pnpm package is installed: ' .. current_npm) - end -end - -local function perl() - start('Perl provider (optional)') - - if disabled_via_loaded_var('perl') then - return - end - - local perl_detect_table = vim.fn['provider#perl#Detect']() - local perl_exec = perl_detect_table[1] - local perl_warnings = perl_detect_table[2] - - if is_blank(perl_exec) then - if not is_blank(perl_warnings) then - warn(perl_warnings, { - 'See :help provider-perl for more information.', - 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim', - }) - else - warn('No usable perl executable found') - end - return - end - - info('perl executable: ' .. perl_exec) - - -- we cannot use cpanm that is on the path, as it may not be for the perl - -- set with g:perl_host_prog - system({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' }) - if shell_error() then - return { perl_exec, '"App::cpanminus" module is not installed' } - end - - local latest_cpan_cmd = { - perl_exec, - '-MApp::cpanminus::script', - '-e', - 'my $app = App::cpanminus::script->new; $app->parse_options ("--info", "-q", "Neovim::Ext"); exit $app->doit', - } - - local latest_cpan = system(latest_cpan_cmd) - if shell_error() or is_blank(latest_cpan) then - error( - 'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '), - { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } - ) - return - elseif latest_cpan[1] == '!' then - local cpanm_errs = vim.split(latest_cpan, '!') - if cpanm_errs[1]:find("Can't write to ") then - local advice = {} - for i = 2, #cpanm_errs do - advice[#advice + 1] = cpanm_errs[i] - end - - warn(cpanm_errs[1], advice) - -- Last line is the package info - latest_cpan = cpanm_errs[#cpanm_errs] - else - error('Unknown warning from command: ' .. latest_cpan_cmd, cpanm_errs) - return - end - end - latest_cpan = vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]]) - if is_blank(latest_cpan) then - error('Cannot parse version number from cpanm output: ' .. latest_cpan) - return - end - - local current_cpan_cmd = { perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION' } - local current_cpan = system(current_cpan_cmd) - if shell_error() then - error( - 'Failed to run: ' .. table.concat(current_cpan_cmd, ' '), - { 'Report this issue with the output of: ', table.concat(current_cpan_cmd, ' ') } - ) - return - end - - if vim.version.lt(current_cpan, latest_cpan) then - local message = 'Module "Neovim::Ext" is out-of-date. Installed: ' - .. current_cpan - .. ', latest: ' - .. latest_cpan - warn(message, 'Run in shell: cpanm -n Neovim::Ext') - else - ok('Latest "Neovim::Ext" cpan module is installed: ' .. current_cpan) - end -end - -function M.check() - clipboard() - python() - ruby() - node() - perl() -end - -return M diff --git a/runtime/lua/provider/node/health.lua b/runtime/lua/provider/node/health.lua new file mode 100644 index 0000000000..a434f8a92b --- /dev/null +++ b/runtime/lua/provider/node/health.lua @@ -0,0 +1,105 @@ +local health = vim.health +local executable = health.executable +local iswin = vim.loop.os_uname().sysname == 'Windows_NT' + +local M = {} + +function M.check() + health.start('Node.js provider (optional)') + + if health.provider_disabled('node') then + return + end + + if + not executable('node') + or (not executable('npm') and not executable('yarn') and not executable('pnpm')) + then + health.warn( + '`node` and `npm` (or `yarn`, `pnpm`) must be in $PATH.', + 'Install Node.js and verify that `node` and `npm` (or `yarn`, `pnpm`) commands work.' + ) + return + end + + -- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or '' + local ok, node_v = health.cmd_ok({ 'node', '-v' }) + health.info('Node.js: ' .. node_v) + if not ok or vim.version.lt(node_v, '6.0.0') then + health.warn('Nvim node.js host does not support Node ' .. node_v) + -- Skip further checks, they are nonsense if nodejs is too old. + return + end + if vim.fn['provider#node#can_inspect']() == 0 then + health.warn( + 'node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.' + ) + end + + local node_detect_table = vim.fn['provider#node#Detect']() + local host = node_detect_table[1] + if host:find('^%s*$') then + health.warn('Missing "neovim" npm (or yarn, pnpm) package.', { + 'Run in shell: npm install -g neovim', + 'Run in shell (if you use yarn): yarn global add neovim', + 'Run in shell (if you use pnpm): pnpm install -g neovim', + 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim', + }) + return + end + health.info('Nvim node.js host: ' .. host) + + local manager = 'npm' + if executable('yarn') then + manager = 'yarn' + elseif executable('pnpm') then + manager = 'pnpm' + end + + local latest_npm_cmd = ( + iswin and 'cmd /c ' .. manager .. ' info neovim --json' or manager .. ' info neovim --json' + ) + local latest_npm + ok, latest_npm = health.cmd_ok(vim.split(latest_npm_cmd, ' ')) + if not ok or latest_npm:find('^%s$') then + health.error( + 'Failed to run: ' .. latest_npm_cmd, + { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } + ) + return + end + + local pcall_ok, pkg_data = pcall(vim.json.decode, latest_npm) + if not pcall_ok then + return 'error: ' .. latest_npm + end + local latest_npm_subtable = pkg_data['dist-tags'] or {} + latest_npm = latest_npm_subtable['latest'] or 'unable to parse' + + local current_npm_cmd = { 'node', host, '--version' } + local current_npm + ok, current_npm = health.cmd_ok(current_npm_cmd) + if not ok then + health.error( + 'Failed to run: ' .. table.concat(current_npm_cmd, ' '), + { 'Report this issue with the output of: ', table.concat(current_npm_cmd, ' ') } + ) + return + end + + if latest_npm ~= 'unable to parse' and vim.version.lt(current_npm, latest_npm) then + local message = 'Package "neovim" is out-of-date. Installed: ' + .. current_npm + .. ' latest: ' + .. latest_npm + health.warn(message({ + 'Run in shell: npm install -g neovim', + 'Run in shell (if you use yarn): yarn global add neovim', + 'Run in shell (if you use pnpm): pnpm install -g neovim', + })) + else + health.ok('Latest "neovim" npm/yarn/pnpm package is installed: ' .. current_npm) + end +end + +return M diff --git a/runtime/lua/provider/perl/health.lua b/runtime/lua/provider/perl/health.lua new file mode 100644 index 0000000000..d14ebc97ab --- /dev/null +++ b/runtime/lua/provider/perl/health.lua @@ -0,0 +1,95 @@ +local health = vim.health + +local M = {} + +function M.check() + health.start('Perl provider (optional)') + + if health.provider_disabled('perl') then + return + end + + local perl_detect_table = vim.fn['provider#perl#Detect']() + local perl_exec = perl_detect_table[1] + local perl_warnings = perl_detect_table[2] + + if perl_exec:find('^%s*$') then + if perl_warnings:find('%S') then + health.warn(perl_warnings, { + 'See :help provider-perl for more information.', + 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim', + }) + else + health.warn('No usable perl executable found') + end + return + end + + health.info('perl executable: ' .. perl_exec) + + -- we cannot use cpanm that is on the path, as it may not be for the perl + -- set with g:perl_host_prog + local ok = health.cmd_ok({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' }) + if not ok then + return { perl_exec, '"App::cpanminus" module is not installed' } + end + + local latest_cpan_cmd = { + perl_exec, + '-MApp::cpanminus::fatscript', + '-e', + 'my $app = App::cpanminus::script->new; $app->parse_options ("--info", "-q", "Neovim::Ext"); exit $app->doit', + } + local latest_cpan + ok, latest_cpan = health.cmd_ok(latest_cpan_cmd) + if not ok or latest_cpan:find('^%s*$') then + health.error( + 'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '), + { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } + ) + return + elseif latest_cpan[1] == '!' then + local cpanm_errs = vim.split(latest_cpan, '!') + if cpanm_errs[1]:find("Can't write to ") then + local advice = {} + for i = 2, #cpanm_errs do + advice[#advice + 1] = cpanm_errs[i] + end + + health.warn(cpanm_errs[1], advice) + -- Last line is the package info + latest_cpan = cpanm_errs[#cpanm_errs] + else + health.error('Unknown warning from command: ' .. latest_cpan_cmd, cpanm_errs) + return + end + end + latest_cpan = vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]]) + if latest_cpan:find('^%s*$') then + health.error('Cannot parse version number from cpanm output: ' .. latest_cpan) + return + end + + local current_cpan_cmd = { perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION' } + local current_cpan + ok, current_cpan = health.cmd_ok(current_cpan_cmd) + if not ok then + health.error( + 'Failed to run: ' .. table.concat(current_cpan_cmd, ' '), + { 'Report this issue with the output of: ', table.concat(current_cpan_cmd, ' ') } + ) + return + end + + if vim.version.lt(current_cpan, latest_cpan) then + local message = 'Module "Neovim::Ext" is out-of-date. Installed: ' + .. current_cpan + .. ', latest: ' + .. latest_cpan + health.warn(message, 'Run in shell: cpanm -n Neovim::Ext') + else + health.ok('Latest "Neovim::Ext" cpan module is installed: ' .. current_cpan) + end +end + +return M diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua new file mode 100644 index 0000000000..7fc4006fc8 --- /dev/null +++ b/runtime/lua/provider/python/health.lua @@ -0,0 +1,503 @@ +local health = vim.health +local executable = health.executable +local iswin = vim.loop.os_uname().sysname == 'Windows_NT' + +local M = {} + +local function is(path, ty) + if not path then + return false + end + local stat = vim.loop.fs_stat(path) + if not stat then + return false + end + return stat.type == ty +end + +-- Resolves Python executable path by invoking and checking `sys.executable`. +local function python_exepath(invocation) + local python = vim.fn.fnameescape(invocation) + local out = vim.fn.system(python .. ' -c "import sys; sys.stdout.write(sys.executable)"') + assert(vim.v.shell_error == 0, out) + return vim.fs.normalize(vim.trim(out)) +end + +-- Check if pyenv is available and a valid pyenv root can be found, then return +-- their respective paths. If either of those is invalid, return two empty +-- strings, effectively ignoring pyenv. +local function check_for_pyenv() + local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv')) + + if pyenv_path == '' then + return { '', '' } + end + + health.info('pyenv: Path: ' .. pyenv_path) + + local pyenv_root = os.getenv('PYENV_ROOT') and vim.fn.resolve('$PYENV_ROOT') or '' + + if pyenv_root == '' then + pyenv_root = vim.fn.system({ pyenv_path, 'root' }) + health.info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.') + end + + if not is(pyenv_root, 'directory') then + local message = string.format( + 'pyenv: Root does not exist: %s. Ignoring pyenv for all following checks.', + pyenv_root + ) + health.warn(message) + return { '', '' } + end + + health.info('pyenv: Root: ' .. pyenv_root) + + return { pyenv_path, pyenv_root } +end + +-- Check the Python interpreter's usability. +local function check_bin(bin) + if not is(bin, 'file') and (not iswin or not is(bin .. '.exe', 'file')) then + health.error('"' .. bin .. '" was not found.') + return false + elseif not executable(bin) then + health.error('"' .. bin .. '" is not executable.') + return false + end + return true +end + +-- Fetch the contents of a URL. +local function download(url) + local has_curl = executable('curl') + if has_curl and vim.fn.system({ 'curl', '-V' }):find('Protocols:.*https') then + local out, rc = health.system({ 'curl', '-sL', url }, { stderr = true, ignore_error = true }) + if rc ~= 0 then + return 'curl error with ' .. url .. ': ' .. rc + else + return out + end + elseif executable('python') then + local script = "try:\n\ + from urllib.request import urlopen\n\ + except ImportError:\n\ + from urllib2 import urlopen\n\ + response = urlopen('" .. url .. "')\n\ + print(response.read().decode('utf8'))\n" + local out, rc = health.system({ 'python', '-c', script }) + if out == '' and rc ~= 0 then + return 'python urllib.request error: ' .. rc + else + return out + end + end + + local message = 'missing `curl` ' + + if has_curl then + message = message .. '(with HTTPS support) ' + end + message = message .. 'and `python`, cannot make web request' + + return message +end + +-- Get the latest Nvim Python client (pynvim) version from PyPI. +local function latest_pypi_version() + local pypi_version = 'unable to get pypi response' + local pypi_response = download('https://pypi.python.org/pypi/pynvim/json') + if pypi_response ~= '' then + local pcall_ok, output = pcall(vim.fn.json_decode, pypi_response) + local pypi_data + if pcall_ok then + pypi_data = output + else + return 'error: ' .. pypi_response + end + + local pypi_element = pypi_data['info'] or {} + pypi_version = pypi_element['version'] or 'unable to parse' + end + return pypi_version +end + +local function is_bad_response(s) + local lower = s:lower() + return vim.startswith(lower, 'unable') + or vim.startswith(lower, 'error') + or vim.startswith(lower, 'outdated') +end + +-- Get version information using the specified interpreter. The interpreter is +-- used directly in case breaking changes were introduced since the last time +-- Nvim's Python client was updated. +-- +-- Returns: { +-- {python executable version}, +-- {current nvim version}, +-- {current pypi nvim status}, +-- {installed version status} +-- } +local function version_info(python) + local pypi_version = latest_pypi_version() + + local python_version, rc = health.system({ + python, + '-c', + 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))', + }) + + if rc ~= 0 or python_version == '' then + python_version = 'unable to parse ' .. python .. ' response' + end + + local nvim_path + nvim_path, rc = health.system({ + python, + '-c', + 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)', + }) + if rc ~= 0 or nvim_path == '' then + return { python_version, 'unable to load neovim Python module', pypi_version, nvim_path } + end + + -- Assuming that multiple versions of a package are installed, sort them + -- numerically in descending order. + local function compare(metapath1, metapath2) + local a = vim.fn.matchstr(vim.fn.fnamemodify(metapath1, ':p:h:t'), [[[0-9.]\+]]) + local b = vim.fn.matchstr(vim.fn.fnamemodify(metapath2, ':p:h:t'), [[[0-9.]\+]]) + if a == b then + return 0 + elseif a > b then + return 1 + else + return -1 + end + end + + -- Try to get neovim.VERSION (added in 0.1.11dev). + local nvim_version + nvim_version, rc = health.system({ + python, + '-c', + 'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))', + }, { stderr = true, ignore_error = true }) + if rc ~= 0 or nvim_version == '' then + nvim_version = 'unable to find pynvim module version' + local base = vim.fs.basename(nvim_path) + local metas = vim.fn.glob(base .. '-*/METADATA', 1, 1) + vim.list_extend(metas, vim.fn.glob(base .. '-*/PKG-INFO', 1, 1)) + vim.list_extend(metas, vim.fn.glob(base .. '.egg-info/PKG-INFO', 1, 1)) + metas = table.sort(metas, compare) + + if metas and next(metas) ~= nil then + for line in io.lines(metas[1]) do + local version = line:match('^Version: (%S+)') + if version then + nvim_version = version + break + end + end + end + end + + local nvim_path_base = vim.fn.fnamemodify(nvim_path, [[:~:h]]) + local version_status = 'unknown; ' .. nvim_path_base + if is_bad_response(nvim_version) and is_bad_response(pypi_version) then + if vim.version.lt(nvim_version, pypi_version) then + version_status = 'outdated; from ' .. nvim_path_base + else + version_status = 'up to date' + end + end + + return { python_version, nvim_version, pypi_version, version_status } +end + +function M.check() + health.start('Python 3 provider (optional)') + + local pyname = 'python3' + local python_exe = '' + local virtual_env = os.getenv('VIRTUAL_ENV') + local venv = virtual_env and vim.fn.resolve(virtual_env) or '' + local host_prog_var = pyname .. '_host_prog' + local python_multiple = {} + + if health.provider_disabled(pyname) then + return + end + + local pyenv_table = check_for_pyenv() + local pyenv = pyenv_table[1] + local pyenv_root = pyenv_table[2] + + if vim.g[host_prog_var] then + local message = string.format('Using: g:%s = "%s"', host_prog_var, vim.g[host_prog_var]) + health.info(message) + end + + local python_table = vim.fn['provider#pythonx#Detect'](3) + pyname = python_table[1] + local pythonx_warnings = python_table[2] + + if pyname == '' then + health.warn( + 'No Python executable found that can `import neovim`. ' + .. 'Using the first available executable for diagnostics.' + ) + elseif vim.g[host_prog_var] then + python_exe = pyname + end + + -- No Python executable could `import neovim`, or host_prog_var was used. + if pythonx_warnings ~= '' then + health.warn(pythonx_warnings, { + 'See :help provider-python for more information.', + 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim', + }) + elseif pyname ~= '' and python_exe == '' then + if not vim.g[host_prog_var] then + local message = string.format( + '`g:%s` is not set. Searching for %s in the environment.', + host_prog_var, + pyname + ) + health.info(message) + end + + if pyenv ~= '' then + python_exe = health.system({ pyenv, 'which', pyname }, { stderr = true }) + if python_exe == '' then + health.warn('pyenv could not find ' .. pyname .. '.') + end + end + + if python_exe == '' then + python_exe = vim.fn.exepath(pyname) + + if os.getenv('PATH') then + local path_sep = iswin and ';' or ':' + local paths = vim.split(os.getenv('PATH') or '', path_sep) + + for _, path in ipairs(paths) do + local path_bin = vim.fs.normalize(path .. '/' .. pyname) + if + path_bin ~= vim.fs.normalize(python_exe) + and vim.tbl_contains(python_multiple, path_bin) + and executable(path_bin) + then + python_multiple[#python_multiple + 1] = path_bin + end + end + + if vim.tbl_count(python_multiple) > 0 then + -- This is worth noting since the user may install something + -- that changes $PATH, like homebrew. + local message = string.format( + 'Multiple %s executables found. Set `g:%s` to avoid surprises.', + pyname, + host_prog_var + ) + health.info(message) + end + + if python_exe:find('shims') then + local message = string.format('`%s` appears to be a pyenv shim.', python_exe) + local advice = string.format( + '`pyenv` is not in $PATH, your pyenv installation is broken. Set `g:%s` to avoid surprises.', + host_prog_var + ) + health.warn(message, advice) + end + end + end + end + + if python_exe ~= '' and not vim.g[host_prog_var] then + if + venv == '' + and pyenv ~= '' + and pyenv_root ~= '' + and vim.startswith(vim.fn.resolve(python_exe), pyenv_root .. '/') + then + local advice = string.format( + 'Create a virtualenv specifically for Nvim using pyenv, and set `g:%s`. This will avoid the need to install the pynvim module in each version/virtualenv.', + host_prog_var + ) + health.warn('pyenv is not set up optimally.', advice) + elseif venv ~= '' then + local venv_root + if pyenv_root ~= '' then + venv_root = pyenv_root + else + venv_root = vim.fs.dirname(venv) + end + + if vim.startswith(vim.fn.resolve(python_exe), venv_root .. '/') then + local advice = string.format( + 'Create a virtualenv specifically for Nvim and use `g:%s`. This will avoid the need to install the pynvim module in each virtualenv.', + host_prog_var + ) + health.warn('Your virtualenv is not set up optimally.', advice) + end + end + end + + if python_exe == '' and pyname ~= '' then + -- An error message should have already printed. + health.error('`' .. pyname .. '` was not found.') + elseif python_exe ~= '' and not check_bin(python_exe) then + python_exe = '' + end + + -- Diagnostic output + health.info('Executable: ' .. (python_exe == '' and 'Not found' or python_exe)) + if vim.tbl_count(python_multiple) > 0 then + for _, path_bin in ipairs(python_multiple) do + health.info('Other python executable: ' .. path_bin) + end + end + + if python_exe == '' then + -- No Python executable can import 'neovim'. Check if any Python executable + -- can import 'pynvim'. If so, that Python failed to import 'neovim' as + -- well, which is most probably due to a failed pip upgrade: + -- https://github.com/neovim/neovim/wiki/Following-HEAD#20181118 + local pynvim_table = vim.fn['provider#pythonx#DetectByModule']('pynvim', 3) + local pynvim_exe = pynvim_table[1] + if pynvim_exe ~= '' then + local message = 'Detected pip upgrade failure: Python executable can import "pynvim" but not "neovim": ' + .. pynvim_exe + local advice = { + 'Use that Python version to reinstall "pynvim" and optionally "neovim".', + pynvim_exe .. ' -m pip uninstall pynvim neovim', + pynvim_exe .. ' -m pip install pynvim', + pynvim_exe .. ' -m pip install neovim # only if needed by third-party software', + } + health.error(message, advice) + end + else + local version_info_table = version_info(python_exe) + local pyversion = version_info_table[1] + local current = version_info_table[2] + local latest = version_info_table[3] + local status = version_info_table[4] + + if not vim.version.range('~3'):has(pyversion) then + health.warn('Unexpected Python version. This could lead to confusing error messages.') + end + + health.info('Python version: ' .. pyversion) + + if is_bad_response(status) then + health.info('pynvim version: ' .. current .. ' (' .. status .. ')') + else + health.info('pynvim version: ' .. current) + end + + if is_bad_response(current) then + health.error( + 'pynvim is not installed.\nError: ' .. current, + 'Run in shell: ' .. python_exe .. ' -m pip install pynvim' + ) + end + + if is_bad_response(latest) then + health.warn('Could not contact PyPI to get latest version.') + health.error('HTTP request failed: ' .. latest) + elseif is_bad_response(status) then + health.warn('Latest pynvim is NOT installed: ' .. latest) + elseif not is_bad_response(current) then + health.ok('Latest pynvim is installed.') + end + end + + health.start('Python virtualenv') + if not virtual_env then + health.ok('no $VIRTUAL_ENV') + return + end + local errors = {} + -- Keep hints as dict keys in order to discard duplicates. + local hints = {} + -- The virtualenv should contain some Python executables, and those + -- executables should be first both on Nvim's $PATH and the $PATH of + -- subshells launched from Nvim. + local bin_dir = iswin and 'Scripts' or 'bin' + local venv_bins = vim.fn.glob(string.format('%s/%s/python*', virtual_env, bin_dir), true, true) + venv_bins = vim.tbl_filter(function(v) + -- XXX: Remove irrelevant executables found in bin/. + return not v:match('python%-config') + end, venv_bins) + if vim.tbl_count(venv_bins) > 0 then + for _, venv_bin in pairs(venv_bins) do + venv_bin = vim.fs.normalize(venv_bin) + local py_bin_basename = vim.fs.basename(venv_bin) + local nvim_py_bin = python_exepath(vim.fn.exepath(py_bin_basename)) + local subshell_py_bin = python_exepath(py_bin_basename) + if venv_bin ~= nvim_py_bin then + errors[#errors + 1] = '$PATH yields this ' + .. py_bin_basename + .. ' executable: ' + .. nvim_py_bin + local hint = '$PATH ambiguities arise if the virtualenv is not ' + .. 'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, ' + .. 'check that invoking Python from the command line launches the correct one, ' + .. 'then relaunch Nvim.' + hints[hint] = true + end + if venv_bin ~= subshell_py_bin then + errors[#errors + 1] = '$PATH in subshells yields this ' + .. py_bin_basename + .. ' executable: ' + .. subshell_py_bin + local hint = '$PATH ambiguities in subshells typically are ' + .. 'caused by your shell config overriding the $PATH previously set by the ' + .. 'virtualenv. Either prevent them from doing so, or use this workaround: ' + .. 'https://vi.stackexchange.com/a/34996' + hints[hint] = true + end + end + else + errors[#errors + 1] = 'no Python executables found in the virtualenv ' + .. bin_dir + .. ' directory.' + end + + local msg = '$VIRTUAL_ENV is set to: ' .. virtual_env + if vim.tbl_count(errors) > 0 then + if vim.tbl_count(venv_bins) > 0 then + msg = string.format( + '%s\nAnd its %s directory contains: %s', + msg, + bin_dir, + table.concat( + vim.tbl_map(function(v) + return vim.fn.fnamemodify(v, ':t') + end, venv_bins), + ', ' + ) + ) + end + local conj = '\nBut ' + for _, err in ipairs(errors) do + msg = msg .. conj .. err + conj = '\nAnd ' + end + msg = msg .. '\nSo invoking Python may lead to unexpected results.' + health.warn(msg, vim.tbl_keys(hints)) + else + health.info(msg) + health.info( + 'Python version: ' + .. health.system( + 'python -c "import platform, sys; sys.stdout.write(platform.python_version())"' + ) + ) + health.ok('$VIRTUAL_ENV provides :!python.') + end +end + +return M diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua new file mode 100644 index 0000000000..12f1ed9b80 --- /dev/null +++ b/runtime/lua/provider/ruby/health.lua @@ -0,0 +1,71 @@ +local health = vim.health +local executable = health.executable +local iswin = vim.loop.os_uname().sysname == 'Windows_NT' + +local M = {} + +function M.check() + health.start('Ruby provider (optional)') + + if health.provider_disabled('ruby') then + return + end + + if not executable('ruby') or not executable('gem') then + health.warn( + '`ruby` and `gem` must be in $PATH.', + 'Install Ruby and verify that `ruby` and `gem` commands work.' + ) + return + end + health.info('Ruby: ' .. health.system({ 'ruby', '-v' })) + + local ruby_detect_table = vim.fn['provider#ruby#Detect']() + local host = ruby_detect_table[1] + if host:find('^%s*$') then + health.warn('`neovim-ruby-host` not found.', { + 'Run `gem install neovim` to ensure the neovim RubyGem is installed.', + 'Run `gem environment` to ensure the gem bin directory is in $PATH.', + 'If you are using rvm/rbenv/chruby, try "rehashing".', + 'See :help g:ruby_host_prog for non-standard gem installations.', + 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim', + }) + return + end + health.info('Host: ' .. host) + + local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$') + local ok, latest_gem = health.cmd_ok(vim.split(latest_gem_cmd, ' ')) + if not ok or latest_gem:find('^%s*$') then + health.error( + 'Failed to run: ' .. latest_gem_cmd, + { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } + ) + return + end + local gem_split = vim.split(latest_gem, [[neovim (\|, \|)$]]) + latest_gem = gem_split[1] or 'not found' + + local current_gem_cmd = { host, '--version' } + local current_gem + ok, current_gem = health.cmd_ok(current_gem_cmd) + if not ok then + health.error( + 'Failed to run: ' .. table.concat(current_gem_cmd, ' '), + { 'Report this issue with the output of: ', table.concat(current_gem_cmd, ' ') } + ) + return + end + + if vim.version.lt(current_gem, latest_gem) then + local message = 'Gem "neovim" is out-of-date. Installed: ' + .. current_gem + .. ', latest: ' + .. latest_gem + health.warn(message, 'Run in shell: gem update neovim') + else + health.ok('Latest "neovim" gem is installed: ' .. current_gem) + end +end + +return M diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 55a451bf56..d9265f6bd6 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -267,6 +267,114 @@ function M.report_error(msg, ...) M.error(msg, ...) end +function M.provider_disabled(provider) + local loaded_var = 'loaded_' .. provider .. '_provider' + local v = vim.g[loaded_var] + if v == 0 then + M.info('Disabled (' .. loaded_var .. '=' .. v .. ').') + return true + end + return false +end + +-- Handler for s:system() function. +local function system_handler(self, _, data, event) + if event == 'stderr' then + if self.add_stderr_to_output then + self.output = self.output .. table.concat(data, '') + else + self.stderr = self.stderr .. table.concat(data, '') + end + elseif event == 'stdout' then + self.output = self.output .. table.concat(data, '') + end +end + +-- Attempts to construct a shell command from an args list. +-- Only for display, to help users debug a failed command. +local function shellify(cmd) + if type(cmd) ~= 'table' then + return cmd + end + local escaped = {} + for i, v in ipairs(cmd) do + if v:match('[^A-Za-z_/.-]') then + escaped[i] = vim.fn.shellescape(v) + else + escaped[i] = v + end + end + return table.concat(escaped, ' ') +end + +function M.cmd_ok(cmd) + local out = vim.fn.system(cmd) + return vim.v.shell_error == 0, out +end + +--- Run a system command and timeout after 30 seconds. +--- +--- @param cmd table List of command arguments to execute +--- @param args ?table Optional arguments: +--- - stdin (string): Data to write to the job's stdin +--- - stderr (boolean): Append stderr to stdout +--- - ignore_error (boolean): If true, ignore error output +--- - timeout (number): Number of seconds to wait before timing out (default 30) +function M.system(cmd, args) + args = args or {} + local stdin = args.stdin or '' + local stderr = vim.F.if_nil(args.stderr, false) + local ignore_error = vim.F.if_nil(args.ignore_error, false) + + local shell_error_code = 0 + local opts = { + add_stderr_to_output = stderr, + output = '', + stderr = '', + on_stdout = system_handler, + on_stderr = system_handler, + on_exit = function(_, data) + shell_error_code = data + end, + } + local jobid = vim.fn.jobstart(cmd, opts) + + if jobid < 1 then + local message = + string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.loop.cwd()) + error(message) + return opts.output, 1 + end + + if stdin:find('^%s$') then + vim.fn.chansend(jobid, stdin) + end + + local res = vim.fn.jobwait({ jobid }, vim.F.if_nil(args.timeout, 30) * 1000) + if res[1] == -1 then + error('Command timed out: ' .. shellify(cmd)) + vim.fn.jobstop(jobid) + elseif shell_error_code ~= 0 and not ignore_error then + local emsg = string.format( + 'Command error (job=%d, exit code %d): %s (in %s)', + jobid, + shell_error_code, + shellify(cmd), + vim.loop.cwd() + ) + if opts.output:find('%S') then + emsg = string.format('%s\noutput: %s', emsg, opts.output) + end + if opts.stderr:find('%S') then + emsg = string.format('%s\nstderr: %s', emsg, opts.stderr) + end + error(emsg) + end + + -- return opts.output + return vim.trim(vim.fn.system(cmd)), shell_error_code +end + local path2name = function(path) if path:match('%.lua$') then -- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp" @@ -389,4 +497,11 @@ function M._check(mods, plugin_names) vim.print('') end +local fn_bool = function(key) + return function(...) + return vim.fn[key](...) == 1 + end +end +M.executable = fn_bool('executable') + return M -- cgit From 4ee656e4f35766bef4e27c5afbfa8e3d8d74a76c Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Mon, 1 Jan 2024 23:03:50 +0200 Subject: feature(diagnostic): add `vim.diagnostic.count()` (#26807) feat(diagnostic): add `vim.diagnostic.count()` Problem: Getting diagnostic count based on the output of `vim.diagnostic.get()` might become costly as number of diagnostic entries grows. This is because it returns a copy of diagnostic cache entries (so as to not allow users to change them in place). Getting information about diagnostic count is frequently used in statusline, so it is important to be as fast as reasonbly possible. Solution: Add `vim.diagnostic.count()` which computes severity counts without making copies. --- runtime/doc/deprecated.txt | 2 +- runtime/doc/diagnostic.txt | 16 ++++++++++++++++ runtime/doc/news.txt | 5 +++++ runtime/lua/vim/diagnostic.lua | 28 ++++++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 9d32f64aef..0f2dbaa77c 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -90,7 +90,7 @@ For each of the functions below, use the corresponding function in - *vim.lsp.diagnostic.enable()* - *vim.lsp.diagnostic.get()* - *vim.lsp.diagnostic.get_all()* Use |vim.diagnostic.get()| instead. -- *vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.get()| instead. +- *vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.count()| instead. - *vim.lsp.diagnostic.get_line_diagnostics()* Use |vim.diagnostic.get()| instead. - *vim.lsp.diagnostic.get_next()* - *vim.lsp.diagnostic.get_next_pos()* diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index fa5ef22e37..106e130a41 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -481,6 +481,22 @@ config({opts}, {namespace}) *vim.diagnostic.config()* Return: ~ (table|nil) table of current diagnostic config if `opts` is omitted. +count({bufnr}, {opts}) *vim.diagnostic.count()* + Get current diagnostics count. + + Parameters: ~ + • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0 + for current buffer or nil for all buffers. + • {opts} (table|nil) A table with the following keys: + • namespace: (number) Limit diagnostics to the given + namespace. + • lnum: (number) Limit diagnostics to the given line number. + • severity: See |diagnostic-severity|. + + Return: ~ + (table) A table with actually present severity values as keys (see + |diagnostic-severity|) and integer counts as values. + disable({bufnr}, {namespace}) *vim.diagnostic.disable()* Disable diagnostics in the given buffer. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 112a76c013..8efad2454b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -275,6 +275,11 @@ The following new APIs and features were added. • |v_Q-default| and |v_@-default| repeat a register for each line of a visual selection. +• |vim.diagnostic.count()| returns the number of diagnostics for a given + buffer and/or namespace, by severity. This is a faster alternative to + |vim.diagnostic.get()| when only the number of diagnostics is needed, but + not the diagnostics themselves. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index ad40723737..a447463dff 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -363,7 +363,6 @@ local function get_diagnostics(bufnr, opts, clamp) local function add(b, d) if not opts.lnum or d.lnum == opts.lnum then - d = vim.deepcopy(d) if clamp and api.nvim_buf_is_loaded(b) then local line_count = buf_line_count[b] - 1 if @@ -374,6 +373,7 @@ local function get_diagnostics(bufnr, opts, clamp) or d.col < 0 or d.end_col < 0 then + d = vim.deepcopy(d) d.lnum = math.max(math.min(d.lnum, line_count), 0) d.end_lnum = math.max(math.min(d.end_lnum, line_count), 0) d.col = math.max(d.col, 0) @@ -756,7 +756,31 @@ function M.get(bufnr, opts) opts = { opts, 't', true }, }) - return get_diagnostics(bufnr, opts, false) + return vim.deepcopy(get_diagnostics(bufnr, opts, false)) +end + +--- Get current diagnostics count. +--- +---@param bufnr integer|nil Buffer number to get diagnostics from. Use 0 for +--- current buffer or nil for all buffers. +---@param opts table|nil A table with the following keys: +--- - namespace: (number) Limit diagnostics to the given namespace. +--- - lnum: (number) Limit diagnostics to the given line number. +--- - severity: See |diagnostic-severity|. +---@return table A table with actually present severity values as keys (see |diagnostic-severity|) and integer counts as values. +function M.count(bufnr, opts) + vim.validate({ + bufnr = { bufnr, 'n', true }, + opts = { opts, 't', true }, + }) + + local diagnostics = get_diagnostics(bufnr, opts, false) + local count = {} + for i = 1, #diagnostics do + local severity = diagnostics[i].severity + count[severity] = (count[severity] or 0) + 1 + end + return count end --- Get the previous diagnostic closest to the cursor position. -- cgit From 3f788e73b34521f093846d362bf51e68bc9a3827 Mon Sep 17 00:00:00 2001 From: TheLeoP <53507599+TheLeoP@users.noreply.github.com> Date: Tue, 2 Jan 2024 04:08:36 -0500 Subject: feat(lsp): support connect via named pipes/unix domain sockets (#26032) Closes https://github.com/neovim/neovim/issues/26031 Co-authored-by: Mathias Fussenegger --- runtime/doc/lsp.txt | 48 ++++++--- runtime/doc/news.txt | 2 + runtime/lua/vim/lsp/rpc.lua | 253 ++++++++++++++++++++++++++++++++------------ 3 files changed, 222 insertions(+), 81 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index aaec58633f..d53a7b4c11 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2082,11 +2082,26 @@ connect({host}, {port}) *vim.lsp.rpc.connect()* and port Parameters: ~ - • {host} (string) - • {port} (integer) + • {host} (string) host to connect to + • {port} (integer) port to connect to Return: ~ - (function) + fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient function intended to be passed to |vim.lsp.start_client()| or + |vim.lsp.start()| on the field cmd + + *vim.lsp.rpc.domain_socket_connect()* +domain_socket_connect({pipe_path}) + Create a LSP RPC client factory that connects via named pipes (Windows) or + unix domain sockets (Unix) to the given pipe_path (file path on Unix and + name on Windows) + + Parameters: ~ + • {pipe_path} (string) file path of the domain socket (Unix) or name of + the named pipe (Windows) to connect to + + Return: ~ + fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient::function intended to be passed to + |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* Constructs an error message from an LSP error object. @@ -2095,14 +2110,14 @@ format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* • {err} (table) The error object Return: ~ - (string) The formatted error message + string::The formatted error message notify({method}, {params}) *vim.lsp.rpc.notify()* Sends a notification to the LSP server. Parameters: ~ • {method} (string) The invoked LSP method - • {params} (table|nil) Parameters for the invoked LSP method + • {params} (table?) Parameters for the invoked LSP method Return: ~ (boolean) `true` if notification could be sent, `false` if not @@ -2113,12 +2128,12 @@ request({method}, {params}, {callback}, {notify_reply_callback}) Parameters: ~ • {method} (string) The invoked LSP method - • {params} (table|nil) Parameters for the invoked LSP + • {params} (table?) Parameters for the invoked LSP method • {callback} fun(err: lsp.ResponseError | nil, result: any) Callback to invoke - • {notify_reply_callback} (function|nil) Callback to invoke as soon as - a request is no longer pending + • {notify_reply_callback} (function?) Callback to invoke as soon as a + request is no longer pending Return: ~ (boolean) success, integer|nil request_id true, message_id if request @@ -2129,11 +2144,13 @@ rpc_response_error({code}, {message}, {data}) Creates an RPC response object/table. Parameters: ~ - • {code} (integer) RPC error code defined in - `vim.lsp.protocol.ErrorCodes` + • {code} (integer) RPC error code defined by JSON RPC • {message} (string|nil) arbitrary message to send to server • {data} any|nil arbitrary data to send to server + Return: ~ + vim.lsp.rpc.Error + *vim.lsp.rpc.start()* start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) Starts an LSP server process and create an LSP RPC client object to @@ -2143,7 +2160,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) Parameters: ~ • {cmd} (string) Command to start the LSP server. - • {cmd_args} (table) List of additional string arguments to + • {cmd_args} string[] List of additional string arguments to pass to {cmd}. • {dispatchers} (table|nil) Dispatchers for LSP message types. Valid dispatcher names are: @@ -2155,11 +2172,14 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) server process. May contain: • {cwd} (string) Working directory for the LSP server process - • {env} (table) Additional environment variables - for LSP server process + • {detached?} (boolean) Detach the LSP server + process from the current process. Defaults to + false on Windows and true otherwise. + • {env?} (table) Additional environment + variables for LSP server process Return: ~ - RpcClientPublic|nil Client RPC object, with these methods: + (table|nil) client RPC object, with these methods: • `notify()` |vim.lsp.rpc.notify()| • `request()` |vim.lsp.rpc.request()| • `is_closing()` returns a boolean indicating if the RPC is closing. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 8efad2454b..03e1989e62 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -193,6 +193,8 @@ The following new APIs and features were added. windows. • |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to the original LSP `Location` or `LocationLink`. + • Added support for connecting to servers using named pipes (Windows) or + unix domain sockets (Unix) via |vim.lsp.rpc.domain_socket_connect()|. • Treesitter • Bundled parsers and queries (highlight, folds) for Markdown, Python, and diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 61ad1e479c..b0d98829a6 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -5,8 +5,31 @@ local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedu local is_win = uv.os_uname().version:find('Windows') +---@alias vim.lsp.rpc.Dispatcher fun(method: string, params: table):nil, vim.lsp.rpc.Error? +---@alias vim.lsp.rpc.on_error fun(code: integer, ...: any) +---@alias vim.lsp.rpc.on_exit fun(code: integer, signal: integer) + +---@class vim.lsp.rpc.Dispatchers +---@field notification vim.lsp.rpc.Dispatcher +---@field server_request vim.lsp.rpc.Dispatcher +---@field on_exit vim.lsp.rpc.on_error +---@field on_error vim.lsp.rpc.on_exit + +---@class vim.lsp.rpc.PublicClient +---@field request fun(method: string, params?: table, callback: fun(err: lsp.ResponseError | nil, result: any), notify_reply_callback:function?) +---@field notify fun(method: string, params: any) +---@field is_closing fun(): boolean +---@field terminate fun(): nil + +---@class vim.lsp.rpc.Client +---@field message_index integer +---@field message_callbacks table dict of message_id to callback +---@field notify_reply_callbacks table dict of message_id to callback +---@field transport vim.lsp.rpc.Transport +---@field dispatchers vim.lsp.rpc.Dispatchers + --- Checks whether a given path exists and is a directory. ----@param filename (string) path to check +---@param filename string path to check ---@return boolean local function is_dir(filename) local stat = uv.fs_stat(filename) @@ -15,14 +38,14 @@ end --- Embeds the given string into a table and correctly computes `Content-Length`. --- ----@param encoded_message (string) ----@return string containing encoded message and `Content-Length` attribute -local function format_message_with_content_length(encoded_message) +---@param message string +---@return string message with `Content-Length` attribute +local function format_message_with_content_length(message) return table.concat({ 'Content-Length: ', - tostring(#encoded_message), + tostring(#message), '\r\n\r\n', - encoded_message, + message, }) end @@ -44,13 +67,17 @@ local function log_debug(...) end end +---@class vim.lsp.rpc.Headers: {string: any} +---@field content_length integer + --- Parses an LSP Message's header --- ----@param header string: The header to parse. ----@return table # parsed headers +---@param header string The header to parse. +---@return vim.lsp.rpc.Headers#parsed headers local function parse_headers(header) assert(type(header) == 'string', 'header must be a string') - local headers = {} --- @type table + --- @type vim.lsp.rpc.Headers + local headers = {} for line in vim.gsplit(header, '\r\n', { plain = true }) do if line == '' then break @@ -92,15 +119,25 @@ local function request_parser_loop() -- be searching for. -- TODO(ashkan) I'd like to remove this, but it seems permanent :( local buffer_start = buffer:find(header_start_pattern) + if not buffer_start then + error( + string.format( + "Headers were expected, a different response was received. The server response was '%s'.", + buffer + ) + ) + end local headers = parse_headers(buffer:sub(buffer_start, start - 1)) local content_length = headers.content_length -- Use table instead of just string to buffer the message. It prevents -- a ton of strings allocating. -- ref. http://www.lua.org/pil/11.6.html + ---@type string[] local body_chunks = { buffer:sub(finish + 1) } local body_length = #body_chunks[1] -- Keep waiting for data until we have enough. while body_length < content_length do + ---@type string local chunk = coroutine.yield() or error('Expected more data for the body. The server may have died.') -- TODO hmm. table.insert(body_chunks, chunk) @@ -148,8 +185,8 @@ M.client_errors = vim.tbl_add_reverse_lookup(M.client_errors) --- Constructs an error message from an LSP error object. --- ----@param err (table) The error object ----@returns (string) The formatted error message +---@param err table The error object +---@return string#The formatted error message function M.format_rpc_error(err) validate({ err = { err, 't' }, @@ -176,11 +213,17 @@ function M.format_rpc_error(err) return table.concat(message_parts, ' ') end +---@class vim.lsp.rpc.Error +---@field code integer RPC error code defined by JSON RPC, see `vim.lsp.protocol.ErrorCodes` +---@field message? string arbitrary message to send to server +---@field data? any arbitrary data to send to server + --- Creates an RPC response object/table. --- ----@param code integer RPC error code defined in `vim.lsp.protocol.ErrorCodes` ----@param message string|nil arbitrary message to send to server ----@param data any|nil arbitrary data to send to server +---@param code integer RPC error code defined by JSON RPC +---@param message? string arbitrary message to send to server +---@param data? any arbitrary data to send to server +---@return vim.lsp.rpc.Error function M.rpc_response_error(code, message, data) -- TODO should this error or just pick a sane error (like InternalError)? local code_name = assert(protocol.ErrorCodes[code], 'Invalid RPC error code') @@ -204,7 +247,7 @@ local default_dispatchers = { --- Default dispatcher for notifications sent to an LSP server. --- ---@param method (string) The invoked LSP method - ---@param params (table): Parameters for the invoked LSP method + ---@param params (table) Parameters for the invoked LSP method notification = function(method, params) log_debug('notification', method, params) end, @@ -212,9 +255,9 @@ local default_dispatchers = { --- Default dispatcher for requests sent to an LSP server. --- ---@param method (string) The invoked LSP method - ---@param params (table): Parameters for the invoked LSP method + ---@param params (table) Parameters for the invoked LSP method ---@return nil - ---@return table, `vim.lsp.protocol.ErrorCodes.MethodNotFound` + ---@return vim.lsp.rpc.Error#`vim.lsp.protocol.ErrorCodes.MethodNotFound` server_request = function(method, params) log_debug('server_request', method, params) return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound) @@ -222,8 +265,8 @@ local default_dispatchers = { --- Default dispatcher for when a client exits. --- - ---@param code (integer): Exit code - ---@param signal (integer): Number describing the signal used to terminate (if + ---@param code (integer) Exit code + ---@param signal (integer) Number describing the signal used to terminate (if ---any) on_exit = function(code, signal) log_info('client_exit', { code = code, signal = signal }) @@ -231,17 +274,19 @@ local default_dispatchers = { --- Default dispatcher for client errors. --- - ---@param code (integer): Error code - ---@param err (any): Details about the error + ---@param code (integer) Error code + ---@param err (any) Details about the error ---any) on_error = function(code, err) log_error('client_error:', M.client_errors[code], err) end, } +---@cast default_dispatchers vim.lsp.rpc.Dispatchers + ---@private function M.create_read_loop(handle_body, on_no_chunk, on_error) - local parse_chunk = coroutine.wrap(request_parser_loop) + local parse_chunk = coroutine.wrap(request_parser_loop) --[[@as fun(chunk: string?): vim.lsp.rpc.Headers?, string?]] parse_chunk() return function(err, chunk) if err then @@ -268,14 +313,7 @@ function M.create_read_loop(handle_body, on_no_chunk, on_error) end end ----@class RpcClient ----@field message_index integer ----@field message_callbacks table ----@field notify_reply_callbacks table ----@field transport table ----@field dispatchers table - ----@class RpcClient +---@class vim.lsp.rpc.Client local Client = {} ---@private @@ -284,15 +322,18 @@ function Client:encode_and_send(payload) if self.transport.is_closing() then return false end - local encoded = vim.json.encode(payload) - self.transport.write(format_message_with_content_length(encoded)) + local jsonstr = assert( + vim.json.encode(payload), + string.format("Couldn't encode payload '%s'", vim.inspect(payload)) + ) + self.transport.write(format_message_with_content_length(jsonstr)) return true end ---@package --- Sends a notification to the LSP server. ----@param method (string) The invoked LSP method ----@param params (any): Parameters for the invoked LSP method +---@param method string The invoked LSP method +---@param params any Parameters for the invoked LSP method ---@return boolean `true` if notification could be sent, `false` if not function Client:notify(method, params) return self:encode_and_send({ @@ -316,10 +357,10 @@ end ---@package --- Sends a request to the LSP server and runs {callback} upon response. --- ----@param method (string) The invoked LSP method ----@param params (table|nil) Parameters for the invoked LSP method ----@param callback fun(err: lsp.ResponseError|nil, result: any) Callback to invoke ----@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending +---@param method string The invoked LSP method +---@param params? table Parameters for the invoked LSP method +---@param callback fun(err?: lsp.ResponseError, result: any) Callback to invoke +---@param notify_reply_callback? function Callback to invoke as soon as a request is no longer pending ---@return boolean success, integer|nil request_id true, request_id if request could be sent, `false` if not function Client:request(method, params, callback, notify_reply_callback) validate({ @@ -352,6 +393,8 @@ function Client:request(method, params, callback, notify_reply_callback) end ---@package +---@param errkind integer +---@param ... any function Client:on_error(errkind, ...) assert(M.client_errors[errkind]) -- TODO what to do if this fails? @@ -359,6 +402,13 @@ function Client:on_error(errkind, ...) end ---@private +---@param errkind integer +---@param status boolean +---@param head any +---@param ... any +---@return boolean status +---@return any head +---@return any|nil ... function Client:pcall_handler(errkind, status, head, ...) if not status then self:on_error(errkind, head, ...) @@ -368,6 +418,12 @@ function Client:pcall_handler(errkind, status, head, ...) end ---@private +---@param errkind integer +---@param fn function +---@param ... any +---@return boolean status +---@return any head +---@return any|nil ... function Client:try_call(errkind, fn, ...) return self:pcall_handler(errkind, pcall(fn, ...)) end @@ -386,7 +442,7 @@ function Client:handle_body(body) log_debug('rpc.receive', decoded) if type(decoded.method) == 'string' and decoded.id then - local err --- @type table? + local err --- @type vim.lsp.rpc.Error? -- Schedule here so that the users functions don't trigger an error and -- we can still use the result. schedule(function() @@ -412,6 +468,7 @@ function Client:handle_body(body) ) end if err then + ---@cast err vim.lsp.rpc.Error assert( type(err) == 'table', 'err must be a table. Use rpc_response_error to help format errors.' @@ -504,7 +561,14 @@ function Client:handle_body(body) end end ----@return RpcClient +---@class vim.lsp.rpc.Transport +---@field write fun(msg: string): nil +---@field is_closing fun(): boolean|nil +---@field terminate fun(): nil + +---@param dispatchers vim.lsp.rpc.Dispatchers +---@param transport vim.lsp.rpc.Transport +---@return vim.lsp.rpc.Client local function new_client(dispatchers, transport) local state = { message_index = 0, @@ -516,14 +580,8 @@ local function new_client(dispatchers, transport) return setmetatable(state, { __index = Client }) end ---- @class RpcClientPublic ---- @field is_closing fun(): boolean ---- @field terminate fun() ---- @field request fun(method: string, params: table?, callback: function, notify_reply_callbacks?: function) ---- @field notify fun(methid: string, params: table?): boolean - ----@param client RpcClient ----@return RpcClientPublic +---@param client vim.lsp.rpc.Client +---@return vim.lsp.rpc.PublicClient local function public_client(client) local result = {} @@ -540,9 +598,9 @@ local function public_client(client) --- Sends a request to the LSP server and runs {callback} upon response. --- ---@param method (string) The invoked LSP method - ---@param params (table|nil) Parameters for the invoked LSP method + ---@param params (table?) Parameters for the invoked LSP method ---@param callback fun(err: lsp.ResponseError | nil, result: any) Callback to invoke - ---@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending + ---@param notify_reply_callback (function?) Callback to invoke as soon as a request is no longer pending ---@return boolean success, integer|nil request_id true, message_id if request could be sent, `false` if not function result.request(method, params, callback, notify_reply_callback) return client:request(method, params, callback, notify_reply_callback) @@ -550,7 +608,7 @@ local function public_client(client) --- Sends a notification to the LSP server. ---@param method (string) The invoked LSP method - ---@param params (table|nil): Parameters for the invoked LSP method + ---@param params (table?) Parameters for the invoked LSP method ---@return boolean `true` if notification could be sent, `false` if not function result.notify(method, params) return client:notify(method, params) @@ -559,13 +617,15 @@ local function public_client(client) return result end ---- @param dispatchers vim.rpc.Dispatchers? ---- @return vim.rpc.Dispatchers +---@param dispatchers? vim.lsp.rpc.Dispatchers +---@return vim.lsp.rpc.Dispatchers local function merge_dispatchers(dispatchers) if dispatchers then local user_dispatchers = dispatchers dispatchers = {} for dispatch_name, default_dispatch in pairs(default_dispatchers) do + ---@cast dispatch_name string + ---@cast default_dispatch function local user_dispatcher = user_dispatchers[dispatch_name] --- @type function if user_dispatcher then if type(user_dispatcher) ~= 'function' then @@ -593,9 +653,9 @@ end --- Create a LSP RPC client factory that connects via TCP to the given host --- and port --- ----@param host string ----@param port integer ----@return function +---@param host string host to connect to +---@param port integer port to connect to +---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient # function intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd function M.connect(host, port) return function(dispatchers) dispatchers = merge_dispatchers(dispatchers) @@ -640,23 +700,82 @@ function M.connect(host, port) end end +--- Create a LSP RPC client factory that connects via named pipes (Windows) +--- or unix domain sockets (Unix) to the given pipe_path (file path on +--- Unix and name on Windows) +--- +---@param pipe_path string file path of the domain socket (Unix) or name of the named pipe (Windows) to connect to +---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient#function intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd +function M.domain_socket_connect(pipe_path) + return function(dispatchers) + dispatchers = merge_dispatchers(dispatchers) + local pipe = + assert(uv.new_pipe(false), string.format('pipe with name %s could not be opened.', pipe_path)) + local closing = false + local transport = { + write = vim.schedule_wrap(function(msg) + pipe:write(msg) + end), + is_closing = function() + return closing + end, + terminate = function() + if not closing then + closing = true + pipe:shutdown() + pipe:close() + dispatchers.on_exit(0, 0) + end + end, + } + local client = new_client(dispatchers, transport) + pipe:connect(pipe_path, function(err) + if err then + vim.schedule(function() + vim.notify( + string.format('Could not connect to :%s, reason: %s', pipe_path, vim.inspect(err)), + vim.log.levels.WARN + ) + end) + return + end + local handle_body = function(body) + client:handle_body(body) + end + pipe:read_start(M.create_read_loop(handle_body, transport.terminate, function(read_err) + client:on_error(M.client_errors.READ_ERROR, read_err) + end)) + end) + + return public_client(client) + end +end + +---@class vim.lsp.rpc.ExtraSpawnParams +---@field cwd? string Working directory for the LSP server process +---@field detached? boolean Detach the LSP server process from the current process +---@field env? table Additional environment variables for LSP server process. See |vim.system| + --- Starts an LSP server process and create an LSP RPC client object to --- interact with it. Communication with the spawned process happens via stdio. For --- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect()| --- ----@param cmd (string) Command to start the LSP server. ----@param cmd_args (table) List of additional string arguments to pass to {cmd}. ----@param dispatchers table|nil Dispatchers for LSP message types. Valid ----dispatcher names are: ---- - `"notification"` ---- - `"server_request"` ---- - `"on_error"` ---- - `"on_exit"` ----@param extra_spawn_params table|nil Additional context for the LSP +---@param cmd string Command to start the LSP server. +---@param cmd_args string[] List of additional string arguments to pass to {cmd}. +--- +---@param dispatchers? vim.lsp.rpc.Dispatchers (table|nil) Dispatchers for LSP message types. +--- Valid dispatcher names are: +--- - `"notification"` +--- - `"server_request"` +--- - `"on_error"` +--- - `"on_exit"` +--- +---@param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams (table|nil) Additional context for the LSP --- server process. May contain: --- - {cwd} (string) Working directory for the LSP server process ---- - {env} (table) Additional environment variables for LSP server process ----@return RpcClientPublic|nil Client RPC object, with these methods: +--- - {detached?} (boolean) Detach the LSP server process from the current process. Defaults to false on Windows and true otherwise. +--- - {env?} (table) Additional environment variables for LSP server process +---@return vim.lsp.rpc.PublicClient? (table|nil) client RPC object, with these methods: --- - `notify()` |vim.lsp.rpc.notify()| --- - `request()` |vim.lsp.rpc.request()| --- - `is_closing()` returns a boolean indicating if the RPC is closing. -- cgit From e0112aa1d21aa01eca867f28f77bcca28aae3b39 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Tue, 2 Jan 2024 10:19:22 +0100 Subject: refactor(lsp): fix remaining luals warnings in lsp.rpc --- runtime/lua/vim/lsp/rpc.lua | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index b0d98829a6..51d6bf4f9f 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -226,6 +226,7 @@ end ---@return vim.lsp.rpc.Error function M.rpc_response_error(code, message, data) -- TODO should this error or just pick a sane error (like InternalError)? + ---@type string local code_name = assert(protocol.ErrorCodes[code], 'Invalid RPC error code') return setmetatable({ code = code, @@ -473,6 +474,7 @@ function Client:handle_body(body) type(err) == 'table', 'err must be a table. Use rpc_response_error to help format errors.' ) + ---@type string local code_name = assert( protocol.ErrorCodes[err.code], 'Errors must use protocol.ErrorCodes. Use rpc_response_error to help format errors.' @@ -620,34 +622,24 @@ end ---@param dispatchers? vim.lsp.rpc.Dispatchers ---@return vim.lsp.rpc.Dispatchers local function merge_dispatchers(dispatchers) - if dispatchers then - local user_dispatchers = dispatchers - dispatchers = {} - for dispatch_name, default_dispatch in pairs(default_dispatchers) do - ---@cast dispatch_name string - ---@cast default_dispatch function - local user_dispatcher = user_dispatchers[dispatch_name] --- @type function - if user_dispatcher then - if type(user_dispatcher) ~= 'function' then - error(string.format('dispatcher.%s must be a function', dispatch_name)) - end - -- server_request is wrapped elsewhere. - if - not (dispatch_name == 'server_request' or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason. - then - user_dispatcher = schedule_wrap(user_dispatcher) - end - --- @diagnostic disable-next-line:no-unknown - dispatchers[dispatch_name] = user_dispatcher - else - --- @diagnostic disable-next-line:no-unknown - dispatchers[dispatch_name] = default_dispatch - end + if not dispatchers then + return default_dispatchers + end + ---@diagnostic disable-next-line: no-unknown + for name, fn in pairs(dispatchers) do + if type(fn) ~= 'function' then + error(string.format('dispatcher.%s must be a function', name)) end - else - dispatchers = default_dispatchers end - return dispatchers + return { + notification = dispatchers.notification and vim.schedule_wrap(dispatchers.notification) + or default_dispatchers.notification, + on_error = dispatchers.on_error and vim.schedule_wrap(dispatchers.on_error) + or default_dispatchers.on_error, + + on_exit = dispatchers.on_exit or default_dispatchers.on_exit, + server_request = dispatchers.server_request or default_dispatchers.server_request, + } end --- Create a LSP RPC client factory that connects via TCP to the given host -- cgit From 99f1530a4f607b80f21135440e267460485b318a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 Jan 2024 19:33:16 +0100 Subject: vim-patch:d08059ab48b8 runtime(ruby): Update ftplugin and omni-complete (vim/vim#13805) https://github.com/vim/vim/commit/d08059ab48b822a25060b8a486085371ddeebcf7 Co-authored-by: dkearns --- runtime/autoload/rubycomplete.vim | 7 +++---- runtime/ftplugin/ruby.vim | 44 +++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 26 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index 3677b25aeb..6ead0fd837 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -2,8 +2,7 @@ " Language: Ruby " Maintainer: Mark Guzman " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns -" Last Change: 2020 Apr 12 +" Last Change: 2023 Dec 31 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -490,7 +489,7 @@ class VimRubyCompletion trail = "%s%s" % [ dir, sub ] tcfg = "%sconfig" % trail - if File.exists?( tcfg ) + if File.exist?( tcfg ) rails_base = trail break end @@ -503,7 +502,7 @@ class VimRubyCompletion bootfile = rails_base + "config/boot.rb" envfile = rails_base + "config/environment.rb" - if File.exists?( bootfile ) && File.exists?( envfile ) + if File.exist?( bootfile ) && File.exist?( envfile ) begin require bootfile require envfile diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index b61c1765d9..b07ed53188 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -2,8 +2,7 @@ " Language: Ruby " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns -" Last Change: 2023 Sep 1st +" Last Change: 2023 Dec 31 if (exists("b:did_ftplugin")) finish @@ -60,35 +59,38 @@ if !exists('g:ruby_version_paths') let g:ruby_version_paths = {} endif +let s:path_split = has('win32') ? ';' : ':' + function! s:query_path(root) abort - " Disabled by default for security reasons. - if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) - return [] + " Disabled by default for security reasons. + if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) || empty(a:root) + return map(split($RUBYLIB, s:path_split), 'v:val ==# "." ? "" : v:val') endif let code = "print $:.join %q{,}" - if &shell =~# 'sh' && empty(&shellxquote) - let prefix = 'env PATH='.shellescape($PATH).' ' - else - let prefix = '' - endif if &shellxquote == "'" - let path_check = prefix.'ruby --disable-gems -e "' . code . '"' + let args = ' --disable-gems -e "' . code . '"' else - let path_check = prefix."ruby --disable-gems -e '" . code . "'" + let args = " --disable-gems -e '" . code . "'" endif - let cd = haslocaldir() ? 'lcd' : 'cd' + let cd = haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd' let cwd = fnameescape(getcwd()) try exe cd fnameescape(a:root) - let s:tmp_cwd = getcwd() - if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd - \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.')) - let path = [] + for dir in split($PATH, s:path_split) + if dir !=# '.' && executable(dir . '/ruby') == 1 + let exepath = dir . '/ruby' + break + endif + endfor + if exists('l:exepath') + let path = split(system(exepath . args),',') + if v:shell_error + let path = [] + endif else - let path = split(system(path_check),',') + let path = [] endif - unlet! s:tmp_cwd exe cd cwd return path finally @@ -129,10 +131,8 @@ else if !exists('g:ruby_default_path') if has("ruby") && has("win32") ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) ) - elseif executable('ruby') && !empty($HOME) - let g:ruby_default_path = s:query_path($HOME) else - let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val') + let g:ruby_default_path = s:query_path($HOME) endif endif let s:ruby_paths = g:ruby_default_path -- cgit From b8df4b2dffcc6cb408476b41b86d47e46c06fe11 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 Jan 2024 19:33:52 +0100 Subject: vim-patch:b16fc9805535 runtime(sh): Update sh syntax and add local keyword for bash (vim/vim#13806) add `local` in shStatement https://github.com/vim/vim/commit/b16fc9805535dc6eb084142da0c87210fc102494 Co-authored-by: Lucien Grondin --- runtime/syntax/sh.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index e2b1947197..a83c020c91 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -620,7 +620,7 @@ elseif exists("b:is_bash") syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias syn keyword shStatement typeset nextgroup=shSetOption syn keyword shStatement fc hash history source suspend times type - syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout mapfile popd pushd readarray shopt source typeset + syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout local mapfile popd pushd readarray shopt source typeset else syn keyword shStatement login newgrp endif -- cgit From e98bef259abf876b90ba1f7885a36b94490e38a6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 Jan 2024 22:11:57 +0100 Subject: vim-patch:34d15155fc45 runtime(menu): regenerate synmenu https://github.com/vim/vim/commit/34d15155fc45162bc0036e97f9ddfc7b9b1630bd Co-authored-by: Christian Brabandt --- runtime/synmenu.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 43aae6f88b..ebab05ffed 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -650,7 +650,7 @@ an 50.170.390 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf") an 50.170.410 &Syntax.WXYZ.YAML :cal SetSyn("yaml") an 50.170.420 &Syntax.WXYZ.Yacc :cal SetSyn("yacc") an 50.170.440 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu") -an 50.170.440 &Syntax.WXYZ.Zserio:cal SetSyn("zserio") +an 50.170.450 &Syntax.WXYZ.Zserio :cal SetSyn("zserio") " The End Of The Syntax Menu -- cgit From 2bf68df289de12510d472f362482e5bde253cb41 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 2 Jan 2024 19:06:43 +0800 Subject: vim-patch:10b4f75d4c03 (#26846) runtime(dist/ft): improve filetype detection for *.v (V/Verilog/Coq) Patch provided by Dan Alt closes: vim/vim#13793 https://github.com/vim/vim/commit/10b4f75d4c03c1cd4f579be5fdc812ba41b72fef Co-authored-by: Christian Brabandt --- runtime/doc/filetype.txt | 1 + runtime/lua/vim/filetype/detect.lua | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 96cd0f8ab0..6c2cddea54 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -167,6 +167,7 @@ variables can be used to overrule the filetype used for certain extensions: `*.sh` g:bash_is_sh |ft-sh-syntax| `*.tex` g:tex_flavor |ft-tex-plugin| `*.typ` g:filetype_typ + `*.v` g:filetype_v `*.w` g:filetype_w |ft-cweb-syntax| For a few filetypes the global variable is used only when the filetype could diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index a1c5ac73b4..6a14c73c92 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1530,12 +1530,26 @@ function M.v(_, bufnr) -- Filetype was already detected return end + if vim.g.filetype_v then + return vim.g.filetype_v + end + local in_comment = 0 for _, line in ipairs(getlines(bufnr, 1, 200)) do - if not line:find('^%s*/') then - if findany(line, { ';%s*$', ';%s*/' }) then - return 'verilog' - elseif findany(line, { '%.%s*$', '%.%s*%(%*' }) then + if line:find('^%s*/%*') then + in_comment = 1 + end + if in_comment == 1 then + if line:find('%*/') then + in_comment = 0 + end + elseif not line:find('^%s*//') then + if + line:find('%.%s*$') and not line:find('/[/*]') + or line:find('%(%*') and not line:find('/[/*].*%(%*') + then return 'coq' + elseif findany(line, { ';%s*$', ';%s*/[/*]' }) then + return 'verilog' end end end -- cgit From 5dc0bdfe98b59bb03226167ed541d17cc5af30b1 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Tue, 2 Jan 2024 14:32:43 +0100 Subject: docs(glob): add glob module (#26853) --- runtime/doc/lua.txt | 27 +++++++++++++++++++++++++++ runtime/lua/vim/glob.lua | 18 ++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 7e0ad5f4c3..a8d36d7062 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2990,6 +2990,33 @@ vim.fs.parents({start}) *vim.fs.parents()* (string|nil) +============================================================================== +Lua module: vim.glob *vim.glob* + +vim.glob.to_lpeg({pattern}) *vim.glob.to_lpeg()* + Parses a raw glob into an |lua-lpeg| pattern. + + This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern + + Glob patterns can have the following syntax: + • `*` to match one or more characters in a path segment + • `?` to match on one character in a path segment + • `**` to match any number of path segments, including none + • `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and + JavaScript files) + • `[]` to declare a range of characters to match in a path segment (e.g., + `example.[0-9]` to match on `example.0`, `example.1`, …) + • `[!...]` to negate a range of characters to match in a path segment + (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not + `example.0`) + + Parameters: ~ + • {pattern} (string) The raw glob pattern + + Return: ~ + vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern + + ============================================================================== Lua module: vim.secure *vim.secure* diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua index 731179d727..49d6f555da 100644 --- a/runtime/lua/vim/glob.lua +++ b/runtime/lua/vim/glob.lua @@ -2,18 +2,20 @@ local lpeg = vim.lpeg local M = {} ---- Parses a raw glob into an |lpeg| pattern. +--- Parses a raw glob into an |lua-lpeg| pattern. --- --- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern +--- --- Glob patterns can have the following syntax: ---- `*` to match one or more characters in a path segment ---- `?` to match on one character in a path segment ---- `**` to match any number of path segments, including none ---- `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) ---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) ---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +--- - `*` to match one or more characters in a path segment +--- - `?` to match on one character in a path segment +--- - `**` to match any number of path segments, including none +--- - `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and JavaScript files) +--- - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +--- - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +--- ---@param pattern string The raw glob pattern ----@return vim.lpeg.Pattern pattern An |lpeg| representation of the pattern +---@return vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern function M.to_lpeg(pattern) local l = lpeg -- cgit From 67f53323446d45bad7a22e92493f6402316a8ba1 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Thu, 28 Dec 2023 18:00:30 -0500 Subject: fix(docs): clean up non-docstring comments for vimdoc gen These non-docstring comments can be included into doxygen's brief description and then appear in the succeeding function documentation. --- runtime/lua/vim/lsp/util.lua | 2 +- runtime/lua/vim/shared.lua | 2 +- runtime/lua/vim/text.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index ba7ce3c2b6..44465f6cff 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1069,7 +1069,7 @@ function M.show_document(location, offset_encoding, opts) -- location may be Location or LocationLink local range = location.range or location.targetSelectionRange if range then - --- Jump to new location (adjusting for encoding of characters) + -- Jump to new location (adjusting for encoding of characters) local row = range.start.line local col = get_line_byte_from_position(bufnr, range.start, offset_encoding) api.nvim_win_set_cursor(win, { row + 1, col }) diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index bbbc888727..fd795aae49 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -579,7 +579,7 @@ function vim.tbl_isarray(t) local count = 0 for k, _ in pairs(t) do - --- Check if the number k is an integer + -- Check if the number k is an integer if type(k) == 'number' and k == math.floor(k) then count = count + 1 else diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua index cfb0f9b821..576b962838 100644 --- a/runtime/lua/vim/text.lua +++ b/runtime/lua/vim/text.lua @@ -1,4 +1,4 @@ ---- Text processing functions. +-- Text processing functions. local M = {} -- cgit From 4e9298ecdf945b4d16c2c6e6e4ed82b97880917c Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Thu, 28 Dec 2023 17:50:05 -0500 Subject: refactor(gen_vimdoc): generate function doc from metadata, not from xml Problem: For function definitions to be included in the vimdoc (formatted) and to be exported as mpack data (unformatted), we had two internal representations of the same function/API metadata in duplicate; one is FunctionDoc (which was previously a dict), and the other is doxygen XML DOM from which vimdoc (functions sections) was generated. Solution: We should have a single path and unified data representation (i.e. FunctionDoc) that contains all the metadata and information about function APIs, from which both of mpack export and vimdoc are generated. I.e., vimdocs are no longer generated directly from doxygen XML nodes, but generated via: (XML DOM Nodes) ------------> FunctionDoc ------> mpack (unformatted) Recursive Internal | Formatting Metadata +---> vimdoc (formatted) This refactoring eliminates the hacky and ugly use of `fmt_vimhelp` in `fmt_node_as_vimhelp()` and all other helper functions! This way, `fmt_node_as_vimhelp()` can simplified as it no longer needs to handle generating of function docs, which needs to be done only in the topmost level of recursion. --- runtime/lua/vim/_meta/api.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c0dfa7635b..b6ce3fce8a 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -73,6 +73,9 @@ function vim.api.nvim__id_dictionary(dct) end function vim.api.nvim__id_float(flt) end --- @private +--- NB: if your UI doesn't use hlstate, this will not return hlstate first +--- time. +--- --- @param grid integer --- @param row integer --- @param col integer -- cgit From 91d76ac941a26f8370c48e062b5e09f98c75f7bc Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Tue, 2 Jan 2024 18:52:29 +0100 Subject: docs(lsp): add supports_method to vim.lsp.client docs (#26852) --- runtime/doc/lsp.txt | 4 ++++ runtime/lua/vim/lsp.lua | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index d53a7b4c11..bbf19f9569 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -745,6 +745,10 @@ client() *vim.lsp.client* client is fully stopped. • on_attach(client, bufnr) Runs the on_attach function from the client's config if it was defined. Useful for buffer-local setup. + • supports_method(method, [opts]): boolean Checks if a client supports a + given method. Always returns true for unknown off-spec methods. [opts] + is a optional `{bufnr?: integer}` table. Some language server + capabilities can be file specific. • Members • {id} (number): The id allocated to the client. diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 3105413b53..27c5f7ce7b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -425,6 +425,12 @@ end --- Runs the on_attach function from the client's config if it was defined. --- Useful for buffer-local setup. --- +--- - supports_method(method, [opts]): boolean +--- Checks if a client supports a given method. +--- Always returns true for unknown off-spec methods. +--- [opts] is a optional `{bufnr?: integer}` table. +--- Some language server capabilities can be file specific. +--- --- - Members --- - {id} (number): The id allocated to the client. --- -- cgit From b3eda5e73f65092d50ccd27a0373e8b9fad076b0 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 28 Dec 2023 13:49:44 +0100 Subject: docs: small fixes Co-authored-by: Christian Clason Co-authored-by: HiPhish Co-authored-by: JD Rudie --- runtime/doc/develop.txt | 6 +++--- runtime/doc/lua.txt | 14 ++++++-------- runtime/doc/luaref.txt | 4 ++-- runtime/lua/man.lua | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index f1d74326c7..28f43a70e0 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -102,11 +102,11 @@ Examples: The provider framework invokes Vimscript from C. It is composed of two functions in eval.c: -- eval_call_provider(name, method, arguments, discard): calls - provider#{name}#Call with the method and arguments. If discard is true, any +- eval_call_provider({name}, {method}, {arguments}, {discard}): Calls + `provider#{name}#Call` with {method} and {arguments}. If {discard} is true, any value returned by the provider will be discarded and empty value will be returned. -- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable +- eval_has_provider({name}): Checks the `g:loaded_{name}_provider` variable which must be set to 2 by the provider script to indicate that it is "enabled and working". Called by |has()| to check if features are available. diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index a8d36d7062..9c9a9db175 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -121,16 +121,14 @@ languages like Python and C#. Example: >lua func_with_opts { foo = true, filename = "hello.world" } < -There's nothing special going on here except that parentheses are treated as -whitespace. But visually, this small bit of sugar gets reasonably close to -a "keyword args" interface. Nvim code tends to prefer this style. - ------------------------------------------------------------------------------- -LUA PATTERNS *lua-patterns* +There's nothing special going on here except that parentheses are implicitly +added. But visually, this small bit of sugar gets reasonably close to a +"keyword args" interface. + *lua-regex* Lua intentionally does not support regular expressions, instead it has limited -"patterns" |lua-pattern| which avoid the performance pitfalls of extended -regex. Lua scripts can also use Vim regex via |vim.regex()|. +|lua-patterns| which avoid the performance pitfalls of extended regex. Lua +scripts can also use Vim regex via |vim.regex()|. Examples: >lua diff --git a/runtime/doc/luaref.txt b/runtime/doc/luaref.txt index 467b5760cf..e7b62f4c6c 100644 --- a/runtime/doc/luaref.txt +++ b/runtime/doc/luaref.txt @@ -4150,7 +4150,7 @@ string.upper({s}) *string.upper()* locale. ------------------------------------------------------------------------------ -5.4.1 Patterns *lua-patterns +5.4.1 Patterns *lua-patterns* A character class is used to represent a set of characters. The following combinations are allowed in describing a character class: @@ -4811,7 +4811,7 @@ debug.setupvalue({func}, {up}, {value}) *debug.setupvalue()* upvalue with the given index. Otherwise, it returns the name of the upvalue. -debug.traceback([{thread},] [{message}] [,{level}]) *debug.traceback()* +debug.traceback([{thread},] [{message} [,{level}]]) *debug.traceback()* Returns a string with a traceback of the call stack. An optional {message} string is appended at the beginning of the traceback. An optional {level} number tells at which level to start the traceback diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index dcdfc2b87f..ac15aff60c 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -238,7 +238,7 @@ local function get_path(sect, name, silent) -- If you run man -w strlen and string.3 comes up first, this is a problem. We -- should search for a matching named one in the results list. -- However, if you search for man -w clock_gettime, you will *only* get - -- clock_getres.2, which is the right page. Searching the resuls for + -- clock_getres.2, which is the right page. Searching the results for -- clock_gettime will no longer work. In this case, we should just use the -- first one that was found in the correct section. -- -- cgit From 3734519e3b4ba1bf19ca772104170b0ef776be46 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 2 Jan 2024 15:47:55 +0000 Subject: feat(lua): add noref to deepcopy Problem: Currently `deepcopy` hashes every single tables it copies so it can be reused. For tables of mostly unique items that are non recursive, this hashing is unnecessarily expensive Solution: Port the `noref` argument from Vimscripts `deepcopy()`. The below benchmark demonstrates the results for two extreme cases of tables of different sizes. One table that uses the same table lots of times and one with all unique tables. | test | `noref=false` (ms) | `noref=true` (ms) | | -------------------- | ------------------ | ----------------- | | unique tables (50) | 6.59 | 2.62 | | shared tables (50) | 3.24 | 6.40 | | unique tables (2000) | 23381.48 | 2884.53 | | shared tables (2000) | 3505.54 | 14038.80 | The results are basically the inverse of each other where `noref` is much more performance on tables with unique fields, and `not noref` is more performant on tables that reuse fields. --- runtime/doc/lua.txt | 13 ++++++-- runtime/doc/news.txt | 2 ++ runtime/lua/vim/diagnostic.lua | 12 +++---- runtime/lua/vim/keymap.lua | 2 +- runtime/lua/vim/lsp.lua | 2 +- runtime/lua/vim/lsp/protocol.lua | 2 +- runtime/lua/vim/shared.lua | 70 +++++++++++++++++++++------------------- runtime/lua/vim/version.lua | 6 ++-- 8 files changed, 61 insertions(+), 48 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 9c9a9db175..e01e16b8f4 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1905,15 +1905,24 @@ vim.deep_equal({a}, {b}) *vim.deep_equal()* Return: ~ (boolean) `true` if values are equals, else `false` -vim.deepcopy({orig}) *vim.deepcopy()* +vim.deepcopy({orig}, {noref}) *vim.deepcopy()* Returns a deep copy of the given object. Non-table objects are copied as in a typical Lua assignment, whereas table objects are copied recursively. Functions are naively copied, so functions in the copied table point to the same functions as those in the input table. Userdata and threads are not copied and will throw an error. + Note: `noref=true` is much more performant on tables with unique table + fields, while `noref=false` is more performant on tables that reuse table + fields. + Parameters: ~ - • {orig} (table) Table to copy + • {orig} (table) Table to copy + • {noref} (boolean|nil) When `false` (default) a contained table is + only copied once and all references point to this single + copy. When `true` every occurrence of a table results in a + new copy. This also means that a cyclic reference can cause + `deepcopy()` to fail. Return: ~ (table) Table of copied keys and (nested) values. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 03e1989e62..d3ace5f33b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -282,6 +282,8 @@ The following new APIs and features were added. |vim.diagnostic.get()| when only the number of diagnostics is needed, but not the diagnostics themselves. +• |vim.deepcopy()| has a `noref` argument to avoid hashing table values. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index a447463dff..897837a5ce 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -134,7 +134,7 @@ local function prefix_source(diagnostics) return d end - local t = vim.deepcopy(d) + local t = vim.deepcopy(d, true) t.message = string.format('%s: %s', d.source, d.message) return t end, diagnostics) @@ -146,7 +146,7 @@ local function reformat_diagnostics(format, diagnostics) diagnostics = { diagnostics, 't' }, }) - local formatted = vim.deepcopy(diagnostics) + local formatted = vim.deepcopy(diagnostics, true) for _, diagnostic in ipairs(formatted) do diagnostic.message = format(diagnostic) end @@ -373,7 +373,7 @@ local function get_diagnostics(bufnr, opts, clamp) or d.col < 0 or d.end_col < 0 then - d = vim.deepcopy(d) + d = vim.deepcopy(d, true) d.lnum = math.max(math.min(d.lnum, line_count), 0) d.end_lnum = math.max(math.min(d.end_lnum, line_count), 0) d.col = math.max(d.col, 0) @@ -636,7 +636,7 @@ function M.config(opts, namespace) if not opts then -- Return current config - return vim.deepcopy(t) + return vim.deepcopy(t, true) end for k, v in pairs(opts) do @@ -723,7 +723,7 @@ end --- ---@return table A list of active diagnostic namespaces |vim.diagnostic|. function M.get_namespaces() - return vim.deepcopy(all_namespaces) + return vim.deepcopy(all_namespaces, true) end ---@class Diagnostic @@ -756,7 +756,7 @@ function M.get(bufnr, opts) opts = { opts, 't', true }, }) - return vim.deepcopy(get_diagnostics(bufnr, opts, false)) + return vim.deepcopy(get_diagnostics(bufnr, opts, false), true) end --- Get current diagnostics count. diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index bdea95f9ab..8e4e123fe0 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -44,7 +44,7 @@ function keymap.set(mode, lhs, rhs, opts) opts = { opts, 't', true }, }) - opts = vim.deepcopy(opts or {}) + opts = vim.deepcopy(opts or {}, true) ---@cast mode string[] mode = type(mode) == 'string' and { mode } or mode diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 27c5f7ce7b..b2aa943359 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1353,7 +1353,7 @@ function lsp.start_client(config) ---@param context? {bufnr: integer} ---@param handler? lsp.Handler only called if a server command function client._exec_cmd(command, context, handler) - context = vim.deepcopy(context or {}) --[[@as lsp.HandlerContext]] + context = vim.deepcopy(context or {}, true) --[[@as lsp.HandlerContext]] context.bufnr = context.bufnr or api.nvim_get_current_buf() context.client_id = client.id local cmdname = command.command diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index df12c36396..35eb0305d7 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -314,7 +314,7 @@ local constants = { } for k, v in pairs(constants) do - local tbl = vim.deepcopy(v) + local tbl = vim.deepcopy(v, true) vim.tbl_add_reverse_lookup(tbl) protocol[k] = tbl end diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index bbbc888727..87ab21a28f 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -9,43 +9,36 @@ ---@diagnostic disable-next-line: lowercase-global vim = vim or {} -local function _id(v) - return v -end +---@generic T +---@param orig T +---@param cache? table +---@return T +local function deepcopy(orig, cache) + if orig == vim.NIL then + return vim.NIL + elseif type(orig) == 'userdata' or type(orig) == 'thread' then + error('Cannot deepcopy object of type ' .. type(orig)) + elseif type(orig) ~= 'table' then + return orig + end -local deepcopy + --- @cast orig table -local deepcopy_funcs = { - table = function(orig, cache) - if cache[orig] then - return cache[orig] - end - local copy = {} + if cache and cache[orig] then + return cache[orig] + end + local copy = {} --- @type table + + if cache then cache[orig] = copy - local mt = getmetatable(orig) - for k, v in pairs(orig) do - copy[deepcopy(k, cache)] = deepcopy(v, cache) - end - return setmetatable(copy, mt) - end, - number = _id, - string = _id, - ['nil'] = _id, - boolean = _id, - ['function'] = _id, -} - -deepcopy = function(orig, _cache) - local f = deepcopy_funcs[type(orig)] - if f then - return f(orig, _cache or {}) - else - if type(orig) == 'userdata' and orig == vim.NIL then - return vim.NIL - end - error('Cannot deepcopy object of type ' .. type(orig)) end + + for k, v in pairs(orig) do + copy[deepcopy(k, cache)] = deepcopy(v, cache) + end + + return setmetatable(copy, getmetatable(orig)) end --- Returns a deep copy of the given object. Non-table objects are copied as @@ -54,11 +47,20 @@ end --- same functions as those in the input table. Userdata and threads are not --- copied and will throw an error. --- +--- Note: `noref=true` is much more performant on tables with unique table +--- fields, while `noref=false` is more performant on tables that reuse table +--- fields. +--- ---@generic T: table ---@param orig T Table to copy +---@param noref? boolean +--- When `false` (default) a contained table is only copied once and all +--- references point to this single copy. When `true` every occurrence of a +--- table results in a new copy. This also means that a cyclic reference can +--- cause `deepcopy()` to fail. ---@return T Table of copied keys and (nested) values. -function vim.deepcopy(orig) - return deepcopy(orig) +function vim.deepcopy(orig, noref) + return deepcopy(orig, not noref and {} or nil) end --- Gets an |iterator| that splits a string at each instance of a separator, in "lazy" fashion diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua index 306eef90d3..0873402e29 100644 --- a/runtime/lua/vim/version.lua +++ b/runtime/lua/vim/version.lua @@ -158,7 +158,7 @@ end function M._version(version, strict) -- Adapted from https://github.com/folke/lazy.nvim if type(version) == 'table' then if version.major then - return setmetatable(vim.deepcopy(version), Version) + return setmetatable(vim.deepcopy(version, true), Version) end return setmetatable({ major = version[1] or 0, @@ -228,7 +228,7 @@ function VersionRange:has(version) version = M.parse(version) elseif getmetatable(version) ~= Version then -- Need metatable to compare versions. - version = setmetatable(vim.deepcopy(version), Version) + version = setmetatable(vim.deepcopy(version, true), Version) end if version then if version.prerelease ~= self.from.prerelease then @@ -298,7 +298,7 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim local semver = M.parse(version) if semver then local from = semver - local to = vim.deepcopy(semver) + local to = vim.deepcopy(semver, true) if mods == '' or mods == '=' then to.patch = to.patch + 1 elseif mods == '<' then -- cgit From 5dbf6ab9b1027b4b5d3703a0ccc1d298cbe6c018 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 4 Jan 2024 05:45:26 +0800 Subject: vim-patch:9.1.0004: reloading colorscheme when not changing 'background' (#26877) Problem: reloading colorscheme when not changing 'background' Solution: Check, if the background option value actually changed, if not, return early. Only reload colorscheme when bg is changed Currently the highlight groups are re-initialized and the colorscheme (if any) is reloaded anytime 'background' is set, even if it is not changed. This is unnecessary, because if the value was not changed then there is no need to change highlight groups or do anything with the colorscheme. Instead, only reload the colorscheme if the value of 'background' was actually changed. closes: vim/vim#13700 https://github.com/vim/vim/commit/83ad2726ff56db70cb2da78e1e4ea0e09941c73b Co-authored-by: Gregory Anders --- runtime/doc/vim_diff.txt | 2 -- 1 file changed, 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 5b0b5655b4..279fdd646f 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -302,8 +302,6 @@ Options: global-local string options work. 'autoread' works in the terminal (if it supports "focus" events) - 'background' colorscheme is only reloaded if value is changed, not every - time it is set 'cpoptions' flags: |cpo-_| 'diffopt' "linematch" feature 'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The -- cgit From 8a6317e70a3aa680fd3332d5c20e63b96e858812 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 3 Jan 2024 18:03:04 +0100 Subject: vim-patch:d4634a26cdcd runtime(vim): Add support for `syntax foldlevel` command (vim/vim#6182) https://github.com/vim/vim/commit/d4634a26cdcdbd0f22ec608bb4954cd7eb8db528 Co-authored-by: Brad King --- runtime/syntax/vim.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index e494e40204..c4e0c4eabc 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -505,6 +505,13 @@ syn match vimGroupAdd contained "add=" nextgroup=vimGroupList syn match vimGroupRem contained "remove=" nextgroup=vimGroupList syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem +" Syntax: foldlevel {{{2 +syn keyword vimSynType contained foldlevel skipwhite nextgroup=vimSynFoldMethod,vimSynFoldMethodError +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynfoldmethoderror") + syn match vimSynFoldMethodError contained "\i\+" +endif +syn keyword vimSynFoldMethod contained start minimum + " Syntax: iskeyword {{{2 syn keyword vimSynType contained iskeyword skipwhite nextgroup=vimIskList syn match vimIskList contained '\S\+' contains=vimIskSep @@ -853,6 +860,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimMapModErr vimError hi def link vimSubstFlagErr vimError hi def link vimSynCaseError vimError + hi def link vimSynFoldMethodError vimError hi def link vimBufnrWarn vimWarn endif @@ -989,6 +997,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimSyncNone Type hi def link vimSynContains vimSynOption hi def link vimSynError Error + hi def link vimSynFoldMethodError Error + hi def link vimSynFoldMethod Type hi def link vimSynKeyContainedin vimSynContains hi def link vimSynKeyOpt vimSynOption hi def link vimSynMtchGrp vimSynOption -- cgit From 39ea076f2fa1b542efa85e4128a63b8a4da371fe Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 3 Jan 2024 18:03:31 +0100 Subject: vim-patch:80beeef0c6a4 runtime(vim): Add support for syntax (vim/vim#10686) Adding `` to list of angle-bracket notation syntax, just like `` `` is already highlighted. ```vim nnoremap o Oldfiles() ``` `` is not. https://github.com/vim/vim/commit/80beeef0c6a4c44b190631725bce3dcc5635e3ee Co-authored-by: dezza <402927+dezza@users.noreply.github.com> --- runtime/syntax/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index c4e0c4eabc..049c18bba1 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -436,7 +436,7 @@ syn match vimMenuBang "!" contained skipwhite nextgroup=@vimMenuList " Angle-Bracket Notation: (tnx to Michael Geddes) {{{2 " ====================== syn case ignore -syn match vimNotation "\%#=1\(\\\|\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cmd\|cr\|lf\|linefeed\|return\|enter\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|mouse\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cmd\|scriptcmd\|cr\|lf\|linefeed\|return\|enter\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|mouse\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket syn match vimNotation "\%#=1\(\\\|\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket syn match vimNotation "\%#=1\(\\\|\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket syn match vimNotation '\(\\\|\)\=[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket -- cgit From 166b4284c83a6be993be6b185d5ecd168570c7ff Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 3 Jan 2024 18:05:04 +0100 Subject: vim-patch:b1392bee701d runtime(doc): document that the diff filetype uses Diff hl groups related: vim/vim#13776 https://github.com/vim/vim/commit/b1392bee701d887b66b596c9af26bfcb6f0614b8 Co-authored-by: Christian Brabandt --- runtime/doc/syntax.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 40c102341b..36ce0297f3 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1224,7 +1224,7 @@ To highlight KDE-reserved features, set > g:desktop_enable_kde follows g:desktop_enable_nonstd if not supplied -DIFF *diff.vim* +DIFF *diff.vim* *ft-diff-syntax* The diff highlighting normally finds translated headers. This can be slow if there are very long lines in the file. To disable translations: > @@ -1233,7 +1233,15 @@ there are very long lines in the file. To disable translations: > Also see |diff-slow|. +Since the Vim 9.1 release the diff filetype links the diffAdded, +diffRemoved and diffChanged highlighting groups to |hl-DiffAdd|, +|hl-DiffDelete| and |hl-DiffChange| by default. If you do not want this, you +can change it to the previous groups like this in your |vimrc| > + hi link diffRemoved Special + hi link diffChanged PreProc + hi link diffAdded Identifier +< DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* The dircolors utility highlighting definition has one option. It exists to -- cgit From 9b90657376754a492d19f1daaffb257bf87d09cf Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 3 Jan 2024 19:58:46 +0100 Subject: vim-patch:d94ca966ca6d runtime(fortran): syntax and documentation updates (vim/vim#13811) closes: vim/vim#13802 https://github.com/vim/vim/commit/d94ca966ca6d85d3dd03c8b68ff6a4cbae4da1af Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com> --- runtime/doc/syntax.txt | 24 ++--- runtime/syntax/fortran.vim | 227 +++++++++++++++++++++------------------------ 2 files changed, 116 insertions(+), 135 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 36ce0297f3..84121be4d6 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1636,27 +1636,19 @@ Unfortunately, the use of tabs will mean that the syntax file will not be able to detect incorrect margins. Syntax folding of Fortran files ~ -If you wish to use foldmethod=syntax, then you must first set the variable -fortran_fold with a command such as > +Vim will fold your file using foldmethod=syntax, if you set the variable +fortran_fold in your .vimrc with a command such as > :let fortran_fold=1 to instruct the syntax script to define fold regions for program units, that is main programs starting with a program statement, subroutines, function -subprograms, modules, submodules, and block data units. Block, interface, -associate, critical, type definition, and change team constructs will also be -folded. If you also set the variable fortran_fold_conditionals with a command -such as > +subprograms, modules, submodules, blocks of comment lines, and block data +units. Block, interface, associate, critical, type definition, and change team +constructs will also be folded. If you also set the variable +fortran_fold_conditionals with a command such as > :let fortran_fold_conditionals=1 then fold regions will also be defined for do loops, if blocks, select case, -select type, and select rank constructs. If you also set the variable -fortran_fold_multilinecomments with a command such as > - :let fortran_fold_multilinecomments=1 -then fold regions will also be defined for three or more consecutive comment -lines. Note that defining fold regions can be slow for large files. - -If fortran_fold, and possibly fortran_fold_conditionals and/or -fortran_fold_multilinecomments, have been set, then vim will fold your file. -Comments or blank lines placed between two program units are not folded -because they are seen as not belonging to any program unit. +select type, and select rank constructs. Note that defining fold regions can +be slow for large files. The syntax/fortran.vim script contains embedded comments that tell you how to comment and/or uncomment some lines to (a) activate recognition of some diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 99e11528de..1fb8a1c424 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, and 77) -" Version: (v109) 2023 December 29 +" Version: (v110) 2024 January 03 " Maintainers: Ajit J. Thakkar ; " Joshua Hollett " Usage: For instructions, do :help fortran-syntax from Vim @@ -68,18 +68,18 @@ if b:fortran_fixed_source == 1 else syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:" endif -syn match fortranConstructName "\(\" -syn match fortranConstructName "\(\" -syn match fortranConstructName "\(\" - -syn match fortranUnitName "\(\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\s\+\)\@12<=\a\w\+" -syn match fortranUnitHeader "\" +syn match fortranConstructName "\%(\" +syn match fortranConstructName "\%(\" + +syn match fortranUnitName "\%(\<\%(end\s*\)\?\%(subroutine\|function\|module\|program\|submodule\)\s\+\)\@12<=\a\w\+" +syn match fortranUnitHeader "\\ze\s*\%(!.*\)\?$" syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh syn keyword fortranIntrinsicR achar iachar transfer dble dprod dim lge lgt lle llt mod @@ -91,7 +91,7 @@ syn keyword fortranIntrinsic dot_product eoshift exponent floor fraction iand syn keyword fortranIntrinsic modulo mvbits nearest pack precision present radix random_number random_seed range repeat reshape rrspacing scale scan set_exponent shape size spacing "syn keyword fortranIntrinsic count epsilon maxval minval product sum huge tiny " intrinsic names often used for variables in older Fortran code -syn match fortranIntrinsic '\<\(count\|epsilon\|maxval\|minval\|product\|sum\|huge\|tiny\)\>\ze\s*(' +syn match fortranIntrinsic '\<\%(count\|epsilon\|maxval\|minval\|product\|sum\|huge\|tiny\)\>\ze\s*(' syn keyword fortranIntrinsic spread system_clock transpose trim ubound unpack verify syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image @@ -116,30 +116,30 @@ syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cq syn keyword fortranType generic final enumerator import syn keyword fortranType c_ptr c_funptr elemental pure impure recursive non_recursive -syn match fortranTypeOb "^\s*\(character\s*\)\@15<=\*" -syn match fortranType "^\s*\(implicit \)\?\s*\(real\|integer\|logical\|complex\|character\|type\)\>" -syn match fortranType "^\s*implicit\s\+none" -syn match fortranType "\(class\|type\)\(of\)\?" -syn match fortranType "\(end\s*\)\?\" +syn match fortranTypeOb "^\s*\zs\%(character\s*\)\@15<=\*" +syn match fortranType "^\s*\zs\%(implicit\s\+\)\?\%(real\|integer\|logical\|complex\|character\|type\)\>" +syn match fortranType "^\s*\zsimplicit\s\+none\>" +syn match fortranType "\<\%(class\|type\)\%(of\)\?\>" +syn match fortranType "\<\%(end\s*\)\?interface\>" syn match fortranType "\" -syn match fortranType "\(end\s*\)\?enumeration\s\+type" -syn match fortranType "\(end\s*\)\?\(\" -syn match fortranTypeR display "double\s*precision" -syn match fortranTypeR display "double\s\+complex" +syn match fortranType "\" +syn match fortranType "\<\%(end\s*\)\?enumeration\s\+type" +syn match fortranType "\<\%(end\s*\)\?\%(module\s\+\)\?procedure\>" +syn match fortranTypeR display "\" +syn match fortranTypeR display "\" syn keyword fortranAttribute value bind deferred contiguous intrinsic non_intrinsic syn keyword fortranAttribute asynchronous nopass non_overridable pass volatile extends syn keyword fortranAttribute abstract external private public protected intent optional syn keyword fortranAttribute pointer target allocatable dimension codimension sequence parameter save syn keyword fortranUnitHeader result operator assignment -syn match fortranUnitHeader "\<\(end\s*\)\?\(subroutine\|function\|module\|program\|submodule\)\>" -syn match fortranBlock "\<\(end\s*\)\?\(block\|critical\|associate\)\>" -syn match fortranCalled "\(call\s\+\)\@7<=\a\w*" +syn match fortranUnitHeader "\<\%(end\s*\)\?\%(subroutine\|function\|module\|program\|submodule\)\>" +syn match fortranBlock "\<\%(end\s*\)\?\%(block\|critical\|associate\)\>" +syn match fortranCalled "\<\%(call\s\+\)\@7<=\a\w*" syn match fortranRepeat "\" syn keyword fortranRepeat concurrent syn keyword fortranRepeatR while -syn match fortranRepeat "\" syn keyword fortranRepeatOb forall syn match fortranRepeatOb "\" @@ -150,16 +150,16 @@ syn region fortranParen transparent start="(" end=")" contains=ALLBUT,fortranPar syn match fortranParenError ")" syn match fortranOperator "\.\s*n\=eqv\s*\." -syn match fortranOperator "\.\s*\(and\|or\|not\)\s*\." -syn match fortranOperator "\(+\|-\|/\|\*\)" -syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" -syn match fortranOperator "\(%\|?\|=>\)" -syn match fortranOperator "\([\|]\)" +syn match fortranOperator "\.\s*\%(and\|or\|not\)\s*\." +syn match fortranOperator "\%(+\|-\|/\|\*\)" +syn match fortranOperator "\%(\%(>\|<\)=\=\|==\|/=\|=\)" +syn match fortranOperator "\%(%\|?\|=>\)" +syn match fortranOperator "\%([\|]\)" syn match fortranOperatorR "\.\s*[gl][et]\s*\." -syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." +syn match fortranOperatorR "\.\s*\%(eq\|ne\)\s*\." syn keyword fortranReadWrite print flush -syn match fortranReadWrite '\<\(backspace\|close\|endfile\|inquire\|open\|read\|rewind\|write\)\ze\s*(' +syn match fortranReadWrite '\<\%(backspace\|close\|endfile\|inquire\|open\|read\|rewind\|write\)\ze\s*(' "If tabs are allowed then the left margin checks do not work if exists("fortran_have_tabs") @@ -170,17 +170,17 @@ endif "Numbers of various sorts " Integers -syn match fortranNumber display "\<\d\+\(_\a\w*\)\=\>" +syn match fortranNumber display "\<\d\+\%(_\a\w*\)\=\>" " floating point number, without a decimal point -syn match fortranFloatIll display "\<\d\+[deq][-+]\=\d\+\(_\a\w*\)\=\>" +syn match fortranFloatIll display "\<\d\+[deq][-+]\=\d\+\%(_\a\w*\)\=\>" " floating point number, starting with a decimal point -syn match fortranFloatIll display "\.\d\+\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" +syn match fortranFloatIll display "\.\d\+\%([deq][-+]\=\d\+\)\=\%(_\a\w*\)\=\>" " floating point number, no digits after decimal -syn match fortranFloatIll display "\<\d\+\.\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" +syn match fortranFloatIll display "\<\d\+\.\%([deq][-+]\=\d\+\)\=\%(_\a\w*\)\=\>" " floating point number, D or Q exponents -syn match fortranFloatIll display "\<\d\+\.\d\+\([dq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" +syn match fortranFloatIll display "\<\d\+\.\d\+\%([dq][-+]\=\d\+\)\=\%(_\a\w*\)\=\>" " floating point number -syn match fortranFloat display "\<\d\+\.\d\+\(e[-+]\=\d\+\)\=\(_\a\w*\)\=\>" +syn match fortranFloat display "\<\d\+\.\d\+\%(e[-+]\=\d\+\)\=\%(_\a\w*\)\=\>" " binary number syn match fortranBinary display "b["'][01]\+["']" " octal number @@ -189,30 +189,29 @@ syn match fortranOctal display "o["'][0-7]\+["']" syn match fortranHex display "z["'][0-9A-F]\+["']" " Numbers in formats syn match fortranFormatSpec display "\d*f\d\+\.\d\+" -syn match fortranFormatSpec display "\d*e[sn]\=\d\+\.\d\+\(e\d+\>\)\=" -syn match fortranFormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\=" +syn match fortranFormatSpec display "\d*e[sn]\=\d\+\.\d\+\%(e\d+\>\)\=" +syn match fortranFormatSpec display "\d*\%(d\|q\|g\)\d\+\.\d\+\%(e\d+\)\=" syn match fortranFormatSpec display "\d\+x\>" " The next match cannot be used because it would pick up identifiers as well -" syn match fortranFormatSpec display "\<\(a\|i\)\d\+" +" syn match fortranFormatSpec display "\<\%(a\|i\)\d\+" " Numbers as labels -syn match fortranLabelNumber display "^\d\{1,5}\s"me=e-1 -syn match fortranLabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1 -syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1 -syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1 -syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1 +syn match fortranLabelNumber display "^\zs\d\{1,5}\ze\s" +syn match fortranLabelNumber display "^ \zs\d\{1,4}\ze\s" +syn match fortranLabelNumber display "^ \zs\d\{1,3}\ze\s" +syn match fortranLabelNumber display "^ \zs\d\d\=\ze\s" +syn match fortranLabelNumber display "^ \zs\d\ze\s" " Numbers as targets -syn match fortranTarget display "\(\" -syn match fortranTarget display "\(\" -syn match fortranTarget display "\(\" +syn match fortranTarget display "\%(\" +syn match fortranTarget display "\%(\" +syn match fortranTarget display "\%(\" -syn match fortranBoolean "\.\s*\(true\|false\)\s*\." +syn match fortranBoolean "\.\s*\%(true\|false\)\s*\." -syn match fortranKeyword "call" +syn keyword fortranKeyword call syn keyword fortranKeyword use only contains -syn match fortranKeyword "fail\s\+image\>" -syn match fortranKeyword "\(error\s\+\)\=stop" -syn match fortranKeyword "\" -syn match fortranKeyword "^\s*\d\+\s\+continue\>" +syn match fortranKeyword "\" +syn match fortranKeyword "\<\%(error\s\+\)\=stop\>" +syn keyword fortranKeyword continue syn match fortranKeyword "\" syn match fortranKeywordDel "\" -syn match fortranConditional "\" -syn match fortranConditional "\(case\|rank\)\(\s\+default\)\?" +syn match fortranConditional "\" +syn match fortranConditional "\<\%(end\s*\)\?\%(if\|where\|select\)\>" +syn match fortranConditional "\" +syn match fortranConditional "\<\%(class\|type\)\s\+is\>" +syn match fortranConditional "\<\%(case\|rank\)\%(\s\+default\)\?\>" syn match fortranConditionalDel "\" -syn match fortranImageControl "\(change\|form\|end\)\s\+team\>" -syn match fortranImageControl "event\s\+\(post\|wait\)" -syn match fortranImageControl "\(un\)\?lock\ze\s*(" -syn match fortranImageControl "notify\s\+wait\ze\s*(" +syn match fortranImageControl "\" +syn match fortranImageControl "\<\%(change\|form\|end\)\s\+team\>" +syn match fortranImageControl "\" syn keyword fortranStorageClass in out syn match fortranStorageClass "\" syn match fortranStorageClass "\\(\s\+\a\w*\s*/\)\@=" -syn match fortranStorageClassOb "^\s*common\>" -syn match fortranStorageClassOb "^\s*common\>\(\s*/\)\@=" +syn match fortranStorageClass "^\s*\zsdata\>\%(\s\+\a\w*\s*/\)\@=" +syn match fortranStorageClassOb "^\s*\zscommon\>" +syn match fortranStorageClassOb "^\s*\zscommon\>\%(\s*/\)\@=" syn keyword fortranStorageClassOb equivalence syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab @@ -284,10 +283,10 @@ if exists("fortran_CUDA") syn keyword fortranTypeCUDA cudaErrorNotReady cudaSuccess cudaErrorInvalidValue syn keyword fortranTypeCUDA c_devptr - syn match fortranStringCUDA "blockidx%[xyz]" - syn match fortranStringCUDA "blockdim%[xyz]" - syn match fortranStringCUDA "griddim%[xyz]" - syn match fortranStringCUDA "threadidx%[xyz]" + syn match fortranStringCUDA "\" + syn match fortranStringCUDA "\" + syn match fortranStringCUDA "\" + syn match fortranStringCUDA "\" syn keyword fortranIntrinsicCUDA warpsize syncthreads syncthreads_and syncthreads_count syncthreads_or threadfence threadfence_block threadfence_system gpu_time allthreads anythread ballot syn keyword fortranIntrinsicCUDA atomicadd atomicsub atomicmax atomicmin atomicand atomicor atomicxor atomicexch atomicinc atomicdec atomiccas sizeof __shfl __shfl_up __shfl_down __shfl_xor @@ -325,14 +324,14 @@ else endif syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell -syn match fortranOpenMP excludenl "^\s*!\$\(OMP\)\=&\=\s.*$" +syn match fortranOpenMP excludenl "^\s*\zs!\$\%(OMP\)\=&\=\s.*$" syn match fortranEndStatement display ";" "cpp is often used with Fortran -syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*" -syn match cPreProc "^\s*#\s*\(elif\|if\)\>.*" -syn match cPreProc "^\s*#\s*\(ifndef\|undef\)\>.*" -syn match cPreCondit "^\s*#\s*\(else\|endif\)\>.*" +syn match cPreProc "^\s*#\s*\%(define\|ifdef\)\>.*" +syn match cPreProc "^\s*#\s*\%(elif\|if\)\>.*" +syn match cPreProc "^\s*#\s*\%(ifndef\|undef\)\>.*" +syn match cPreCondit "^\s*#\s*\%(else\|endif\)\>.*" syn region cIncluded contained start=+"[^("]+ skip=+\\\\\|\\"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber "syn region cIncluded contained start=+"[^("]+ skip=+\\\\\|\\"+ end=+"+ syn match cIncluded contained "<[^>]*>" @@ -353,61 +352,50 @@ if exists("fortran_fold") setlocal foldmethod=syntax endif if (b:fortran_fixed_source == 1) - syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranModule - syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranProgram - syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranModule + syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\%(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranModule transparent fold keepend start="^\s*module\s\+\%(procedure\)\@!\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\\)\=\|$\)" contains=ALLBUT,fortranProgram + syn region fortranFunction transparent fold keepend extend start="^\s*\%(elemental \|pure \|impure \|module \|recursive \)\=\s*\%(\%(\%(real \|integer \|logical \|complex \|double \s*precision \)\s*\%((\%(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \%((\%(\s*len\s*=\)\=\s*\d\+\s*)\|(\%(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule + syn region fortranSubroutine transparent fold keepend extend start="^\s*\%(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranBlockData transparent fold keepend start="\" skip="^\s*[!#].*$" excludenl end="\" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock - syn region fortranAssociate transparent fold keepend start="^\s*\ Date: Mon, 25 Dec 2023 02:31:47 +0900 Subject: fix(decorations): validate botline for on_win Problem: Many decoration providers (treesitter injection highlighting, semantic token highlighting, inlay hint) rely on the correctness of the `botline` argument of `on_win` callback. However, `botline` can be smaller than the actual line number of the last displayed line if some lines are folded. In such cases, some decorations will be missing in the lines not covered by `botline`. Solution: Validate `botline` when invoking `on_win`. NOTE: It seems that the old code was deliberately avoiding this presumably due to performance reasons. However, I haven't experienced noticeable lag after this change, and I believe the cost of botline computation would be much smaller than the cost of decoration providers. --- runtime/doc/api.txt | 4 +--- runtime/lua/vim/_meta/api.lua | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index e3063b0591..07e4473ac2 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2841,9 +2841,7 @@ nvim_set_decoration_provider({ns_id}, {*opts}) • on_buf: called for each buffer being redrawn (before window callbacks) ["buf", bufnr, tick] • on_win: called when starting to redraw a specific window. - botline_guess is an approximation that does not exceed the - last line number. ["win", winid, bufnr, topline, - botline_guess] + ["win", winid, bufnr, topline, botline] • on_line: called for each buffer line being redrawn. (The interaction with fold lines is subject to change) ["win", winid, bufnr, row] diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c0dfa7635b..02128b66b9 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1761,9 +1761,7 @@ function vim.api.nvim_set_current_win(window) end --- • on_buf: called for each buffer being redrawn (before window --- callbacks) ["buf", bufnr, tick] --- • on_win: called when starting to redraw a specific window. ---- botline_guess is an approximation that does not exceed the ---- last line number. ["win", winid, bufnr, topline, ---- botline_guess] +--- ["win", winid, bufnr, topline, botline] --- • on_line: called for each buffer line being redrawn. (The --- interaction with fold lines is subject to change) ["win", --- winid, bufnr, row] -- cgit From fa61e0c047954e7eb494ee02144a4dc71a42b3b2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 1 Jan 2024 14:24:48 +0100 Subject: refactor(column): define and use maximum 'statuscolumn' width Problem: The maximum 'statuscolumn' width and grow behavior is undocumented. Solution: Define, use and document the maximum 'statuscolumn' width and grow behavior. --- runtime/doc/options.txt | 10 +++++++--- runtime/lua/vim/_meta/options.lua | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 176c8ca3db..117e9c9ec8 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5923,9 +5923,13 @@ A jump table for the options with a short description can be found at |Q_op|. %s sign column for currently drawn line %C fold column for currently drawn line - NOTE: To draw the sign and fold columns, their items must be included in - 'statuscolumn'. Even when they are not included, the status column width - will adapt to the 'signcolumn' and 'foldcolumn' width. + The 'statuscolumn' width follows that of the default columns and + adapts to the |'numberwidth'|, |'signcolumn'| and |'foldcolumn'| option + values (regardless of whether the sign and fold items are present). + Aditionally, the 'statuscolumn' grows with the size of the evaluated + format string, up to a point (following the maximum size of the default + fold, sign and number columns). Shrinking only happens when the number + of lines in a buffer changes, or the 'statuscolumn' option is set. The |v:lnum| variable holds the line number to be drawn. The |v:relnum| variable holds the relative line number to be drawn. diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 46497179ac..7ad720b6b2 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6359,9 +6359,13 @@ vim.go.sol = vim.go.startofline --- %s sign column for currently drawn line --- %C fold column for currently drawn line --- ---- NOTE: To draw the sign and fold columns, their items must be included in ---- 'statuscolumn'. Even when they are not included, the status column width ---- will adapt to the 'signcolumn' and 'foldcolumn' width. +--- The 'statuscolumn' width follows that of the default columns and +--- adapts to the `'numberwidth'`, `'signcolumn'` and `'foldcolumn'` option +--- values (regardless of whether the sign and fold items are present). +--- Aditionally, the 'statuscolumn' grows with the size of the evaluated +--- format string, up to a point (following the maximum size of the default +--- fold, sign and number columns). Shrinking only happens when the number +--- of lines in a buffer changes, or the 'statuscolumn' option is set. --- --- The `v:lnum` variable holds the line number to be drawn. --- The `v:relnum` variable holds the relative line number to be drawn. -- cgit From 88eb0ad149d353c475455e4013cafa6db2a3f9f1 Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Thu, 4 Jan 2024 15:51:52 -0600 Subject: fix(health): fix tmux RGB capability detection (#26886) tmux indicates its RGB support via setrgbb and setrgbf. In modern tmux code, Tc and RGB just set setrgbb and setrgbf, so we can just check for them. Link: https://github.com/tmux/tmux/commit/7eb496c00c313c2f8ab8debe6d154d5ac0db277b --- runtime/lua/nvim/health.lua | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua index afab6f824d..5a643db0ba 100644 --- a/runtime/lua/nvim/health.lua +++ b/runtime/lua/nvim/health.lua @@ -324,24 +324,17 @@ local function check_tmux() end -- check for RGB capabilities - local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' }) - info = vim.split(vim.trim(info), ',', { trimempty = true }) - if not vim.list_contains(info, 'RGB') then - local has_rgb = false - if #info == 0 then - -- client_termfeatures may not be supported; fallback to checking show-messages - info = vim.fn.system({ 'tmux', 'show-messages', '-JT' }) - has_rgb = info:find(' Tc: (flag) true', 1, true) or info:find(' RGB: (flag) true', 1, true) - end - if not has_rgb then - health.warn( - "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.", - { - "Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-features ',XXX:RGB'", - "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'", - } - ) - end + local info = vim.fn.system({ 'tmux', 'show-messages', '-T' }) + local has_setrgbb = vim.fn.stridx(info, ' setrgbb: (string)') ~= -1 + local has_setrgbf = vim.fn.stridx(info, ' setrgbf: (string)') ~= -1 + if not has_setrgbb or not has_setrgbf then + health.warn( + "True color support could not be detected. |'termguicolors'| won't work properly.", + { + "Add the following to your tmux configuration file, replacing XXX by the value of $TERM outside of tmux:\nset-option -a terminal-features 'XXX:RGB'", + "For older tmux versions use this instead:\nset-option -a terminal-overrides 'XXX:Tc'", + } + ) end end -- cgit From dab584408211a39962a7313b7b8c4cb7e3717a7a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jan 2024 08:23:51 +0800 Subject: vim-patch:9.1.0010: Keymap completion is not available (#26888) Problem: Keymap completion is not available Solution: Add keymap completion (Doug Kearns) Add keymap completion to the 'keymap' option, user commands and builtin completion functions. closes: vim/vim#13692 https://github.com/vim/vim/commit/81642d9d6ff5cd6a90a012b1b98632ce51eeb1a8 Co-authored-by: Doug Kearns --- runtime/doc/builtin.txt | 1 + runtime/doc/map.txt | 1 + runtime/lua/vim/_meta/vimfn.lua | 1 + 3 files changed, 3 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 98201c0eed..5f89082b6f 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2372,6 +2372,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* help help subjects highlight highlight groups history |:history| suboptions + keymap keyboard mappings locale locale names (as output of locale -a) mapclear buffer argument mapping mapping name diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 6f61259af0..d1f61dce85 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1389,6 +1389,7 @@ completion can be enabled: -complete=help help subjects -complete=highlight highlight groups -complete=history :history suboptions + -complete=keymap keyboard mappings -complete=locale locale names (as output of locale -a) -complete=lua Lua expression |:lua| -complete=mapclear buffer argument diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 02e794ce10..a763be93b9 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2889,6 +2889,7 @@ function vim.fn.getcmdwintype() end --- help help subjects --- highlight highlight groups --- history |:history| suboptions +--- keymap keyboard mappings --- locale locale names (as output of locale -a) --- mapclear buffer argument --- mapping mapping name -- cgit From f38f86b1ad8ad2ae3236f36e56fcdb416f679e65 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Jan 2024 06:19:19 +0800 Subject: vim-patch:9.1.0007: can select empty inner text blocks Problem: can select empty inner text blocks (laurentalacoque) Solution: make selecting empty inner text blocks an error textobjects: Make selecting inner empty blocks an error fixes: vim/vim#13514 closes: vim/vim#13523 https://github.com/vim/vim/commit/ad4d7f446dc6754bde212234d46f4849b520b6e0 Co-authored-by: Christian Brabandt --- runtime/doc/motion.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index b72dd8d39c..03fe5c7b81 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -578,7 +578,8 @@ i] *v_i]* *v_i[* *i]* *i[* i[ "inner [] block", select [count] '[' ']' blocks. This goes backwards to the [count] unclosed '[', and finds the matching ']'. The enclosed text is selected, - excluding the '[' and ']'. The |cpo-M| option flag + excluding the '[' and ']'. It's an error to select an + empty inner block like "[]". The |cpo-M| option flag is used to handle escaped brackets. When used in Visual mode it is made charwise. @@ -596,7 +597,8 @@ i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see |[(|). If the cursor is not inside a () block, then - find the next "(". The |cpo-M| option flag + find the next "(". It's an error to select an empty + inner block like "()". The |cpo-M| option flag is used to handle escaped parenthesis. When used in Visual mode it is made charwise. @@ -610,8 +612,9 @@ a< "a <> block", select [count] <> blocks, from the i> *v_i>* *v_i<* *i>* *i<* i< "inner <> block", select [count] <> blocks, from the [count]'th unmatched '<' backwards to the matching - '>', excluding the '<' and '>'. The |cpo-M| option flag - is used to handle escaped '<' and '>'. + '>', excluding the '<' and '>'. It's an error to + select an empty inner block like "<>". The |cpo-M| + option flag is used to handle escaped '<' and '>'. When used in Visual mode it is made charwise. *v_at* *at* @@ -640,7 +643,8 @@ i} *v_i}* *i}* *i{* i{ *v_iB* *v_i{* *iB* iB "inner Block", select [count] Blocks, from `[count] [{` to the matching "}", excluding the "{" and "}" (see - |[{|). The |cpo-M| option flag is used to handle + |[{|). It"s an error to select an empty inner block + like "{}". The |cpo-M| option flag is used to handle escaped braces. When used in Visual mode it is made charwise. -- cgit From 099bd35a7d0a52bcf3c58d1b841d008c8af0a8de Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 6 Jan 2024 11:45:25 +0100 Subject: docs(luvref): update to version bump --- runtime/doc/luvref.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index 915b69efe3..1a811a361b 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -977,15 +977,15 @@ called from another thread. async:send() < -uv.new_async([{callback}]) *uv.new_async()* +uv.new_async({callback}) *uv.new_async()* Parameters: - - `callback`: `callable` or `nil` + - `callback`: `callable` - `...`: `threadargs` passed to/from `uv.async_send(async, ...)` Creates and initializes a new |uv_async_t|. Returns the Lua - userdata wrapping it. A `nil` callback is allowed. + userdata wrapping it. Returns: `uv_async_t userdata` or `fail` @@ -2067,11 +2067,11 @@ uv.pipe({read_flags}, {write_flags}) *uv.pipe()* uv.pipe_bind2({pipe}, {name}, {flags}) *uv.pipe_bind2()* > method form `pipe:pipe_bind(name, flags)` - + Parameters: - `pipe`: `uv_pipe_t userdata` - `name`: `string` - - `flags`: `integer` or `table` or `nil`(default: 0) + - `flags`: `integer` or `table` or `nil` (default: 0) Flags: - If `type(flags)` is `number`, it must be `0` or @@ -2101,7 +2101,7 @@ uv.pipe_connect2(pipe, name, [flags], [callback]) *uv.pipe_connect2()* Parameters: - `pipe`: `uv_pipe_t userdata` - `name`: `string` - - `flags`: `integer` or `table` or `nil`(default: 0) + - `flags`: `integer` or `table` or `nil` (default: 0) - `callback`: `callable` or `nil` - `err`: `nil` or `string` -- cgit From 8df37423781493f58de060e1c9219cd1c3768130 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sat, 6 Jan 2024 18:08:29 -0600 Subject: fix(defaults): use augroup for default autocommands (#26933) --- runtime/lua/vim/_defaults.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index af962eea5d..64eb638fd7 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -190,6 +190,8 @@ for _, ui in ipairs(vim.api.nvim_list_uis()) do end if tty then + local group = vim.api.nvim_create_augroup('nvim_tty', {}) + --- Set an option after startup (so that OptionSet is fired), but only if not --- already set by the user. --- @@ -207,6 +209,7 @@ if tty then vim.o[option] = value else vim.api.nvim_create_autocmd('VimEnter', { + group = group, once = true, nested = true, callback = function() @@ -295,6 +298,7 @@ if tty then local timer = assert(vim.uv.new_timer()) local id = vim.api.nvim_create_autocmd('TermResponse', { + group = group, nested = true, callback = function(args) local resp = args.data ---@type string @@ -370,6 +374,7 @@ if tty then local b = 3 local id = vim.api.nvim_create_autocmd('TermResponse', { + group = group, nested = true, callback = function(args) local resp = args.data ---@type string -- cgit From fbe40caa7cc1786dc58210a82901307417ba0654 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Sat, 6 Jan 2024 07:18:13 -0500 Subject: docs(treesitter): improve 'no parser' error message for InspectTree Improve error messages for `:InspectTree`, when no parsers are available for the current buffer and filetype. We can show more informative and helpful error message for users (e.g., which lang was searched for): ``` ... No parser available for the given buffer: +... no parser for 'custom_ft' language, see :help treesitter-parsers ``` Also improve the relevant docs for *treesitter-parsers*. --- runtime/doc/treesitter.txt | 21 ++++++++++++++++----- runtime/lua/vim/treesitter/dev.lua | 3 ++- runtime/lua/vim/treesitter/language.lua | 4 ++++ 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 44d644f945..b4c444bbfc 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -20,15 +20,23 @@ PARSER FILES *treesitter-parsers* Parsers are the heart of tree-sitter. They are libraries that tree-sitter will search for in the `parser` runtime directory. By default, Nvim bundles parsers for C, Lua, Vimscript, Vimdoc and Treesitter query files, but parsers can be -installed manually or via a plugin like -https://github.com/nvim-treesitter/nvim-treesitter. Parsers are searched for -as `parser/{lang}.*` in any 'runtimepath' directory. If multiple parsers for -the same language are found, the first one is used. (This typically implies -the priority "user config > plugins > bundled". +installed via a plugin like https://github.com/nvim-treesitter/nvim-treesitter +or even manually. + +Parsers are searched for as `parser/{lang}.*` in any 'runtimepath' directory. +If multiple parsers for the same language are found, the first one is used. +(NOTE: This typically implies the priority "user config > plugins > bundled".) A parser can also be loaded manually using a full path: >lua vim.treesitter.language.add('python', { path = "/path/to/python.so" }) < +To associate certain |filetypes| with a treesitter language (name of parser), +use |vim.treesitter.language.register()|. For example, to use the `xml` +treesitter parser for buffers with filetype `svg` or `xslt`, use: >lua + + vim.treesitter.language.register('xml', { 'svg', 'xslt' }) +< + ============================================================================== TREESITTER TREES *treesitter-tree* *TSTree* @@ -833,6 +841,9 @@ inspect({lang}) *vim.treesitter.language.inspect()* register({lang}, {filetype}) *vim.treesitter.language.register()* Register a parser named {lang} to be used for {filetype}(s). + Note: this adds or overrides the mapping for {filetype}, any existing + mappings from other filetypes to {lang} will be preserved. + Parameters: ~ • {lang} (string) Name of parser • {filetype} string|string[] Filetype(s) to associate with lang diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 870761b7c7..399d0ef03e 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -75,7 +75,8 @@ end function TSTreeView:new(bufnr, lang) local ok, parser = pcall(vim.treesitter.get_parser, bufnr or 0, lang) if not ok then - return nil, 'No parser available for the given buffer' + local err = parser --[[ @as string ]] + return nil, 'No parser available for the given buffer:\n' .. err end -- For each child tree (injected language), find the root of the tree and locate the node within diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua index 2056c337c8..2105a1d992 100644 --- a/runtime/lua/vim/treesitter/language.lua +++ b/runtime/lua/vim/treesitter/language.lua @@ -119,6 +119,10 @@ local function ensure_list(x) end --- Register a parser named {lang} to be used for {filetype}(s). +--- +--- Note: this adds or overrides the mapping for {filetype}, any existing mappings from other +--- filetypes to {lang} will be preserved. +--- --- @param lang string Name of parser --- @param filetype string|string[] Filetype(s) to associate with lang function M.register(lang, filetype) -- cgit From f40df63bdca33d343cada6ceaafbc8b765ed7cc6 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Thu, 4 Jan 2024 11:09:13 -0500 Subject: fix(docs): make lines not overflow in vim docs Problem: Some lines in the generated vim doc are overflowing, not correctly wrapped at 78 characters. This happens when docs body contains several consecutive 'inline' elements generated by doxygen. Solution: Take into account the current column offset of the last line, and prepend some padding before doc_wrap(). --- runtime/doc/api.txt | 28 ++++++++++++++++++---------- runtime/doc/diagnostic.txt | 22 ++++++++++++---------- runtime/doc/lsp.txt | 14 +++++++++----- runtime/doc/lua.txt | 40 +++++++++++++++++++++++++--------------- runtime/doc/treesitter.txt | 28 +++++++++++++++++----------- runtime/lua/vim/_meta/api.lua | 28 ++++++++++++++++++---------- 6 files changed, 99 insertions(+), 61 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 07e4473ac2..5b464debca 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1277,7 +1277,8 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()* • {data} Multiline input. May be binary (containing NUL bytes). • {crlf} Also break lines at CR and CRLF. • {phase} -1: paste in a single call (i.e. without streaming). To - "stream" a paste, call `nvim_paste` sequentially with these `phase` values: + "stream" a paste, call `nvim_paste` sequentially + with these `phase` values: • 1: starts the paste (exactly once) • 2: continues the paste (zero or more times) • 3: ends the paste (exactly once) @@ -2095,7 +2096,8 @@ nvim_buf_attach({buffer}, {send_buffer}, {*opts}) *nvim_buf_attach()* will be `nvim_buf_changedtick_event`. Not for Lua callbacks. • {opts} Optional parameters. - • on_lines: Lua callback invoked on change. Return `true` to detach. Args: + • on_lines: Lua callback invoked on change. Return `true` to + detach. Args: • the string "lines" • buffer handle • b:changedtick @@ -2108,7 +2110,8 @@ nvim_buf_attach({buffer}, {send_buffer}, {*opts}) *nvim_buf_attach()* • on_bytes: Lua callback invoked on change. This callback receives more granular information about the - change compared to on_lines. Return `true` to detach. Args: + change compared to on_lines. Return `true` to + detach. Args: • the string "bytes" • buffer handle • b:changedtick @@ -2704,7 +2707,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts}) wrapped lines. • hl_mode : control how highlights are combined with the highlights of the text. Currently only affects virt_text - highlights, but might affect `hl_group` in later versions. + highlights, but might affect `hl_group` in + later versions. • "replace": only show the virt_text color. This is the default. • "combine": combine with background text color. @@ -3141,8 +3145,8 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()* • height: Window height (in character cells). Minimum of 1. • bufpos: Places float relative to buffer text (only when relative="win"). Takes a tuple of zero-indexed [line, - column]. `row` and `col` if given are applied relative to this position, else they - default to: + column]. `row` and `col` if given are + applied relative to this position, else they default to: • `row=1` and `col=0` if `anchor` is "NW" or "NE" • `row=0` and `col=0` if `anchor` is "SW" or "SE" (thus like a tooltip near the buffer text). @@ -3157,8 +3161,9 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()* • external: GUI should display the window as an external top-level window. Currently accepts no other positioning configuration together with this. - • zindex: Stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger - than zero. The following screen elements have hard-coded + • zindex: Stacking order. floats with higher `zindex` go on + top on floats with lower indices. Must be larger than + zero. The following screen elements have hard-coded z-indices: • 100: insert completion popupmenu • 200: message scrollback @@ -3351,7 +3356,8 @@ nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()* • NOTE: Cannot be used with {pattern} • group: (string|int) The augroup name or id. - • NOTE: If not passed, will only delete autocmds not in any group. + • NOTE: If not passed, will only delete autocmds not in any + group. nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()* Create or get an autocommand group |autocmd-groups|. @@ -3375,7 +3381,9 @@ nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()* • |autocmd-groups| nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()* - Creates an |autocommand| event handler, defined by `callback` (Lua function or Vimscript function name string) or `command` (Ex command string). + Creates an |autocommand| event handler, defined by `callback` (Lua + function or Vimscript function name string) or `command` (Ex command + string). Example using Lua callback: >lua vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 106e130a41..ddebeb6730 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -541,7 +541,9 @@ get({bufnr}, {opts}) *vim.diagnostic.get()* • severity: See |diagnostic-severity|. Return: ~ - Diagnostic [] table A list of diagnostic items |diagnostic-structure|. Keys `bufnr` , `end_lnum` , `end_col` , and `severity` are guaranteed to be present. + Diagnostic [] table A list of diagnostic items |diagnostic-structure|. + Keys `bufnr` , `end_lnum` , `end_col` , and `severity` are + guaranteed to be present. get_namespace({namespace}) *vim.diagnostic.get_namespace()* Get namespace metadata. @@ -634,8 +636,8 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()* |vim.diagnostic.disable()|. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all - namespaces. + • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide + diagnostics from all namespaces. • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. When omitted, hide diagnostics in all buffers. @@ -644,9 +646,9 @@ is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()* Parameters: ~ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. - • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are - disabled in {bufnr}. Otherwise, only checks if - diagnostics from {namespace} are disabled. + • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks + if all diagnostics are disabled in {bufnr}. Otherwise, + only checks if diagnostics from {namespace} are disabled. Return: ~ (boolean) @@ -746,8 +748,8 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()* re-displayed, use |vim.diagnostic.hide()|. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all - namespaces. + • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove + diagnostics from all namespaces. • {bufnr} (integer|nil) Remove diagnostics for the given buffer. When omitted, diagnostics are removed for all buffers. @@ -795,8 +797,8 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) Display diagnostics for the given namespace and buffer. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all - namespaces. + • {namespace} (integer|nil) Diagnostic namespace. When omitted, show + diagnostics from all namespaces. • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. When omitted, show diagnostics in all buffers. • {diagnostics} (table|nil) The diagnostics to display. When omitted, diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index bbf19f9569..47c5c2379e 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1128,7 +1128,8 @@ code_action({options}) *vim.lsp.buf.code_action()* Parameters: ~ • {options} (table|nil) Optional table which holds the following optional fields: - • context: (table|nil) Corresponds to `CodeActionContext` of the LSP specification: + • context: (table|nil) Corresponds to `CodeActionContext` of + the LSP specification: • diagnostics (table|nil): LSP `Diagnostic[]`. Inferred from the current position if not provided. • only (table|nil): List of LSP `CodeActionKind`s used to @@ -1510,7 +1511,8 @@ get({filter}) *vim.lsp.inlay_hint.get()* • range (lsp.Range?) Return: ~ - vim.lsp.inlay_hint.get.ret [] Each list item is a table with the following fields: + vim.lsp.inlay_hint.get.ret [] Each list item is a table with the + following fields: • bufnr (integer) • client_id (integer) • inlay_hint (lsp.InlayHint) @@ -2090,8 +2092,9 @@ connect({host}, {port}) *vim.lsp.rpc.connect()* • {port} (integer) port to connect to Return: ~ - fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient function intended to be passed to |vim.lsp.start_client()| or - |vim.lsp.start()| on the field cmd + fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient function + intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| + on the field cmd *vim.lsp.rpc.domain_socket_connect()* domain_socket_connect({pipe_path}) @@ -2104,7 +2107,8 @@ domain_socket_connect({pipe_path}) the named pipe (Windows) to connect to Return: ~ - fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient::function intended to be passed to + fun(dispatchers: vim.lsp.rpc.Dispatchers ): + vim.lsp.rpc.PublicClient::function intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index e01e16b8f4..1bae1a43d4 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -680,8 +680,10 @@ vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_}) vim.regex:match_str({str}) *regex:match_str()* Match the string against the regex. If the string should match the regex - precisely, surround the regex with `^` and `$` . If there was a match, the byte indices for the beginning and end of the - match are returned. When there is no match, `nil` is returned. Because any integer is "truthy", `regex:match_str()` can be directly used as a condition in an if-statement. + precisely, surround the regex with `^` and `$` . If there was a match, the + byte indices for the beginning and end of the match are returned. When + there is no match, `nil` is returned. Because any integer is "truthy", `regex:match_str()` can + be directly used as a condition in an if-statement. Parameters: ~ • {str} (string) @@ -713,9 +715,9 @@ vim.diff({a}, {b}, {opts}) *vim.diff()* • {a} (string) First string to compare • {b} (string) Second string to compare • {opts} table Optional parameters: - • `on_hunk` (callback): Invoked for each hunk in the diff. Return a - negative number to cancel the callback for any remaining - hunks. Args: + • `on_hunk` (callback): Invoked for each hunk in the diff. + Return a negative number to cancel the callback for any + remaining hunks. Args: • `start_a` (integer): Start line of hunk in {a}. • `count_a` (integer): Hunk size in {a}. • `start_b` (integer): Start line of hunk in {b}. @@ -858,7 +860,8 @@ vim.spell.check({str}) *vim.spell.check()* • {str} (string) Return: ~ - `{[1]: string, [2]: string, [3]: string}[]` List of tuples with three items: + `{[1]: string, [2]: string, [3]: string}[]` 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 @@ -1581,7 +1584,8 @@ vim.deprecate({name}, {alternative}, {version}, {plugin}, {backtrace}) Parameters: ~ • {name} string Deprecated feature (function, API, etc.). • {alternative} (string|nil) Suggested alternative feature. - • {version} string Version when the deprecated function will be removed. + • {version} string Version when the deprecated function will be + removed. • {plugin} string|nil Name of the plugin that owns the deprecated feature. Defaults to "Nvim". • {backtrace} boolean|nil Prints backtrace. Defaults to true. @@ -1692,7 +1696,8 @@ vim.paste({lines}, {phase}) *vim.paste()* • {lines} string[] # |readfile()|-style list of lines to paste. |channel-lines| • {phase} paste_phase -1: "non-streaming" paste: the call contains all - lines. If paste is "streamed", `phase` indicates the stream state: + lines. If paste is "streamed", `phase` indicates + the stream state: • 1: starts the paste (exactly once) • 2: continues the paste (zero or more times) • 3: ends the paste (exactly once) @@ -1896,7 +1901,8 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* vim.deep_equal({a}, {b}) *vim.deep_equal()* Deep compare values for equality - Tables are compared recursively unless they both provide the `eq` metamethod. All other types are compared using the equality `==` operator. + Tables are compared recursively unless they both provide the `eq` metamethod. + All other types are compared using the equality `==` operator. Parameters: ~ • {a} any First value @@ -2276,7 +2282,8 @@ vim.tbl_get({o}, {...}) *vim.tbl_get()* any Nested value indexed by key (if it exists), else nil vim.tbl_isarray({t}) *vim.tbl_isarray()* - Tests if `t` is an "array": a table indexed only by integers (potentially non-contiguous). + Tests if `t` is an "array": a table indexed only by integers (potentially + non-contiguous). If the indexes start from 1 and are contiguous then the array is also a list. |vim.tbl_islist()| @@ -2307,8 +2314,8 @@ vim.tbl_isempty({t}) *vim.tbl_isempty()* • https://github.com/premake/premake-core/blob/master/src/base/table.lua vim.tbl_islist({t}) *vim.tbl_islist()* - Tests if `t` is a "list": a table indexed only by contiguous integers starting from 1 (what |lua-length| calls a "regular - array"). + Tests if `t` is a "list": a table indexed only by contiguous integers + starting from 1 (what |lua-length| calls a "regular array"). Empty table `{}` is a list, unless it was created by |vim.empty_dict()| or returned as a dict-like |API| or Vimscript result, for example from @@ -3150,7 +3157,8 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()* (integer) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`. vim.version.eq({v1}, {v2}) *vim.version.eq()* - Returns `true` if the given versions are equal. See |vim.version.cmp()| for usage. + Returns `true` if the given versions are equal. See |vim.version.cmp()| + for usage. Parameters: ~ • {v1} Version|number[] @@ -3204,7 +3212,8 @@ vim.version.parse({version}, {opts}) *vim.version.parse()* "1.0", "0-x", "tmux 3.2a" into valid versions. Return: ~ - (table|nil) parsed_version Version object or `nil` if input is invalid. + (table|nil) parsed_version Version object or `nil` if input is + invalid. See also: ~ • # https://semver.org/spec/v2.0.0.html @@ -3762,7 +3771,8 @@ vim.snippet.exit() *vim.snippet.exit()* Exits the current snippet. vim.snippet.expand({input}) *vim.snippet.expand()* - Expands the given snippet text. Refer to https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax for the specification of valid input. + Expands the given snippet text. Refer to https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax for + the specification of valid input. Tabstops are highlighted with hl-SnippetTabstop. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index b4c444bbfc..8702b98f76 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -936,7 +936,8 @@ lint({buf}, {opts}) *vim.treesitter.query.lint()* The found diagnostics are reported using |diagnostic-api|. By default, the parser used for verification is determined by the containing folder of the - query file, e.g., if the path ends in `/lua/highlights.scm` , the parser for the `lua` language will be used. + query file, e.g., if the path ends in `/lua/highlights.scm` , the parser + for the `lua` language will be used. Parameters: ~ • {buf} (integer) Buffer handle @@ -969,8 +970,9 @@ parse({lang}, {query}) *vim.treesitter.query.parse()* Parse {query} as a string. (If the query is in a file, the caller should read the contents into a string before calling). - Returns a `Query` (see |lua-treesitter-query|) object which can be used to search nodes in - the syntax tree for the patterns defined in {query} using `iter_*` methods below. + Returns a `Query` (see |lua-treesitter-query|) object which can be used to + search nodes in the syntax tree for the patterns defined in {query} using `iter_*` methods + below. Exposes `info` and `captures` with additional context about {query}. • `captures` contains the list of unique capture names defined in {query}. @@ -1078,7 +1080,8 @@ inject other languages, recursively. For example a Lua buffer containing some Vimscript commands needs multiple parsers to fully understand its contents. -To create a LanguageTree (parser object) for a given buffer and language, use: >lua +To create a LanguageTree (parser object) for a given buffer and language, +use: >lua local parser = vim.treesitter.get_parser(bufnr, lang) < @@ -1136,9 +1139,9 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()* • {fn} fun(tree: TSTree, ltree: LanguageTree) LanguageTree:included_regions() *LanguageTree:included_regions()* - Gets the set of included regions managed by this LanguageTree . This can be different from the regions set by injection query, because a - partial |LanguageTree:parse()| drops the regions outside the requested - range. + Gets the set of included regions managed by this LanguageTree . This can + be different from the regions set by injection query, because a partial + |LanguageTree:parse()| drops the regions outside the requested range. Return: ~ table @@ -1150,8 +1153,9 @@ LanguageTree:invalidate({reload}) *LanguageTree:invalidate()* • {reload} (boolean|nil) LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()* - Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()| reflects the latest state of the - source. If invalid, user should call |LanguageTree:parse()|. + Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()| + reflects the latest state of the source. If invalid, user should call + |LanguageTree:parse()|. Parameters: ~ • {exclude_children} (boolean|nil) whether to ignore the validity of @@ -1213,7 +1217,8 @@ LanguageTree:register_cbs({cbs}, {recursive}) Parameters: ~ • {cbs} (table) An |nvim_buf_attach()|-like table argument with the following handlers: - • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback. + • `on_bytes` : see |nvim_buf_attach()|, but this will be + called after the parsers callback. • `on_changedtree` : a callback that will be called every time the tree has syntactical changes. It will be passed two arguments: a table of the ranges (as node @@ -1248,7 +1253,8 @@ LanguageTree:tree_for_range({range}, {opts}) LanguageTree:trees() *LanguageTree:trees()* Returns all trees of the regions parsed by this parser. Does not include child languages. The result is list-like if - • this LanguageTree is the root, in which case the result is empty or a singleton list; or + • this LanguageTree is the root, in which case the result is empty or a + singleton list; or • the root LanguageTree is fully parsed. Return: ~ diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index e85f81f5f9..19039eb226 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -155,7 +155,8 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start --- will be `nvim_buf_changedtick_event`. Not for Lua --- callbacks. --- @param opts vim.api.keyset.buf_attach Optional parameters. ---- • on_lines: Lua callback invoked on change. Return `true` to detach. Args: +--- • on_lines: Lua callback invoked on change. Return `true` to +--- detach. Args: --- • the string "lines" --- • buffer handle --- • b:changedtick @@ -168,7 +169,8 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start --- --- • on_bytes: Lua callback invoked on change. This --- callback receives more granular information about the ---- change compared to on_lines. Return `true` to detach. Args: +--- change compared to on_lines. Return `true` to +--- detach. Args: --- • the string "bytes" --- • buffer handle --- • b:changedtick @@ -530,7 +532,8 @@ function vim.api.nvim_buf_line_count(buffer) end --- wrapped lines. --- • hl_mode : control how highlights are combined with the --- highlights of the text. Currently only affects virt_text ---- highlights, but might affect `hl_group` in later versions. +--- highlights, but might affect `hl_group` in +--- later versions. --- • "replace": only show the virt_text color. This is the --- default. --- • "combine": combine with background text color. @@ -740,7 +743,8 @@ function vim.api.nvim_chan_send(chan, data) end --- • NOTE: Cannot be used with {pattern} --- --- • group: (string|int) The augroup name or id. ---- • NOTE: If not passed, will only delete autocmds not in any group. +--- • NOTE: If not passed, will only delete autocmds not in any +--- group. function vim.api.nvim_clear_autocmds(opts) end --- Executes an Ex command. @@ -808,7 +812,9 @@ function vim.api.nvim_complete_set(index, opts) end --- @return integer function vim.api.nvim_create_augroup(name, opts) end ---- Creates an `autocommand` event handler, defined by `callback` (Lua function or Vimscript function name string) or `command` (Ex command string). +--- Creates an `autocommand` event handler, defined by `callback` (Lua +--- function or Vimscript function name string) or `command` (Ex command +--- string). --- Example using Lua callback: --- --- ```lua @@ -1525,8 +1531,8 @@ function vim.api.nvim_open_term(buffer, opts) end --- • height: Window height (in character cells). Minimum of 1. --- • bufpos: Places float relative to buffer text (only when --- relative="win"). Takes a tuple of zero-indexed [line, ---- column]. `row` and `col` if given are applied relative to this position, else they ---- default to: +--- column]. `row` and `col` if given are +--- applied relative to this position, else they default to: --- • `row=1` and `col=0` if `anchor` is "NW" or "NE" --- • `row=0` and `col=0` if `anchor` is "SW" or "SE" (thus --- like a tooltip near the buffer text). @@ -1541,8 +1547,9 @@ function vim.api.nvim_open_term(buffer, opts) end --- • external: GUI should display the window as an external --- top-level window. Currently accepts no other positioning --- configuration together with this. ---- • zindex: Stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger ---- than zero. The following screen elements have hard-coded +--- • zindex: Stacking order. floats with higher `zindex` go on +--- top on floats with lower indices. Must be larger than +--- zero. The following screen elements have hard-coded --- z-indices: --- • 100: insert completion popupmenu --- • 200: message scrollback @@ -1661,7 +1668,8 @@ function vim.api.nvim_parse_expression(expr, flags, highlight) end --- @param data string Multiline input. May be binary (containing NUL bytes). --- @param crlf boolean Also break lines at CR and CRLF. --- @param phase integer -1: paste in a single call (i.e. without streaming). To ---- "stream" a paste, call `nvim_paste` sequentially with these `phase` values: +--- "stream" a paste, call `nvim_paste` sequentially +--- with these `phase` values: --- • 1: starts the paste (exactly once) --- • 2: continues the paste (zero or more times) --- • 3: ends the paste (exactly once) -- cgit From beca827212b106114c371f8bb61aa1a50810062f Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Tue, 9 Jan 2024 15:27:56 +0100 Subject: feat(terminal): trigger TermRequest autocommand events (#22159) This commit implements a new TermRequest autocommand event and has Neovim emit this event when children of terminal buffers emit an OSC or DCS sequence libvterm does not handle. The TermRequest autocommand event has additional data in the v:termrequest variable. Co-authored-by: Gregory Anders --- runtime/doc/autocmd.txt | 5 +++++ runtime/doc/news.txt | 3 +++ runtime/doc/vvars.txt | 9 ++++++++- runtime/lua/vim/_meta/vvars.lua | 11 +++++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 45d7a4244c..ce3af01073 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -986,6 +986,11 @@ TermLeave After leaving |Terminal-mode|. TermClose When a |terminal| job ends. Sets these |v:event| keys: status + *TermRequest* +TermRequest When a |terminal| job emits an OSC or DCS + sequence. Sets |v:termrequest|. When used from + Lua, the request string is included in the + "data" field of the autocommand callback. *TermResponse* TermResponse When Nvim receives an OSC or DCS response from the terminal. Sets |v:termresponse|. When used diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index d3ace5f33b..98b782a105 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -284,6 +284,9 @@ The following new APIs and features were added. • |vim.deepcopy()| has a `noref` argument to avoid hashing table values. +• Terminal buffers emit a |TermRequest| autocommand event when the child + process emits an OSC or DCS control sequence. + ============================================================================== CHANGED FEATURES *news-changed* diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt index 7e96d356d0..e71e31abf8 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -647,9 +647,16 @@ v:t_number Value of |Number| type. Read-only. See: |type()| *v:t_string* *t_string-variable* v:t_string Value of |String| type. Read-only. See: |type()| + *v:termrequest* *termrequest-variable* +v:termrequest + The value of the most recent OSC or DCS control sequence + sent from a process running in the embedded |terminal|. + This can be read in a |TermRequest| event handler to respond + to queries from embedded applications. + *v:termresponse* *termresponse-variable* v:termresponse - The value of the most recent OSC or DCS escape sequence + The value of the most recent OSC or DCS control sequence received by Nvim from the terminal. This can be read in a |TermResponse| event handler after querying the terminal using another escape sequence. diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index e3b89aeff7..ca87fb9d15 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -687,11 +687,18 @@ vim.v.t_number = ... --- @type integer vim.v.t_string = ... ---- The value of the most recent OSC or DCS escape sequence +--- The value of the most recent OSC or DCS control sequence +--- sent from a process running in the embedded `terminal`. +--- This can be read in a `TermRequest` event handler to respond +--- to queries from embedded applications. +--- @type string +vim.v.termrequest = ... + +--- The value of the most recent OSC or DCS control sequence --- received by Nvim from the terminal. This can be read in a --- `TermResponse` event handler after querying the terminal using --- another escape sequence. ---- @type any +--- @type string vim.v.termresponse = ... --- Must be set before using `test_garbagecollect_now()`. -- cgit From 501cf323575864c847be892da1197daa8c3771a1 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:03:09 +0100 Subject: vim-patch:3a5b3df7764d (#26956) runtime(tar): fix a few problems with the tar plugin From: vim/vim#138331: - Updating .tar.zst files was broken. Fixes vim/vim#12639. - Extracting files from .tar.zst / .tzs files was also broken and works now. From: vim/vim#12637: - Fixes variable assignment and typo From: vim/vim#8109: - Rename .tzs to the more standard .tzst fixes: vim/vim#12639 fixes: vim/vim#8105 closes: vim/vim#8109 closes: vim/vim#12637 closes: vim/vim#13831 https://github.com/vim/vim/commit/3a5b3df7764daa058a3e779183e8f38a8418b164 Co-authored-by: Christian Brabandt Co-authored-by: Martin Rys Co-authored-by: Eisuke Kawashima Co-authored-by: Carlo Teubner --- runtime/autoload/tar.vim | 36 ++++++++++++++++++------------------ runtime/plugin/tarPlugin.vim | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index e242fe98e3..5ecce8579f 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -163,9 +163,9 @@ fun! tar#Browse(tarfile) " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " - elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$' + elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzst\)$' if has("unix") && executable("file") - let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2" + let filekind= system("file ".shellescape(tarfile,1)) else let filekind= "" endif @@ -192,7 +192,7 @@ fun! tar#Browse(tarfile) elseif tarfile =~# '\.\(xz\|txz\)$' " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " - elseif tarfile =~# '\.\(zst\|tzs\)$' + elseif tarfile =~# '\.\(zst\|tzst\)$' exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " else if tarfile =~ '^\s*-' @@ -230,7 +230,7 @@ fun! tar#Browse(tarfile) " set up maps supported for tar setlocal noma nomod ro noremap :call TarBrowseSelect() - noremap x :call tar#Extract() + noremap x :call tar#Extract() if &mouse != "" noremap :call TarBrowseSelect() endif @@ -468,9 +468,9 @@ fun! tar#Write(fname) let compress= "xz -- ".shellescape(tarfile,0) " call Decho("compress<".compress.">") elseif tarfile =~# '\.zst' - call system("zstd --decompress -- ".shellescape(tarfile,0)) + call system("zstd --decompress --rm -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.zst','','e') - let compress= "zstd -- ".shellescape(tarfile,0) + let compress= "zstd --rm -- ".shellescape(tarfile,0) elseif tarfile =~# '\.lzma' call system("lzma -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.lzma','','e') @@ -486,7 +486,7 @@ fun! tar#Write(fname) else " call Decho("tarfile<".tarfile."> fname<".fname.">") - + if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') if has("win32unix") && executable("cygpath") @@ -502,7 +502,7 @@ fun! tar#Write(fname) let tarfile = substitute(tarfile, '-', './-', '') endif " call Decho("tarfile<".tarfile."> fname<".fname.">") - + if exists("g:tar_secure") let tar_secure= " -- " else @@ -512,7 +512,7 @@ fun! tar#Write(fname) if has("win32unix") && executable("cygpath") let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') endif - + " delete old file from tarfile " call Decho("system(".g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")") call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) @@ -521,8 +521,8 @@ fun! tar#Write(fname) " call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname)) echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None else - - " update tarfile with new file + + " update tarfile with new file " call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) if v:shell_error != 0 @@ -555,7 +555,7 @@ fun! tar#Write(fname) unlet s:tblfile_{winnr()} endif endif - + " cleanup and restore current directory cd .. call s:Rmdir("_ZIPVIM_") @@ -696,13 +696,13 @@ fun! tar#Extract() echo "***note*** successfully extracted ".fname endif - elseif filereadable(tarbase.".tzs") + elseif filereadable(tarbase.".tzst") let extractcmd= substitute(extractcmd,"-","--zstd","") -" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")") - call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname)) +" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzst ".shellescape(fname).")") + call system(extractcmd." ".shellescape(tarbase).".tzst ".shellescape(fname)) if v:shell_error != 0 - echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE -" call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!") + echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzst ".fname.": failed!" | echohl NONE +" call Decho("***error*** ".extractcmd." ".tarbase.".tzst ".fname.": failed!") else echo "***note*** successfully extracted ".fname endif @@ -710,7 +710,7 @@ fun! tar#Extract() elseif filereadable(tarbase.".tar.zst") let extractcmd= substitute(extractcmd,"-","--zstd","") " call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")") - call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname)) + call system(extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname)) if v:shell_error != 0 echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE " call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!") diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim index 384a3ed823..26a994aee5 100644 --- a/runtime/plugin/tarPlugin.vim +++ b/runtime/plugin/tarPlugin.vim @@ -45,7 +45,7 @@ augroup tar au BufReadCmd *.tar.xz call tar#Browse(expand("")) au BufReadCmd *.txz call tar#Browse(expand("")) au BufReadCmd *.tar.zst call tar#Browse(expand("")) - au BufReadCmd *.tzs call tar#Browse(expand("")) + au BufReadCmd *.tzst call tar#Browse(expand("")) augroup END " --------------------------------------------------------------------- -- cgit From 595f684c5b37fe4c0ff1ae7514c935a6723fa644 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 9 Jan 2024 22:57:25 +0100 Subject: vim-patch:71d0ba07a33a runtime(netrw): Sync with netrw 174b (vim/vim#13836) * Import netrw v174b * Revert unwanted changes * Fix indent * Revert some changes * Update tags * Break long line https://github.com/vim/vim/commit/71d0ba07a33a750e9834cd42b7acc619043dedb1 Co-authored-by: K.Takata --- runtime/autoload/netrw.vim | 44 ++++++++++++++++++++++---------------------- runtime/doc/pi_netrw.txt | 37 +++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 42 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index a4d6c41b78..fb551ac675 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -2074,9 +2074,9 @@ fun! netrw#NetRead(mode,...) let wholechoice = wholechoice . " " . choice let ichoice = ichoice + 1 if ichoice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) - endif + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) + endif " call Dret("netrw#NetRead :2 getcwd<".getcwd().">") return endif @@ -2497,9 +2497,9 @@ fun! netrw#NetWrite(...) range let wholechoice= wholechoice . " " . choice let ichoice = ichoice + 1 if choice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) - endif + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) + endif " call Dret("netrw#NetWrite") return endif @@ -4956,12 +4956,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if g:netrw_chgwin >= 1 " call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("")) if winnr("$")+1 == g:netrw_chgwin - " if g:netrw_chgwin is set to one more than the last window, then - " vertically split the last window to make that window available. - let curwin= winnr() - exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" - vs - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin + " if g:netrw_chgwin is set to one more than the last window, then + " vertically split the last window to make that window available. + let curwin= winnr() + exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" + vs + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin endif exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" endif @@ -6070,7 +6070,7 @@ fun! s:NetrwServerEdit(islocal,fname) " used something like . " call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("")) if exists("g:netrw_browse_split") - unlet g:netrw_browse_split + unlet g:netrw_browse_split endif let g:netrw_browse_split= 0 if exists("s:netrw_browse_split_".winnr()) @@ -6104,7 +6104,7 @@ fun! s:NetrwServerEdit(islocal,fname) if !ctrlr " call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("")) if exists("g:netrw_browse_split") - unlet g:netrw_browse_split + unlet g:netrw_browse_split endif let g:netrw_browse_split= 0 call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) @@ -7446,7 +7446,7 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) for fname in s:netrwmarkfilelist_{curbufnr} if a:islocal if g:netrw_keepdir - let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) + let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) endif else let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) @@ -10575,7 +10575,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ret= system(netrw_rm_cmd) if v:shell_error != 0 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir - call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) + call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) else call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif @@ -11083,16 +11083,16 @@ fun! s:LocalListing() " call Decho("pfile <".pfile.">",'~'.expand("")) if w:netrw_liststyle == s:LONGLIST - let longfile= printf("%-".g:netrw_maxfilenamelen."S",pfile) - let sz = getfsize(filename) - let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen) - let szlen = (szlen > 0) ? szlen : 0 + let longfile = printf("%-".g:netrw_maxfilenamelen."S",pfile) + let sz = getfsize(filename) + let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen) + let szlen = (szlen > 0) ? szlen : 0 if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif let fsz = printf("%".szlen."S",sz) - let pfile = longfile." ".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) + let pfile= longfile." ".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) " call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("")) endif @@ -12112,7 +12112,7 @@ fun! s:NetrwLcd(newdir) if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' let dirname = '\' - exe 'NetrwKeepj sil lcd '.fnameescape(dirname) + exe 'NetrwKeepj sil lcd '.fnameescape(dirname) endif endif catch /^Vim\%((\a\+)\)\=:E472/ diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 85ac290361..1020b703a9 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1621,10 +1621,8 @@ A further approach is to delete files which match a pattern. This will cause the matching files to be marked. Then, press "D". -If your vim has 7.4 with patch#1107, then |g:netrw_localrmdir| no longer -is used to remove directories; instead, vim's |delete()| is used with -the "d" option. Please note that only empty directories may be deleted -with the "D" mapping. Regular files are deleted with |delete()|, too. +Please note that only empty directories may be deleted with the "D" mapping. +Regular files are deleted with |delete()|, too. The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are used to control the attempts to remove remote files and directories. The @@ -1643,8 +1641,7 @@ to remove it again using the g:netrw_rmf_cmd variable. Its default value is: |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f Related topics: |netrw-d| -Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd| - |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd| +Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd| *netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore* @@ -1687,7 +1684,11 @@ DIRECTORY EXPLORATION COMMANDS {{{2 to 2; edits will thus preferentially be made in window#2. The [N] specifies a |g:netrw_winsize| just for the new :Lexplore - window. + window. That means that + if [N] < 0 : use |N| columns for the Lexplore window + if [N] = 0 : a normal split is made + if [N] > 0 : use N% of the current window will be used for the + new window Those who like this method often also like tree style displays; see |g:netrw_liststyle|. @@ -2848,14 +2849,6 @@ your browsing preferences. (see also: |netrw-settings|) =" /c move" Windows Options for |g:netrw_localmovecmd| - *g:netrw_localrmdir* ="rmdir" Linux/Unix/MacOS/Cygwin - =expand("$COMSPEC") Windows - Remove directory command (rmdir) - This variable is only used if your vim is - earlier than 7.4 or if your vim doesn't - have patch#1107. Otherwise, |delete()| - is used with the "d" option. - *g:netrw_maxfilenamelen* =32 by default, selected so as to make long listings fit on 80 column displays. If your screen is wider, and you have file @@ -3766,7 +3759,7 @@ Example: Clear netrw's marked file list via a mapping on gu > Netrw uses several system level commands to do things (see |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, - |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). + |g:netrw_mkdir_cmd|). You may need to adjust the default commands for one or more of these commands by setting them properly in your .vimrc. Another @@ -3892,8 +3885,13 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 - v172: Apr 22, 2023 * removed g:netrw_localrmdiropt - removed g:netrw_localrmdir + v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go" + * (Bram Moolenaar) no need for "b" in + netrw-safe guioptions + Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir + references + Aug 18, 2022 * (Miguel Barro) improving compatability with + powershell v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe() to allow |'bh'| to be set to delete when rather than hide when g:netrw_fastbrowse @@ -3981,7 +3979,6 @@ netrw: |g:netrw_localcopydircmdopt| |g:netrw_localmkdiropt| |g:netrw_localmovecmdopt| - g:netrw_localrmdiropt Nov 21, 2016 * (mattn) provided a patch for preview; swapped winwidth() with winheight() Nov 22, 2016 * (glacambre) reported that files containing @@ -4041,7 +4038,7 @@ netrw: refreshes. However, inside a |:map-|, tab and window changes are disallowed. Fixed. (affects netrw's s:LocalBrowseRefresh()) - * |g:netrw_localrmdir| not used any more, but + * g:netrw_localrmdir not used any more, but the relevant patch that causes |delete()| to take over was #1107 (not #1109). * |expand()| is now used on |g:netrw_home|; -- cgit From c67efe3a9c5b04b1909bf0051476ede495531066 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrett-ruth@users.noreply.github.com> Date: Tue, 9 Jan 2024 16:28:18 -0600 Subject: fix(health): correctly expand and resolve PYENV_ROOT (#26953) --- runtime/lua/provider/python/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua index 7fc4006fc8..0b6edf5b42 100644 --- a/runtime/lua/provider/python/health.lua +++ b/runtime/lua/provider/python/health.lua @@ -35,7 +35,7 @@ local function check_for_pyenv() health.info('pyenv: Path: ' .. pyenv_path) - local pyenv_root = os.getenv('PYENV_ROOT') and vim.fn.resolve('$PYENV_ROOT') or '' + local pyenv_root = vim.fn.resolve(os.getenv('PYENV_ROOT') or '') if pyenv_root == '' then pyenv_root = vim.fn.system({ pyenv_path, 'root' }) -- cgit From 63a17322dd835724887517c1309e70c06748ed59 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrett-ruth@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:05:44 -0600 Subject: fix(health): improve python executable check error handling (#26954) Credit to @wookayin for the fix. --- runtime/lua/provider/python/health.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua index 0b6edf5b42..6d3a4d5c50 100644 --- a/runtime/lua/provider/python/health.lua +++ b/runtime/lua/provider/python/health.lua @@ -17,10 +17,9 @@ end -- Resolves Python executable path by invoking and checking `sys.executable`. local function python_exepath(invocation) - local python = vim.fn.fnameescape(invocation) - local out = vim.fn.system(python .. ' -c "import sys; sys.stdout.write(sys.executable)"') - assert(vim.v.shell_error == 0, out) - return vim.fs.normalize(vim.trim(out)) + local p = vim.system({ invocation, '-c', 'import sys; sys.stdout.write(sys.executable)' }):wait() + assert(p.code == 0, p.stderr) + return vim.fs.normalize(vim.trim(p.stdout)) end -- Check if pyenv is available and a valid pyenv root can be found, then return -- cgit From a767c046f4e6bff1412269d56a8edfe33857d954 Mon Sep 17 00:00:00 2001 From: JD <46619169+rudiejd@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:57:51 -0500 Subject: feat(vim.iter): add Iter:flatten (#26786) Co-authored-by: Gregory Anders Co-authored-by: Jongwook Choi --- runtime/doc/lua.txt | 22 +++++++++++++ runtime/lua/vim/iter.lua | 82 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 100 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 1bae1a43d4..b558a3fc8d 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3431,6 +3431,28 @@ Iter:find({f}) *Iter:find()* Return: ~ any +Iter:flatten({depth}) *Iter:flatten()* + Flattens a |list-iterator|, un-nesting nested values up to the given + {depth}. Errors if it attempts to flatten a dict-like value. + + Examples: >lua + vim.iter({ 1, { 2 }, { { 3 } } }):flatten():totable() + -- { 1, 2, { 3 } } + + vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable() + -- { 1, { a = 2 }, 3 } + + vim.iter({ 1, { { a = 2 } }, { 3 } }):flatten(math.huge):totable() + -- error: attempt to flatten a dict-like table +< + + Parameters: ~ + • {depth} (number|nil) Depth to which |list-iterator| should be + flattened (defaults to 1) + + Return: ~ + Iter + Iter:fold({init}, {f}) *Iter:fold()* Folds ("reduces") an iterator into a single value. diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index b658dde099..c6feeea3dc 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -112,6 +112,35 @@ local function sanitize(t) return t end +--- Flattens a single list-like table. Errors if it attempts to flatten a +--- dict-like table +---@param v table table which should be flattened +---@param max_depth number depth to which the table should be flattened +---@param depth number current iteration depth +---@param result table output table that contains flattened result +---@return table|nil flattened table if it can be flattened, otherwise nil +local function flatten(v, max_depth, depth, result) + if depth < max_depth and type(v) == 'table' then + local i = 0 + for _ in pairs(v) do + i = i + 1 + + if v[i] == nil then + -- short-circuit: this is not a list like table + return nil + end + + if flatten(v[i], max_depth, depth + 1, result) == nil then + return nil + end + end + else + result[#result + 1] = v + end + + return result +end + --- Determine if the current iterator stage should continue. --- --- If any arguments are passed to this function, then return those arguments @@ -179,6 +208,54 @@ function ListIter.filter(self, f) return self end +--- Flattens a |list-iterator|, un-nesting nested values up to the given {depth}. +--- Errors if it attempts to flatten a dict-like value. +--- +--- Examples: +--- +--- ```lua +--- vim.iter({ 1, { 2 }, { { 3 } } }):flatten():totable() +--- -- { 1, 2, { 3 } } +--- +--- vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable() +--- -- { 1, { a = 2 }, 3 } +--- +--- vim.iter({ 1, { { a = 2 } }, { 3 } }):flatten(math.huge):totable() +--- -- error: attempt to flatten a dict-like table +--- ``` +--- +---@param depth? number Depth to which |list-iterator| should be flattened +--- (defaults to 1) +---@return Iter +function Iter.flatten(self, depth) -- luacheck: no unused args + error('flatten() requires a list-like table') +end + +---@private +function ListIter.flatten(self, depth) + depth = depth or 1 + local inc = self._head < self._tail and 1 or -1 + local target = {} + + for i = self._head, self._tail - inc, inc do + local flattened = flatten(self._table[i], depth, 0, {}) + + -- exit early if we try to flatten a dict-like table + if flattened == nil then + error('flatten() requires a list-like table') + end + + for _, v in pairs(flattened) do + target[#target + 1] = v + end + end + + self._head = 1 + self._tail = #target + 1 + self._table = target + return self +end + --- Maps the items of an iterator pipeline to the values returned by `f`. --- --- If the map function returns nil, the value is filtered from the iterator. @@ -461,9 +538,8 @@ end --- ``` --- ---@return Iter -function Iter.rev(self) +function Iter.rev(self) -- luacheck: no unused args error('rev() requires a list-like table') - return self end ---@private @@ -733,7 +809,6 @@ end ---@diagnostic disable-next-line: unused-local function Iter.skipback(self, n) -- luacheck: no unused args error('skipback() requires a list-like table') - return self end ---@private @@ -800,7 +875,6 @@ end ---@diagnostic disable-next-line: unused-local function Iter.slice(self, first, last) -- luacheck: no unused args error('slice() requires a list-like table') - return self end ---@private -- cgit From 2f9ee9b6cfc61a0504fc0bc22bdf481828e2ea91 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 9 Jan 2024 17:36:46 +0000 Subject: fix(doc): improve doc generation of types using lpeg Added a lpeg grammar for LuaCATS and use it in lua2dox.lua --- runtime/doc/api.txt | 5 +- runtime/doc/diagnostic.txt | 132 +++--- runtime/doc/lsp.txt | 466 ++++++++++----------- runtime/doc/lua.txt | 759 ++++++++++++++++++----------------- runtime/doc/treesitter.txt | 233 ++++++----- runtime/lua/vim/_editor.lua | 7 +- runtime/lua/vim/_meta/api.lua | 5 +- runtime/lua/vim/_system.lua | 4 +- runtime/lua/vim/filetype.lua | 4 +- runtime/lua/vim/health.lua | 2 +- runtime/lua/vim/iter.lua | 48 +-- runtime/lua/vim/lsp/handlers.lua | 2 +- runtime/lua/vim/lsp/util.lua | 6 +- runtime/lua/vim/shared.lua | 2 +- runtime/lua/vim/treesitter/query.lua | 2 +- 15 files changed, 840 insertions(+), 837 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 5b464debca..b5a49f6002 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3381,9 +3381,8 @@ nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()* • |autocmd-groups| nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()* - Creates an |autocommand| event handler, defined by `callback` (Lua - function or Vimscript function name string) or `command` (Ex command - string). + Creates an |autocommand| event handler, defined by `callback` (Lua function + or Vimscript function name string) or `command` (Ex command string). Example using Lua callback: >lua vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index ddebeb6730..5ff1c3bab5 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -390,7 +390,7 @@ config({opts}, {namespace}) *vim.diagnostic.config()* any of the above. Parameters: ~ - • {opts} (table|nil) When omitted or "nil", retrieve the current + • {opts} (`table?`) When omitted or "nil", retrieve the current configuration. Otherwise, a configuration table with the following keys: • underline: (default true) Use underline for @@ -475,55 +475,55 @@ config({opts}, {namespace}) *vim.diagnostic.config()* severities are displayed before lower severities (e.g. ERROR is displayed before WARN). Options: • reverse: (boolean) Reverse sort order - • {namespace} (integer|nil) Update the options for the given namespace. + • {namespace} (`integer?`) Update the options for the given namespace. When omitted, update the global diagnostic options. Return: ~ - (table|nil) table of current diagnostic config if `opts` is omitted. + (`table?`) table of current diagnostic config if `opts` is omitted. count({bufnr}, {opts}) *vim.diagnostic.count()* Get current diagnostics count. Parameters: ~ - • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0 - for current buffer or nil for all buffers. - • {opts} (table|nil) A table with the following keys: + • {bufnr} (`integer?`) Buffer number to get diagnostics from. Use 0 for + current buffer or nil for all buffers. + • {opts} (`table?`) A table with the following keys: • namespace: (number) Limit diagnostics to the given namespace. • lnum: (number) Limit diagnostics to the given line number. • severity: See |diagnostic-severity|. Return: ~ - (table) A table with actually present severity values as keys (see + (`table`) A table with actually present severity values as keys (see |diagnostic-severity|) and integer counts as values. disable({bufnr}, {namespace}) *vim.diagnostic.disable()* Disable diagnostics in the given buffer. Parameters: ~ - • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. - When omitted, disable diagnostics in all buffers. - • {namespace} (integer|nil) Only disable diagnostics for the given + • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When + omitted, disable diagnostics in all buffers. + • {namespace} (`integer?`) Only disable diagnostics for the given namespace. enable({bufnr}, {namespace}) *vim.diagnostic.enable()* Enable diagnostics in the given buffer. Parameters: ~ - • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. - When omitted, enable diagnostics in all buffers. - • {namespace} (integer|nil) Only enable diagnostics for the given + • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When + omitted, enable diagnostics in all buffers. + • {namespace} (`integer?`) Only enable diagnostics for the given namespace. fromqflist({list}) *vim.diagnostic.fromqflist()* Convert a list of quickfix items to a list of diagnostics. Parameters: ~ - • {list} table[] List of quickfix items from |getqflist()| or + • {list} (`table[]`) List of quickfix items from |getqflist()| or |getloclist()|. Return: ~ - Diagnostic [] array of |diagnostic-structure| + (`Diagnostic[]`) array of |diagnostic-structure| get({bufnr}, {opts}) *vim.diagnostic.get()* Get current diagnostics. @@ -532,77 +532,77 @@ get({bufnr}, {opts}) *vim.diagnostic.get()* diagnostics in a buffer, use |vim.diagnostic.set()|. Parameters: ~ - • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0 - for current buffer or nil for all buffers. - • {opts} (table|nil) A table with the following keys: + • {bufnr} (`integer?`) Buffer number to get diagnostics from. Use 0 for + current buffer or nil for all buffers. + • {opts} (`table?`) A table with the following keys: • namespace: (number) Limit diagnostics to the given namespace. • lnum: (number) Limit diagnostics to the given line number. • severity: See |diagnostic-severity|. Return: ~ - Diagnostic [] table A list of diagnostic items |diagnostic-structure|. - Keys `bufnr` , `end_lnum` , `end_col` , and `severity` are + (`Diagnostic[]`) table A list of diagnostic items + |diagnostic-structure|. Keys `bufnr` , `end_lnum` , `end_col` , and `severity` are guaranteed to be present. get_namespace({namespace}) *vim.diagnostic.get_namespace()* Get namespace metadata. Parameters: ~ - • {namespace} (integer) Diagnostic namespace + • {namespace} (`integer`) Diagnostic namespace Return: ~ - (table) Namespace metadata + (`table`) Namespace metadata get_namespaces() *vim.diagnostic.get_namespaces()* Get current diagnostic namespaces. Return: ~ - (table) A list of active diagnostic namespaces |vim.diagnostic|. + (`table`) A list of active diagnostic namespaces |vim.diagnostic|. get_next({opts}) *vim.diagnostic.get_next()* Get the next diagnostic closest to the cursor position. Parameters: ~ - • {opts} (table|nil) See |vim.diagnostic.goto_next()| + • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - Diagnostic|nil Next diagnostic + (`Diagnostic?`) Next diagnostic get_next_pos({opts}) *vim.diagnostic.get_next_pos()* Return the position of the next diagnostic in the current buffer. Parameters: ~ - • {opts} (table|nil) See |vim.diagnostic.goto_next()| + • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - table|false Next diagnostic position as a (row, col) tuple or false if - no next diagnostic. + (`table|false`) Next diagnostic position as a (row, col) tuple or + false if no next diagnostic. get_prev({opts}) *vim.diagnostic.get_prev()* Get the previous diagnostic closest to the cursor position. Parameters: ~ - • {opts} nil|table See |vim.diagnostic.goto_next()| + • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - Diagnostic|nil Previous diagnostic + (`Diagnostic?`) Previous diagnostic get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()* Return the position of the previous diagnostic in the current buffer. Parameters: ~ - • {opts} (table|nil) See |vim.diagnostic.goto_next()| + • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - table|false Previous diagnostic position as a (row, col) tuple or + (`table|false`) Previous diagnostic position as a (row, col) tuple or false if there is no prior diagnostic goto_next({opts}) *vim.diagnostic.goto_next()* Move to the next diagnostic. Parameters: ~ - • {opts} (table|nil) Configuration table with the following keys: + • {opts} (`table?`) Configuration table with the following keys: • namespace: (number) Only consider diagnostics from the given namespace. • cursor_position: (cursor position) Cursor position as a @@ -623,7 +623,7 @@ goto_prev({opts}) *vim.diagnostic.goto_prev()* Move to the previous diagnostic in the current buffer. Parameters: ~ - • {opts} (table|nil) See |vim.diagnostic.goto_next()| + • {opts} (`table?`) See |vim.diagnostic.goto_next()| hide({namespace}, {bufnr}) *vim.diagnostic.hide()* Hide currently displayed diagnostics. @@ -636,22 +636,22 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()* |vim.diagnostic.disable()|. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide + • {namespace} (`integer?`) Diagnostic namespace. When omitted, hide diagnostics from all namespaces. - • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. - When omitted, hide diagnostics in all buffers. + • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When + omitted, hide diagnostics in all buffers. is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()* Check whether diagnostics are disabled in a given buffer. Parameters: ~ - • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. - • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks - if all diagnostics are disabled in {bufnr}. Otherwise, - only checks if diagnostics from {namespace} are disabled. + • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. + • {namespace} (`integer?`) Diagnostic namespace. When omitted, checks if + all diagnostics are disabled in {bufnr}. Otherwise, only + checks if diagnostics from {namespace} are disabled. Return: ~ - (boolean) + (`boolean`) *vim.diagnostic.match()* match({str}, {pat}, {groups}, {severity_map}, {defaults}) @@ -669,25 +669,25 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults}) < Parameters: ~ - • {str} (string) String to parse diagnostics from. - • {pat} (string) Lua pattern with capture groups. - • {groups} (table) List of fields in a |diagnostic-structure| to - associate with captures from {pat}. - • {severity_map} (table) A table mapping the severity field from + • {str} (`string`) String to parse diagnostics from. + • {pat} (`string`) Lua pattern with capture groups. + • {groups} (`table`) List of fields in a |diagnostic-structure| + to associate with captures from {pat}. + • {severity_map} (`table`) A table mapping the severity field from {groups} with an item from |vim.diagnostic.severity|. - • {defaults} (table|nil) Table of default values for any fields not + • {defaults} (`table?`) Table of default values for any fields not listed in {groups}. When omitted, numeric values default to 0 and "severity" defaults to ERROR. Return: ~ - Diagnostic|nil: |diagnostic-structure| or `nil` if {pat} fails to - match {str}. + (`Diagnostic?`) |diagnostic-structure| or `nil` if {pat} fails to match + {str}. open_float({opts}, {...}) *vim.diagnostic.open_float()* Show diagnostics in a floating window. Parameters: ~ - • {opts} (table|nil) Configuration table with the same keys as + • {opts} (`table?`) Configuration table with the same keys as |vim.lsp.util.open_floating_preview()| in addition to the following: • bufnr: (number) Buffer number to show diagnostics from. @@ -737,7 +737,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()* from |vim.diagnostic.config()|. Return: ~ - integer|nil, integer|nil: ({float_bufnr}, {win_id}) + (`integer?, integer?`) ({float_bufnr}, {win_id}) reset({namespace}, {bufnr}) *vim.diagnostic.reset()* Remove all diagnostics from the given namespace. @@ -748,27 +748,27 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()* re-displayed, use |vim.diagnostic.hide()|. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove + • {namespace} (`integer?`) Diagnostic namespace. When omitted, remove diagnostics from all namespaces. - • {bufnr} (integer|nil) Remove diagnostics for the given buffer. + • {bufnr} (`integer?`) Remove diagnostics for the given buffer. When omitted, diagnostics are removed for all buffers. set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()* Set diagnostics for the given namespace and buffer. Parameters: ~ - • {namespace} (integer) The diagnostic namespace - • {bufnr} (integer) Buffer number - • {diagnostics} (table) A list of diagnostic items + • {namespace} (`integer`) The diagnostic namespace + • {bufnr} (`integer`) Buffer number + • {diagnostics} (`table`) A list of diagnostic items |diagnostic-structure| - • {opts} (table|nil) Display options to pass to + • {opts} (`table?`) Display options to pass to |vim.diagnostic.show()| setloclist({opts}) *vim.diagnostic.setloclist()* Add buffer diagnostics to the location list. Parameters: ~ - • {opts} (table|nil) Configuration table with the following keys: + • {opts} (`table?`) Configuration table with the following keys: • namespace: (number) Only add diagnostics from the given namespace. • winnr: (number, default 0) Window number to set location @@ -783,7 +783,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()* Add all diagnostics to the quickfix list. Parameters: ~ - • {opts} (table|nil) Configuration table with the following keys: + • {opts} (`table?`) Configuration table with the following keys: • namespace: (number) Only add diagnostics from the given namespace. • open: (boolean, default true) Open quickfix list after @@ -797,17 +797,17 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) Display diagnostics for the given namespace and buffer. Parameters: ~ - • {namespace} (integer|nil) Diagnostic namespace. When omitted, show + • {namespace} (`integer?`) Diagnostic namespace. When omitted, show diagnostics from all namespaces. - • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. + • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When omitted, show diagnostics in all buffers. - • {diagnostics} (table|nil) The diagnostics to display. When omitted, + • {diagnostics} (`table?`) The diagnostics to display. When omitted, use the saved diagnostics for the given namespace and buffer. This can be used to display a list of diagnostics without saving them or to display only a subset of diagnostics. May not be used when {namespace} or {bufnr} is nil. - • {opts} (table|nil) Display options. See + • {opts} (`table?`) Display options. See |vim.diagnostic.config()|. toqflist({diagnostics}) *vim.diagnostic.toqflist()* @@ -815,9 +815,9 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()* passed to |setqflist()| or |setloclist()|. Parameters: ~ - • {diagnostics} (table) List of diagnostics |diagnostic-structure|. + • {diagnostics} (`table`) List of diagnostics |diagnostic-structure|. Return: ~ - table[] of quickfix list items |setqflist-what| + (`table[]`) of quickfix list items |setqflist-what| vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 47c5c2379e..7e1c0a4a15 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -642,12 +642,12 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()* Without calling this, the server won't be notified of changes to a buffer. Parameters: ~ - • {bufnr} (integer) Buffer handle, or 0 for current - • {client_id} (integer) Client id + • {bufnr} (`integer`) Buffer handle, or 0 for current + • {client_id} (`integer`) Client id Return: ~ - (boolean) success `true` if client was attached successfully; `false` - otherwise + (`boolean`) success `true` if client was attached successfully; + `false` otherwise buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()* Detaches client from the specified buffer. Note: While the server is @@ -655,26 +655,26 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()* send notifications should it ignore this notification. Parameters: ~ - • {bufnr} (integer) Buffer handle, or 0 for current - • {client_id} (integer) Client id + • {bufnr} (`integer`) Buffer handle, or 0 for current + • {client_id} (`integer`) Client id buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()* Checks if a buffer is attached for a particular client. Parameters: ~ - • {bufnr} (integer) Buffer handle, or 0 for current - • {client_id} (integer) the client id + • {bufnr} (`integer`) Buffer handle, or 0 for current + • {client_id} (`integer`) the client id buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()* Send a notification to a server Parameters: ~ - • {bufnr} (integer|nil) The number of the buffer - • {method} (string) Name of the request method - • {params} (any) Arguments to send to the server + • {bufnr} (`integer?`) The number of the buffer + • {method} (`string`) Name of the request method + • {params} (`any`) Arguments to send to the server Return: ~ - (boolean) success true if any client returns true; false otherwise + (`boolean`) success true if any client returns true; false otherwise *vim.lsp.buf_request_all()* buf_request_all({bufnr}, {method}, {params}, {handler}) @@ -682,14 +682,15 @@ buf_request_all({bufnr}, {method}, {params}, {handler}) executes the `handler` callback with the combined result. Parameters: ~ - • {bufnr} (integer) Buffer handle, or 0 for current. - • {method} (string) LSP method name - • {params} (table|nil) Parameters to send to the server - • {handler} (function) Handler called after all requests are completed. - Server results are passed as a `client_id:result` map. + • {bufnr} (`integer`) Buffer handle, or 0 for current. + • {method} (`string`) LSP method name + • {params} (`table?`) Parameters to send to the server + • {handler} (`function`) Handler called after all requests are + completed. Server results are passed as a + `client_id:result` map. Return: ~ - (function) cancel Function that cancels all requests. + (`function`) cancel Function that cancels all requests. *vim.lsp.buf_request_sync()* buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) @@ -700,15 +701,15 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) result is different. Waits a maximum of {timeout_ms} (default 1000) ms. Parameters: ~ - • {bufnr} (integer) Buffer handle, or 0 for current. - • {method} (string) LSP method name - • {params} (table|nil) Parameters to send to the server - • {timeout_ms} (integer|nil) Maximum time in milliseconds to wait for a + • {bufnr} (`integer`) Buffer handle, or 0 for current. + • {method} (`string`) LSP method name + • {params} (`table?`) Parameters to send to the server + • {timeout_ms} (`integer?`) Maximum time in milliseconds to wait for a result. Defaults to 1000 Return (multiple): ~ - (table) result Map of client_id:request_result. - (string|nil) err On timeout, cancel, or error, `err` is a string + (`table`) result Map of client_id:request_result. + (`string?`) err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil. client() *vim.lsp.client* @@ -780,10 +781,10 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()* Checks whether a client is stopped. Parameters: ~ - • {client_id} (integer) + • {client_id} (`integer`) Return: ~ - (boolean) stopped true if client is stopped, false otherwise. + (`boolean`) stopped true if client is stopped, false otherwise. commands *vim.lsp.commands* Registry for client side commands. This is an extension point for plugins @@ -813,7 +814,7 @@ formatexpr({opts}) *vim.lsp.formatexpr()* 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`. Parameters: ~ - • {opts} (table) options for customizing the formatting expression + • {opts} (`table`) options for customizing the formatting expression which takes the following optional keys: • timeout_ms (default 500ms). The timeout period for the formatting request. @@ -823,26 +824,26 @@ get_buffers_by_client_id({client_id}) Returns list of buffers attached to client_id. Parameters: ~ - • {client_id} (integer) client id + • {client_id} (`integer`) client id Return: ~ - integer[] buffers list of buffer ids + (`integer[]`) buffers list of buffer ids get_client_by_id({client_id}) *vim.lsp.get_client_by_id()* Gets a client by id, or nil if the id is invalid. The returned client may not yet be fully initialized. Parameters: ~ - • {client_id} (integer) client id + • {client_id} (`integer`) client id Return: ~ - (nil|lsp.Client) client rpc object + (`lsp.Client?`) client rpc object get_clients({filter}) *vim.lsp.get_clients()* Get active clients. Parameters: ~ - • {filter} (table|nil) A table with key-value pairs used to filter the + • {filter} (`table?`) A table with key-value pairs used to filter the returned clients. The available keys are: • id (number): Only return clients with the given id • bufnr (number): Only return clients attached to this @@ -852,23 +853,23 @@ get_clients({filter}) *vim.lsp.get_clients()* method Return: ~ - lsp.Client []: List of |vim.lsp.client| objects + (`lsp.Client[]`) List of |vim.lsp.client| objects get_log_path() *vim.lsp.get_log_path()* Gets the path of the logfile used by the LSP client. Return: ~ - (string) path to log file + (`string`) path to log file omnifunc({findstart}, {base}) *vim.lsp.omnifunc()* Implements 'omnifunc' compatible LSP completion. Parameters: ~ - • {findstart} (integer) 0 or 1, decides behavior - • {base} (integer) findstart=0, text to match against + • {findstart} (`integer`) 0 or 1, decides behavior + • {base} (`integer`) findstart=0, text to match against Return: ~ - integer|table Decided by {findstart}: + (`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()|) @@ -887,7 +888,7 @@ set_log_level({level}) *vim.lsp.set_log_level()* Use `lsp.log_levels` for reverse lookup. Parameters: ~ - • {level} (integer|string) the case insensitive level name or number + • {level} (`integer|string`) the case insensitive level name or number See also: ~ • |vim.lsp.log_levels| @@ -932,9 +933,9 @@ start({config}, {opts}) *vim.lsp.start()* `ftplugin/.lua` (See |ftplugin-name|) Parameters: ~ - • {config} (table) Same configuration as documented in + • {config} (`table`) Same configuration as documented in |vim.lsp.start_client()| - • {opts} (nil|lsp.StartOpts) Optional keyword arguments: + • {opts} (`lsp.StartOpts?`) Optional keyword arguments: • reuse_client (fun(client: client, config: table): boolean) Predicate used to decide if a client should be re-used. Used on all running clients. The default implementation @@ -943,7 +944,7 @@ start({config}, {opts}) *vim.lsp.start()* re-using a client (0 for current). Return: ~ - (integer|nil) client_id + (`integer?`) client_id start_client({config}) *vim.lsp.start_client()* Starts and initializes a client with the given configuration. @@ -951,7 +952,7 @@ start_client({config}) *vim.lsp.start_client()* Field `cmd` in {config} is required. Parameters: ~ - • {config} ( lsp.ClientConfig ) Configuration for the server: + • {config} (`lsp.ClientConfig`) Configuration for the server: • cmd: (string[]|fun(dispatchers: table):table) command a list of strings treated like |jobstart()|. The command must launch the language server process. `cmd` can also be @@ -1060,7 +1061,7 @@ start_client({config}) *vim.lsp.start_client()* initialization. Return: ~ - (integer|nil) client_id. |vim.lsp.get_client_by_id()| Note: client may + (`integer?`) client_id. |vim.lsp.get_client_by_id()| Note: client may not be fully initialized. Use `on_init` to do any actions once the client has been initialized. @@ -1069,7 +1070,7 @@ status() *vim.lsp.status()* a string. Empty if there are no clients or if no new messages Return: ~ - (string) + (`string`) stop_client({client_id}, {force}) *vim.lsp.stop_client()* Stops a client(s). @@ -1083,9 +1084,9 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()* for this client, then force-shutdown is attempted. Parameters: ~ - • {client_id} integer|table id or |vim.lsp.client| object, or list + • {client_id} (`integer|table`) id or |vim.lsp.client| object, or list thereof - • {force} (boolean|nil) shutdown forcefully + • {force} (`boolean?`) shutdown forcefully tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()* Provides an interface between the built-in client and 'tagfunc'. @@ -1096,18 +1097,18 @@ tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()* LSP servers, falls back to using built-in tags. Parameters: ~ - • {pattern} (string) Pattern used to find a workspace symbol - • {flags} (string) See |tag-function| + • {pattern} (`string`) Pattern used to find a workspace symbol + • {flags} (`string`) See |tag-function| Return: ~ - table[] tags A list of matching tags + (`table[]`) tags A list of matching tags with({handler}, {override_config}) *vim.lsp.with()* Function to manage overriding defaults for LSP handlers. Parameters: ~ - • {handler} (lsp.Handler) See |lsp-handler| - • {override_config} (table) Table containing the keys to override + • {handler} (`lsp.Handler`) See |lsp-handler| + • {override_config} (`table`) Table containing the keys to override behavior of the {handler} @@ -1126,7 +1127,7 @@ code_action({options}) *vim.lsp.buf.code_action()* Selects a code action available at the current cursor position. Parameters: ~ - • {options} (table|nil) Optional table which holds the following + • {options} (`table?`) Optional table which holds the following optional fields: • context: (table|nil) Corresponds to `CodeActionContext` of the LSP specification: @@ -1158,7 +1159,7 @@ completion({context}) *vim.lsp.buf.completion()* called in Insert mode. Parameters: ~ - • {context} (table) (context support not yet implemented) Additional + • {context} (`table`) (context support not yet implemented) Additional information about the context in which a completion was triggered (how it was triggered, and by which trigger character, if applicable) @@ -1174,7 +1175,7 @@ declaration({options}) *vim.lsp.buf.declaration()* |vim.lsp.buf.definition()| instead. Parameters: ~ - • {options} (table|nil) additional options + • {options} (`table?`) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. • on_list: (function) |lsp-on-list-handler| replacing the @@ -1184,7 +1185,7 @@ definition({options}) *vim.lsp.buf.definition()* Jumps to the definition of the symbol under the cursor. Parameters: ~ - • {options} (table|nil) additional options + • {options} (`table?`) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. • on_list: (function) |lsp-on-list-handler| replacing the @@ -1208,7 +1209,7 @@ document_symbol({options}) *vim.lsp.buf.document_symbol()* Lists all symbols in the current buffer in the quickfix window. Parameters: ~ - • {options} (table|nil) additional options + • {options} (`table?`) additional options • on_list: (function) handler for list results. See |lsp-on-list-handler| @@ -1216,7 +1217,7 @@ execute_command({command_params}) *vim.lsp.buf.execute_command()* Executes an LSP server command. Parameters: ~ - • {command_params} (table) A valid `ExecuteCommandParams` object + • {command_params} (`table`) A valid `ExecuteCommandParams` object See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand @@ -1226,7 +1227,7 @@ format({options}) *vim.lsp.buf.format()* server clients. Parameters: ~ - • {options} (table|nil) Optional table which holds the following + • {options} (`table?`) Optional table which holds the following optional fields: • formatting_options (table|nil): Can be used to specify FormattingOptions. Some unspecified options will be @@ -1268,7 +1269,7 @@ implementation({options}) *vim.lsp.buf.implementation()* quickfix window. Parameters: ~ - • {options} (table|nil) additional options + • {options} (`table?`) additional options • on_list: (function) |lsp-on-list-handler| replacing the default handler. Called for any non-empty result. @@ -1290,8 +1291,8 @@ references({context}, {options}) *vim.lsp.buf.references()* window. Parameters: ~ - • {context} (table|nil) Context for the request - • {options} (table|nil) additional options + • {context} (`table?`) Context for the request + • {options} (`table?`) additional options • on_list: (function) handler for list results. See |lsp-on-list-handler| @@ -1307,9 +1308,9 @@ rename({new_name}, {options}) *vim.lsp.buf.rename()* Renames all references to the symbol under the cursor. Parameters: ~ - • {new_name} (string|nil) If not provided, the user will be prompted - for a new name using |vim.ui.input()|. - • {options} (table|nil) additional options + • {new_name} (`string?`) If not provided, the user will be prompted for + a new name using |vim.ui.input()|. + • {options} (`table?`) additional options • filter (function|nil): Predicate used to filter clients. Receives a client as argument and must return a boolean. Clients matching the predicate are included. @@ -1324,7 +1325,7 @@ type_definition({options}) *vim.lsp.buf.type_definition()* Jumps to the definition of the type of the symbol under the cursor. Parameters: ~ - • {options} (table|nil) additional options + • {options} (`table?`) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. • on_list: (function) |lsp-on-list-handler| replacing the @@ -1338,8 +1339,8 @@ workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()* string means no filtering is done. Parameters: ~ - • {query} (string|nil) optional - • {options} (table|nil) additional options + • {query} (`string?`) optional + • {options} (`table?`) additional options • on_list: (function) handler for list results. See |lsp-on-list-handler| @@ -1353,8 +1354,8 @@ get_namespace({client_id}, {is_pull}) |vim.diagnostic| for diagnostics Parameters: ~ - • {client_id} (integer) The id of the LSP client - • {is_pull} boolean? Whether the namespace is for a pull or push + • {client_id} (`integer`) The id of the LSP client + • {is_pull} (`boolean?`) Whether the namespace is for a pull or push client. Defaults to push *vim.lsp.diagnostic.on_diagnostic()* @@ -1383,8 +1384,9 @@ on_diagnostic({_}, {result}, {ctx}, {config}) < Parameters: ~ - • {ctx} lsp.HandlerContext - • {config} (table) Configuration table (see |vim.diagnostic.config()|). + • {ctx} (`lsp.HandlerContext`) + • {config} (`table`) Configuration table (see + |vim.diagnostic.config()|). *vim.lsp.diagnostic.on_publish_diagnostics()* on_publish_diagnostics({_}, {result}, {ctx}, {config}) @@ -1412,8 +1414,9 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config}) < Parameters: ~ - • {ctx} lsp.HandlerContext - • {config} (table) Configuration table (see |vim.diagnostic.config()|). + • {ctx} (`lsp.HandlerContext`) + • {config} (`table`) Configuration table (see + |vim.diagnostic.config()|). ============================================================================== @@ -1423,33 +1426,33 @@ clear({client_id}, {bufnr}) *vim.lsp.codelens.clear()* Clear the lenses Parameters: ~ - • {client_id} (integer|nil) filter by client_id. All clients if nil - • {bufnr} (integer|nil) filter by buffer. All buffers if nil + • {client_id} (`integer?`) filter by client_id. All clients if nil + • {bufnr} (`integer?`) filter by buffer. All buffers if nil display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()* Display the lenses using virtual text Parameters: ~ - • {lenses} lsp.CodeLens[]|nil lenses to display - • {bufnr} (integer) - • {client_id} (integer) + • {lenses} (`lsp.CodeLens[]?`) lenses to display + • {bufnr} (`integer`) + • {client_id} (`integer`) get({bufnr}) *vim.lsp.codelens.get()* Return all lenses for the given buffer Parameters: ~ - • {bufnr} (integer) Buffer number. 0 can be used for the current + • {bufnr} (`integer`) Buffer number. 0 can be used for the current buffer. Return: ~ - lsp.CodeLens[] + (`lsp.CodeLens[]`) *vim.lsp.codelens.on_codelens()* on_codelens({err}, {result}, {ctx}, {_}) |lsp-handler| for the method `textDocument/codeLens` Parameters: ~ - • {ctx} lsp.HandlerContext + • {ctx} (`lsp.HandlerContext`) refresh() *vim.lsp.codelens.refresh()* Refresh the codelens for the current buffer @@ -1467,9 +1470,9 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()* Store lenses for a specific buffer and client Parameters: ~ - • {lenses} lsp.CodeLens[]|nil lenses to store - • {bufnr} (integer) - • {client_id} (integer) + • {lenses} (`lsp.CodeLens[]?`) lenses to store + • {bufnr} (`integer`) + • {client_id} (`integer`) ============================================================================== @@ -1482,8 +1485,8 @@ enable({bufnr}, {enable}) *vim.lsp.inlay_hint.enable()* This API is pre-release (unstable). Parameters: ~ - • {bufnr} (integer|nil) Buffer handle, or 0 or nil for current - • {enable} (boolean|nil) true/nil to enable, false to disable + • {bufnr} (`integer?`) Buffer handle, or 0 or nil for current + • {enable} (`boolean?`) true/nil to enable, false to disable get({filter}) *vim.lsp.inlay_hint.get()* Get the list of inlay hints, (optionally) restricted by buffer or range. @@ -1506,12 +1509,13 @@ get({filter}) *vim.lsp.inlay_hint.get()* This API is pre-release (unstable). Parameters: ~ - • {filter} vim.lsp.inlay_hint.get.filter ? Optional filters |kwargs|: + • {filter} (`vim.lsp.inlay_hint.get.filter?`) Optional filters + |kwargs|: • bufnr (integer?): 0 for current buffer • range (lsp.Range?) Return: ~ - vim.lsp.inlay_hint.get.ret [] Each list item is a table with the + (`vim.lsp.inlay_hint.get.ret[]`) Each list item is a table with the following fields: • bufnr (integer) • client_id (integer) @@ -1522,10 +1526,10 @@ is_enabled({bufnr}) *vim.lsp.inlay_hint.is_enabled()* This API is pre-release (unstable). Parameters: ~ - • {bufnr} (integer|nil) Buffer handle, or 0 or nil for current + • {bufnr} (`integer?`) Buffer handle, or 0 or nil for current Return: ~ - (boolean) + (`boolean`) ============================================================================== @@ -1538,7 +1542,7 @@ force_refresh({bufnr}) *vim.lsp.semantic_tokens.force_refresh()* highlighting (|vim.lsp.semantic_tokens.start()| has been called for it) Parameters: ~ - • {bufnr} (integer|nil) filter by buffer. All buffers if nil, current + • {bufnr} (`integer?`) filter by buffer. All buffers if nil, current buffer if 0 *vim.lsp.semantic_tokens.get_at_pos()* @@ -1547,12 +1551,12 @@ get_at_pos({bufnr}, {row}, {col}) arguments, returns the token under the cursor. Parameters: ~ - • {bufnr} (integer|nil) Buffer number (0 for current buffer, default) - • {row} (integer|nil) Position row (default cursor position) - • {col} (integer|nil) Position column (default cursor position) + • {bufnr} (`integer?`) Buffer number (0 for current buffer, default) + • {row} (`integer?`) Position row (default cursor position) + • {col} (`integer?`) Position column (default cursor position) Return: ~ - (table|nil) List of tokens at position. Each token has the following + (`table?`) List of tokens at position. Each token has the following fields: • line (integer) line number, 0-based • start_col (integer) start column, 0-based @@ -1572,12 +1576,12 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) use inside |LspTokenUpdate| callbacks. Parameters: ~ - • {token} (table) a semantic token, found as `args.data.token` in + • {token} (`table`) a semantic token, found as `args.data.token` in |LspTokenUpdate|. - • {bufnr} (integer) the buffer to highlight - • {client_id} (integer) The ID of the |vim.lsp.client| - • {hl_group} (string) Highlight group name - • {opts} (table|nil) Optional parameters. + • {bufnr} (`integer`) the buffer to highlight + • {client_id} (`integer`) The ID of the |vim.lsp.client| + • {hl_group} (`string`) Highlight group name + • {opts} (`table?`) Optional parameters. • priority: (integer|nil) Priority for the applied extmark. Defaults to `vim.highlight.priorities.semantic_tokens + 3` @@ -1595,9 +1599,9 @@ start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()* < Parameters: ~ - • {bufnr} (integer) - • {client_id} (integer) - • {opts} (nil|table) Optional keyword arguments + • {bufnr} (`integer`) + • {client_id} (`integer`) + • {opts} (`table?`) Optional keyword arguments • debounce (integer, default: 200): Debounce token requests to the server by the given number in milliseconds @@ -1612,8 +1616,8 @@ stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()* from the buffer. Parameters: ~ - • {bufnr} (integer) - • {client_id} (integer) + • {bufnr} (`integer`) + • {client_id} (`integer`) ============================================================================== @@ -1632,8 +1636,8 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()* < Parameters: ~ - • {ctx} lsp.HandlerContext - • {config} (table) Configuration table. + • {ctx} (`lsp.HandlerContext`) + • {config} (`table`) Configuration table. • border: (default=nil) • Add borders to the floating window • See |vim.lsp.util.open_floating_preview()| for more @@ -1653,9 +1657,9 @@ signature_help({_}, {result}, {ctx}, {config}) < Parameters: ~ - • {result} (table) Response from the language server - • {ctx} lsp.HandlerContext Client context - • {config} (table) Configuration table. + • {result} (`table`) Response from the language server + • {ctx} (`lsp.HandlerContext`) Client context + • {config} (`table`) Configuration table. • border: (default=nil) • Add borders to the floating window • See |vim.lsp.util.open_floating_preview()| for more @@ -1671,9 +1675,9 @@ 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 a - list of edits (or nil, if not from a list) + • {text_document_edit} (`table`) a `TextDocumentEdit` object + • {index} (`integer`) Optional index of the edit, if from + a list of edits (or nil, if not from a list) See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit @@ -1683,9 +1687,9 @@ 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 - • {bufnr} (integer) Buffer id - • {offset_encoding} (string) utf-8|utf-16|utf-32 + • {text_edits} (`table`) list of `TextEdit` objects + • {bufnr} (`integer`) Buffer id + • {offset_encoding} (`string`) utf-8|utf-16|utf-32 See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit @@ -1695,24 +1699,24 @@ apply_workspace_edit({workspace_edit}, {offset_encoding}) Applies a `WorkspaceEdit`. Parameters: ~ - • {workspace_edit} (table) `WorkspaceEdit` - • {offset_encoding} (string) utf-8|utf-16|utf-32 (required) + • {workspace_edit} (`table`) `WorkspaceEdit` + • {offset_encoding} (`string`) utf-8|utf-16|utf-32 (required) buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()* Removes document highlights from a buffer. Parameters: ~ - • {bufnr} (integer|nil) Buffer id + • {bufnr} (`integer?`) Buffer id *vim.lsp.util.buf_highlight_references()* buf_highlight_references({bufnr}, {references}, {offset_encoding}) Shows a list of document highlights for a certain buffer. Parameters: ~ - • {bufnr} (integer) Buffer id - • {references} (table) List of `DocumentHighlight` objects to + • {bufnr} (`integer`) Buffer id + • {references} (`table`) List of `DocumentHighlight` objects to highlight - • {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32". + • {offset_encoding} (`string`) One of "utf-8", "utf-16", "utf-32". See also: ~ • https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent @@ -1722,14 +1726,14 @@ character_offset({buf}, {row}, {col}, {offset_encoding}) Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. Parameters: ~ - • {buf} (integer) buffer number (0 for current) - • {row} 0-indexed line - • {col} 0-indexed byte offset in line - • {offset_encoding} (string) utf-8|utf-16|utf-32 defaults to + • {buf} (`integer`) buffer number (0 for current) + • {row} (`integer`) 0-indexed line + • {col} (`integer`) 0-indexed byte offset in line + • {offset_encoding} (`string`) utf-8|utf-16|utf-32 defaults to `offset_encoding` of first client of `buf` Return: ~ - (integer) `offset_encoding` index of the character in line {row} + (`integer`) `offset_encoding` index of the character in line {row} column {col} in buffer {buf} *vim.lsp.util.convert_input_to_markdown_lines()* @@ -1744,12 +1748,12 @@ convert_input_to_markdown_lines({input}, {contents}) modifications. Parameters: ~ - • {input} (`MarkedString` | `MarkedString[]` | `MarkupContent`) - • {contents} (table|nil) List of strings to extend with converted - lines. Defaults to {}. + • {input} (`lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent`) + • {contents} (`table?`) List of strings to extend with converted lines. + Defaults to {}. Return: ~ - string[] extended with lines of converted markdown. + (`string[]`) extended with lines of converted markdown. See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover @@ -1759,15 +1763,15 @@ 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` - • {ft} (string|nil) filetype that will be use as the `lang` + • {signature_help} (`table`) Response of `textDocument/SignatureHelp` + • {ft} (`string?`) filetype that will be use as the `lang` for the label markdown code block - • {triggers} (table|nil) list of trigger characters from the lsp + • {triggers} (`table?`) list of trigger characters from the lsp server. used to better determine parameter offsets Return (multiple): ~ - (table|nil) table list of lines of converted markdown. - (table|nil) table of active hl + (`table?`) table list of lines of converted markdown. + (`table?`) table of active hl See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp @@ -1776,10 +1780,10 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* Returns indentation size. Parameters: ~ - • {bufnr} (integer|nil) Buffer handle, defaults to current + • {bufnr} (`integer?`) Buffer handle, defaults to current Return: ~ - (integer) indentation size + (`integer`) indentation size See also: ~ • 'shiftwidth' @@ -1789,13 +1793,13 @@ jump_to_location({location}, {offset_encoding}, {reuse_win}) Jumps to a location. Parameters: ~ - • {location} (table) (`Location`|`LocationLink`) - • {offset_encoding} (string|nil) utf-8|utf-16|utf-32 - • {reuse_win} (boolean|nil) Jump to existing window if buffer is + • {location} (`table`) (`Location`|`LocationLink`) + • {offset_encoding} (`string?`) utf-8|utf-16|utf-32 + • {reuse_win} (`boolean?`) Jump to existing window if buffer is already open. Return: ~ - (boolean) `true` if the jump succeeded + (`boolean`) `true` if the jump succeeded *vim.lsp.util.locations_to_items()* locations_to_items({locations}, {offset_encoding}) @@ -1809,23 +1813,23 @@ locations_to_items({locations}, {offset_encoding}) |setloclist()|. Parameters: ~ - • {locations} lsp.Location[]|lsp.LocationLink[] - • {offset_encoding} (string) offset_encoding for locations + • {locations} (`lsp.Location[]|lsp.LocationLink[]`) + • {offset_encoding} (`string`) offset_encoding for locations utf-8|utf-16|utf-32 default to first client of buffer Return: ~ - vim.lsp.util.LocationItem [] list of items + (`vim.lsp.util.LocationItem[]`) list of items lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()* Helper function to return nested values in language server settings Parameters: ~ - • {settings} (table) language server settings - • {section} string indicating the field of the settings table + • {settings} (`table`) language server settings + • {section} (`string`) indicating the field of the settings table Return: ~ - table|string The value of settings accessed via section + (`table|string`) The value of settings accessed via section *vim.lsp.util.make_floating_popup_options()* make_floating_popup_options({width}, {height}, {opts}) @@ -1833,9 +1837,9 @@ make_floating_popup_options({width}, {height}, {opts}) table can be passed to |nvim_open_win()|. Parameters: ~ - • {width} (integer) window width (in character cells) - • {height} (integer) window height (in character cells) - • {opts} (table) optional + • {width} (`integer`) window width (in character cells) + • {height} (`integer`) window height (in character cells) + • {opts} (`table`) optional • offset_x (integer) offset to add to `col` • offset_y (integer) offset to add to `row` • border (string or table) override `border` @@ -1851,7 +1855,7 @@ make_floating_popup_options({width}, {height}, {opts}) are not enough lines to display the full window height. Return: ~ - (table) Options + (`table`) Options *vim.lsp.util.make_formatting_params()* make_formatting_params({options}) @@ -1859,10 +1863,10 @@ make_formatting_params({options}) cursor position. Parameters: ~ - • {options} (table|nil) with valid `FormattingOptions` entries + • {options} (`table?`) with valid `FormattingOptions` entries Return: ~ - lsp.DocumentFormattingParams object + (`lsp.DocumentFormattingParams`) object See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting @@ -1873,18 +1877,18 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding}) similar to |vim.lsp.util.make_range_params()|. Parameters: ~ - • {start_pos} integer[]|nil {row,col} mark-indexed position. + • {start_pos} (`integer[]?`) {row,col} mark-indexed position. Defaults to the start of the last visual selection. - • {end_pos} integer[]|nil {row,col} mark-indexed position. + • {end_pos} (`integer[]?`) {row,col} mark-indexed position. Defaults to the end of the last visual selection. - • {bufnr} (integer|nil) buffer handle or 0 for current, + • {bufnr} (`integer?`) buffer handle or 0 for current, defaults to current - • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to + • {offset_encoding} (`"utf-8"|"utf-16"|"utf-32"?`) defaults to `offset_encoding` of first client of `bufnr` Return: ~ - (table) { textDocument = { uri = `current_file_uri` }, range = { start - = `start_position`, end = `end_position` } } + (`table`) { textDocument = { uri = `current_file_uri` }, range = { + start = `start_position`, end = `end_position` } } *vim.lsp.util.make_position_params()* make_position_params({window}, {offset_encoding}) @@ -1892,14 +1896,14 @@ make_position_params({window}, {offset_encoding}) cursor position. Parameters: ~ - • {window} (integer|nil) window handle or 0 for current, + • {window} (`integer?`) window handle or 0 for current, defaults to current - • {offset_encoding} (string|nil) utf-8|utf-16|utf-32|nil defaults to + • {offset_encoding} (`string?`) utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window` Return: ~ - (table) `TextDocumentPositionParams` object + (`table`) `TextDocumentPositionParams` object See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams @@ -1912,25 +1916,25 @@ make_range_params({window}, {offset_encoding}) `textDocument/rangeFormatting`. Parameters: ~ - • {window} (integer|nil) window handle or 0 for current, + • {window} (`integer?`) window handle or 0 for current, defaults to current - • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to + • {offset_encoding} (`"utf-8"|"utf-16"|"utf-32"?`) defaults to `offset_encoding` of first client of buffer of `window` Return: ~ - (table) { textDocument = { uri = `current_file_uri` }, range = { start - = `current_position`, end = `current_position` } } + (`table`) { textDocument = { uri = `current_file_uri` }, range = { + start = `current_position`, end = `current_position` } } *vim.lsp.util.make_text_document_params()* make_text_document_params({bufnr}) Creates a `TextDocumentIdentifier` object for the current buffer. Parameters: ~ - • {bufnr} (integer|nil) Buffer handle, defaults to current + • {bufnr} (`integer?`) Buffer handle, defaults to current Return: ~ - (table) `TextDocumentIdentifier` + (`table`) `TextDocumentIdentifier` See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier @@ -1940,19 +1944,19 @@ make_workspace_params({added}, {removed}) Create the workspace params Parameters: ~ - • {added} (table) - • {removed} (table) + • {added} (`table`) + • {removed} (`table`) *vim.lsp.util.open_floating_preview()* open_floating_preview({contents}, {syntax}, {opts}) Shows contents in a floating window. Parameters: ~ - • {contents} (table) of lines to show in window - • {syntax} (string) of syntax to set for opened buffer - • {opts} (table) with optional fields (additional keys are filtered - with |vim.lsp.util.make_floating_popup_options()| before - they are passed on to |nvim_open_win()|) + • {contents} (`table`) of lines to show in window + • {syntax} (`string`) of syntax to set for opened buffer + • {opts} (`table`) with optional fields (additional keys are + filtered with |vim.lsp.util.make_floating_popup_options()| + before they are passed on to |nvim_open_win()|) • height: (integer) height of floating window • width: (integer) width of floating window • wrap: (boolean, default true) wrap long lines @@ -1970,8 +1974,8 @@ open_floating_preview({contents}, {syntax}, {opts}) window with the same {focus_id} Return (multiple): ~ - (integer) bufnr of newly created float window - (integer) winid of newly created float window preview window + (`integer`) bufnr of newly created float window + (`integer`) winid of newly created float window preview window preview_location({location}, {opts}) *vim.lsp.util.preview_location()* Previews a location in a floating window @@ -1982,33 +1986,33 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()* definition) Parameters: ~ - • {location} (table) a single `Location` or `LocationLink` + • {location} (`table`) a single `Location` or `LocationLink` Return (multiple): ~ - (integer|nil) buffer id of float window - (integer|nil) window id of float window + (`integer?`) buffer id of float window + (`integer?`) window id of float window rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()* Rename old_fname to new_fname Parameters: ~ - • {opts} (table) + • {opts} (`table`) *vim.lsp.util.show_document()* show_document({location}, {offset_encoding}, {opts}) Shows document and optionally jumps to the location. Parameters: ~ - • {location} (table) (`Location`|`LocationLink`) - • {offset_encoding} (string|nil) utf-8|utf-16|utf-32 - • {opts} (table|nil) options + • {location} (`table`) (`Location`|`LocationLink`) + • {offset_encoding} (`string?`) utf-8|utf-16|utf-32 + • {opts} (`table?`) options • reuse_win (boolean) Jump to existing window if buffer is already open. • focus (boolean) Whether to focus/jump to location if possible. Defaults to true. Return: ~ - (boolean) `true` if succeeded + (`boolean`) `true` if succeeded *vim.lsp.util.stylize_markdown()* stylize_markdown({bufnr}, {contents}, {opts}) @@ -2023,8 +2027,8 @@ stylize_markdown({bufnr}, {contents}, {opts}) `open_floating_preview` instead Parameters: ~ - • {contents} (table) of lines to show in window - • {opts} (table) with optional fields + • {contents} (`table`) of lines to show in window + • {opts} (`table`) with optional fields • height of floating window • width of floating window • wrap_at character to wrap at for computing height @@ -2033,13 +2037,13 @@ stylize_markdown({bufnr}, {contents}, {opts}) • separator insert separator after code block Return: ~ - (table) stripped content + (`table`) stripped content symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()* Converts symbols to quickfix list items. Parameters: ~ - • {symbols} (table) DocumentSymbol[] or SymbolInformation[] + • {symbols} (`table`) DocumentSymbol[] or SymbolInformation[] ============================================================================== @@ -2049,32 +2053,32 @@ get_filename() *vim.lsp.log.get_filename()* Returns the log filename. Return: ~ - (string) log filename + (`string`) log filename get_level() *vim.lsp.log.get_level()* Gets the current log level. Return: ~ - (integer) current log level + (`integer`) current log level set_format_func({handle}) *vim.lsp.log.set_format_func()* Sets formatting function used to format logs Parameters: ~ - • {handle} (function) function to apply to logging arguments, pass + • {handle} (`function`) function to apply to logging arguments, pass vim.inspect for multi-line formatting set_level({level}) *vim.lsp.log.set_level()* Sets the current log level. Parameters: ~ - • {level} (string|integer) One of `vim.lsp.log.levels` + • {level} (`string|integer`) One of `vim.lsp.log.levels` should_log({level}) *vim.lsp.log.should_log()* Checks whether the level is sufficient for logging. Parameters: ~ - • {level} (integer) log level + • {level} (`integer`) log level Return: ~ (bool) true if would log, false if not @@ -2088,13 +2092,13 @@ connect({host}, {port}) *vim.lsp.rpc.connect()* and port Parameters: ~ - • {host} (string) host to connect to - • {port} (integer) port to connect to + • {host} (`string`) host to connect to + • {port} (`integer`) port to connect to Return: ~ - fun(dispatchers: vim.lsp.rpc.Dispatchers ): vim.lsp.rpc.PublicClient function - intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| - on the field cmd + (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`) + function intended to be passed to |vim.lsp.start_client()| or + |vim.lsp.start()| on the field cmd *vim.lsp.rpc.domain_socket_connect()* domain_socket_connect({pipe_path}) @@ -2103,48 +2107,48 @@ domain_socket_connect({pipe_path}) name on Windows) Parameters: ~ - • {pipe_path} (string) file path of the domain socket (Unix) or name of - the named pipe (Windows) to connect to + • {pipe_path} (`string`) file path of the domain socket (Unix) or name + of the named pipe (Windows) to connect to Return: ~ - fun(dispatchers: vim.lsp.rpc.Dispatchers ): - vim.lsp.rpc.PublicClient::function intended to be passed to - |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd + (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`) + function intended to be passed to |vim.lsp.start_client()| or + |vim.lsp.start()| on the field cmd format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* Constructs an error message from an LSP error object. Parameters: ~ - • {err} (table) The error object + • {err} (`table`) The error object Return: ~ - string::The formatted error message + (`string`) The formatted error message notify({method}, {params}) *vim.lsp.rpc.notify()* Sends a notification to the LSP server. Parameters: ~ - • {method} (string) The invoked LSP method - • {params} (table?) Parameters for the invoked LSP method + • {method} (`string`) The invoked LSP method + • {params} (`table?`) Parameters for the invoked LSP method Return: ~ - (boolean) `true` if notification could be sent, `false` if not + (`boolean`) `true` if notification could be sent, `false` if not *vim.lsp.rpc.request()* request({method}, {params}, {callback}, {notify_reply_callback}) Sends a request to the LSP server and runs {callback} upon response. Parameters: ~ - • {method} (string) The invoked LSP method - • {params} (table?) Parameters for the invoked LSP + • {method} (`string`) The invoked LSP method + • {params} (`table?`) Parameters for the invoked LSP method - • {callback} fun(err: lsp.ResponseError | nil, result: - any) Callback to invoke - • {notify_reply_callback} (function?) Callback to invoke as soon as a + • {callback} (`fun(err: lsp.ResponseError?, result: any)`) + Callback to invoke + • {notify_reply_callback} (`function?`) Callback to invoke as soon as a request is no longer pending Return: ~ - (boolean) success, integer|nil request_id true, message_id if request + (`boolean success, integer? request_id`) true, message_id if request could be sent, `false` if not *vim.lsp.rpc.rpc_response_error()* @@ -2152,12 +2156,12 @@ rpc_response_error({code}, {message}, {data}) Creates an RPC response object/table. Parameters: ~ - • {code} (integer) RPC error code defined by JSON RPC - • {message} (string|nil) arbitrary message to send to server - • {data} any|nil arbitrary data to send to server + • {code} (`integer`) RPC error code defined by JSON RPC + • {message} (`string?`) arbitrary message to send to server + • {data} (`any?`) arbitrary data to send to server Return: ~ - vim.lsp.rpc.Error + (`vim.lsp.rpc.Error`) *vim.lsp.rpc.start()* start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) @@ -2167,17 +2171,17 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) |vim.lsp.rpc.connect()| Parameters: ~ - • {cmd} (string) Command to start the LSP server. - • {cmd_args} string[] List of additional string arguments to - pass to {cmd}. - • {dispatchers} (table|nil) Dispatchers for LSP message types. + • {cmd} (`string`) Command to start the LSP server. + • {cmd_args} (`string[]`) List of additional string arguments + to pass to {cmd}. + • {dispatchers} (`table?`) Dispatchers for LSP message types. Valid dispatcher names are: • `"notification"` • `"server_request"` • `"on_error"` • `"on_exit"` - • {extra_spawn_params} (table|nil) Additional context for the LSP - server process. May contain: + • {extra_spawn_params} (`table?`) Additional context for the LSP server + process. May contain: • {cwd} (string) Working directory for the LSP server process • {detached?} (boolean) Detach the LSP server @@ -2187,7 +2191,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) variables for LSP server process Return: ~ - (table|nil) client RPC object, with these methods: + (`table?`) client RPC object, with these methods: • `notify()` |vim.lsp.rpc.notify()| • `request()` |vim.lsp.rpc.request()| • `is_closing()` returns a boolean indicating if the RPC is closing. @@ -2203,7 +2207,7 @@ make_client_capabilities() capabilities. Return: ~ - lsp.ClientCapabilities + (`lsp.ClientCapabilities`) Methods *vim.lsp.protocol.Methods* LSP method names. @@ -2216,10 +2220,10 @@ resolve_capabilities({server_capabilities}) Creates a normalized object describing LSP server capabilities. Parameters: ~ - • {server_capabilities} (table) Table of capabilities supported by the - server + • {server_capabilities} (`table`) Table of capabilities supported by + the server Return: ~ - lsp.ServerCapabilities|nil Normalized table of capabilities + (`lsp.ServerCapabilities?`) Normalized table of capabilities vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index b558a3fc8d..aadc73e95c 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -606,7 +606,7 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()* Highlight the yanked text Parameters: ~ - • {opts} (table|nil) Optional parameters + • {opts} (`table?`) Optional parameters • higroup highlight group for yanked region (default "IncSearch") • timeout time in ms before highlight is cleared (default 150) @@ -631,14 +631,14 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) Apply highlight group to range of text. Parameters: ~ - • {bufnr} (integer) Buffer number to apply highlighting to - • {ns} (integer) Namespace to add highlight to - • {higroup} (string) Highlight group to use for highlighting - • {start} integer[]|string Start of region as a (line, column) tuple - or string accepted by |getpos()| - • {finish} integer[]|string End of region as a (line, column) tuple or - string accepted by |getpos()| - • {opts} (table|nil) Optional parameters + • {bufnr} (`integer`) Buffer number to apply highlighting to + • {ns} (`integer`) Namespace to add highlight to + • {higroup} (`string`) Highlight group to use for highlighting + • {start} (`integer[]|string`) Start of region as a (line, column) + tuple or string accepted by |getpos()| + • {finish} (`integer[]|string`) End of region as a (line, column) + tuple or string accepted by |getpos()| + • {opts} (`table?`) Optional parameters • regtype type of range (see |setreg()|, default charwise) • inclusive boolean indicating whether the range is end-inclusive (default false) @@ -660,10 +660,10 @@ vim.regex({re}) *vim.regex()* They can be controlled with flags, see |/magic| and |/ignorecase|. Parameters: ~ - • {re} (string) + • {re} (`string`) Return: ~ - vim.regex + (`vim.regex`) *regex:match_line()* vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_}) @@ -673,10 +673,10 @@ vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_}) will be relative {start}. Parameters: ~ - • {bufnr} (integer) - • {line_idx} (integer) - • {start} (integer|nil) - • {end_} (integer|nil) + • {bufnr} (`integer`) + • {line_idx} (`integer`) + • {start} (`integer?`) + • {end_} (`integer?`) vim.regex:match_str({str}) *regex:match_str()* Match the string against the regex. If the string should match the regex @@ -686,7 +686,7 @@ vim.regex:match_str({str}) *regex:match_str()* be directly used as a condition in an if-statement. Parameters: ~ - • {str} (string) + • {str} (`string`) ============================================================================== @@ -712,9 +712,9 @@ vim.diff({a}, {b}, {opts}) *vim.diff()* < Parameters: ~ - • {a} (string) First string to compare - • {b} (string) Second string to compare - • {opts} table Optional parameters: + • {a} (`string`) First string to compare + • {b} (`string`) Second string to compare + • {opts} (`table`) Optional parameters: • `on_hunk` (callback): Invoked for each hunk in the diff. Return a negative number to cancel the callback for any remaining hunks. Args: @@ -753,7 +753,7 @@ vim.diff({a}, {b}, {opts}) *vim.diff()* the internal diff library. Return: ~ - string|table|nil See {opts.result_type}. `nil` if {opts.on_hunk} is + (`string|table?`) See {opts.result_type}. `nil` if {opts.on_hunk} is given. @@ -768,7 +768,7 @@ vim.mpack.decode({str}) *vim.mpack.decode()* Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object. Parameters: ~ - • {str} (string) + • {str} (`string`) vim.mpack.encode({obj}) *vim.mpack.encode()* Encodes (or "packs") Lua object {obj} as msgpack in a Lua string. @@ -794,8 +794,8 @@ vim.json.decode({str}, {opts}) *vim.json.decode()* < Parameters: ~ - • {str} (string) Stringified JSON data. - • {opts} table|nil Options table with keys: + • {str} (`string`) Stringified JSON data. + • {opts} (`table?`) Options table with keys: • luanil: (table) Table with keys: • object: (boolean) When true, converts `null` in JSON objects to Lua `nil` instead of |vim.NIL|. @@ -803,16 +803,16 @@ vim.json.decode({str}, {opts}) *vim.json.decode()* to Lua `nil` instead of |vim.NIL|. Return: ~ - any + (`any`) vim.json.encode({obj}) *vim.json.encode()* Encodes (or "packs") Lua object {obj} as JSON in a Lua string. Parameters: ~ - • {obj} any + • {obj} (`any`) Return: ~ - (string) + (`string`) ============================================================================== @@ -822,19 +822,19 @@ vim.base64.decode({str}) *vim.base64.decode()* Decode a Base64 encoded string. Parameters: ~ - • {str} (string) Base64 encoded string + • {str} (`string`) Base64 encoded string Return: ~ - (string) Decoded string + (`string`) Decoded string vim.base64.encode({str}) *vim.base64.encode()* Encode {str} using Base64. Parameters: ~ - • {str} (string) String to encode + • {str} (`string`) String to encode Return: ~ - (string) Encoded string + (`string`) Encoded string ============================================================================== @@ -857,11 +857,11 @@ vim.spell.check({str}) *vim.spell.check()* < Parameters: ~ - • {str} (string) + • {str} (`string`) Return: ~ - `{[1]: string, [2]: string, [3]: string}[]` List of tuples with three - items: + (`{[1]: string, [2]: string, [3]: string}[]`) 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 @@ -945,13 +945,13 @@ vim.iconv({str}, {from}, {to}, {opts}) *vim.iconv()* ":Man 3 iconv". Parameters: ~ - • {str} (string) Text to convert - • {from} (number) Encoding of {str} - • {to} (number) Target encoding - • {opts} table|nil + • {str} (`string`) Text to convert + • {from} (`number`) Encoding of {str} + • {to} (`number`) Target encoding + • {opts} (`table?`) Return: ~ - (string|nil) Converted string if conversion succeeds, `nil` otherwise. + (`string?`) Converted string if conversion succeeds, `nil` otherwise. vim.in_fast_event() *vim.in_fast_event()* Returns true if the code is executing as part of a "fast" event handler, @@ -967,10 +967,10 @@ vim.rpcnotify({channel}, {method}, {args}, {...}) *vim.rpcnotify()* This function also works in a fast callback |lua-loop-callbacks|. Parameters: ~ - • {channel} (integer) - • {method} (string) - • {args} any[]|nil - • {...} any|nil + • {channel} (`integer`) + • {method} (`string`) + • {args} (`any[]?`) + • {...} (`any?`) vim.rpcrequest({channel}, {method}, {args}, {...}) *vim.rpcrequest()* Sends a request to {channel} to invoke {method} via |RPC| and blocks until @@ -980,17 +980,17 @@ vim.rpcrequest({channel}, {method}, {args}, {...}) *vim.rpcrequest()* special value Parameters: ~ - • {channel} (integer) - • {method} (string) - • {args} any[]|nil - • {...} any|nil + • {channel} (`integer`) + • {method} (`string`) + • {args} (`any[]?`) + • {...} (`any?`) vim.schedule({fn}) *vim.schedule()* Schedules {fn} to be invoked soon by the main event-loop. Useful to avoid |textlock| or other temporary restrictions. Parameters: ~ - • {fn} (function) + • {fn} (`function`) vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()* Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not @@ -1001,9 +1001,9 @@ vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()* sequence. Parameters: ~ - • {str} (string) - • {index} (number) - • {use_utf16} any|nil + • {str} (`string`) + • {index} (`number`) + • {use_utf16} (`any?`) vim.str_utf_end({str}, {index}) *vim.str_utf_end()* Gets the distance (in bytes) from the last byte of the codepoint @@ -1020,11 +1020,11 @@ vim.str_utf_end({str}, {index}) *vim.str_utf_end()* < Parameters: ~ - • {str} (string) - • {index} (number) + • {str} (`string`) + • {index} (`number`) Return: ~ - (number) + (`number`) vim.str_utf_pos({str}) *vim.str_utf_pos()* Gets a list of the starting byte positions of each UTF-8 codepoint in the @@ -1033,10 +1033,10 @@ vim.str_utf_pos({str}) *vim.str_utf_pos()* Embedded NUL bytes are treated as terminating the string. Parameters: ~ - • {str} (string) + • {str} (`string`) Return: ~ - (table) + (`table`) vim.str_utf_start({str}, {index}) *vim.str_utf_start()* Gets the distance (in bytes) from the starting byte of the codepoint @@ -1056,11 +1056,11 @@ vim.str_utf_start({str}, {index}) *vim.str_utf_start()* < Parameters: ~ - • {str} (string) - • {index} (number) + • {str} (`string`) + • {index} (`number`) Return: ~ - (number) + (`number`) vim.str_utfindex({str}, {index}) *vim.str_utfindex()* Convert byte index to UTF-32 and UTF-16 indices. If {index} is not @@ -1072,23 +1072,23 @@ vim.str_utfindex({str}, {index}) *vim.str_utfindex()* that sequence. Parameters: ~ - • {str} (string) - • {index} (number|nil) + • {str} (`string`) + • {index} (`number?`) Return (multiple): ~ - (integer) UTF-32 index - (integer) UTF-16 index + (`integer`) UTF-32 index + (`integer`) UTF-16 index vim.stricmp({a}, {b}) *vim.stricmp()* Compares strings case-insensitively. Parameters: ~ - • {a} (string) - • {b} (string) + • {a} (`string`) + • {b} (`string`) Return: ~ - 0|1|-1 if strings are equal, {a} is greater than {b} or {a} is lesser - than {b}, respectively. + (`0|1|-1`) if strings are equal, {a} is greater than {b} or {a} is + lesser than {b}, respectively. vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()* Attach to ui events, similar to |nvim_ui_attach()| but receive events as @@ -1126,16 +1126,16 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()* < Parameters: ~ - • {ns} (integer) - • {options} table - • {callback} fun() + • {ns} (`integer`) + • {options} (`table`) + • {callback} (`fun()`) vim.ui_detach({ns}) *vim.ui_detach()* Detach a callback previously attached with |vim.ui_attach()| for the given namespace {ns}. Parameters: ~ - • {ns} (integer) + • {ns} (`integer`) vim.wait({time}, {callback}, {interval}, {fast_only}) *vim.wait()* Wait for {time} in milliseconds until {callback} returns `true`. @@ -1170,16 +1170,16 @@ vim.wait({time}, {callback}, {interval}, {fast_only}) *vim.wait()* < Parameters: ~ - • {time} (integer) Number of milliseconds to wait - • {callback} fun():|nil boolean Optional callback. Waits until + • {time} (`integer`) Number of milliseconds to wait + • {callback} (`fun(): boolean?`) Optional callback. Waits until {callback} returns true - • {interval} (integer|nil) (Approximate) number of milliseconds to - wait between polls - • {fast_only} (boolean|nil) If true, only |api-fast| events will be + • {interval} (`integer?`) (Approximate) number of milliseconds to wait + between polls + • {fast_only} (`boolean?`) If true, only |api-fast| events will be processed. Return: ~ - boolean, nil|-1|-2 + (`boolean, -1|-2?`) • If {callback} returns `true` during the {time}: `true, nil` • If {callback} never returns `true` during the {time}: `false, -1` • If {callback} is interrupted during the {time}: `false, -2` @@ -1376,7 +1376,7 @@ Option:append({value}) *vim.opt:append()* < Parameters: ~ - • {value} (string) Value to append + • {value} (`string`) Value to append Option:get() *vim.opt:get()* Returns a Lua-representation of the option. Boolean, number and string @@ -1422,7 +1422,7 @@ Option:get() *vim.opt:get()* < Return: ~ - string|integer|boolean|nil value of option + (`string|integer|boolean?`) value of option Option:prepend({value}) *vim.opt:prepend()* Prepend a value to string-style options. See |:set^=| @@ -1433,7 +1433,7 @@ Option:prepend({value}) *vim.opt:prepend()* < Parameters: ~ - • {value} (string) Value to prepend + • {value} (`string`) Value to prepend Option:remove({value}) *vim.opt:remove()* Remove a value from string-style options. See |:set-=| @@ -1444,7 +1444,7 @@ Option:remove({value}) *vim.opt:remove()* < Parameters: ~ - • {value} (string) Value to remove + • {value} (`string`) Value to remove vim.bo *vim.bo* Get or set buffer-scoped |options| for the buffer with number {bufnr}. @@ -1471,7 +1471,7 @@ vim.env *vim.env* < Parameters: ~ - • {var} (string) + • {var} (`string`) vim.go *vim.go* Get or set global |options|. Like `:setglobal`. Invalid key is an error. @@ -1553,12 +1553,12 @@ vim.cmd *vim.cmd()* < Parameters: ~ - • {command} string|table Command(s) to execute. If a string, executes - multiple lines of Vim script at once. In this case, it is - an alias to |nvim_exec2()|, where `opts.output` is set to - false. Thus it works identical to |:source|. If a table, - executes a single command. In this case, it is an alias to - |nvim_cmd()| where `opts` is empty. + • {command} (`string|table`) Command(s) to execute. If a string, + executes multiple lines of Vim script at once. In this + case, it is an alias to |nvim_exec2()|, where `opts.output` + is set to false. Thus it works identical to |:source|. If a + table, executes a single command. In this case, it is an + alias to |nvim_cmd()| where `opts` is empty. See also: ~ • |ex-cmd-index| @@ -1570,34 +1570,34 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn()* |vim.schedule_wrap()|ped automatically, so API functions are safe to call. Parameters: ~ - • {fn} (function) Callback to call once `timeout` expires - • {timeout} (integer) Number of milliseconds to wait before calling + • {fn} (`function`) Callback to call once `timeout` expires + • {timeout} (`integer`) Number of milliseconds to wait before calling `fn` Return: ~ - (table) timer luv timer object + (`table`) timer luv timer object *vim.deprecate()* vim.deprecate({name}, {alternative}, {version}, {plugin}, {backtrace}) Shows a deprecation message to the user. Parameters: ~ - • {name} string Deprecated feature (function, API, etc.). - • {alternative} (string|nil) Suggested alternative feature. - • {version} string Version when the deprecated function will be + • {name} (`string`) Deprecated feature (function, API, etc.). + • {alternative} (`string?`) Suggested alternative feature. + • {version} (`string`) Version when the deprecated function will be removed. - • {plugin} string|nil Name of the plugin that owns the deprecated + • {plugin} (`string?`) Name of the plugin that owns the deprecated feature. Defaults to "Nvim". - • {backtrace} boolean|nil Prints backtrace. Defaults to true. + • {backtrace} (`boolean?`) Prints backtrace. Defaults to true. Return: ~ - (string|nil) Deprecated message, or nil if no message was shown. + (`string?`) Deprecated message, or nil if no message was shown. vim.inspect *vim.inspect()* Gets a human-readable representation of the given object. Return: ~ - (string) + (`string`) See also: ~ • |vim.print()| @@ -1613,10 +1613,10 @@ vim.keycode({str}) *vim.keycode()* < Parameters: ~ - • {str} (string) String to be converted. + • {str} (`string`) String to be converted. Return: ~ - (string) + (`string`) See also: ~ • |nvim_replace_termcodes()| @@ -1635,9 +1635,9 @@ vim.notify({msg}, {level}, {opts}) *vim.notify()* writes to |:messages|. Parameters: ~ - • {msg} (string) Content of the notification to show to the user. - • {level} (integer|nil) One of the values from |vim.log.levels|. - • {opts} (table|nil) Optional parameters. Unused by default. + • {msg} (`string`) Content of the notification to show to the user. + • {level} (`integer?`) One of the values from |vim.log.levels|. + • {opts} (`table?`) Optional parameters. Unused by default. vim.notify_once({msg}, {level}, {opts}) *vim.notify_once()* Displays a notification only one time. @@ -1646,12 +1646,12 @@ vim.notify_once({msg}, {level}, {opts}) *vim.notify_once()* display a notification. Parameters: ~ - • {msg} (string) Content of the notification to show to the user. - • {level} (integer|nil) One of the values from |vim.log.levels|. - • {opts} (table|nil) Optional parameters. Unused by default. + • {msg} (`string`) Content of the notification to show to the user. + • {level} (`integer?`) One of the values from |vim.log.levels|. + • {opts} (`table?`) Optional parameters. Unused by default. Return: ~ - (boolean) true if message was displayed, else false + (`boolean`) true if message was displayed, else false vim.on_key({fn}, {ns_id}) *vim.on_key()* Adds Lua function {fn} with namespace id {ns_id} as a listener to every, @@ -1666,15 +1666,15 @@ vim.on_key({fn}, {ns_id}) *vim.on_key()* • {fn} will receive the keys after mappings have been evaluated Parameters: ~ - • {fn} fun(key: string) Function invoked on every key press. + • {fn} (`fun(key: string)`) Function invoked on every key press. |i_CTRL-V| Returning nil removes the callback associated with namespace {ns_id}. - • {ns_id} integer? Namespace ID. If nil or 0, generates and returns a - new |nvim_create_namespace()| id. + • {ns_id} (`integer?`) Namespace ID. If nil or 0, generates and returns + a new |nvim_create_namespace()| id. Return: ~ - (integer) Namespace id associated with {fn}. Or count of all callbacks - if on_key() is called without arguments. + (`integer`) Namespace id associated with {fn}. Or count of all + callbacks if on_key() is called without arguments. vim.paste({lines}, {phase}) *vim.paste()* Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the @@ -1693,9 +1693,9 @@ vim.paste({lines}, {phase}) *vim.paste()* < Parameters: ~ - • {lines} string[] # |readfile()|-style list of lines to paste. + • {lines} (`string[]`) |readfile()|-style list of lines to paste. |channel-lines| - • {phase} paste_phase -1: "non-streaming" paste: the call contains all + • {phase} (`-1|1|2|3`) -1: "non-streaming" paste: the call contains all lines. If paste is "streamed", `phase` indicates the stream state: • 1: starts the paste (exactly once) @@ -1703,10 +1703,10 @@ vim.paste({lines}, {phase}) *vim.paste()* • 3: ends the paste (exactly once) Return: ~ - (boolean) result false if client should cancel the paste. + (`boolean`) result false if client should cancel the paste. See also: ~ - • |paste| @alias paste_phase -1 | 1 | 2 | 3 + • |paste| vim.print({...}) *vim.print()* "Pretty prints" the given arguments and returns them unmodified. @@ -1716,7 +1716,7 @@ vim.print({...}) *vim.print()* < Return: ~ - any given arguments. + (`any`) given arguments. See also: ~ • |vim.inspect()| @@ -1732,17 +1732,17 @@ vim.region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) returned as |v:maxcol| (big number). Parameters: ~ - • {bufnr} (integer) Buffer number, or 0 for current buffer - • {pos1} integer[]|string Start of region as a (line, column) + • {bufnr} (`integer`) Buffer number, or 0 for current buffer + • {pos1} (`integer[]|string`) Start of region as a (line, column) tuple or |getpos()|-compatible string - • {pos2} integer[]|string End of region as a (line, column) tuple - or |getpos()|-compatible string - • {regtype} (string) |setreg()|-style selection type - • {inclusive} (boolean) Controls whether the ending column is inclusive - (see also 'selection'). + • {pos2} (`integer[]|string`) End of region as a (line, column) + tuple or |getpos()|-compatible string + • {regtype} (`string`) |setreg()|-style selection type + • {inclusive} (`boolean`) Controls whether the ending column is + inclusive (see also 'selection'). Return: ~ - (table) region Dict of the form `{linenr = {startcol,endcol}}`. + (`table`) region Dict of the form `{linenr = {startcol,endcol}}`. `endcol` is exclusive, and whole lines are returned as `{startcol,endcol} = {0,-1}`. @@ -1759,10 +1759,10 @@ vim.schedule_wrap({fn}) *vim.schedule_wrap()* < Parameters: ~ - • {fn} (function) + • {fn} (`function`) Return: ~ - (function) + (`function`) See also: ~ • |lua-loop-callbacks| @@ -1792,8 +1792,8 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()* throws an error if {cmd} cannot be run. Parameters: ~ - • {cmd} (string[]) Command to execute - • {opts} (SystemOpts|nil) Options: + • {cmd} (`string[]`) Command to execute + • {opts} (`vim.SystemOpts?`) Options: • cwd: (string) Set the current working directory for the sub-process. • env: table Set environment variables for @@ -1823,12 +1823,13 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()* process will still keep the parent's event loop alive unless the parent process calls |uv.unref()| on the child's process handle. - • {on_exit} (function|nil) Called when subprocess exits. When provided, - the command runs asynchronously. Receives SystemCompleted - object, see return of SystemObj:wait(). + • {on_exit} (`fun(out: vim.SystemCompleted)?`) Called when subprocess + exits. When provided, the command runs asynchronously. + Receives SystemCompleted object, see return of + SystemObj:wait(). Return: ~ - vim.SystemObj Object with the fields: + (`vim.SystemObj`) Object with the fields: • pid (integer) Process ID • wait (fun(timeout: integer|nil): SystemCompleted) Wait for the process to complete. Upon timeout the process is sent the KILL @@ -1855,12 +1856,12 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()* Can also be pretty-printed with `:Inspect!`. *:Inspect!* Parameters: ~ - • {bufnr} (integer|nil) defaults to the current buffer - • {row} (integer|nil) row to inspect, 0-based. Defaults to the row - of the current cursor - • {col} (integer|nil) col to inspect, 0-based. Defaults to the col - of the current cursor - • {filter} (table|nil) a table with key-value pairs to filter the items + • {bufnr} (`integer?`) defaults to the current buffer + • {row} (`integer?`) row to inspect, 0-based. Defaults to the row of + the current cursor + • {col} (`integer?`) col to inspect, 0-based. Defaults to the col of + the current cursor + • {filter} (`table?`) a table with key-value pairs to filter the items • syntax (boolean): include syntax based highlight groups (defaults to true) • treesitter (boolean): include treesitter based highlight @@ -1872,7 +1873,7 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()* (defaults to true) Return: ~ - (table) a table with the following key-value pairs. Items are in + (`table`) a table with the following key-value pairs. Items are in "traversal order": • treesitter: a list of treesitter captures • syntax: a list of syntax groups @@ -1888,12 +1889,12 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* Can also be shown with `:Inspect`. *:Inspect* Parameters: ~ - • {bufnr} (integer|nil) defaults to the current buffer - • {row} (integer|nil) row to inspect, 0-based. Defaults to the row - of the current cursor - • {col} (integer|nil) col to inspect, 0-based. Defaults to the col - of the current cursor - • {filter} (table|nil) see |vim.inspect_pos()| + • {bufnr} (`integer?`) defaults to the current buffer + • {row} (`integer?`) row to inspect, 0-based. Defaults to the row of + the current cursor + • {col} (`integer?`) col to inspect, 0-based. Defaults to the col of + the current cursor + • {filter} (`table?`) see |vim.inspect_pos()| @@ -1905,11 +1906,11 @@ vim.deep_equal({a}, {b}) *vim.deep_equal()* All other types are compared using the equality `==` operator. Parameters: ~ - • {a} any First value - • {b} any Second value + • {a} (`any`) First value + • {b} (`any`) Second value Return: ~ - (boolean) `true` if values are equals, else `false` + (`boolean`) `true` if values are equals, else `false` vim.deepcopy({orig}, {noref}) *vim.deepcopy()* Returns a deep copy of the given object. Non-table objects are copied as @@ -1923,15 +1924,15 @@ vim.deepcopy({orig}, {noref}) *vim.deepcopy()* fields. Parameters: ~ - • {orig} (table) Table to copy - • {noref} (boolean|nil) When `false` (default) a contained table is - only copied once and all references point to this single - copy. When `true` every occurrence of a table results in a - new copy. This also means that a cyclic reference can cause + • {orig} (`table`) Table to copy + • {noref} (`boolean?`) When `false` (default) a contained table is only + copied once and all references point to this single copy. + When `true` every occurrence of a table results in a new + copy. This also means that a cyclic reference can cause `deepcopy()` to fail. Return: ~ - (table) Table of copied keys and (nested) values. + (`table`) Table of copied keys and (nested) values. vim.defaulttable({createfn}) *vim.defaulttable()* Creates a table whose missing keys are provided by {createfn} (like @@ -1944,21 +1945,21 @@ vim.defaulttable({createfn}) *vim.defaulttable()* < Parameters: ~ - • {createfn} function?(key:any):any Provides the value for a missing + • {createfn} (`fun(key:any):any?`) Provides the value for a missing `key`. Return: ~ - (table) Empty table with `__index` metamethod. + (`table`) Empty table with `__index` metamethod. vim.endswith({s}, {suffix}) *vim.endswith()* Tests if `s` ends with `suffix`. Parameters: ~ - • {s} (string) String - • {suffix} (string) Suffix to match + • {s} (`string`) String + • {suffix} (`string`) Suffix to match Return: ~ - (boolean) `true` if `suffix` is a suffix of `s` + (`boolean`) `true` if `suffix` is a suffix of `s` vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()* Gets an |iterator| that splits a string at each instance of a separator, @@ -1978,15 +1979,15 @@ vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()* < Parameters: ~ - • {s} (string) String to split - • {sep} (string) Separator or pattern - • {opts} (table|nil) Keyword arguments |kwargs|: + • {s} (`string`) String to split + • {sep} (`string`) Separator or pattern + • {opts} (`table?`) Keyword arguments |kwargs|: • plain: (boolean) Use `sep` literally (as in string.find). • trimempty: (boolean) Discard empty segments at start and end of the sequence. Return: ~ - (function) Iterator over the split components + (`function`) Iterator over the split components See also: ~ • |string.gmatch()| @@ -1999,20 +2000,20 @@ vim.is_callable({f}) *vim.is_callable()* Returns true if object `f` can be called as a function. Parameters: ~ - • {f} any Any object + • {f} (`any`) Any object Return: ~ - (boolean) `true` if `f` is callable, else `false` + (`boolean`) `true` if `f` is callable, else `false` vim.list_contains({t}, {value}) *vim.list_contains()* Checks if a list-like table (integer keys without gaps) contains `value`. Parameters: ~ - • {t} (table) Table to check (must be list-like, not validated) - • {value} any Value to compare + • {t} (`table`) Table to check (must be list-like, not validated) + • {value} (`any`) Value to compare Return: ~ - (boolean) `true` if `t` contains `value` + (`boolean`) `true` if `t` contains `value` See also: ~ • |vim.tbl_contains()| for checking values in general tables @@ -2023,13 +2024,13 @@ vim.list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()* NOTE: This mutates dst! Parameters: ~ - • {dst} (table) List which will be modified and appended to - • {src} (table) List from which values will be inserted - • {start} (integer|nil) Start index on src. Defaults to 1 - • {finish} (integer|nil) Final index on src. Defaults to `#src` + • {dst} (`table`) List which will be modified and appended to + • {src} (`table`) List from which values will be inserted + • {start} (`integer?`) Start index on src. Defaults to 1 + • {finish} (`integer?`) Final index on src. Defaults to `#src` Return: ~ - (table) dst + (`table`) dst See also: ~ • |vim.tbl_extend()| @@ -2039,21 +2040,21 @@ vim.list_slice({list}, {start}, {finish}) *vim.list_slice()* (inclusive) Parameters: ~ - • {list} (list) Table - • {start} (integer|nil) Start range of slice - • {finish} (integer|nil) End range of slice + • {list} (`list`) Table + • {start} (`integer?`) Start range of slice + • {finish} (`integer?`) End range of slice Return: ~ - (list) Copy of table sliced from start to finish (inclusive) + (`list`) Copy of table sliced from start to finish (inclusive) vim.pesc({s}) *vim.pesc()* Escapes magic chars in |lua-patterns|. Parameters: ~ - • {s} (string) String to escape + • {s} (`string`) String to escape Return: ~ - (string) %-escaped pattern string + (`string`) %-escaped pattern string See also: ~ • https://github.com/rxi/lume @@ -2084,10 +2085,10 @@ vim.ringbuf({size}) *vim.ringbuf()* • |Ringbuf:clear()| Parameters: ~ - • {size} (integer) + • {size} (`integer`) Return: ~ - (table) + (`table`) vim.Ringbuf:clear() *Ringbuf:clear()* Clear all items. @@ -2096,28 +2097,28 @@ vim.Ringbuf:peek() *Ringbuf:peek()* Returns the first unread item without removing it Return: ~ - any?|nil + (`any?`) vim.Ringbuf:pop() *Ringbuf:pop()* Removes and returns the first unread item Return: ~ - any?|nil + (`any?`) vim.Ringbuf:push({item}) *Ringbuf:push()* Adds an item, overriding the oldest item if the buffer is full. Parameters: ~ - • {item} any + • {item} (`any`) vim.spairs({t}) *vim.spairs()* Enumerates key-value pairs of a table, ordered by key. Parameters: ~ - • {t} (table) Dict-like table + • {t} (`table`) Dict-like table Return: ~ - (function) |for-in| iterator over sorted keys and their values + (`function`) |for-in| iterator over sorted keys and their values See also: ~ • Based on https://github.com/premake/premake-core/blob/master/src/base/table.lua @@ -2134,13 +2135,13 @@ vim.split({s}, {sep}, {opts}) *vim.split()* < Parameters: ~ - • {s} (string) String to split - • {sep} (string) Separator or pattern - • {opts} (table|nil) Keyword arguments |kwargs| accepted by + • {s} (`string`) String to split + • {sep} (`string`) Separator or pattern + • {opts} (`table?`) Keyword arguments |kwargs| accepted by |vim.gsplit()| Return: ~ - string[] List of split components + (`string[]`) List of split components See also: ~ • |vim.gsplit()| @@ -2150,11 +2151,11 @@ vim.startswith({s}, {prefix}) *vim.startswith()* Tests if `s` starts with `prefix`. Parameters: ~ - • {s} (string) String - • {prefix} (string) Prefix to match + • {s} (`string`) String + • {prefix} (`string`) Prefix to match Return: ~ - (boolean) `true` if `prefix` is a prefix of `s` + (`boolean`) `true` if `prefix` is a prefix of `s` vim.tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()* Add the reverse lookup values to an existing table. For example: @@ -2163,10 +2164,10 @@ vim.tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()* Note that this modifies the input. Parameters: ~ - • {o} (table) Table to add the reverse to + • {o} (`table`) Table to add the reverse to Return: ~ - (table) o + (`table`) o vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()* Checks if a table contains a given value, specified either directly or via @@ -2180,14 +2181,14 @@ vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()* < Parameters: ~ - • {t} (table) Table to check - • {value} any Value to compare or predicate function reference - • {opts} (table|nil) Keyword arguments |kwargs|: + • {t} (`table`) Table to check + • {value} (`any`) Value to compare or predicate function reference + • {opts} (`table?`) Keyword arguments |kwargs|: • predicate: (boolean) `value` is a function reference to be checked (default false) Return: ~ - (boolean) `true` if `t` contains `value` + (`boolean`) `true` if `t` contains `value` See also: ~ • |vim.list_contains()| for checking values in list-like tables @@ -2199,10 +2200,10 @@ vim.tbl_count({t}) *vim.tbl_count()* < Parameters: ~ - • {t} (table) Table + • {t} (`table`) Table Return: ~ - (integer) Number of non-nil values in table + (`integer`) Number of non-nil values in table See also: ~ • https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua @@ -2211,15 +2212,15 @@ vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()* Merges recursively two or more tables. Parameters: ~ - • {behavior} (string) Decides what to do if a key is found in more than - one map: + • {behavior} (`string`) Decides what to do if a key is found in more + than one map: • "error": raise an error • "keep": use value from the leftmost map • "force": use value from the rightmost map - • {...} (table) Two or more tables + • {...} (`table`) Two or more tables Return: ~ - (table) Merged table + (`table`) Merged table See also: ~ • |vim.tbl_extend()| @@ -2228,15 +2229,15 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()* Merges two or more tables. Parameters: ~ - • {behavior} (string) Decides what to do if a key is found in more than - one map: + • {behavior} (`string`) Decides what to do if a key is found in more + than one map: • "error": raise an error • "keep": use value from the leftmost map • "force": use value from the rightmost map - • {...} (table) Two or more tables + • {...} (`table`) Two or more tables Return: ~ - (table) Merged table + (`table`) Merged table See also: ~ • |extend()| @@ -2245,21 +2246,21 @@ vim.tbl_filter({func}, {t}) *vim.tbl_filter()* Filter a table using a predicate function Parameters: ~ - • {func} (function) Function - • {t} (table) Table + • {func} (`function`) Function + • {t} (`table`) Table Return: ~ - (table) Table of filtered values + (`table`) Table of filtered values vim.tbl_flatten({t}) *vim.tbl_flatten()* Creates a copy of a list-like table such that any nested tables are "unrolled" and appended to the result. Parameters: ~ - • {t} (table) List-like table + • {t} (`table`) List-like table Return: ~ - (table) Flattened copy of the given list-like table + (`table`) Flattened copy of the given list-like table See also: ~ • From https://github.com/premake/premake-core/blob/master/src/base/table.lua @@ -2274,12 +2275,12 @@ vim.tbl_get({o}, {...}) *vim.tbl_get()* < Parameters: ~ - • {o} (table) Table to index - • {...} any Optional keys (0 or more, variadic) via which to index the - table + • {o} (`table`) Table to index + • {...} (`any`) Optional keys (0 or more, variadic) via which to index + the table Return: ~ - any Nested value indexed by key (if it exists), else nil + (`any`) Nested value indexed by key (if it exists), else nil vim.tbl_isarray({t}) *vim.tbl_isarray()* Tests if `t` is an "array": a table indexed only by integers (potentially @@ -2293,10 +2294,10 @@ vim.tbl_isarray({t}) *vim.tbl_isarray()* |rpcrequest()| or |vim.fn|. Parameters: ~ - • {t} (table) + • {t} (`table`) Return: ~ - (boolean) `true` if array-like table, else `false`. + (`boolean`) `true` if array-like table, else `false`. See also: ~ • https://github.com/openresty/luajit2#tableisarray @@ -2305,10 +2306,10 @@ vim.tbl_isempty({t}) *vim.tbl_isempty()* Checks if a table is empty. Parameters: ~ - • {t} (table) Table to check + • {t} (`table`) Table to check Return: ~ - (boolean) `true` if `t` is empty + (`boolean`) `true` if `t` is empty See also: ~ • https://github.com/premake/premake-core/blob/master/src/base/table.lua @@ -2322,10 +2323,10 @@ vim.tbl_islist({t}) *vim.tbl_islist()* |rpcrequest()| or |vim.fn|. Parameters: ~ - • {t} (table) + • {t} (`table`) Return: ~ - (boolean) `true` if list-like table, else `false`. + (`boolean`) `true` if list-like table, else `false`. See also: ~ • |vim.tbl_isarray()| @@ -2335,10 +2336,10 @@ vim.tbl_keys({t}) *vim.tbl_keys()* return table of keys is not guaranteed. Parameters: ~ - • {t} (table) Table + • {t} (`table`) Table Return: ~ - (list) List of keys + (`list`) List of keys See also: ~ • From https://github.com/premake/premake-core/blob/master/src/base/table.lua @@ -2347,30 +2348,30 @@ vim.tbl_map({func}, {t}) *vim.tbl_map()* Apply a function to all values of a table. Parameters: ~ - • {func} (function) Function - • {t} (table) Table + • {func} (`function`) Function + • {t} (`table`) Table Return: ~ - (table) Table of transformed values + (`table`) Table of transformed values vim.tbl_values({t}) *vim.tbl_values()* Return a list of all values used in a table. However, the order of the return table of values is not guaranteed. Parameters: ~ - • {t} (table) Table + • {t} (`table`) Table Return: ~ - (list) List of values + (`list`) List of values vim.trim({s}) *vim.trim()* Trim whitespace (Lua pattern "%s") from both sides of a string. Parameters: ~ - • {s} (string) String to trim + • {s} (`string`) String to trim Return: ~ - (string) String with whitespace removed from its beginning and end + (`string`) String with whitespace removed from its beginning and end See also: ~ • |lua-patterns| @@ -2410,7 +2411,7 @@ vim.validate({opt}) *vim.validate()* < Parameters: ~ - • {opt} (table) Names of parameters to validate. Each key is a + • {opt} (`table`) Names of parameters to validate. Each key is a parameter name; each value is a tuple in one of these forms: 1. (arg_value, type_name, optional) • arg_value: argument value @@ -2447,9 +2448,9 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()* Finds Lua modules for the given module name. Parameters: ~ - • {modname} (string) Module name, or `"*"` to find the top-level + • {modname} (`string`) Module name, or `"*"` to find the top-level modules instead - • {opts} (table|nil) Options for finding a module: + • {opts} (`table?`) Options for finding a module: • rtp: (boolean) Search for modname in the runtime path (defaults to `true`) • paths: (string[]) Extra paths to search for modname @@ -2462,7 +2463,7 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()* first one (defaults to `false`) Return: ~ - (list) A list of results with the following properties: + (`list`) A list of results with the following properties: • modpath: (string) the path to the module • modname: (string) the name of the module • stat: (table|nil) the fs_stat of the module path. Won't be returned @@ -2472,7 +2473,7 @@ vim.loader.reset({path}) *vim.loader.reset()* Resets the cache for the path, or all the paths if path is nil. Parameters: ~ - • {path} string? path to reset + • {path} (`string?`) path to reset ============================================================================== @@ -2482,57 +2483,57 @@ vim.uri_decode({str}) *vim.uri_decode()* URI-decodes a string containing percent escapes. Parameters: ~ - • {str} (string) string to decode + • {str} (`string`) string to decode Return: ~ - (string) decoded string + (`string`) decoded string vim.uri_encode({str}, {rfc}) *vim.uri_encode()* URI-encodes a string using percent escapes. Parameters: ~ - • {str} (string) string to encode - • {rfc} "rfc2396" | "rfc2732" | "rfc3986" | nil + • {str} (`string`) string to encode + • {rfc} (`"rfc2396"|"rfc2732"|"rfc3986"?`) Return: ~ - (string) encoded string + (`string`) encoded string vim.uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()* Gets a URI from a bufnr. Parameters: ~ - • {bufnr} (integer) + • {bufnr} (`integer`) Return: ~ - (string) URI + (`string`) URI vim.uri_from_fname({path}) *vim.uri_from_fname()* Gets a URI from a file path. Parameters: ~ - • {path} (string) Path to file + • {path} (`string`) Path to file Return: ~ - (string) URI + (`string`) URI vim.uri_to_bufnr({uri}) *vim.uri_to_bufnr()* Gets the buffer for a uri. Creates a new unloaded buffer if no buffer for the uri already exists. Parameters: ~ - • {uri} (string) + • {uri} (`string`) Return: ~ - (integer) bufnr + (`integer`) bufnr vim.uri_to_fname({uri}) *vim.uri_to_fname()* Gets a filename from a URI. Parameters: ~ - • {uri} (string) + • {uri} (`string`) Return: ~ - (string) filename or unchanged URI for non-file URIs + (`string`) filename or unchanged URI for non-file URIs ============================================================================== @@ -2549,7 +2550,7 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()* < Parameters: ~ - • {opts} (table) Additional options. See |input()| + • {opts} (`table`) Additional options. See |input()| • prompt (string|nil) Text of the prompt • default (string|nil) Default reply to the input • completion (string|nil) Specifies type of completion @@ -2558,7 +2559,7 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()* "-complete=" argument. See |:command-completion| • highlight (function) Function that will be used for highlighting user inputs. - • {on_confirm} (function) ((input|nil) -> ()) Called once the user + • {on_confirm} (`function`) ((input|nil) -> ()) Called once the user confirms or abort the input. `input` is what the user typed (it might be an empty string if nothing was entered), or `nil` if the user aborted the dialog. @@ -2577,11 +2578,11 @@ vim.ui.open({path}) *vim.ui.open()* < Parameters: ~ - • {path} (string) Path or URL to open + • {path} (`string`) Path or URL to open Return (multiple): ~ - vim.SystemCompleted|nil Command result, or nil if not found. - (string|nil) Error message on failure + (`vim.SystemCompleted?`) Command result, or nil if not found. + (`string?`) Error message on failure See also: ~ • |vim.system()| @@ -2606,8 +2607,8 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()* < Parameters: ~ - • {items} (table) Arbitrary items - • {opts} (table) Additional options + • {items} (`table`) Arbitrary items + • {opts} (`table`) Additional options • prompt (string|nil) Text of the prompt. Defaults to `Select one of:` • format_item (function item -> text) Function to format @@ -2617,7 +2618,7 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()* item shape. Plugins reimplementing `vim.ui.select` may wish to use this to infer the structure or semantics of `items`, or the context in which select() was called. - • {on_choice} (function) ((item|nil, idx|nil) -> ()) Called once the + • {on_choice} (`function`) ((item|nil, idx|nil) -> ()) Called once the user made a choice. `idx` is the 1-based index of `item` within `items`. `nil` if the user aborted the dialog. @@ -2707,7 +2708,7 @@ vim.filetype.add({filetypes}) *vim.filetype.add()* < Parameters: ~ - • {filetypes} (table) A table containing new filetype maps (see + • {filetypes} (`table`) A table containing new filetype maps (see example). *vim.filetype.get_option()* @@ -2727,11 +2728,11 @@ vim.filetype.get_option({filetype}, {option}) may not reflect later changes. Parameters: ~ - • {filetype} (string) Filetype - • {option} (string) Option name + • {filetype} (`string`) Filetype + • {option} (`string`) Option name Return: ~ - string|boolean|integer: Option value + (`string|boolean|integer`) Option value vim.filetype.match({args}) *vim.filetype.match()* Perform filetype detection. @@ -2763,7 +2764,7 @@ vim.filetype.match({args}) *vim.filetype.match()* < Parameters: ~ - • {args} (table) Table specifying which matching strategy to use. + • {args} (`table`) Table specifying which matching strategy to use. Accepted keys are: • buf (number): Buffer number to use for matching. Mutually exclusive with {contents} @@ -2779,8 +2780,8 @@ vim.filetype.match({args}) *vim.filetype.match()* Mutually exclusive with {buf}. Return (multiple): ~ - (string|nil) If a match was found, the matched filetype. - (function|nil) A function that modifies buffer state when called (for + (`string?`) If a match was found, the matched filetype. + (`function?`) A function that modifies buffer state when called (for example, to set some filetype specific buffer variables). The function accepts a buffer number as its only argument. @@ -2796,7 +2797,7 @@ vim.keymap.del({modes}, {lhs}, {opts}) *vim.keymap.del()* < Parameters: ~ - • {opts} (table|nil) A table of optional arguments: + • {opts} (`table?`) A table of optional arguments: • "buffer": (integer|boolean) Remove a mapping from the given buffer. When `0` or `true`, use the current buffer. @@ -2820,12 +2821,12 @@ vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* < Parameters: ~ - • {mode} string|table Mode short-name, see |nvim_set_keymap()|. Can + • {mode} (`string|table`) Mode short-name, see |nvim_set_keymap()|. Can also be list of modes to create mapping on multiple modes. - • {lhs} (string) Left-hand side |{lhs}| of the mapping. - • {rhs} string|function Right-hand side |{rhs}| of the mapping, can be - a Lua function. - • {opts} (table|nil) Table of |:map-arguments|. + • {lhs} (`string`) Left-hand side |{lhs}| of the mapping. + • {rhs} (`string|function`) Right-hand side |{rhs}| of the mapping, + can be a Lua function. + • {opts} (`table?`) Table of |:map-arguments|. • Same as |nvim_set_keymap()| {opts}, except: • "replace_keycodes" defaults to `true` if "expr" is `true`. • "noremap": inverse of "remap" (see below). @@ -2850,26 +2851,26 @@ vim.fs.basename({file}) *vim.fs.basename()* Return the basename of the given path Parameters: ~ - • {file} (string) Path + • {file} (`string`) Path Return: ~ - (string|nil) Basename of {file} + (`string?`) Basename of {file} vim.fs.dir({path}, {opts}) *vim.fs.dir()* Return an iterator over the items located in {path} Parameters: ~ - • {path} (string) An absolute or relative path to the directory to + • {path} (`string`) An absolute or relative path to the directory to iterate over. The path is first normalized |vim.fs.normalize()|. - • {opts} (table|nil) Optional keyword arguments: + • {opts} (`table?`) Optional keyword arguments: • depth: integer|nil How deep the traverse (default 1) • skip: (fun(dir_name: string): boolean)|nil Predicate to control traversal. Return false to stop searching the current directory. Only useful when depth > 1 Return: ~ - Iterator over items in {path}. Each iteration yields two values: + (`Iterator`) over items in {path}. Each iteration yields two values: "name" and "type". "name" is the basename of the item relative to {path}. "type" is one of the following: "file", "directory", "link", "fifo", "socket", "char", "block", "unknown". @@ -2878,10 +2879,10 @@ vim.fs.dirname({file}) *vim.fs.dirname()* Return the parent directory of the given path Parameters: ~ - • {file} (string) Path + • {file} (`string`) Path Return: ~ - (string|nil) Parent directory of {file} + (`string?`) Parent directory of {file} vim.fs.find({names}, {opts}) *vim.fs.find()* Find files or directories (or other items as specified by `opts.type`) in @@ -2917,7 +2918,7 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* < Parameters: ~ - • {names} (string|string[]|fun(name: string, path: string): boolean) + • {names} (`string|string[]|fun(name: string, path: string): boolean`) Names of the items to find. Must be base names, paths and globs are not supported when {names} is a string or a table. If {names} is a function, it is called for each traversed @@ -2925,7 +2926,7 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* • name: base name of the current item • path: full path of the current item The function should return `true` if the given item is considered a match. - • {opts} (table) Optional keyword arguments: + • {opts} (`table`) Optional keyword arguments: • path (string): Path to begin searching from. If omitted, the |current-directory| is used. • upward (boolean, default false): If true, search upward @@ -2940,17 +2941,18 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* number of matches. Return: ~ - (string[]) Normalized paths |vim.fs.normalize()| of all matching items + (`string[]`) Normalized paths |vim.fs.normalize()| of all matching + items vim.fs.joinpath({...}) *vim.fs.joinpath()* Concatenate directories and/or file paths into a single path with normalization (e.g., `"foo/"` and `"bar"` get joined to `"foo/bar"`) Parameters: ~ - • {...} (string) + • {...} (`string`) Return: ~ - (string) + (`string`) vim.fs.normalize({path}, {opts}) *vim.fs.normalize()* Normalize a path to a standard format. A tilde (~) character at the @@ -2970,13 +2972,13 @@ vim.fs.normalize({path}, {opts}) *vim.fs.normalize()* < Parameters: ~ - • {path} (string) Path to normalize - • {opts} (table|nil) Options: + • {path} (`string`) Path to normalize + • {opts} (`table?`) Options: • expand_env: boolean Expand environment variables (default: true) Return: ~ - (string) Normalized path + (`string`) Normalized path vim.fs.parents({start}) *vim.fs.parents()* Iterate over all the parents of the given path. @@ -2996,12 +2998,12 @@ vim.fs.parents({start}) *vim.fs.parents()* < Parameters: ~ - • {start} (string) Initial path. + • {start} (`string`) Initial path. Return (multiple): ~ - fun(_, dir: string): string? Iterator - nil - (string|nil) + (`fun(_, dir: string): string?`) Iterator + (`nil`) + (`string?`) ============================================================================== @@ -3025,10 +3027,11 @@ vim.glob.to_lpeg({pattern}) *vim.glob.to_lpeg()* `example.0`) Parameters: ~ - • {pattern} (string) The raw glob pattern + • {pattern} (`string`) The raw glob pattern Return: ~ - vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern + (`vim.lpeg.Pattern`) pattern An |lua-lpeg| representation of the + pattern ============================================================================== @@ -3040,10 +3043,10 @@ vim.secure.read({path}) *vim.secure.read()* $XDG_STATE_HOME/nvim/trust. Parameters: ~ - • {path} (string) Path to a file to read. + • {path} (`string`) Path to a file to read. Return: ~ - (string|nil) The contents of the given file if it exists and is + (`string?`) The contents of the given file if it exists and is trusted, or nil otherwise. See also: ~ @@ -3055,7 +3058,7 @@ vim.secure.trust({opts}) *vim.secure.trust()* The trust database is located at |$XDG_STATE_HOME|/nvim/trust. Parameters: ~ - • {opts} (table) + • {opts} (`table`) • action (string): "allow" to add a file to the trust database and trust it, "deny" to add a file to the trust database and deny it, "remove" to remove file from the trust database @@ -3066,8 +3069,9 @@ vim.secure.trust({opts}) *vim.secure.trust()* exclusive with {path}. Return (multiple): ~ - (boolean) success true if operation was successful - (string) msg full path if operation was successful, else error message + (`boolean`) success true if operation was successful + (`string`) msg full path if operation was successful, else error + message ============================================================================== @@ -3150,51 +3154,51 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()* otherwise-equivalent versions. Parameters: ~ - • {v1} Version|number[] Version object. - • {v2} Version|number[] Version to compare with `v1` . + • {v1} (`Version|number[]`) Version object. + • {v2} (`Version|number[]`) Version to compare with `v1` . Return: ~ - (integer) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`. + (`integer`) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`. vim.version.eq({v1}, {v2}) *vim.version.eq()* - Returns `true` if the given versions are equal. See |vim.version.cmp()| - for usage. + Returns `true` if the given versions are equal. See |vim.version.cmp()| for + usage. Parameters: ~ - • {v1} Version|number[] - • {v2} Version|number[] + • {v1} (`Version|number[]`) + • {v2} (`Version|number[]`) Return: ~ - (boolean) + (`boolean`) vim.version.gt({v1}, {v2}) *vim.version.gt()* Returns `true` if `v1 > v2` . See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} Version|number[] - • {v2} Version|number[] + • {v1} (`Version|number[]`) + • {v2} (`Version|number[]`) Return: ~ - (boolean) + (`boolean`) vim.version.last({versions}) *vim.version.last()* TODO: generalize this, move to func.lua Parameters: ~ - • {versions} Version [] + • {versions} (`Version[]`) Return: ~ - Version ?|nil + (`Version?`) vim.version.lt({v1}, {v2}) *vim.version.lt()* Returns `true` if `v1 < v2` . See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} Version|number[] - • {v2} Version|number[] + • {v1} (`Version|number[]`) + • {v2} (`Version|number[]`) Return: ~ - (boolean) + (`boolean`) vim.version.parse({version}, {opts}) *vim.version.parse()* Parses a semantic version string and returns a version object which can be @@ -3204,16 +3208,15 @@ vim.version.parse({version}, {opts}) *vim.version.parse()* < Parameters: ~ - • {version} (string) Version string to parse. - • {opts} (table|nil) Optional keyword arguments: + • {version} (`string`) Version string to parse. + • {opts} (`table?`) Optional keyword arguments: • strict (boolean): Default false. If `true`, no coercion is attempted on input not conforming to semver v2.0.0. If `false`, `parse()` attempts to coerce input such as "1.0", "0-x", "tmux 3.2a" into valid versions. Return: ~ - (table|nil) parsed_version Version object or `nil` if input is - invalid. + (`table?`) parsed_version Version object or `nil` if input is invalid. See also: ~ • # https://semver.org/spec/v2.0.0.html @@ -3243,7 +3246,7 @@ vim.version.range({spec}) *vim.version.range()* < Parameters: ~ - • {spec} (string) Version range "spec" + • {spec} (`string`) Version range "spec" See also: ~ • # https://github.com/npm/node-semver#ranges @@ -3328,13 +3331,13 @@ filter({f}, {src}, {...}) *vim.iter.filter()* < Parameters: ~ - • {f} function(...):bool Filter function. Accepts the current - iterator or table values as arguments and returns true if those - values should be kept in the final table - • {src} table|function Table or iterator function to filter + • {f} (`fun(...):bool`) Filter function. Accepts the current iterator + or table values as arguments and returns true if those values + should be kept in the final table + • {src} (`table|function`) Table or iterator function to filter Return: ~ - (table) + (`table`) See also: ~ • |Iter:filter()| @@ -3343,7 +3346,7 @@ Iter:all({pred}) *Iter:all()* Returns true if all items in the iterator match the given predicate. Parameters: ~ - • {pred} function(...):bool Predicate function. Takes all values + • {pred} (`fun(...):bool`) Predicate function. Takes all values returned from the previous stage in the pipeline as arguments and returns true if the predicate matches. @@ -3352,7 +3355,7 @@ Iter:any({pred}) *Iter:any()* predicate. Parameters: ~ - • {pred} function(...):bool Predicate function. Takes all values + • {pred} (`fun(...):bool`) Predicate function. Takes all values returned from the previous stage in the pipeline as arguments and returns true if the predicate matches. @@ -3364,7 +3367,7 @@ Iter:each({f}) *Iter:each()* |Iter:map()|. Parameters: ~ - • {f} function(...) Function to execute for each item in the pipeline. + • {f} (`fun(...)`) Function to execute for each item in the pipeline. Takes all of the values returned by the previous stage in the pipeline as arguments. @@ -3391,7 +3394,7 @@ Iter:enumerate() *Iter:enumerate()* < Return: ~ - Iter + (`Iter`) Iter:filter({f}) *Iter:filter()* Filters an iterator pipeline. @@ -3401,12 +3404,12 @@ Iter:filter({f}) *Iter:filter()* < Parameters: ~ - • {f} function(...):bool Takes all values returned from the previous + • {f} (`fun(...):bool`) Takes all values returned from the previous stage in the pipeline and returns false or nil if the current iterator element should be removed. Return: ~ - Iter + (`Iter`) Iter:find({f}) *Iter:find()* Find the first value in the iterator that satisfies the given predicate. @@ -3429,7 +3432,7 @@ Iter:find({f}) *Iter:find()* < Return: ~ - any + (`any`) Iter:flatten({depth}) *Iter:flatten()* Flattens a |list-iterator|, un-nesting nested values up to the given @@ -3447,11 +3450,11 @@ Iter:flatten({depth}) *Iter:flatten()* < Parameters: ~ - • {depth} (number|nil) Depth to which |list-iterator| should be + • {depth} (`number?`) Depth to which |list-iterator| should be flattened (defaults to 1) Return: ~ - Iter + (`Iter`) Iter:fold({init}, {f}) *Iter:fold()* Folds ("reduces") an iterator into a single value. @@ -3469,11 +3472,11 @@ Iter:fold({init}, {f}) *Iter:fold()* < Parameters: ~ - • {init} any Initial value of the accumulator. - • {f} function(acc:any, ...):A Accumulation function. + • {init} (`any`) Initial value of the accumulator. + • {f} (`fun(acc:any, ...):any`) Accumulation function. Return: ~ - any + (`any`) Iter:join({delim}) *Iter:join()* Collect the iterator into a delimited string. @@ -3483,10 +3486,10 @@ Iter:join({delim}) *Iter:join()* Consumes the iterator. Parameters: ~ - • {delim} (string) Delimiter + • {delim} (`string`) Delimiter Return: ~ - (string) + (`string`) Iter:last() *Iter:last()* Drains the iterator and returns the last item. @@ -3502,7 +3505,7 @@ Iter:last() *Iter:last()* < Return: ~ - any + (`any`) Iter:map({f}) *Iter:map()* Maps the items of an iterator pipeline to the values returned by `f`. @@ -3520,13 +3523,13 @@ Iter:map({f}) *Iter:map()* < Parameters: ~ - • {f} function(...):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 + (`Iter`) Iter:next() *Iter:next()* Gets the next value from the iterator. @@ -3542,7 +3545,7 @@ Iter:next() *Iter:next()* < Return: ~ - any + (`any`) Iter:nextback() *Iter:nextback()* "Pops" a value from a |list-iterator| (gets the last value and decrements @@ -3557,7 +3560,7 @@ Iter:nextback() *Iter:nextback()* < Return: ~ - any + (`any`) Iter:nth({n}) *Iter:nth()* Gets the nth value of an iterator (and advances to it). @@ -3571,10 +3574,10 @@ Iter:nth({n}) *Iter:nth()* < Parameters: ~ - • {n} (number) The index of the value to return. + • {n} (`number`) The index of the value to return. Return: ~ - any + (`any`) Iter:nthback({n}) *Iter:nthback()* Gets the nth value from the end of a |list-iterator| (and advances to it). @@ -3588,10 +3591,10 @@ Iter:nthback({n}) *Iter:nthback()* < Parameters: ~ - • {n} (number) The index of the value to return. + • {n} (`number`) The index of the value to return. Return: ~ - any + (`any`) Iter:peek() *Iter:peek()* Gets the next value in a |list-iterator| without consuming it. @@ -3607,7 +3610,7 @@ Iter:peek() *Iter:peek()* < Return: ~ - any + (`any`) Iter:peekback() *Iter:peekback()* Gets the last value of a |list-iterator| without consuming it. @@ -3625,7 +3628,7 @@ Iter:peekback() *Iter:peekback()* < Return: ~ - any + (`any`) Iter:rev() *Iter:rev()* Reverses a |list-iterator| pipeline. @@ -3637,7 +3640,7 @@ Iter:rev() *Iter:rev()* < Return: ~ - Iter + (`Iter`) Iter:rfind({f}) *Iter:rfind()* Gets the first value in a |list-iterator| that satisfies a predicate, @@ -3655,7 +3658,7 @@ Iter:rfind({f}) *Iter:rfind()* < Return: ~ - any + (`any`) See also: ~ • Iter.find @@ -3670,10 +3673,10 @@ Iter:skip({n}) *Iter:skip()* < Parameters: ~ - • {n} (number) Number of values to skip. + • {n} (`number`) Number of values to skip. Return: ~ - Iter + (`Iter`) Iter:skipback({n}) *Iter:skipback()* Skips `n` values backwards from the end of a |list-iterator| pipeline. @@ -3687,10 +3690,10 @@ Iter:skipback({n}) *Iter:skipback()* < Parameters: ~ - • {n} (number) Number of values to skip. + • {n} (`number`) Number of values to skip. Return: ~ - Iter + (`Iter`) Iter:slice({first}, {last}) *Iter:slice()* Sets the start and end of a |list-iterator| pipeline. @@ -3698,11 +3701,11 @@ Iter:slice({first}, {last}) *Iter:slice()* Equivalent to `:skip(first - 1):skipback(len - last + 1)`. Parameters: ~ - • {first} (number) - • {last} (number) + • {first} (`number`) + • {last} (`number`) Return: ~ - Iter + (`Iter`) Iter:take({n}) *Iter:take()* Transforms an iterator to yield only the first n values. @@ -3718,10 +3721,10 @@ Iter:take({n}) *Iter:take()* < Parameters: ~ - • {n} (integer) + • {n} (`integer`) Return: ~ - Iter + (`Iter`) Iter:totable() *Iter:totable()* Collect the iterator into a table. @@ -3747,7 +3750,7 @@ Iter:totable() *Iter:totable()* |Iter:fold()|. Return: ~ - (table) + (`table`) map({f}, {src}, {...}) *vim.iter.map()* Maps a table or other |iterable|. >lua @@ -3756,13 +3759,13 @@ map({f}, {src}, {...}) *vim.iter.map()* < Parameters: ~ - • {f} function(...):?any Map function. Accepts the current iterator + • {f} (`fun(...): any?`) Map function. Accepts the current iterator or table values as arguments and returns one or more new values. Nil values are removed from the final table. - • {src} table|function Table or iterator function to filter + • {src} (`table|function`) Table or iterator function to filter Return: ~ - (table) + (`table`) See also: ~ • |Iter:map()| @@ -3774,10 +3777,10 @@ totable({f}, {...}) *vim.iter.totable()* < Parameters: ~ - • {f} (function) Iterator function + • {f} (`function`) Iterator function Return: ~ - (table) + (`table`) ============================================================================== @@ -3787,7 +3790,7 @@ vim.snippet.active() *vim.snippet.active()* Returns `true` if there's an active snippet in the current buffer. Return: ~ - (boolean) + (`boolean`) vim.snippet.exit() *vim.snippet.exit()* Exits the current snippet. @@ -3799,7 +3802,7 @@ vim.snippet.expand({input}) *vim.snippet.expand()* Tabstops are highlighted with hl-SnippetTabstop. Parameters: ~ - • {input} (string) + • {input} (`string`) vim.snippet.jump({direction}) *vim.snippet.jump()* Jumps within the active snippet in the given direction. If the jump isn't @@ -3816,7 +3819,7 @@ vim.snippet.jump({direction}) *vim.snippet.jump()* < Parameters: ~ - • {direction} (vim.snippet.Direction) Navigation direction. -1 for + • {direction} (`vim.snippet.Direction`) Navigation direction. -1 for previous, 1 for next. vim.snippet.jumpable({direction}) *vim.snippet.jumpable()* @@ -3833,11 +3836,11 @@ vim.snippet.jumpable({direction}) *vim.snippet.jumpable()* < Parameters: ~ - • {direction} (vim.snippet.Direction) Navigation direction. -1 for + • {direction} (`vim.snippet.Direction`) Navigation direction. -1 for previous, 1 for next. Return: ~ - (boolean) + (`boolean`) ============================================================================== @@ -3847,18 +3850,18 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()* Hex decode a string. Parameters: ~ - • {enc} (string) String to decode + • {enc} (`string`) String to decode Return: ~ - (string) Decoded string + (`string`) Decoded string vim.text.hexencode({str}) *vim.text.hexencode()* Hex encode a string. Parameters: ~ - • {str} (string) String to encode + • {str} (`string`) String to encode Return: ~ - (string) Hex encoded string + (`string`) Hex encoded string vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 8702b98f76..14dedbcbd9 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -567,10 +567,10 @@ foldexpr({lnum}) *vim.treesitter.foldexpr()* < Parameters: ~ - • {lnum} (integer|nil) Line number to calculate fold level for + • {lnum} (`integer?`) Line number to calculate fold level for Return: ~ - (string) + (`string`) foldtext() *vim.treesitter.foldtext()* Returns the highlighted content of the first line of the fold or falls @@ -580,17 +580,17 @@ foldtext() *vim.treesitter.foldtext()* < Return: ~ - `{ [1]: string, [2]: string[] }[]` | string + (`{ [1]: string, [2]: string[] }[]|string`) *vim.treesitter.get_captures_at_cursor()* get_captures_at_cursor({winnr}) Returns a list of highlight capture names under the cursor Parameters: ~ - • {winnr} (integer|nil) Window handle or 0 for current window (default) + • {winnr} (`integer?`) Window handle or 0 for current window (default) Return: ~ - string[] List of capture names + (`string[]`) List of capture names *vim.treesitter.get_captures_at_pos()* get_captures_at_pos({bufnr}, {row}, {col}) @@ -601,12 +601,13 @@ get_captures_at_pos({bufnr}, {row}, {col}) if none are defined). Parameters: ~ - • {bufnr} (integer) Buffer number (0 for current buffer) - • {row} (integer) Position row - • {col} (integer) Position column + • {bufnr} (`integer`) Buffer number (0 for current buffer) + • {row} (`integer`) Position row + • {col} (`integer`) Position column Return: ~ - table[] List of captures `{ capture = "name", metadata = { ... } }` + (`table[]`) List of captures `{ capture = "name", metadata = { ... } + }` get_node({opts}) *vim.treesitter.get_node()* Returns the smallest named node at the given position @@ -618,7 +619,7 @@ get_node({opts}) *vim.treesitter.get_node()* < Parameters: ~ - • {opts} (table|nil) Optional keyword arguments: + • {opts} (`table?`) Optional keyword arguments: • bufnr integer|nil Buffer number (nil or 0 for current buffer) • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor @@ -630,35 +631,35 @@ get_node({opts}) *vim.treesitter.get_node()* true) Return: ~ - |TSNode| | nil Node at the given position + (`TSNode?`) Node at the given position get_node_range({node_or_range}) *vim.treesitter.get_node_range()* Returns the node's range or an unpacked range table Parameters: ~ - • {node_or_range} (|TSNode| | table) Node or table of positions + • {node_or_range} (`TSNode|table`) Node or table of positions Return (multiple): ~ - (integer) start_row - (integer) start_col - (integer) end_row - (integer) end_col + (`integer`) start_row + (`integer`) start_col + (`integer`) end_row + (`integer`) end_col *vim.treesitter.get_node_text()* get_node_text({node}, {source}, {opts}) Gets the text corresponding to a given node Parameters: ~ - • {node} |TSNode| - • {source} (integer|string) Buffer or string from which the {node} is + • {node} (`TSNode`) + • {source} (`integer|string`) Buffer or string from which the {node} is extracted - • {opts} (table|nil) Optional parameters. + • {opts} (`table?`) Optional parameters. • metadata (table) Metadata of a specific capture. This would be set to `metadata[capture_id]` when using |vim.treesitter.query.add_directive()|. Return: ~ - (string) + (`string`) get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* Returns the parser for a specific buffer and attaches it to the buffer @@ -666,39 +667,39 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* If needed, this will create the parser. Parameters: ~ - • {bufnr} (integer|nil) Buffer the parser should be tied to (default: + • {bufnr} (`integer?`) Buffer the parser should be tied to (default: current buffer) - • {lang} (string|nil) Filetype of this parser (default: buffer + • {lang} (`string?`) Filetype of this parser (default: buffer filetype) - • {opts} (table|nil) Options to pass to the created language tree + • {opts} (`table?`) Options to pass to the created language tree Return: ~ - |LanguageTree| object to use for parsing + (`LanguageTree`) object to use for parsing get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()* Get the range of a |TSNode|. Can also supply {source} and {metadata} to get the range with directives applied. Parameters: ~ - • {node} |TSNode| - • {source} integer|string|nil Buffer or string from which the {node} + • {node} (`TSNode`) + • {source} (`integer|string?`) Buffer or string from which the {node} is extracted - • {metadata} TSMetadata|nil + • {metadata} (`TSMetadata?`) Return: ~ - (table) + (`Range6`) *vim.treesitter.get_string_parser()* get_string_parser({str}, {lang}, {opts}) Returns a string parser Parameters: ~ - • {str} (string) Text to parse - • {lang} (string) Language of this string - • {opts} (table|nil) Options to pass to the created language tree + • {str} (`string`) Text to parse + • {lang} (`string`) Language of this string + • {opts} (`table?`) Options to pass to the created language tree Return: ~ - |LanguageTree| object to use for parsing + (`LanguageTree`) object to use for parsing inspect_tree({opts}) *vim.treesitter.inspect_tree()* Open a window that displays a textual representation of the nodes in the @@ -712,7 +713,7 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()* Can also be shown with `:InspectTree`. *:InspectTree* Parameters: ~ - • {opts} (table|nil) Optional options table with the following possible + • {opts} (`table?`) Optional options table with the following possible keys: • lang (string|nil): The language of the source buffer. If omitted, the filetype of the source buffer is used. @@ -732,33 +733,33 @@ is_ancestor({dest}, {source}) *vim.treesitter.is_ancestor()* Determines whether a node is the ancestor of another Parameters: ~ - • {dest} |TSNode| Possible ancestor - • {source} |TSNode| Possible descendant + • {dest} (`TSNode`) Possible ancestor + • {source} (`TSNode`) Possible descendant Return: ~ - (boolean) True if {dest} is an ancestor of {source} + (`boolean`) True if {dest} is an ancestor of {source} *vim.treesitter.is_in_node_range()* is_in_node_range({node}, {line}, {col}) Determines whether (line, col) position is in node range Parameters: ~ - • {node} |TSNode| defining the range - • {line} (integer) Line (0-based) - • {col} (integer) Column (0-based) + • {node} (`TSNode`) defining the range + • {line} (`integer`) Line (0-based) + • {col} (`integer`) Column (0-based) Return: ~ - (boolean) True if the position is in node range + (`boolean`) True if the position is in node range node_contains({node}, {range}) *vim.treesitter.node_contains()* Determines if a node contains a range Parameters: ~ - • {node} |TSNode| - • {range} (table) + • {node} (`TSNode`) + • {range} (`table`) Return: ~ - (boolean) True if the {node} contains the {range} + (`boolean`) True if the {node} contains the {range} start({bufnr}, {lang}) *vim.treesitter.start()* Starts treesitter highlighting for a buffer @@ -779,16 +780,15 @@ start({bufnr}, {lang}) *vim.treesitter.start()* < Parameters: ~ - • {bufnr} (integer|nil) Buffer to be highlighted (default: current + • {bufnr} (`integer?`) Buffer to be highlighted (default: current buffer) - • {lang} (string|nil) Language of the parser (default: buffer - filetype) + • {lang} (`string?`) Language of the parser (default: buffer filetype) stop({bufnr}) *vim.treesitter.stop()* Stops treesitter highlighting for a buffer Parameters: ~ - • {bufnr} (integer|nil) Buffer to stop highlighting (default: current + • {bufnr} (`integer?`) Buffer to stop highlighting (default: current buffer) @@ -802,8 +802,8 @@ add({lang}, {opts}) *vim.treesitter.language.add()* {path} Parameters: ~ - • {lang} (string) Name of the parser (alphanumerical and `_` only) - • {opts} (table|nil) Options: + • {lang} (`string`) Name of the parser (alphanumerical and `_` only) + • {opts} (`table?`) Options: • filetype (string|string[]) Default filetype the parser should be associated with. Defaults to {lang}. • path (string|nil) Optional path the parser is located at @@ -814,17 +814,17 @@ get_filetypes({lang}) *vim.treesitter.language.get_filetypes()* Get the filetypes associated with the parser named {lang}. Parameters: ~ - • {lang} (string) Name of parser + • {lang} (`string`) Name of parser Return: ~ - string[] filetypes + (`string[]`) filetypes get_lang({filetype}) *vim.treesitter.language.get_lang()* Parameters: ~ - • {filetype} (string) + • {filetype} (`string`) Return: ~ - (string|nil) + (`string?`) inspect({lang}) *vim.treesitter.language.inspect()* Inspects the provided language. @@ -833,10 +833,10 @@ inspect({lang}) *vim.treesitter.language.inspect()* names, ... Parameters: ~ - • {lang} (string) Language + • {lang} (`string`) Language Return: ~ - (table) + (`table`) register({lang}, {filetype}) *vim.treesitter.language.register()* Register a parser named {lang} to be used for {filetype}(s). @@ -845,8 +845,8 @@ register({lang}, {filetype}) *vim.treesitter.language.register()* mappings from other filetypes to {lang} will be preserved. Parameters: ~ - • {lang} (string) Name of parser - • {filetype} string|string[] Filetype(s) to associate with lang + • {lang} (`string`) Name of parser + • {filetype} (`string|string[]`) Filetype(s) to associate with lang ============================================================================== @@ -862,9 +862,8 @@ add_directive({name}, {handler}, {force}) `metadata[capture_id].key = value` Parameters: ~ - • {name} (string) Name of the directive, without leading # - • {handler} function(match:table, pattern:string, - bufnr:integer, predicate:string[], metadata:table) + • {name} (`string`) Name of the directive, without leading # + • {handler} (`function`) • match: see |treesitter-query| • node-level data are accessible via `match[capture_id]` @@ -872,19 +871,18 @@ add_directive({name}, {handler}, {force}) • predicate: list of strings containing the full directive being called, e.g. `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }` - • {force} (boolean|nil) + • {force} (`boolean?`) *vim.treesitter.query.add_predicate()* add_predicate({name}, {handler}, {force}) Adds a new predicate to be used in queries Parameters: ~ - • {name} (string) Name of the predicate, without leading # - • {handler} function(match:table, pattern:string, - bufnr:integer, predicate:string[]) + • {name} (`string`) Name of the predicate, without leading # + • {handler} (`function`) • see |vim.treesitter.query.add_directive()| for argument meanings - • {force} (boolean|nil) + • {force} (`boolean?`) edit({lang}) *vim.treesitter.query.edit()* Opens a live editor to query the buffer you started from. @@ -897,31 +895,32 @@ edit({lang}) *vim.treesitter.query.edit()* `$VIMRUNTIME/queries/`. Parameters: ~ - • {lang} (string|nil) language to open the query editor for. If - omitted, inferred from the current buffer's filetype. + • {lang} (`string?`) language to open the query editor for. If omitted, + inferred from the current buffer's filetype. get({lang}, {query_name}) *vim.treesitter.query.get()* Returns the runtime query {query_name} for {lang}. Parameters: ~ - • {lang} (string) Language to use for the query - • {query_name} (string) Name of the query (e.g. "highlights") + • {lang} (`string`) Language to use for the query + • {query_name} (`string`) Name of the query (e.g. "highlights") Return: ~ - Query|nil Parsed query + (`Query?`) Parsed query *vim.treesitter.query.get_files()* get_files({lang}, {query_name}, {is_included}) Gets the list of files used to make up a query Parameters: ~ - • {lang} (string) Language to get query for - • {query_name} (string) Name of the query to load (e.g., "highlights") - • {is_included} (boolean|nil) Internal parameter, most of the time left + • {lang} (`string`) Language to get query for + • {query_name} (`string`) Name of the query to load (e.g., + "highlights") + • {is_included} (`boolean?`) Internal parameter, most of the time left as `nil` Return: ~ - string[] query_files List of files to load for given query and + (`string[]`) query_files List of files to load for given query and language lint({buf}, {opts}) *vim.treesitter.query.lint()* @@ -940,8 +939,8 @@ lint({buf}, {opts}) *vim.treesitter.query.lint()* for the `lua` language will be used. Parameters: ~ - • {buf} (integer) Buffer handle - • {opts} (QueryLinterOpts|nil) Optional keyword arguments: + • {buf} (`integer`) Buffer handle + • {opts} (`table?`) Optional keyword arguments: • langs (string|string[]|nil) Language(s) to use for checking the query. If multiple languages are specified, queries are validated for all of them @@ -951,13 +950,13 @@ list_directives() *vim.treesitter.query.list_directives()* Lists the currently available directives to use in queries. Return: ~ - string[] List of supported directives. + (`string[]`) List of supported directives. list_predicates() *vim.treesitter.query.list_predicates()* Lists the currently available predicates to use in queries. Return: ~ - string[] List of supported predicates. + (`string[]`) List of supported predicates. omnifunc({findstart}, {base}) *vim.treesitter.query.omnifunc()* Omnifunc for completing node names and predicates in treesitter queries. @@ -980,11 +979,11 @@ parse({lang}, {query}) *vim.treesitter.query.parse()* • `info.patterns` contains information about predicates. Parameters: ~ - • {lang} (string) Language to use for the query - • {query} (string) Query in s-expr syntax + • {lang} (`string`) Language to use for the query + • {query} (`string`) Query in s-expr syntax Return: ~ - Query Parsed query + (`Query`) Parsed query *Query:iter_captures()* Query:iter_captures({node}, {source}, {start}, {stop}) @@ -1010,14 +1009,14 @@ Query:iter_captures({node}, {source}, {start}, {stop}) < Parameters: ~ - • {node} |TSNode| under which the search will occur - • {source} (integer|string) Source buffer or string to extract text + • {node} (`TSNode`) under which the search will occur + • {source} (`integer|string`) Source buffer or string to extract text from - • {start} (integer) Starting line for the search - • {stop} (integer) Stopping line for the search (end-exclusive) + • {start} (`integer`) Starting line for the search + • {stop} (`integer`) Stopping line for the search (end-exclusive) Return: ~ - (fun(end_line: integer|nil): integer, TSNode, TSMetadata): capture id, + (`fun(end_line: integer?): integer, TSNode, TSMetadata`) capture id, capture node, metadata *Query:iter_matches()* @@ -1044,18 +1043,18 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts}) < Parameters: ~ - • {node} |TSNode| under which the search will occur - • {source} (integer|string) Source buffer or string to search - • {start} (integer) Starting line for the search - • {stop} (integer) Stopping line for the search (end-exclusive) - • {opts} (table|nil) Options: + • {node} (`TSNode`) under which the search will occur + • {source} (`integer|string`) Source buffer or string to search + • {start} (`integer`) Starting line for the search + • {stop} (`integer`) Stopping line for the search (end-exclusive) + • {opts} (`table?`) Options: • max_start_depth (integer) if non-zero, sets the maximum start depth for each match. This is used to prevent traversing too deep into a tree. Requires treesitter >= 0.20.9. Return: ~ - (fun(): integer, table, table): pattern id, match, + (`fun(): integer, table, table`) pattern id, match, metadata set({lang}, {query_name}, {text}) *vim.treesitter.query.set()* @@ -1065,9 +1064,9 @@ set({lang}, {query_name}, {text}) *vim.treesitter.query.set()* by plugins. Parameters: ~ - • {lang} (string) Language to use for the query - • {query_name} (string) Name of the query (e.g., "highlights") - • {text} (string) Query text (unparsed). + • {lang} (`string`) Language to use for the query + • {query_name} (`string`) Name of the query (e.g., "highlights") + • {text} (`string`) Query text (unparsed). ============================================================================== @@ -1117,10 +1116,10 @@ LanguageTree:contains({range}) *LanguageTree:contains()* Determines whether {range} is contained in the |LanguageTree|. Parameters: ~ - • {range} (table) `{ start_line, start_col, end_line, end_col }` + • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }` Return: ~ - (boolean) + (`boolean`) LanguageTree:destroy() *LanguageTree:destroy()* Destroys this |LanguageTree| and all its children. @@ -1136,21 +1135,21 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()* Note: This includes the invoking tree's child trees as well. Parameters: ~ - • {fn} fun(tree: TSTree, ltree: LanguageTree) + • {fn} (`fun(tree: TSTree, ltree: LanguageTree)`) LanguageTree:included_regions() *LanguageTree:included_regions()* - Gets the set of included regions managed by this LanguageTree . This can - be different from the regions set by injection query, because a partial + Gets the set of included regions managed by this LanguageTree . This can be + different from the regions set by injection query, because a partial |LanguageTree:parse()| drops the regions outside the requested range. Return: ~ - table + (`table`) LanguageTree:invalidate({reload}) *LanguageTree:invalidate()* Invalidates this parser and all its children Parameters: ~ - • {reload} (boolean|nil) + • {reload} (`boolean?`) LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()* Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()| @@ -1158,11 +1157,11 @@ LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()* |LanguageTree:parse()|. Parameters: ~ - • {exclude_children} (boolean|nil) whether to ignore the validity of + • {exclude_children} (`boolean?`) whether to ignore the validity of children (default `false`) Return: ~ - (boolean) + (`boolean`) LanguageTree:lang() *LanguageTree:lang()* Gets the language of this tree node. @@ -1172,23 +1171,23 @@ LanguageTree:language_for_range({range}) Gets the appropriate language that contains {range}. Parameters: ~ - • {range} (table) `{ start_line, start_col, end_line, end_col }` + • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }` Return: ~ - |LanguageTree| Managing {range} + (`LanguageTree`) Managing {range} *LanguageTree:named_node_for_range()* LanguageTree:named_node_for_range({range}, {opts}) Gets the smallest named node that contains {range}. Parameters: ~ - • {range} (table) `{ start_line, start_col, end_line, end_col }` - • {opts} (table|nil) Optional keyword arguments: + • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }` + • {opts} (`table?`) Optional keyword arguments: • ignore_injections boolean Ignore injected languages (default true) Return: ~ - |TSNode| | nil Found node + (`TSNode?`) Found node LanguageTree:parse({range}) *LanguageTree:parse()* Recursively parse all regions in the language tree using @@ -1201,21 +1200,21 @@ LanguageTree:parse({range}) *LanguageTree:parse()* if {range} is `true`). Parameters: ~ - • {range} boolean|Range|nil: Parse this range in the parser's source. + • {range} (`boolean|Range?`) Parse this range in the parser's source. Set to `true` to run a complete parse of the source (Note: Can be slow!) Set to `false|nil` to only parse regions with empty ranges (typically only the root tree without injections). Return: ~ - table + (`table`) *LanguageTree:register_cbs()* LanguageTree:register_cbs({cbs}, {recursive}) Registers callbacks for the |LanguageTree|. Parameters: ~ - • {cbs} (table) An |nvim_buf_attach()|-like table argument with + • {cbs} (`table`) An |nvim_buf_attach()|-like table argument with the following handlers: • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback. @@ -1230,7 +1229,7 @@ LanguageTree:register_cbs({cbs}, {recursive}) • `on_detach` : emitted when the buffer is detached, see |nvim_buf_detach_event|. Takes one argument, the number of the buffer. - • {recursive} (boolean|nil) Apply callbacks recursively for all + • {recursive} (`boolean?`) Apply callbacks recursively for all children. Any new children will also inherit the callbacks. @@ -1242,13 +1241,13 @@ LanguageTree:tree_for_range({range}, {opts}) Gets the tree that contains {range}. Parameters: ~ - • {range} (table) `{ start_line, start_col, end_line, end_col }` - • {opts} (table|nil) Optional keyword arguments: + • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }` + • {opts} (`table?`) Optional keyword arguments: • ignore_injections boolean Ignore injected languages (default true) Return: ~ - TSTree|nil + (`TSTree?`) LanguageTree:trees() *LanguageTree:trees()* Returns all trees of the regions parsed by this parser. Does not include @@ -1258,6 +1257,6 @@ LanguageTree:trees() *LanguageTree:trees()* • the root LanguageTree is fully parsed. Return: ~ - table + (`table`) vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index cde61697b6..4fe601dfd5 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -95,7 +95,7 @@ vim.log = { --- throws an error if {cmd} cannot be run. --- --- @param cmd (string[]) Command to execute ---- @param opts (SystemOpts|nil) Options: +--- @param opts vim.SystemOpts? Options: --- - cwd: (string) Set the current working directory for the sub-process. --- - env: table Set environment variables for the new process. Inherits the --- current environment with `NVIM` set to |v:servername|. @@ -118,7 +118,7 @@ vim.log = { --- parent exits. Note that the child process will still keep the parent's event loop alive --- unless the parent process calls |uv.unref()| on the child's process handle. --- ---- @param on_exit (function|nil) Called when subprocess exits. When provided, the command runs +--- @param on_exit? fun(out: vim.SystemCompleted) Called when subprocess exits. When provided, the command runs --- asynchronously. Receives SystemCompleted object, see return of SystemObj:wait(). --- --- @return vim.SystemObj Object with the fields: @@ -219,10 +219,9 @@ do --- ``` --- ---@see |paste| - ---@alias paste_phase -1 | 1 | 2 | 3 --- ---@param lines string[] # |readfile()|-style list of lines to paste. |channel-lines| - ---@param phase paste_phase -1: "non-streaming" paste: the call contains all lines. + ---@param phase (-1|1|2|3) -1: "non-streaming" paste: the call contains all lines. --- If paste is "streamed", `phase` indicates the stream state: --- - 1: starts the paste (exactly once) --- - 2: continues the paste (zero or more times) diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 19039eb226..3f06d4fd43 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -812,9 +812,8 @@ function vim.api.nvim_complete_set(index, opts) end --- @return integer function vim.api.nvim_create_augroup(name, opts) end ---- Creates an `autocommand` event handler, defined by `callback` (Lua ---- function or Vimscript function name string) or `command` (Ex command ---- string). +--- Creates an `autocommand` event handler, defined by `callback` (Lua function +--- or Vimscript function name string) or `command` (Ex command string). --- Example using Lua callback: --- --- ```lua diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index 9279febddf..9e935b7e95 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -1,6 +1,6 @@ local uv = vim.uv ---- @class SystemOpts +--- @class vim.SystemOpts --- @field stdin? string|string[]|true --- @field stdout? fun(err:string?, data: string?)|false --- @field stderr? fun(err:string?, data: string?)|false @@ -302,7 +302,7 @@ end --- Run a system command --- --- @param cmd string[] ---- @param opts? SystemOpts +--- @param opts? vim.SystemOpts --- @param on_exit? fun(out: vim.SystemCompleted) --- @return vim.SystemObj function M.run(cmd, opts, on_exit) diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 9141b1e4c6..8cd5f19569 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2165,7 +2165,7 @@ end --- } --- ``` --- ----@param filetypes vim.filetype.add.filetypes A table containing new filetype maps (see example). +---@param filetypes vim.filetype.add.filetypes (table) A table containing new filetype maps (see example). function M.add(filetypes) for k, v in pairs(filetypes.extension or {}) do extension[k] = v @@ -2300,7 +2300,7 @@ end --- vim.filetype.match({ contents = {'#!/usr/bin/env bash'} }) --- ``` --- ----@param args vim.filetype.match.args Table specifying which matching strategy to use. +---@param args vim.filetype.match.args (table) Table specifying which matching strategy to use. --- Accepted keys are: --- * buf (number): Buffer number to use for matching. Mutually exclusive with --- {contents} diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index d9265f6bd6..f6f7abef8f 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -315,7 +315,7 @@ end --- Run a system command and timeout after 30 seconds. --- --- @param cmd table List of command arguments to execute ---- @param args ?table Optional arguments: +--- @param args? table Optional arguments: --- - stdin (string): Data to write to the job's stdin --- - stderr (boolean): Append stderr to stdout --- - ignore_error (boolean): If true, ignore error output diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index c6feeea3dc..a63d5ba565 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -181,9 +181,9 @@ end --- local bufs = vim.iter(vim.api.nvim_list_bufs()):filter(vim.api.nvim_buf_is_loaded) --- ``` --- ----@param f function(...):bool Takes all values returned from the previous stage ---- in the pipeline and returns false or nil if the ---- current iterator element should be removed. +---@param f fun(...):bool Takes all values returned from the previous stage +--- in the pipeline and returns false or nil if the +--- current iterator element should be removed. ---@return Iter function Iter.filter(self, f) return self:map(function(...) @@ -272,11 +272,11 @@ end --- -- { 6, 12 } --- ``` --- ----@param f function(...):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. +---@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 +--- are filtered from the output. ---@return Iter function Iter.map(self, f) -- Implementation note: the reader may be forgiven for observing that this @@ -340,9 +340,9 @@ end --- --- For functions with side effects. To modify the values in the iterator, use |Iter:map()|. --- ----@param f function(...) Function to execute for each item in the pipeline. ---- Takes all of the values returned by the previous stage ---- in the pipeline as arguments. +---@param f fun(...) Function to execute for each item in the pipeline. +--- Takes all of the values returned by the previous stage +--- in the pipeline as arguments. function Iter.each(self, f) local function fn(...) if select(1, ...) ~= nil then @@ -464,7 +464,7 @@ end ---@generic A --- ---@param init A Initial value of the accumulator. ----@param f function(acc:A, ...):A Accumulation function. +---@param f fun(acc:A, ...):A Accumulation function. ---@return A function Iter.fold(self, init, f) local acc = init @@ -884,9 +884,9 @@ end --- Returns true if any of the items in the iterator match the given predicate. --- ----@param pred function(...):bool Predicate function. Takes all values returned from the previous ---- stage in the pipeline as arguments and returns true if the ---- predicate matches. +---@param pred fun(...):bool Predicate function. Takes all values returned from the previous +--- stage in the pipeline as arguments and returns true if the +--- predicate matches. function Iter.any(self, pred) local any = false @@ -908,9 +908,9 @@ end --- Returns true if all items in the iterator match the given predicate. --- ----@param pred function(...):bool Predicate function. Takes all values returned from the previous ---- stage in the pipeline as arguments and returns true if the ---- predicate matches. +---@param pred fun(...):bool Predicate function. Takes all values returned from the previous +--- stage in the pipeline as arguments and returns true if the +--- predicate matches. function Iter.all(self, pred) local all = true @@ -1106,9 +1106,9 @@ end --- ---@see |Iter:filter()| --- ----@param f function(...):bool Filter function. Accepts the current iterator or table values as ---- arguments and returns true if those values should be kept in the ---- final table +---@param f fun(...):bool Filter function. Accepts the current iterator or table values as +--- arguments and returns true if those values should be kept in the +--- final table ---@param src table|function Table or iterator function to filter ---@return table function M.filter(f, src, ...) @@ -1124,9 +1124,9 @@ end --- ---@see |Iter:map()| --- ----@param f function(...):?any Map function. Accepts the current iterator or table values as ---- arguments and returns one or more new values. Nil values are removed ---- from the final table. +---@param f fun(...): any? Map function. Accepts the current iterator or table values as +--- arguments and returns one or more new values. Nil values are removed +--- from the final table. ---@param src table|function Table or iterator function to filter ---@return table function M.map(f, src, ...) diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index c03a17fa59..daf09b6430 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -516,7 +516,7 @@ end --- --- Displays call hierarchy in the quickfix window. --- ----@param direction `"from"` for incoming calls and `"to"` for outgoing calls +---@param direction 'from'|'to' `"from"` for incoming calls and `"to"` for outgoing calls ---@return function --- `CallHierarchyIncomingCall[]` if {direction} is `"from"`, --- `CallHierarchyOutgoingCall[]` if {direction} is `"to"`, diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 44465f6cff..a2cc81781a 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -790,7 +790,7 @@ 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 (`MarkedString` | `MarkedString[]` | `MarkupContent`) +---@param input (lsp.MarkedString | lsp.MarkedString[] | lsp.MarkupContent) ---@param contents (table|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 @@ -2115,8 +2115,8 @@ end --- Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. --- ---@param buf integer buffer number (0 for current) ----@param row 0-indexed line ----@param col 0-indexed byte offset in line +---@param row integer 0-indexed line +---@param col integer 0-indexed byte offset in line ---@param offset_encoding string utf-8|utf-16|utf-32 defaults to `offset_encoding` of first client of `buf` ---@return integer `offset_encoding` index of the character in line {row} column {col} in buffer {buf} function M.character_offset(buf, row, col, offset_encoding) diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 24bc97bf8e..e76d148b1b 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -875,7 +875,7 @@ end --- a.b.c = 1 --- ``` --- ----@param createfn function?(key:any):any Provides the value for a missing `key`. +---@param createfn? fun(key:any):any Provides the value for a missing `key`. ---@return table # Empty table with `__index` metamethod. function vim.defaulttable(createfn) createfn = createfn or function(_) diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 8cbbffcd60..cc8fe319e8 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -793,7 +793,7 @@ end --- of the query file, e.g., if the path ends in `/lua/highlights.scm`, the parser for the --- `lua` language will be used. ---@param buf (integer) Buffer handle ----@param opts (QueryLinterOpts|nil) Optional keyword arguments: +---@param opts? QueryLinterOpts (table) Optional keyword arguments: --- - langs (string|string[]|nil) Language(s) to use for checking the query. --- If multiple languages are specified, queries are validated for all of them --- - clear (boolean) if `true`, just clear current lint errors -- cgit From f46ae1368530389129b5f7f1768c057d5d0b9c2f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 10 Jan 2024 18:45:46 +0100 Subject: vim-patch:9.1.0016: default diff highlighting is too noisy Problem: default diff highlighting is too noisy Solution: Link diff highlighting groups to new Added/Removed/Changed, revert previous change (Romain Lafourcade) Remove diff* links added in vim/vim#13776 and doc added in commit b1392be The links added in vim/vim#13776 are way too noisy for the contexts in which the `diff` syntax is applied (git commits, patches, etc.). This commit: - removes those links - adds new default highlighting groups Added, Changed and Removed - links the diff highlighting groups to those new defaults - removes the doc changes - adjusts the syntax_completion test for those newly added group names Note: Changes to the default color schemes will be handled separately, by adding links to those newly created Added/Removed/Changed highlighting groups. related: vim/vim#13776 closes vim/vim#13825 https://github.com/vim/vim/commit/124371c5a149a8c0c75c04b6c90ac11e71a0aa97 Co-authored-by: Romain Lafourcade --- runtime/doc/syntax.txt | 15 +++++---------- runtime/syntax/diff.vim | 6 +++--- runtime/syntax/help.vim | 7 +++++++ 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 84121be4d6..8cbb958e35 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -243,6 +243,10 @@ Error any erroneous construct Todo anything that needs extra attention; mostly the keywords TODO FIXME and XXX +Added added line in a diff +Changed changed line in a diff +Removed removed line in a diff + The names marked with * are the preferred groups; the others are minor groups. For the preferred groups, the "syntax.vim" file contains default highlighting. The minor groups are linked to the preferred groups, so they get the same @@ -1224,7 +1228,7 @@ To highlight KDE-reserved features, set > g:desktop_enable_kde follows g:desktop_enable_nonstd if not supplied -DIFF *diff.vim* *ft-diff-syntax* +DIFF *diff.vim* The diff highlighting normally finds translated headers. This can be slow if there are very long lines in the file. To disable translations: > @@ -1233,15 +1237,6 @@ there are very long lines in the file. To disable translations: > Also see |diff-slow|. -Since the Vim 9.1 release the diff filetype links the diffAdded, -diffRemoved and diffChanged highlighting groups to |hl-DiffAdd|, -|hl-DiffDelete| and |hl-DiffChange| by default. If you do not want this, you -can change it to the previous groups like this in your |vimrc| > - - hi link diffRemoved Special - hi link diffChanged PreProc - hi link diffAdded Identifier -< DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* The dircolors utility highlighting definition has one option. It exists to diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index b5c3f5ecbb..b0a8594def 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -378,9 +378,9 @@ hi def link diffBDiffer Constant hi def link diffIsA Constant hi def link diffNoEOL Constant hi def link diffCommon Constant -hi def link diffRemoved DiffDelete -hi def link diffChanged DiffChange -hi def link diffAdded DiffAdd +hi def link diffRemoved Removed +hi def link diffChanged Changed +hi def link diffAdded Added hi def link diffLine Statement hi def link diffSubname PreProc hi def link diffComment Comment diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim index f1e650b2fb..fced5e7dd1 100644 --- a/runtime/syntax/help.vim +++ b/runtime/syntax/help.vim @@ -136,6 +136,10 @@ syn match helpTodo "\t[* ]Todo\t\+[a-z].*" syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]` +syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*" +syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*" +syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*" + " Additionally load a language-specific syntax file "help_ab.vim". let s:i = match(expand("%"), '\.\a\ax$') if s:i > 0 @@ -209,6 +213,9 @@ hi def link helpUnderlined Underlined hi def link helpError Error hi def link helpTodo Todo hi def link helpURL String +hi def link helpDiffAdded Added +hi def link helpDiffChanged Changed +hi def link helpDiffRemoved Removed let b:current_syntax = "help" -- cgit From 061a0d5a48e4e3c4a72930de806e5957763f4dc8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 10 Jan 2024 18:54:58 +0100 Subject: vim-patch:5f4cc8ea65e8 runtime(colorschemes): Add initial support for Added/Removed/Changed highlight groups (vim/vim#13830) For some of the colorschemes where diffAdded and diffRemoved were explicitly set up. https://github.com/vim/vim/commit/5f4cc8ea65e80efa35f84fe9a9985a42c3c96bae Co-authored-by: Maxim Kim --- runtime/colors/blue.vim | 18 +++++------ runtime/colors/darkblue.vim | 10 +++---- runtime/colors/evening.vim | 14 ++++----- runtime/colors/habamax.vim | 22 ++++++++------ runtime/colors/lunaperche.vim | 32 ++++++++++++-------- runtime/colors/murphy.vim | 4 ++- runtime/colors/wildcharm.vim | 70 +++++++++++++++++++++++-------------------- 7 files changed, 94 insertions(+), 76 deletions(-) (limited to 'runtime') diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index 2d0e48f448..d6931e4c71 100644 --- a/runtime/colors/blue.vim +++ b/runtime/colors/blue.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:33 +" Last Updated: Mon 08 Jan 2024 09:42:49 AM AEDT " Generated by Colortemplate v2.2.3 @@ -81,8 +81,8 @@ hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cter hi Label guifg=#ffd700 guibg=NONE gui=NONE cterm=NONE hi! link Terminal Normal hi! link Debug Special -hi! link diffAdded String -hi! link diffRemoved WarningMsg +hi! link Added String +hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -191,8 +191,8 @@ if s:t_Co >= 256 hi Label ctermfg=220 ctermbg=NONE cterm=NONE hi! link Terminal Normal hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -304,8 +304,8 @@ if s:t_Co >= 16 hi Label ctermfg=yellow ctermbg=NONE cterm=NONE hi! link Terminal Normal hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -416,8 +416,8 @@ if s:t_Co >= 8 hi Label ctermfg=yellow ctermbg=NONE cterm=NONE hi! link Terminal Normal hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index 05b3fa4199..471b8561fb 100644 --- a/runtime/colors/darkblue.vim +++ b/runtime/colors/darkblue.vim @@ -4,7 +4,7 @@ " Maintainer: Original author Bohdan Vlasyuk " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:37 +" Last Updated: Mon 08 Jan 2024 09:43:03 AM AEDT " Generated by Colortemplate v2.2.3 @@ -59,8 +59,8 @@ hi! link Structure Type hi! link Tag Special hi! link Typedef Type hi! link Debug Special -hi! link diffAdded String -hi! link diffRemoved WarningMsg +hi! link Added String +hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -167,8 +167,8 @@ if s:t_Co >= 256 hi! link Tag Special hi! link Typedef Type hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index 01fc0d8354..1abdd8006f 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:35 +" Last Updated: Mon 08 Jan 2024 09:43:27 AM AEDT " Generated by Colortemplate v2.2.3 @@ -33,8 +33,8 @@ hi! link CursorIM Cursor hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link Debug Special -hi! link diffAdded String -hi! link diffRemoved WarningMsg +hi! link Added String +hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -141,8 +141,8 @@ if s:t_Co >= 256 hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg @@ -252,8 +252,8 @@ if s:t_Co >= 16 hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link Debug Special - hi! link diffAdded String - hi! link diffRemoved WarningMsg + hi! link Added String + hi! link Removed WarningMsg hi! link diffOnly WarningMsg hi! link diffNoEOL WarningMsg hi! link diffIsA WarningMsg diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim index 1073ba3d93..66f40ab56a 100644 --- a/runtime/colors/habamax.vim +++ b/runtime/colors/habamax.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:35 +" Last Updated: Mon 08 Jan 2024 09:39:53 AM AEDT " Generated by Colortemplate v2.2.3 @@ -111,8 +111,9 @@ hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Debug guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE hi DiffAdd guifg=#dadada guibg=#5f875f gui=NONE cterm=NONE hi DiffDelete guifg=#af875f guibg=NONE gui=NONE cterm=NONE -hi diffAdded guifg=#87af87 guibg=NONE gui=NONE cterm=NONE -hi diffRemoved guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE +hi Added guifg=#87af87 guibg=NONE gui=NONE cterm=NONE +hi Changed guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE +hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE hi diffSubname guifg=#af87af guibg=NONE gui=NONE cterm=NONE hi DiffText guifg=#dadada guibg=#878787 gui=NONE cterm=NONE hi DiffChange guifg=#bcbcbc guibg=#5f5f5f gui=NONE cterm=NONE @@ -204,8 +205,9 @@ if s:t_Co >= 256 hi Debug ctermfg=66 ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=253 ctermbg=65 cterm=NONE hi DiffDelete ctermfg=137 ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=108 ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=167 ctermbg=NONE cterm=NONE + hi Added ctermfg=108 ctermbg=NONE cterm=NONE + hi Changed ctermfg=66 ctermbg=NONE cterm=NONE + hi Removed ctermfg=167 ctermbg=NONE cterm=NONE hi diffSubname ctermfg=139 ctermbg=NONE cterm=NONE hi DiffText ctermfg=253 ctermbg=102 cterm=NONE hi DiffChange ctermfg=250 ctermbg=59 cterm=NONE @@ -282,8 +284,9 @@ if s:t_Co >= 16 hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi DiffText ctermfg=white ctermbg=lightgrey cterm=NONE hi DiffChange ctermfg=white ctermbg=darkgray cterm=NONE @@ -360,8 +363,9 @@ if s:t_Co >= 8 hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi DiffText ctermfg=white ctermbg=black cterm=bold,reverse hi DiffChange ctermfg=black ctermbg=white cterm=NONE diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim index 3c8682737e..62538468dc 100644 --- a/runtime/colors/lunaperche.vim +++ b/runtime/colors/lunaperche.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://www.github.com/vim/colorschemes " License: Vim License (see `:help license`) -" Last Updated: Fri 15 Dec 2023 20:05:37 +" Last Updated: Mon 08 Jan 2024 09:41:03 AM AEDT " Generated by Colortemplate v2.2.3 @@ -169,8 +169,9 @@ if &background ==# 'dark' hi DiffChange guifg=#c6c6c6 guibg=#5f5f5f gui=NONE cterm=NONE hi DiffText guifg=#afffff guibg=#5f8787 gui=NONE cterm=NONE hi DiffDelete guifg=#d78787 guibg=NONE gui=NONE cterm=NONE - hi diffAdded guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE - hi diffRemoved guifg=#d78787 guibg=NONE gui=NONE cterm=NONE + hi Added guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE + hi Changed guifg=#5fafff guibg=NONE gui=NONE cterm=NONE + hi Removed guifg=#d78787 guibg=NONE gui=NONE cterm=NONE hi diffSubname guifg=#ff87ff guibg=NONE gui=NONE cterm=NONE hi dirType guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE hi dirPermissionUser guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE @@ -263,8 +264,9 @@ else hi DiffChange guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE hi DiffText guifg=#000000 guibg=#5fd7d7 gui=NONE cterm=NONE hi DiffDelete guifg=#870000 guibg=NONE gui=NONE cterm=NONE - hi diffAdded guifg=#008700 guibg=NONE gui=NONE cterm=NONE - hi diffRemoved guifg=#d70000 guibg=NONE gui=NONE cterm=NONE + hi Added guifg=#008700 guibg=NONE gui=NONE cterm=NONE + hi Changed guifg=#005fd7 guibg=NONE gui=NONE cterm=NONE + hi Removed guifg=#d70000 guibg=NONE gui=NONE cterm=NONE hi diffSubname guifg=#af00af guibg=NONE gui=NONE cterm=NONE hi dirType guifg=#005f5f guibg=NONE gui=NONE cterm=NONE hi dirPermissionUser guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE @@ -430,8 +432,9 @@ if s:t_Co >= 256 hi DiffChange ctermfg=251 ctermbg=59 cterm=NONE hi DiffText ctermfg=159 ctermbg=66 cterm=NONE hi DiffDelete ctermfg=174 ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=77 ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=174 ctermbg=NONE cterm=NONE + hi Added ctermfg=77 ctermbg=NONE cterm=NONE + hi Changed ctermfg=75 ctermbg=NONE cterm=NONE + hi Removed ctermfg=174 ctermbg=NONE cterm=NONE hi diffSubname ctermfg=213 ctermbg=NONE cterm=NONE hi dirType ctermfg=176 ctermbg=NONE cterm=NONE hi dirPermissionUser ctermfg=71 ctermbg=NONE cterm=NONE @@ -515,8 +518,9 @@ if s:t_Co >= 256 hi DiffChange ctermfg=16 ctermbg=252 cterm=NONE hi DiffText ctermfg=16 ctermbg=80 cterm=NONE hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=28 ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=160 ctermbg=NONE cterm=NONE + hi Added ctermfg=28 ctermbg=NONE cterm=NONE + hi Changed ctermfg=26 ctermbg=NONE cterm=NONE + hi Removed ctermfg=160 ctermbg=NONE cterm=NONE hi diffSubname ctermfg=127 ctermbg=NONE cterm=NONE hi dirType ctermfg=23 ctermbg=NONE cterm=NONE hi dirPermissionUser ctermfg=130 ctermbg=NONE cterm=NONE @@ -605,8 +609,9 @@ if s:t_Co >= 16 hi DiffChange ctermfg=white ctermbg=darkgreen cterm=NONE hi DiffText ctermfg=black ctermbg=cyan cterm=NONE hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=green ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE + hi Added ctermfg=green ctermbg=NONE cterm=NONE + hi Changed ctermfg=blue ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE hi diffSubname ctermfg=magenta ctermbg=NONE cterm=NONE hi dirType ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi dirPermissionUser ctermfg=darkgreen ctermbg=NONE cterm=NONE @@ -690,8 +695,9 @@ if s:t_Co >= 16 hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE hi DiffText ctermfg=black ctermbg=cyan cterm=NONE hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE - hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=red ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE + hi Removed ctermfg=red ctermbg=NONE cterm=NONE hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi dirType ctermfg=darkcyan ctermbg=NONE cterm=NONE hi dirPermissionUser ctermfg=darkyellow ctermbg=NONE cterm=NONE diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index 66b994a6c7..c1612fbc0e 100644 --- a/runtime/colors/murphy.vim +++ b/runtime/colors/murphy.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ron Aaron . " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:38 +" Last Updated: Mon 08 Jan 2024 09:50:15 AM AEDT " Generated by Colortemplate v2.2.3 @@ -33,6 +33,7 @@ hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link Added Constant hi Normal guifg=#87ff87 guibg=#000000 gui=NONE cterm=NONE hi EndOfBuffer guifg=#0000ff guibg=#000000 gui=NONE cterm=NONE hi StatusLine guifg=#ffffff guibg=#00008b gui=NONE cterm=NONE @@ -105,6 +106,7 @@ if s:t_Co >= 256 hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link Added Constant hi Normal ctermfg=120 ctermbg=16 cterm=NONE hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE hi StatusLine ctermfg=231 ctermbg=18 cterm=NONE diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim index ae0489e259..c47a66d148 100644 --- a/runtime/colors/wildcharm.vim +++ b/runtime/colors/wildcharm.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:43 +" Last Updated: Mon 08 Jan 2024 09:40:36 AM AEDT " Generated by Colortemplate v2.2.3 @@ -98,8 +98,9 @@ if &background ==# 'dark' hi DiffChange guifg=#d0d0d0 guibg=#5f5f5f gui=NONE cterm=NONE hi DiffText guifg=#afffff guibg=#5f8787 gui=NONE cterm=NONE hi DiffDelete guifg=#ffafaf guibg=#875f5f gui=NONE cterm=NONE - hi diffAdded guifg=#00af5f guibg=NONE gui=NONE cterm=NONE - hi diffRemoved guifg=#d7005f guibg=NONE gui=NONE cterm=NONE + hi Added guifg=#00af5f guibg=NONE gui=NONE cterm=NONE + hi Changed guifg=#0087d7 guibg=NONE gui=NONE cterm=NONE + hi Removed guifg=#d7005f guibg=NONE gui=NONE cterm=NONE else " Light background if (has('termguicolors') && &termguicolors) || has('gui_running') @@ -176,8 +177,9 @@ else hi DiffChange guifg=#262626 guibg=#dadada gui=NONE cterm=NONE hi DiffText guifg=#005f5f guibg=#afd7d7 gui=NONE cterm=NONE hi DiffDelete guifg=#875f5f guibg=#ffd7d7 gui=NONE cterm=NONE - hi diffAdded guifg=#008700 guibg=NONE gui=NONE cterm=NONE - hi diffRemoved guifg=#d70000 guibg=NONE gui=NONE cterm=NONE + hi Added guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE + hi Changed guifg=#0087d7 guibg=NONE gui=NONE cterm=NONE + hi Removed guifg=#d70000 guibg=NONE gui=NONE cterm=NONE endif if s:t_Co >= 256 @@ -256,8 +258,9 @@ if s:t_Co >= 256 hi DiffChange ctermfg=252 ctermbg=59 cterm=NONE hi DiffText ctermfg=159 ctermbg=66 cterm=NONE hi DiffDelete ctermfg=217 ctermbg=95 cterm=NONE - hi diffAdded ctermfg=35 ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=161 ctermbg=NONE cterm=NONE + hi Added ctermfg=35 ctermbg=NONE cterm=NONE + hi Changed ctermfg=32 ctermbg=NONE cterm=NONE + hi Removed ctermfg=161 ctermbg=NONE cterm=NONE else " Light background hi Normal ctermfg=16 ctermbg=231 cterm=NONE @@ -325,8 +328,9 @@ if s:t_Co >= 256 hi DiffChange ctermfg=235 ctermbg=253 cterm=NONE hi DiffText ctermfg=23 ctermbg=152 cterm=NONE hi DiffDelete ctermfg=95 ctermbg=224 cterm=NONE - hi diffAdded ctermfg=28 ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=160 ctermbg=NONE cterm=NONE + hi Added ctermfg=71 ctermbg=NONE cterm=NONE + hi Changed ctermfg=32 ctermbg=NONE cterm=NONE + hi Removed ctermfg=160 ctermbg=NONE cterm=NONE endif unlet s:t_Co finish @@ -395,12 +399,13 @@ if s:t_Co >= 16 hi Directory ctermfg=blue ctermbg=NONE cterm=bold hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE + hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE hi DiffText ctermfg=black ctermbg=cyan cterm=NONE hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE - hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE else " Light background hi Normal ctermfg=black ctermbg=white cterm=NONE @@ -464,12 +469,13 @@ if s:t_Co >= 16 hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE + hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE hi DiffText ctermfg=black ctermbg=cyan cterm=NONE hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE - hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi diffRemoved ctermfg=red ctermbg=NONE cterm=NONE + hi Added ctermfg=green ctermbg=NONE cterm=NONE + hi Changed ctermfg=blue ctermbg=NONE cterm=NONE + hi Removed ctermfg=red ctermbg=NONE cterm=NONE endif unlet s:t_Co finish @@ -519,7 +525,7 @@ if s:t_Co >= 8 hi VisualNOS ctermfg=black ctermbg=darkblue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE - hi Folded ctermfg=black ctermbg=NONE cterm=bold + hi Folded ctermfg=grey ctermbg=NONE cterm=bold hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=reverse @@ -528,20 +534,20 @@ if s:t_Co >= 8 hi Comment ctermfg=NONE ctermbg=NONE cterm=bold hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE - hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold + hi Identifier ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi Statement ctermfg=darkblue ctermbg=NONE cterm=NONE hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE - hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Special ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE - hi DiffChange ctermfg=black ctermbg=darkcyan cterm=NONE - hi DiffText ctermfg=black ctermbg=grey cterm=NONE - hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE + hi DiffChange ctermfg=black ctermbg=darkblue cterm=NONE + hi DiffText ctermfg=black ctermbg=darkmagenta cterm=NONE + hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE else " Light background hi Normal ctermfg=black ctermbg=grey cterm=NONE @@ -595,20 +601,20 @@ if s:t_Co >= 8 hi Comment ctermfg=NONE ctermbg=NONE cterm=bold hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE - hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold + hi Identifier ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi Statement ctermfg=darkblue ctermbg=NONE cterm=NONE hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE - hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Special ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE - hi DiffChange ctermfg=black ctermbg=darkcyan cterm=NONE - hi DiffText ctermfg=grey ctermbg=black cterm=NONE - hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE + hi DiffChange ctermfg=black ctermbg=darkblue cterm=NONE + hi DiffText ctermfg=black ctermbg=darkmagenta cterm=NONE + hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE endif unlet s:t_Co finish @@ -709,7 +715,7 @@ endif " Color: colorlC #ff5fff 207 magenta " Color: colorDim #878787 102 grey " Color: colorMP #ff00af 199 magenta -" Color: diffAdd #5f875f 65 darkmagenta +" Color: diffAdd #5f875f 65 darkgreen " Color: diffAddFg #afffaf 157 black " Color: diffDelete #875f5f 95 darkred " Color: diffDeleteFg #ffafaf 217 black @@ -748,7 +754,7 @@ endif " Color: colorDim #626262 241 darkgrey " Color: colorSt #5f5f5f 59 darkgrey " Color: colorMP #ff00af 199 magenta -" Color: diffAdd #afd7af 151 darkmagenta +" Color: diffAdd #afd7af 151 darkgreen " Color: diffAddFg #005f00 22 black " Color: diffDelete #ffd7d7 224 darkred " Color: diffDeleteFg #875f5f 95 black -- cgit From 7f249936a989dbc21ad03e394197afc07cb9c0bf Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 12 Jan 2024 17:30:54 +0100 Subject: vim-patch:2357765304e4 runtime(netrw): Decode multibyte percent-encoding filename correctly (vim/vim#13842) Use `printf("%c")` instead of `nr2char()` to handle '%xx' as a byte. Close vim/vim#13787 https://github.com/vim/vim/commit/2357765304e4c55935b5cc853ffb98ae82d64a01 Co-authored-by: K.Takata --- runtime/autoload/netrw.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index fb551ac675..811a9501fe 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -11477,7 +11477,7 @@ endfun " netrw#RFC2396: converts %xx into characters {{{2 fun! netrw#RFC2396(fname) " call Dfunc("netrw#RFC2396(fname<".a:fname.">)") - let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t") + let fname = escape(substitute(a:fname,'%\(\x\x\)','\=printf("%c","0x".submatch(1))','ge')," \t") " call Dret("netrw#RFC2396 ".fname) return fname endfun -- cgit From c8f696f2b0c289a88054c20e0415051ebe017eb3 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 12 Jan 2024 20:01:42 +0100 Subject: vim-patch:9.1.0025: A few typos in tests and justify.vim Problem: A few typos in tests and justify.vim Solution: fix them closes: vim/vim#13848 https://github.com/vim/vim/commit/dc4c37b9d5130c777b377287b8b38cd24da084cb Co-authored-by: dundargoc --- runtime/pack/dist/opt/justify/plugin/justify.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/pack/dist/opt/justify/plugin/justify.vim b/runtime/pack/dist/opt/justify/plugin/justify.vim index 4ef3bf95fa..57be790423 100644 --- a/runtime/pack/dist/opt/justify/plugin/justify.vim +++ b/runtime/pack/dist/opt/justify/plugin/justify.vim @@ -80,7 +80,7 @@ " conformant with :left, :right and :center. " " If joinspaces is set, an extra space is added after '.', '?' and '!'. -" If 'cpooptions' include 'j', extra space is only added after '.'. +" If 'cpoptions' include 'j', extra space is only added after '.'. " (This may on occasion conflict with maxspaces.) -- cgit From 2783b6b0a48389f5e12109d9894269768c3e9fe5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Jan 2024 07:01:08 +0800 Subject: vim-patch:9.1.0015: i_CTRL-R- no longer works in replace mode Problem: i_CTRL-R- no longer works in replace mode Solution: delete characters in replace mode before putting, add a test, add a bit warning into the documentation, that i_CTRL-R-P/O is not supported in Replace mode for now fixes: vim/vim#13792 closes: vim/vim#13816 https://github.com/vim/vim/commit/5d5cbb2b9ac526fb6fad2116e24a282affc45efe Co-authored-by: Christian Brabandt --- runtime/doc/insert.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index ce2ec36ca3..34affb22e9 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -160,22 +160,22 @@ CTRL-R CTRL-O {register} *i_CTRL-R_CTRL-O* auto-indent. Does the same as pasting with the mouse ||. When the register is linewise this will insert the text above the current line, like with `P`. - Does not replace characters! The '.' register (last inserted text) is still inserted as typed. After this command, the '.' register contains the command typed and not the text. I.e., the literals "^R^O" and not the text from the register. + Does not replace characters in |Replace-mode|! CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P* Insert the contents of a register literally and fix the indent, like |[|. - Does not replace characters! The '.' register (last inserted text) is still inserted as typed. After this command, the '.' register contains the command typed and not the text. I.e., the literals "^R^P" and not the text from the register. + Does not replace characters in |Replace-mode|! *i_CTRL-T* CTRL-T Insert one shiftwidth of indent at the start of the current -- cgit From 0c850add3ecedec5b7dea62f0dd152f3421b66fc Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sun, 14 Jan 2024 02:35:37 +0200 Subject: fix(colorscheme): default statusline groups usability #26921 Problem: Current values of `StatusLine` and `StatusLineNC` are currently designed to be visually distinctive while being not intrusive. However, the compromise was more shifted towards "not intrusive". After the feedback, statusline highlight groups should be designed to: - Make current window clearly noticeable. Meaning `StatusLine` and `StatusLineNC` should obviously differ. - Make non-current windows clearly separable. Meaning `StatusLineNC` and `Normal`/`NormalNC` should obviously differ. Solution: - Update `StatusLineNC` to have more visible background. - Update `StatusLine` to be inverted variant of `StatusLineNC`. - Update `WinBar` and `WinBarNC` to not link to `StatusLine` and `StatusLineNC` because it makes two goals harder to achieve. - Update `TabLine` to link to `StatusLineNC` instead of `StatusLine` to not be very visually intrusive. --- runtime/doc/news.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 98b782a105..cb70c81191 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -99,8 +99,8 @@ The following changes may require adaptations in user config or plugins. a meaningfully different way and might need an update: • |hl-FloatBorder| is linked to |hl-NormalFloat| instead of |hl-WinSeparator|. • |hl-NormalFloat| is not linked to |hl-Pmenu|. - • |hl-WinBar| is linked to |hl-StatusLine|. - • |hl-WinBarNC| is linked to |hl-StatusLineNC| instead of |hl-WinBar|. + • |hl-WinBar| has different background. + • |hl-WinBarNC| is similar to |hl-WinBar| but not bold. • |hl-WinSeparator| is linked to |hl-Normal| instead of |hl-VertSplit|. This also might result into some color schemes looking differently due to -- cgit From 2bdd8fad4cf4008125ce540453434888c07044a6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jan 2024 08:44:16 +0800 Subject: docs(builtin): fix mapset() signature (#27008) --- runtime/doc/builtin.txt | 3 ++- runtime/lua/vim/_meta/vimfn.lua | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5f89082b6f..d85735a008 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4273,7 +4273,8 @@ mapnew({expr1}, {expr2}) *mapnew()* unchanged. Items can still be changed by {expr2}, if you don't want that use |deepcopy()| first. -mapset({mode}, {abbr}, {dict}) *mapset()* +mapset({mode}, {abbr}, {dict}) +mapset({dict}) *mapset()* Restore a mapping from a dictionary, possibly returned by |maparg()| or |maplist()|. A buffer mapping, when dict.buffer is true, is set on the current buffer; it is up to the caller diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index a763be93b9..f044871601 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -5152,6 +5152,12 @@ function vim.fn.maplist() end --- @return any function vim.fn.mapnew(expr1, expr2) end +--- @param mode string +--- @param abbr? any +--- @param dict? any +--- @return any +function vim.fn.mapset(mode, abbr, dict) end + --- Restore a mapping from a dictionary, possibly returned by --- |maparg()| or |maplist()|. A buffer mapping, when dict.buffer --- is true, is set on the current buffer; it is up to the caller @@ -5187,11 +5193,9 @@ function vim.fn.mapnew(expr1, expr2) end --- call mapset(d) --- endfor --- ---- @param mode string ---- @param abbr? any ---- @param dict? any +--- @param dict any --- @return any -function vim.fn.mapset(mode, abbr, dict) end +function vim.fn.mapset(dict) end --- When {expr} is a |List| then this returns the index of the --- first item where {pat} matches. Each item is used as a -- cgit From ce4ea638c703275aedadb3794efc56dcb782c908 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Tue, 9 Jan 2024 18:04:27 -0500 Subject: fix(lsp): fix incorrect typing and doc for `vim.lsp.rpc` Typings introduced in #26032 and #26552 have a few conflicts, so we merge and clean them up. We also fix some incorrect type annotation in the `vim.lsp.rpc` package. See the associated PR for more details. Summary: - vim.rpc.Dispatchers -> vim.lsp.rpc.Dispatchers - vim.lsp.rpc.Error -> lsp.ResponseError - Revise docs --- runtime/doc/lsp.txt | 47 ++++++------ runtime/lua/vim/_system.lua | 4 +- runtime/lua/vim/lsp.lua | 8 ++- runtime/lua/vim/lsp/rpc.lua | 172 ++++++++++++++++++++++---------------------- 4 files changed, 120 insertions(+), 111 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 7e1c0a4a15..427cd40761 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2089,7 +2089,10 @@ Lua module: vim.lsp.rpc *lsp-rpc* connect({host}, {port}) *vim.lsp.rpc.connect()* Create a LSP RPC client factory that connects via TCP to the given host - and port + and port. + + Return a function that can be passed to the `cmd` field for + |vim.lsp.start_client()| or |vim.lsp.start()|. Parameters: ~ • {host} (`string`) host to connect to @@ -2097,14 +2100,15 @@ connect({host}, {port}) *vim.lsp.rpc.connect()* Return: ~ (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`) - function intended to be passed to |vim.lsp.start_client()| or - |vim.lsp.start()| on the field cmd *vim.lsp.rpc.domain_socket_connect()* domain_socket_connect({pipe_path}) Create a LSP RPC client factory that connects via named pipes (Windows) or unix domain sockets (Unix) to the given pipe_path (file path on Unix and - name on Windows) + name on Windows). + + Return a function that can be passed to the `cmd` field for + |vim.lsp.start_client()| or |vim.lsp.start()|. Parameters: ~ • {pipe_path} (`string`) file path of the domain socket (Unix) or name @@ -2112,8 +2116,6 @@ domain_socket_connect({pipe_path}) Return: ~ (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`) - function intended to be passed to |vim.lsp.start_client()| or - |vim.lsp.start()| on the field cmd format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* Constructs an error message from an LSP error object. @@ -2122,7 +2124,7 @@ format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* • {err} (`table`) The error object Return: ~ - (`string`) The formatted error message + (`string`) error_message The formatted error message notify({method}, {params}) *vim.lsp.rpc.notify()* Sends a notification to the LSP server. @@ -2144,24 +2146,29 @@ request({method}, {params}, {callback}, {notify_reply_callback}) method • {callback} (`fun(err: lsp.ResponseError?, result: any)`) Callback to invoke - • {notify_reply_callback} (`function?`) Callback to invoke as soon as a - request is no longer pending + • {notify_reply_callback} (`fun(message_id: integer)?`) Callback to + invoke as soon as a request is no longer + pending - Return: ~ - (`boolean success, integer? request_id`) true, message_id if request - could be sent, `false` if not + Return (multiple): ~ + (`boolean`) success `true` if request could be sent, `false` if not + (`integer?`) message_id if request could be sent, `nil` if not *vim.lsp.rpc.rpc_response_error()* rpc_response_error({code}, {message}, {data}) - Creates an RPC response object/table. + Creates an RPC response table `error` to be sent to the LSP response. Parameters: ~ - • {code} (`integer`) RPC error code defined by JSON RPC + • {code} (`integer`) RPC error code defined, see + `vim.lsp.protocol.ErrorCodes` • {message} (`string?`) arbitrary message to send to server • {data} (`any?`) arbitrary data to send to server Return: ~ - (`vim.lsp.rpc.Error`) + (`lsp.ResponseError`) + + See also: ~ + • lsp.ErrorCodes See `vim.lsp.protocol.ErrorCodes` *vim.lsp.rpc.start()* start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) @@ -2174,14 +2181,14 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) • {cmd} (`string`) Command to start the LSP server. • {cmd_args} (`string[]`) List of additional string arguments to pass to {cmd}. - • {dispatchers} (`table?`) Dispatchers for LSP message types. - Valid dispatcher names are: + • {dispatchers} (`vim.lsp.rpc.Dispatchers?`) Dispatchers for LSP + message types. Valid dispatcher names are: • `"notification"` • `"server_request"` • `"on_error"` • `"on_exit"` - • {extra_spawn_params} (`table?`) Additional context for the LSP server - process. May contain: + • {extra_spawn_params} (`vim.lsp.rpc.ExtraSpawnParams?`) Additional + context for the LSP server process. May contain: • {cwd} (string) Working directory for the LSP server process • {detached?} (boolean) Detach the LSP server @@ -2191,7 +2198,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) variables for LSP server process Return: ~ - (`table?`) client RPC object, with these methods: + (`vim.lsp.rpc.PublicClient?`) Client RPC object, with these methods: • `notify()` |vim.lsp.rpc.notify()| • `request()` |vim.lsp.rpc.request()| • `is_closing()` returns a boolean indicating if the RPC is closing. diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index 9e935b7e95..efad3f88cf 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -61,7 +61,7 @@ end --- @field wait fun(self: vim.SystemObj, timeout?: integer): vim.SystemCompleted --- @field kill fun(self: vim.SystemObj, signal: integer|string) --- @field write fun(self: vim.SystemObj, data?: string|string[]) ---- @field is_closing fun(self: vim.SystemObj): boolean? +--- @field is_closing fun(self: vim.SystemObj): boolean local SystemObj = {} --- @param state vim.SystemState @@ -140,7 +140,7 @@ end --- @return boolean function SystemObj:is_closing() local handle = self._state.handle - return handle == nil or handle:is_closing() + return handle == nil or handle:is_closing() or false end ---@param output fun(err:string?, data: string?)|false diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index b2aa943359..a02a93d559 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -258,7 +258,7 @@ end --- Validates a client configuration as given to |vim.lsp.start_client()|. --- ---@param config (lsp.ClientConfig) ----@return (string|fun(dispatchers:vim.rpc.Dispatchers):RpcClientPublic?) Command +---@return (string|fun(dispatchers:vim.rpc.Dispatchers):vim.lsp.rpc.PublicClient?) Command ---@return string[] Arguments ---@return string Encoding. local function validate_client_config(config) @@ -291,7 +291,7 @@ local function validate_client_config(config) 'flags.debounce_text_changes must be a number with the debounce time in milliseconds' ) - local cmd, cmd_args --- @type (string|fun(dispatchers:vim.rpc.Dispatchers):RpcClientPublic), string[] + local cmd, cmd_args --- @type (string|fun(dispatchers:vim.rpc.Dispatchers):vim.lsp.rpc.PublicClient), string[] local config_cmd = config.cmd if type(config_cmd) == 'function' then cmd = config_cmd @@ -826,6 +826,8 @@ function lsp.start_client(config) --- ---@param method (string) LSP method name ---@param params (table) The parameters for that method + ---@return any result + ---@return lsp.ResponseError error code and message set in case an exception happens during the request. function dispatch.server_request(method, params) if log.trace() then log.trace('server_request', method, params) @@ -953,7 +955,7 @@ function lsp.start_client(config) end -- Start the RPC client. - local rpc --- @type RpcClientPublic? + local rpc --- @type vim.lsp.rpc.PublicClient? if type(cmd) == 'function' then rpc = cmd(dispatch) else diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 51d6bf4f9f..660b126ce4 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -5,29 +5,6 @@ local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedu local is_win = uv.os_uname().version:find('Windows') ----@alias vim.lsp.rpc.Dispatcher fun(method: string, params: table):nil, vim.lsp.rpc.Error? ----@alias vim.lsp.rpc.on_error fun(code: integer, ...: any) ----@alias vim.lsp.rpc.on_exit fun(code: integer, signal: integer) - ----@class vim.lsp.rpc.Dispatchers ----@field notification vim.lsp.rpc.Dispatcher ----@field server_request vim.lsp.rpc.Dispatcher ----@field on_exit vim.lsp.rpc.on_error ----@field on_error vim.lsp.rpc.on_exit - ----@class vim.lsp.rpc.PublicClient ----@field request fun(method: string, params?: table, callback: fun(err: lsp.ResponseError | nil, result: any), notify_reply_callback:function?) ----@field notify fun(method: string, params: any) ----@field is_closing fun(): boolean ----@field terminate fun(): nil - ----@class vim.lsp.rpc.Client ----@field message_index integer ----@field message_callbacks table dict of message_id to callback ----@field notify_reply_callbacks table dict of message_id to callback ----@field transport vim.lsp.rpc.Transport ----@field dispatchers vim.lsp.rpc.Dispatchers - --- Checks whether a given path exists and is a directory. ---@param filename string path to check ---@return boolean @@ -186,7 +163,7 @@ M.client_errors = vim.tbl_add_reverse_lookup(M.client_errors) --- Constructs an error message from an LSP error object. --- ---@param err table The error object ----@return string#The formatted error message +---@return string error_message The formatted error message function M.format_rpc_error(err) validate({ err = { err, 't' }, @@ -213,17 +190,14 @@ function M.format_rpc_error(err) return table.concat(message_parts, ' ') end ----@class vim.lsp.rpc.Error ----@field code integer RPC error code defined by JSON RPC, see `vim.lsp.protocol.ErrorCodes` ----@field message? string arbitrary message to send to server ----@field data? any arbitrary data to send to server - ---- Creates an RPC response object/table. +--- Creates an RPC response table `error` to be sent to the LSP response. --- ----@param code integer RPC error code defined by JSON RPC +---@param code integer RPC error code defined, see `vim.lsp.protocol.ErrorCodes` ---@param message? string arbitrary message to send to server ---@param data? any arbitrary data to send to server ----@return vim.lsp.rpc.Error +--- +---@see lsp.ErrorCodes See `vim.lsp.protocol.ErrorCodes` +---@return lsp.ResponseError function M.rpc_response_error(code, message, data) -- TODO should this error or just pick a sane error (like InternalError)? ---@type string @@ -237,28 +211,28 @@ function M.rpc_response_error(code, message, data) }) end ---- @class vim.rpc.Dispatchers +--- @class vim.lsp.rpc.Dispatchers --- @field notification fun(method: string, params: table) ---- @field server_request fun(method: string, params: table): any?, string? +--- @field server_request fun(method: string, params: table): any?, lsp.ResponseError? --- @field on_exit fun(code: integer, signal: integer) --- @field on_error fun(code: integer, err: any) ---- @type vim.rpc.Dispatchers +--- @type vim.lsp.rpc.Dispatchers local default_dispatchers = { --- Default dispatcher for notifications sent to an LSP server. --- - ---@param method (string) The invoked LSP method - ---@param params (table) Parameters for the invoked LSP method + ---@param method string The invoked LSP method + ---@param params table Parameters for the invoked LSP method notification = function(method, params) log_debug('notification', method, params) end, --- Default dispatcher for requests sent to an LSP server. --- - ---@param method (string) The invoked LSP method - ---@param params (table) Parameters for the invoked LSP method - ---@return nil - ---@return vim.lsp.rpc.Error#`vim.lsp.protocol.ErrorCodes.MethodNotFound` + ---@param method string The invoked LSP method + ---@param params table Parameters for the invoked LSP method + ---@return any result (always nil for the default dispatchers) + ---@return lsp.ResponseError error `vim.lsp.protocol.ErrorCodes.MethodNotFound` server_request = function(method, params) log_debug('server_request', method, params) return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound) @@ -266,25 +240,21 @@ local default_dispatchers = { --- Default dispatcher for when a client exits. --- - ---@param code (integer) Exit code - ---@param signal (integer) Number describing the signal used to terminate (if - ---any) + ---@param code integer Exit code + ---@param signal integer Number describing the signal used to terminate (if any) on_exit = function(code, signal) log_info('client_exit', { code = code, signal = signal }) end, --- Default dispatcher for client errors. --- - ---@param code (integer) Error code - ---@param err (any) Details about the error - ---any) + ---@param code integer Error code + ---@param err any Details about the error on_error = function(code, err) log_error('client_error:', M.client_errors[code], err) end, } ----@cast default_dispatchers vim.lsp.rpc.Dispatchers - ---@private function M.create_read_loop(handle_body, on_no_chunk, on_error) local parse_chunk = coroutine.wrap(request_parser_loop) --[[@as fun(chunk: string?): vim.lsp.rpc.Headers?, string?]] @@ -314,6 +284,14 @@ function M.create_read_loop(handle_body, on_no_chunk, on_error) end end +---@private +---@class vim.lsp.rpc.Client +---@field message_index integer +---@field message_callbacks table dict of message_id to callback +---@field notify_reply_callbacks table dict of message_id to callback +---@field transport vim.lsp.rpc.Transport +---@field dispatchers vim.lsp.rpc.Dispatchers + ---@class vim.lsp.rpc.Client local Client = {} @@ -356,13 +334,14 @@ function Client:send_response(request_id, err, result) end ---@package ---- Sends a request to the LSP server and runs {callback} upon response. +--- Sends a request to the LSP server and runs {callback} upon response. |vim.lsp.rpc.request()| --- ---@param method string The invoked LSP method ----@param params? table Parameters for the invoked LSP method +---@param params table? Parameters for the invoked LSP method ---@param callback fun(err?: lsp.ResponseError, result: any) Callback to invoke ----@param notify_reply_callback? function Callback to invoke as soon as a request is no longer pending ----@return boolean success, integer|nil request_id true, request_id if request could be sent, `false` if not +---@param notify_reply_callback fun(message_id: integer)|nil Callback to invoke as soon as a request is no longer pending +---@return boolean success `true` if request could be sent, `false` if not +---@return integer? message_id if request could be sent, `nil` if not function Client:request(method, params, callback, notify_reply_callback) validate({ callback = { callback, 'f' }, @@ -382,14 +361,14 @@ function Client:request(method, params, callback, notify_reply_callback) if message_callbacks then message_callbacks[message_id] = schedule_wrap(callback) else - return false + return false, nil end if notify_reply_callback and notify_reply_callbacks then notify_reply_callbacks[message_id] = schedule_wrap(notify_reply_callback) end return result, message_id else - return false + return false, nil end end @@ -443,7 +422,7 @@ function Client:handle_body(body) log_debug('rpc.receive', decoded) if type(decoded.method) == 'string' and decoded.id then - local err --- @type vim.lsp.rpc.Error? + local err --- @type lsp.ResponseError|nil -- Schedule here so that the users functions don't trigger an error and -- we can still use the result. schedule(function() @@ -469,7 +448,7 @@ function Client:handle_body(body) ) end if err then - ---@cast err vim.lsp.rpc.Error + ---@cast err lsp.ResponseError assert( type(err) == 'table', 'err must be a table. Use rpc_response_error to help format errors.' @@ -564,9 +543,9 @@ function Client:handle_body(body) end ---@class vim.lsp.rpc.Transport ----@field write fun(msg: string): nil ----@field is_closing fun(): boolean|nil ----@field terminate fun(): nil +---@field write fun(msg: string) +---@field is_closing fun(): boolean +---@field terminate fun() ---@param dispatchers vim.lsp.rpc.Dispatchers ---@param transport vim.lsp.rpc.Transport @@ -582,9 +561,17 @@ local function new_client(dispatchers, transport) return setmetatable(state, { __index = Client }) end +---@class vim.lsp.rpc.PublicClient +---@field request fun(method: string, params: table?, callback: fun(err: lsp.ResponseError|nil, result: any), notify_reply_callback: fun(integer)|nil):boolean,integer? see |vim.lsp.rpc.request()| +---@field notify fun(method: string, params: any):boolean see |vim.lsp.rpc.notify()| +---@field is_closing fun(): boolean +---@field terminate fun() + ---@param client vim.lsp.rpc.Client ---@return vim.lsp.rpc.PublicClient local function public_client(client) + ---@type vim.lsp.rpc.PublicClient + ---@diagnostic disable-next-line: missing-fields local result = {} ---@private @@ -601,9 +588,10 @@ local function public_client(client) --- ---@param method (string) The invoked LSP method ---@param params (table?) Parameters for the invoked LSP method - ---@param callback fun(err: lsp.ResponseError | nil, result: any) Callback to invoke - ---@param notify_reply_callback (function?) Callback to invoke as soon as a request is no longer pending - ---@return boolean success, integer|nil request_id true, message_id if request could be sent, `false` if not + ---@param callback fun(err: lsp.ResponseError|nil, result: any) Callback to invoke + ---@param notify_reply_callback fun(message_id: integer)|nil Callback to invoke as soon as a request is no longer pending + ---@return boolean success `true` if request could be sent, `false` if not + ---@return integer? message_id if request could be sent, `nil` if not function result.request(method, params, callback, notify_reply_callback) return client:request(method, params, callback, notify_reply_callback) end @@ -619,7 +607,7 @@ local function public_client(client) return result end ----@param dispatchers? vim.lsp.rpc.Dispatchers +---@param dispatchers vim.lsp.rpc.Dispatchers? ---@return vim.lsp.rpc.Dispatchers local function merge_dispatchers(dispatchers) if not dispatchers then @@ -631,23 +619,30 @@ local function merge_dispatchers(dispatchers) error(string.format('dispatcher.%s must be a function', name)) end end - return { - notification = dispatchers.notification and vim.schedule_wrap(dispatchers.notification) - or default_dispatchers.notification, - on_error = dispatchers.on_error and vim.schedule_wrap(dispatchers.on_error) - or default_dispatchers.on_error, - + ---@type vim.lsp.rpc.Dispatchers + local merged = { + notification = ( + dispatchers.notification and vim.schedule_wrap(dispatchers.notification) + or default_dispatchers.notification + ), + on_error = ( + dispatchers.on_error and vim.schedule_wrap(dispatchers.on_error) + or default_dispatchers.on_error + ), on_exit = dispatchers.on_exit or default_dispatchers.on_exit, server_request = dispatchers.server_request or default_dispatchers.server_request, } + return merged end ---- Create a LSP RPC client factory that connects via TCP to the given host ---- and port +--- Create a LSP RPC client factory that connects via TCP to the given host and port. +--- +--- Return a function that can be passed to the `cmd` field for +--- |vim.lsp.start_client()| or |vim.lsp.start()|. --- ---@param host string host to connect to ---@param port integer port to connect to ----@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient # function intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd +---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient function M.connect(host, port) return function(dispatchers) dispatchers = merge_dispatchers(dispatchers) @@ -694,10 +689,13 @@ end --- Create a LSP RPC client factory that connects via named pipes (Windows) --- or unix domain sockets (Unix) to the given pipe_path (file path on ---- Unix and name on Windows) +--- Unix and name on Windows). +--- +--- Return a function that can be passed to the `cmd` field for +--- |vim.lsp.start_client()| or |vim.lsp.start()|. --- ---@param pipe_path string file path of the domain socket (Unix) or name of the named pipe (Windows) to connect to ----@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient#function intended to be passed to |vim.lsp.start_client()| or |vim.lsp.start()| on the field cmd +---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient function M.domain_socket_connect(pipe_path) return function(dispatchers) dispatchers = merge_dispatchers(dispatchers) @@ -755,23 +753,25 @@ end ---@param cmd string Command to start the LSP server. ---@param cmd_args string[] List of additional string arguments to pass to {cmd}. --- ----@param dispatchers? vim.lsp.rpc.Dispatchers (table|nil) Dispatchers for LSP message types. +---@param dispatchers? vim.lsp.rpc.Dispatchers Dispatchers for LSP message types. --- Valid dispatcher names are: --- - `"notification"` --- - `"server_request"` --- - `"on_error"` --- - `"on_exit"` --- ----@param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams (table|nil) Additional context for the LSP +---@param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams Additional context for the LSP --- server process. May contain: ---- - {cwd} (string) Working directory for the LSP server process ---- - {detached?} (boolean) Detach the LSP server process from the current process. Defaults to false on Windows and true otherwise. ---- - {env?} (table) Additional environment variables for LSP server process ----@return vim.lsp.rpc.PublicClient? (table|nil) client RPC object, with these methods: ---- - `notify()` |vim.lsp.rpc.notify()| ---- - `request()` |vim.lsp.rpc.request()| ---- - `is_closing()` returns a boolean indicating if the RPC is closing. ---- - `terminate()` terminates the RPC client. +--- - {cwd} (string) Working directory for the LSP server process +--- - {detached?} (boolean) Detach the LSP server process from the current process. +--- Defaults to false on Windows and true otherwise. +--- - {env?} (table) Additional environment variables for LSP server process +--- +---@return vim.lsp.rpc.PublicClient? Client RPC object, with these methods: +--- - `notify()` |vim.lsp.rpc.notify()| +--- - `request()` |vim.lsp.rpc.request()| +--- - `is_closing()` returns a boolean indicating if the RPC is closing. +--- - `terminate()` terminates the RPC client. function M.start(cmd, cmd_args, dispatchers, extra_spawn_params) log_info('Starting RPC client', { cmd = cmd, args = cmd_args, extra = extra_spawn_params }) @@ -846,7 +846,7 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params) end local msg = string.format('Spawning language server with cmd: `%s` failed%s', cmd, sfx) vim.notify(msg, vim.log.levels.WARN) - return + return nil end sysobj = sysobj_or_err --[[@as vim.SystemObj]] -- cgit From 2cdea852e8934beb89012f2127f333e4dd8aada8 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Thu, 11 Jan 2024 12:24:44 -0500 Subject: docs: auto-generate docs for `vim.lpeg` and `vim.re` - Add section `VIM.LPEG` and `VIM.RE` to docs/lua.txt. - Add `_meta/re.lua` which adds luadoc and type annotations, for the vendored `vim.re` package. - Fix minor style issues on `_meta/lpeg.lua` luadoc for better vimdocs generation. - Fix a bug on `gen_vimdoc` where non-helptags in verbatim code blocks were parsed as helptags, affecting code examples on `vim.lpeg.Cf`, etc. - Also move the `vim.regex` section below so that it can be located closer to `vim.lpeg` and `vim.re`. --- runtime/doc/lua.txt | 522 +++++++++++++++++++++++++++++++++++++---- runtime/lua/vim/_meta/lpeg.lua | 32 ++- runtime/lua/vim/_meta/re.lua | 57 +++++ runtime/lua/vim/re.lua | 1 + 4 files changed, 559 insertions(+), 53 deletions(-) create mode 100644 runtime/lua/vim/_meta/re.lua (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index aadc73e95c..924eb99e4e 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -572,13 +572,6 @@ A subset of the `vim.*` API is available in threads. This includes: like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on. - `vim.is_thread()` returns true from a non-main thread. ------------------------------------------------------------------------------- -VIM.LPEG *lua-lpeg* - - *vim.lpeg* *vim.re* -The Lpeg library for parsing expression grammars is being included as -`vim.lpeg` (https://www.inf.puc-rio.br/~roberto/lpeg/). In addition, its regex-like -interface is available as `vim.re` (https://www.inf.puc-rio.br/~roberto/lpeg/re.html). ============================================================================== VIM.HIGHLIGHT *vim.highlight* @@ -646,49 +639,6 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) priorities.user) -============================================================================== -VIM.REGEX *vim.regex* - - -Vim regexes can be used directly from Lua. Currently they only allow -matching within a single line. - - -vim.regex({re}) *vim.regex()* - Parse the Vim regex {re} and return a regex object. Regexes are "magic" - and case-sensitive by default, regardless of 'magic' and 'ignorecase'. - They can be controlled with flags, see |/magic| and |/ignorecase|. - - Parameters: ~ - • {re} (`string`) - - Return: ~ - (`vim.regex`) - - *regex:match_line()* -vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_}) - Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and {end} - are supplied, match only this byte index range. Otherwise see - |regex:match_str()|. If {start} is used, then the returned byte indices - will be relative {start}. - - Parameters: ~ - • {bufnr} (`integer`) - • {line_idx} (`integer`) - • {start} (`integer?`) - • {end_} (`integer?`) - -vim.regex:match_str({str}) *regex:match_str()* - Match the string against the regex. If the string should match the regex - precisely, surround the regex with `^` and `$` . If there was a match, the - byte indices for the beginning and end of the match are returned. When - there is no match, `nil` is returned. Because any integer is "truthy", `regex:match_str()` can - be directly used as a condition in an if-statement. - - Parameters: ~ - • {str} (`string`) - - ============================================================================== VIM.DIFF *vim.diff* @@ -3034,6 +2984,478 @@ vim.glob.to_lpeg({pattern}) *vim.glob.to_lpeg()* pattern +============================================================================== +VIM.LPEG *vim.lpeg* + + +LPeg is a pattern-matching library for Lua, based on +Parsing Expression Grammars (https://bford.info/packrat/) (PEGs). + + *lua-lpeg* + *vim.lpeg.Pattern* +The LPeg library for parsing expression grammars is included as `vim.lpeg` +(https://www.inf.puc-rio.br/~roberto/lpeg/). + +In addition, its regex-like interface is available as |vim.re| +(https://www.inf.puc-rio.br/~roberto/lpeg/re.html). + +vim.lpeg.B({pattern}) *vim.lpeg.B()* + Returns a pattern that matches only if the input string at the current + position is preceded by `patt`. Pattern `patt` must match only strings + with some fixed length, and it cannot contain captures. Like the and + predicate, this pattern never consumes any input, independently of success + or failure. + + Parameters: ~ + • {pattern} (`vim.lpeg.Pattern`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.lpeg.C({patt}) *vim.lpeg.C()* + Creates a simple capture, which captures the substring of the subject that + matches `patt`. The captured value is a string. If `patt` has other + captures, their values are returned after this one. + + Example: >lua + local function split (s, sep) + sep = lpeg.P(sep) + local elem = lpeg.C((1 - sep)^0) + local p = elem * (sep * elem)^0 + return lpeg.match(p, s) + end + local a, b, c = split('a,b,c', ',') + assert(a == 'a') + assert(b == 'b') + assert(c == 'c') +< + + Parameters: ~ + • {patt} (`vim.lpeg.Pattern`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Carg({n}) *vim.lpeg.Carg()* + Creates an argument capture. This pattern matches the empty string and + produces the value given as the nth extra argument given in the call to `lpeg.match` . + + Parameters: ~ + • {n} (`integer`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cb({name}) *vim.lpeg.Cb()* + Creates a back capture. This pattern matches the empty string and produces + the values produced by the most recent group capture named `name` (where + `name` can be any Lua value). Most recent means the last complete + outermost group capture with the given name. A Complete capture means that + the entire pattern corresponding to the capture has matched. An Outermost + capture means that the capture is not inside another complete capture. In + the same way that LPeg does not specify when it evaluates captures, it + does not specify whether it reuses values previously produced by the group + or re-evaluates them. + + Parameters: ~ + • {name} (`any`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cc({...}) *vim.lpeg.Cc()* + Creates a constant capture. This pattern matches the empty string and + produces all given values as its captured values. + + Parameters: ~ + • {...} (`any`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()* + Creates a fold capture. If `patt` produces a list of captures C1 C2 ... + Cn, this capture will produce the value `func(...func(func(C1, C2), + C3)...,Cn)`, that is, it will fold (or accumulate, or reduce) the captures + from `patt` using function `func`. This capture assumes that `patt` should + produce at least one capture with at least one value (of any type), which + becomes the initial value of an accumulator. (If you need a specific + initial value, you may prefix a constant captureto `patt`.) For each + subsequent capture, LPeg calls `func` with this accumulator as the first + argument and all values produced by the capture as extra arguments; the + first result from this call becomes the new value for the accumulator. The + final value of the accumulator becomes the captured value. + + Example: >lua + local number = lpeg.R("09") ^ 1 / tonumber + local list = number * ("," * number) ^ 0 + local function add(acc, newvalue) return acc + newvalue end + local sum = lpeg.Cf(list, add) + assert(sum:match("10,30,43") == 83) +< + + Parameters: ~ + • {patt} (`vim.lpeg.Pattern`) + • {func} (`fun(acc, newvalue)`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cg({patt}, {name}) *vim.lpeg.Cg()* + Creates a group capture. It groups all values returned by `patt` into a + single capture. The group may be anonymous (if no name is given) or named + with the given name (which can be any non-nil Lua value). + + Parameters: ~ + • {patt} (`vim.lpeg.Pattern`) + • {name} (`string?`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cmt({patt}, {fn}) *vim.lpeg.Cmt()* + Creates a match-time capture. Unlike all other captures, this one is + evaluated immediately when a match occurs (even if it is part of a larger + pattern that fails later). It forces the immediate evaluation of all its + nested captures and then calls `function`. The given function gets as + arguments the entire subject, the current position (after the match of + `patt`), plus any capture values produced by `patt`. The first value + returned by `function` defines how the match happens. If the call returns + a number, the match succeeds and the returned number becomes the new + current position. (Assuming a subject sand current position i, the + returned number must be in the range [i, len(s) + 1].) If the call returns + true, the match succeeds without consuming any input (so, to return true + is equivalent to return i). If the call returns false, nil, or no value, + the match fails. Any extra values returned by the function become the + values produced by the capture. + + Parameters: ~ + • {patt} (`vim.lpeg.Pattern`) + • {fn} (`function`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cp() *vim.lpeg.Cp()* + Creates a position capture. It matches the empty string and captures the + position in the subject where the match occurs. The captured value is a + number. + + Example: >lua + local I = lpeg.Cp() + local function anywhere(p) return lpeg.P({I * p * I + 1 * lpeg.V(1)}) end + local match_start, match_end = anywhere("world"):match("hello world!") + assert(match_start == 7) + assert(match_end == 12) +< + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Cs({patt}) *vim.lpeg.Cs()* + Creates a substitution capture. This function creates a substitution + capture, which captures the substring of the subject that matches `patt`, + with substitutions. For any capture inside `patt` with a value, the + substring that matched the capture is replaced by the capture value (which + should be a string). The final captured value is the string resulting from + all replacements. + + Example: >lua + local function gsub (s, patt, repl) + patt = lpeg.P(patt) + patt = lpeg.Cs((patt / repl + 1)^0) + return lpeg.match(patt, s) + end + assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!') +< + + Parameters: ~ + • {patt} (`vim.lpeg.Pattern`) + + Return: ~ + (`vim.lpeg.Capture`) + +vim.lpeg.Ct({patt}) *vim.lpeg.Ct()* + Creates a table capture. This capture returns a table with all values from + all anonymous captures made by `patt` inside this table in successive + integer keys, starting at 1. Moreover, for each named capture group + created by `patt`, the first value of the group is put into the table with + the group name as its key. The captured value is only the table. + + Parameters: ~ + • {patt} (vim.lpeg.Pattern |' `) @return (` vim.lpeg.Capture`) + +vim.lpeg.lpeg *vim.lpeg()* + LPeg is a new pattern-matching library for Lua, based on Parsing Expression + Grammars (PEGs). + +vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()* + Matches the given `pattern` against the `subject` string. If the match + succeeds, returns the index in the subject of the first character after + the match, or the captured values (if the pattern captured any value). An + optional numeric argument `init` makes the match start at that position in + the subject string. As usual in Lua libraries, a negative value counts + from the end. Unlike typical pattern-matching functions, `match` works + only in anchored mode; that is, it tries to match the pattern with a + prefix of the given subject string (at position `init`), not with an + arbitrary substring of the subject. So, if we want to find a pattern + anywhere in a string, we must either write a loop in Lua or write a + pattern that matches anywhere. + + Example: >lua + local pattern = lpeg.R("az") ^ 1 * -1 + assert(pattern:match("hello") == 6) + assert(lpeg.match(pattern, "hello") == 6) + assert(pattern:match("1 hello") == nil) +< + + Parameters: ~ + • {pattern} (`vim.lpeg.Pattern`) + • {subject} (`string`) + • {init} (`integer?`) + + Return: ~ + (`integer|vim.lpeg.Capture?`) + +vim.lpeg.P({value}) *vim.lpeg.P()* + Converts the given value into a proper pattern. This following rules are + applied: + • If the argument is a pattern, it is returned unmodified. + • If the argument is a string, it is translated to a pattern that matches + the string literally. + • If the argument is a non-negative number `n`, the result is a pattern + that matches exactly `n` characters. + • If the argument is a negative number `-n`, the result is a pattern that + succeeds only if the input string has less than `n` characters left: + `lpeg.P(-n)` is equivalent to `-lpeg.P(n)` (see the unary minus + operation). + • If the argument is a boolean, the result is a pattern that always + succeeds or always fails (according to the boolean value), without + consuming any input. + • If the argument is a table, it is interpreted as a grammar (see + Grammars). + • If the argument is a function, returns a pattern equivalent to a + match-time captureover the empty string. + + Parameters: ~ + • {value} (`vim.lpeg.Pattern|string|integer|boolean|table|function`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.lpeg.Pattern:match({subject}, {init}) *Pattern:match()* + Matches the given `pattern` against the `subject` string. If the match + succeeds, returns the index in the subject of the first character after + the match, or the captured values (if the pattern captured any value). An + optional numeric argument `init` makes the match start at that position in + the subject string. As usual in Lua libraries, a negative value counts + from the end. Unlike typical pattern-matching functions, `match` works + only in anchored mode; that is, it tries to match the pattern with a + prefix of the given subject string (at position `init`), not with an + arbitrary substring of the subject. So, if we want to find a pattern + anywhere in a string, we must either write a loop in Lua or write a + pattern that matches anywhere. + + Example: >lua + local pattern = lpeg.R("az") ^ 1 * -1 + assert(pattern:match("hello") == 6) + assert(lpeg.match(pattern, "hello") == 6) + assert(pattern:match("1 hello") == nil) +< + + Parameters: ~ + • {subject} (`string`) + • {init} (`integer?`) + + Return: ~ + (`integer|vim.lpeg.Capture?`) + +vim.lpeg.R({...}) *vim.lpeg.R()* + Returns a pattern that matches any single character belonging to one of + the given ranges. Each `range` is a string `xy` of length 2, representing + all characters with code between the codes of `x` and `y` (both + inclusive). As an example, the pattern `lpeg.R("09")` matches any digit, + and `lpeg.R("az", "AZ")` matches any ASCII letter. + + Example: >lua + local pattern = lpeg.R("az") ^ 1 * -1 + assert(pattern:match("hello") == 6) +< + + Parameters: ~ + • {...} (`string`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.lpeg.S({string}) *vim.lpeg.S()* + Returns a pattern that matches any single character that appears in the + given string (the `S` stands for Set). As an example, the pattern + `lpeg.S("+-*‍/")` matches any arithmetic operator. Note that, if `s` + is a character (that is, a string of length 1), then `lpeg.P(s)` is + equivalent to `lpeg.S(s)` which is equivalent to `lpeg.R(s..s)`. Note also + that both `lpeg.S("")` and `lpeg.R()` are patterns that always fail. + + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.lpeg.setmaxstack({max}) *vim.lpeg.setmaxstack()* + Sets a limit for the size of the backtrack stack used by LPeg to track + calls and choices. The default limit is `400`. Most well-written patterns + need little backtrack levels and therefore you seldom need to change this + limit; before changing it you should try to rewrite your pattern to avoid + the need for extra space. Nevertheless, a few useful patterns may + overflow. Also, with recursive grammars, subjects with deep recursion may + also need larger limits. + + Parameters: ~ + • {max} (`integer`) + +vim.lpeg.type({value}) *vim.lpeg.type()* + Returns the string `"pattern"` if the given value is a pattern, otherwise + `nil`. + + Return: ~ + (`"pattern"?`) + +vim.lpeg.V({v}) *vim.lpeg.V()* + Creates a non-terminal (a variable) for a grammar. This operation creates + a non-terminal (a variable) for a grammar. The created non-terminal refers + to the rule indexed by `v` in the enclosing grammar. + + Example: >lua + local b = lpeg.P({"(" * ((1 - lpeg.S "()") + lpeg.V(1)) ^ 0 * ")"}) + assert(b:match('((string))') == 11) + assert(b:match('(') == nil) +< + + Parameters: ~ + • {v} (`string|integer`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.lpeg.version() *vim.lpeg.version()* + Returns a string with the running version of LPeg. + + Return: ~ + (`string`) + + +============================================================================== +VIM.RE *vim.re* + + +The `vim.re` module provides a conventional regex-like syntax for pattern usage +within LPeg |vim.lpeg|. + +See https://www.inf.puc-rio.br/~roberto/lpeg/re.html for the original +documentation including regex syntax and more concrete examples. + +vim.re.compile({string}, {defs}) *vim.re.compile()* + Compiles the given {string} and returns an equivalent LPeg pattern. The + given string may define either an expression or a grammar. The optional + {defs} table provides extra Lua values to be used by the pattern. + + Parameters: ~ + • {string} (`string`) + • {defs} (`table?`) + + Return: ~ + (`vim.lpeg.Pattern`) + +vim.re.find({subject}, {pattern}, {init}) *vim.re.find()* + Searches the given {pattern} in the given {subject}. If it finds a match, + returns the index where this occurrence starts and the index where it + ends. Otherwise, returns nil. + + An optional numeric argument {init} makes the search starts at that + position in the subject string. As usual in Lua libraries, a negative + value counts from the end. + + Parameters: ~ + • {subject} (`string`) + • {pattern} (`vim.lpeg.Pattern|string`) + • {init} (`integer?`) + + Return (multiple): ~ + (`integer?`) the index where the occurrence starts, nil if no match + (`integer?`) the index where the occurrence ends, nil if no match + +vim.re.gsub({subject}, {pattern}, {replacement}) *vim.re.gsub()* + Does a global substitution, replacing all occurrences of {pattern} in the + given {subject} by {replacement}. + + Parameters: ~ + • {subject} (`string`) + • {pattern} (`vim.lpeg.Pattern|string`) + • {replacement} (`string`) + + Return: ~ + (`string`) + +vim.re.match({subject}, {pattern}, {init}) *vim.re.match()* + Matches the given {pattern} against the given {subject}, returning all + captures. + + Parameters: ~ + • {subject} (`string`) + • {pattern} (`vim.lpeg.Pattern|string`) + • {init} (`integer?`) + + Return: ~ + (`integer|vim.lpeg.Capture?`) + + See also: ~ + • vim.lpeg.match() + + +============================================================================== +VIM.REGEX *vim.regex* + + +Vim regexes can be used directly from Lua. Currently they only allow +matching within a single line. + + +vim.regex({re}) *vim.regex()* + Parse the Vim regex {re} and return a regex object. Regexes are "magic" + and case-sensitive by default, regardless of 'magic' and 'ignorecase'. + They can be controlled with flags, see |/magic| and |/ignorecase|. + + Parameters: ~ + • {re} (`string`) + + Return: ~ + (`vim.regex`) + + *regex:match_line()* +vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_}) + Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and {end} + are supplied, match only this byte index range. Otherwise see + |regex:match_str()|. If {start} is used, then the returned byte indices + will be relative {start}. + + Parameters: ~ + • {bufnr} (`integer`) + • {line_idx} (`integer`) + • {start} (`integer?`) + • {end_} (`integer?`) + +vim.regex:match_str({str}) *regex:match_str()* + Match the string against the regex. If the string should match the regex + precisely, surround the regex with `^` and `$` . If there was a match, the + byte indices for the beginning and end of the match are returned. When + there is no match, `nil` is returned. Because any integer is "truthy", `regex:match_str()` can + be directly used as a condition in an if-statement. + + Parameters: ~ + • {str} (`string`) + + ============================================================================== Lua module: vim.secure *vim.secure* diff --git a/runtime/lua/vim/_meta/lpeg.lua b/runtime/lua/vim/_meta/lpeg.lua index 42c9a6449e..5bd502a7c8 100644 --- a/runtime/lua/vim/_meta/lpeg.lua +++ b/runtime/lua/vim/_meta/lpeg.lua @@ -1,7 +1,24 @@ --- @meta +error('Cannot require a meta file') --- These types were taken from https://github.com/LuaCATS/lpeg, with types being renamed to include --- the vim namespace and with some descriptions made less verbose. +-- These types were taken from https://github.com/LuaCATS/lpeg +-- (based on revision 4aded588f9531d89555566bb1de27490354b91c7) +-- with types being renamed to include the vim namespace and with some descriptions made less verbose. + +---@defgroup vim.lpeg +---
help
+---LPeg is a pattern-matching library for Lua, based on
+---Parsing Expression Grammars (https://bford.info/packrat/) (PEGs).
+---
+---                                                                    *lua-lpeg*
+---                                                            *vim.lpeg.Pattern*
+---The LPeg library for parsing expression grammars is included as `vim.lpeg`
+---(https://www.inf.puc-rio.br/~roberto/lpeg/).
+---
+---In addition, its regex-like interface is available as |vim.re|
+---(https://www.inf.puc-rio.br/~roberto/lpeg/re.html).
+---
+---
--- *LPeg* is a new pattern-matching library for Lua, based on [Parsing Expression Grammars](https://bford.info/packrat/) (PEGs). vim.lpeg = {} @@ -32,6 +49,7 @@ local Pattern = {} --- matches anywhere. --- --- Example: +--- --- ```lua --- local pattern = lpeg.R("az") ^ 1 * -1 --- assert(pattern:match("hello") == 6) @@ -55,6 +73,7 @@ function vim.lpeg.match(pattern, subject, init) end --- we must either write a loop in Lua or write a pattern that matches anywhere. --- --- Example: +--- --- ```lua --- local pattern = lpeg.R("az") ^ 1 * -1 --- assert(pattern:match("hello") == 6) @@ -69,7 +88,7 @@ function Pattern:match(subject, init) end --- Returns the string `"pattern"` if the given value is a pattern, otherwise `nil`. --- ---- @return 'pattern'|nil +--- @return "pattern"|nil function vim.lpeg.type(value) end --- Returns a string with the running version of LPeg. @@ -115,6 +134,7 @@ function vim.lpeg.B(pattern) end --- `lpeg.R("az", "AZ")` matches any ASCII letter. --- --- Example: +--- --- ```lua --- local pattern = lpeg.R("az") ^ 1 * -1 --- assert(pattern:match("hello") == 6) @@ -137,6 +157,7 @@ function vim.lpeg.S(string) end --- for a grammar. The created non-terminal refers to the rule indexed by `v` in the enclosing grammar. --- --- Example: +--- --- ```lua --- local b = lpeg.P({"(" * ((1 - lpeg.S "()") + lpeg.V(1)) ^ 0 * ")"}) --- assert(b:match('((string))') == 11) @@ -168,6 +189,7 @@ function vim.lpeg.V(v) end --- that table. --- --- Example: +--- --- ```lua --- lpeg.locale(lpeg) --- local space = lpeg.space^0 @@ -191,6 +213,7 @@ function vim.lpeg.locale(tab) end --- The captured value is a string. If `patt` has other captures, their values are returned after this one. --- --- Example: +--- --- ```lua --- local function split (s, sep) --- sep = lpeg.P(sep) @@ -241,6 +264,7 @@ function vim.lpeg.Cc(...) end --- becomes the captured value. --- --- Example: +--- --- ```lua --- local number = lpeg.R("09") ^ 1 / tonumber --- local list = number * ("," * number) ^ 0 @@ -267,6 +291,7 @@ function vim.lpeg.Cg(patt, name) end --- subject where the match occurs. The captured value is a number. --- --- Example: +--- --- ```lua --- local I = lpeg.Cp() --- local function anywhere(p) return lpeg.P({I * p * I + 1 * lpeg.V(1)}) end @@ -285,6 +310,7 @@ function vim.lpeg.Cp() end --- value is the string resulting from all replacements. --- --- Example: +--- --- ```lua --- local function gsub (s, patt, repl) --- patt = lpeg.P(patt) diff --git a/runtime/lua/vim/_meta/re.lua b/runtime/lua/vim/_meta/re.lua new file mode 100644 index 0000000000..4f254b19a0 --- /dev/null +++ b/runtime/lua/vim/_meta/re.lua @@ -0,0 +1,57 @@ +--- @meta +error('Cannot require a meta file') + +-- Documentations and Lua types for vim.re (vendored re.lua, lpeg-1.1.0) +-- https://www.inf.puc-rio.br/~roberto/lpeg/re.html +-- +-- Copyright © 2007-2023 Lua.org, PUC-Rio. +-- See 'lpeg.html' for license + +--- @defgroup vim.re +---
help
+---The `vim.re` module provides a conventional regex-like syntax for pattern usage
+---within LPeg |vim.lpeg|.
+---
+---See https://www.inf.puc-rio.br/~roberto/lpeg/re.html for the original
+---documentation including regex syntax and more concrete examples.
+---
+---
+ +--- Compiles the given {string} and returns an equivalent LPeg pattern. The given string may define +--- either an expression or a grammar. The optional {defs} table provides extra Lua values to be used +--- by the pattern. +--- @param string string +--- @param defs? table +--- @return vim.lpeg.Pattern +function vim.re.compile(string, defs) end + +--- Searches the given {pattern} in the given {subject}. If it finds a match, returns the index +--- where this occurrence starts and the index where it ends. Otherwise, returns nil. +--- +--- An optional numeric argument {init} makes the search starts at that position in the subject +--- string. As usual in Lua libraries, a negative value counts from the end. +--- @param subject string +--- @param pattern vim.lpeg.Pattern|string +--- @param init? integer +--- @return integer|nil the index where the occurrence starts, nil if no match +--- @return integer|nil the index where the occurrence ends, nil if no match +function vim.re.find(subject, pattern, init) end + +--- Does a global substitution, replacing all occurrences of {pattern} in the given {subject} by +--- {replacement}. +--- @param subject string +--- @param pattern vim.lpeg.Pattern|string +--- @param replacement string +--- @return string +function vim.re.gsub(subject, pattern, replacement) end + +--- Matches the given {pattern} against the given {subject}, returning all captures. +--- @param subject string +--- @param pattern vim.lpeg.Pattern|string +--- @param init? integer +--- @return integer|vim.lpeg.Capture|nil +--- @see vim.lpeg.match() +function vim.re.match(subject, pattern, init) end + +--- Updates the pre-defined character classes to the current locale. +function vim.re.updatelocale() end diff --git a/runtime/lua/vim/re.lua b/runtime/lua/vim/re.lua index 007eb27ed8..114f74eb80 100644 --- a/runtime/lua/vim/re.lua +++ b/runtime/lua/vim/re.lua @@ -3,6 +3,7 @@ -- written by Roberto Ierusalimschy -- --- vendored from lpeg-1.1.0 +--- documentation available at runtime/lua/vim/_meta/re.lua -- imported functions and modules local tonumber, type, print, error = tonumber, type, print, error -- cgit From e5ff71fbbfea0431826a82a6de24656d93651ec3 Mon Sep 17 00:00:00 2001 From: altermo Date: Sun, 14 Jan 2024 12:10:31 +0100 Subject: docs(builtin): overload functions with union return types --- runtime/lua/vim/_meta/vimfn.lua | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index f044871601..fd9b68a6f3 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -1843,7 +1843,13 @@ function vim.fn.exp(expr) end --- --- @param string string --- @param nosuf? boolean ---- @param list? any +--- @param list? nil|false +--- @return string +function vim.fn.expand(string, nosuf, list) end + +--- @param string string +--- @param nosuf boolean +--- @param list true|number|string|table --- @return string|string[] function vim.fn.expand(string, nosuf, list) end @@ -3138,7 +3144,12 @@ function vim.fn.getjumplist(winnr, tabnr) end --- |getbufoneline()| --- --- @param lnum integer ---- @param end_? any +--- @param end_? nil|false +--- @return string +function vim.fn.getline(lnum, end_) end + +--- @param lnum integer +--- @param end_ true|number|string|table --- @return string|string[] function vim.fn.getline(lnum, end_) end @@ -3436,7 +3447,12 @@ function vim.fn.getqflist(what) end --- If {regname} is not specified, |v:register| is used. --- --- @param regname? string ---- @param list? any +--- @param list? nil|false +--- @return string +function vim.fn.getreg(regname, list) end + +--- @param regname string +--- @param list true|number|string|table --- @return string|string[] function vim.fn.getreg(regname, list) end @@ -5067,7 +5083,14 @@ function vim.fn.map(expr1, expr2) end --- @param name string --- @param mode? string --- @param abbr? boolean ---- @param dict? boolean +--- @param dict? false +--- @return string +function vim.fn.maparg(name, mode, abbr, dict) end + +--- @param name string +--- @param mode string +--- @param abbr boolean +--- @param dict true --- @return string|table function vim.fn.maparg(name, mode, abbr, dict) end @@ -9317,7 +9340,12 @@ function vim.fn.strwidth(string) end --- A line break is included as a newline character. --- --- @param nr integer ---- @param list? integer +--- @param list? nil +--- @return string +function vim.fn.submatch(nr, list) end + +--- @param nr integer +--- @param list integer --- @return string|string[] function vim.fn.submatch(nr, list) end -- cgit From 4d91604c8868b7afaf429cc16b72192ce89ea698 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Sun, 14 Jan 2024 22:37:07 -0500 Subject: docs: add lua typing for `vim.NIL` --- runtime/doc/lsp.txt | 3 ++- runtime/lua/vim/_meta/builtin.lua | 9 ++++++++- runtime/lua/vim/_meta/vvars.lua | 2 +- runtime/lua/vim/lsp/util.lua | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 427cd40761..9de30f1e8a 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1829,7 +1829,8 @@ lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()* • {section} (`string`) indicating the field of the settings table Return: ~ - (`table|string`) The value of settings accessed via section + (`table|string|vim.NIL`) The value of settings accessed via section. + `vim.NIL` if not found. *vim.lsp.util.make_floating_popup_options()* make_floating_popup_options({width}, {height}, {opts}) diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index eeba356672..dd849e5247 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -1,7 +1,8 @@ ---@meta - -- luacheck: no unused args +error('Cannot require a meta file') + ---@defgroup vim.builtin --- ---@brief
help
@@ -62,6 +63,12 @@
 ---
 ---
+---@class vim.NIL + +---@type vim.NIL +---@nodoc +vim.NIL = ... + --- Returns true if the code is executing as part of a "fast" event handler, --- where most of the API is disabled. These are low-level events (e.g. --- |lua-loop-callbacks|) which can be invoked whenever Nvim polls for input. diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index ca87fb9d15..958b4a7ccd 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -427,7 +427,7 @@ vim.v.msgpack_types = ... --- In some places `v:null` can be used for a List, Dict, etc. --- that is not set. That is slightly different than an empty --- List, Dict, etc. ---- @type any +--- @type vim.NIL vim.v.null = ... --- Maximum value of a number. diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index a2cc81781a..50890e37ce 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -2139,7 +2139,7 @@ end --- ---@param settings table language server settings ---@param section string indicating the field of the settings table ----@return table|string The value of settings accessed via section +---@return table|string|vim.NIL The value of settings accessed via section. `vim.NIL` if not found. function M.lookup_section(settings, section) for part in vim.gsplit(section, '.', { plain = true }) do settings = settings[part] -- cgit From fa836cb98b54dd170db485529cbeddb43c307ee1 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Sat, 6 Jan 2024 08:59:50 -0500 Subject: docs(vvars): fix wrong lua types in vim.v variables - cmdarg: string[] -> string - shell_error: string -> int - stderr: string -> int - Add types for: cmdbang, errors, exception, false, true --- runtime/lua/vim/_meta/vvars.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index 958b4a7ccd..ee6d8ddf35 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -34,14 +34,14 @@ vim.v.charconvert_to = ... --- leading space to make it possible to append this variable --- directly after the read/write command. Note: "+cmd" isn't --- included here, because it will be executed anyway. ---- @type string[] +--- @type string vim.v.cmdarg = ... --- Set like v:cmdarg for a file read/write command. When a "!" --- was used the value is 1, otherwise it is 0. Note that this --- can only be used in autocommands. For user commands `` --- can be used. ---- @type any +--- @type integer vim.v.cmdbang = ... --- The current locale setting for collation order of the runtime @@ -141,7 +141,7 @@ vim.v.errmsg = ... --- --- If v:errors is set to anything but a list it is made an empty --- list by the assert function. ---- @type any +--- @type string[] vim.v.errors = ... --- Dictionary of event data for the current `autocommand`. Valid @@ -210,7 +210,7 @@ vim.v.event = ... --- ``` --- --- Output: "caught oops". ---- @type any +--- @type string vim.v.exception = ... --- Exit code, or `v:null` before invoking the `VimLeavePre` @@ -228,7 +228,7 @@ vim.v.exiting = ... --- as a String (e.g. in `expr5` with string concatenation --- operator) and to zero when used as a Number (e.g. in `expr5` --- or `expr7` when used with numeric operators). Read-only. ---- @type any +--- @type boolean vim.v['false'] = ... --- What should happen after a `FileChangedShell` event was @@ -608,7 +608,7 @@ vim.v.servername = ... --- echo 'could not rename "foo" to "bar"!' --- endif --- ``` ---- @type string +--- @type integer vim.v.shell_error = ... --- Last given status message. @@ -624,7 +624,7 @@ vim.v.statusmsg = ... --- ```vim --- :call chansend(v:stderr, "error: toaster empty\n") --- ``` ---- @type string +--- @type integer vim.v.stderr = ... --- `SwapExists` autocommands can set this to the selected choice @@ -733,7 +733,7 @@ vim.v.throwpoint = ... --- as a String (e.g. in `expr5` with string concatenation --- operator) and to one when used as a Number (e.g. in `expr5` or --- `expr7` when used with numeric operators). Read-only. ---- @type any +--- @type boolean vim.v['true'] = ... --- Value of the current item of a `List` or `Dictionary`. Only -- cgit From 7ed69660237bd052d11af454503a986c22c507a7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 15 Jan 2024 11:12:32 +0100 Subject: vim-patch:93197fde0f1d runtime(ftplugin): Use "*" browsefilter pattern to match "All Files" Problem: The "*.*" browsefilter pattern only matches all files on Windows (Daryl Lee) Solution: Use "*" to filter on all platforms but keep "*.*" as the label text on Windows. (Fixes vim/vim#12685, Doug Kearns) The *.* browsefilter pattern used to match "All Files" on Windows is a legacy of the DOS 8.3 filename wildcard matching algorithm. For reasons of backward compatibility this still works on Windows to match all files, even those without an extension. However, this pattern only matches filenames containing a dot on other platforms. This often makes files without an extension difficult to access from the file dialog, e.g., "Makefile" On Windows it is still standard practice to use "*.*" for the filter label so ftplugins should use "All Files (*.*)" on Windows and "All Files (*)" on other platforms. This matches Vim's default browsefilter values. This commit also normalises the browsefilter conditional test to check for the Win32 and GTK GUI features and an unset b:browsefilter. closes: vim/vim#12759 https://github.com/vim/vim/commit/93197fde0f1db09b1e495cf3eb14a8f42c318b80 Co-authored-by: Doug Kearns --- runtime/doc/editing.txt | 5 +++-- runtime/ftplugin/aap.vim | 9 +++++++-- runtime/ftplugin/abap.vim | 15 ++++++++++----- runtime/ftplugin/abaqus.vim | 9 +++++++-- runtime/ftplugin/ant.vim | 15 ++++++++++----- runtime/ftplugin/aspvbs.vim | 15 ++++++++++----- runtime/ftplugin/awk.vim | 14 +++++++++----- runtime/ftplugin/basic.vim | 10 +++++++--- runtime/ftplugin/c.vim | 32 +++++++++++++++++--------------- runtime/ftplugin/clojure.vim | 9 +++++++-- runtime/ftplugin/cobol.vim | 9 +++++++-- runtime/ftplugin/config.vim | 15 ++++++++++----- runtime/ftplugin/cs.vim | 11 ++++++++--- runtime/ftplugin/csh.vim | 10 +++++++--- runtime/ftplugin/diff.vim | 9 +++++++-- runtime/ftplugin/dosbatch.vim | 12 +++++++++--- runtime/ftplugin/dtd.vim | 15 ++++++++++----- runtime/ftplugin/eiffel.vim | 10 +++++++--- runtime/ftplugin/eruby.vim | 11 ++++++++--- runtime/ftplugin/expect.vim | 10 +++++++--- runtime/ftplugin/falcon.vim | 13 +++++++++---- runtime/ftplugin/forth.vim | 9 +++++++-- runtime/ftplugin/fortran.vim | 10 ++++++++-- runtime/ftplugin/fpcmake.vim | 12 ++++++++---- runtime/ftplugin/freebasic.vim | 10 +++++++--- runtime/ftplugin/haml.vim | 15 ++++++++++----- runtime/ftplugin/html.vim | 12 ++++++++---- runtime/ftplugin/icon.vim | 16 ++++++++++------ runtime/ftplugin/ishd.vim | 10 +++++++--- runtime/ftplugin/j.vim | 7 ++++++- runtime/ftplugin/java.vim | 15 ++++++++++----- runtime/ftplugin/javascript.vim | 8 ++++++-- runtime/ftplugin/json5.vim | 10 +++++++--- runtime/ftplugin/jsp.vim | 15 ++++++++++----- runtime/ftplugin/kotlin.vim | 10 +++++++--- runtime/ftplugin/kwt.vim | 15 ++++++++++----- runtime/ftplugin/lua.vim | 10 +++++++--- runtime/ftplugin/lynx.vim | 10 +++++++--- runtime/ftplugin/m3build.vim | 10 +++++++--- runtime/ftplugin/m3quake.vim | 10 +++++++--- runtime/ftplugin/meson.vim | 9 +++++++-- runtime/ftplugin/modula2.vim | 10 +++++++--- runtime/ftplugin/modula3.vim | 10 +++++++--- runtime/ftplugin/msmessages.vim | 13 +++++++++---- runtime/ftplugin/occam.vim | 17 +++++++++++------ runtime/ftplugin/octave.vim | 10 +++++++--- runtime/ftplugin/pascal.vim | 10 +++++++--- runtime/ftplugin/perl.vim | 9 +++++++-- runtime/ftplugin/php.vim | 10 +++++++--- runtime/ftplugin/pod.vim | 10 ++++++++-- runtime/ftplugin/poke.vim | 16 ++++++++++------ runtime/ftplugin/postscr.vim | 15 ++++++++++----- runtime/ftplugin/ps1.vim | 13 +++++++++---- runtime/ftplugin/ps1xml.vim | 13 +++++++++---- runtime/ftplugin/pyrex.vim | 13 +++++++++---- runtime/ftplugin/python.vim | 9 +++++++-- runtime/ftplugin/qml.vim | 12 +++++++++--- runtime/ftplugin/r.vim | 9 +++++++-- runtime/ftplugin/racket.vim | 9 +++++++-- runtime/ftplugin/readline.vim | 10 +++++++--- runtime/ftplugin/registry.vim | 15 ++++++++++----- runtime/ftplugin/rhelp.vim | 9 +++++++-- runtime/ftplugin/rmd.vim | 9 +++++++-- runtime/ftplugin/rnoweb.vim | 9 +++++++-- runtime/ftplugin/routeros.vim | 9 +++++++-- runtime/ftplugin/rrst.vim | 9 +++++++-- runtime/ftplugin/ruby.vim | 9 +++++++-- runtime/ftplugin/sed.vim | 10 +++++++--- runtime/ftplugin/sgml.vim | 15 ++++++++++----- runtime/ftplugin/sh.vim | 14 +++++++++----- runtime/ftplugin/solution.vim | 10 +++++++--- runtime/ftplugin/sql.vim | 13 +++++++++---- runtime/ftplugin/svg.vim | 15 ++++++++++----- runtime/ftplugin/tcl.vim | 13 +++++++++---- runtime/ftplugin/tcsh.vim | 10 +++++++--- runtime/ftplugin/tidy.vim | 16 ++++++++++------ runtime/ftplugin/typescript.vim | 15 ++++++++++----- runtime/ftplugin/vb.vim | 10 +++++++--- runtime/ftplugin/verilog.vim | 13 +++++++++---- runtime/ftplugin/vhdl.vim | 14 ++++++++------ runtime/ftplugin/wget.vim | 10 +++++++--- runtime/ftplugin/wget2.vim | 10 +++++++--- runtime/ftplugin/xhtml.vim | 15 ++++++++++----- runtime/ftplugin/xml.vim | 9 +++++++-- runtime/ftplugin/xsd.vim | 15 ++++++++++----- runtime/ftplugin/xslt.vim | 2 +- 86 files changed, 692 insertions(+), 305 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 7df2eb9742..1a4572e94a 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1291,8 +1291,9 @@ b:browsefilter variable. You would most likely set b:browsefilter in a filetype plugin, so that the browse dialog would contain entries related to the type of file you are currently editing. Disadvantage: This makes it difficult to start editing a file of a different type. To overcome this, you -may want to add "All Files\t*.*\n" as the final filter, so that the user can -still access any desired file. +may want to add "All Files (*.*)\t*\n" as the final filter on Windows or "All +Files (*)\t*\n" on other platforms, so that the user can still access any +desired file. To avoid setting browsefilter when Vim does not actually support it, you can use has("browsefilter"): > diff --git a/runtime/ftplugin/aap.vim b/runtime/ftplugin/aap.vim index df839c99ae..cd7e2a425e 100644 --- a/runtime/ftplugin/aap.vim +++ b/runtime/ftplugin/aap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Aap recipe " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2024 Jan 14 " Former Maintainer: Bram Moolenaar " Only do this when not done yet for this buffer @@ -28,6 +28,11 @@ setlocal commentstring=#\ %s setlocal expandtab if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Aap Recipe Files (*.aap)\t*.aap\nAll Files (*.*)\t*.*\n" + let b:browsefilter = "Aap Recipe Files (*.aap)\t*.aap\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/abap.vim b/runtime/ftplugin/abap.vim index 61db8093fb..8b2040e5aa 100644 --- a/runtime/ftplugin/abap.vim +++ b/runtime/ftplugin/abap.vim @@ -3,7 +3,8 @@ " Author: Steven Oliver " Copyright: Copyright (c) 2013 Steven Oliver " License: You may redistribute this under the same terms as Vim itself -" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin) +" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin) +" 2024 Jan 14 by Vim Project (browsefilter) " -------------------------------------------------------------------------- " Only do this when not done yet for this buffer @@ -21,10 +22,14 @@ setlocal suffixesadd=.abap let b:undo_ftplugin = "setl sts< sua< sw<" " Windows allows you to filter the open file dialog -if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "ABAP Source Files (*.abap)\t*.abap\n" . - \ "All Files (*.*)\t*.*\n" - let b:undo_ftplugin .= " | unlet! b:browsefilter" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "ABAP Source Files (*.abap)\t*.abap\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif + let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim index 5931cd921d..c16e7b032e 100644 --- a/runtime/ftplugin/abaqus.vim +++ b/runtime/ftplugin/abaqus.vim @@ -2,6 +2,7 @@ " Language: Abaqus finite element input file (www.abaqus.com) " Maintainer: Carl Osterwisch " Last Change: 2022 Oct 08 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") | finish | endif @@ -49,8 +50,12 @@ endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . \ "Abaqus Results (*.dat)\t*.dat\n" . - \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . - \ "All Files (*.*)\t*.*\n" + \ "Abaqus Messages (*.pre, *.msg, *.sta)\t*.pre;*.msg;*.sta\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif let b:undo_ftplugin .= "|unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim index aee07ca4b9..65e01a1a76 100644 --- a/runtime/ftplugin/ant.vim +++ b/runtime/ftplugin/ant.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: ant +" Language: ant " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "XML Files (*.xml)\t*.xml\n" . - \ "All Files (*.*)\t*.*\n" +let s:browsefilter = "XML Files (*.xml)\t*.xml\n" +if has("win32") + let s:browsefilter .= "All Files (*.*)\t*\n" +else + let s:browsefilter .= "All Files (*)\t*\n" +endif runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim let b:did_ftplugin = 1 @@ -30,7 +35,7 @@ if exists("b:browsefilter") endif " Change the :browse e filter to primarily show Ant-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Build Files (build.xml)\tbuild.xml\n" . \ "Java Files (*.java)\t*.java\n" . \ "Properties Files (*.prop*)\t*.prop*\n" . diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim index 70a130d287..6979bb8f84 100644 --- a/runtime/ftplugin/aspvbs.vim +++ b/runtime/ftplugin/aspvbs.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: aspvbs +" Language: aspvbs " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n" . - \ "All Files (*.*)\t*.*\n" +let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n" +if has("win32") + let s:browsefilter .= "All Files (*.*)\t*\n" +else + let s:browsefilter .= "All Files (*)\t*\n" +endif let s:match_words = "" runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -51,7 +56,7 @@ if exists("loaded_matchit") endif " Change the :browse e filter to primarily show ASP-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="ASP Files (*.asp)\t*.asp\n" . s:browsefilter endif diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim index 40fe304cf4..bcd772350a 100644 --- a/runtime/ftplugin/awk.vim +++ b/runtime/ftplugin/awk.vim @@ -2,7 +2,7 @@ " Language: awk, nawk, gawk, mawk " Maintainer: Doug Kearns " Previous Maintainer: Antonio Colombo -" Last Change: 2020 Sep 28 +" Last Change: 2024 Jan 14 " This plugin was prepared by Mark Sikora " This plugin was updated as proposed by Doug Kearns @@ -25,8 +25,7 @@ setlocal formatoptions-=t formatoptions+=croql setlocal define=function setlocal suffixesadd+=.awk -let b:undo_ftplugin = "setl fo< com< cms< def< sua<" . - \ " | unlet! b:browsefilter" +let b:undo_ftplugin = "setl fo< com< cms< def< sua<" " TODO: set this in scripts.vim? if exists("g:awk_is_gawk") @@ -49,8 +48,13 @@ if exists("g:awk_is_gawk") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Awk Source Files (*.awk,*.gawk)\t*.awk;*.gawk\n" . - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "Awk Source Files (*.awk, *.gawk)\t*.awk;*.gawk\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif + let b:undo_ftplugin .= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim index 4399fbf3ad..32f713b43e 100644 --- a/runtime/ftplugin/basic.vim +++ b/runtime/ftplugin/basic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: BASIC (QuickBASIC 4.5) " Maintainer: Doug Kearns -" Last Change: 2022 Jun 22 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -45,8 +45,12 @@ endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" .. - \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" .. - \ "All Files (*.*)\t*.*\n" + \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif let b:basic_set_browsefilter = 1 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter" endif diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 83fb9ead68..716b454675 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2023 Aug 22 " Former Maintainer: Bram Moolenaar " Only do this when not done yet for this buffer @@ -43,24 +43,26 @@ if !exists("b:match_words") let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words" endif -" Win32 can filter files in the browse dialog +" Win32 and GTK can filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") if &ft == "cpp" - let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . - \ "C Header Files (*.h)\t*.h\n" . - \ "C Source Files (*.c)\t*.c\n" . - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" .. + \ "C Header Files (*.h)\t*.h\n" .. + \ "C Source Files (*.c)\t*.c\n" elseif &ft == "ch" - let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . - \ "C Header Files (*.h)\t*.h\n" . - \ "C Source Files (*.c)\t*.c\n" . - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. + \ "C Header Files (*.h)\t*.h\n" .. + \ "C Source Files (*.c)\t*.c\n" else - let b:browsefilter = "C Source Files (*.c)\t*.c\n" . - \ "C Header Files (*.h)\t*.h\n" . - \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . - \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "C Source Files (*.c)\t*.c\n" .. + \ "C Header Files (*.h)\t*.h\n" .. + \ "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. + \ "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" + endif + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim index c922d75699..4da7554d85 100644 --- a/runtime/ftplugin/clojure.vim +++ b/runtime/ftplugin/clojure.vim @@ -6,6 +6,7 @@ " URL: https://github.com/clojure-vim/clojure.vim " License: Vim (see :h license) " Last Change: 2022-03-24 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") finish @@ -66,10 +67,14 @@ endif " Filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "All Files\t*\n" . - \ "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" . + let b:browsefilter = "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" . \ "EDN Files\t*.edn\n" . \ "Java Files\t*.java\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim index ec1e95456d..5e52702fd5 100644 --- a/runtime/ftplugin/cobol.vim +++ b/runtime/ftplugin/cobol.vim @@ -3,6 +3,7 @@ " Maintainer: Ankit Jain " (formerly Tim Pope ) " Last Update: By Ankit Jain (add gtk support) on 15.08.2020 +" 2024 Jan 14 by Vim Project (browsefilter) " Insert mode mappings: " Normal mode mappings: < > << >> [[ ]] [] ][ @@ -39,8 +40,12 @@ endif " add gtk support if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "COBOL Source Files (*.cbl, *.cob)\t*.cbl;*.cob;*.lib\n". - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "COBOL Source Files (*.cbl, *.cob)\t*.cbl;*.cob;*.lib\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif endif let b:undo_ftplugin = "setlocal com< cms< fo< et< tw<" . diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim index 73136cbc66..595fc657b9 100644 --- a/runtime/ftplugin/config.vim +++ b/runtime/ftplugin/config.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: config +" Language: config " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "Bourne Shell Files (*.sh)\t*.sh\n" . - \ "All Files (*.*)\t*.*\n" +let s:browsefilter = "Bourne Shell Files (*.sh)\t*.sh\n" +if has("win32") + let s:browsefilter .= "All Files (*.*)\t*\n" +else + let s:browsefilter .= "All Files (*)\t*\n" +endif let s:match_words = "" runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim @@ -31,7 +36,7 @@ if exists("b:browsefilter") endif " Change the :browse e filter to primarily show configure-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="Configure Scripts (configure.*, config.*)\tconfigure*;config.*\n" . \ s:browsefilter endif diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim index 0734d11d22..ada71315e1 100644 --- a/runtime/ftplugin/cs.vim +++ b/runtime/ftplugin/cs.vim @@ -3,6 +3,7 @@ " Maintainer: Nick Jensen " Former Maintainer: Johannes Zellner " Last Change: 2022-11-16 +" 2024 Jan 14 by Vim Project (browsefilter) " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -31,10 +32,14 @@ if exists('loaded_matchit') && !exists('b:match_words') endif if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter') - let b:browsefilter = "C# Source Files (*.cs *.csx)\t*.cs;*.csx\n" . + let b:browsefilter = "C# Source Files (*.cs, *.csx)\t*.cs;*.csx\n" . \ "C# Project Files (*.csproj)\t*.csproj\n" . - \ "Visual Studio Solution Files (*.sln)\t*.sln\n" . - \ "All Files (*.*)\t*.*\n" + \ "Visual Studio Solution Files (*.sln)\t*.sln\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim index 2feec57bb2..a22bee3279 100644 --- a/runtime/ftplugin/csh.vim +++ b/runtime/ftplugin/csh.vim @@ -3,7 +3,7 @@ " Maintainer: Doug Kearns " Previous Maintainer: Dan Sharp " Contributor: Johannes Zellner -" Last Change: 2023 Oct 09 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -44,8 +44,12 @@ if exists("loaded_matchit") && !exists("b:match_words") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n" .. - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif let b:csh_set_browsefilter = 1 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:csh_set_browsefilter" endif diff --git a/runtime/ftplugin/diff.vim b/runtime/ftplugin/diff.vim index f2a0820be9..2daa48aeb4 100644 --- a/runtime/ftplugin/diff.vim +++ b/runtime/ftplugin/diff.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Diff " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2023 Aug 22 " Former Maintainer: Bram Moolenaar " Only do this when not done yet for this buffer @@ -19,6 +19,11 @@ setlocal nomodeline let &l:commentstring = "# %s" if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\nAll Files (*.*)\t*.*\n" + let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim index f02f26b1fd..5001cf68bd 100644 --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -2,6 +2,7 @@ " Language: MS-DOS/Windows .bat files " Maintainer: Mike Williams " Last Change: 12th February 2023 +" 2024 Jan 14 by Vim Project (browsefilter) " " Options Flags: " dosbatch_colons_comment - any value to treat :: as comment line @@ -37,12 +38,17 @@ if executable('help.exe') endif " Define patterns for the browse file filter -if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\nAll Files (*.*)\t*.*\n" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\n" + if has("win32") + let b:browsefilter ..= "All Files (*.*)\t*\n" + else + let b:browsefilter ..= "All Files (*)\t*\n" + endif endif let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<" - \ . "| unlet! b:browsefiler" + \ . "| unlet! b:browsefilter" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim index a046118c70..bea8c5c18a 100644 --- a/runtime/ftplugin/dtd.vim +++ b/runtime/ftplugin/dtd.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: dtd +" Language: dtd " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -27,10 +28,14 @@ if exists("loaded_matchit") endif " Change the :browse e filter to primarily show Java-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="DTD Files (*.dtd)\t*.dtd\n" . - \ "XML Files (*.xml)\t*.xml\n" . - \ "All Files (*.*)\t*.*\n" + \ "XML Files (*.xml)\t*.xml\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif endif " Undo the stuff we changed. diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim index 216fdde162..e193110cde 100644 --- a/runtime/ftplugin/eiffel.vim +++ b/runtime/ftplugin/eiffel.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Eiffel " Maintainer: Doug Kearns -" Last Change: 2010 Aug 29 +" Last Change: 2024 Jan 14 if (exists("b:did_ftplugin")) finish @@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" . - \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" . - \ "All Files (*.*)\t*.*\n" + \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" + if has("win32") + let b:browsefilter .= "All Files (*.*)\t*\n" + else + let b:browsefilter .= "All Files (*)\t*\n" + endif endif if exists("loaded_matchit") && !exists("b:match_words") diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index 893fa58d32..b5c4665d24 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -4,6 +4,7 @@ " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns " Last Change: 2022 May 15 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -15,7 +16,11 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "All Files (*.*)\t*.*\n" +if has("win32") + let s:browsefilter = "All Files (*.*)\t*\n" +else + let s:browsefilter = "All Files (*)\t*\n" +endif let s:match_words = "" if !exists("g:eruby_default_subtype") @@ -109,8 +114,8 @@ exe 'cmap " - \ ]) - endif - - " insert javascript to get IDs from line numbers, and to open a fold before - " jumping to any lines contained therein - if s:settings.line_ids - call append(style_start, [ - \ " /* Always jump to new location even if the line was hidden inside a fold, or", - \ " * we corrected the raw number to a line ID.", - \ " */", - \ " if (lineElem) {", - \ " lineElem.scrollIntoView(true);", - \ " }", - \ " return true;", - \ "}", - \ "if ('onhashchange' in window) {", - \ " window.onhashchange = JumpToLine;", - \ "}" - \ ]) - - if s:settings.dynamic_folds - call append(style_start, [ - \ "", - \ " /* navigate upwards in the DOM tree to open all folds containing the line */", - \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement"..s:settings.id_suffix.."')", - \ " {", - \ " if (node.className == 'closed-fold')", - \ " {", - \ " /* toggle open the fold ID (remove window ID) */", - \ " toggleFold(node.id.substr(4));", - \ " }", - \ " node = node.parentNode;", - \ " }", - \ ]) - endif - endif - - if s:settings.line_ids - call append(style_start, [ - \ "", - \ "/* function to open any folds containing a jumped-to line before jumping to it */", - \ "function JumpToLine()", - \ "{", - \ " var lineNum;", - \ " lineNum = window.location.hash;", - \ " lineNum = lineNum.substr(1); /* strip off '#' */", - \ "", - \ " if (lineNum.indexOf('L') == -1) {", - \ " lineNum = 'L'+lineNum;", - \ " }", - \ " if (lineNum.indexOf('W') == -1) {", - \ " lineNum = 'W1'+lineNum;", - \ " }", - \ " var lineElem = document.getElementById(lineNum);" - \ ]) - endif - - " Insert javascript to toggle matching folds open and closed in all windows, - " if dynamic folding is active. - if s:settings.dynamic_folds - call append(style_start, [ - \ " function toggleFold(objID)", - \ " {", - \ " for (win_num = 1; win_num <= "..len(a:buf_list).."; win_num++)", - \ " {", - \ " var fold;", - \ ' fold = document.getElementById("win"+win_num+objID);', - \ " if(fold.className == 'closed-fold')", - \ " {", - \ " fold.className = 'open-fold';", - \ " }", - \ " else if (fold.className == 'open-fold')", - \ " {", - \ " fold.className = 'closed-fold';", - \ " }", - \ " }", - \ " }", - \ ]) - endif - - if s:uses_script - " insert script tag if needed - call append(style_start, [ - \ "", - \ s:settings.use_xhtml ? '//']+ - \ style+ - \ [ s:settings.use_xhtml ? '' : '', - \ '' - \]) - endif "}}} - endif - endif - - let &paste = s:old_paste - let &magic = s:old_magic -endfunc "}}} - -" Gets a single user option and sets it in the passed-in Dict, or gives it the -" default value if the option doesn't actually exist. -func! tohtml#GetOption(settings, option, default) "{{{ - if exists('g:html_'..a:option) - let a:settings[a:option] = g:html_{a:option} - else - let a:settings[a:option] = a:default - endif -endfunc "}}} - -" returns a Dict containing the values of all user options for 2html, including -" default values for those not given an explicit value by the user. Discards the -" html_ prefix of the option for nicer looking code. -func! tohtml#GetUserSettings() "{{{ - if exists('s:settings') - " just restore the known options if we've already retrieved them - return s:settings - else - " otherwise figure out which options are set - let user_settings = {} - - " Define the correct option if the old option name exists and we haven't - " already defined the correct one. - if exists('g:use_xhtml') && !exists("g:html_use_xhtml") - echohl WarningMsg - echomsg "Warning: g:use_xhtml is deprecated, use g:html_use_xhtml" - echohl None - let g:html_use_xhtml = g:use_xhtml - endif - - " get current option settings with appropriate defaults {{{ - call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") ) - call tohtml#GetOption(user_settings, 'diff_one_file', 0 ) - call tohtml#GetOption(user_settings, 'number_lines', &number ) - call tohtml#GetOption(user_settings, 'pre_wrap', &wrap ) - call tohtml#GetOption(user_settings, 'use_css', 1 ) - call tohtml#GetOption(user_settings, 'ignore_conceal', 0 ) - call tohtml#GetOption(user_settings, 'ignore_folding', 0 ) - call tohtml#GetOption(user_settings, 'dynamic_folds', 0 ) - call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding) - call tohtml#GetOption(user_settings, 'hover_unfold', 0 ) - call tohtml#GetOption(user_settings, 'no_pre', 0 ) - call tohtml#GetOption(user_settings, 'no_doc', 0 ) - call tohtml#GetOption(user_settings, 'no_links', 0 ) - call tohtml#GetOption(user_settings, 'no_modeline', 0 ) - call tohtml#GetOption(user_settings, 'no_invalid', 0 ) - call tohtml#GetOption(user_settings, 'whole_filler', 0 ) - call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) - call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines ) - call tohtml#GetOption(user_settings, 'use_input_for_pc', 'none') - " }}} - - " override those settings that need it {{{ - - " hover opening implies dynamic folding - if user_settings.hover_unfold - let user_settings.dynamic_folds = 1 - endif - - " ignore folding overrides dynamic folding - if user_settings.ignore_folding && user_settings.dynamic_folds - let user_settings.dynamic_folds = 0 - let user_settings.hover_unfold = 0 - endif - - " dynamic folding with no foldcolumn implies hover opens - if user_settings.dynamic_folds && user_settings.no_foldcolumn - let user_settings.hover_unfold = 1 - endif - - " dynamic folding implies css - if user_settings.dynamic_folds - let user_settings.use_css = 1 - else - let user_settings.no_foldcolumn = 1 " won't do anything but for consistency and for the test suite - endif - - " if we're not using CSS we cannot use a pre section because tags - " aren't allowed inside a
 block
-    if !user_settings.use_css
-      let user_settings.no_pre = 1
-    endif
-
-    " pre_wrap doesn't do anything if not using pre or not using CSS
-    if user_settings.no_pre || !user_settings.use_css
-      let user_settings.pre_wrap = 0
-    endif
-    "}}}
-
-    " set up expand_tabs option after all the overrides so we know the
-    " appropriate defaults {{{
-    if user_settings.no_pre == 0
-      call tohtml#GetOption(user_settings,
-	    \ 'expand_tabs',
-	    \ &expandtab || &ts != 8 || (exists("+vts") && &vts != '') || user_settings.number_lines ||
-	    \   (user_settings.dynamic_folds && !user_settings.no_foldcolumn))
-    else
-      let user_settings.expand_tabs = 1
-    endif
-    " }}}
-
-    " textual options
-    if exists("g:html_use_encoding") "{{{
-      " user specified the desired MIME charset, figure out proper
-      " 'fileencoding' from it or warn the user if we cannot
-      let user_settings.encoding = g:html_use_encoding
-      let user_settings.vim_encoding = tohtml#EncodingFromCharset(g:html_use_encoding)
-      if user_settings.vim_encoding == ''
-	echohl WarningMsg
-	echomsg "TOhtml: file encoding for"
-	      \ g:html_use_encoding
-	      \ "unknown, please set 'fileencoding'"
-	echohl None
-      endif
-    else
-      " Figure out proper MIME charset from 'fileencoding' if possible
-      if &l:fileencoding != '' 
-	" If the buffer is not a "normal" type, the 'fileencoding' value may not
-	" be trusted; since the buffer should not be written the fileencoding is
-	" not intended to be used.
-	if &l:buftype=='' || &l:buftype==?'help'
-	  let user_settings.vim_encoding = &l:fileencoding
-	  call tohtml#CharsetFromEncoding(user_settings)
-	else
-	  let user_settings.encoding = '' " trigger detection using &encoding
-	endif
-      endif
-
-      " else from 'encoding' if possible
-      if &l:fileencoding == '' || user_settings.encoding == ''
-	let user_settings.vim_encoding = &encoding
-	call tohtml#CharsetFromEncoding(user_settings)
-      endif
-
-      " else default to UTF-8 and warn user
-      if user_settings.encoding == ''
-	let user_settings.vim_encoding = 'utf-8'
-	let user_settings.encoding = 'UTF-8'
-	echohl WarningMsg
-	echomsg "TOhtml: couldn't determine MIME charset, using UTF-8"
-	echohl None
-      endif
-    endif "}}}
-
-    " Default to making nothing uncopyable, because we default to
-    " not-standards way of doing things, and also because Microsoft Word and
-    " others paste the  elements anyway.
-    "
-    " html_prevent_copy only has an effect when using CSS.
-    "
-    " All options:
-    "	  f - fold column
-    "	  n - line numbers (also within fold text)
-    "	  t - fold text
-    "	  d - diff filler
-    "	  c - concealed text (reserved future)
-    "	  l - listchars (reserved possible future)
-    "	  s - signs (reserved possible future)
-    "
-    " Normal text is always selectable.
-    let user_settings.prevent_copy = ""
-    if user_settings.use_css
-      if exists("g:html_prevent_copy")
-	if user_settings.dynamic_folds && !user_settings.no_foldcolumn && g:html_prevent_copy =~# 'f'
-	  let user_settings.prevent_copy ..= 'f'
-	endif
-	if user_settings.number_lines && g:html_prevent_copy =~# 'n'
-	  let user_settings.prevent_copy ..= 'n'
-	endif
-	if &diff && g:html_prevent_copy =~# 'd'
-	  let user_settings.prevent_copy ..= 'd'
-	endif
-	if !user_settings.ignore_folding && g:html_prevent_copy =~# 't'
-	  let user_settings.prevent_copy ..= 't'
-	endif
-      else
-	let user_settings.prevent_copy = ""
-      endif
-    endif
-    if empty(user_settings.prevent_copy)
-      let user_settings.no_invalid = 0
-    endif
-
-    " enforce valid values for use_input_for_pc
-    if user_settings.use_input_for_pc !~# 'fallback\|none\|all'
-      let user_settings.use_input_for_pc = 'none'
-      echohl WarningMsg
-      echomsg '2html: "' .. g:html_use_input_for_pc .. '" is not valid for g:html_use_input_for_pc'
-      echomsg '2html: defaulting to "' .. user_settings.use_input_for_pc .. '"'
-      echohl None
-      sleep 3
-    endif
-
-    if exists('g:html_id_expr')
-      let user_settings.id_suffix = eval(g:html_id_expr)
-      if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$'
-	echohl WarningMsg
-	echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes'
-	echomsg '2html: Omitting user-specified suffix'
-	echohl None
-	sleep 3
-	let user_settings.id_suffix=""
-      endif
-    else
-      let user_settings.id_suffix=""
-    endif
-
-    " TODO: font
-
-    return user_settings
-  endif
-endfunc "}}}
-
-" get the proper HTML charset name from a Vim encoding option.
-function! tohtml#CharsetFromEncoding(settings) "{{{
-  let l:vim_encoding = a:settings.vim_encoding
-  if exists('g:html_charset_override') && has_key(g:html_charset_override, l:vim_encoding)
-    let a:settings.encoding = g:html_charset_override[l:vim_encoding]
-  else
-    if l:vim_encoding =~ '^8bit\|^2byte'
-      " 8bit- and 2byte- prefixes are to indicate encodings available on the
-      " system that Vim will convert with iconv(), look up just the encoding name,
-      " not Vim's prefix.
-      let l:vim_encoding = substitute(l:vim_encoding, '^8bit-\|^2byte-', '', '')
-    endif
-    if has_key(g:tohtml#encoding_to_charset, l:vim_encoding)
-      let a:settings.encoding = g:tohtml#encoding_to_charset[l:vim_encoding]
-    else
-      let a:settings.encoding = ""
-    endif
-  endif
-  if a:settings.encoding != ""
-    let l:vim_encoding = tohtml#EncodingFromCharset(a:settings.encoding)
-    if l:vim_encoding != ""
-      " if the Vim encoding to HTML encoding conversion is set up (by default or
-      " by the user) to convert to a different encoding, we need to also change
-      " the Vim encoding of the new buffer
-      let a:settings.vim_encoding = l:vim_encoding
-    endif
-  endif
-endfun "}}}
-
-" Get the proper Vim encoding option setting from an HTML charset name.
-function! tohtml#EncodingFromCharset(encoding) "{{{
-  if exists('g:html_encoding_override') && has_key(g:html_encoding_override, a:encoding)
-    return g:html_encoding_override[a:encoding]
-  elseif has_key(g:tohtml#charset_to_encoding, tolower(a:encoding))
-    return g:tohtml#charset_to_encoding[tolower(a:encoding)]
-  else
-    return ""
-  endif
-endfun "}}}
-
-let &cpo = s:cpo_sav
-unlet s:cpo_sav
-
-" Make sure any patches will probably use consistent indent
-"   vim: ts=8 sw=2 sts=2 noet fdm=marker
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 2b269f7d9c..5f6f6fb149 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -4363,4 +4363,35 @@ vim.text.hexencode({str})                               *vim.text.hexencode()*
         (`string`) Hex encoded string
 
 
+==============================================================================
+Lua module: tohtml                                                *vim.tohtml*
+
+
+:TOhtml {file}                                                       *:TOhtml*
+Converts the buffer shown in the current window to HTML, opens the generated
+HTML in a new split window, and saves its contents to {file}. If {file} is not
+given, a temporary file (created by |tempname()|) is used.
+
+
+tohtml.tohtml({winid}, {opt})                         *tohtml.tohtml.tohtml()*
+    Converts the buffer shown in the window {winid} to HTML and returns the
+    output as a list of string.
+
+    Parameters: ~
+      • {winid}  (`integer?`) Window to convert (defaults to current window)
+      • {opt}    (`table?`) Optional parameters.
+                 • title (string): Title tag to set in the generated HTML code
+                   (defaults to buffer name)
+                 • number_lines (boolean): Show line numbers (defaults to
+                   `false`)
+                 • font (string|string[]): Fonts to use (defaults to
+                   `guifont`)
+                 • width (integer) Width used for items which are either right
+                   aligned or repeat a character infinitely (defaults to
+                   'textwidth' if non-zero or window width otherwise)
+
+    Return: ~
+        (`string[]`)
+
+
  vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 6895254a42..50beb79adf 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -134,6 +134,9 @@ The following changes may require adaptations in user config or plugins.
   If necessary, the respective capability can be
   removed when calling |vim.lsp.protocol.make_client_capabilities()|.
 
+• |:TOhtml| has been rewritten in Lua to support Neovim-specific decorations,
+  and many options have been removed.
+
 ==============================================================================
 BREAKING CHANGES IN HEAD                                    *news-breaking-dev*
 
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 0e7c38b38d..c02752a2b7 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -341,443 +341,11 @@ Upon loading a file, Vim finds the relevant syntax file as follows:
 	syntax.
 
 ==============================================================================
-4. Conversion to HTML				*2html.vim* *convert-to-HTML*
+4. Conversion to HTML				*convert-to-HTML* *2html.vim*
 
-2html is not a syntax file itself, but a script that converts the current
-window into HTML. Vim opens a new window in which it builds the HTML file.
+The old to html converter has ben replaced by a Lua version and the
+documentation has been moved to |:TOhtml|.
 
-After you save the resulting file, you can view it with any browser. The
-colors should be exactly the same as you see them in Vim.  With
-|g:html_line_ids| you can jump to specific lines by adding (for example) #L123
-or #123 to the end of the URL in your browser's address bar. And with
-|g:html_dynamic_folds| enabled, you can show or hide the text that is folded
-in Vim.
-
-You are not supposed to set the 'filetype' or 'syntax' option to "2html"!
-Source the script to convert the current file: >
-
-	:runtime! syntax/2html.vim
-<
-Many variables affect the output of 2html.vim; see below. Any of the on/off
-options listed below can be enabled or disabled by setting them explicitly to
-the desired value, or restored to their default by removing the variable using
-|:unlet|.
-
-Remarks:
-- Some truly ancient browsers may not show the background colors.
-- From most browsers you can also print the file (in color)!
-
-Here is an example how to run the script over all .c and .h files from a
-Unix shell: >
-   for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done
-<
-					*g:html_start_line* *g:html_end_line*
-To restrict the conversion to a range of lines, use a range with the |:TOhtml|
-command below, or set "g:html_start_line" and "g:html_end_line" to the first
-and last line to be converted.  Example, using the last set Visual area: >
-
-	:let g:html_start_line = line("'<")
-	:let g:html_end_line = line("'>")
-	:runtime! syntax/2html.vim
-<
-							*:TOhtml*
-:[range]TOhtml		The ":TOhtml" command is defined in a standard plugin.
-			This command will source |2html.vim| for you. When a
-			range is given, this command sets |g:html_start_line|
-			and |g:html_end_line| to the start and end of the
-			range, respectively. Default range is the entire
-			buffer.
-
-			If the current window is part of a |diff|, unless
-			|g:html_diff_one_file| is set, :TOhtml will convert
-			all windows which are part of the diff in the current
-			tab and place them side-by-side in a  element
-			in the generated HTML. With |g:html_line_ids| you can
-			jump to lines in specific windows with (for example)
-			#W1L42 for line 42 in the first diffed window, or
-			#W3L87 for line 87 in the third.
-
-			Examples: >
-
-	:10,40TOhtml " convert lines 10-40 to html
-	:'<,'>TOhtml " convert current/last visual selection
-	:TOhtml      " convert entire buffer
-<
-							*g:html_diff_one_file*
-Default: 0.
-When 0, and using |:TOhtml| all windows involved in a |diff| in the current tab
-page are converted to HTML and placed side-by-side in a 
element. When -1, only the current buffer is converted. -Example: > - - let g:html_diff_one_file = 1 -< - *g:html_whole_filler* -Default: 0. -When 0, if |g:html_diff_one_file| is 1, a sequence of more than 3 filler lines -is displayed as three lines with the middle line mentioning the total number -of inserted lines. -When 1, always display all inserted lines as if |g:html_diff_one_file| were -not set. -> - :let g:html_whole_filler = 1 -< - *TOhtml-performance* *g:html_no_progress* -Default: 0. -When 0, display a progress bar in the statusline for each major step in the -2html.vim conversion process. -When 1, do not display the progress bar. This offers a minor speed improvement -but you won't have any idea how much longer the conversion might take; for big -files it can take a long time! -Example: > - - let g:html_no_progress = 1 -< -You can obtain better performance improvements by also instructing Vim to not -run interactively, so that too much time is not taken to redraw as the script -moves through the buffer, switches windows, and the like: > - - vim -E -s -c "let g:html_no_progress=1" -c "syntax on" -c "set ft=c" -c "runtime syntax/2html.vim" -cwqa myfile.c -< -Note that the -s flag prevents loading your vimrc and any plugins, so you -need to explicitly source/enable anything that will affect the HTML -conversion. See |-E| and |-s-ex| for details. It is probably best to create a -script to replace all the -c commands and use it with the -u flag instead of -specifying each command separately. - - *hl-TOhtmlProgress* *TOhtml-progress-color* -When displayed, the progress bar will show colored boxes along the statusline -as the HTML conversion proceeds. By default, the background color as the -current "DiffDelete" highlight group is used. If "DiffDelete" and "StatusLine" -have the same background color, TOhtml will automatically adjust the color to -differ. If you do not like the automatically selected colors, you can define -your own highlight colors for the progress bar. Example: > - - hi TOhtmlProgress guifg=#c0ffee ctermbg=7 -< - *g:html_number_lines* -Default: Current 'number' setting. -When 0, buffer text is displayed in the generated HTML without line numbering. -When 1, a column of line numbers is added to the generated HTML with the same -highlighting as the line number column in Vim (|hl-LineNr|). -Force line numbers even if 'number' is not set: > - :let g:html_number_lines = 1 -Force to omit the line numbers: > - :let g:html_number_lines = 0 -Go back to the default to use 'number' by deleting the variable: > - :unlet g:html_number_lines -< - *g:html_line_ids* -Default: 1 if |g:html_number_lines| is set, 0 otherwise. -When 1, adds an HTML id attribute to each line number, or to an empty -inserted for that purpose if no line numbers are shown. This ID attribute -takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view -pages, and is used to jump to a specific line (in a specific window of a diff -view). Javascript is inserted to open any closed dynamic folds -(|g:html_dynamic_folds|) containing the specified line before jumping. The -javascript also allows omitting the window ID in the url, and the leading L. -For example: > - - page.html#L123 jumps to line 123 in a single-buffer file - page.html#123 does the same - - diff.html#W1L42 jumps to line 42 in the first window in a diff - diff.html#42 does the same -< - *g:html_use_css* -Default: 1. -When 1, generate valid HTML 5 markup with CSS styling, supported in all modern -browsers and many old browsers. -When 0, generate tags and similar outdated markup. This is not -recommended but it may work better in really old browsers, email clients, -forum posts, and similar situations where basic CSS support is unavailable. -Example: > - :let g:html_use_css = 0 -< - *g:html_ignore_conceal* -Default: 0. -When 0, concealed text is removed from the HTML and replaced with a character -from |:syn-cchar| or 'listchars' as appropriate, depending on the current -value of 'conceallevel'. -When 1, include all text from the buffer in the generated HTML, even if it is -|conceal|ed. - -Either of the following commands will ensure that all text in the buffer is -included in the generated HTML (unless it is folded): > - :let g:html_ignore_conceal = 1 - :setl conceallevel=0 -< - *g:html_ignore_folding* -Default: 0. -When 0, text in a closed fold is replaced by the text shown for the fold in -Vim (|fold-foldtext|). See |g:html_dynamic_folds| if you also want to allow -the user to expand the fold as in Vim to see the text inside. -When 1, include all text from the buffer in the generated HTML; whether the -text is in a fold has no impact at all. |g:html_dynamic_folds| has no effect. - -Either of these commands will ensure that all text in the buffer is included -in the generated HTML (unless it is concealed): > - zR - :let g:html_ignore_folding = 1 -< - *g:html_dynamic_folds* -Default: 0. -When 0, text in a closed fold is not included at all in the generated HTML. -When 1, generate javascript to open a fold and show the text within, just like -in Vim. - -Setting this variable to 1 causes 2html.vim to always use CSS for styling, -regardless of what |g:html_use_css| is set to. - -This variable is ignored when |g:html_ignore_folding| is set. -> - :let g:html_dynamic_folds = 1 -< - *g:html_no_foldcolumn* -Default: 0. -When 0, if |g:html_dynamic_folds| is 1, generate a column of text similar to -Vim's foldcolumn (|fold-foldcolumn|) the user can click on to toggle folds -open or closed. The minimum width of the generated text column is the current -'foldcolumn' setting. -When 1, do not generate this column; instead, hovering the mouse cursor over -folded text will open the fold as if |g:html_hover_unfold| were set. -> - :let g:html_no_foldcolumn = 1 -< - *TOhtml-uncopyable-text* *g:html_prevent_copy* -Default: Empty string. -This option prevents certain regions of the generated HTML from being copied, -when you select all text in document rendered in a browser and copy it. Useful -for allowing users to copy-paste only the source text even if a fold column or -line numbers are shown in the generated content. Specify regions to be -affected in this way as follows: - f: fold column - n: line numbers (also within fold text) - t: fold text - d: diff filler - -Example, to make the fold column and line numbers uncopyable: > - :let g:html_prevent_copy = "fn" -< -The method used to prevent copying in the generated page depends on the value -of |g:html_use_input_for_pc|. - - *g:html_use_input_for_pc* -Default: "none" -If |g:html_prevent_copy| is non-empty, then: - -When "all", read-only elements are used in place of normal text for -uncopyable regions. In some browsers, especially older browsers, after -selecting an entire page and copying the selection, the tags are not -pasted with the page text. If |g:html_no_invalid| is 0, the tags have -invalid type; this works in more browsers, but the page will not validate. -Note: This method does NOT work in recent versions of Chrome and equivalent -browsers; the tags get pasted with the text. - -When "fallback" (default value), the same elements are generated for -older browsers, but newer browsers (detected by CSS feature query) hide the - elements and instead use generated content in an ::before pseudoelement -to display the uncopyable text. This method should work with the largest -number of browsers, both old and new. - -When "none", the elements are not generated at all. Only the -generated-content method is used. This means that old browsers, notably -Internet Explorer, will either copy the text intended not to be copyable, or -the non-copyable text may not appear at all. However, this is the most -standards-based method, and there will be much less markup. - - *g:html_no_invalid* -Default: 0. -When 0, if |g:html_prevent_copy| is non-empty and |g:html_use_input_for_pc| is -not "none", an invalid attribute is intentionally inserted into the -element for the uncopyable areas. This prevents pasting the elements -in some applications. Specifically, some versions of Microsoft Word will not -paste the elements if they contain this invalid attribute. When 1, no -invalid markup is inserted, and the generated page should validate. However, - elements may be pasted into some applications and can be difficult to -remove afterward. - - *g:html_hover_unfold* -Default: 0. -When 0, the only way to open a fold generated by 2html.vim with -|g:html_dynamic_folds| set, is to click on the generated fold column. -When 1, use CSS 2.0 to allow the user to open a fold by moving the mouse -cursor over the displayed fold text. This is useful to allow users with -disabled javascript to view the folded text. - -Note that old browsers (notably Internet Explorer 6) will not support this -feature. Browser-specific markup for IE6 is included to fall back to the -normal CSS1 styling so that the folds show up correctly for this browser, but -they will not be openable without a foldcolumn. -> - :let g:html_hover_unfold = 1 -< - *g:html_id_expr* -Default: "" -Dynamic folding and jumping to line IDs rely on unique IDs within the document -to work. If generated HTML is copied into a larger document, these IDs are no -longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can -evaluate to get a unique string to append to each ID used in a given document, -so that the full IDs will be unique even when combined with other content in a -larger HTML document. Example, to append _ and the buffer number to each ID: > - - :let g:html_id_expr = '"_" .. bufnr("%")' -< -To append a string "_mystring" to the end of each ID: > - - :let g:html_id_expr = '"_mystring"' -< -Note: When converting a diff view to HTML, the expression will only be -evaluated for the first window in the diff, and the result used for all the -windows. - - *TOhtml-wrap-text* *g:html_pre_wrap* -Default: Current 'wrap' setting. -When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does -not wrap at the edge of the browser window. -When 1, if |g:html_use_css| is 1, the CSS 2.0 "white-space:pre-wrap" value is -used, causing the text to wrap at whitespace at the edge of the browser -window. -Explicitly enable text wrapping: > - :let g:html_pre_wrap = 1 -Explicitly disable wrapping: > - :let g:html_pre_wrap = 0 -Go back to default, determine wrapping from 'wrap' setting: > - :unlet g:html_pre_wrap -< - *g:html_no_pre* -Default: 0. -When 0, buffer text in the generated HTML is surrounded by
...
-tags. Series of whitespace is shown as in Vim without special markup, and tab -characters can be included literally (see |g:html_expand_tabs|). -When 1 (not recommended), the
 tags are omitted, and a plain 
is -used instead. Whitespace is replaced by a series of   character -references, and
is used to end each line. This is another way to allow -text in the generated HTML is wrap (see |g:html_pre_wrap|) which also works in -old browsers, but may cause noticeable differences between Vim's display and -the rendered page generated by 2html.vim. -> - :let g:html_no_pre = 1 -< - *g:html_no_doc* -Default: 0. -When 1 it doesn't generate a full HTML document with a DOCTYPE, , -, etc. If |g:html_use_css| is enabled (the default) you'll have to -define the CSS manually. The |g:html_dynamic_folds| and |g:html_line_ids| -settings (off by default) also insert some JavaScript. - - - *g:html_no_links* -Default: 0. -Don't generate tags for text that looks like an URL. - - *g:html_no_modeline* -Default: 0. -Don't generate a modeline disabling folding. - - *g:html_expand_tabs* -Default: 0 if 'tabstop' is 8, 'expandtab' is 0, 'vartabstop' is not in use, - and no fold column or line numbers occur in the generated HTML; - 1 otherwise. -When 1, characters in the buffer text are replaced with an appropriate -number of space characters, or   references if |g:html_no_pre| is 1. -When 0, if |g:html_no_pre| is 0 or unset, characters in the buffer text -are included as-is in the generated HTML. This is useful for when you want to -allow copy and paste from a browser without losing the actual whitespace in -the source document. Note that this can easily break text alignment and -indentation in the HTML, unless set by default. - -Force |2html.vim| to keep characters: > - :let g:html_expand_tabs = 0 -< -Force tabs to be expanded: > - :let g:html_expand_tabs = 1 -< - *TOhtml-encoding-detect* *TOhtml-encoding* -It is highly recommended to set your desired encoding with -|g:html_use_encoding| for any content which will be placed on a web server. - -If you do not specify an encoding, |2html.vim| uses the preferred IANA name -for the current value of 'fileencoding' if set, or 'encoding' if not. -'encoding' is always used for certain 'buftype' values. 'fileencoding' will be -set to match the chosen document encoding. - -Automatic detection works for the encodings mentioned specifically by name in -|encoding-names|, but TOhtml will only automatically use those encodings with -wide browser support. However, you can override this to support specific -encodings that may not be automatically detected by default (see options -below). See https://www.iana.org/assignments/character-sets for the IANA names. - -Note: By default all Unicode encodings are converted to UTF-8 with no BOM in -the generated HTML, as recommended by W3C: - - https://www.w3.org/International/questions/qa-choosing-encodings - https://www.w3.org/International/questions/qa-byte-order-mark - - *g:html_use_encoding* -Default: none, uses IANA name for current 'fileencoding' as above. -To overrule all automatic charset detection, set g:html_use_encoding to the -name of the charset to be used. It is recommended to set this variable to -something widely supported, like UTF-8, for anything you will be hosting on a -webserver: > - :let g:html_use_encoding = "UTF-8" -You can also use this option to omit the line that specifies the charset -entirely, by setting g:html_use_encoding to an empty string (NOT recommended): > - :let g:html_use_encoding = "" -To go back to the automatic mechanism, delete the |g:html_use_encoding| -variable: > - :unlet g:html_use_encoding -< - *g:html_encoding_override* -Default: none, autoload/tohtml.vim contains default conversions for encodings - mentioned by name at |encoding-names|. -This option allows |2html.vim| to detect the correct 'fileencoding' when you -specify an encoding with |g:html_use_encoding| which is not in the default -list of conversions. - -This is a dictionary of charset-encoding pairs that will replace existing -pairs automatically detected by TOhtml, or supplement with new pairs. - -Detect the HTML charset "windows-1252" as the encoding "8bit-cp1252": > - :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'} -< - *g:html_charset_override* -Default: none, autoload/tohtml.vim contains default conversions for encodings - mentioned by name at |encoding-names| and which have wide - browser support. -This option allows |2html.vim| to detect the HTML charset for any -'fileencoding' or 'encoding' which is not detected automatically. You can also -use it to override specific existing encoding-charset pairs. For example, -TOhtml will by default use UTF-8 for all Unicode/UCS encodings. To use UTF-16 -and UTF-32 instead, use: > - :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'} - -Note that documents encoded in either UTF-32 or UTF-16 have known -compatibility problems with some major browsers. - - *g:html_font* -Default: "monospace" -You can specify the font or fonts used in the converted document using -g:html_font. If this option is set to a string, then the value will be -surrounded with single quotes. If this option is set to a list then each list -item is surrounded by single quotes and the list is joined with commas. Either -way, "monospace" is added as the fallback generic family name and the entire -result used as the font family (using CSS) or font face (if not using CSS). -Examples: > - - " font-family: 'Consolas', monospace; - :let g:html_font = "Consolas" - - " font-family: 'DejaVu Sans Mono', 'Consolas', monospace; - :let g:html_font = ["DejaVu Sans Mono", "Consolas"] -< - *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml* -Default: 0. -When 0, generate standard HTML 4.01 (strict when possible). -When 1, generate XHTML 1.0 instead (XML compliant HTML). -> - :let g:html_use_xhtml = 1 -< ============================================================================== 5. Syntax file remarks *:syn-file-remarks* diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 1d5d62c737..b0caf9fdaf 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -635,6 +635,7 @@ Commands: :lcscope :scscope :Vimuntar + The old `:TOhtml`, replaced by a Lua version (contains many differences) Compile-time features: Emacs tags support diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua new file mode 100644 index 0000000000..e3c7fc68c0 --- /dev/null +++ b/runtime/lua/tohtml.lua @@ -0,0 +1,1335 @@ +--- @brief +---
help
+---:TOhtml {file}                                                       *:TOhtml*
+---Converts the buffer shown in the current window to HTML, opens the generated
+---HTML in a new split window, and saves its contents to {file}. If {file} is not
+---given, a temporary file (created by |tempname()|) is used.
+---
+ +-- The HTML conversion script is different from Vim's one. If you want to use +-- Vim's TOhtml converter, download it from the vim GitHub repo. +-- Here are the Vim files related to this functionality: +-- - https://github.com/vim/vim/blob/master/runtime/syntax/2html.vim +-- - https://github.com/vim/vim/blob/master/runtime/autoload/tohtml.vim +-- - https://github.com/vim/vim/blob/master/runtime/plugin/tohtml.vim +-- +-- Main differences between this and the vim version: +-- - No "ignore some visual thing" settings (just set the right Vim option) +-- - No support for legacy web engines +-- - No support for legacy encoding (supports only UTF-8) +-- - No interactive webpage +-- - No specifying the internal HTML (no XHTML, no use_css=false) +-- - No multiwindow diffs +-- - No ranges +-- +-- Remarks: +-- - Not all visuals are supported, so it may differ. + +--- @class vim.tohtml.opt +--- @field title? string|false +--- @field number_lines? boolean +--- @field font? string[]|string +--- @field width? integer + +--- @class vim.tohtml.state.global +--- @field background string +--- @field foreground string +--- @field title string|false +--- @field font string +--- @field highlights_name table +--- @field conf vim.tohtml.opt + +--- @class vim.tohtml.state:vim.tohtml.state.global +--- @field style vim.tohtml.styletable +--- @field tabstop string|false +--- @field opt vim.wo +--- @field winid integer +--- @field bufnr integer +--- @field width integer +--- @field buflen integer + +--- @class vim.tohtml.styletable +--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive)) + +--- @class vim.tohtml.line +--- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]} +--- @field pre_text string[][] +--- @field hide? boolean +--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive)) + +--- @class vim.tohtml.cell +--- @field [1] integer[] start +--- @field [2] integer[] close +--- @field [3] any[][] virt_text +--- @field [4] any[][] overlay_text + +local HIDE_ID = -1 +-- stylua: ignore start +local cterm_8_to_hex={ + [0] = "#808080", "#ff6060", "#00ff00", "#ffff00", + "#8080ff", "#ff40ff", "#00ffff", "#ffffff", +} +local cterm_16_to_hex={ + [0] = "#000000", "#c00000", "#008000", "#804000", + "#0000c0", "#c000c0", "#008080", "#c0c0c0", + "#808080", "#ff6060", "#00ff00", "#ffff00", + "#8080ff", "#ff40ff", "#00ffff", "#ffffff", +} +local cterm_88_to_hex={ + [0] = "#000000", "#c00000", "#008000", "#804000", + "#0000c0", "#c000c0", "#008080", "#c0c0c0", + "#808080", "#ff6060", "#00ff00", "#ffff00", + "#8080ff", "#ff40ff", "#00ffff", "#ffffff", + "#000000", "#00008b", "#0000cd", "#0000ff", + "#008b00", "#008b8b", "#008bcd", "#008bff", + "#00cd00", "#00cd8b", "#00cdcd", "#00cdff", + "#00ff00", "#00ff8b", "#00ffcd", "#00ffff", + "#8b0000", "#8b008b", "#8b00cd", "#8b00ff", + "#8b8b00", "#8b8b8b", "#8b8bcd", "#8b8bff", + "#8bcd00", "#8bcd8b", "#8bcdcd", "#8bcdff", + "#8bff00", "#8bff8b", "#8bffcd", "#8bffff", + "#cd0000", "#cd008b", "#cd00cd", "#cd00ff", + "#cd8b00", "#cd8b8b", "#cd8bcd", "#cd8bff", + "#cdcd00", "#cdcd8b", "#cdcdcd", "#cdcdff", + "#cdff00", "#cdff8b", "#cdffcd", "#cdffff", + "#ff0000", "#ff008b", "#ff00cd", "#ff00ff", + "#ff8b00", "#ff8b8b", "#ff8bcd", "#ff8bff", + "#ffcd00", "#ffcd8b", "#ffcdcd", "#ffcdff", + "#ffff00", "#ffff8b", "#ffffcd", "#ffffff", + "#2e2e2e", "#5c5c5c", "#737373", "#8b8b8b", + "#a2a2a2", "#b9b9b9", "#d0d0d0", "#e7e7e7", +} +local cterm_256_to_hex={ + [0] = "#000000", "#c00000", "#008000", "#804000", + "#0000c0", "#c000c0", "#008080", "#c0c0c0", + "#808080", "#ff6060", "#00ff00", "#ffff00", + "#8080ff", "#ff40ff", "#00ffff", "#ffffff", + "#000000", "#00005f", "#000087", "#0000af", + "#0000d7", "#0000ff", "#005f00", "#005f5f", + "#005f87", "#005faf", "#005fd7", "#005fff", + "#008700", "#00875f", "#008787", "#0087af", + "#0087d7", "#0087ff", "#00af00", "#00af5f", + "#00af87", "#00afaf", "#00afd7", "#00afff", + "#00d700", "#00d75f", "#00d787", "#00d7af", + "#00d7d7", "#00d7ff", "#00ff00", "#00ff5f", + "#00ff87", "#00ffaf", "#00ffd7", "#00ffff", + "#5f0000", "#5f005f", "#5f0087", "#5f00af", + "#5f00d7", "#5f00ff", "#5f5f00", "#5f5f5f", + "#5f5f87", "#5f5faf", "#5f5fd7", "#5f5fff", + "#5f8700", "#5f875f", "#5f8787", "#5f87af", + "#5f87d7", "#5f87ff", "#5faf00", "#5faf5f", + "#5faf87", "#5fafaf", "#5fafd7", "#5fafff", + "#5fd700", "#5fd75f", "#5fd787", "#5fd7af", + "#5fd7d7", "#5fd7ff", "#5fff00", "#5fff5f", + "#5fff87", "#5fffaf", "#5fffd7", "#5fffff", + "#870000", "#87005f", "#870087", "#8700af", + "#8700d7", "#8700ff", "#875f00", "#875f5f", + "#875f87", "#875faf", "#875fd7", "#875fff", + "#878700", "#87875f", "#878787", "#8787af", + "#8787d7", "#8787ff", "#87af00", "#87af5f", + "#87af87", "#87afaf", "#87afd7", "#87afff", + "#87d700", "#87d75f", "#87d787", "#87d7af", + "#87d7d7", "#87d7ff", "#87ff00", "#87ff5f", + "#87ff87", "#87ffaf", "#87ffd7", "#87ffff", + "#af0000", "#af005f", "#af0087", "#af00af", + "#af00d7", "#af00ff", "#af5f00", "#af5f5f", + "#af5f87", "#af5faf", "#af5fd7", "#af5fff", + "#af8700", "#af875f", "#af8787", "#af87af", + "#af87d7", "#af87ff", "#afaf00", "#afaf5f", + "#afaf87", "#afafaf", "#afafd7", "#afafff", + "#afd700", "#afd75f", "#afd787", "#afd7af", + "#afd7d7", "#afd7ff", "#afff00", "#afff5f", + "#afff87", "#afffaf", "#afffd7", "#afffff", + "#d70000", "#d7005f", "#d70087", "#d700af", + "#d700d7", "#d700ff", "#d75f00", "#d75f5f", + "#d75f87", "#d75faf", "#d75fd7", "#d75fff", + "#d78700", "#d7875f", "#d78787", "#d787af", + "#d787d7", "#d787ff", "#d7af00", "#d7af5f", + "#d7af87", "#d7afaf", "#d7afd7", "#d7afff", + "#d7d700", "#d7d75f", "#d7d787", "#d7d7af", + "#d7d7d7", "#d7d7ff", "#d7ff00", "#d7ff5f", + "#d7ff87", "#d7ffaf", "#d7ffd7", "#d7ffff", + "#ff0000", "#ff005f", "#ff0087", "#ff00af", + "#ff00d7", "#ff00ff", "#ff5f00", "#ff5f5f", + "#ff5f87", "#ff5faf", "#ff5fd7", "#ff5fff", + "#ff8700", "#ff875f", "#ff8787", "#ff87af", + "#ff87d7", "#ff87ff", "#ffaf00", "#ffaf5f", + "#ffaf87", "#ffafaf", "#ffafd7", "#ffafff", + "#ffd700", "#ffd75f", "#ffd787", "#ffd7af", + "#ffd7d7", "#ffd7ff", "#ffff00", "#ffff5f", + "#ffff87", "#ffffaf", "#ffffd7", "#ffffff", + "#080808", "#121212", "#1c1c1c", "#262626", + "#303030", "#3a3a3a", "#444444", "#4e4e4e", + "#585858", "#626262", "#6c6c6c", "#767676", + "#808080", "#8a8a8a", "#949494", "#9e9e9e", + "#a8a8a8", "#b2b2b2", "#bcbcbc", "#c6c6c6", + "#d0d0d0", "#dadada", "#e4e4e4", "#eeeeee", +} +-- stylua: ignore end + +--- @type table +local cterm_color_cache = {} +--- @type string? +local background_color_cache = nil +--- @type string? +local foreground_color_cache = nil + +--- @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands +--- @param color "background"|"foreground"|integer +--- @return string? +local function try_query_terminal_color(color) + local parameter = 4 + if color == 'foreground' then + parameter = 10 + elseif color == 'background' then + parameter = 11 + end + --- @type string? + local hex = nil + local au = vim.api.nvim_create_autocmd('TermResponse', { + once = true, + callback = function(args) + hex = '#' + .. table.concat({ args.data:match('\027%]%d+;%d*;?rgb:(%w%w)%w%w/(%w%w)%w%w/(%w%w)%w%w') }) + end, + }) + if type(color) == 'number' then + io.stdout:write(('\027]%s;%s;?\027\\'):format(parameter, color)) + else + io.stdout:write(('\027]%s;?\027\\'):format(parameter)) + end + vim.wait(100, function() + return hex and true or false + end) + pcall(vim.api.nvim_del_autocmd, au) + return hex +end + +--- @param colorstr string +--- @return string +local function cterm_to_hex(colorstr) + if colorstr:sub(1, 1) == '#' then + return colorstr + end + assert(colorstr ~= '') + local color = tonumber(colorstr) + assert(color and 0 <= color and color <= 255) + if cterm_color_cache[color] then + return cterm_color_cache[color] + end + local hex = try_query_terminal_color(color) + if hex then + cterm_color_cache[color] = hex + else + vim.notify_once("Info(TOhtml): Couldn't get terminal colors, using fallback") + local t_Co = tonumber(vim.api.nvim_eval('&t_Co')) + if t_Co <= 8 then + cterm_color_cache = cterm_8_to_hex + elseif t_Co == 88 then + cterm_color_cache = cterm_88_to_hex + elseif t_Co == 256 then + cterm_color_cache = cterm_256_to_hex + else + cterm_color_cache = cterm_16_to_hex + end + end + return cterm_color_cache[color] +end + +--- @return string +local function get_background_color() + local bg = vim.fn.synIDattr(vim.fn.hlID('Normal'), 'bg#') + if bg ~= '' then + return cterm_to_hex(bg) + end + if background_color_cache then + return background_color_cache + end + local hex = try_query_terminal_color('background') + if not hex or not hex:match('#%x%x%x%x%x%x') then + vim.notify_once("Info(TOhtml): Couldn't get terminal background colors, using fallback") + hex = vim.o.background == 'light' and '#ffffff' or '#000000' + end + background_color_cache = hex + return hex +end + +--- @return string +local function get_foreground_color() + local fg = vim.fn.synIDattr(vim.fn.hlID('Normal'), 'fg#') + if fg ~= '' then + return cterm_to_hex(fg) + end + if foreground_color_cache then + return foreground_color_cache + end + local hex = try_query_terminal_color('foreground') + if not hex or not hex:match('#%x%x%x%x%x%x') then + vim.notify_once("Info(TOhtml): Couldn't get terminal foreground colors, using fallback") + hex = vim.o.background == 'light' and '#000000' or '#ffffff' + end + foreground_color_cache = hex + return hex +end + +--- @param style_line vim.tohtml.line +--- @param col integer (1-index) +--- @param field integer +--- @param val any +local function _style_line_insert(style_line, col, field, val) + if style_line[col] == nil then + style_line[col] = { {}, {}, {}, {} } + end + table.insert(style_line[col][field], val) +end + +--- @param style_line vim.tohtml.line +--- @param col integer (1-index) +--- @param val any[] +local function style_line_insert_overlay_char(style_line, col, val) + _style_line_insert(style_line, col, 4, val) +end + +--- @param style_line vim.tohtml.line +--- @param col integer (1-index) +--- @param val any[] +local function style_line_insert_virt_text(style_line, col, val) + _style_line_insert(style_line, col, 3, val) +end + +--- @param state vim.tohtml.state +--- @param hl string|integer|nil +--- @return nil|integer +local function register_hl(state, hl) + if type(hl) == 'nil' then + return + elseif type(hl) == 'string' then + hl = vim.fn.hlID(hl) + assert(hl ~= 0) + end + hl = vim.fn.synIDtrans(hl) + if not state.highlights_name[hl] then + local name = vim.fn.synIDattr(hl, 'name') + assert(name ~= '') + state.highlights_name[hl] = name + end + return hl +end + +--- @param state vim.tohtml.state +--- @param start_row integer (1-index) +--- @param start_col integer (1-index) +--- @param end_row integer (1-index) +--- @param end_col integer (1-index) +--- @param conceal_text string +--- @param hl_group string|integer? +local function styletable_insert_conceal( + state, + start_row, + start_col, + end_row, + end_col, + conceal_text, + hl_group +) + assert(state.opt.conceallevel > 0) + local styletable = state.style + if start_col == end_col and start_row == end_row then + return + end + if state.opt.conceallevel == 1 and conceal_text == '' then + conceal_text = vim.opt_local.listchars:get().conceal or ' ' + end + local hlid = register_hl(state, hl_group) + if vim.wo[state.winid].conceallevel ~= 3 then + _style_line_insert(styletable[start_row], start_col, 3, { conceal_text, hlid }) + end + _style_line_insert(styletable[start_row], start_col, 1, HIDE_ID) + _style_line_insert(styletable[end_row], end_col, 2, HIDE_ID) +end + +--- @param state vim.tohtml.state +--- @param start_row integer (1-index) +--- @param start_col integer (1-index) +--- @param end_row integer (1-index) +--- @param end_col integer (1-index) +--- @param hl_group string|integer|nil +local function styletable_insert_range(state, start_row, start_col, end_row, end_col, hl_group) + if start_col == end_col and start_row == end_row or not hl_group then + return + end + local styletable = state.style + _style_line_insert(styletable[start_row], start_col, 1, hl_group) + _style_line_insert(styletable[end_row], end_col, 2, hl_group) +end + +--- @param bufnr integer +--- @return vim.tohtml.styletable +local function generate_styletable(bufnr) + --- @type vim.tohtml.styletable + local styletable = {} + for row = 1, vim.api.nvim_buf_line_count(bufnr) + 1 do + styletable[row] = { virt_lines = {}, pre_text = {} } + end + return styletable +end + +--- @param state vim.tohtml.state +local function styletable_syntax(state) + for row = 1, state.buflen do + local prev_id = 0 + local prev_col = nil + for col = 1, #vim.fn.getline(row) + 1 do + local hlid = vim.fn.synID(row, col, 1) + hlid = hlid == 0 and 0 or assert(register_hl(state, hlid)) + if hlid ~= prev_id then + if prev_id ~= 0 then + styletable_insert_range(state, row, assert(prev_col), row, col, prev_id) + end + prev_col = col + prev_id = hlid + end + end + end +end + +--- @param state vim.tohtml.state +local function styletable_diff(state) + local styletable = state.style + for row = 1, state.buflen do + local style_line = styletable[row] + local filler = vim.fn.diff_filler(row) + if filler ~= 0 then + local fill = (vim.opt_local.fillchars:get().diff or '-') + table.insert( + style_line.virt_lines, + { { fill:rep(state.width), register_hl(state, 'DiffDelete') } } + ) + end + if row == state.buflen + 1 then + break + end + local prev_id = 0 + local prev_col = nil + for col = 1, #vim.fn.getline(row) do + local hlid = vim.fn.diff_hlID(row, col) + hlid = hlid == 0 and 0 or assert(register_hl(state, hlid)) + if hlid ~= prev_id then + if prev_id ~= 0 then + styletable_insert_range(state, row, assert(prev_col), row, col, prev_id) + end + prev_col = col + prev_id = hlid + end + end + if prev_id ~= 0 then + styletable_insert_range(state, row, assert(prev_col), row, #vim.fn.getline(row) + 1, prev_id) + end + end +end + +--- @param state vim.tohtml.state +local function styletable_treesitter(state) + local bufnr = state.bufnr + local buf_highlighter = vim.treesitter.highlighter.active[bufnr] + if not buf_highlighter then + return + end + buf_highlighter.tree:parse(true) + buf_highlighter.tree:for_each_tree(function(tstree, tree) + --- @cast tree LanguageTree + if not tstree then + return + end + local root = tstree:root() + local q = buf_highlighter:get_query(tree:lang()) + --- @type Query? + local query = q:query() + if not query then + return + end + for capture, node, metadata in query:iter_captures(root, buf_highlighter.bufnr, 0, state.buflen) do + local srow, scol, erow, ecol = node:range() + --- @diagnostic disable-next-line: invisible + local c = q._query.captures[capture] + if c ~= nil then + local hlid = register_hl(state, '@' .. c .. '.' .. tree:lang()) + if metadata.conceal and state.opt.conceallevel ~= 0 then + styletable_insert_conceal(state, srow + 1, scol + 1, erow + 1, ecol + 1, metadata.conceal) + end + styletable_insert_range(state, srow + 1, scol + 1, erow + 1, ecol + 1, hlid) + end + end + end) +end + +--- @param state vim.tohtml.state +--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any} +--- @param namespaces table +local function _styletable_extmarks_highlight(state, extmark, namespaces) + if not extmark[4].hl_group then + return + end + ---TODO(altermo) LSP semantic tokens (and some other extmarks) are only + ---generated in visible lines, and not in the whole buffer. + if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_semantic_tokens') then + vim.notify_once('Info(TOhtml): lsp semantic tokens are not supported, HTML may be incorrect') + return + end + local srow, scol, erow, ecol = + extmark[2], extmark[3], extmark[4].end_row or extmark[2], extmark[4].end_col or extmark[3] + if scol == ecol and srow == erow then + return + end + local hlid = register_hl(state, extmark[4].hl_group) + styletable_insert_range(state, srow + 1, scol + 1, erow + 1, ecol + 1, hlid) +end + +--- @param state vim.tohtml.state +--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any} +local function _styletable_extmarks_virt_text(state, extmark) + if not extmark[4].virt_text then + return + end + local styletable = state.style + --- @type integer,integer + local row, col = extmark[2], extmark[3] + if + extmark[4].virt_text_pos == 'inline' + or extmark[4].virt_text_pos == 'eol' + or extmark[4].virt_text_pos == 'overlay' + then + if extmark[4].virt_text_pos == 'eol' then + style_line_insert_virt_text(styletable[row + 1], #vim.fn.getline(row + 1) + 1, { ' ' }) + end + local virt_text_len = 0 + for _, i in + ipairs(extmark[4].virt_text --[[@as (string[][])]]) + do + local hlid = register_hl(state, i[2]) + if extmark[4].virt_text_pos == 'eol' then + style_line_insert_virt_text( + styletable[row + 1], + #vim.fn.getline(row + 1) + 1, + { i[1], hlid } + ) + else + style_line_insert_virt_text(styletable[row + 1], col + 1, { i[1], hlid }) + end + virt_text_len = virt_text_len + #i[1] + end + if extmark[4].virt_text_pos == 'overlay' then + styletable_insert_range(state, row + 1, col + 1, row + 1, col + virt_text_len + 1, HIDE_ID) + end + end + local not_supported = { + virt_text_pos = 'right_align', + hl_mode = 'blend', + hl_group = 'combine', + } + for opt, val in ipairs(not_supported) do + if extmark[4][opt] == val then + vim.notify_once( + ('Info(TOhtml): extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val) + ) + end + end +end + +--- @param state vim.tohtml.state +--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]: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 + return + end + --- @type integer + local row = extmark[2] + (extmark[4].virt_lines_above and 1 or 2) + for _, line in + ipairs(extmark[4].virt_lines --[[@as (string[][][])]]) + do + local virt_line = {} + for _, i in ipairs(line) do + local hlid = register_hl(state, i[2]) + table.insert(virt_line, { i[1], hlid }) + end + table.insert(state.style[row].virt_lines, virt_line) + end +end + +--- @param state vim.tohtml.state +--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]: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 + end + local srow, scol, erow, ecol = + extmark[2], extmark[3], extmark[4].end_row or extmark[2], extmark[4].end_col or extmark[3] + styletable_insert_conceal( + state, + srow + 1, + scol + 1, + erow + 1, + ecol + 1, + extmark[4].conceal, + extmark[4].hl_group or 'Conceal' + ) +end + +--- @param state vim.tohtml.state +local function styletable_extmarks(state) + --TODO(altermo) extmarks may have col/row which is outside of the buffer, which could cause an error + local bufnr = state.bufnr + local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, 0, -1, { details = true }) + local namespaces = vim.tbl_add_reverse_lookup(vim.api.nvim_get_namespaces()) + for _, v in ipairs(extmarks) do + _styletable_extmarks_highlight(state, v, namespaces) + end + for _, v in ipairs(extmarks) do + _styletable_extmarks_conceal(state, v) + end + for _, v in ipairs(extmarks) do + _styletable_extmarks_virt_text(state, v) + end + for _, v in ipairs(extmarks) do + _styletable_extmarks_virt_lines(state, v) + end +end + +--- @param state vim.tohtml.state +local function styletable_folds(state) + local styletable = state.style + local has_folded = false + for row = 1, state.buflen do + if vim.fn.foldclosed(row) > 0 then + has_folded = true + styletable[row].hide = true + end + if vim.fn.foldclosed(row) == row then + local hlid = register_hl(state, 'Folded') + ---TODO(altermo): Is there a way to get highlighted foldtext? + local foldtext = vim.fn.foldtextresult(row) + foldtext = foldtext .. (vim.opt.fillchars:get().fold or '·'):rep(state.width - #foldtext) + table.insert(styletable[row].virt_lines, { { foldtext, hlid } }) + end + end + if has_folded and type(({ pcall(vim.api.nvim_eval, vim.o.foldtext) })[2]) == 'table' then + vim.notify_once( + 'Info(TOhtml): foldtext returning a table is half supported, HTML may be incorrect' + ) + end +end + +--- @param state vim.tohtml.state +local function styletable_conceal(state) + local bufnr = state.bufnr + vim.api.nvim_buf_call(bufnr, function() + for row = 1, state.buflen do + --- @type table + local conceals = {} + local line_len_exclusive = #vim.fn.getline(row) + 1 + for col = 1, line_len_exclusive do + --- @type integer,string,integer + local is_concealed, conceal, hlid = unpack(vim.fn.synconcealed(row, col) --[[@as table]]) + if is_concealed == 0 then + assert(true) + elseif not conceals[hlid] then + conceals[hlid] = { col, math.min(col + 1, line_len_exclusive), conceal } + else + conceals[hlid][2] = math.min(col + 1, line_len_exclusive) + end + end + for _, v in pairs(conceals) do + styletable_insert_conceal(state, row, v[1], row, v[2], v[3], 'Conceal') + end + end + end) +end + +--- @param state vim.tohtml.state +local function styletable_match(state) + for _, match in + ipairs(vim.fn.getmatches(state.winid) --[[@as (table[])]]) + do + local hlid = register_hl(state, match.group) + local function range(srow, scol, erow, ecol) + if match.group == 'Conceal' and state.opt.conceallevel ~= 0 then + styletable_insert_conceal(state, srow, scol, erow, ecol, match.conceal or '', hlid) + else + styletable_insert_range(state, srow, scol, erow, ecol, hlid) + end + end + if match.pos1 then + for key, v in + pairs(match --[[@as (table)]]) + do + if not key:match('^pos(%d+)$') then + assert(true) + elseif #v == 1 then + range(v[1], 1, v[1], #vim.fn.getline(v[1]) + 1) + else + range(v[1], v[2], v[1], v[3] + v[2]) + end + end + else + for _, v in + ipairs(vim.fn.matchbufline(state.bufnr, match.pattern, 1, '$') --[[@as (table[])]]) + do + range(v.lnum, v.byteidx + 1, v.lnum, v.byteidx + 1 + #v.text) + end + end + end +end + +--- Requires state.conf.number_lines to be set to true +--- @param state vim.tohtml.state +local function styletable_statuscolumn(state) + if not state.conf.number_lines then + return + end + local statuscolumn = state.opt.statuscolumn + + if statuscolumn == '' then + if state.opt.relativenumber then + if state.opt.number then + statuscolumn = '%C%s%{%v:lnum!=line(".")?"%=".v:relnum." ":v:lnum%}' + else + statuscolumn = '%C%s%{%"%=".v:relnum." "%}' + end + else + statuscolumn = '%C%s%{%"%=".v:lnum." "%}' + end + end + local minwidth = 0 + + local signcolumn = state.opt.signcolumn + if state.opt.number or state.opt.relativenumber then + minwidth = minwidth + state.opt.numberwidth + if signcolumn == 'number' then + signcolumn = 'no' + end + end + if signcolumn == 'number' then + signcolumn = 'auto' + end + if signcolumn ~= 'no' then + local max = tonumber(signcolumn:match('^%w-:(%d)')) or 1 + if signcolumn:match('^auto') then + --- @type table + local signcount = {} + for _, extmark in + ipairs(vim.api.nvim_buf_get_extmarks(state.bufnr, -1, 0, -1, { details = true })) + do + if extmark[4].sign_text then + signcount[extmark[2]] = (signcount[extmark[2]] or 0) + 1 + end + end + local maxsigns = 0 + for _, v in pairs(signcount) do + if v > maxsigns then + maxsigns = v + end + end + minwidth = minwidth + math.min(maxsigns, max) * 2 + else + minwidth = minwidth + max * 2 + end + end + + local foldcolumn = state.opt.foldcolumn + if foldcolumn ~= '0' then + if foldcolumn:match('^auto') then + local max = tonumber(foldcolumn:match('^%w-:(%d)')) or 1 + local maxfold = 0 + vim.api.nvim_buf_call(state.bufnr, function() + for row = 1, vim.api.nvim_buf_line_count(state.bufnr) do + local foldlevel = vim.fn.foldlevel(row) + if foldlevel > maxfold then + maxfold = foldlevel + end + end + end) + minwidth = minwidth + math.min(maxfold, max) + else + minwidth = minwidth + tonumber(foldcolumn) + end + end + + --- @type table + local statuses = {} + for row = 1, state.buflen do + local status = vim.api.nvim_eval_statusline( + statuscolumn, + { winid = state.winid, use_statuscol_lnum = row, highlights = true } + ) + local width = vim.api.nvim_strwidth(status.str) + if width > minwidth then + minwidth = width + end + table.insert(statuses, status) + --- @type string + end + for row, status in pairs(statuses) do + --- @type string + local str = status.str + --- @type table[] + local hls = status.highlights + for k, v in ipairs(hls) do + local text = str:sub(v.start + 1, hls[k + 1] and hls[k + 1].start or nil) + if k == #hls then + text = text .. (' '):rep(minwidth - vim.api.nvim_strwidth(str)) + end + if text ~= '' then + local hlid = register_hl(state, v.group) + local virt_text = { text, hlid } + table.insert(state.style[row].pre_text, virt_text) + end + end + end +end + +--- @param state vim.tohtml.state +local function styletable_listchars(state) + if not state.opt.list then + return + end + --- @return string + local function utf8_sub(str, i, j) + return vim.fn.strcharpart(str, i - 1, j and j - i + 1 or nil) + end + local len = vim.api.nvim_strwidth + --- @type table + local listchars = vim.opt_local.listchars:get() + local ids = setmetatable({}, { + __index = function(t, k) + rawset(t, k, register_hl(state, k)) + return rawget(t, k) + end, + }) + + if listchars.eol then + for row = 1, state.buflen do + local style_line = state.style[row] + style_line_insert_overlay_char( + style_line, + #vim.fn.getline(row) + 1, + { listchars.eol, ids.NonText } + ) + end + end + + if listchars.tab and state.tabstop then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, '\t', 1, '$') --[[@as (table[])]]) + do + --- @type integer + local tablen = #state.tabstop + - ((vim.fn.virtcol({ match.lnum, match.byteidx }, false, state.winid)) % #state.tabstop) + --- @type string? + local text + if len(listchars.tab) == 3 then + if tablen == 1 then + text = utf8_sub(listchars.tab, 3, 3) + else + text = utf8_sub(listchars.tab, 1, 1) + .. utf8_sub(listchars.tab, 2, 2):rep(tablen - 2) + .. utf8_sub(listchars.tab, 3, 3) + end + else + text = utf8_sub(listchars.tab, 1, 1) .. utf8_sub(listchars.tab, 2, 2):rep(tablen - 1) + end + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + 1, + { text, ids.Whitespace } + ) + end + end + + if listchars.space then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, ' ', 1, '$') --[[@as (table[])]]) + do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + 1, + { listchars.space, ids.Whitespace } + ) + end + end + + if listchars.multispace then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, [[ \+]], 1, '$') --[[@as (table[])]]) + do + local text = utf8_sub(listchars.multispace:rep(len(match.text)), 1, len(match.text)) + for i = 1, len(text) do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + i, + { utf8_sub(text, i, i), ids.Whitespace } + ) + end + end + end + + if listchars.lead or listchars.leadmultispace then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, [[^ \+]], 1, '$') --[[@as (table[])]]) + do + local text = '' + if len(match.text) == 1 or not listchars.leadmultispace then + if listchars.lead then + text = listchars.lead:rep(len(match.text)) + end + elseif listchars.leadmultispace then + text = utf8_sub(listchars.leadmultispace:rep(len(match.text)), 1, len(match.text)) + end + for i = 1, len(text) do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + i, + { utf8_sub(text, i, i), ids.Whitespace } + ) + end + end + end + + if listchars.trail then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, [[ \+$]], 1, '$') --[[@as (table[])]]) + do + local text = listchars.trail:rep(len(match.text)) + for i = 1, len(text) do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + i, + { utf8_sub(text, i, i), ids.Whitespace } + ) + end + end + end + + if listchars.nbsp then + for _, match in + ipairs(vim.fn.matchbufline(state.bufnr, '\xe2\x80\xaf\\|\xa0', 1, '$') --[[@as (table[])]]) + do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + 1, + { listchars.nbsp, ids.Whitespace } + ) + for i = 2, #match.text do + style_line_insert_overlay_char( + state.style[match.lnum], + match.byteidx + i, + { '', ids.Whitespace } + ) + end + end + end +end + +--- @param name string +--- @return string +local function highlight_name_to_class_name(name) + return (name:gsub('%.', '-'):gsub('@', '-')) +end + +--- @param name string +--- @return string +local function name_to_tag(name) + return '' +end + +--- @param _ string +--- @return string +local function name_to_closetag(_) + return '' +end + +--- @param str string +--- @param tabstop string|false? +--- @return string +local function html_escape(str, tabstop) + str = str:gsub('&', '&'):gsub('<', '<'):gsub('>', '>'):gsub('"', '"') + if tabstop then + --- @type string + str = str:gsub('\t', tabstop) + end + return str +end + +--- @param out string[] +--- @param state vim.tohtml.state.global +local function extend_style(out, state) + table.insert(out, '') +end + +--- @param out string[] +--- @param state vim.tohtml.state.global +local function extend_head(out, state) + table.insert(out, '') + table.insert(out, '') + if state.title ~= false then + table.insert(out, ('%s'):format(state.title)) + end + local colorscheme = vim.api.nvim_exec2('colorscheme', { output = true }).output + table.insert( + out, + (''):format(html_escape(colorscheme)) + ) + extend_style(out, state) + table.insert(out, '') +end + +--- @param out string[] +--- @param state vim.tohtml.state +--- @param row integer +local function _extend_virt_lines(out, state, row) + local style_line = state.style[row] + for _, virt_line in ipairs(style_line.virt_lines) do + local virt_s = '' + for _, v in ipairs(virt_line) do + if v[2] then + virt_s = virt_s .. (name_to_tag(state.highlights_name[v[2]])) + end + virt_s = virt_s .. v[1] + if v[2] then + --- @type string + virt_s = virt_s .. (name_to_closetag(state.highlights_name[v[2]])) + end + end + table.insert(out, virt_s) + end +end + +--- @param state vim.tohtml.state +--- @param row integer +--- @return string +local function _pre_text_to_html(state, row) + local style_line = state.style[row] + local s = '' + for _, pre_text in ipairs(style_line.pre_text) do + if pre_text[2] then + s = s .. (name_to_tag(state.highlights_name[pre_text[2]])) + end + s = s .. (html_escape(pre_text[1], state.tabstop)) + if pre_text[2] then + --- @type string + s = s .. (name_to_closetag(state.highlights_name[pre_text[2]])) + end + end + return s +end + +--- @param state vim.tohtml.state +--- @param char table +--- @return string +local function _char_to_html(state, char) + local s = '' + if char[2] then + s = s .. name_to_tag(state.highlights_name[char[2]]) + end + s = s .. html_escape(char[1], state.tabstop) + if char[2] then + s = s .. name_to_closetag(state.highlights_name[char[2]]) + end + return s +end + +--- @param state vim.tohtml.state +--- @param cell vim.tohtml.cell +--- @return string +local function _virt_text_to_html(state, cell) + local s = '' + for _, v in ipairs(cell[3]) do + if v[2] then + s = s .. (name_to_tag(state.highlights_name[v[2]])) + end + --- @type string + s = s .. html_escape(v[1], state.tabstop) + if v[2] then + s = s .. name_to_closetag(state.highlights_name[v[2]]) + end + end + return s +end + +--- @param out string[] +--- @param state vim.tohtml.state +local function extend_pre(out, state) + local styletable = state.style + table.insert(out, '
')
+  local hide_count = 0
+  --- @type integer[]
+  local stack = {}
+
+  local function loop(row)
+    local style_line = styletable[row]
+    if style_line.hide and (styletable[row - 1] or {}).hide then
+      return
+    end
+    _extend_virt_lines(out, state, row)
+    --Possible improvement (altermo):
+    --Instead of looping over all the buffer characters per line,
+    --why not loop over all the style_line cells,
+    --and then calculating the amount of text.
+    if style_line.hide then
+      return
+    end
+    local line = vim.api.nvim_buf_get_lines(state.bufnr, row - 1, row, false)[1] or ''
+    local s = ''
+    s = s .. _pre_text_to_html(state, row)
+    for col = 1, #line + 1 do
+      local cell = style_line[col]
+      --- @type table?
+      local char
+      if cell then
+        for i = #cell[2], 1, -1 do
+          local hlid = cell[2][i]
+          if hlid < 0 then
+            if hlid == HIDE_ID then
+              hide_count = hide_count - 1
+            end
+          else
+            --- @type integer?
+            local index
+            for idx = #stack, 1, -1 do
+              s = s .. (name_to_closetag(state.highlights_name[stack[idx]]))
+              if stack[idx] == hlid then
+                index = idx
+                break
+              end
+            end
+            assert(index, 'a coles tag which has no corresponding open tag')
+            for idx = index + 1, #stack do
+              s = s .. (name_to_tag(state.highlights_name[stack[idx]]))
+            end
+            table.remove(stack, index)
+          end
+        end
+
+        for _, hlid in ipairs(cell[1]) do
+          if hlid < 0 then
+            if hlid == HIDE_ID then
+              hide_count = hide_count + 1
+            end
+          else
+            table.insert(stack, hlid)
+            s = s .. (name_to_tag(state.highlights_name[hlid]))
+          end
+        end
+
+        if cell[3] then
+          s = s .. _virt_text_to_html(state, cell)
+        end
+
+        char = cell[4][#cell[4]]
+      end
+
+      if col == #line + 1 and not char then
+        break
+      end
+
+      if hide_count == 0 then
+        s = s
+          .. _char_to_html(
+            state,
+            char
+              or { vim.api.nvim_buf_get_text(state.bufnr, row - 1, col - 1, row - 1, col, {})[1] }
+          )
+      end
+    end
+    table.insert(out, s)
+  end
+
+  for row = 1, state.buflen + 1 do
+    loop(row)
+  end
+  assert(#stack == 0, 'an open HTML tag was never closed')
+  table.insert(out, '
') +end + +--- @param out string[] +--- @param fn fun() +local function extend_body(out, fn) + table.insert(out, '') + fn() + table.insert(out, '') +end + +--- @param out string[] +--- @param fn fun() +local function extend_html(out, fn) + table.insert(out, '') + table.insert(out, '') + fn() + table.insert(out, '') +end + +--- @param winid integer +--- @param global_state vim.tohtml.state.global +--- @return vim.tohtml.state +local function global_state_to_state(winid, global_state) + local bufnr = vim.api.nvim_win_get_buf(winid) + local opt = global_state.conf + local width = opt.width or vim.bo[bufnr].textwidth + if not width or width < 1 then + width = vim.api.nvim_win_get_width(winid) + end + local state = setmetatable({ + winid = winid == 0 and vim.api.nvim_get_current_win() or winid, + opt = vim.wo[winid], + style = generate_styletable(bufnr), + bufnr = bufnr, + tabstop = (' '):rep(vim.bo[bufnr].tabstop), + width = width, + buflen = vim.api.nvim_buf_line_count(bufnr), + }, { __index = global_state }) + return state --[[@as vim.tohtml.state]] +end + +--- @param opt vim.tohtml.opt +--- @param title? string +--- @return vim.tohtml.state.global +local function opt_to_global_state(opt, title) + local fonts = {} + if opt.font then + fonts = type(opt.font) == 'string' and { opt.font } or opt.font --[[@as (string[])]] + elseif vim.o.guifont:match('^[^:]+') then + table.insert(fonts, vim.o.guifont:match('^[^:]+')) + end + table.insert(fonts, 'monospace') + --- @type vim.tohtml.state.global + local state = { + background = get_background_color(), + foreground = get_foreground_color(), + title = opt.title or title or false, + font = table.concat(fonts, ','), + highlights_name = {}, + conf = opt, + } + return state +end + +--- @type fun(state: vim.tohtml.state)[] +local styletable_funcs = { + styletable_syntax, + styletable_diff, + styletable_treesitter, + styletable_match, + styletable_extmarks, + styletable_conceal, + styletable_listchars, + styletable_folds, + styletable_statuscolumn, +} + +--- @param state vim.tohtml.state +local function state_generate_style(state) + vim.api.nvim_win_call(state.winid, function() + for _, fn in ipairs(styletable_funcs) do + --- @type string? + local cond + if type(fn) == 'table' then + cond = fn[2] --[[@as string]] + --- @type function + fn = fn[1] + end + if not cond or cond(state) then + fn(state) + end + end + end) +end + +--- @param winid integer[]|integer +--- @param opt? vim.tohtml.opt +--- @return string[] +local function win_to_html(winid, opt) + if type(winid) == 'number' then + winid = { winid } + end + --- @cast winid integer[] + assert(#winid > 0, 'no window specified') + opt = opt or {} + local title = table.concat( + vim.tbl_map(vim.api.nvim_buf_get_name, vim.tbl_map(vim.api.nvim_win_get_buf, winid)), + ',' + ) + local global_state = opt_to_global_state(opt, title) + --- @type vim.tohtml.state[] + local states = {} + for _, i in ipairs(winid) do + local state = global_state_to_state(i, global_state) + state_generate_style(state) + table.insert(states, state) + end + local html = {} + extend_html(html, function() + extend_head(html, global_state) + extend_body(html, function() + for _, state in ipairs(states) do + extend_pre(html, state) + end + end) + end) + return html +end + +local M = {} + +--- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string. +--- @param winid? integer Window to convert (defaults to current window) +--- @param opt? vim.tohtml.opt (table) Optional parameters. +--- - title (string): Title tag to set in the generated HTML code (defaults to buffer name) +--- - number_lines (boolean): Show line numbers (defaults to `false`) +--- - font (string|string[]): Fonts to use (defaults to `guifont`) +--- - width (integer) Width used for items which are either right aligned or repeat a character infinitely +--- (defaults to 'textwidth' if non-zero or window width otherwise) +--- @return string[] +function M.tohtml(winid, opt) + return win_to_html(winid or 0, opt) +end + +return M diff --git a/runtime/plugin/tohtml.lua b/runtime/plugin/tohtml.lua new file mode 100644 index 0000000000..893419ece6 --- /dev/null +++ b/runtime/plugin/tohtml.lua @@ -0,0 +1,11 @@ +if vim.g.loaded_2html_plugin ~= nil then + return +end +vim.g.loaded_2html_plugin = true + +vim.api.nvim_create_user_command('TOhtml', function(args) + local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html' + local html = require('tohtml').tohtml() + vim.fn.writefile(html, outfile) + vim.cmd.split(outfile) +end, { bar = true, nargs = '?' }) diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim deleted file mode 100644 index 56eb2c15bf..0000000000 --- a/runtime/plugin/tohtml.vim +++ /dev/null @@ -1,254 +0,0 @@ -" Vim plugin for converting a syntax highlighted file to HTML. -" Maintainer: Ben Fritz -" Last Change: 2023 Sep 07 -" -" The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and -" $VIMRUNTIME/syntax/2html.vim -" -if exists('g:loaded_2html_plugin') - finish -endif -let g:loaded_2html_plugin = 'vim9.0_v2' - -" -" Changelog: {{{ -" 9.0_v2 (this version): - Warn if using deprecated g:use_xhtml option -" - Change default g:html_use_input_for_pc to "none" -" instead of "fallback". All modern browsers support -" the "user-select: none" and "content:" CSS -" properties so the older method relying on extra -" markup and unspecified browser/app clipboard -" handling is only needed in rare special cases. -" - Fix SourceForge issue #33: generate diff filler -" correctly when new lines have been added to or -" removed from end of buffer. -" - Fix SourceForge issue #32/Vim Github issue #8547: -" use translated highlight ID for styling the -" special-use group names (e.g. LineNr) used -" directly by name in the 2html processing. -" - Fix SourceForge issue #26, refactoring to use -" :let-heredoc style string assignment and -" additional fixes for ".." vs. "." style string -" concatenation. Requires Vim v8.1.1354 or higher. -" 9.0_v1 (Vim 9.0.1275): - Implement g:html_no_doc and g:html_no_modeline -" for diff mode. Add tests. -" (Vim 9.0.1122): NOTE: no version string update for this version! -" - Bugfix for variable name in g:html_no_doc -" (Vim 9.0.0819): NOTE: no version string update for this version! -" - Add options g:html_no_doc, g:html_no_lines, -" and g:html_no_modeline (partially included in Vim -" runtime prior to version string update). -" - Updates for new Vim9 string append style (i.e. use -" ".." instead of "."). Requires Vim version -" 8.1.1114 or higher. -" -" 8.1 updates: {{{ -" 8.1_v2 (Vim 8.1.2312): - Fix SourceForge issue #19: fix calculation of tab -" stop position to use in expanding a tab, when that -" tab occurs after a syntax match which in turn -" comes after previously expanded tabs. -" - Set eventignore while splitting a window for the -" destination file to ignore FileType events; -" speeds up processing when the destination file -" already exists and HTML highlight takes too long. -" - Fix SourceForge issue #20: progress bar could not be -" seen when DiffDelete background color matched -" StatusLine background color. Added TOhtmlProgress -" highlight group for manual user override, but -" calculate it to be visible compared to StatusLine -" by default. -" - Fix SourceForge issue #1: Remove workaround for old -" browsers which don't support 'ch' CSS unit, since -" all modern browsers, including IE>=9, support it. -" - Fix SourceForge issue #10: support termguicolors -" - Fix SourceForge issue #21: default to using -" generated content instead of tags for -" uncopyable text, so that text is correctly -" prevented from being copied in chrome. Use -" g:html_use_input_for_pc option to control the -" method used. -" - Switch to HTML5 to allow using vnu as a validator -" in unit test. -" - Fix fallback sizing of tags for browsers -" without "ch" support. -" - Fix cursor on unselectable diff filler text. -" 8.1_v1 (Vim 8.1.0528): - Fix SourceForge issue #6: Don't generate empty -" script tag. -" - Fix SourceForge issue #5: javascript should -" declare variables with "var". -" - Fix SourceForge issue #13: errors thrown sourcing -" 2html.vim directly when plugins not loaded. -" - Fix SourceForge issue #16: support 'vartabstop'. -"}}} -" -" 7.4 updates: {{{ -" 7.4_v2 (Vim 7.4.0899): Fix error raised when converting a diff containing -" an empty buffer. Jan Stocker: allow g:html_font to -" take a list so it is easier to specfiy fallback -" fonts in the generated CSS. -" 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and -" also for version-specific modelines like "vim>703:". -"}}} -" -" 7.3 updates: {{{ -" 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using -" g:html_line_ids=0. Allow customizing -" important IDs (like line IDs and fold IDs) using -" g:html_id_expr evaluated when the buffer conversion -" is started. -" 7.3_v13 (Vim 7.3.1088): Keep foldmethod at manual in the generated file and -" insert modeline to set it to manual. -" Fix bug: diff mode with 2 unsaved buffers creates a -" duplicate of one buffer instead of including both. -" Add anchors to each line so you can put '#L123' -" or '#123' at the end of the URL to jump to line 123 -" (idea by Andy Spencer). Add javascript to open folds -" to show the anchor being jumped to if it is hidden. -" Fix XML validation error: &nsbp; not part of XML. -" Allow TOhtml to chain together with other commands -" using |. -" 7.3_v12 (Vim 7.3.0616): Fix modeline mangling to also work for when multiple -" highlight groups make up the start-of-modeline text. -" Improve render time of page with uncopyable regions -" by not using one-input-per-char. Change name of -" uncopyable option from html_unselectable to -" html_prevent_copy. Added html_no_invalid option and -" default to inserting invalid markup for uncopyable -" regions to prevent MS Word from pasting undeletable -" elements. Fix 'cpo' handling (Thilo Six). -" 7.3_v12b1: Add html_unselectable option. Rework logic to -" eliminate post-processing substitute commands in -" favor of doing the work up front. Remove unnecessary -" special treatment of 'LineNr' highlight group. Minor -" speed improvements. Fix modeline mangling in -" generated output so it works for text in the first -" column. Fix missing line number and fold column in -" diff filler lines. Fix that some fonts have a 1px -" gap (using a dirty hack, improvements welcome). Add -" "colorscheme" meta tag. Does NOT include support for -" the new default foldtext added in v11, as the patch -" adding it has not yet been included in Vim. -" 7.3_v11 ( unreleased ): Support new default foldtext from patch by Christian -" Brabandt in -" http://groups.google.com/d/topic/vim_dev/B6FSGfq9VoI/discussion. -" This patch has not yet been included in Vim, thus -" these changes are removed in the next version. -" 7.3_v10 (Vim 7.3.0227): Fix error E684 when converting a range wholly inside -" multiple nested folds with dynamic folding on. -" Also fix problem with foldtext in this situation. -" 7.3_v9 (Vim 7.3.0170): Add html_pre_wrap option active with html_use_css -" and without html_no_pre, default value same as -" 'wrap' option, (Andy Spencer). Don't use -" 'fileencoding' for converted document encoding if -" 'buftype' indicates a special buffer which isn't -" written. -" 7.3_v8 (Vim 7.3.0100): Add html_expand_tabs option to allow leaving tab -" characters in generated output (Andy Spencer). -" Escape text that looks like a modeline so Vim -" doesn't use anything in the converted HTML as a -" modeline. Bugfixes: Fix folding when a fold starts -" before the conversion range. Remove fold column when -" there are no folds. -" 7.3_v7 (Vim 7-3-0063): see betas released on vim_dev below: -" 7.3_v7b3: Fixed bug, convert Unicode to UTF-8 all the way. -" 7.3_v7b2: Remove automatic detection of encodings that are not -" supported by all major browsers according to -" http://wiki.whatwg.org/wiki/Web_Encodings and -" convert to UTF-8 for all Unicode encodings. Make -" HTML encoding to Vim encoding detection be -" case-insensitive for built-in pairs. -" 7.3_v7b1: Remove use of setwinvar() function which cannot be -" called in restricted mode (Andy Spencer). Use -" 'fencoding' instead of 'encoding' to determine by -" charset, and make sure the 'fenc' of the generated -" file matches its indicated charset. Add charsets for -" all of Vim's natively supported encodings. -" 7.3_v6 (Vim 7.3.0000): Really fix bug with 'nowrapscan', 'magic' and other -" user settings interfering with diff mode generation, -" trailing whitespace (e.g. line number column) when -" using html_no_pre, and bugs when using -" html_hover_unfold. -" 7.3_v5 ( unreleased ): Fix bug with 'nowrapscan' and also with out-of-sync -" folds in diff mode when first line was folded. -" 7.3_v4 (Vim 7.3.0000): Bugfixes, especially for xhtml markup, and diff mode -" 7.3_v3 (Vim 7.3.0000): Refactor option handling and make html_use_css -" default to true when not set to anything. Use strict -" doctypes where possible. Rename use_xhtml option to -" html_use_xhtml for consistency. Use .xhtml extension -" when using this option. Add meta tag for settings. -" 7.3_v2 (Vim 7.3.0000): Fix syntax highlighting in diff mode to use both the -" diff colors and the normal syntax colors -" 7.3_v1 (Vim 7.3.0000): Add conceal support and meta tags in output -"}}} -"}}} - -" TODO: {{{ -" * Check the issue tracker: -" https://sourceforge.net/p/vim-tohtml/issues/search/?q=%21status%3Aclosed -" * Options for generating the CSS in external style sheets. New :TOcss -" command to convert the current color scheme into a (mostly) generic CSS -" stylesheet which can be re-used. Alternate stylesheet support? Good start -" by Erik Falor -" ( https://groups.google.com/d/topic/vim_use/7XTmC4D22dU/discussion ). -" * Add optional argument to :TOhtml command to specify mode (gui, cterm, -" term) to use for the styling. Suggestion by "nacitar". -" * Add way to override or specify which RGB colors map to the color numbers -" in cterm. Get better defaults than just guessing? Suggestion by "nacitar". -" * Disable filetype detection until after all processing is done. -" * Add option for not generating the hyperlink on stuff that looks like a -" URL? Or just color the link to fit with the colorscheme (and only special -" when hovering)? -" * Bug: Opera does not allow printing more than one page if uncopyable -" regions is turned on. Possible solution: Add normal text line numbers with -" display:none, set to display:inline for print style sheets, and hide -" elements for print, to allow Opera printing multiple pages (and -" other uncopyable areas?). May need to make the new text invisible to IE -" with conditional comments to prevent copying it, IE for some reason likes -" to copy hidden text. Other browsers too? -" * Bug: still a 1px gap throughout the fold column when html_prevent_copy is -" "fn" in some browsers. Specifically, in Chromium on Ubuntu (but not Chrome -" on Windows). Perhaps it is font related? -" * Bug: still some gaps in the fold column when html_prevent_copy contains -" 'd' and showing the whole diff (observed in multiple browsers). Only gaps -" on diff lines though. -" * Undercurl support via CSS3, with fallback to dotted or something: -" https://groups.google.com/d/topic/vim_use/BzXA6He1pHg/discussion -" * Redo updates for modified default foldtext (v11) when/if the patch is -" accepted to modify it. -" * Test case +diff_one_file-dynamic_folds+expand_tabs-hover_unfold -" +ignore_conceal-ignore_folding+no_foldcolumn+no_pre+no_progress -" +number_lines-pre_wrap-use_css+use_xhtml+whole_filler.xhtml -" does not show the whole diff filler as it is supposed to? -" * Bug: when 'isprint' is wrong for the current encoding, will generate -" invalid content. Can/should anything be done about this? Maybe a separate -" plugin to correct 'isprint' based on encoding? -" * Check to see if the windows-125\d encodings actually work in Unix without -" the 8bit- prefix. Add prefix to autoload dictionaries for Unix if not. -" * Font auto-detection similar to -" http://www.vim.org/scripts/script.php?script_id=2384 but for a variety of -" platforms. -" * Pull in code from http://www.vim.org/scripts/script.php?script_id=3113 : -" - listchars support -" - full-line background highlight -" - other? -" * Make it so deleted lines in a diff don't create side-scrolling (get it -" free with full-line background highlight above). -" * Restore open/closed folds and cursor position after processing each file -" with option not to restore for speed increase. -" * Add extra meta info (generation time, etc.)? -" * Tidy up so we can use strict doctype in even more situations -" * Implementation detail: add threshold for writing the lines to the html -" buffer before we're done (5000 or so lines should do it) -" * TODO comments for code cleanup scattered throughout -"}}} - -" Define the :TOhtml command when: -" - 'compatible' is not set -" - this plugin or user override was not already loaded -" - user commands are available. {{{ -if !&cp && !exists(":TOhtml") && has("user_commands") - command -range=% -bar TOhtml :call tohtml#Convert2HTML(, ) -endif "}}} - -" Make sure any patches will probably use consistent indent -" vim: ts=8 sw=2 sts=2 noet fdm=marker diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim deleted file mode 100644 index 5fbdad90f3..0000000000 --- a/runtime/syntax/2html.vim +++ /dev/null @@ -1,2068 +0,0 @@ -" Vim syntax support file -" Maintainer: Ben Fritz -" Last Change: 2023 Sep 05 -" -" Additional contributors: -" -" Original by Bram Moolenaar -" Modified by David Ne\v{c}as (Yeti) -" XHTML support by Panagiotis Issaris -" Made w3 compliant by Edd Barrett -" Added html_font. Edd Barrett -" Progress bar based off code from "progressbar widget" plugin by -" Andreas Politz, heavily modified: -" http://www.vim.org/scripts/script.php?script_id=2006 -" -" See Mercurial change logs for more! - -" Transform a file into HTML, using the current syntax highlighting. - -" this file uses line continuations -let s:cpo_sav = &cpo -let s:ls = &ls -let s:ei_sav = &eventignore -set cpo&vim - -" HTML filetype can take a while to load/highlight if the destination file -" already exists. -set eventignore+=FileType - -let s:end=line('$') - -" Font -if exists("g:html_font") - if type(g:html_font) == type([]) - let s:htmlfont = "'".. join(g:html_font,"','") .. "', monospace" - else - let s:htmlfont = "'".. g:html_font .. "', monospace" - endif -else - let s:htmlfont = "monospace" -endif - -let s:settings = tohtml#GetUserSettings() - -if s:settings.use_xhtml - let s:html5 = 0 -elseif s:settings.use_css && !s:settings.no_pre - let s:html5 = 1 -else - let s:html5 = 0 -endif - -if !exists('s:FOLDED_ID') - let s:FOLDED_ID = hlID("Folded") | lockvar s:FOLDED_ID - let s:FOLD_C_ID = hlID("FoldColumn") | lockvar s:FOLD_C_ID - let s:LINENR_ID = hlID('LineNr') | lockvar s:LINENR_ID - let s:DIFF_D_ID = hlID("DiffDelete") | lockvar s:DIFF_D_ID - let s:DIFF_A_ID = hlID("DiffAdd") | lockvar s:DIFF_A_ID - let s:DIFF_C_ID = hlID("DiffChange") | lockvar s:DIFF_C_ID - let s:DIFF_T_ID = hlID("DiffText") | lockvar s:DIFF_T_ID - let s:CONCEAL_ID = hlID('Conceal') | lockvar s:CONCEAL_ID -endif - -" Whitespace -if s:settings.pre_wrap - let s:whitespace = "white-space: pre-wrap; " -else - let s:whitespace = "" -endif - -if !empty(s:settings.prevent_copy) - if s:settings.no_invalid - " User has decided they don't want invalid markup. Still works in - " OpenOffice, and for text editors, but when pasting into Microsoft Word the - " input elements get pasted too and they cannot be deleted (at least not - " easily). - let s:unselInputType = "" - else - " Prevent from copy-pasting the input elements into Microsoft Word where - " they cannot be deleted easily by deliberately inserting invalid markup. - let s:unselInputType = " type='invalid_input_type'" - endif -endif - -" When gui colors are not supported, we can only guess the colors. -" TODO - is this true anymore? Is there a way to ask the terminal what colors -" each number means or read them from some file? -if &termguicolors || has("gui_running") - let s:whatterm = "gui" -else - let s:whatterm = "cterm" - if &t_Co == 8 - let s:cterm_color = { - \ 0: "#808080", 1: "#ff6060", 2: "#00ff00", 3: "#ffff00", - \ 4: "#8080ff", 5: "#ff40ff", 6: "#00ffff", 7: "#ffffff" - \ } - else - let s:cterm_color = { - \ 0: "#000000", 1: "#c00000", 2: "#008000", 3: "#804000", - \ 4: "#0000c0", 5: "#c000c0", 6: "#008080", 7: "#c0c0c0", - \ 8: "#808080", 9: "#ff6060", 10: "#00ff00", 11: "#ffff00", - \ 12: "#8080ff", 13: "#ff40ff", 14: "#00ffff", 15: "#ffffff" - \ } - - " Colors for 88 and 256 come from xterm. - if &t_Co == 88 - call extend(s:cterm_color, { - \ 16: "#000000", 17: "#00008b", 18: "#0000cd", 19: "#0000ff", - \ 20: "#008b00", 21: "#008b8b", 22: "#008bcd", 23: "#008bff", - \ 24: "#00cd00", 25: "#00cd8b", 26: "#00cdcd", 27: "#00cdff", - \ 28: "#00ff00", 29: "#00ff8b", 30: "#00ffcd", 31: "#00ffff", - \ 32: "#8b0000", 33: "#8b008b", 34: "#8b00cd", 35: "#8b00ff", - \ 36: "#8b8b00", 37: "#8b8b8b", 38: "#8b8bcd", 39: "#8b8bff", - \ 40: "#8bcd00", 41: "#8bcd8b", 42: "#8bcdcd", 43: "#8bcdff", - \ 44: "#8bff00", 45: "#8bff8b", 46: "#8bffcd", 47: "#8bffff", - \ 48: "#cd0000", 49: "#cd008b", 50: "#cd00cd", 51: "#cd00ff", - \ 52: "#cd8b00", 53: "#cd8b8b", 54: "#cd8bcd", 55: "#cd8bff", - \ 56: "#cdcd00", 57: "#cdcd8b", 58: "#cdcdcd", 59: "#cdcdff", - \ 60: "#cdff00", 61: "#cdff8b", 62: "#cdffcd", 63: "#cdffff", - \ 64: "#ff0000" - \ }) - call extend(s:cterm_color, { - \ 65: "#ff008b", 66: "#ff00cd", 67: "#ff00ff", 68: "#ff8b00", - \ 69: "#ff8b8b", 70: "#ff8bcd", 71: "#ff8bff", 72: "#ffcd00", - \ 73: "#ffcd8b", 74: "#ffcdcd", 75: "#ffcdff", 76: "#ffff00", - \ 77: "#ffff8b", 78: "#ffffcd", 79: "#ffffff", 80: "#2e2e2e", - \ 81: "#5c5c5c", 82: "#737373", 83: "#8b8b8b", 84: "#a2a2a2", - \ 85: "#b9b9b9", 86: "#d0d0d0", 87: "#e7e7e7" - \ }) - elseif &t_Co == 256 - call extend(s:cterm_color, { - \ 16: "#000000", 17: "#00005f", 18: "#000087", 19: "#0000af", - \ 20: "#0000d7", 21: "#0000ff", 22: "#005f00", 23: "#005f5f", - \ 24: "#005f87", 25: "#005faf", 26: "#005fd7", 27: "#005fff", - \ 28: "#008700", 29: "#00875f", 30: "#008787", 31: "#0087af", - \ 32: "#0087d7", 33: "#0087ff", 34: "#00af00", 35: "#00af5f", - \ 36: "#00af87", 37: "#00afaf", 38: "#00afd7", 39: "#00afff", - \ 40: "#00d700", 41: "#00d75f", 42: "#00d787", 43: "#00d7af", - \ 44: "#00d7d7", 45: "#00d7ff", 46: "#00ff00", 47: "#00ff5f", - \ 48: "#00ff87", 49: "#00ffaf", 50: "#00ffd7", 51: "#00ffff", - \ 52: "#5f0000", 53: "#5f005f", 54: "#5f0087", 55: "#5f00af", - \ 56: "#5f00d7", 57: "#5f00ff", 58: "#5f5f00", 59: "#5f5f5f", - \ 60: "#5f5f87", 61: "#5f5faf", 62: "#5f5fd7", 63: "#5f5fff", - \ 64: "#5f8700" - \ }) - call extend(s:cterm_color, { - \ 65: "#5f875f", 66: "#5f8787", 67: "#5f87af", 68: "#5f87d7", - \ 69: "#5f87ff", 70: "#5faf00", 71: "#5faf5f", 72: "#5faf87", - \ 73: "#5fafaf", 74: "#5fafd7", 75: "#5fafff", 76: "#5fd700", - \ 77: "#5fd75f", 78: "#5fd787", 79: "#5fd7af", 80: "#5fd7d7", - \ 81: "#5fd7ff", 82: "#5fff00", 83: "#5fff5f", 84: "#5fff87", - \ 85: "#5fffaf", 86: "#5fffd7", 87: "#5fffff", 88: "#870000", - \ 89: "#87005f", 90: "#870087", 91: "#8700af", 92: "#8700d7", - \ 93: "#8700ff", 94: "#875f00", 95: "#875f5f", 96: "#875f87", - \ 97: "#875faf", 98: "#875fd7", 99: "#875fff", 100: "#878700", - \ 101: "#87875f", 102: "#878787", 103: "#8787af", 104: "#8787d7", - \ 105: "#8787ff", 106: "#87af00", 107: "#87af5f", 108: "#87af87", - \ 109: "#87afaf", 110: "#87afd7", 111: "#87afff", 112: "#87d700" - \ }) - call extend(s:cterm_color, { - \ 113: "#87d75f", 114: "#87d787", 115: "#87d7af", 116: "#87d7d7", - \ 117: "#87d7ff", 118: "#87ff00", 119: "#87ff5f", 120: "#87ff87", - \ 121: "#87ffaf", 122: "#87ffd7", 123: "#87ffff", 124: "#af0000", - \ 125: "#af005f", 126: "#af0087", 127: "#af00af", 128: "#af00d7", - \ 129: "#af00ff", 130: "#af5f00", 131: "#af5f5f", 132: "#af5f87", - \ 133: "#af5faf", 134: "#af5fd7", 135: "#af5fff", 136: "#af8700", - \ 137: "#af875f", 138: "#af8787", 139: "#af87af", 140: "#af87d7", - \ 141: "#af87ff", 142: "#afaf00", 143: "#afaf5f", 144: "#afaf87", - \ 145: "#afafaf", 146: "#afafd7", 147: "#afafff", 148: "#afd700", - \ 149: "#afd75f", 150: "#afd787", 151: "#afd7af", 152: "#afd7d7", - \ 153: "#afd7ff", 154: "#afff00", 155: "#afff5f", 156: "#afff87", - \ 157: "#afffaf", 158: "#afffd7" - \ }) - call extend(s:cterm_color, { - \ 159: "#afffff", 160: "#d70000", 161: "#d7005f", 162: "#d70087", - \ 163: "#d700af", 164: "#d700d7", 165: "#d700ff", 166: "#d75f00", - \ 167: "#d75f5f", 168: "#d75f87", 169: "#d75faf", 170: "#d75fd7", - \ 171: "#d75fff", 172: "#d78700", 173: "#d7875f", 174: "#d78787", - \ 175: "#d787af", 176: "#d787d7", 177: "#d787ff", 178: "#d7af00", - \ 179: "#d7af5f", 180: "#d7af87", 181: "#d7afaf", 182: "#d7afd7", - \ 183: "#d7afff", 184: "#d7d700", 185: "#d7d75f", 186: "#d7d787", - \ 187: "#d7d7af", 188: "#d7d7d7", 189: "#d7d7ff", 190: "#d7ff00", - \ 191: "#d7ff5f", 192: "#d7ff87", 193: "#d7ffaf", 194: "#d7ffd7", - \ 195: "#d7ffff", 196: "#ff0000", 197: "#ff005f", 198: "#ff0087", - \ 199: "#ff00af", 200: "#ff00d7", 201: "#ff00ff", 202: "#ff5f00", - \ 203: "#ff5f5f", 204: "#ff5f87" - \ }) - call extend(s:cterm_color, { - \ 205: "#ff5faf", 206: "#ff5fd7", 207: "#ff5fff", 208: "#ff8700", - \ 209: "#ff875f", 210: "#ff8787", 211: "#ff87af", 212: "#ff87d7", - \ 213: "#ff87ff", 214: "#ffaf00", 215: "#ffaf5f", 216: "#ffaf87", - \ 217: "#ffafaf", 218: "#ffafd7", 219: "#ffafff", 220: "#ffd700", - \ 221: "#ffd75f", 222: "#ffd787", 223: "#ffd7af", 224: "#ffd7d7", - \ 225: "#ffd7ff", 226: "#ffff00", 227: "#ffff5f", 228: "#ffff87", - \ 229: "#ffffaf", 230: "#ffffd7", 231: "#ffffff", 232: "#080808", - \ 233: "#121212", 234: "#1c1c1c", 235: "#262626", 236: "#303030", - \ 237: "#3a3a3a", 238: "#444444", 239: "#4e4e4e", 240: "#585858", - \ 241: "#626262", 242: "#6c6c6c", 243: "#767676", 244: "#808080", - \ 245: "#8a8a8a", 246: "#949494", 247: "#9e9e9e", 248: "#a8a8a8", - \ 249: "#b2b2b2", 250: "#bcbcbc", 251: "#c6c6c6", 252: "#d0d0d0", - \ 253: "#dadada", 254: "#e4e4e4", 255: "#eeeeee" - \ }) - endif - endif -endif - -" Return good color specification: in GUI no transformation is done, in -" terminal return RGB values of known colors and empty string for unknown -if s:whatterm == "gui" - function! s:HtmlColor(color) - return a:color - endfun -else - function! s:HtmlColor(color) - if has_key(s:cterm_color, a:color) - return s:cterm_color[a:color] - else - return "" - endif - endfun -endif - -" Find out the background and foreground color for use later -let s:fgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "fg#", s:whatterm)) -let s:bgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "bg#", s:whatterm)) -if s:fgc == "" - let s:fgc = ( &background == "dark" ? "#ffffff" : "#000000" ) -endif -if s:bgc == "" - let s:bgc = ( &background == "dark" ? "#000000" : "#ffffff" ) -endif - -if !s:settings.use_css - " Return opening HTML tag for given highlight id - function! s:HtmlOpening(id, extra_attrs) - let a = "" - let translated_ID = synIDtrans(a:id) - if synIDattr(translated_ID, "inverse") - " For inverse, we always must set both colors (and exchange them) - let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) - let a = a .. '' - let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) - let a = a .. '' - else - let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) - if x != "" - let a = a .. '' - elseif !empty(a:extra_attrs) - let a = a .. '' - endif - let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) - if x != "" | let a = a .. '' | endif - endif - if synIDattr(translated_ID, "bold") | let a = a .. "" | endif - if synIDattr(translated_ID, "italic") | let a = a .. "" | endif - if synIDattr(translated_ID, "underline") | let a = a .. "" | endif - return a - endfun - - " Return closing HTML tag for given highlight id - function! s:HtmlClosing(id, has_extra_attrs) - let a = "" - let translated_ID = synIDtrans(a:id) - if synIDattr(translated_ID, "underline") | let a = a .. "" | endif - if synIDattr(translated_ID, "italic") | let a = a .. "" | endif - if synIDattr(translated_ID, "bold") | let a = a .. "" | endif - if synIDattr(translated_ID, "inverse") - let a = a .. '' - else - let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) - if x != "" | let a = a .. '' | endif - let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) - if x != "" || a:has_extra_attrs | let a = a .. '' | endif - endif - return a - endfun -endif - -" Use a different function for formatting based on user options. This way we -" can avoid a lot of logic during the actual execution. -" -" Build the function line by line containing only what is needed for the options -" in use for maximum code sharing with minimal branch logic for greater speed. -" -" Note, 'exec' commands do not recognize line continuations, so must concatenate -" lines rather than continue them. -if s:settings.use_css - " save CSS to a list of rules to add to the output at the end of processing - - " first, get the style names we need - let s:wrapperfunc_lines = [] - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselectable, unformatted) - - let l:style_name = synIDattr(a:style_id, "name", s:whatterm) - ENDLET - if &diff - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - let l:diff_style_name = synIDattr(a:diff_style_id, "name", s:whatterm) - ENDLET - - " Add normal groups and diff groups to separate lists so we can order them to - " allow diff highlight to override normal highlight - - " if primary style IS a diff style, grab it from the diff cache instead - " (always succeeds because we pre-populate it) - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - - if a:style_id == s:DIFF_D_ID || a:style_id == s:DIFF_A_ID || a:style_id == s:DIFF_C_ID || a:style_id == s:DIFF_T_ID - let l:saved_style = get(s:diffstylelist,a:style_id) - else - ENDLET - endif - - " get primary style info from cache or build it on the fly if not found - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - let l:saved_style = get(s:stylelist,a:style_id) - if type(l:saved_style) == type(0) - unlet l:saved_style - let l:saved_style = s:CSS1(a:style_id) - if l:saved_style != "" - let l:saved_style = "." .. l:style_name .. " { " .. l:saved_style .. "}" - endif - let s:stylelist[a:style_id] = l:saved_style - endif - ENDLET - if &diff - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - endif - ENDLET - endif -" Ignore this comment, just bypassing a highlighting issue: if - - " Build the wrapper tags around the text. It turns out that caching these - " gives pretty much zero performance gain and adds a lot of logic. - - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - - if l:saved_style == "" && empty(a:extra_attrs) - ENDLET - if &diff - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - if a:diff_style_id <= 0 - ENDLET - endif - " no surroundings if neither primary nor diff style has any info - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - return a:text - ENDLET - if &diff - " no primary style, but diff style - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - else - return ''..a:text.."" - endif - ENDLET - endif - " Ignore this comment, just bypassing a highlighting issue: if - - " open tag for non-empty primary style - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - else - ENDLET - " non-empty primary style. handle either empty or non-empty diff style. - " - " separate the two classes by a space to apply them both if there is a diff - " style name, unless the primary style is empty, then just use the diff style - " name - let s:diffstyle = - \ (&diff ? '(a:diff_style_id <= 0 ? "" : " " .. l:diff_style_name)..' - \ : '') - if s:settings.prevent_copy == "" - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim eval ENDLET - return "'..a:text.."" - ENDLET - else - - " New method: use generated content in the CSS. The only thing needed here - " is a span with no content, with an attribute holding the desired text. - " - " Old method: use an element when text is unsectable. This is still - " used in conditional comments for Internet Explorer, where the new method - " doesn't work. - " - " Wrap the in a to allow fixing the stupid bug in some fonts - " which cause browsers to display a 1px gap between lines when these - " s have a background color (maybe not really a bug, this isn't - " well-defined) - " - " use strwidth, because we care only about how many character boxes are - " needed to size the input, we don't care how many characters (including - " separately counted composing chars, from strchars()) or bytes (from - " len())the string contains. strdisplaywidth() is not needed because none of - " the unselectable groups can contain tab characters (fold column, fold - " text, line number). - " - " Note, if maxlength property needs to be added in the future, it will need - " to use strchars(), because HTML specifies that the maxlength parameter - " uses the number of unique codepoints for its limit. - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim eval ENDLET - if a:make_unselectable - let return_span = "' : '>') - ENDLET - endif - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim eval ENDLET - return return_span..'' - else - return "'..a:text.."" - endif - ENDLET - endif - call add(s:wrapperfunc_lines, []) - let s:wrapperfunc_lines[-1] =<< trim ENDLET - endif - endfun - ENDLET -else - " Non-CSS method just needs the wrapper. - " - " Functions used to get opening/closing automatically return null strings if - " no styles exist. - if &diff - let s:wrapperfunc_lines =<< trim ENDLET - function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2) - if a:diff_style_id <= 0 - let l:diff_opening = s:HtmlOpening(a:diff_style_id, "") - let l:diff_closing = s:HtmlClosing(a:diff_style_id, 0) - else - let l:diff_opening = "" - let l:diff_closing = "" - endif - return s:HtmlOpening(a:style_id, a:extra_attrs)..l:diff_opening..a:text..l:diff_closing..s:HtmlClosing(a:style_id, !empty(a:extra_attrs)) - endfun - ENDLET - else - let s:wrapperfunc_lines =<< trim ENDLET - function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2) - return s:HtmlOpening(a:style_id, a:extra_attrs)..a:text..s:HtmlClosing(a:style_id, !empty(a:extra_attrs)) - endfun - ENDLET - endif -endif - -" create the function we built line by line above -exec join(flatten(s:wrapperfunc_lines), "\n") - -let s:diff_mode = &diff - -" Return HTML valid characters enclosed in a span of class style_name with -" unprintable characters expanded and double spaces replaced as necessary. -" -" TODO: eliminate unneeded logic like done for BuildStyleWrapper -function! s:HtmlFormat(text, style_id, diff_style_id, extra_attrs, make_unselectable) - " Replace unprintable characters - let unformatted = strtrans(a:text) - - let formatted = unformatted - - " Replace the reserved html characters - let formatted = substitute(formatted, '&', '\&', 'g') - let formatted = substitute(formatted, '<', '\<', 'g') - let formatted = substitute(formatted, '>', '\>', 'g') - let formatted = substitute(formatted, '"', '\"', 'g') - " ' is not valid in HTML but it is in XHTML, so just use the numeric - " reference for it instead. Needed because it could appear in quotes - " especially if unselectable regions is turned on. - let formatted = substitute(formatted, '"', '\'', 'g') - - " Replace a "form feed" character with HTML to do a page break - " TODO: need to prevent this in unselectable areas? Probably it should never - " BE in an unselectable area... - let formatted = substitute(formatted, "\x0c", '
', 'g') - - " Replace double spaces, leading spaces, and trailing spaces if needed - if ' ' != s:HtmlSpace - let formatted = substitute(formatted, ' ', s:HtmlSpace .. s:HtmlSpace, 'g') - let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g') - let formatted = substitute(formatted, ' \+$', s:HtmlSpace, 'g') - endif - - " Enclose in the correct format - return s:BuildStyleWrapper(a:style_id, a:diff_style_id, a:extra_attrs, formatted, a:make_unselectable, unformatted) -endfun - -" set up functions to call HtmlFormat in certain ways based on whether the -" element is supposed to be unselectable or not -if s:settings.prevent_copy =~# 'n' - if s:settings.number_lines - if s:settings.line_ids - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - if a:lnr > 0 - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 1) - else - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) - endif - endfun - else - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) - endfun - endif - elseif s:settings.line_ids - " if lines are not being numbered the only reason this function gets called - " is to put the line IDs on each line; "text" will be empty but lnr will - " always be non-zero, however we don't want to use the because that - " won't work as nice for empty text - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0) - endfun - endif -else - if s:settings.line_ids - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - if a:lnr > 0 - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0) - else - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) - endif - endfun - else - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) - endfun - endif -endif -if s:settings.prevent_copy =~# 'd' - function! s:HtmlFormat_d(text, style_id, diff_style_id) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) - endfun -else - function! s:HtmlFormat_d(text, style_id, diff_style_id) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) - endfun -endif -if s:settings.prevent_copy =~# 'f' - if s:settings.use_input_for_pc ==# 'none' - " Simply space-pad to the desired width inside the generated content (note - " that the FoldColumn definition includes a whitespace:pre rule) - function! s:FoldColumn_build(char, len, numfill, char2, class, click) - return "
" - endfun - function! s:FoldColumn_fill() - return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 1) - endfun - else - " Note the elements for fill spaces will have a single space for - " content, to allow active cursor CSS selection to work. - " - " Wrap the whole thing in a span for the 1px padding workaround for gaps. - " - " Build the function line by line containing only what is needed for the - " options in use for maximum code sharing with minimal branch logic for - " greater speed. - " - " Note, 'exec' commands do not recognize line continuations, so must - " concatenate lines rather than continue them. - let s:build_fun_lines = [] - call add(s:build_fun_lines, []) - let s:build_fun_lines[-1] =<< trim ENDLET - function! s:FoldColumn_build(char, len, numfill, char2, class, click) - let l:input_open = "" : "'>") - let l:return_span = "" - let l:return_span ..= l:input_open..l:common_attrs..repeat(a:char, a:len)..(a:char2) - let l:return_span ..= l:input_close - ENDLET - if s:settings.use_input_for_pc ==# 'fallback' - call add(s:build_fun_lines, []) - let s:build_fun_lines[-1] =<< trim ENDLET - let l:return_span ..= "". - \ repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill). - \ "" - endfun - function! s:FoldColumn_fill() - return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 0) - endfun -endif -if s:settings.prevent_copy =~# 't' - " put an extra empty span at the end for dynamic folds, so the linebreak can - " be surrounded. Otherwise do it as normal. - " - " TODO: isn't there a better way to do this, than placing it here and using a - " substitute later? - if s:settings.dynamic_folds - function! s:HtmlFormat_t(text, style_id, diff_style_id) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) . - \ s:HtmlFormat("", a:style_id, 0, "", 0) - endfun - else - function! s:HtmlFormat_t(text, style_id, diff_style_id) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) - endfun - endif -else - function! s:HtmlFormat_t(text, style_id, diff_style_id) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) - endfun -endif - -" Return CSS style describing given highlight id (can be empty) -function! s:CSS1(id) - let a = "" - let translated_ID = synIDtrans(a:id) - if synIDattr(translated_ID, "inverse") - " For inverse, we always must set both colors (and exchange them) - let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) - let a = a .. "color: " .. ( x != "" ? x : s:bgc ) .. "; " - let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) - let a = a .. "background-color: " .. ( x != "" ? x : s:fgc ) .. "; " - else - let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm)) - if x != "" | let a = a .. "color: " .. x .. "; " | endif - let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm)) - if x != "" - let a = a .. "background-color: " .. x .. "; " - " stupid hack because almost every browser seems to have at least one font - " which shows 1px gaps between lines which have background - let a = a .. "padding-bottom: 1px; " - elseif (translated_ID == s:FOLDED_ID || translated_ID == s:LINENR_ID || translated_ID == s:FOLD_C_ID) && !empty(s:settings.prevent_copy) - " input elements default to a different color than the rest of the page - let a = a .. "background-color: " .. s:bgc .. "; " - endif - endif - if synIDattr(translated_ID, "bold") | let a = a .. "font-weight: bold; " | endif - if synIDattr(translated_ID, "italic") | let a = a .. "font-style: italic; " | endif - if synIDattr(translated_ID, "underline") | let a = a .. "text-decoration: underline; " | endif - return a -endfun - -if s:settings.dynamic_folds - " compares two folds as stored in our list of folds - " A fold is "less" than another if it starts at an earlier line number, - " or ends at a later line number, ties broken by fold level - function! s:FoldCompare(f1, f2) - if a:f1.firstline != a:f2.firstline - " put it before if it starts earlier - return a:f1.firstline - a:f2.firstline - elseif a:f1.lastline != a:f2.lastline - " put it before if it ends later - return a:f2.lastline - a:f1.lastline - else - " if folds begin and end on the same lines, put lowest fold level first - return a:f1.level - a:f2.level - endif - endfunction - -endif - - -" Set some options to make it work faster. -" Don't report changes for :substitute, there will be many of them. -" Don't change other windows; turn off scroll bind temporarily -let s:old_title = &title -let s:old_icon = &icon -let s:old_et = &l:et -let s:old_bind = &l:scrollbind -let s:old_report = &report -let s:old_search = @/ -let s:old_more = &more -set notitle noicon -setlocal et -set nomore -set report=1000000 -setlocal noscrollbind - -if exists(':ownsyntax') && exists('w:current_syntax') - let s:current_syntax = w:current_syntax -elseif exists('b:current_syntax') - let s:current_syntax = b:current_syntax -else - let s:current_syntax = 'none' -endif - -if s:current_syntax == '' - let s:current_syntax = 'none' -endif - -" If the user is sourcing this script directly then the plugin version isn't -" known because the main plugin script didn't load. In the usual case where the -" user still has the full Vim runtime installed, or has this full plugin -" installed in a package or something, then we can extract the version from the -" main plugin file at it's usual spot relative to this file. Otherwise the user -" is assembling their runtime piecemeal and we have no idea what versions of -" other files may be present so don't even try to make a guess or assume the -" presence of other specific files with specific meaning. -" -" We don't want to actually source the main plugin file here because the user -" may have a good reason not to (e.g. they define their own TOhtml command or -" something). -" -" If this seems way too complicated and convoluted, it is. Probably I should -" have put the version information in the autoload file from the start. But the -" version has been in the global variable for so long that changing it could -" break a lot of user scripts. -if exists("g:loaded_2html_plugin") - let s:pluginversion = g:loaded_2html_plugin -else - if !exists("g:unloaded_tohtml_plugin") - let s:main_plugin_path = expand(":p:h:h").."/plugin/tohtml.vim" - if filereadable(s:main_plugin_path) - let s:lines = readfile(s:main_plugin_path, "", 20) - call filter(s:lines, 'v:val =~ "loaded_2html_plugin = "') - if empty(s:lines) - let g:unloaded_tohtml_plugin = "unknown" - else - let g:unloaded_tohtml_plugin = substitute(s:lines[0], '.*loaded_2html_plugin = \([''"]\)\(\%(\1\@!.\)\+\)\1', '\2', '') - endif - unlet s:lines - else - let g:unloaded_tohtml_plugin = "unknown" - endif - unlet s:main_plugin_path - endif - let s:pluginversion = g:unloaded_tohtml_plugin -endif - -" Split window to create a buffer with the HTML file. -let s:orgbufnr = winbufnr(0) -let s:origwin_stl = &l:stl -if expand("%") == "" - if exists('g:html_diff_win_num') - exec 'new Untitled_win'..g:html_diff_win_num..'.'.(s:settings.use_xhtml ? 'xhtml' : 'html') - else - exec 'new Untitled.'..(s:settings.use_xhtml ? 'xhtml' : 'html') - endif -else - exec 'new %.'..(s:settings.use_xhtml ? 'xhtml' : 'html') -endif - -" Resize the new window to very small in order to make it draw faster -let s:old_winheight = winheight(0) -let s:old_winfixheight = &l:winfixheight -if s:old_winheight > 2 - resize 1 " leave enough room to view one line at a time - norm! G - norm! zt -endif -setlocal winfixheight - -let s:newwin_stl = &l:stl - -" on the new window, set the least time-consuming fold method -let s:old_fen = &foldenable -setlocal foldmethod=manual -setlocal nofoldenable - -let s:newwin = winnr() -let s:orgwin = bufwinnr(s:orgbufnr) - -setlocal modifiable -%d -let s:old_paste = &paste -set paste -let s:old_magic = &magic -set magic - -" set the fileencoding to match the charset we'll be using -let &l:fileencoding=s:settings.vim_encoding - -" According to http://www.w3.org/TR/html4/charset.html#doc-char-set, the byte -" order mark is highly recommend on the web when using multibyte encodings. But, -" it is not a good idea to include it on UTF-8 files. Otherwise, let Vim -" determine when it is actually inserted. -if s:settings.vim_encoding == 'utf-8' - setlocal nobomb -else - setlocal bomb -endif - -let s:lines = [] - -if s:settings.use_xhtml - if s:settings.encoding != "" - call add(s:lines, "") - else - call add(s:lines, "") - endif - let s:tag_close = ' />' -else - let s:tag_close = '>' -endif - -let s:HtmlSpace = ' ' -let s:LeadingSpace = ' ' -let s:HtmlEndline = '' -if s:settings.no_pre - let s:HtmlEndline = '", - \ ""]) - " include encoding as close to the top as possible, but only if not already - " contained in XML information (to avoid haggling over content type) - if s:settings.encoding != "" && !s:settings.use_xhtml - if s:html5 - call add(s:lines, '"..expand("%:p:~")..""), - \ ("", - \ s:settings.use_xhtml ? "" : "", - \] - else - " if we aren't doing hover_unfold, use CSS 1 only - call extend(s:lines, [ - \ ".FoldColumn { text-decoration: none; white-space: pre; }", - \ ".open-fold .fulltext { display: inline; }", - \ ".open-fold span.Folded { display: none; }", - \ ".open-fold .toggle-open { display: none; }", - \ ".open-fold .toggle-closed { display: inline; }", - \ "", - \ ".closed-fold .fulltext { display: none; }", - \ ".closed-fold span.Folded { display: inline; }", - \ ".closed-fold .toggle-open { display: inline; }", - \ ".closed-fold .toggle-closed { display: none; }", - \]) - endif - endif - " else we aren't doing any dynamic folding, no need for any special rules - - call extend(s:lines, [ - \ s:settings.use_xhtml ? "" : '-->', - \ "", - \]) - call extend(s:lines, s:ieonly) - unlet s:ieonly - endif - - let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids - - " insert script tag if needed - if s:uses_script - call extend(s:lines, [ - \ "", - \ "", - \ s:settings.use_xhtml ? '//' : '-->', - \ "" - \ ]) - endif - - call extend(s:lines, ["", - \ ""]) -endif - -if s:settings.no_pre - " if we're not using CSS we use a font tag which can't have a div inside - if s:settings.use_css - call extend(s:lines, ["
"]) - endif -else - call extend(s:lines, ["
"])
-endif
-
-exe s:orgwin .. "wincmd w"
-
-" caches of style data
-" initialize to include line numbers if using them
-if s:settings.number_lines
-  let s:stylelist = { s:LINENR_ID : ".LineNr { " .. s:CSS1( s:LINENR_ID ) .. "}" }
-else
-  let s:stylelist = {}
-endif
-let s:diffstylelist = {
-      \   s:DIFF_A_ID : ".DiffAdd { " .. s:CSS1( s:DIFF_A_ID ) .. "}",
-      \   s:DIFF_C_ID : ".DiffChange { " .. s:CSS1( s:DIFF_C_ID ) .. "}",
-      \   s:DIFF_D_ID : ".DiffDelete { " .. s:CSS1( s:DIFF_D_ID ) .. "}",
-      \   s:DIFF_T_ID : ".DiffText { " .. s:CSS1( s:DIFF_T_ID ) .. "}"
-      \ }
-
-" set up progress bar in the status line
-if !s:settings.no_progress
-  " ProgressBar Indicator
-  let s:progressbar={}
-
-  " Progressbar specific functions
-
-  func! s:SetProgbarColor()
-    if hlID("TOhtmlProgress") != 0
-      hi! link TOhtmlProgress_auto TOhtmlProgress
-    elseif hlID("TOhtmlProgress_auto")==0 ||
-       \ !exists("s:last_colors_name") || !exists("g:colors_name") ||
-       \ g:colors_name != s:last_colors_name
-      let s:last_colors_name = exists("g:colors_name") ? g:colors_name : "none"
-
-      let l:diffatr = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
-      let l:stlatr = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
-
-      let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), l:diffatr, s:whatterm)
-      let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), l:stlatr, s:whatterm)
-
-      if "" == l:progbar_color
-	let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
-      endif
-      if "" == l:stl_color
-	let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
-      endif
-
-      if l:progbar_color == l:stl_color
-	if s:whatterm == 'cterm'
-	  if l:progbar_color >= (&t_Co/2)
-	    let l:progbar_color-=1
-	  else
-	    let l:progbar_color+=1
-	  endif
-	else
-	  let l:rgb = map(matchlist(l:progbar_color, '#\zs\x\x\ze\(\x\x\)\(\x\x\)')[:2], 'str2nr(v:val, 16)')
-	  let l:avg = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
-	  if l:avg >= 128
-	    let l:avg_new = l:avg
-	    while l:avg - l:avg_new < 0x15
-	      let l:rgb = map(l:rgb, 'v:val * 3 / 4')
-	      let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
-	    endwhile
-	  else
-	    let l:avg_new = l:avg
-	    while l:avg_new - l:avg < 0x15
-	      let l:rgb = map(l:rgb, 'min([max([v:val, 4]) * 5 / 4, 255])')
-	      let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
-	    endwhile
-	  endif
-	  let l:progbar_color = printf("#%02x%02x%02x", l:rgb[0], l:rgb[1], l:rgb[2])
-	endif
-	echomsg "diff detected progbar color set to" l:progbar_color
-      endif
-      exe "hi TOhtmlProgress_auto" s:whatterm.."bg="..l:progbar_color
-    endif
-  endfun
-
-  func! s:ProgressBar(title, max_value, winnr)
-    let pgb=copy(s:progressbar)
-    let pgb.title = a:title..' '
-    let pgb.max_value = a:max_value
-    let pgb.winnr = a:winnr
-    let pgb.cur_value = 0
-
-    let pgb.items = { 'title'   : { 'color' : 'Statusline' },
-	  \'bar'     : { 'color' : 'Statusline' , 'fillcolor' : 'TOhtmlProgress_auto' , 'bg' : 'Statusline' } ,
-	  \'counter' : { 'color' : 'Statusline' } }
-    let pgb.last_value = 0
-    let pgb.needs_redraw = 0
-    " Note that you must use len(split) instead of len() if you want to use 
-    " unicode in title.
-    "
-    " Subtract 3 for spacing around the title.
-    " Subtract 4 for the percentage display.
-    " Subtract 2 for spacing before this.
-    " Subtract 2 more for the '|' on either side of the progress bar
-    let pgb.subtractedlen=len(split(pgb.title, '\zs'))+3+4+2+2
-    let pgb.max_len = 0
-    set laststatus=2
-    return pgb
-  endfun
-
-  " Function: progressbar.calculate_ticks() {{{1
-  func! s:progressbar.calculate_ticks(pb_len)
-    if a:pb_len<=0
-      let pb_len = 100
-    else
-      let pb_len = a:pb_len
-    endif
-    let self.progress_ticks = map(range(pb_len+1), "v:val * self.max_value / pb_len")
-  endfun
-
-  "Function: progressbar.paint()
-  func! s:progressbar.paint()
-    " Recalculate widths.
-    let max_len = winwidth(self.winnr)
-    let pb_len = 0
-    " always true on first call because of initial value of self.max_len
-    if max_len != self.max_len
-      let self.max_len = max_len
-
-      " Progressbar length
-      let pb_len = max_len - self.subtractedlen
-
-      call self.calculate_ticks(pb_len)
-
-      let self.needs_redraw = 1
-      let cur_value = 0
-      let self.pb_len = pb_len
-    else
-      " start searching at the last found index to make the search for the
-      " appropriate tick value normally take 0 or 1 comparisons
-      let cur_value = self.last_value
-      let pb_len = self.pb_len
-    endif
-
-    let cur_val_max = pb_len > 0 ? pb_len : 100
-
-    " find the current progress bar position based on precalculated thresholds
-    while cur_value < cur_val_max && self.cur_value > self.progress_ticks[cur_value]
-      let cur_value += 1
-    endwhile
-
-    " update progress bar
-    if self.last_value != cur_value || self.needs_redraw || self.cur_value == self.max_value
-      let self.needs_redraw = 1
-      let self.last_value = cur_value
-
-      let t_color  = self.items.title.color
-      let b_fcolor = self.items.bar.fillcolor
-      let b_color  = self.items.bar.color
-      let c_color  = self.items.counter.color
-
-      let stl =  "%#".t_color."#%-( ".self.title." %)".
-	    \"%#".b_color."#".
-	    \(pb_len>0 ?
-	    \	('|%#'.b_fcolor."#%-(".repeat(" ",cur_value)."%)".
-	    \	 '%#'.b_color."#".repeat(" ",pb_len-cur_value)."|"):
-	    \	('')).
-	    \"%=%#".c_color."#%( ".printf("%3.d ",100*self.cur_value/self.max_value)."%% %)"
-      call setwinvar(self.winnr, '&stl', stl)
-    endif
-  endfun
-
-  func! s:progressbar.incr( ... )
-    let self.cur_value += (a:0 ? a:1 : 1)
-    " if we were making a general-purpose progress bar, we'd need to limit to a
-    " lower limit as well, but since we always increment with a positive value
-    " in this script, we only need limit the upper value
-    let self.cur_value = (self.cur_value > self.max_value ? self.max_value : self.cur_value)
-    call self.paint()
-  endfun
-  " }}}
-  if s:settings.dynamic_folds
-    " to process folds we make two passes through each line
-    let s:pgb = s:ProgressBar("Processing folds:", line('$')*2, s:orgwin)
-  endif
-
-  call s:SetProgbarColor()
-endif
-
-let s:build_fun_lines = []
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
-    func! s:Add_diff_fill(lnum)
-      let l:filler = diff_filler(a:lnum)
-      if l:filler > 0
-	let l:to_insert = l:filler
-	while l:to_insert > 0
-	  let l:new = repeat(s:difffillchar, 3)
-
-	  if l:to_insert > 2 && l:to_insert < l:filler && !s:settings.whole_filler
-	    let l:new = l:new .. " " .. l:filler .. " inserted lines "
-	    let l:to_insert = 2
-	  endif
-ENDLET
-call add(s:build_fun_lines, [])
-if !s:settings.no_pre
-  let s:build_fun_lines[-1] =<< trim ENDLET
-	  " HTML line wrapping is off--go ahead and fill to the margin
-	  " TODO: what about when CSS wrapping is turned on?
-	  let l:new = l:new .. repeat(s:difffillchar, &columns - strlen(l:new) - s:margin)
-  ENDLET
-else
-  let s:build_fun_lines[-1] =<< trim ENDLET
-	  let l:new = l:new .. repeat(s:difffillchar, 3)
-  ENDLET
-endif
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
-	let l:new = s:HtmlFormat_d(l:new, s:DIFF_D_ID, 0)
-ENDLET
-if s:settings.number_lines
-  call add(s:build_fun_lines, [])
-  let s:build_fun_lines[-1] =<< trim ENDLET
-	  " Indent if line numbering is on. Indent gets style of line number
-	  " column.
-	  let l:new = s:HtmlFormat_n(repeat(' ', s:margin), s:LINENR_ID, 0, 0) .. l:new
-  ENDLET
-endif
-if s:settings.dynamic_folds && !s:settings.no_foldcolumn 
-  call add(s:build_fun_lines, [])
-  let s:build_fun_lines[-1] =<< trim ENDLET
-	  if s:foldcolumn > 0
-	    " Indent for foldcolumn if there is one. Assume it's empty, there should
-	    " not be a fold for deleted lines in diff mode.
-	    let l:new = s:FoldColumn_fill() .. l:new
-	  endif
-  ENDLET
-endif
-" Ignore this comment, just bypassing a highlighting issue: if
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
-	call add(s:lines, l:new..s:HtmlEndline)
-	let l:to_insert = l:to_insert - 1
-      endwhile
-    endif
-  endfun
-ENDLET
-exec join(flatten(s:build_fun_lines), "\n")
-
-" First do some preprocessing for dynamic folding. Do this for the entire file
-" so we don't accidentally start within a closed fold or something.
-let s:allfolds = []
-
-if s:settings.dynamic_folds
-  let s:lnum = 1
-  let s:end = line('$')
-  " save the fold text and set it to the default so we can find fold levels
-  let s:foldtext_save = &foldtext
-  setlocal foldtext&
-
-  " we will set the foldcolumn in the html to the greater of the maximum fold
-  " level and the current foldcolumn setting
-  let s:foldcolumn = &foldcolumn
-
-  " get all info needed to describe currently closed folds
-  while s:lnum <= s:end
-    if foldclosed(s:lnum) == s:lnum
-      " default fold text has '+-' and then a number of dashes equal to fold
-      " level, so subtract 2 from index of first non-dash after the dashes
-      " in order to get the fold level of the current fold
-      let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
-      " store fold info for later use
-      let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
-      call add(s:allfolds, s:newfold)
-      " open the fold so we can find any contained folds
-      execute s:lnum.."foldopen"
-    else
-      if !s:settings.no_progress
-	call s:pgb.incr()
-	if s:pgb.needs_redraw
-	  redrawstatus
-	  let s:pgb.needs_redraw = 0
-	endif
-      endif
-      let s:lnum = s:lnum + 1
-    endif
-  endwhile
-
-  " close all folds to get info for originally open folds
-  silent! %foldclose!
-  let s:lnum = 1
-
-  " the originally open folds will be all folds we encounter that aren't
-  " already in the list of closed folds
-  while s:lnum <= s:end
-    if foldclosed(s:lnum) == s:lnum
-      " default fold text has '+-' and then a number of dashes equal to fold
-      " level, so subtract 2 from index of first non-dash after the dashes
-      " in order to get the fold level of the current fold
-      let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
-      let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
-      " only add the fold if we don't already have it
-      if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
-	let s:newfold.type = "open-fold"
-	call add(s:allfolds, s:newfold)
-      endif
-      " open the fold so we can find any contained folds
-      execute s:lnum.."foldopen"
-    else
-      if !s:settings.no_progress
-	call s:pgb.incr()
-	if s:pgb.needs_redraw
-	  redrawstatus
-	  let s:pgb.needs_redraw = 0
-	endif
-      endif
-      let s:lnum = s:lnum + 1
-    endif
-  endwhile
-
-  " sort the folds so that we only ever need to look at the first item in the
-  " list of folds
-  call sort(s:allfolds, "s:FoldCompare")
-
-  let &l:foldtext = s:foldtext_save
-  unlet s:foldtext_save
-
-  " close all folds again so we can get the fold text as we go
-  silent! %foldclose!
-
-  " Go through and remove folds we don't need to (or cannot) process in the
-  " current conversion range
-  "
-  " If a fold is removed which contains other folds, which are included, we need
-  " to adjust the level of the included folds as used by the conversion logic
-  " (avoiding special cases is good)
-  "
-  " Note any time we remove a fold, either all of the included folds are in it,
-  " or none of them, because we only remove a fold if neither its start nor its
-  " end are within the conversion range.
-  let leveladjust = 0
-  for afold in s:allfolds
-    let removed = 0
-    if exists("g:html_start_line") && exists("g:html_end_line")
-      if afold.firstline < g:html_start_line
-	if afold.lastline <= g:html_end_line && afold.lastline >= g:html_start_line
-	  " if a fold starts before the range to convert but stops within the
-	  " range, we need to include it. Make it start on the first converted
-	  " line.
-	  let afold.firstline = g:html_start_line
-	else
-	  " if the fold lies outside the range or the start and stop enclose
-	  " the entire range, don't bother parsing it
-	  call remove(s:allfolds, index(s:allfolds, afold))
-	  let removed = 1
-	  if afold.lastline > g:html_end_line
-	    let leveladjust += 1
-	  endif
-	endif
-      elseif afold.firstline > g:html_end_line
-	" If the entire fold lies outside the range we need to remove it.
-	call remove(s:allfolds, index(s:allfolds, afold))
-	let removed = 1
-      endif
-    elseif exists("g:html_start_line")
-      if afold.firstline < g:html_start_line
-	" if there is no last line, but there is a first line, the end of the
-	" fold will always lie within the region of interest, so keep it
-	let afold.firstline = g:html_start_line
-      endif
-    elseif exists("g:html_end_line")
-      " if there is no first line we default to the first line in the buffer so
-      " the fold start will always be included if the fold itself is included.
-      " If however the entire fold lies outside the range we need to remove it.
-      if afold.firstline > g:html_end_line
-	call remove(s:allfolds, index(s:allfolds, afold))
-	let removed = 1
-      endif
-    endif
-    if !removed
-      let afold.level -= leveladjust
-      if afold.level+1 > s:foldcolumn
-	let s:foldcolumn = afold.level+1
-      endif
-    endif
-  endfor
-
-  " if we've removed folds containing the conversion range from processing,
-  " getting foldtext as we go won't know to open the removed folds, so the
-  " foldtext would be wrong; open them now.
-  "
-  " Note that only when a start and an end line is specified will a fold
-  " containing the current range ever be removed.
-  while leveladjust > 0
-    exe g:html_start_line.."foldopen"
-    let leveladjust -= 1
-  endwhile
-endif
-
-" Now loop over all lines in the original text to convert to html.
-" Use html_start_line and html_end_line if they are set.
-if exists("g:html_start_line")
-  let s:lnum = html_start_line
-  if s:lnum < 1 || s:lnum > line("$")
-    let s:lnum = 1
-  endif
-else
-  let s:lnum = 1
-endif
-if exists("g:html_end_line")
-  let s:end = html_end_line
-  if s:end < s:lnum || s:end > line("$")
-    let s:end = line("$")
-  endif
-else
-  let s:end = line("$")
-endif
-
-" stack to keep track of all the folds containing the current line
-let s:foldstack = []
-
-if !s:settings.no_progress
-  let s:pgb = s:ProgressBar("Processing lines:", s:end - s:lnum + 1, s:orgwin)
-endif
-
-if s:settings.number_lines
-  let s:margin = strlen(s:end) + 1
-else
-  let s:margin = 0
-endif
-
-if has('folding') && !s:settings.ignore_folding
-  let s:foldfillchar = &fillchars[matchend(&fillchars, 'fold:')]
-  if s:foldfillchar == ''
-    let s:foldfillchar = '-'
-  endif
-endif
-let s:difffillchar = &fillchars[matchend(&fillchars, 'diff:')]
-if s:difffillchar == ''
-  let s:difffillchar = '-'
-endif
-
-let s:foldId = 0
-
-if !s:settings.expand_tabs
-  " If keeping tabs, add them to printable characters so we keep them when
-  " formatting text (strtrans() doesn't replace printable chars)
-  let s:old_isprint = &isprint
-  setlocal isprint+=9
-endif
-
-while s:lnum <= s:end
-
-  " If there are filler lines for diff mode, show these above the line.
-  call s:Add_diff_fill(s:lnum)
-
-  " Start the line with the line number.
-  if s:settings.number_lines
-    let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) .. s:lnum .. ' '
-  endif
-
-  let s:new = ""
-
-  if has('folding') && !s:settings.ignore_folding && foldclosed(s:lnum) > -1 && !s:settings.dynamic_folds
-    "
-    " This is the beginning of a folded block (with no dynamic folding)
-    let s:new = foldtextresult(s:lnum)
-    if !s:settings.no_pre
-      " HTML line wrapping is off--go ahead and fill to the margin
-      let s:new = s:new .. repeat(s:foldfillchar, &columns - strlen(s:new))
-    endif
-
-    " put numcol in a separate group for sake of unselectable text
-    let s:new = (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, s:lnum): "") .. s:HtmlFormat_t(s:new, s:FOLDED_ID, 0)
-
-    " Skip to the end of the fold
-    let s:new_lnum = foldclosedend(s:lnum)
-
-    if !s:settings.no_progress
-      call s:pgb.incr(s:new_lnum - s:lnum)
-    endif
-
-    let s:lnum = s:new_lnum
-
-  else
-    "
-    " A line that is not folded, or doing dynamic folding.
-    "
-    let s:line = getline(s:lnum)
-    let s:len = strlen(s:line)
-
-    if s:settings.dynamic_folds
-      " First insert a closing for any open folds that end on this line
-      while !empty(s:foldstack) && get(s:foldstack,0).lastline == s:lnum-1
-	let s:new = s:new..""
-	call remove(s:foldstack, 0)
-      endwhile
-
-      " Now insert an opening for any new folds that start on this line
-      let s:firstfold = 1
-      while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
-	let s:foldId = s:foldId + 1
-	let s:new ..= ""
-
-
-	" Unless disabled, add a fold column for the opening line of a fold.
-	"
-	" Note that dynamic folds require using css so we just use css to take
-	" care of the leading spaces rather than using   in the case of
-	" html_no_pre to make it easier
-	if !s:settings.no_foldcolumn
-	  " add fold column that can open the new fold
-	  if s:allfolds[0].level > 1 && s:firstfold
-	    let s:new = s:new .. s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
-		  \ 'toggle-open FoldColumn','javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
-	  endif
-	  " add the filler spaces separately from the '+' char so that it can be
-	  " shown/hidden separately during a hover unfold
-	  let s:new = s:new .. s:FoldColumn_build("+", 1, 0, "",
-		\ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
-	  " If this is not the last fold we're opening on this line, we need
-	  " to keep the filler spaces hidden if the fold is opened by mouse
-	  " hover. If it is the last fold to open in the line, we shouldn't hide
-	  " them, so don't apply the toggle-filler class.
-	  let s:new = s:new .. s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
-		\ 'toggle-open FoldColumn'.. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-filler" :""),
-		\ 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
-
-	  " add fold column that can close the new fold
-	  " only add extra blank space if we aren't opening another fold on the
-	  " same line
-	  if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
-	    let s:extra_space = s:foldcolumn - s:allfolds[0].level
-	  else
-	    let s:extra_space = 0
-	  endif
-	  if s:firstfold
-	    " the first fold in a line has '|' characters from folds opened in
-	    " previous lines, before the '-' for this fold
-	    let s:new ..= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
-		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
-	  else
-	    " any subsequent folds in the line only add a single '-'
-	    let s:new = s:new .. s:FoldColumn_build("-", 1, s:extra_space, "",
-		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
-	  endif
-	  let s:firstfold = 0
-	endif
-
-	" Add fold text, moving the span ending to the next line so collapsing
-	" of folds works correctly.
-	" Put numcol in a separate group for sake of unselectable text.
-	let s:new = s:new .. (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, 0) : "") .. substitute(s:HtmlFormat_t(foldtextresult(s:lnum), s:FOLDED_ID, 0), '', s:HtmlEndline..'\n\0', '')
-	let s:new = s:new .. ""
-
-	" open the fold now that we have the fold text to allow retrieval of
-	" fold text for subsequent folds
-	execute s:lnum.."foldopen"
-	call insert(s:foldstack, remove(s:allfolds,0))
-	let s:foldstack[0].id = s:foldId
-      endwhile
-
-      " Unless disabled, add a fold column for other lines.
-      "
-      " Note that dynamic folds require using css so we just use css to take
-      " care of the leading spaces rather than using   in the case of
-      " html_no_pre to make it easier
-      if !s:settings.no_foldcolumn
-	if empty(s:foldstack)
-	  " add the empty foldcolumn for unfolded lines if there is a fold
-	  " column at all
-	  if s:foldcolumn > 0
-	    let s:new = s:new .. s:FoldColumn_fill()
-	  endif
-	else
-	  " add the fold column for folds not on the opening line
-	  if get(s:foldstack, 0).firstline < s:lnum
-	    let s:new = s:new .. s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].level, "",
-		  \ 'FoldColumn', 'javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
-	  endif
-	endif
-      endif
-    endif
-
-    " Now continue with the unfolded line text
-    if s:settings.number_lines
-      let s:new = s:new .. s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
-    elseif s:settings.line_ids
-      let s:new = s:new .. s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
-    endif
-
-    " Get the diff attribute, if any.
-    let s:diffattr = diff_hlID(s:lnum, 1)
-
-    " initialize conceal info to act like not concealed, just in case
-    let s:concealinfo = [0, '']
-
-    " Loop over each character in the line
-    let s:col = 1
-
-    " most of the time we won't use the diff_id, initialize to zero
-    let s:diff_id = 0
-
-    while s:col <= s:len || (s:col == 1 && s:diffattr)
-      let s:startcol = s:col " The start column for processing text
-      if !s:settings.ignore_conceal && has('conceal')
-	let s:concealinfo = synconcealed(s:lnum, s:col)
-      endif
-      if !s:settings.ignore_conceal && s:concealinfo[0]
-	let s:col = s:col + 1
-	" Speed loop (it's small - that's the trick)
-	" Go along till we find a change in the match sequence number (ending
-	" the specific concealed region) or until there are no more concealed
-	" characters.
-	while s:col <= s:len && s:concealinfo == synconcealed(s:lnum, s:col) | let s:col = s:col + 1 | endwhile
-      elseif s:diffattr
-	let s:diff_id = diff_hlID(s:lnum, s:col)
-	let s:id = synID(s:lnum, s:col, 1)
-	let s:col = s:col + 1
-	" Speed loop (it's small - that's the trick)
-	" Go along till we find a change in hlID
-	while s:col <= s:len && s:id == synID(s:lnum, s:col, 1)
-	      \   && s:diff_id == diff_hlID(s:lnum, s:col) |
-	      \     let s:col = s:col + 1 |
-	      \ endwhile
-	if s:len < &columns && !s:settings.no_pre
-	  " Add spaces at the end of the raw text line to extend the changed
-	  " line to the full width.
-	  let s:line = s:line .. repeat(' ', &columns - virtcol([s:lnum, s:len]) - s:margin)
-	  let s:len = &columns
-	endif
-      else
-	let s:id = synID(s:lnum, s:col, 1)
-	let s:col = s:col + 1
-	" Speed loop (it's small - that's the trick)
-	" Go along till we find a change in synID
-	while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile
-      endif
-
-      if s:settings.ignore_conceal || !s:concealinfo[0]
-	" Expand tabs if needed
-	let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
-	if s:settings.expand_tabs
-	  let s:offset = 0
-	  let s:idx = stridx(s:expandedtab, "\t")
-	  let s:tablist = exists("+vts") ? split(&vts,',') : []
-	  if empty(s:tablist)
-	    let s:tablist = [ &ts ]
-	  endif
-	  let s:tabidx = 0
-	  let s:tabwidth = 0
-	  while s:idx >= 0
-	    if s:startcol + s:idx == 1
-	      let s:i = s:tablist[0]
-	    else
-	      " Get the character, which could be multiple bytes, which falls
-	      " immediately before the found tab. Extract it by matching a
-	      " character just prior to the column where the tab matches.
-	      " We'll use this to get the byte index of the character
-	      " immediately preceding the tab, so we can then look up the
-	      " virtual column that character appears in, to determine how
-	      " much of the current tabstop has been used up.
-	      if s:idx == 0
-		" if the found tab is the first character in the text being
-		" processed, we need to get the character prior to the text,
-		" given by startcol.
-		let s:prevc = matchstr(s:line, '.\%' .. (s:startcol + s:offset) .. 'c')
-	      else
-		" Otherwise, the byte index of the tab into s:expandedtab is
-		" given by s:idx.
-		let s:prevc = matchstr(s:expandedtab, '.\%' .. (s:idx + 1) .. 'c')
-	      endif
-	      let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
-
-	      " find the tabstop interval to use for the tab we just found. Keep
-	      " adding tabstops (which could be variable) until we would exceed
-	      " the virtual screen position of the start of the found tab.
-	      while s:vcol >= s:tabwidth + s:tablist[s:tabidx]
-		let s:tabwidth += s:tablist[s:tabidx]
-		if s:tabidx < len(s:tablist)-1
-		  let s:tabidx = s:tabidx+1
-		endif
-	      endwhile
-	      let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth)
-	    endif
-	    " update offset to keep the index within the line corresponding to
-	    " actual tab characters instead of replaced spaces; s:idx reflects
-	    " replaced spaces in s:expandedtab, s:offset cancels out all but
-	    " the tab character itself.
-	    let s:offset -= s:i - 1
-	    let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
-	    let s:idx = stridx(s:expandedtab, "\t")
-	  endwhile
-	end
-
-	" get the highlight group name to use
-	let s:id = synIDtrans(s:id)
-      else
-	" use Conceal highlighting for concealed text
-	let s:id = s:CONCEAL_ID
-	let s:expandedtab = s:concealinfo[1]
-      endif
-
-      " Output the text with the same synID, with class set to the highlight ID
-      " name, unless it has been concealed completely.
-      if strlen(s:expandedtab) > 0
-	let s:new = s:new .. s:HtmlFormat(s:expandedtab,  s:id, s:diff_id, "", 0)
-      endif
-    endwhile
-  endif
-
-  call extend(s:lines, split(s:new..s:HtmlEndline, '\n', 1))
-  if !s:settings.no_progress && s:pgb.needs_redraw
-    redrawstatus
-    let s:pgb.needs_redraw = 0
-  endif
-  let s:lnum = s:lnum + 1
-
-  if !s:settings.no_progress
-    call s:pgb.incr()
-  endif
-endwhile
-
-" Diff filler is returned based on what needs inserting *before* the given line.
-" So to get diff filler at the end of the buffer, we need to use last line + 1
-call s:Add_diff_fill(s:end+1)
-
-if s:settings.dynamic_folds
-  " finish off any open folds
-  while !empty(s:foldstack)
-    let s:lines[-1]..=""
-    call remove(s:foldstack, 0)
-  endwhile
-
-  " add fold column to the style list if not already there
-  let s:id = s:FOLD_C_ID
-  if !has_key(s:stylelist, s:id)
-    let s:stylelist[s:id] = '.FoldColumn { ' .. s:CSS1(s:id) .. '}'
-  endif
-endif
-
-if s:settings.no_pre
-  if !s:settings.use_css
-    " Close off the font tag that encapsulates the whole 
-    call extend(s:lines, [""])
-  else
-    call extend(s:lines, ["
"]) - endif -else - call extend(s:lines, ["
"]) -endif -if !s:settings.no_doc - call extend(s:lines, ["", ""]) -endif - -exe s:newwin .. "wincmd w" -call setline(1, s:lines) -unlet s:lines - -" Mangle modelines so Vim doesn't try to use HTML text as a modeline if editing -" this file in the future; need to do this after generating all the text in case -" the modeline text has different highlight groups which all turn out to be -" stripped from the final output. -%s!\v(%(^|\s+)%([Vv]i%(m%([<=>]?\d+)?)?|ex)):!\1\:!ge - -" The generated HTML is admittedly ugly and takes a LONG time to fold. -" Make sure the user doesn't do syntax folding when loading a generated file, -" using a modeline. -if !s:settings.no_modeline - call append(line('$'), "") -endif - -" Now, when we finally know which, we define the colors and styles -if s:settings.use_css && !s:settings.no_doc - 1;//+1 - - " Normal/global attributes - if s:settings.no_pre - call append('.', "body { color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; font-family: ".. s:htmlfont .."; }") - + - else - call append('.', "pre { " .. s:whitespace .. "font-family: ".. s:htmlfont .."; color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; }") - + - yank - put - execute "normal! ^cwbody\e" - " body should not have the wrap formatting, only the pre section - if s:whitespace != '' - exec 's#'..s:whitespace - endif - endif - " fix browser inconsistencies (sometimes within the same browser) of different - " default font size for different elements - call append('.', '* { font-size: 1em; }') - + - " if we use any input elements for unselectable content, make sure they look - " like normal text - if !empty(s:settings.prevent_copy) - if s:settings.use_input_for_pc !=# "none" - call append('.', 'input { border: none; margin: 0; padding: 0; font-family: '..s:htmlfont..'; }') - + - " ch units for browsers which support them, em units for a somewhat - " reasonable fallback. - for w in range(1, 20, 1) - call append('.', [ - \ "input[size='"..w.."'] { width: "..w.."em; width: "..w.."ch; }" - \ ]) - + - endfor - endif - - if s:settings.use_input_for_pc !=# 'all' - let s:unselectable_styles = [] - if s:settings.prevent_copy =~# 'f' - call add(s:unselectable_styles, 'FoldColumn') - endif - if s:settings.prevent_copy =~# 'n' - call add(s:unselectable_styles, 'LineNr') - endif - if s:settings.prevent_copy =~# 't' && !s:settings.ignore_folding - call add(s:unselectable_styles, 'Folded') - endif - if s:settings.prevent_copy =~# 'd' - call add(s:unselectable_styles, 'DiffDelete') - endif - if s:settings.use_input_for_pc !=# 'none' - call append('.', [ - \ '/* Note: IE does not support @supports conditionals, but also does not fully support', - \ ' "content:" with custom content, so we *want* the check to fail */', - \ '@supports ( content: attr(data-custom-content) ) {' - \ ]) - +3 - endif - " The line number column inside the foldtext is styled just like the fold - " text in Vim, but it should use the prevent_copy settings of line number - " rather than fold text. Apply the prevent_copy styles to foldtext - " specifically for line numbers, which always come after the fold column, - " or at the beginning of the line. - if s:settings.prevent_copy =~# 'n' && !s:settings.ignore_folding - call append('.', [ - \ ' .FoldColumn + .Folded, .Folded:first-child { user-select: none; }', - \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { content: attr(data-Folded-content); }', - \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }', - \ ' .FoldColumn + span[data-Folded-content]::before, [data-Folded-content]:first-child::before { cursor: default; }', - \ ]) - +4 - endif - for s:style_name in s:unselectable_styles - call append('.', [ - \ ' .'..s:style_name..' { user-select: none; }', - \ ' [data-'..s:style_name..'-content]::before { content: attr(data-'..s:style_name..'-content); }', - \ ' [data-'..s:style_name..'-content]::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }', - \ ' span[data-'..s:style_name..'-content]::before { cursor: default; }', - \ ]) - +4 - endfor - if s:settings.use_input_for_pc !=# 'none' - " Note, the extra '}' is to match the "@supports" above - call append('.', [ - \ ' input { display: none; }', - \ '}' - \ ]) - +2 - endif - unlet s:unselectable_styles - endif - - " Fix mouse cursor shape for the fallback method of uncopyable text - if s:settings.use_input_for_pc !=# 'none' - if s:settings.prevent_copy =~# 'f' - " Make the cursor show active fold columns as active areas, and empty fold - " columns as not interactive. - call append('.', ['input.FoldColumn { cursor: pointer; }', - \ 'input.FoldColumn[value="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }' - \ ]) - +2 - if s:settings.use_input_for_pc !=# 'all' - call append('.', [ - \ 'a[data-FoldColumn-content="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }' - \ ]) - +1 - end - endif - " make line number column show as non-interactive if not selectable - if s:settings.prevent_copy =~# 'n' - call append('.', 'input.LineNr { cursor: default; }') - + - endif - " make fold text and line number column within fold text show as - " non-interactive if not selectable - if (s:settings.prevent_copy =~# 'n' || s:settings.prevent_copy =~# 't') && !s:settings.ignore_folding - call append('.', 'input.Folded { cursor: default; }') - + - endif - " make diff filler show as non-interactive if not selectable - if s:settings.prevent_copy =~# 'd' - call append('.', 'input.DiffDelete { cursor: default; }') - + - endif - endif - endif -endif - -if !s:settings.use_css && !s:settings.no_doc - " For Netscape 4, set attributes too, though, strictly speaking, it's - " incorrect. - execute '%s:]*\):\r]\|>\|<\|"\)+\1\2+ge -endif - -" The DTD -if !s:settings.no_doc - if s:settings.use_xhtml - exe "normal! gg$a\n" - elseif s:html5 - exe "normal! gg0i\n" - else - exe "normal! gg0i\n" - endif -endif - -if s:settings.use_xhtml && !s:settings.no_doc - exe "normal! gg/ Date: Thu, 29 Feb 2024 01:32:25 +0900 Subject: fix(lsp): remove unnecessary file load/write when renaming (#27621) Previously rename would unconditionally read the to-be-renamed file from the disk and write it to the disk. This is redundant in some cases If the file is not already loaded, it's not attached to lsp client, so nvim doesn't need to care about this file. If the file is loaded but has no change, it doesn't need to be written. --- runtime/lua/vim/lsp/util.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 3973e606f8..d2a5d9a08e 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -710,11 +710,12 @@ function M.rename(old_fname, new_fname, opts) end for _, b in ipairs(oldbufs) do - vim.fn.bufload(b) - -- The there may be pending changes in the buffer - api.nvim_buf_call(b, function() - vim.cmd('w!') - end) + -- There may be pending changes in the buffer + if api.nvim_buf_is_loaded(b) then + api.nvim_buf_call(b, function() + vim.cmd('update!') + end) + end end local newdir = assert(vim.fs.dirname(new_fname)) -- cgit From aa62898ae329ec7ef978b4e7263c6f41b28f2503 Mon Sep 17 00:00:00 2001 From: notomo Date: Thu, 29 Feb 2024 01:36:28 +0900 Subject: fix(lsp): correct the error message's cmd on spawning (#27632) --- runtime/lua/vim/lsp/rpc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 1455ab51fa..e52c06a1bd 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -819,7 +819,8 @@ function M.start(cmd, dispatchers, extra_spawn_params) else sfx = string.format(' with error message: %s', err) end - local msg = string.format('Spawning language server with cmd: `%s` failed%s', cmd, sfx) + local msg = + string.format('Spawning language server with cmd: `%s` failed%s', vim.inspect(cmd), sfx) vim.notify(msg, vim.log.levels.WARN) return nil end -- cgit From 0246f1a897f4c349760cec9aea6db8bdd71bf3c5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 28 Feb 2024 18:01:38 +0100 Subject: fix(tohtml): set filetype of generated HTML to `html` Problem: `:TOhtml` opens the generated HTML code in a split, meaning it inherits the `help` filetype if a help buffer is to be converted. Solution: Explicitly set the filetype to `html`. --- runtime/plugin/tohtml.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/plugin/tohtml.lua b/runtime/plugin/tohtml.lua index 893419ece6..79f2794a40 100644 --- a/runtime/plugin/tohtml.lua +++ b/runtime/plugin/tohtml.lua @@ -8,4 +8,5 @@ vim.api.nvim_create_user_command('TOhtml', function(args) local html = require('tohtml').tohtml() vim.fn.writefile(html, outfile) vim.cmd.split(outfile) + vim.bo.filetype = 'html' end, { bar = true, nargs = '?' }) -- cgit From d981670bc9acd4cfd7b0768b8bc64390b026bf98 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sun, 25 Feb 2024 12:05:35 -0800 Subject: refactor(lsp): remove outdated comment --- runtime/lua/vim/lsp/protocol.lua | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index fb41311961..4a5ab1a73d 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -2,24 +2,6 @@ -- Protocol for the Microsoft Language Server Protocol (mslsp) ---[=[ ----@private ---- Useful for interfacing with: ---- https://github.com/microsoft/language-server-protocol/raw/gh-pages/_specifications/specification-3-14.md -function transform_schema_comments() - nvim.command [[silent! '<,'>g/\/\*\*\|\*\/\|^$/d]] - nvim.command [[silent! '<,'>s/^\(\s*\) \* \=\(.*\)/\1--\2/]] -end ----@private -function transform_schema_to_table() - transform_schema_comments() - nvim.command [[silent! '<,'>s/: \S\+//]] - nvim.command [[silent! '<,'>s/export const //]] - nvim.command [[silent! '<,'>s/export namespace \(\S*\)\s*{/protocol.\1 = {/]] - nvim.command [[silent! '<,'>s/namespace \(\S*\)\s*{/protocol.\1 = {/]] -end ---]=] - local protocol = { --- @enum lsp.DiagnosticSeverity DiagnosticSeverity = { -- cgit From 853f647da618d2891e4ac513fb96d3c8a42fa131 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sun, 25 Feb 2024 12:45:39 -0800 Subject: fix(lsp): handle reverse lookup in capabilities --- runtime/lua/vim/lsp/protocol.lua | 52 ++++++++++++---------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 4a5ab1a73d..fa614780c2 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -1,5 +1,11 @@ --- @diagnostic disable: duplicate-doc-alias +local function get_value_set(t) + return vim.iter.filter(function(i) + return type(i) == 'number' + end, ipairs(t)) +end + -- Protocol for the Microsoft Language Server Protocol (mslsp) local protocol = { @@ -295,6 +301,7 @@ local protocol = { }, } +-- TODO(mariasolos): Remove this reverse lookup. for k, v in pairs(protocol) do local tbl = vim.deepcopy(v, true) vim.tbl_add_reverse_lookup(tbl) @@ -705,7 +712,10 @@ function protocol.make_client_capabilities() codeActionLiteralSupport = { codeActionKind = { valueSet = (function() - local res = vim.tbl_values(protocol.CodeActionKind) + local res = vim.iter.filter(function(value) + -- Filter out the keys that were added by the reverse lookup. + return value:match('^%l') + end, vim.tbl_values(protocol.CodeActionKind)) table.sort(res) return res end)(), @@ -736,15 +746,7 @@ function protocol.make_client_capabilities() documentationFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText }, }, completionItemKind = { - valueSet = (function() - local res = {} - for k in ipairs(protocol.CompletionItemKind) do - if type(k) == 'number' then - table.insert(res, k) - end - end - return res - end)(), + valueSet = get_value_set(protocol.CompletionItemKind), }, completionList = { itemDefaults = { @@ -794,15 +796,7 @@ function protocol.make_client_capabilities() documentSymbol = { dynamicRegistration = false, symbolKind = { - valueSet = (function() - local res = {} - for k in ipairs(protocol.SymbolKind) do - if type(k) == 'number' then - table.insert(res, k) - end - end - return res - end)(), + valueSet = get_value_set(protocol.SymbolKind), }, hierarchicalDocumentSymbolSupport = true, }, @@ -813,15 +807,7 @@ function protocol.make_client_capabilities() publishDiagnostics = { relatedInformation = true, tagSupport = { - valueSet = (function() - local res = {} - for k in ipairs(protocol.DiagnosticTag) do - if type(k) == 'number' then - table.insert(res, k) - end - end - return res - end)(), + valueSet = get_value_set(protocol.DiagnosticTag), }, dataSupport = true, }, @@ -833,15 +819,7 @@ function protocol.make_client_capabilities() symbol = { dynamicRegistration = false, symbolKind = { - valueSet = (function() - local res = {} - for k in ipairs(protocol.SymbolKind) do - if type(k) == 'number' then - table.insert(res, k) - end - end - return res - end)(), + valueSet = get_value_set(protocol.SymbolKind), }, }, configuration = true, -- cgit From f912030d4ed0998b3de90bad9f1b416fffff49c9 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Wed, 28 Feb 2024 14:14:49 -0800 Subject: docs(lpeg): remove double backticks from meta (#27659) --- runtime/doc/lua.txt | 8 ++++---- runtime/lua/vim/_meta/lpeg.lua | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 5f6f6fb149..797b097096 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3326,8 +3326,8 @@ vim.lpeg.R({...}) *vim.lpeg.R()* Returns a pattern that matches any single character belonging to one of the given ranges. Each `range` is a string `xy` of length 2, representing all characters with code between the codes of `x` and `y` (both - inclusive). As an example, the pattern ``lpeg.R('09')`` matches any digit, - and ``lpeg.R('az', 'AZ')`` matches any ASCII letter. + inclusive). As an example, the pattern `lpeg.R('09')` matches any digit, + and `lpeg.R('az', 'AZ')` matches any ASCII letter. Example: >lua local pattern = lpeg.R('az') ^ 1 * -1 @@ -3343,10 +3343,10 @@ vim.lpeg.R({...}) *vim.lpeg.R()* vim.lpeg.S({string}) *vim.lpeg.S()* Returns a pattern that matches any single character that appears in the given string (the `S` stands for Set). As an example, the pattern - ``lpeg.S('+-*/')`` matches any arithmetic operator. Note that, if `s` is a + `lpeg.S('+-*/')` matches any arithmetic operator. Note that, if `s` is a character (that is, a string of length 1), then `lpeg.P(s)` is equivalent to `lpeg.S(s)` which is equivalent to `lpeg.R(s..s)`. Note also that both - ``lpeg.S('')`` and `lpeg.R()` are patterns that always fail. + `lpeg.S('')` and `lpeg.R()` are patterns that always fail. Parameters: ~ • {string} (`string`) diff --git a/runtime/lua/vim/_meta/lpeg.lua b/runtime/lua/vim/_meta/lpeg.lua index fef07d3046..202c99f18c 100644 --- a/runtime/lua/vim/_meta/lpeg.lua +++ b/runtime/lua/vim/_meta/lpeg.lua @@ -129,8 +129,8 @@ function vim.lpeg.B(pattern) end --- Returns a pattern that matches any single character belonging to one of the given ranges. --- Each `range` is a string `xy` of length 2, representing all characters with code between the codes of ---- `x` and `y` (both inclusive). As an example, the pattern ``lpeg.R('09')`` matches any digit, and ---- ``lpeg.R('az', 'AZ')`` matches any ASCII letter. +--- `x` and `y` (both inclusive). As an example, the pattern `lpeg.R('09')` matches any digit, and +--- `lpeg.R('az', 'AZ')` matches any ASCII letter. --- --- Example: --- @@ -144,9 +144,9 @@ function vim.lpeg.B(pattern) end function vim.lpeg.R(...) end --- Returns a pattern that matches any single character that appears in the given string (the `S` stands for Set). ---- As an example, the pattern ``lpeg.S('+-*/')`` matches any arithmetic operator. Note that, if `s` is a character +--- As an example, the pattern `lpeg.S('+-*/')` matches any arithmetic operator. Note that, if `s` is a character --- (that is, a string of length 1), then `lpeg.P(s)` is equivalent to `lpeg.S(s)` which is equivalent to ---- `lpeg.R(s..s)`. Note also that both ``lpeg.S('')`` and `lpeg.R()` are patterns that always fail. +--- `lpeg.R(s..s)`. Note also that both `lpeg.S('')` and `lpeg.R()` are patterns that always fail. --- --- @param string string --- @return vim.lpeg.Pattern -- cgit From ce7c51a1a3b2b38cdba730aeb53840d0ace32173 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 29 Feb 2024 07:19:26 +0800 Subject: vim-patch:9.1.0142: getregion() can be improved (#27662) Problem: getregion() can be improved (after v9.1.120) Solution: change getregion() implementation to use pos as lists and one optional {opt} dictionary (Shougo Matsushita) Note: The following is a breaking change! Currently, the getregion() function (included as of patch v9.1.120) takes 3 arguments: the first 2 arguments are strings, describing a position, arg3 is the type string. However, that is slightly inflexible, there is no way to specify additional arguments. So let's instead change the function signature to: getregion(pos1, pos2 [, {Dict}]) where both pos1 and pos2 are lists. This is slightly cleaner, and gives us the flexibility to specify additional arguments as key/value pairs to the optional Dict arg. Now it supports the "type" key to specify the selection type (characterwise, blockwise or linewise) and now in addition one can also define the selection type, independently of what the 'selection' option actually is. Technically, this is a breaking change, but since the getregion() Vimscript function is still quite new, this should be fine. closes: vim/vim#14090 https://github.com/vim/vim/commit/19b718828d8d5fab52d94c6cdba694641879ab38 Co-authored-by: Shougo Matsushita --- runtime/doc/builtin.txt | 36 +++++++++++++++++++++-------------- runtime/lua/vim/_defaults.lua | 3 ++- runtime/lua/vim/_meta/vimfn.lua | 42 ++++++++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 32 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index aa9bc4836f..290fba5281 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2918,14 +2918,25 @@ getreginfo([{regname}]) *getreginfo()* If {regname} is not specified, |v:register| is used. The returned Dictionary can be passed to |setreg()|. -getregion({pos1}, {pos2}, {type}) *getregion()* - Returns the list of strings from {pos1} to {pos2} as if it's - selected in visual mode of {type}. - For possible values of {pos1} and {pos2} see |line()|. - {type} is the selection type: - "v" for |charwise| mode - "V" for |linewise| mode - "" for |blockwise-visual| mode +getregion({pos1}, {pos2} [, {opts}]) *getregion()* + Returns the list of strings from {pos1} to {pos2} in current + buffer. + + {pos1} and {pos2} must both be |List|s with four numbers. + See |getpos()| for the format of the list. + + The optional argument {opts} is a Dict and supports the + following items: + + type Specify the selection type + (default: "v"): + "v" for |charwise| mode + "V" for |linewise| mode + "" for |blockwise-visual| mode + + exclusive If |TRUE|, use exclusive selection + for the end position 'selection'. + You can get the last selection type by |visualmode()|. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). @@ -2943,16 +2954,13 @@ getregion({pos1}, {pos2}, {type}) *getregion()* - If the selection starts or ends in the middle of a multibyte character, it is not included but its selected part is substituted with spaces. - - If {pos1} or {pos2} equals "v" (see |line()|) and it is not in - |visual-mode|, an empty list is returned. - - If {pos1}, {pos2} or {type} is an invalid string, an empty - list is returned. - - If {pos1} or {pos2} is a mark in different buffer, an empty + - If {pos1} or {pos2} is not current in the buffer, an empty list is returned. Examples: > :xnoremap - \ echom getregion('v', '.', mode()) + \ echom getregion( + \ getpos('v'), getpos('.'), #{ type: mode() }) < getregtype([{regname}]) *getregtype()* diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 7cece41ed3..c8131f8eb4 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -6,7 +6,8 @@ do do local function _visual_search(cmd) assert(cmd == '/' or cmd == '?') - local chunks = vim.fn.getregion('.', 'v', vim.fn.mode()) + local chunks = + vim.fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() }) local esc_chunks = vim .iter(chunks) :map(function(v) diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 779016f2d1..be89c7dd01 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3525,13 +3525,24 @@ function vim.fn.getreg(regname, list) end --- @return table function vim.fn.getreginfo(regname) end ---- Returns the list of strings from {pos1} to {pos2} as if it's ---- selected in visual mode of {type}. ---- For possible values of {pos1} and {pos2} see |line()|. ---- {type} is the selection type: ---- "v" for |charwise| mode ---- "V" for |linewise| mode ---- "" for |blockwise-visual| mode +--- Returns the list of strings from {pos1} to {pos2} in current +--- buffer. +--- +--- {pos1} and {pos2} must both be |List|s with four numbers. +--- See |getpos()| for the format of the list. +--- +--- The optional argument {opts} is a Dict and supports the +--- following items: +--- +--- type Specify the selection type +--- (default: "v"): +--- "v" for |charwise| mode +--- "V" for |linewise| mode +--- "" for |blockwise-visual| mode +--- +--- exclusive If |TRUE|, use exclusive selection +--- for the end position 'selection'. +--- --- You can get the last selection type by |visualmode()|. --- If Visual mode is active, use |mode()| to get the Visual mode --- (e.g., in a |:vmap|). @@ -3549,23 +3560,20 @@ function vim.fn.getreginfo(regname) end --- - If the selection starts or ends in the middle of a multibyte --- character, it is not included but its selected part is --- substituted with spaces. ---- - If {pos1} or {pos2} equals "v" (see |line()|) and it is not in ---- |visual-mode|, an empty list is returned. ---- - If {pos1}, {pos2} or {type} is an invalid string, an empty ---- list is returned. ---- - If {pos1} or {pos2} is a mark in different buffer, an empty +--- - If {pos1} or {pos2} is not current in the buffer, an empty --- list is returned. --- --- Examples: > --- :xnoremap ---- \ echom getregion('v', '.', mode()) +--- \ echom getregion( +--- \ getpos('v'), getpos('.'), #{ type: mode() }) --- < --- ---- @param pos1 string ---- @param pos2 string ---- @param type string +--- @param pos1 table +--- @param pos2 table +--- @param opts? table --- @return string[] -function vim.fn.getregion(pos1, pos2, type) end +function vim.fn.getregion(pos1, pos2, opts) end --- The result is a String, which is type of register {regname}. --- The value will be one of: -- cgit From f9e7c4c9c4fb89e6114a37387f3738d98cb4ba6a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 29 Feb 2024 08:21:13 +0800 Subject: refactor(defaults): use getregion() for Visual mode gx (#27663) Also make it work better on a multiline selection. --- runtime/lua/vim/_defaults.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index c8131f8eb4..91baee1a1e 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -67,15 +67,6 @@ do ) --- Map |gx| to call |vim.ui.open| on the identifier under the cursor do - -- TODO: use vim.region() when it lands... #13896 #16843 - local function get_visual_selection() - local save_a = vim.fn.getreginfo('a') - vim.cmd([[norm! "ay]]) - local selection = vim.fn.getreg('a', 1) - vim.fn.setreg('a', save_a) - return selection - end - local function do_open(uri) local _, err = vim.ui.open(uri) if err then @@ -89,7 +80,10 @@ do do_open(vim.fn.expand('')) end, { desc = gx_desc }) vim.keymap.set({ 'x' }, 'gx', function() - do_open(get_visual_selection()) + local lines = + vim.fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() }) + -- Trim whitespace on each line and concatenate. + do_open(table.concat(vim.iter(lines):map(vim.trim):totable())) end, { desc = gx_desc }) end end -- cgit From 86c3f284fc8569b65d5ef4becc76f8d18c59e3d3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 Feb 2024 09:36:07 +0100 Subject: vim-patch:9ecf02cd5f5f MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime(java): Recognise _when_ clauses in _switch_ blocks Also: - distinguish _yield_ when used as a contextual keyword from when used qualified as a method or a method reference (as can be seen in testdir/input/java_switch.java, variables and method declarations named _yield_ will be recognised as the namesake keyword--consider picking other names for variables, and defining g:java_highlight_functions to have method names painted; since _yield_ statements can have trailing parens, they must be recognised as statements, for only qualified _yield_ method calls are supported); - recognise grouped _default_ _case_ labels; - describe primitive types for _case_ labels (JLS, §14.11, §3.10.1); - recognise some non-ASCII identifiers (see javaLambdaDef, javaUserLabel) (further improvement for better recognition of identifiers will be arranged in a separate PR). Because the arrow '->' is used in two kinds of expressions, lambda (abstractions) and _switch_, necessary changes were made for the recognition of either (and further improvement touching lambda expressions will be separately arranged). Because 'default' is used for instance method declarations in interfaces and in _switch_ labels, necessary changes were made for the recognition of either (and further improvement touching method declarations will be separately arranged). Finally, it deemed appropriate to put 'yield' in the syntax group of javaOperator rather than javaStatement, for its member 'var' is also another contextual keyword (e.g., this is valid syntax: "var var = var(test.var);"). References: https://openjdk.org/jeps/361 (Switch Expressions) https://openjdk.org/jeps/440 (Record Patterns) https://openjdk.org/jeps/441 (Pattern Matching for switch) Also, add a Java specific filetype plugin for the syntax test, so that no soft-wrapping of long indented lines occur. Otherwise the syntax scripts would miss a few lines during scrolling and verification of the screen dumps. closes: vim/vim#14105 https://github.com/vim/vim/commit/9ecf02cd5f5feabe096f66cd5f503a822c78793f Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- runtime/syntax/java.vim | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 44fbfa8398..1b940ebd39 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2023 Aug 13 +" Last Change: 2024 Feb 27 " Please check :help java.vim for comments on some of the options available. @@ -37,9 +37,17 @@ syn keyword javaBoolean true false syn keyword javaConstant null syn keyword javaTypedef this super syn keyword javaOperator var new instanceof +" Since the yield statement, which could take a parenthesised operand, +" and _qualified_ yield methods get along within the switch block +" (JLS-17, §3.8), it seems futile to make a region definition for this +" block; instead look for the _yield_ word alone, and if found, +" backtrack (arbitrarily) 80 bytes, at most, on the matched line and, +" if necessary, on the line before that (h: \@<=), trying to match +" neither a method reference nor a qualified method invocation. +syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@80" syn keyword javaType boolean char byte short int long float double syn keyword javaType void -syn keyword javaStatement return yield +syn keyword javaStatement return syn keyword javaStorageClass static synchronized transient volatile final strictfp serializable syn keyword javaExceptions throw try catch finally syn keyword javaAssert assert @@ -56,6 +64,7 @@ syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained syn match javaVarArg "\.\.\." syn keyword javaScopeDecl public protected private abstract +syn match javaConceptKind "\\%(\s*\%(:\|->\)\)\@!" function s:isModuleInfoDeclarationCurrentBuffer() abort return fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!' @@ -142,15 +151,30 @@ if exists("java_space_errors") endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\" matchgroup=NONE end=":\|->" contains=javaNumber,javaCharacter,javaString -syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel -syn keyword javaLabel default +syn match javaUserLabel "^\s*\<\K\k*\>\%(\\)\@" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaLabelDefault,javaLabelVarType,javaLabelWhenClause +syn region javaLabelRegion transparent matchgroup=javaLabel start="\\%(\s*\%(:\|->\)\)\@=" matchgroup=NONE end=":\|->" oneline +" Consider grouped _default_ _case_ labels, i.e. +" case null, default -> +" case null: default: +syn keyword javaLabelDefault contained default +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="\" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal +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 +hi def link javaLabelVarType javaOperator +hi def link javaLabelNumber javaNumber +hi def link javaLabelCastType javaType " highlighting C++ keywords as errors removed, too many people find it " annoying. Was: if !exists("java_allow_cpp_keywords") " The following cluster contains all java groups except the contained ones -syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg +syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaConceptKind,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg " Comments @@ -231,9 +255,9 @@ if exists("java_highlight_functions") " 1. class names are always capitalized (ie: Button) " 2. method names are never capitalized (except constructors, of course) "syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses - syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(<.*>\s\+\)\?\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^(){}]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^\s\+\%(\%(public\|protected\|private\|static\|\%(abstract\|default\)\|final\|native\|synchronized\)\s\+\)*\%(<.*>\s\+\)\?\%(\%(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\%([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\%(<[^(){}]*>\)\=\%(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation endif - syn match javaLambdaDef "[a-zA-Z_][a-zA-Z0-9_]*\s*->" + syn match javaLambdaDef "\<\K\k*\>\%(\\)\@" syn match javaBraces "[{}]" syn cluster javaTop add=javaFuncDef,javaBraces,javaLambdaDef endif @@ -326,6 +350,7 @@ hi def link javaStorageClass StorageClass hi def link javaMethodDecl javaStorageClass hi def link javaClassDecl javaStorageClass hi def link javaScopeDecl javaStorageClass +hi def link javaConceptKind NonText hi def link javaBoolean Boolean hi def link javaSpecial Special -- cgit From 2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 Feb 2024 10:21:02 +0100 Subject: fix(lsp): use plain loop for non-list-like table of protocol values Fixup for #27628 Closes #27669 --- runtime/lua/vim/lsp/protocol.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index fa614780c2..7016209372 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -1,9 +1,17 @@ --- @diagnostic disable: duplicate-doc-alias +-- TODO(clason) can be simplified after reverse lookup is removed +---@param t table +---@return number[] local function get_value_set(t) - return vim.iter.filter(function(i) - return type(i) == 'number' - end, ipairs(t)) + local result = {} + for _, v in pairs(t) do + if type(v) == 'number' then + table.insert(result, v) + end + end + table.sort(result) + return result end -- Protocol for the Microsoft Language Server Protocol (mslsp) -- cgit From 6ab0876f51e8ff5debdff03b36508fe7279032b7 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 29 Feb 2024 19:39:11 +0800 Subject: docs(eval): getline and indent function support string type Problem: getline and indent function missing string type in param. Solution: add string type in eval gen. --- runtime/lua/vim/_meta/vimfn.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index be89c7dd01..fa13c36a11 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3185,7 +3185,7 @@ function vim.fn.getjumplist(winnr, tabnr) end --- Date: Thu, 29 Feb 2024 18:02:29 +0100 Subject: vim-patch:56b7da3c051f runtime(netrw): handle file/dir symlinks specifically in tree mode fixes: vim/vim#2386 related: vim/vim#3609 https://github.com/vim/vim/commit/56b7da3c051fe1a5fd76534998c17b22d83c0899 Co-authored-by: Christian Brabandt --- runtime/autoload/netrw.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 33d3fbd4cc..363fc660ec 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -9376,7 +9376,7 @@ fun! s:NetrwTreeDir(islocal) " call Decho("treedir<".treedir.">",'~'.expand("")) elseif curline =~ '@$' " call Decho("handle symbolic link from current line",'~'.expand("")) - let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) + let potentialdir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) " call Decho("treedir<".treedir.">",'~'.expand("")) else " call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("")) @@ -9401,7 +9401,6 @@ fun! s:NetrwTreeDir(islocal) " call Decho("COMBAK#23 : mod=".&mod." win#".winnr()) " call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("")) - let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) " call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("")) " call Decho("COMBAK#24 : mod=".&mod." win#".winnr()) @@ -9414,8 +9413,15 @@ fun! s:NetrwTreeDir(islocal) " " call Decho("newdir <".newdir.">",'~'.expand("")) " else " call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("")) - let treedir = s:NetrwTreePath(w:netrw_treetop) -" endif + if a:islocal && curline =~ '@$' + if isdirectory(s:NetrwFile(potentialdir)) + let treedir = w:netrw_treetop.'/'.potentialdir.'/' + let w:netrw_treetop = treedir + endif + else + let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) + let treedir = s:NetrwTreePath(w:netrw_treetop) + endif endif " call Decho("COMBAK#25 : mod=".&mod." win#".winnr()) -- cgit From c8299d15db16fb8305c95a2cb5af53668a007ef2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 Feb 2024 18:28:31 +0100 Subject: vim-patch:b4eb3f1e4489 runtime(yaml): disable multiline_scalar detection by default There have been many complaints about Yaml indenting too much, because it considers values to be multi-line by default, which leads to unintended indenting for (apparently most) users. So let's hide this feature behind the new feature flag, keep it simple and prefer single line value key pairs by default. If you want the old behaviour, set the following value: > :let g:yaml_indent_multiline_scalar = 1 If not set, it will indent the same as the previous line. closes vim/vim#13845 https://github.com/vim/vim/commit/b4eb3f1e44896b12fdfa3885a78c6eaa181eaeff Co-authored-by: Christian Brabandt --- runtime/doc/indent.txt | 6 ++++++ runtime/indent/yaml.vim | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index a79ce41ac1..ba1033ee0a 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1226,5 +1226,11 @@ indent for a continuation line, a line that starts with a backslash: > Three times shiftwidth is the default value. +YAML *ft-yaml-indent* + +By default, the yaml indent script does not try to detect multiline scalars. +If you want to enable this, set the following variable: > + + let g:yaml_indent_multiline_scalar = 1 vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index 93fd8ea6f6..e5daf9f219 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -3,6 +3,7 @@ " Maintainer: Nikolai Pavlov " Last Updates: Lukas Reineke, "lacygoill" " Last Change: 2022 Jun 17 +" 2024 Feb 29 disable mulitline indent by default (The Vim project) " Only load this indent file when no other was loaded. if exists('b:did_indent') @@ -138,11 +139,13 @@ function GetYAMLIndent(lnum) else return indent(prevmapline) endif - elseif prevline =~# '^\s*- ' + elseif get(g:, 'yaml_indent_multiline_scalar', 0) && + \ prevline =~# '^\s*- ' " - List with " multiline scalar return previndent+2 - elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property .. + elseif get(g:, 'yaml_indent_multiline_scalar', 0) && + \ prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property .. \ '\v|' .. s:c_ns_anchor_property .. \ '\v|' .. s:block_scalar_header .. \ '\v)%(\s+|\s*%(\#.*)?$))*' -- cgit From 41f2cbe1710d2e177c113bf98e2002040336c42c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 Feb 2024 18:27:01 +0100 Subject: vim-patch:8fad5d58874e runtime(doc,netrw): update "Last Change header", remove trailing whitespace Update Last-Change Header for netrw and doc/indent.txt, fix a trailing whitespace in indent.txt and make CI happy. https://github.com/vim/vim/commit/8fad5d58874ed724f673ac8a83739164cead3961 Co-authored-by: Christian Brabandt --- runtime/autoload/netrw.vim | 3 ++- runtime/doc/indent.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 363fc660ec..fa08bb3848 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -6,7 +6,8 @@ " Last Change: " 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a) " 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a) -" 2024 Feb 19 by Vim Project (announce adoption) +" 2024 Feb 19 by Vim Project: (announce adoption) +" 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly " Former Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index ba1033ee0a..c20143bc6e 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1228,7 +1228,7 @@ Three times shiftwidth is the default value. YAML *ft-yaml-indent* -By default, the yaml indent script does not try to detect multiline scalars. +By default, the yaml indent script does not try to detect multiline scalars. If you want to enable this, set the following variable: > let g:yaml_indent_multiline_scalar = 1 -- cgit From b413f5d048ab8676d5a77d0f2b3c20587a270673 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 2 Mar 2024 02:31:54 +0900 Subject: fix(lsp): rename undofile when renaming (#27684) Problem: After `rename()`, the undo information for the renamed file(s) are lost. Solution: Rename the undofile as well. --- runtime/lua/vim/lsp/util.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index d2a5d9a08e..0553d39851 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -724,6 +724,13 @@ function M.rename(old_fname, new_fname, opts) local ok, err = os.rename(old_fname_full, new_fname) assert(ok, err) + local old_undofile = vim.fn.undofile(old_fname_full) + if uv.fs_stat(old_undofile) ~= nil then + local new_undofile = vim.fn.undofile(new_fname) + vim.fn.mkdir(assert(vim.fs.dirname(new_undofile)), 'p') + os.rename(old_undofile, new_undofile) + end + if vim.fn.isdirectory(new_fname) == 0 then local newbuf = vim.fn.bufadd(new_fname) if win then -- cgit From b87505e11656163ddf0dbbc16b7d224815873964 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Feb 2024 11:24:44 +0000 Subject: refactor(watch): general tidy up - Rename watch.poll to watch.watchdirs - Unify how include and exclude is applied - Improve type hints --- runtime/lua/vim/_watch.lua | 202 +++++++++++++++++++----------------- runtime/lua/vim/lsp/_watchfiles.lua | 7 +- 2 files changed, 111 insertions(+), 98 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 092781826f..019af1822f 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -1,45 +1,61 @@ -local M = {} local uv = vim.uv ----@enum vim._watch.FileChangeType -local FileChangeType = { +local M = {} + +--- @enum vim._watch.FileChangeType +--- Types of events watchers will emit. +M.FileChangeType = { Created = 1, Changed = 2, Deleted = 3, } ---- Enumeration describing the types of events watchers will emit. -M.FileChangeType = vim.tbl_add_reverse_lookup(FileChangeType) - ---- Joins filepath elements by static '/' separator +--- @class vim._watch.Opts --- ----@param ... (string) The path elements. ----@return string -local function filepath_join(...) - return table.concat({ ... }, '/') -end - ---- Stops and closes a libuv |uv_fs_event_t| or |uv_fs_poll_t| handle +--- @field debounce? integer ms +--- +--- An |lpeg| pattern. Only changes to files whose full paths match the pattern +--- will be reported. Only matches against non-directoriess, all directories will +--- be watched for new potentially-matching files. exclude_pattern can be used to +--- filter out directories. When nil, matches any file name. +--- @field include_pattern? vim.lpeg.Pattern --- ----@param handle (uv.uv_fs_event_t|uv.uv_fs_poll_t) The handle to stop -local function stop(handle) - local _, stop_err = handle:stop() - assert(not stop_err, stop_err) - local is_closing, close_err = handle:is_closing() - assert(not close_err, close_err) - if not is_closing then - handle:close() +--- An |lpeg| pattern. Only changes to files and directories whose full path does +--- not match the pattern will be reported. Matches against both files and +--- directories. When nil, matches nothing. +--- @field exclude_pattern? vim.lpeg.Pattern + +--- @alias vim._watch.Callback fun(path: string, change_type: vim._watch.FileChangeType) + +--- @class vim._watch.watch.Opts : vim._watch.Opts +--- @field uvflags? uv.fs_event_start.flags + +--- @param path string +--- @param opts? vim._watch.Opts +local function skip(path, opts) + if not opts then + return false + end + + if opts.include_pattern and opts.include_pattern:match(path) == nil then + return true end + + if opts.exclude_pattern and opts.exclude_pattern:match(path) ~= nil then + return true + end + + return false end --- Initializes and starts a |uv_fs_event_t| --- ----@param path (string) The path to watch ----@param opts (table|nil) Additional options ---- - uvflags (table|nil) ---- Same flags as accepted by |uv.fs_event_start()| ----@param callback (function) The function called when new events ----@return (function) Stops the watcher +--- @param path string The path to watch +--- @param opts vim._watch.watch.Opts? Additional options: +--- - uvflags (table|nil) +--- Same flags as accepted by |uv.fs_event_start()| +--- @param callback vim._watch.Callback Callback for new events +--- @return fun() cancel Stops the watcher function M.watch(path, opts, callback) vim.validate({ path = { path, 'string', false }, @@ -47,49 +63,69 @@ function M.watch(path, opts, callback) callback = { callback, 'function', false }, }) + opts = opts or {} + path = vim.fs.normalize(path) local uvflags = opts and opts.uvflags or {} - local handle, new_err = vim.uv.new_fs_event() - assert(not new_err, new_err) - handle = assert(handle) + local handle = assert(uv.new_fs_event()) + local _, start_err = handle:start(path, uvflags, function(err, filename, events) assert(not err, err) local fullpath = path if filename then - filename = filename:gsub('\\', '/') - fullpath = filepath_join(fullpath, filename) + fullpath = vim.fs.normalize(vim.fs.joinpath(fullpath, filename)) end - local change_type = events.change and M.FileChangeType.Changed or 0 + + if skip(fullpath, opts) then + return + end + + --- @type vim._watch.FileChangeType + local change_type if events.rename then - local _, staterr, staterrname = vim.uv.fs_stat(fullpath) + local _, staterr, staterrname = uv.fs_stat(fullpath) if staterrname == 'ENOENT' then change_type = M.FileChangeType.Deleted else assert(not staterr, staterr) change_type = M.FileChangeType.Created end + elseif events.change then + change_type = M.FileChangeType.Changed end callback(fullpath, change_type) end) + assert(not start_err, start_err) + return function() - stop(handle) + local _, stop_err = handle:stop() + assert(not stop_err, stop_err) + local is_closing, close_err = handle:is_closing() + assert(not close_err, close_err) + if not is_closing then + handle:close() + end end end ---- @class watch.PollOpts ---- @field debounce? integer ---- @field include_pattern? vim.lpeg.Pattern ---- @field exclude_pattern? vim.lpeg.Pattern +--- Initializes and starts a |uv_fs_event_t| recursively watching every directory underneath the +--- directory at path. +--- +--- @param path string The path to watch. Must refer to a directory. +--- @param opts vim._watch.Opts? Additional options +--- @param callback vim._watch.Callback Callback for new events +--- @return fun() cancel Stops the watcher +function M.watchdirs(path, opts, callback) + vim.validate({ + path = { path, 'string', false }, + opts = { opts, 'table', true }, + callback = { callback, 'function', false }, + }) ----@param path string ----@param opts watch.PollOpts ----@param callback function Called on new events ----@return function cancel stops the watcher -local function recurse_watch(path, opts, callback) opts = opts or {} local debounce = opts.debounce or 500 - local uvflags = {} + ---@type table handle by fullpath local handles = {} @@ -98,28 +134,23 @@ local function recurse_watch(path, opts, callback) ---@type table[] local changesets = {} - local function is_included(filepath) - return opts.include_pattern and opts.include_pattern:match(filepath) - end - local function is_excluded(filepath) - return opts.exclude_pattern and opts.exclude_pattern:match(filepath) - end - - local process_changes = function() - assert(false, "Replaced later. I'm only here as forward reference") - end + local process_changes --- @type fun() + --- @param filepath string + --- @return uv.fs_event_start.callback local function create_on_change(filepath) return function(err, filename, events) assert(not err, err) local fullpath = vim.fs.joinpath(filepath, filename) - if is_included(fullpath) and not is_excluded(filepath) then - table.insert(changesets, { - fullpath = fullpath, - events = events, - }) - timer:start(debounce, 0, process_changes) + if skip(fullpath, opts) then + return end + + table.insert(changesets, { + fullpath = fullpath, + events = events, + }) + timer:start(debounce, 0, process_changes) end end @@ -128,7 +159,7 @@ local function recurse_watch(path, opts, callback) local filechanges = vim.defaulttable() for i, change in ipairs(changesets) do changesets[i] = nil - if is_included(change.fullpath) and not is_excluded(change.fullpath) then + if not skip(change.fullpath) then table.insert(filechanges[change.fullpath], change.events) end end @@ -137,10 +168,10 @@ local function recurse_watch(path, opts, callback) ---@type vim._watch.FileChangeType local change_type if stat then - change_type = FileChangeType.Created + change_type = M.FileChangeType.Created for _, event in ipairs(events_list) do if event.change then - change_type = FileChangeType.Changed + change_type = M.FileChangeType.Changed end end if stat.type == 'directory' then @@ -148,10 +179,11 @@ local function recurse_watch(path, opts, callback) if not handle then handle = assert(uv.new_fs_event()) handles[fullpath] = handle - handle:start(fullpath, uvflags, create_on_change(fullpath)) + handle:start(fullpath, {}, create_on_change(fullpath)) end end else + change_type = M.FileChangeType.Deleted local handle = handles[fullpath] if handle then if not handle:is_closing() then @@ -159,15 +191,15 @@ local function recurse_watch(path, opts, callback) end handles[fullpath] = nil end - change_type = FileChangeType.Deleted end callback(fullpath, change_type) end) end end + local root_handle = assert(uv.new_fs_event()) handles[path] = root_handle - root_handle:start(path, uvflags, create_on_change(path)) + root_handle:start(path, {}, create_on_change(path)) --- "640K ought to be enough for anyone" --- Who has folders this deep? @@ -175,12 +207,13 @@ local function recurse_watch(path, opts, callback) for name, type in vim.fs.dir(path, { depth = max_depth }) do local filepath = vim.fs.joinpath(path, name) - if type == 'directory' and not is_excluded(filepath) then + if type == 'directory' and not skip(filepath, opts) then local handle = assert(uv.new_fs_event()) handles[filepath] = handle - handle:start(filepath, uvflags, create_on_change(filepath)) + handle:start(filepath, {}, create_on_change(filepath)) end end + local function cancel() for fullpath, handle in pairs(handles) do if not handle:is_closing() then @@ -191,34 +224,9 @@ local function recurse_watch(path, opts, callback) timer:stop() timer:close() end - return cancel -end ---- Initializes and starts a |uv_fs_poll_t| recursively watching every file underneath the ---- directory at path. ---- ----@param path (string) The path to watch. Must refer to a directory. ----@param opts (table|nil) Additional options ---- - debounce (number|nil) ---- Time events are debounced in ms. Defaults to 500 ---- - include_pattern (LPeg pattern|nil) ---- An |lpeg| pattern. Only changes to files whose full paths match the pattern ---- will be reported. Only matches against non-directoriess, all directories will ---- be watched for new potentially-matching files. exclude_pattern can be used to ---- filter out directories. When nil, matches any file name. ---- - exclude_pattern (LPeg pattern|nil) ---- An |lpeg| pattern. Only changes to files and directories whose full path does ---- not match the pattern will be reported. Matches against both files and ---- directories. When nil, matches nothing. ----@param callback (function) The function called when new events ----@return function Stops the watcher -function M.poll(path, opts, callback) - vim.validate({ - path = { path, 'string', false }, - opts = { opts, 'table', true }, - callback = { callback, 'function', false }, - }) - return recurse_watch(path, opts, callback) + return cancel end return M + diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index 6ca60b78cd..220052be5f 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -7,7 +7,11 @@ local lpeg = vim.lpeg local M = {} -M._watchfunc = (vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1) and watch.watch or watch.poll +if vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1 then + M._watchfunc = watch.watch +else + M._watchfunc = watch.watchdirs +end ---@type table> client id -> registration id -> cancel function local cancels = vim.defaulttable() @@ -164,3 +168,4 @@ function M.unregister(unreg, ctx) end return M + -- cgit From bf1e098d971d455cba1bdc9f6b2e777572fd6b16 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Feb 2024 11:27:37 +0000 Subject: refactor(watch): simplify filechanges processing --- runtime/lua/vim/_watch.lua | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 019af1822f..03b632b53c 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -131,8 +131,10 @@ function M.watchdirs(path, opts, callback) local timer = assert(uv.new_timer()) - ---@type table[] - local changesets = {} + --- Map of file path to boolean indicating if the file has been changed + --- at some point within the debounce cycle. + --- @type table + local filechanges = {} local process_changes --- @type fun() @@ -146,34 +148,25 @@ function M.watchdirs(path, opts, callback) return end - table.insert(changesets, { - fullpath = fullpath, - events = events, - }) + if not filechanges[fullpath] then + filechanges[fullpath] = events.change or false + end timer:start(debounce, 0, process_changes) end end process_changes = function() - ---@type table - local filechanges = vim.defaulttable() - for i, change in ipairs(changesets) do - changesets[i] = nil - if not skip(change.fullpath) then - table.insert(filechanges[change.fullpath], change.events) - end - end - for fullpath, events_list in pairs(filechanges) do + -- Since the callback is debounced it may have also been deleted later on + -- so we always need to check the existence of the file: + -- stat succeeds, changed=true -> Changed + -- stat succeeds, changed=false -> Created + -- stat fails -> Removed + for fullpath, changed in pairs(filechanges) do uv.fs_stat(fullpath, function(_, stat) ---@type vim._watch.FileChangeType local change_type if stat then - change_type = M.FileChangeType.Created - for _, event in ipairs(events_list) do - if event.change then - change_type = M.FileChangeType.Changed - end - end + change_type = changed and M.FileChangeType.Changed or M.FileChangeType.Created if stat.type == 'directory' then local handle = handles[fullpath] if not handle then @@ -195,6 +188,7 @@ function M.watchdirs(path, opts, callback) callback(fullpath, change_type) end) end + filechanges = {} end local root_handle = assert(uv.new_fs_event()) -- cgit From 816b56f878f0291c00a9018d5057b7b2b00f1891 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Feb 2024 13:05:33 +0000 Subject: fix(lsp): cancel watchers when closing a client --- runtime/lua/vim/lsp/_watchfiles.lua | 9 +++++++++ runtime/lua/vim/lsp/client.lua | 1 + 2 files changed, 10 insertions(+) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index 220052be5f..c66a76feae 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -167,5 +167,14 @@ function M.unregister(unreg, ctx) end end +--- @param client_id integer +function M.cancel(client_id) + for _, reg_cancels in pairs(cancels[client_id]) do + for _, cancel in pairs(reg_cancels) do + cancel() + end + end +end + return M diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua index c1b41a7183..1e709a1992 100644 --- a/runtime/lua/vim/lsp/client.lua +++ b/runtime/lua/vim/lsp/client.lua @@ -727,6 +727,7 @@ function Client:_stop(force) rpc.terminate() self._graceful_shutdown_failed = true end + vim.lsp._watchfiles.cancel(self.id) end) end -- cgit From 1fe65b3457d2e0632831445899d6d8a4bff9daee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 2 Mar 2024 06:42:39 +0800 Subject: vim-patch:87410ab3f556 (#27696) runtime(doc): some improvements to getregion() docs (vim/vim#14122) - Mention the default selection behavior - Remove useless sentence - Correct description about space padding https://github.com/vim/vim/commit/87410ab3f556121dfb3b30515f40c5f079edd004 --- runtime/doc/builtin.txt | 21 ++++++++++----------- runtime/lua/vim/_meta/vimfn.lua | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 290fba5281..a043121adf 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2928,32 +2928,31 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* The optional argument {opts} is a Dict and supports the following items: - type Specify the selection type + type Specify the region's selection type (default: "v"): "v" for |charwise| mode "V" for |linewise| mode "" for |blockwise-visual| mode exclusive If |TRUE|, use exclusive selection - for the end position 'selection'. + for the end position + (default: follow 'selection') You can get the last selection type by |visualmode()|. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). - This function uses the line and column number from the - specified position. - It is useful to get text starting and ending in different - columns, such as |charwise-visual| selection. + This function is useful to get text starting and ending in + different columns, such as a |charwise-visual| selection. Note that: - Order of {pos1} and {pos2} doesn't matter, it will always return content from the upper left position to the lower right position. - - If 'virtualedit' is enabled and selection is past the end of - line, resulting lines are filled with blanks. - - If the selection starts or ends in the middle of a multibyte - character, it is not included but its selected part is - substituted with spaces. + - If 'virtualedit' is enabled and the region is past the end + of the lines, resulting lines are padded with spaces. + - If the region is blockwise and it starts or ends in the + middle of a multi-cell character, it is not included but + its selected part is substituted with spaces. - If {pos1} or {pos2} is not current in the buffer, an empty list is returned. diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index fa13c36a11..ff95edddf6 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3534,32 +3534,31 @@ function vim.fn.getreginfo(regname) end --- The optional argument {opts} is a Dict and supports the --- following items: --- ---- type Specify the selection type +--- type Specify the region's selection type --- (default: "v"): --- "v" for |charwise| mode --- "V" for |linewise| mode --- "" for |blockwise-visual| mode --- --- exclusive If |TRUE|, use exclusive selection ---- for the end position 'selection'. +--- for the end position +--- (default: follow 'selection') --- --- You can get the last selection type by |visualmode()|. --- If Visual mode is active, use |mode()| to get the Visual mode --- (e.g., in a |:vmap|). ---- This function uses the line and column number from the ---- specified position. ---- It is useful to get text starting and ending in different ---- columns, such as |charwise-visual| selection. +--- This function is useful to get text starting and ending in +--- different columns, such as a |charwise-visual| selection. --- --- Note that: --- - Order of {pos1} and {pos2} doesn't matter, it will always --- return content from the upper left position to the lower --- right position. ---- - If 'virtualedit' is enabled and selection is past the end of ---- line, resulting lines are filled with blanks. ---- - If the selection starts or ends in the middle of a multibyte ---- character, it is not included but its selected part is ---- substituted with spaces. +--- - If 'virtualedit' is enabled and the region is past the end +--- of the lines, resulting lines are padded with spaces. +--- - If the region is blockwise and it starts or ends in the +--- middle of a multi-cell character, it is not included but +--- its selected part is substituted with spaces. --- - If {pos1} or {pos2} is not current in the buffer, an empty --- list is returned. --- -- cgit From 813dd36b72979dfd05479eb6402b9becc0faea29 Mon Sep 17 00:00:00 2001 From: Will Hopkins Date: Fri, 1 Mar 2024 14:59:32 -0800 Subject: fix(types): rename win_get_config return type to win_config Follow-up to #27397 --- runtime/lua/vim/_meta/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index d2f624fd97..94eab72291 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -2118,7 +2118,7 @@ function vim.api.nvim_win_get_buf(window) end --- `relative` is empty for normal windows. --- --- @param window integer Window handle, or 0 for current window ---- @return vim.api.keyset.float_config +--- @return vim.api.keyset.win_config function vim.api.nvim_win_get_config(window) end --- Gets the (1,0)-indexed, buffer-relative cursor position for a given window -- cgit From 4ff3217bbd8747d2d44680a825ac29097faf9c4b Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Feb 2024 11:28:35 +0000 Subject: feat(lsp): add fswatch watchfunc backend Problem: vim._watch.watchdirs has terrible performance. Solution: - On linux use fswatch as a watcher backend if available. - Add File watcher section to health:vim.lsp. Warn if watchfunc is libuv-poll. --- runtime/doc/news.txt | 3 ++ runtime/lua/vim/_watch.lua | 78 ++++++++++++++++++++++++++++++++++++- runtime/lua/vim/lsp/_watchfiles.lua | 3 +- runtime/lua/vim/lsp/health.lua | 40 ++++++++++++++++--- 4 files changed, 117 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 50beb79adf..516ff6f0fe 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -369,6 +369,9 @@ The following changes to existing APIs or features add new behavior. • The `workspace/didChangeWatchedFiles` LSP client capability is now enabled by default. + • On Mac or Windows, `libuv.fs_watch` is used as the backend. + • On Linux, `fswatch` (recommended) is used as the backend if available, + otherwise `libuv.fs_event` is used on each subdirectory. • |LspRequest| autocmd callbacks now contain additional information about the LSP request status update that occurred. diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 03b632b53c..d199cf8e29 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -222,5 +222,81 @@ function M.watchdirs(path, opts, callback) return cancel end -return M +--- @param data string +--- @param opts vim._watch.Opts? +--- @param callback vim._watch.Callback +local function fswatch_output_handler(data, opts, callback) + local d = vim.split(data, '%s+') + + -- only consider the last reported event + local fullpath, event = d[1], d[#d] + + if skip(fullpath, opts) then + return + end + + --- @type integer + local change_type + + if event == 'Created' then + change_type = M.FileChangeType.Created + elseif event == 'Removed' then + change_type = M.FileChangeType.Deleted + elseif event == 'Updated' then + change_type = M.FileChangeType.Changed + elseif event == 'Renamed' then + local _, staterr, staterrname = uv.fs_stat(fullpath) + if staterrname == 'ENOENT' then + change_type = M.FileChangeType.Deleted + else + assert(not staterr, staterr) + change_type = M.FileChangeType.Created + end + end + + if change_type then + callback(fullpath, change_type) + end +end + +--- @param path string The path to watch. Must refer to a directory. +--- @param opts vim._watch.Opts? +--- @param callback vim._watch.Callback Callback for new events +--- @return fun() cancel Stops the watcher +function M.fswatch(path, opts, callback) + -- debounce isn't the same as latency but close enough + local latency = 0.5 -- seconds + if opts and opts.debounce then + latency = opts.debounce / 1000 + end + local obj = vim.system({ + 'fswatch', + '--event=Created', + '--event=Removed', + '--event=Updated', + '--event=Renamed', + '--event-flags', + '--recursive', + '--latency=' .. tostring(latency), + '--exclude', + '/.git/', + path, + }, { + stdout = function(err, data) + if err then + error(err) + end + + for line in vim.gsplit(data or '', '\n', { plain = true, trimempty = true }) do + fswatch_output_handler(line, opts, callback) + end + end, + }) + + return function() + obj:kill(2) + end +end + +return M diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index c66a76feae..49328fbe9b 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -9,6 +9,8 @@ local M = {} if vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1 then M._watchfunc = watch.watch +elseif vim.fn.executable('fswatch') == 1 then + M._watchfunc = watch.fswatch else M._watchfunc = watch.watchdirs end @@ -177,4 +179,3 @@ function M.cancel(client_id) end return M - diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua index 15e4555b55..797a1097f9 100644 --- a/runtime/lua/vim/lsp/health.lua +++ b/runtime/lua/vim/lsp/health.lua @@ -1,10 +1,9 @@ local M = {} ---- Performs a healthcheck for LSP -function M.check() - local report_info = vim.health.info - local report_warn = vim.health.warn +local report_info = vim.health.info +local report_warn = vim.health.warn +local function check_log() local log = vim.lsp.log local current_log_level = log.get_level() local log_level_string = log.levels[current_log_level] ---@type string @@ -27,9 +26,11 @@ function M.check() local report_fn = (log_size / 1000000 > 100 and report_warn or report_info) report_fn(string.format('Log size: %d KB', log_size / 1000)) +end - local clients = vim.lsp.get_clients() +local function check_active_clients() vim.health.start('vim.lsp: Active Clients') + local clients = vim.lsp.get_clients() if next(clients) then for _, client in pairs(clients) do local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',') @@ -48,4 +49,33 @@ function M.check() end end +local function check_watcher() + vim.health.start('vim.lsp: File watcher') + local watchfunc = vim.lsp._watchfiles._watchfunc + assert(watchfunc) + local watchfunc_name --- @type string + if watchfunc == vim._watch.watch then + watchfunc_name = 'libuv-watch' + elseif watchfunc == vim._watch.watchdirs then + watchfunc_name = 'libuv-watchdirs' + elseif watchfunc == vim._watch.fswatch then + watchfunc_name = 'fswatch' + else + local nm = debug.getinfo(watchfunc, 'S').source + watchfunc_name = string.format('Custom (%s)', nm) + end + + report_info('File watch backend: ' .. watchfunc_name) + if watchfunc_name == 'libuv-watchdirs' then + report_warn('libuv-watchdirs has known performance issues. Consider installing fswatch.') + end +end + +--- Performs a healthcheck for LSP +function M.check() + check_log() + check_active_clients() + check_watcher() +end + return M -- cgit From a5fe8f59d98398d04bed8586cee73864bbcdde92 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 27 Feb 2024 15:20:32 +0000 Subject: docs: improve/add documentation of Lua types - Added `@inlinedoc` so single use Lua types can be inlined into the functions docs. E.g. ```lua --- @class myopts --- @inlinedoc --- --- Documentation for some field --- @field somefield integer --- @param opts myOpts function foo(opts) end ``` Will be rendered as ``` foo(opts) Parameters: - {opts} (table) Object with the fields: - somefield (integer) Documentation for some field ``` - Marked many classes with with `@nodoc` or `(private)`. We can eventually introduce these when we want to. --- runtime/doc/deprecated.txt | 2 +- runtime/doc/develop.txt | 33 +- runtime/doc/diagnostic.txt | 189 +++++-- runtime/doc/lsp.txt | 776 +++++++++++++++------------ runtime/doc/lua.txt | 181 ++++--- runtime/doc/treesitter.txt | 42 +- runtime/lua/tohtml.lua | 47 +- runtime/lua/vim/_editor.lua | 5 +- runtime/lua/vim/_inspector.lua | 28 +- runtime/lua/vim/_meta/builtin.lua | 1 + runtime/lua/vim/_meta/lpeg.lua | 2 + runtime/lua/vim/_meta/regex.lua | 1 + runtime/lua/vim/_options.lua | 1 + runtime/lua/vim/diagnostic.lua | 123 +++-- runtime/lua/vim/filetype.lua | 32 +- runtime/lua/vim/fs.lua | 49 +- runtime/lua/vim/iter.lua | 3 + runtime/lua/vim/loader.lua | 72 +-- runtime/lua/vim/lsp.lua | 297 ++-------- runtime/lua/vim/lsp/_changetracking.lua | 12 +- runtime/lua/vim/lsp/buf.lua | 251 +++++---- runtime/lua/vim/lsp/client.lua | 123 ++++- runtime/lua/vim/lsp/codelens.lua | 6 +- runtime/lua/vim/lsp/diagnostic.lua | 2 +- runtime/lua/vim/lsp/handlers.lua | 1 + runtime/lua/vim/lsp/inlay_hint.lua | 24 +- runtime/lua/vim/lsp/rpc.lua | 40 +- runtime/lua/vim/lsp/semantic_tokens.lua | 26 +- runtime/lua/vim/lsp/util.lua | 91 ++-- runtime/lua/vim/secure.lua | 25 +- runtime/lua/vim/shared.lua | 24 +- runtime/lua/vim/snippet.lua | 4 +- runtime/lua/vim/treesitter.lua | 30 +- runtime/lua/vim/treesitter/_query_linter.lua | 6 +- runtime/lua/vim/treesitter/dev.lua | 69 +-- runtime/lua/vim/treesitter/highlighter.lua | 19 +- runtime/lua/vim/treesitter/language.lua | 20 +- runtime/lua/vim/treesitter/languagetree.lua | 41 +- runtime/lua/vim/treesitter/query.lua | 52 +- runtime/lua/vim/version.lua | 61 ++- 40 files changed, 1553 insertions(+), 1258 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 1b16a19aca..9ca4e66c7b 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -141,7 +141,7 @@ LSP FUNCTIONS - *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()| or |vim.lsp.buf.format()| instead. - *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| or access - `progress` of |vim.lsp.client| + `progress` of |vim.lsp.Client| - *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()| - *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()| - *vim.lsp.util.lookup_section()* Use |vim.tbl_get()| and diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 28f43a70e0..1d566efec8 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -179,6 +179,8 @@ Strict "vimdoc" subset: - Do not use indentation in random places—that prevents the page from using "flow" layout. If you need a preformatted section, put it in a |help-codeblock| starting with ">". +- Parameters and fields are documented as `{foo}`. +- Optional parameters and fields are documented as `{foo}?`. C docstrings ~ @@ -189,9 +191,8 @@ from the docstrings defined in src/nvim/api/*.c. Docstring format: - Lines start with `///` - Special tokens start with `@` followed by the token name: - `@note`, `@param`, `@returns` -- Limited markdown is supported. - - List-items start with `-` (useful to nest or "indent") + `@note`, `@param`, `@return` +- Markdown is supported. - Use ``` for code samples. Code samples can be annotated as `vim` or `lua` @@ -233,11 +234,33 @@ definitions. The |lua-vim| :help is generated from the docstrings. Docstring format: - Use LuaCATS annotations: https://luals.github.io/wiki/annotations/ -- Limited markdown is supported. - - List-items start with `-` (useful to nest or "indent") +- Markdown is supported. - Use ``` for code samples. Code samples can be annotated as `vim` or `lua` - Use `@nodoc` to prevent documentation generation. +- Use `@inlinedoc` to inline `@class` blocks into `@param` blocks. + E.g. >lua + --- Object with fields: + --- @class myOpts + --- @inlinedoc + --- + --- Documentation for some field + --- @field somefield? integer + + --- @param opts? myOpts + function foo(opts) + end +< + + Will be rendered as: >vimdoc + + foo({opts}) + + Parameters: + - {opts}? (table) Object with the fields: + - {somefield}? (integer) Documentation + for some field +< - Files which has `@meta` are only used for typing and documentation. Example: the help for |vim.paste()| is generated from a docstring decorating diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index dbfa0148af..29859f7b05 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -38,24 +38,6 @@ optionally supplied). A good rule of thumb is that if a method is meant to modify the diagnostics for a buffer (e.g. |vim.diagnostic.set()|) then it requires a namespace. - *diagnostic-structure* -A diagnostic is a Lua table with the following keys. Required keys are -indicated with (+): - - bufnr: Buffer number - lnum(+): The starting line of the diagnostic - end_lnum: The final line of the diagnostic - col(+): The starting column of the diagnostic - end_col: The final column of the diagnostic - severity: The severity of the diagnostic |vim.diagnostic.severity| - message(+): The diagnostic text - source: The source of the diagnostic - code: The diagnostic code - user_data: Arbitrary data plugins or users can add - -Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based -rows and columns). |api-indexing| - *vim.diagnostic.severity* *diagnostic-severity* The "severity" key in a diagnostic is one of the values defined in `vim.diagnostic.severity`: @@ -361,6 +343,105 @@ Example: >lua ============================================================================== Lua module: vim.diagnostic *diagnostic-api* +*vim.Diagnostic* + *diagnostic-structure* + + Diagnostics use the same indexing as the rest of the Nvim API (i.e. + 0-based rows and columns). |api-indexing| + + Fields: ~ + • {bufnr}? (`integer`) Buffer number + • {lnum} (`integer`) The starting line of the diagnostic + (0-indexed) + • {end_lnum}? (`integer`) The final line of the diagnostic (0-indexed) + • {col} (`integer`) The starting column of the diagnostic + (0-indexed) + • {end_col}? (`integer`) The final column of the diagnostic + (0-indexed) + • {severity}? (`vim.diagnostic.Severity`) The severity of the + diagnostic |vim.diagnostic.severity| + • {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`) + +*vim.diagnostic.NS* + + Fields: ~ + • {name} (`string`) + • {opts} (`vim.diagnostic.Opts`) + • {user_data} (`table`) + • {disabled}? (`boolean`) + +*vim.diagnostic.Opts* + + Fields: ~ + • {float}? (`boolean|vim.diagnostic.Opts.Float`) + • {update_in_insert}? (`boolean`) + • {underline}? (`boolean|vim.diagnostic.Opts.Underline`) + • {virtual_text}? (`boolean|vim.diagnostic.Opts.VirtualText`) + • {signs}? (`boolean|vim.diagnostic.Opts.Signs`) + • {severity_sort}? (`boolean|{reverse?:boolean}`) + +*vim.diagnostic.Opts.Float* + + Fields: ~ + • {bufnr}? (`integer`) + • {namespace}? (`integer`) + • {scope}? (`'line'|'buffer'|'cursor'|'c'|'l'|'b'`) + • {pos}? (`integer|{[1]:integer,[2]:integer}`) + • {severity_sort}? (`boolean|{reverse?:boolean}`) + • {severity}? (`vim.diagnostic.SeverityFilter`) + • {header}? (`string|{[1]:string,[2]:any}`) + • {source}? (`boolean|string`) + • {format}? (`fun(diagnostic:vim.Diagnostic): string`) + • {prefix}? (`string|table`) + • {suffix}? (`string|table`) + • {focus_id}? (`string`) + +*vim.diagnostic.Opts.Signs* + + Fields: ~ + • {severity}? (`vim.diagnostic.SeverityFilter`) + • {priority}? (`integer`) + • {text}? (`table`) + • {numhl}? (`table`) + • {linehl}? (`table`) + • {texthl}? (`table`) + +*vim.diagnostic.Opts.Underline* + + Fields: ~ + • {severity}? (`vim.diagnostic.SeverityFilter`) + +*vim.diagnostic.Opts.VirtualText* + + Fields: ~ + • {severity}? (`vim.diagnostic.SeverityFilter`) + • {source}? (`boolean|string`) + • {prefix}? (`string|function`) + • {suffix}? (`string|function`) + • {spacing}? (`integer`) + • {format}? (`function`) + • {hl_mode}? (`'replace'|'combine'|'blend'`) + • {virt_text}? (`{[1]:string,[2]:any}[]`) + • {virt_text_pos}? (`'eol'|'overlay'|'right_align'|'inline'`) + • {virt_text_win_col}? (`integer`) + • {virt_text_hide}? (`boolean`) + +*vim.diagnostic.OptsResolved* + + Fields: ~ + • {float} (`vim.diagnostic.Opts.Float`) + • {update_in_insert} (`boolean`) + • {underline} (`vim.diagnostic.Opts.Underline`) + • {virtual_text} (`vim.diagnostic.Opts.VirtualText`) + • {signs} (`vim.diagnostic.Opts.Signs`) + • {severity_sort} (`{reverse?:boolean}`) + + config({opts}, {namespace}) *vim.diagnostic.config()* Configure diagnostic options globally or for a specific diagnostic namespace. @@ -518,7 +599,8 @@ fromqflist({list}) *vim.diagnostic.fromqflist()* |getloclist()|. Return: ~ - (`vim.Diagnostic[]`) array of |diagnostic-structure| + (`vim.Diagnostic[]`) array of |diagnostic-structure|. See + |vim.Diagnostic|. get({bufnr}, {opts}) *vim.diagnostic.get()* Get current diagnostics. @@ -538,7 +620,7 @@ get({bufnr}, {opts}) *vim.diagnostic.get()* Return: ~ (`vim.Diagnostic[]`) table A list of diagnostic items |diagnostic-structure|. Keys `bufnr`, `end_lnum`, `end_col`, and - `severity` are guaranteed to be present. + `severity` are guaranteed to be present. See |vim.Diagnostic|. get_namespace({namespace}) *vim.diagnostic.get_namespace()* Get namespace metadata. @@ -563,7 +645,7 @@ get_next({opts}) *vim.diagnostic.get_next()* • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - (`vim.Diagnostic?`) Next diagnostic + (`vim.Diagnostic?`) Next diagnostic. See |vim.Diagnostic|. get_next_pos({opts}) *vim.diagnostic.get_next_pos()* Return the position of the next diagnostic in the current buffer. @@ -582,7 +664,7 @@ get_prev({opts}) *vim.diagnostic.get_prev()* • {opts} (`table?`) See |vim.diagnostic.goto_next()| Return: ~ - (`vim.Diagnostic?`) Previous diagnostic + (`vim.Diagnostic?`) Previous diagnostic. See |vim.Diagnostic|. get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()* Return the position of the previous diagnostic in the current buffer. @@ -599,21 +681,22 @@ goto_next({opts}) *vim.diagnostic.goto_next()* Parameters: ~ • {opts} (`table?`) Configuration table with the following keys: - • namespace: (integer) Only consider diagnostics from the + • {namespace} (`integer`) Only consider diagnostics from the given namespace. - • cursor_position: (cursor position) Cursor position as a - (row, col) tuple. See |nvim_win_get_cursor()|. Defaults to - the current cursor position. - • wrap: (boolean, default true) Whether to loop around file or - not. Similar to 'wrapscan'. - • severity: See |diagnostic-severity|. - • float: (boolean or table, default true) If "true", call - |vim.diagnostic.open_float()| after moving. If a table, pass - the table as the {opts} parameter to - |vim.diagnostic.open_float()|. Unless overridden, the float - will show diagnostics at the new cursor position (as if - "cursor" were passed to the "scope" option). - • win_id: (number, default 0) Window ID + • {cursor_position}? (`{[1]:integer,[2]:integer}`) Cursor + position as a (row, col) tuple. See |nvim_win_get_cursor()|. + Defaults to the current cursor position. + • {wrap}? (`boolean`, default: `true`) Whether to loop around + file or not. Similar to 'wrapscan'. + • {severity} (`vim.diagnostic.Severity`) See + |diagnostic-severity|. + • {float}? (`boolean|vim.diagnostic.Opts.Float`, default: + `true`) If "true", call |vim.diagnostic.open_float()| after + moving. If a table, pass the table as the {opts} parameter + to |vim.diagnostic.open_float()|. Unless overridden, the + float will show diagnostics at the new cursor position (as + if "cursor" were passed to the "scope" option). + • {win_id}? (`integer`, default: `0`) Window ID goto_prev({opts}) *vim.diagnostic.goto_prev()* Move to the previous diagnostic in the current buffer. @@ -678,7 +761,7 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults}) Return: ~ (`vim.Diagnostic?`) |diagnostic-structure| or `nil` if {pat} fails to - match {str}. + match {str}. See |vim.Diagnostic|. open_float({opts}) *vim.diagnostic.open_float()* Show diagnostics in a floating window. @@ -758,7 +841,7 @@ set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()* • {namespace} (`integer`) The diagnostic namespace • {bufnr} (`integer`) Buffer number • {diagnostics} (`vim.Diagnostic[]`) A list of diagnostic items - |diagnostic-structure| + |diagnostic-structure|. See |vim.Diagnostic|. • {opts} (`table?`) Display options to pass to |vim.diagnostic.show()| @@ -767,28 +850,30 @@ setloclist({opts}) *vim.diagnostic.setloclist()* Parameters: ~ • {opts} (`table?`) Configuration table with the following keys: - • namespace: (number) Only add diagnostics from the given + • {namespace}? (`integer`) Only add diagnostics from the given namespace. - • winnr: (number, default 0) Window number to set location - list for. - • open: (boolean, default true) Open the location list after - setting. - • title: (string) Title of the location list. Defaults to + • {winnr}? (`integer`, default: `0`) Window number to set + location list for. + • {open}? (`boolean`, default: `true`) Open the location list + after setting. + • {title}? (`string`) Title of the location list. Defaults to "Diagnostics". - • severity: See |diagnostic-severity|. + • {severity}? (`vim.diagnostic.Severity`) See + |diagnostic-severity|. setqflist({opts}) *vim.diagnostic.setqflist()* Add all diagnostics to the quickfix list. Parameters: ~ • {opts} (`table?`) Configuration table with the following keys: - • namespace: (number) Only add diagnostics from the given + • {namespace}? (`integer`) Only add diagnostics from the given namespace. - • open: (boolean, default true) Open quickfix list after - setting. - • title: (string) Title of quickfix list. Defaults to + • {open}? (`boolean`, default: `true`) Open quickfix list + after setting. + • {title}? (`string`) Title of quickfix list. Defaults to "Diagnostics". - • severity: See |diagnostic-severity|. + • {severity}? (`vim.diagnostic.Severity`) See + |diagnostic-severity|. *vim.diagnostic.show()* show({namespace}, {bufnr}, {diagnostics}, {opts}) @@ -804,7 +889,7 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) namespace and buffer. This can be used to display a list of diagnostics without saving them or to display only a subset of diagnostics. May not be used when - {namespace} or {bufnr} is nil. + {namespace} or {bufnr} is nil. See |vim.Diagnostic|. • {opts} (`table?`) Display options. See |vim.diagnostic.config()|. @@ -814,7 +899,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()* Parameters: ~ • {diagnostics} (`vim.Diagnostic[]`) List of diagnostics - |diagnostic-structure|. + |diagnostic-structure|. See |vim.Diagnostic|. Return: ~ (`table[]`) of quickfix list items |setqflist-what| diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index c14c0e5b9c..d78189780d 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -218,7 +218,7 @@ Each response handler has this signature: > - {ctx} (table) Table of calling state associated with the handler, with these keys: - {method} (string) |lsp-method| name. - - {client_id} (number) |vim.lsp.client| identifier. + - {client_id} (number) |vim.lsp.Client| identifier. - {bufnr} (Buffer) Buffer handle. - {params} (table|nil) Request parameters table. - {version} (number) Document version at time of @@ -366,31 +366,6 @@ https://microsoft.github.io/language-server-protocol/specifications/specificatio LSP notification shape: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage - *lsp-on-list-handler* - -`on_list` receives a table with: - - - `items` table[], structured like |setqflist-what| - - `title` string, title for the list. - - `context` table|nil. `ctx` from |lsp-handler| - -This table can be used with vim.fn.setqflist or vim.fn.setloclist. E.g.: ->lua - local function on_list(options) - vim.fn.setqflist({}, ' ', options) - vim.api.nvim_command('cfirst') - end - - vim.lsp.buf.definition{on_list=on_list} - vim.lsp.buf.references(nil, {on_list=on_list}) -< -If you prefer loclist do something like this: ->lua - local function on_list(options) - vim.fn.setloclist(0, {}, ' ', options) - vim.api.nvim_command('lopen') - end -< ================================================================================ LSP HIGHLIGHT *lsp-highlight* @@ -557,7 +532,7 @@ LspNotify *LspNotify* LspProgress *LspProgress* Upon receipt of a progress notification from the server. Notifications can - be polled from a `progress` ring buffer of a |vim.lsp.client| or use + be polled from a `progress` ring buffer of a |vim.lsp.Client| or use |vim.lsp.status()| to get an aggregate message If the server sends a "work done progress", the `pattern` is set to `kind` @@ -583,7 +558,7 @@ LspRequest *LspRequest* will trigger with {type} == `cancel`. When used from Lua, the client ID, request ID, and request are sent in - the "data" table. See {requests} in |vim.lsp.client| for details on the + the "data" table. See {requests} in |vim.lsp.Client| for details on the {request} value. If the request type is `complete`, the request will be deleted from the client's pending requests table immediately after calling the event's callbacks. Example: >lua @@ -712,77 +687,6 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) (`string?`) err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil. -client *vim.lsp.client* - LSP client object. You can get an active client object via - |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|. - • Methods: - • request(method, params, [handler], bufnr) Sends a request to the - server. This is a thin wrapper around {client.rpc.request} with some - additional checking. If {handler} is not specified, If one is not - found there, then an error will occur. Returns: {status}, - {[client_id]}. {status} is a boolean indicating if the notification - was successful. If it is `false`, then it will always be `false` (the - client has shutdown). If {status} is `true`, the function returns - {request_id} as the second result. You can use this with - `client.cancel_request(request_id)` to cancel the request. - • request_sync(method, params, timeout_ms, bufnr) Sends a request to the - server and synchronously waits for the response. This is a wrapper - around {client.request} Returns: { err=err, result=result }, a - dictionary, where `err` and `result` come from the |lsp-handler|. On - timeout, cancel or error, returns `(nil, err)` where `err` is a string - describing the failure reason. If the request was unsuccessful returns - `nil`. - • notify(method, params) Sends a notification to an LSP server. Returns: - a boolean to indicate if the notification was successful. If it is - false, then it will always be false (the client has shutdown). - • cancel_request(id) Cancels a request with a given request id. Returns: - same as `notify()`. - • stop([force]) Stops a client, optionally with force. By default, it - will just ask the server to shutdown without force. If you request to - stop a client which has previously been requested to shutdown, it will - automatically escalate and force shutdown. - • is_stopped() Checks whether a client is stopped. Returns: true if the - client is fully stopped. - • on_attach(client, bufnr) Runs the on_attach function from the client's - config if it was defined. Useful for buffer-local setup. - • supports_method(method, [opts]): boolean Checks if a client supports a - given method. Always returns true for unknown off-spec methods. [opts] - is a optional `{bufnr?: integer}` table. Some language server - capabilities can be file specific. - • Members - • {id} (number): The id allocated to the client. - • {name} (string): If a name is specified on creation, that will be - used. Otherwise it is just the client id. This is used for logs and - messages. - • {rpc} (table): RPC client object, for low level interaction with the - client. See |vim.lsp.rpc.start()|. - • {offset_encoding} (string): The encoding used for communicating with - the server. You can modify this in the `config`'s `on_init` method - before text is sent to the server. - • {handlers} (table): The handlers used by the client as described in - |lsp-handler|. - • {commands} (table): Table of command name to function which is called - if any LSP action (code action, code lenses, ...) triggers the - command. Client commands take precedence over the global command - registry. - • {requests} (table): The current pending requests in flight to the - server. Entries are key-value pairs with the key being the request ID - while the value is a table with `type`, `bufnr`, and `method` - key-value pairs. `type` is either "pending" for an active request, or - "cancel" for a cancel request. It will be "complete" ephemerally while - executing |LspRequest| autocmds when replies are received from the - server. - • {config} (table): Reference of the table that was passed by the user - to |vim.lsp.start_client()|. - • {server_capabilities} (table): Response from the server sent on - `initialize` describing the server's capabilities. - • {progress} A ring buffer (|vim.ringbuf()|) containing progress - messages sent by the server. - • {settings} Map with language server specific settings. See {config} in - |vim.lsp.start_client()| - • {flags} A table with flags for the client. See {config} in - |vim.lsp.start_client()| - client_is_stopped({client_id}) *vim.lsp.client_is_stopped()* Checks whether a client is stopped. @@ -820,10 +724,9 @@ formatexpr({opts}) *vim.lsp.formatexpr()* 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`. Parameters: ~ - • {opts} (`table`) options for customizing the formatting expression - which takes the following optional keys: - • timeout_ms (default 500ms). The timeout period for the - formatting request. + • {opts} (`table?`) A table with the following fields: + • {timeout_ms} (`integer`, default: 500ms) The timeout period + for the formatting request.. *vim.lsp.get_buffers_by_client_id()* get_buffers_by_client_id({client_id}) @@ -843,23 +746,23 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()* • {client_id} (`integer`) client id Return: ~ - (`lsp.Client?`) client rpc object + (`vim.lsp.Client?`) client rpc object get_clients({filter}) *vim.lsp.get_clients()* Get active clients. Parameters: ~ - • {filter} (`table?`) A table with key-value pairs used to filter the - returned clients. The available keys are: - • id (number): Only return clients with the given id - • bufnr (number): Only return clients attached to this + • {filter} (`table?`) Key-value pairs used to filter the returned + clients. + • {id}? (`integer`) Only return clients with the given id + • {bufnr}? (`integer`) Only return clients attached to this buffer - • name (string): Only return clients with the given name - • method (string): Only return clients supporting the given - method + • {name}? (`string`) Only return clients with the given name + • {method}? (`string`) Only return clients supporting the + given method Return: ~ - (`lsp.Client[]`) List of |vim.lsp.client| objects + (`vim.lsp.Client[]`) List of |vim.lsp.Client| objects get_log_path() *vim.lsp.get_log_path()* Gets the path of the logfile used by the LSP client. @@ -937,15 +840,16 @@ start({config}, {opts}) *vim.lsp.start()* `ftplugin/.lua` (See |ftplugin-name|) Parameters: ~ - • {config} (`lsp.ClientConfig`) Same configuration as documented in - |vim.lsp.start_client()| - • {opts} (`lsp.StartOpts?`) Optional keyword arguments: - • reuse_client (fun(client: client, config: table): 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 (number) Buffer handle to attach to if starting or - re-using a client (0 for current). + • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See + |vim.lsp.ClientConfig|. + • {opts} (`table?`) Optional keyword arguments + • {reuse_client} (`fun(client: vim.lsp.Client, config: + table): 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). Return: ~ (`integer?`) client_id @@ -953,112 +857,12 @@ start({config}, {opts}) *vim.lsp.start()* start_client({config}) *vim.lsp.start_client()* Starts and initializes a client with the given configuration. - Field `cmd` in {config} is required. - - Parameters: ~ - • {config} (`lsp.ClientConfig`) Configuration for the server: - • cmd: (string[]|fun(dispatchers: table):table) command - string[] that launches the language server (treated as in - |jobstart()|, must be absolute or on `$PATH`, shell - constructs like "~" are not expanded), or function that - creates an RPC client. Function receives a `dispatchers` - table and returns a table with member functions `request`, - `notify`, `is_closing` and `terminate`. See - |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|. For TCP - there is a builtin RPC client factory: - |vim.lsp.rpc.connect()| - • cmd_cwd: (string, default=|getcwd()|) Directory to launch - the `cmd` process. Not related to `root_dir`. - • cmd_env: (table) Environment flags to pass to the LSP on - spawn. Must be specified using a table. Non-string values - are coerced to string. Example: > - { PORT = 8080; HOST = "0.0.0.0"; } -< - • detached: (boolean, default true) Daemonize the server - process so that it runs in a separate process group from - Nvim. Nvim will shutdown the process on exit, but if Nvim - fails to exit cleanly this could leave behind orphaned - server processes. - • workspace_folders: (table) List of workspace folders - passed to the language server. For backwards compatibility - rootUri and rootPath will be derived from the first - workspace folder in this list. See `workspaceFolders` in - the LSP spec. - • capabilities: Map overriding the default capabilities - defined by |vim.lsp.protocol.make_client_capabilities()|, - passed to the language server on initialization. Hint: use - make_client_capabilities() and modify its result. - • Note: To send an empty dictionary use - |vim.empty_dict()|, else it will be encoded as an array. - • handlers: Map of language server method names to - |lsp-handler| - • settings: Map with language server specific settings. - These are returned to the language server if requested via - `workspace/configuration`. Keys are case-sensitive. - • commands: table Table that maps string of clientside - commands to user-defined functions. Commands passed to - start_client take precedence over the global command - registry. Each key must be a unique command name, and the - value is a function which is called if any LSP action - (code action, code lenses, ...) triggers the command. - • init_options Values to pass in the initialization request - as `initializationOptions`. See `initialize` in the LSP - spec. - • name: (string, default=client-id) Name in log messages. - • get_language_id: function(bufnr, filetype) -> language ID - as string. Defaults to the filetype. - • offset_encoding: (default="utf-16") One of "utf-8", - "utf-16", or "utf-32" which is the encoding that the LSP - server expects. Client does not verify this is correct. - • on_error: Callback with parameters (code, ...), invoked - when the client operation throws an error. `code` is a - number describing the error. Other arguments may be passed - depending on the error kind. See - `vim.lsp.rpc.client_errors` for possible errors. Use - `vim.lsp.rpc.client_errors[code]` to get human-friendly - name. - • before_init: Callback with parameters (initialize_params, - config) invoked before the LSP "initialize" phase, where - `params` contains the parameters being sent to the server - and `config` is the config that was passed to - |vim.lsp.start_client()|. You can use this to modify - parameters before they are sent. - • on_init: Callback (client, initialize_result) invoked - after LSP "initialize", where `result` is a table of - `capabilities` and anything else the server may send. For - example, clangd sends `initialize_result.offsetEncoding` - if `capabilities.offsetEncoding` was sent to it. You can - only modify the `client.offset_encoding` here before any - notifications are sent. - • on_exit Callback (code, signal, client_id) invoked on - client exit. - • code: exit code of the process - • signal: number describing the signal used to terminate - (if any) - • client_id: client handle - • on_attach: Callback (client, bufnr) invoked when client - attaches to a buffer. - • trace: ("off" | "messages" | "verbose" | nil) passed - directly to the language server in the initialize request. - Invalid/empty values will default to "off" - • flags: A table with flags for the client. The current - (experimental) flags are: - • allow_incremental_sync (bool, default true): Allow using - incremental sync for buffer edits - • debounce_text_changes (number, default 150): Debounce - didChange notifications to the server by the given - number in milliseconds. No debounce occurs if nil - • exit_timeout (number|boolean, default false): - Milliseconds to wait for server to exit cleanly after - sending the "shutdown" request before sending kill -15. - If set to false, nvim exits immediately after sending - the "shutdown" request to the server. - • root_dir: (string) Directory where the LSP server will - base its workspaceFolders, rootUri, and rootPath on - initialization. + Parameters: ~ + • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See + |vim.lsp.ClientConfig|. Return: ~ - (`integer?`) client_id. |vim.lsp.get_client_by_id()| Note: client may + (`integer?`) client_id |vim.lsp.get_client_by_id()| Note: client may not be fully initialized. Use `on_init` to do any actions once the client has been initialized. @@ -1072,7 +876,7 @@ status() *vim.lsp.status()* stop_client({client_id}, {force}) *vim.lsp.stop_client()* Stops a client(s). - You can also use the `stop()` function on a |vim.lsp.client| object. To + You can also use the `stop()` function on a |vim.lsp.Client| object. To stop all clients: >lua vim.lsp.stop_client(vim.lsp.get_clients()) < @@ -1081,8 +885,8 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()* for this client, then force-shutdown is attempted. Parameters: ~ - • {client_id} (`integer|table`) id or |vim.lsp.client| object, or list - thereof + • {client_id} (`integer|vim.lsp.Client`) id or |vim.lsp.Client| object, + or list thereof • {force} (`boolean?`) shutdown forcefully tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()* @@ -1109,9 +913,281 @@ with({handler}, {override_config}) *vim.lsp.with()* behavior of the {handler} +============================================================================== +Lua module: vim.lsp.client *lsp-client* + +*vim.lsp.Client* + + Fields: ~ + • {id} (`integer`) The id allocated to the client. + • {name} (`string`) If a name is specified on creation, + that will be used. Otherwise it is just the + client id. This is used for logs and messages. + • {rpc} (`vim.lsp.rpc.PublicClient`) RPC client + object, for low level interaction with the + client. See |vim.lsp.rpc.start()|. + • {offset_encoding} (`string`) The encoding used for communicating + with the server. You can modify this in the + `config`'s `on_init` method before text is + sent to the server. + • {handlers} (`table`) The handlers + used by the client as described in + |lsp-handler|. + • {requests} (`table`) + The current pending requests in flight to the + server. Entries are key-value pairs with the + key being the request ID while the value is a + table with `type`, `bufnr`, and `method` + key-value pairs. `type` is either "pending" + for an active request, or "cancel" for a + cancel request. It will be "complete" + ephemerally while executing |LspRequest| + autocmds when replies are received from the + server. + • {config} (`vim.lsp.ClientConfig`) copy of the table + that was passed by the user to + |vim.lsp.start_client()|. + • {server_capabilities} (`lsp.ServerCapabilities?`) Response from the + server sent on initialize` describing the + server's capabilities. + • {progress} (`vim.lsp.Client.Progress`) A ring buffer + (|vim.ringbuf()|) containing progress messages + sent by the server. + • {initialized} (`true?`) + • {workspace_folders} (`lsp.WorkspaceFolder[]?`) The workspace + folders configured in the client when the + server starts. This property is only available + if the client supports workspace folders. It + can be `null` if the client supports workspace + folders but none are configured. + • {root_dir} (`string`) + • {attached_buffers} (`table`) + • {commands} (`table`) Table of command name to function + which is called if any LSP action (code + action, code lenses, ...) triggers the + command. Client commands take precedence over + the global command registry. + • {settings} (`table`) + • {flags} (`table`) + • {get_language_id} (`fun(bufnr: integer, filetype: string): string`) + • {capabilities} (`lsp.ClientCapabilities`) The capabilities + provided by the client (editor or tool) + • {dynamic_capabilities} (`lsp.DynamicCapabilities`) + • {request} (`fun(method: string, params: table?, handler: lsp.Handler?, bufnr: integer): boolean, integer?`) + Sends a request to the server. This is a thin + wrapper around {client.rpc.request} with some + additional checking. If {handler} is not + specified, If one is not found there, then an + error will occur. Returns: {status}, + {[client_id]}. {status} is a boolean + indicating if the notification was successful. + If it is `false`, then it will always be + `false` (the client has shutdown). If {status} + is `true`, the function returns {request_id} + as the second result. You can use this with + `client.cancel_request(request_id)` to cancel + the request. + • {request_sync} (`fun(method: string, params: table?, timeout_ms: integer?, bufnr: integer): {err: lsp.ResponseError?, result:any}?, string?`) + err # a dictionary, where + • {notify} (`fun(method: string, params: table?): + boolean`) Sends a notification to an LSP + server. Returns: a boolean to indicate if the + notification was successful. If it is false, + then it will always be false (the client has + shutdown). + • {cancel_request} (`fun(id: integer): boolean`) Cancels a + request with a given request id. Returns: same + as `notify()`. + • {stop} (`fun(force?: boolean)`) Stops a client, + optionally with force. By default, it will + just ask the server to shutdown without force. + If you request to stop a client which has + previously been requested to shutdown, it will + automatically escalate and force shutdown. + • {on_attach} (`fun(bufnr: integer)`) Runs the on_attach + function from the client's config if it was + defined. Useful for buffer-local setup. + • {supports_method} (`fun(method: string, opts?: {bufnr: integer?}): boolean`) + Checks if a client supports a given method. + Always returns true for unknown off-spec + methods. [opts] is a optional `{bufnr?: + integer}` table. Some language server + capabilities can be file specific. + • {is_stopped} (`fun(): boolean`) Checks whether a client is + stopped. Returns: true if the client is fully + stopped. + +*vim.lsp.Client.Progress* + Extends: |vim.Ringbuf| + + Fields: ~ + • {pending} (`table`) + +*vim.lsp.ClientConfig* + + Fields: ~ + • {cmd} (`string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient?`) + command string[] that launches the language + server (treated as in |jobstart()|, must be + absolute or on `$PATH`, shell constructs like + "~" are not expanded), or function that creates + an RPC client. Function receives a `dispatchers` + table and returns a table with member functions + `request`, `notify`, `is_closing` and + `terminate`. See |vim.lsp.rpc.request()|, + |vim.lsp.rpc.notify()|. For TCP there is a + builtin RPC client factory: + |vim.lsp.rpc.connect()| + • {cmd_cwd}? (`string`, default: cwd) Directory to launch the + `cmd` process. Not related to `root_dir`. + • {cmd_env}? (`table`) Environment flags to pass to the LSP + on spawn. Must be specified using a table. + Non-string values are coerced to string. + Example: >lua + { PORT = 8080; HOST = "0.0.0.0"; } +< + • {detached}? (`boolean`, default: true) Daemonize the server + process so that it runs in a separate process + group from Nvim. Nvim will shutdown the process + on exit, but if Nvim fails to exit cleanly this + could leave behind orphaned server processes. + • {workspace_folders}? (`lsp.WorkspaceFolder[]`) List of workspace + folders passed to the language server. For + backwards compatibility rootUri and rootPath + will be derived from the first workspace folder + in this list. See `workspaceFolders` in the LSP + spec. + • {capabilities}? (`lsp.ClientCapabilities`) Map overriding the + default capabilities defined by + |vim.lsp.protocol.make_client_capabilities()|, + passed to the language server on initialization. + Hint: use make_client_capabilities() and modify + its result. + • Note: To send an empty dictionary use + |vim.empty_dict()|, else it will be encoded as + an array. + • {handlers}? (`table`) Map of language + server method names to |lsp-handler| + • {settings}? (`table`) Map with language server specific + settings. These are returned to the language + server if requested via + `workspace/configuration`. Keys are + case-sensitive. + • {commands}? (`table`) Table that maps string of clientside + commands to user-defined functions. Commands + passed to start_client take precedence over the + global command registry. Each key must be a + unique command name, and the value is a function + which is called if any LSP action (code action, + code lenses, ...) triggers the command. + • {init_options}? (`table`) Values to pass in the initialization + request as `initializationOptions`. See + `initialize` in the LSP spec. + • {name}? (`string`, default: client-id) Name in log + messages. + • {get_language_id}? (`fun(bufnr: integer, filetype: string): + string`) Language ID as string. Defaults to the + filetype. + • {offset_encoding}? (`'utf-8'|'utf-16'|'utf-32'`) The encoding that + the LSP server expects. Client does not verify + this is correct. + • {on_error}? (`fun(code: integer, err: string)`) Callback + invoked when the client operation throws an + error. `code` is a number describing the error. + Other arguments may be passed depending on the + error kind. See `vim.lsp.rpc.client_errors` for + possible errors. Use + `vim.lsp.rpc.client_errors[code]` to get + human-friendly name. + • {before_init}? (`vim.lsp.client.before_init_cb`) Callback + invoked before the LSP "initialize" phase, where + `params` contains the parameters being sent to + the server and `config` is the config that was + passed to |vim.lsp.start_client()|. You can use + this to modify parameters before they are sent. + • {on_init}? (`elem_or_list`) + Callback invoked after LSP "initialize", where + `result` is a table of `capabilities` and + anything else the server may send. For example, + clangd sends `initialize_result.offsetEncoding` + if `capabilities.offsetEncoding` was sent to it. + You can only modify the `client.offset_encoding` + here before any notifications are sent. + • {on_exit}? (`elem_or_list`) + Callback invoked on client exit. + • code: exit code of the process + • signal: number describing the signal used to + terminate (if any) + • client_id: client handle + • {on_attach}? (`elem_or_list`) + Callback invoked when client attaches to a + buffer. + • {trace}? (`'off'|'messages'|'verbose'`, default: "off") + Passed directly to the language server in the + initialize request. Invalid/empty values will + • {flags}? (`table`) A table with flags for the client. The + current (experimental) flags are: + • allow_incremental_sync (bool, default true): + Allow using incremental sync for buffer edits + • debounce_text_changes (number, default 150): + Debounce didChange notifications to the server + by the given number in milliseconds. No + debounce occurs if nil + • exit_timeout (number|boolean, default false): + Milliseconds to wait for server to exit + cleanly after sending the "shutdown" request + before sending kill -15. If set to false, nvim + exits immediately after sending the "shutdown" + request to the server. + • {root_dir}? (`string`) Directory where the LSP server will + base its workspaceFolders, rootUri, and rootPath + on initialization. + + + ============================================================================== Lua module: vim.lsp.buf *lsp-buf* +*vim.lsp.ListOpts* + + Fields: ~ + • {on_list}? (`fun(t: vim.lsp.LocationOpts.OnList)`) list-handler + replacing the default handler. Called for any non-empty + result. This table can be used with |setqflist()| or + |setloclist()|. E.g.: >lua + local function on_list(options) + vim.fn.setqflist({}, ' ', options) + vim.cmd.cfirst() + end + + vim.lsp.buf.definition({ on_list = on_list }) + vim.lsp.buf.references(nil, { on_list = on_list }) +< + + If you prefer loclist do something like this: >lua + local function on_list(options) + vim.fn.setloclist(0, {}, ' ', options) + vim.cmd.lopen() + end +< + +*vim.lsp.LocationOpts* + Extends: |vim.lsp.ListOpts| + + Fields: ~ + • {reuse_win}? (`boolean`) Jump to existing window if buffer is already + open. + +*vim.lsp.LocationOpts.OnList* + + Fields: ~ + • {items} (`table[]`) Structured like |setqflist-what| + • {title}? (`string`) Title for the list. + • {context}? (`table`) `ctx` from |lsp-handler| + + *vim.lsp.buf.add_workspace_folder()* add_workspace_folder({workspace_folder}) Add the folder at path to the workspace folders. If {path} is not @@ -1127,27 +1203,26 @@ code_action({options}) *vim.lsp.buf.code_action()* Selects a code action available at the current cursor position. Parameters: ~ - • {options} (`table?`) Optional table which holds the following - optional fields: - • context: (table|nil) Corresponds to `CodeActionContext` - of the LSP specification: - • diagnostics (table|nil): LSP `Diagnostic[]`. Inferred + • {options} (`table?`) A table with the following fields: + • {context}? (`lsp.CodeActionContext`) Corresponds to + `CodeActionContext` of the LSP specification: + • {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred from the current position if not provided. - • only (table|nil): List of LSP `CodeActionKind`s used to + • {only}? (`table`) List of LSP `CodeActionKind`s used to filter the code actions. Most language servers support values like `refactor` or `quickfix`. - • triggerKind (number|nil): The reason why code actions + • {triggerKind}? (`integer`) The reason why code actions were requested. - • filter: (function|nil) Predicate taking an `CodeAction` - and returning a boolean. - • apply: (boolean|nil) When set to `true`, and there is + • {filter}? (`fun(x: lsp.CodeAction|lsp.Command):boolean`) + Predicate taking an `CodeAction` and returning a boolean. + • {apply}? (`boolean`) When set to `true`, and there is just one remaining action (after filtering), the action is applied without user query. - • range: (table|nil) Range for which code actions should be - requested. If in visual mode this defaults to the active - selection. Table must contain `start` and `end` keys with - {row,col} tuples using mark-like indexing. See - |api-indexing| + • {range}? (`{start: integer[], end: integer[]}`) Range for + which code actions should be requested. If in visual mode + this defaults to the active selection. Table must contain + `start` and `end` keys with {row,col} tuples using + mark-like indexing. See |api-indexing| See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction @@ -1174,21 +1249,13 @@ declaration({options}) *vim.lsp.buf.declaration()* |vim.lsp.buf.definition()| instead. Parameters: ~ - • {options} (`table?`) additional options - • reuse_win: (boolean) Jump to existing window if buffer is - already open. - • on_list: (function) |lsp-on-list-handler| replacing the - default handler. Called for any non-empty result. + • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|. definition({options}) *vim.lsp.buf.definition()* Jumps to the definition of the symbol under the cursor. Parameters: ~ - • {options} (`table?`) additional options - • reuse_win: (boolean) Jump to existing window if buffer is - already open. - • on_list: (function) |lsp-on-list-handler| replacing the - default handler. Called for any non-empty result. + • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|. document_highlight() *vim.lsp.buf.document_highlight()* Send request to the server to resolve document highlights for the current @@ -1208,15 +1275,13 @@ document_symbol({options}) *vim.lsp.buf.document_symbol()* Lists all symbols in the current buffer in the quickfix window. Parameters: ~ - • {options} (`table?`) additional options - • on_list: (function) handler for list results. See - |lsp-on-list-handler| + • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|. execute_command({command_params}) *vim.lsp.buf.execute_command()* Executes an LSP server command. Parameters: ~ - • {command_params} (`table`) A valid `ExecuteCommandParams` object + • {command_params} (`lsp.ExecuteCommandParams`) See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand @@ -1226,38 +1291,37 @@ format({options}) *vim.lsp.buf.format()* server clients. Parameters: ~ - • {options} (`table?`) Optional table which holds the following - optional fields: - • formatting_options (table|nil): Can be used to specify + • {options} (`table?`) A table with the following fields: + • {formatting_options}? (`table`) Can be used to specify FormattingOptions. Some unspecified options will be automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions - • timeout_ms (integer|nil, default 1000): Time in + • {timeout_ms}? (`integer`, default: `1000`) Time in milliseconds to block for formatting requests. No effect - if async=true - • bufnr (number|nil): Restrict formatting to the clients - attached to the given buffer, defaults to the current - buffer (0). - • filter (function|nil): Predicate used to filter clients. - Receives a client as argument and must return a boolean. - Clients matching the predicate are included. Example: >lua - -- Never request typescript-language-server for formatting - vim.lsp.buf.format { - filter = function(client) return client.name ~= "tsserver" end - } + if async=true. + • {bufnr}? (`integer`, default: current buffer) Restrict + formatting to the clients attached to the given buffer. + • {filter}? (`fun(client: vim.lsp.Client): boolean?`) + Predicate used to filter clients. Receives a client as + argument and must return a boolean. Clients matching the + predicate are included. Example: >lua + -- Never request typescript-language-server for formatting + vim.lsp.buf.format { + filter = function(client) return client.name ~= "tsserver" end + } < - • async boolean|nil If true the method won't block. - Defaults to false. Editing the buffer while formatting + • {async}? (`boolean`, default: false) If true the method + won't block. Editing the buffer while formatting asynchronous can lead to unexpected changes. - • id (number|nil): Restrict formatting to the client with + • {id}? (`integer`) Restrict formatting to the client with ID (client.id) matching this field. - • name (string|nil): Restrict formatting to the client with + • {name}? (`string`) Restrict formatting to the client with name (client.name) matching this field. - • range (table|nil) Range to format. Table must contain - `start` and `end` keys with {row,col} tuples using (1,0) - indexing. Defaults to current selection in visual mode - Defaults to `nil` in other modes, formatting the full - buffer + • {range}? (`{start:integer[],end:integer[]}`, default: + current selection in visual mode, `nil` in other modes, + formatting the full buffer) Range to format. Table must + contain `start` and `end` keys with {row,col} tuples + using (1,0) indexing. hover() *vim.lsp.buf.hover()* Displays hover information about the symbol under the cursor in a floating @@ -1268,9 +1332,7 @@ implementation({options}) *vim.lsp.buf.implementation()* quickfix window. Parameters: ~ - • {options} (`table?`) additional options - • on_list: (function) |lsp-on-list-handler| replacing the - default handler. Called for any non-empty result. + • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|. incoming_calls() *vim.lsp.buf.incoming_calls()* Lists all the call sites of the symbol under the cursor in the |quickfix| @@ -1291,9 +1353,7 @@ references({context}, {options}) *vim.lsp.buf.references()* Parameters: ~ • {context} (`table?`) Context for the request - • {options} (`table?`) additional options - • on_list: (function) handler for list results. See - |lsp-on-list-handler| + • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|. See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references @@ -1312,11 +1372,12 @@ rename({new_name}, {options}) *vim.lsp.buf.rename()* Parameters: ~ • {new_name} (`string?`) If not provided, the user will be prompted for a new name using |vim.ui.input()|. - • {options} (`table?`) additional options - • filter (function|nil): Predicate used to filter clients. - Receives a client as argument and must return a boolean. - Clients matching the predicate are included. - • name (string|nil): Restrict clients used for rename to + • {options} (`table?`) Additional options: + • {filter}? (`fun(client: vim.lsp.Client): boolean?`) + Predicate used to filter clients. Receives a client as + argument and must return a boolean. Clients matching the + predicate are included. + • {name}? (`string`) Restrict clients used for rename to ones where client.name matches this field. signature_help() *vim.lsp.buf.signature_help()* @@ -1327,11 +1388,7 @@ type_definition({options}) *vim.lsp.buf.type_definition()* Jumps to the definition of the type of the symbol under the cursor. Parameters: ~ - • {options} (`table?`) additional options - • reuse_win: (boolean) Jump to existing window if buffer is - already open. - • on_list: (function) |lsp-on-list-handler| replacing the - default handler. Called for any non-empty result. + • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|. workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()* Lists all symbols in the current workspace in the quickfix window. @@ -1342,9 +1399,7 @@ workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()* Parameters: ~ • {query} (`string?`) optional - • {options} (`table?`) additional options - • on_list: (function) handler for list results. See - |lsp-on-list-handler| + • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|. ============================================================================== @@ -1470,10 +1525,9 @@ refresh({opts}) *vim.lsp.codelens.refresh()* < Parameters: ~ - • {opts} (`vim.lsp.codelens.RefreshOptions?`) Table with the following - fields: - • `bufnr` (integer|nil): filter by buffer. All buffers if nil, - 0 for current buffer + • {opts} (`table?`) Optional fields + • {bufnr} (`integer?`) filter by buffer. All buffers if nil, 0 + for current buffer run() *vim.lsp.codelens.run()* Run the code lens in the current line @@ -1525,17 +1579,15 @@ get({filter}) *vim.lsp.inlay_hint.get()* • This API is pre-release (unstable). Parameters: ~ - • {filter} (`vim.lsp.inlay_hint.get.filter?`) Optional filters - |kwargs|: - • bufnr (integer?): 0 for current buffer - • range (lsp.Range?) + • {filter} (`table?`) Optional filters |kwargs|: + • {bufnr} (`integer?`) + • {range} (`lsp.Range?`) Return: ~ - (`vim.lsp.inlay_hint.get.ret[]`) Each list item is a table with the - following fields: - • bufnr (integer) - • client_id (integer) - • inlay_hint (lsp.InlayHint) + (`table[]`) A list of objects with the following fields: + • {bufnr} (`integer`) + • {client_id} (`integer`) + • {inlay_hint} (`lsp.InlayHint`) is_enabled({bufnr}) *vim.lsp.inlay_hint.is_enabled()* @@ -1596,12 +1648,12 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) • {token} (`table`) a semantic token, found as `args.data.token` in |LspTokenUpdate|. • {bufnr} (`integer`) the buffer to highlight - • {client_id} (`integer`) The ID of the |vim.lsp.client| + • {client_id} (`integer`) The ID of the |vim.lsp.Client| • {hl_group} (`string`) Highlight group name - • {opts} (`table?`) Optional parameters. - • priority: (integer|nil) Priority for the applied - extmark. Defaults to - `vim.highlight.priorities.semantic_tokens + 3` + • {opts} (`table?`) Optional parameters: + • {priority}? (`integer`, default: + `vim.highlight.priorities.semantic_tokens + 3`) + Priority for the applied extmark. start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()* Start the semantic token highlighting engine for the given buffer with the @@ -1841,7 +1893,12 @@ locations_to_items({locations}, {offset_encoding}) buffer Return: ~ - (`vim.lsp.util.LocationItem[]`) list of items + (`table[]`) A list of objects with the following fields: + • {filename} (`string`) + • {lnum} (`integer`) 1-indexed line number + • {col} (`integer`) 1-indexed column + • {text} (`string`) + • {user_data} (`lsp.Location|lsp.LocationLink`) *vim.lsp.util.make_floating_popup_options()* make_floating_popup_options({width}, {height}, {opts}) @@ -1966,22 +2023,25 @@ open_floating_preview({contents}, {syntax}, {opts}) Parameters: ~ • {contents} (`table`) of lines to show in window • {syntax} (`string`) of syntax to set for opened buffer - • {opts} (`table`) with optional fields (additional keys are + • {opts} (`table?`) with optional fields (additional keys are filtered with |vim.lsp.util.make_floating_popup_options()| before they are passed on to |nvim_open_win()|) - • height: (integer) height of floating window - • width: (integer) width of floating window - • wrap: (boolean, default true) wrap long lines - • wrap_at: (integer) character to wrap at for computing - height when wrap is enabled - • max_width: (integer) maximal width of floating window - • max_height: (integer) maximal height of floating window - • focus_id: (string) if a popup with this id is opened, - then focus it - • close_events: (table) list of events that closes the + • {height}? (`integer`) Height of floating window + • {width}? (`integer`) Width of floating window + • {wrap}? (`boolean`, default: `true`) Wrap long lines + • {wrap_at}? (`integer`) Character to wrap at for + computing height when wrap is enabled + • {max_width}? (`integer`) Maximal width of floating + window + • {max_height}? (`integer`) Maximal height of floating + window + • {focus_id}? (`string`) If a popup with this id is + opened, then focus it + • {close_events}? (`table`) List of events that closes the floating window - • focusable: (boolean, default true) Make float focusable - • focus: (boolean, default true) If `true`, and if + • {focusable}? (`boolean`, default: `true`) Make float + focusable. + • {focus}? (`boolean`, default: `true`) If `true`, and if {focusable} is also `true`, focus an existing floating window with the same {focus_id} @@ -2011,9 +2071,9 @@ rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()* Parameters: ~ • {old_fname} (`string`) • {new_fname} (`string`) - • {opts} (`table?`) options - • overwrite? boolean - • ignoreIfExists? boolean + • {opts} (`table?`) Options: + • {overwrite}? (`boolean`) + • {ignoreIfExists}? (`boolean`) *vim.lsp.util.show_document()* show_document({location}, {offset_encoding}, {opts}) @@ -2106,6 +2166,17 @@ should_log({level}) *vim.lsp.log.should_log()* ============================================================================== Lua module: vim.lsp.rpc *lsp-rpc* +*vim.lsp.rpc.PublicClient* + + Fields: ~ + • {request} (`fun(method: string, params: table?, callback: fun(err: lsp.ResponseError?, result: any), notify_reply_callback: fun(integer)?):boolean,integer?`) + see |vim.lsp.rpc.request()| + • {notify} (`fun(method: string, params: any):boolean`) see + |vim.lsp.rpc.notify()| + • {is_closing} (`fun(): boolean`) + • {terminate} (`fun()`) + + connect({host}, {port}) *vim.lsp.rpc.connect()* Create a LSP RPC client factory that connects via TCP to the given host and port. @@ -2199,28 +2270,31 @@ start({cmd}, {dispatchers}, {extra_spawn_params}) *vim.lsp.rpc.start()* Parameters: ~ • {cmd} (`string[]`) Command to start the LSP server. - • {dispatchers} (`vim.lsp.rpc.Dispatchers?`) Dispatchers for LSP - message types. Valid dispatcher names are: - • `"notification"` - • `"server_request"` - • `"on_error"` - • `"on_exit"` - • {extra_spawn_params} (`vim.lsp.rpc.ExtraSpawnParams?`) Additional - context for the LSP server process. May contain: - • {cwd} (string) Working directory for the LSP - server process - • {detached?} (boolean) Detach the LSP server - process from the current process. Defaults to - false on Windows and true otherwise. - • {env?} (table) Additional environment - variables for LSP server process + • {dispatchers} (`table?`) Dispatchers for LSP message types. + • {notification} (`fun(method: string, params: + table)`) + • {server_request} (`fun(method: string, params: + table): any?, lsp.ResponseError?`) + • {on_exit} (`fun(code: integer, signal: + integer)`) + • {on_error} (`fun(code: integer, err: any)`) + • {extra_spawn_params} (`table?`) Additional context for the LSP server + process. + • {cwd}? (`string`) Working directory for the + LSP server process + • {detached}? (`boolean`) Detach the LSP server + process from the current process + • {env}? (`table`) Additional + environment variables for LSP server process. + See |vim.system()| Return: ~ (`vim.lsp.rpc.PublicClient?`) Client RPC object, with these methods: • `notify()` |vim.lsp.rpc.notify()| • `request()` |vim.lsp.rpc.request()| • `is_closing()` returns a boolean indicating if the RPC is closing. - • `terminate()` terminates the RPC client. + • `terminate()` terminates the RPC client. See + |vim.lsp.rpc.PublicClient|. ============================================================================== diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 797b097096..b4d66f11ae 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1828,16 +1828,16 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()* the current cursor • {col} (`integer?`) col to inspect, 0-based. Defaults to the col of the current cursor - • {filter} (`table?`) a table with key-value pairs to filter the items - • syntax (boolean): include syntax based highlight groups - (defaults to true) - • treesitter (boolean): include treesitter based highlight - groups (defaults to true) - • extmarks (boolean|"all"): include extmarks. When `all`, - then extmarks without a `hl_group` will also be included - (defaults to true) - • semantic_tokens (boolean): include semantic tokens + • {filter} (`table?`) Table with key-value pairs to filter the items + • {syntax} (`boolean`) Include syntax based highlight groups (defaults to true) + • {treesitter} (`boolean`) Include treesitter based + highlight groups (defaults to true) + • {extmarks} (`boolean|"all"`, default: true) Include + extmarks. When `all`, then extmarks without a `hl_group` + will also be included. + • {semantic_tokens} (`boolean`) Include semantic token + highlights (defaults to true) Return: ~ (`table`) a table with the following key-value pairs. Items are in @@ -1866,6 +1866,17 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* +*vim.Ringbuf* + + Fields: ~ + • {clear} (`fun()`) Clear all items + • {push} (`fun(item: T)`) Adds an item, overriding the oldest item if + the buffer is full. + • {pop} (`fun(): T?`) Removes and returns the first unread item + • {peek} (`fun(): T?`) Returns the first unread item without removing + it + + Ringbuf:clear() *Ringbuf:clear()* Clear all items @@ -1970,9 +1981,10 @@ vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()* • {s} (`string`) String to split • {sep} (`string`) Separator or pattern • {opts} (`table?`) Keyword arguments |kwargs|: - • plain: (boolean) Use `sep` literally (as in string.find). - • trimempty: (boolean) Discard empty segments at start and end - of the sequence. + • {plain}? (`boolean`) Use `sep` literally (as in + string.find). + • {trimempty}? (`boolean`) Discard empty segments at start and + end of the sequence. Return: ~ (`function`) Iterator over the split components @@ -2104,8 +2116,11 @@ vim.split({s}, {sep}, {opts}) *vim.split()* Parameters: ~ • {s} (`string`) String to split • {sep} (`string`) Separator or pattern - • {opts} (`table?`) Keyword arguments |kwargs| accepted by - |vim.gsplit()| + • {opts} (`table?`) Keyword arguments |kwargs|: + • {plain}? (`boolean`) Use `sep` literally (as in + string.find). + • {trimempty}? (`boolean`) Discard empty segments at start and + end of the sequence. Return: ~ (`string[]`) List of split components @@ -2151,8 +2166,8 @@ vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()* • {t} (`table`) Table to check • {value} (`any`) Value to compare or predicate function reference • {opts} (`table?`) Keyword arguments |kwargs|: - • predicate: (boolean) `value` is a function reference to be - checked (default false) + • {predicate}? (`boolean`) `value` is a function reference to + be checked (default false) Return: ~ (`boolean`) `true` if `t` contains `value` @@ -2419,23 +2434,23 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()* • {modname} (`string`) Module name, or `"*"` to find the top-level modules instead • {opts} (`table?`) Options for finding a module: - • rtp: (boolean) Search for modname in the runtime path - (defaults to `true`) - • paths: (string[]) Extra paths to search for modname - (defaults to `{}`) - • patterns: (string[]) List of patterns to use when - searching for modules. A pattern is a string added to the - basename of the Lua module being searched. (defaults to - `{"/init.lua", ".lua"}`) - • all: (boolean) Return all matches instead of just the - first one (defaults to `false`) - - Return: ~ - (`table`) A list of results with the following properties: - • modpath: (string) the path to the module - • modname: (string) the name of the module - • stat: (table|nil) the fs_stat of the module path. Won't be returned - for `modname="*"` + • {rtp}? (`boolean`, default: `true`) Search for modname in + the runtime path. + • {paths}? (`string[]`, default: `{}`) Extra paths to + search for modname + • {patterns}? (`string[]`, default: `{"/init.lua", + ".lua"}`) List of patterns to use when searching for + modules. A pattern is a string added to the basename of + the Lua module being searched. + • {all}? (`boolean`, default: `false`) Search for all + matches. + + Return: ~ + (`table[]`) A list of objects with the following fields: + • {modpath} (`string`) Path of the module + • {modname} (`string`) Name of the module + • {stat}? (`uv.uv_fs_t`) The fs_stat of the module path. Won't be + returned for `modname="*"` vim.loader.reset({path}) *vim.loader.reset()* Resets the cache for the path, or all the paths if path is nil. @@ -2678,6 +2693,9 @@ vim.filetype.add({filetypes}) *vim.filetype.add()* Parameters: ~ • {filetypes} (`table`) A table containing new filetype maps (see example). + • {pattern}? (`vim.filetype.mapping`) + • {extension}? (`vim.filetype.mapping`) + • {filename}? (`vim.filetype.mapping`) *vim.filetype.get_option()* vim.filetype.get_option({filetype}, {option}) @@ -2734,16 +2752,16 @@ vim.filetype.match({args}) *vim.filetype.match()* Parameters: ~ • {args} (`table`) Table specifying which matching strategy to use. Accepted keys are: - • buf (number): Buffer number to use for matching. Mutually - exclusive with {contents} - • filename (string): Filename to use for matching. When {buf} - is given, defaults to the filename of the given buffer + • {buf}? (`integer`) Buffer number to use for matching. + Mutually exclusive with {contents} + • {filename}? (`string`) Filename to use for matching. When + {buf} is given, defaults to the filename of the given buffer number. The file need not actually exist in the filesystem. When used without {buf} only the name of the file is used for filetype matching. This may result in failure to detect the filetype in cases where the filename alone is not enough to disambiguate the filetype. - • contents (table): An array of lines representing file + • {contents}? (`string[]`) An array of lines representing file contents to use for matching. Can be used with {filename}. Mutually exclusive with {buf}. @@ -2896,18 +2914,18 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* • path: full path of the current item The function should return `true` if the given item is considered a match. • {opts} (`table`) Optional keyword arguments: - • path (string): Path to begin searching from. If omitted, + • {path} (`string`) Path to begin searching from. If omitted, the |current-directory| is used. - • upward (boolean, default false): If true, search upward + • {upward} (`boolean`, default: `false`) Search upward through parent directories. Otherwise, search through child directories (recursively). - • stop (string): Stop searching when this directory is + • {stop} (`string`) Stop searching when this directory is reached. The directory itself is not searched. - • type (string): Find only items of the given type. If + • {type} (`string`) Find only items of the given type. If omitted, all items that match {names} are included. - • limit (number, default 1): Stop the search after finding - this many matches. Use `math.huge` to place no limit on the - number of matches. + • {limit} (`number`, default: `1`) Stop the search after + finding this many matches. Use `math.huge` to place no + limit on the number of matches. Return: ~ (`string[]`) Normalized paths |vim.fs.normalize()| of all matching @@ -2942,9 +2960,9 @@ vim.fs.normalize({path}, {opts}) *vim.fs.normalize()* Parameters: ~ • {path} (`string`) Path to normalize - • {opts} (`table?`) Options: - • expand_env: boolean Expand environment variables (default: - true) + • {opts} (`table?`) A table with the following fields: + • {expand_env} (`boolean`, default: `true`) Expand environment + variables. Return: ~ (`string`) Normalized path @@ -3538,14 +3556,15 @@ vim.secure.trust({opts}) *vim.secure.trust()* The trust database is located at |$XDG_STATE_HOME|/nvim/trust. Parameters: ~ - • {opts} (`table`) - • action (string): "allow" to add a file to the trust database - and trust it, "deny" to add a file to the trust database and - deny it, "remove" to remove file from the trust database - • path (string|nil): Path to a file to update. Mutually + • {opts} (`table?`) A table with the following fields: + • {action} (`'allow'|'deny'|'remove'`) - `'allow'` to add a + file to the trust database and trust it, + • `'deny'` to add a file to the trust database and deny it, + • `'remove'` to remove file from the trust database + • {path}? (`string`) Path to a file to update. Mutually exclusive with {bufnr}. Cannot be used when {action} is "allow". - • bufnr (number|nil): Buffer number to update. Mutually + • {bufnr}? (`integer`) Buffer number to update. Mutually exclusive with {path}. Return (multiple): ~ @@ -3628,8 +3647,8 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()* otherwise-equivalent versions. Parameters: ~ - • {v1} (`Version|number[]|string`) Version object. - • {v2} (`Version|number[]|string`) Version to compare with `v1`. + • {v1} (`vim.Version|number[]|string`) Version object. + • {v2} (`vim.Version|number[]|string`) Version to compare with `v1`. Return: ~ (`integer`) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`. @@ -3639,8 +3658,8 @@ vim.version.eq({v1}, {v2}) *vim.version.eq()* for usage. Parameters: ~ - • {v1} (`Version|number[]|string`) - • {v2} (`Version|number[]|string`) + • {v1} (`vim.Version|number[]|string`) + • {v2} (`vim.Version|number[]|string`) Return: ~ (`boolean`) @@ -3649,8 +3668,8 @@ vim.version.ge({v1}, {v2}) *vim.version.ge()* Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} (`Version|number[]|string`) - • {v2} (`Version|number[]|string`) + • {v1} (`vim.Version|number[]|string`) + • {v2} (`vim.Version|number[]|string`) Return: ~ (`boolean`) @@ -3659,8 +3678,8 @@ vim.version.gt({v1}, {v2}) *vim.version.gt()* Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} (`Version|number[]|string`) - • {v2} (`Version|number[]|string`) + • {v1} (`vim.Version|number[]|string`) + • {v2} (`vim.Version|number[]|string`) Return: ~ (`boolean`) @@ -3669,17 +3688,17 @@ vim.version.last({versions}) *vim.version.last()* TODO: generalize this, move to func.lua Parameters: ~ - • {versions} (`Version[]`) + • {versions} (`vim.Version[]`) Return: ~ - (`Version?`) + (`vim.Version?`) vim.version.le({v1}, {v2}) *vim.version.le()* Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} (`Version|number[]|string`) - • {v2} (`Version|number[]|string`) + • {v1} (`vim.Version|number[]|string`) + • {v2} (`vim.Version|number[]|string`) Return: ~ (`boolean`) @@ -3688,8 +3707,8 @@ vim.version.lt({v1}, {v2}) *vim.version.lt()* Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage. Parameters: ~ - • {v1} (`Version|number[]|string`) - • {v2} (`Version|number[]|string`) + • {v1} (`vim.Version|number[]|string`) + • {v2} (`vim.Version|number[]|string`) Return: ~ (`boolean`) @@ -3710,7 +3729,7 @@ vim.version.parse({version}, {opts}) *vim.version.parse()* "1.0", "0-x", "tmux 3.2a" into valid versions. Return: ~ - (`Version?`) parsed_version Version object or `nil` if input is + (`vim.Version?`) parsed_version Version object or `nil` if input is invalid. See also: ~ @@ -3744,6 +3763,12 @@ vim.version.range({spec}) *vim.version.range()* Parameters: ~ • {spec} (`string`) Version range "spec" + Return: ~ + (`table`) A table with the following fields: + • {from} (`vim.Version`) + • {to}? (`vim.Version`) + • {has} (`fun(self: vim.VersionRangeversion: string|vim.Version)`) + See also: ~ • https://github.com/npm/node-semver#ranges @@ -4380,15 +4405,15 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()* Parameters: ~ • {winid} (`integer?`) Window to convert (defaults to current window) • {opt} (`table?`) Optional parameters. - • title (string): Title tag to set in the generated HTML code - (defaults to buffer name) - • number_lines (boolean): Show line numbers (defaults to - `false`) - • font (string|string[]): Fonts to use (defaults to - `guifont`) - • width (integer) Width used for items which are either right - aligned or repeat a character infinitely (defaults to - 'textwidth' if non-zero or window width otherwise) + • {title}? (`string|false`, default: buffer name) Title tag + to set in the generated HTML code. + • {number_lines}? (`boolean`, default: `false`) Show line + numbers. + • {font}? (`string[]|string`, default: `guifont`) Fonts to + use. + • {width}? (`integer`, default: 'textwidth' if non-zero or + window width otherwise) Width used for items which are + either right aligned or repeat a character infinitely. Return: ~ (`string[]`) diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 09c086b7f7..1d9b67adec 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -732,16 +732,16 @@ get_node({opts}) *vim.treesitter.get_node()* < Parameters: ~ - • {opts} (`vim.treesitter.GetNodeOpts?`) Optional keyword arguments: - • bufnr integer|nil Buffer number (nil or 0 for current + • {opts} (`table?`) Optional keyword arguments: + • {bufnr} (`integer?`) Buffer number (nil or 0 for current buffer) - • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor - position in the current window. Required if {bufnr} is not - the current buffer - • lang string|nil Parser language. (default: from 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 + • {lang} (`string?`) Parser language. (default: from buffer filetype) - • ignore_injections boolean Ignore injected languages (default - true) + • {ignore_injections} (`boolean?`) Ignore injected languages + (default true) Return: ~ (`TSNode?`) Node at the given position @@ -787,7 +787,7 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* • {opts} (`table?`) Options to pass to the created language tree Return: ~ - (`LanguageTree`) object to use for parsing + (`vim.treesitter.LanguageTree`) object to use for parsing get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()* Get the range of a |TSNode|. Can also supply {source} and {metadata} to @@ -797,7 +797,7 @@ get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()* • {node} (`TSNode`) • {source} (`integer|string?`) Buffer or string from which the {node} is extracted - • {metadata} (`TSMetadata?`) + • {metadata} (`vim.treesitter.query.TSMetadata?`) Return: ~ (`Range6`) @@ -812,7 +812,7 @@ get_string_parser({str}, {lang}, {opts}) • {opts} (`table?`) Options to pass to the created language tree Return: ~ - (`LanguageTree`) object to use for parsing + (`vim.treesitter.LanguageTree`) object to use for parsing inspect_tree({opts}) *vim.treesitter.inspect_tree()* Open a window that displays a textual representation of the nodes in the @@ -917,10 +917,10 @@ add({lang}, {opts}) *vim.treesitter.language.add()* Parameters: ~ • {lang} (`string`) Name of the parser (alphanumerical and `_` only) • {opts} (`table?`) Options: - • filetype (string|string[]) Default filetype the parser - should be associated with. Defaults to {lang}. - • path (string|nil) Optional path the parser is located at - • symbol_name (string|nil) Internal symbol name for the + • {filetype}? (`string|string[]`, default: {lang}) Default + filetype the parser should be associated with. + • {path}? (`string`) Optional path the parser is located at + • {symbol_name}? (`string`) Internal symbol name for the language to load get_filetypes({lang}) *vim.treesitter.language.get_filetypes()* @@ -1069,10 +1069,10 @@ lint({buf}, {opts}) *vim.treesitter.query.lint()* Parameters: ~ • {buf} (`integer`) Buffer handle • {opts} (`table?`) Optional keyword arguments: - • langs (string|string[]|nil) Language(s) to use for checking + • {langs}? (`string|string[]`) Language(s) to use for checking the query. If multiple languages are specified, queries are validated for all of them - • clear (boolean) if `true`, just clear current lint errors + • {clear} (`boolean`) Just clear current lint errors list_directives() *vim.treesitter.query.list_directives()* Lists the currently available directives to use in queries. @@ -1153,8 +1153,8 @@ Query:iter_captures({node}, {source}, {start}, {stop}) Defaults to `node:end_()`. Return: ~ - (`fun(end_line: integer?): integer, TSNode, TSMetadata`) capture id, - capture node, metadata + (`fun(end_line: integer?): integer, TSNode, + vim.treesitter.query.TSMetadata`) capture id, capture node, metadata *Query:iter_matches()* Query:iter_matches({node}, {source}, {start}, {stop}, {opts}) @@ -1279,7 +1279,7 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()* Note: This includes the invoking tree's child trees as well. Parameters: ~ - • {fn} (`fun(tree: TSTree, ltree: LanguageTree)`) + • {fn} (`fun(tree: TSTree, ltree: vim.treesitter.LanguageTree)`) LanguageTree:included_regions() *LanguageTree:included_regions()* Gets the set of included regions managed by this LanguageTree. This can be @@ -1318,7 +1318,7 @@ LanguageTree:language_for_range({range}) • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }` Return: ~ - (`LanguageTree`) Managing {range} + (`vim.treesitter.LanguageTree`) Managing {range} *LanguageTree:named_node_for_range()* LanguageTree:named_node_for_range({range}, {opts}) diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua index e3c7fc68c0..52e0742ef3 100644 --- a/runtime/lua/tohtml.lua +++ b/runtime/lua/tohtml.lua @@ -25,13 +25,7 @@ -- Remarks: -- - Not all visuals are supported, so it may differ. ---- @class vim.tohtml.opt ---- @field title? string|false ---- @field number_lines? boolean ---- @field font? string[]|string ---- @field width? integer - ---- @class vim.tohtml.state.global +--- @class (private) vim.tohtml.state.global --- @field background string --- @field foreground string --- @field title string|false @@ -39,7 +33,7 @@ --- @field highlights_name table --- @field conf vim.tohtml.opt ---- @class vim.tohtml.state:vim.tohtml.state.global +--- @class (private) vim.tohtml.state:vim.tohtml.state.global --- @field style vim.tohtml.styletable --- @field tabstop string|false --- @field opt vim.wo @@ -48,20 +42,20 @@ --- @field width integer --- @field buflen integer ---- @class vim.tohtml.styletable +--- @class (private) vim.tohtml.styletable --- @field [integer] vim.tohtml.line (integer: (1-index, exclusive)) ---- @class vim.tohtml.line +--- @class (private) vim.tohtml.line --- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]} --- @field pre_text string[][] --- @field hide? boolean --- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive)) ---- @class vim.tohtml.cell +--- @class (private) vim.tohtml.cell --- @field [1] integer[] start --- @field [2] integer[] close ---- @field [3] any[][] virt_text ---- @field [4] any[][] overlay_text +--- @field [3] any[][] virt_text +--- @field [4] any[][] overlay_text local HIDE_ID = -1 -- stylua: ignore start @@ -1319,14 +1313,29 @@ end local M = {} +--- @class vim.tohtml.opt +--- @inlinedoc +--- +--- Title tag to set in the generated HTML code. +--- (default: buffer name) +--- @field title? string|false +--- +--- Show line numbers. +--- (default: `false`) +--- @field number_lines? boolean +--- +--- Fonts to use. +--- (default: `guifont`) +--- @field font? string[]|string +--- +--- Width used for items which are either right aligned or repeat a character +--- infinitely. +--- (default: 'textwidth' if non-zero or window width otherwise) +--- @field width? integer + --- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string. --- @param winid? integer Window to convert (defaults to current window) ---- @param opt? vim.tohtml.opt (table) Optional parameters. ---- - title (string): Title tag to set in the generated HTML code (defaults to buffer name) ---- - number_lines (boolean): Show line numbers (defaults to `false`) ---- - font (string|string[]): Fonts to use (defaults to `guifont`) ---- - width (integer) Width used for items which are either right aligned or repeat a character infinitely ---- (defaults to 'textwidth' if non-zero or window width otherwise) +--- @param opt? vim.tohtml.opt Optional parameters. --- @return string[] function M.tohtml(winid, opt) return win_to_html(winid or 0, opt) diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 4e39abb2be..d14007312e 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -190,6 +190,7 @@ function vim._os_proc_children(ppid) return children end +--- @nodoc --- @class vim.inspect.Opts --- @field depth? integer --- @field newline? string @@ -454,7 +455,7 @@ vim.cmd = setmetatable({}, { end, }) ---- @class vim.var_accessor +--- @class (private) vim.var_accessor --- @field [string] any --- @field [integer] vim.var_accessor @@ -1048,7 +1049,7 @@ function vim.deprecate(name, alternative, version, plugin, backtrace) -- e.g., when planned to be removed in version = '0.12' (soft-deprecated since 0.10-dev), -- show warnings since 0.11, including 0.11-dev (hard_deprecated_since = 0.11-dev). if plugin == 'Nvim' then - local current_version = vim.version() ---@type Version + local current_version = vim.version() ---@type vim.Version local removal_version = assert(vim.version.parse(version)) local is_hard_deprecated ---@type boolean diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua index 9a073c32c4..a19d40c50d 100644 --- a/runtime/lua/vim/_inspector.lua +++ b/runtime/lua/vim/_inspector.lua @@ -1,8 +1,18 @@ ----@class InspectorFilter ----@field syntax boolean include syntax based highlight groups (defaults to true) ----@field treesitter boolean include treesitter based highlight groups (defaults to true) ----@field extmarks boolean|"all" include extmarks. When `all`, then extmarks without a `hl_group` will also be included (defaults to true) ----@field semantic_tokens boolean include semantic token highlights (defaults to true) +--- @class vim._inspector.Filter +--- @inlinedoc +--- +--- Include syntax based highlight groups (defaults to true) +--- @field syntax boolean +--- +--- Include treesitter based highlight groups (defaults to true) +--- @field treesitter boolean +--- +--- Include extmarks. When `all`, then extmarks without a `hl_group` will also be included. +--- (default: true) +--- @field extmarks boolean|"all" +--- +--- Include semantic token highlights (defaults to true) +--- @field semantic_tokens boolean local defaults = { syntax = true, treesitter = true, @@ -17,11 +27,7 @@ local defaults = { ---@param bufnr? integer defaults to the current buffer ---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor ---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor ----@param filter? InspectorFilter (table) a table with key-value pairs to filter the items ---- - syntax (boolean): include syntax based highlight groups (defaults to true) ---- - treesitter (boolean): include treesitter based highlight groups (defaults to true) ---- - extmarks (boolean|"all"): include extmarks. When `all`, then extmarks without a `hl_group` will also be included (defaults to true) ---- - semantic_tokens (boolean): include semantic tokens (defaults to true) +---@param filter? vim._inspector.Filter Table with key-value pairs to filter the items ---@return {treesitter:table,syntax:table,extmarks:table,semantic_tokens:table,buffer:integer,col:integer,row:integer} (table) a table with the following key-value pairs. Items are in "traversal order": --- - treesitter: a list of treesitter captures --- - syntax: a list of syntax groups @@ -139,7 +145,7 @@ end ---@param bufnr? integer defaults to the current buffer ---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor ---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor ----@param filter? InspectorFilter (table) see |vim.inspect_pos()| +---@param filter? vim._inspector.Filter (table) see |vim.inspect_pos()| function vim.show_pos(bufnr, row, col, filter) local items = vim.inspect_pos(bufnr, row, col, filter) diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index 472162ecc1..4831989e1a 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -61,6 +61,7 @@ error('Cannot require a meta file') --- --- +---@nodoc ---@class vim.NIL ---@type vim.NIL diff --git a/runtime/lua/vim/_meta/lpeg.lua b/runtime/lua/vim/_meta/lpeg.lua index 202c99f18c..1ce40f3340 100644 --- a/runtime/lua/vim/_meta/lpeg.lua +++ b/runtime/lua/vim/_meta/lpeg.lua @@ -21,6 +21,7 @@ error('Cannot require a meta file') vim.lpeg = {} +--- @nodoc --- @class vim.lpeg.Pattern --- @operator unm: vim.lpeg.Pattern --- @operator add(vim.lpeg.Pattern): vim.lpeg.Pattern @@ -167,6 +168,7 @@ function vim.lpeg.S(string) end --- @return vim.lpeg.Pattern function vim.lpeg.V(v) end +--- @nodoc --- @class vim.lpeg.Locale --- @field alnum userdata --- @field alpha userdata diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua index ab403b97e7..595ad96319 100644 --- a/runtime/lua/vim/_meta/regex.lua +++ b/runtime/lua/vim/_meta/regex.lua @@ -12,6 +12,7 @@ --- @return vim.regex function vim.regex(re) end +--- @nodoc --- @class vim.regex local regex = {} -- luacheck: no unused diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua index f1fed50c6d..bde9421552 100644 --- a/runtime/lua/vim/_options.lua +++ b/runtime/lua/vim/_options.lua @@ -797,6 +797,7 @@ end --- `vim.opt_global`. --- +--- @nodoc --- @class vim.Option local Option = {} -- luacheck: no unused diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 49165c4db9..3979e5512c 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -2,18 +2,44 @@ local api, if_nil = vim.api, vim.F.if_nil local M = {} +--- *diagnostic-structure* +--- +--- Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based +--- rows and columns). |api-indexing| --- @class vim.Diagnostic +--- +--- Buffer number --- @field bufnr? integer ---- @field lnum integer 0-indexed ---- @field end_lnum? integer 0-indexed ---- @field col integer 0-indexed ---- @field end_col? integer 0-indexed +--- +--- The starting line of the diagnostic (0-indexed) +--- @field lnum integer +--- +--- The final line of the diagnostic (0-indexed) +--- @field end_lnum? integer +--- +--- The starting column of the diagnostic (0-indexed) +--- @field col integer +--- +--- The final column of the diagnostic (0-indexed) +--- @field end_col? integer +--- +--- The severity of the diagnostic |vim.diagnostic.severity| --- @field severity? vim.diagnostic.Severity +--- +--- The diagnostic text --- @field message string +--- +--- The source of the diagnostic --- @field source? string +--- +--- The diagnostic code --- @field code? string|integer +--- --- @field _tags? { deprecated: boolean, unnecessary: boolean} +--- +--- Arbitrary data plugins or users can add --- @field user_data? any arbitrary data plugins can add +--- --- @field namespace? integer --- @class vim.diagnostic.Opts @@ -104,7 +130,7 @@ local global_diagnostic_options = { severity_sort = false, } ---- @class vim.diagnostic.Handler +--- @class (private) vim.diagnostic.Handler --- @field show? fun(namespace: integer, bufnr: integer, diagnostics: vim.Diagnostic[], opts?: vim.diagnostic.OptsResolved) --- @field hide? fun(namespace:integer, bufnr:integer) @@ -154,7 +180,7 @@ do }) end ---- @class vim.diagnostic._extmark +--- @class (private) vim.diagnostic._extmark --- @field [1] integer id --- @field [2] integer start --- @field [3] integer end @@ -1018,31 +1044,52 @@ function M.get_next_pos(opts) return { next.lnum, next.col } end +--- A table with the following keys: --- @class vim.diagnostic.GetOpts +--- @inlinedoc +--- +--- Limit diagnostics to the given namespace. --- @field namespace? integer +--- +--- Limit diagnostics to the given line number. --- @field lnum? integer +--- +--- See |diagnostic-severity|. --- @field severity? vim.diagnostic.SeverityFilter +--- Configuration table with the following keys: --- @class vim.diagnostic.GotoOpts : vim.diagnostic.GetOpts +--- @inlinedoc +--- +--- Only consider diagnostics from the given namespace. +--- @field namespace integer +--- +--- Cursor position as a (row, col) tuple. +--- See |nvim_win_get_cursor()|. Defaults to the current cursor position. --- @field cursor_position? {[1]:integer,[2]:integer} +--- +--- Whether to loop around file or not. Similar to 'wrapscan'. +--- (default: `true`) --- @field wrap? boolean +--- +--- See |diagnostic-severity|. +--- @field severity vim.diagnostic.Severity +--- +--- If "true", call |vim.diagnostic.open_float()| +--- after moving. If a table, pass the table as the {opts} parameter +--- to |vim.diagnostic.open_float()|. Unless overridden, the float will show +--- diagnostics at the new cursor position (as if "cursor" were passed to +--- the "scope" option). +--- (default: `true`) --- @field float? boolean|vim.diagnostic.Opts.Float +--- +--- Window ID +--- (default: `0`) --- @field win_id? integer --- Move to the next diagnostic. --- ----@param opts? vim.diagnostic.GotoOpts (table) Configuration table with the following keys: ---- - namespace: (integer) Only consider diagnostics from the given namespace. ---- - cursor_position: (cursor position) Cursor position as a (row, col) tuple. ---- See |nvim_win_get_cursor()|. Defaults to the current cursor position. ---- - wrap: (boolean, default true) Whether to loop around file or not. Similar to 'wrapscan'. ---- - severity: See |diagnostic-severity|. ---- - float: (boolean or table, default true) If "true", call |vim.diagnostic.open_float()| ---- after moving. If a table, pass the table as the {opts} parameter ---- to |vim.diagnostic.open_float()|. Unless overridden, the float will show ---- diagnostics at the new cursor position (as if "cursor" were passed to ---- the "scope" option). ---- - win_id: (number, default 0) Window ID +---@param opts? vim.diagnostic.GotoOpts function M.goto_next(opts) diagnostic_move_pos(opts, M.get_next_pos(opts)) end @@ -1789,38 +1836,54 @@ function M.reset(namespace, bufnr) end end +--- Configuration table with the following keys: --- @class vim.diagnostic.setqflist.Opts +--- @inlinedoc +--- +--- Only add diagnostics from the given namespace. --- @field namespace? integer +--- +--- Open quickfix list after setting. +--- (default: `true`) --- @field open? boolean +--- +--- Title of quickfix list. Defaults to "Diagnostics". --- @field title? string +--- +--- See |diagnostic-severity|. --- @field severity? vim.diagnostic.Severity --- Add all diagnostics to the quickfix list. --- ----@param opts? vim.diagnostic.setqflist.Opts (table) Configuration table with the following keys: ---- - namespace: (number) Only add diagnostics from the given namespace. ---- - open: (boolean, default true) Open quickfix list after setting. ---- - title: (string) Title of quickfix list. Defaults to "Diagnostics". ---- - severity: See |diagnostic-severity|. +---@param opts? vim.diagnostic.setqflist.Opts function M.setqflist(opts) set_list(false, opts) end +---Configuration table with the following keys: --- @class vim.diagnostic.setloclist.Opts +--- @inlinedoc +--- +--- Only add diagnostics from the given namespace. --- @field namespace? integer +--- +--- Window number to set location list for. +--- (default: `0`) +--- @field winnr? integer +--- +--- Open the location list after setting. +--- (default: `true`) --- @field open? boolean +--- +--- Title of the location list. Defaults to "Diagnostics". --- @field title? string +--- +--- See |diagnostic-severity|. --- @field severity? vim.diagnostic.Severity ---- @field winnr? integer --- Add buffer diagnostics to the location list. --- ----@param opts? vim.diagnostic.setloclist.Opts (table) Configuration table with the following keys: ---- - namespace: (number) Only add diagnostics from the given namespace. ---- - winnr: (number, default 0) Window number to set location list for. ---- - open: (boolean, default true) Open the location list after setting. ---- - title: (string) Title of the location list. Defaults to "Diagnostics". ---- - severity: See |diagnostic-severity|. +---@param opts? vim.diagnostic.setloclist.Opts function M.setloclist(opts) set_list(true, opts) end diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index e7971d8916..fba76f93b2 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2082,6 +2082,7 @@ local function normalize_path(path, as_pattern) end --- @class vim.filetype.add.filetypes +--- @inlinedoc --- @field pattern? vim.filetype.mapping --- @field extension? vim.filetype.mapping --- @field filename? vim.filetype.mapping @@ -2170,7 +2171,7 @@ end --- } --- ``` --- ----@param filetypes vim.filetype.add.filetypes (table) A table containing new filetype maps (see example). +---@param filetypes vim.filetype.add.filetypes A table containing new filetype maps (see example). function M.add(filetypes) for k, v in pairs(filetypes.extension or {}) do extension[k] = v @@ -2272,8 +2273,23 @@ local function match_pattern(name, path, tail, pat) end --- @class vim.filetype.match.args +--- @inlinedoc +--- +--- Buffer number to use for matching. Mutually exclusive with {contents} --- @field buf? integer +--- +--- Filename to use for matching. When {buf} is given, +--- defaults to the filename of the given buffer number. The +--- file need not actually exist in the filesystem. When used +--- without {buf} only the name of the file is used for +--- filetype matching. This may result in failure to detect +--- the filetype in cases where the filename alone is not +--- enough to disambiguate the filetype. --- @field filename? string +--- +--- An array of lines representing file contents to use for +--- matching. Can be used with {filename}. Mutually exclusive +--- with {buf}. --- @field contents? string[] --- Perform filetype detection. @@ -2305,20 +2321,8 @@ end --- vim.filetype.match({ contents = {'#!/usr/bin/env bash'} }) --- ``` --- ----@param args vim.filetype.match.args (table) Table specifying which matching strategy to use. +---@param args vim.filetype.match.args Table specifying which matching strategy to use. --- Accepted keys are: ---- * buf (number): Buffer number to use for matching. Mutually exclusive with ---- {contents} ---- * filename (string): Filename to use for matching. When {buf} is given, ---- defaults to the filename of the given buffer number. The ---- file need not actually exist in the filesystem. When used ---- without {buf} only the name of the file is used for ---- filetype matching. This may result in failure to detect ---- the filetype in cases where the filename alone is not ---- enough to disambiguate the filetype. ---- * contents (table): An array of lines representing file contents to use for ---- matching. Can be used with {filename}. Mutually exclusive ---- with {buf}. ---@return string|nil # If a match was found, the matched filetype. ---@return function|nil # A function that modifies buffer state when called (for example, to set some --- filetype specific buffer variables). The function accepts a buffer number as diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 0af5fc4f30..a47b35e991 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -147,11 +147,29 @@ function M.dir(path, opts) end) end ---- @class vim.fs.find.opts +--- @class vim.fs.find.Opts +--- @inlinedoc +--- +--- Path to begin searching from. If +--- omitted, the |current-directory| is used. --- @field path string +--- +--- Search upward through parent directories. +--- Otherwise, search through child directories (recursively). +--- (default: `false`) --- @field upward boolean +--- +--- Stop searching when this directory is reached. +--- The directory itself is not searched. --- @field stop string +--- +--- Find only items of the given type. +--- If omitted, all items that match {names} are included. --- @field type string +--- +--- Stop the search after finding this many matches. +--- Use `math.huge` to place no limit on the number of matches. +--- (default: `1`) --- @field limit number --- Find files or directories (or other items as specified by `opts.type`) in the given path. @@ -194,23 +212,10 @@ end --- - path: full path of the current item --- The function should return `true` if the given item is considered a match. --- ----@param opts (table) Optional keyword arguments: ---- - path (string): Path to begin searching from. If ---- omitted, the |current-directory| is used. ---- - upward (boolean, default false): If true, search ---- upward through parent directories. Otherwise, ---- search through child directories ---- (recursively). ---- - stop (string): Stop searching when this directory is ---- reached. The directory itself is not searched. ---- - type (string): Find only items of the given type. ---- If omitted, all items that match {names} are included. ---- - limit (number, default 1): Stop the search after ---- finding this many matches. Use `math.huge` to ---- place no limit on the number of matches. +---@param opts vim.fs.find.Opts Optional keyword arguments: ---@return (string[]) # Normalized paths |vim.fs.normalize()| of all matching items function M.find(names, opts) - opts = opts or {} --[[@as vim.fs.find.opts]] + opts = opts or {} vim.validate({ names = { names, { 's', 't', 'f' } }, path = { opts.path, 's', true }, @@ -318,6 +323,13 @@ function M.find(names, opts) return matches end +--- @class vim.fs.normalize.Opts +--- @inlinedoc +--- +--- Expand environment variables. +--- (default: `true`) +--- @field expand_env boolean + --- Normalize a path to a standard format. A tilde (~) character at the --- beginning of the path is expanded to the user's home directory and any --- backslash (\) characters are converted to forward slashes (/). Environment @@ -337,9 +349,8 @@ end --- ``` --- ---@param path (string) Path to normalize ----@param opts table|nil Options: ---- - expand_env: boolean Expand environment variables (default: true) ----@return (string) Normalized path +---@param opts? vim.fs.normalize.Opts +---@return (string) : Normalized path function M.normalize(path, opts) opts = opts or {} diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index 798428014d..09de969b5b 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -64,11 +64,13 @@ --- In addition to the |vim.iter()| function, the |vim.iter| module provides --- convenience functions like |vim.iter.filter()| and |vim.iter.totable()|. +---@nodoc ---@class IterMod ---@operator call:Iter local M = {} +---@nodoc ---@class Iter local Iter = {} Iter.__index = Iter @@ -77,6 +79,7 @@ Iter.__call = function(self) end --- Special case implementations for iterators on list tables. +---@nodoc ---@class ListIter : Iter ---@field _table table Underlying table data ---@field _head number Index to the front of a table iterator diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index 5f3da55544..0d708ca1eb 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -10,16 +10,37 @@ local M = {} ---@alias CacheHash {mtime: {nsec: integer, sec: integer}, size: integer, type?: uv.aliases.fs_stat_types} ---@alias CacheEntry {hash:CacheHash, chunk:string} ----@class ModuleFindOpts ----@field all? boolean Search for all matches (defaults to `false`) ----@field rtp? boolean Search for modname in the runtime path (defaults to `true`) ----@field patterns? string[] Patterns to use (defaults to `{"/init.lua", ".lua"}`) ----@field paths? string[] Extra paths to search for modname - ----@class ModuleInfo ----@field modpath string Path of the module ----@field modname string Name of the module ----@field stat? uv.uv_fs_t File stat of the module path +--- @class vim.loader.find.Opts +--- @inlinedoc +--- +--- Search for modname in the runtime path. +--- (default: `true`) +--- @field rtp? boolean +--- +--- Extra paths to search for modname +--- (default: `{}`) +--- @field paths? string[] +--- +--- List of patterns to use when searching for modules. +--- A pattern is a string added to the basename of the Lua module being searched. +--- (default: `{"/init.lua", ".lua"}`) +--- @field patterns? string[] +--- +--- Search for all matches. +--- (default: `false`) +--- @field all? boolean + +--- @class vim.loader.ModuleInfo +--- @inlinedoc +--- +--- Path of the module +--- @field modpath string +--- +--- Name of the module +--- @field modname string +--- +--- The fs_stat of the module path. Won't be returned for `modname="*"` +--- @field stat? uv.uv_fs_t ---@alias LoaderStats table @@ -29,14 +50,14 @@ M.path = vim.fn.stdpath('cache') .. '/luac' ---@nodoc M.enabled = false ----@class Loader ----@field _rtp string[] ----@field _rtp_pure string[] ----@field _rtp_key string ----@field _hashes? table +---@class (private) Loader +---@field private _rtp string[] +---@field private _rtp_pure string[] +---@field private _rtp_key string +---@field private _hashes? table local Loader = { VERSION = 4, - ---@type table> + ---@type table> _indexed = {}, ---@type table _topmods = {}, @@ -270,17 +291,8 @@ end --- Finds Lua modules for the given module name. ---@param modname string Module name, or `"*"` to find the top-level modules instead ----@param opts? ModuleFindOpts (table) Options for finding a module: ---- - rtp: (boolean) Search for modname in the runtime path (defaults to `true`) ---- - paths: (string[]) Extra paths to search for modname (defaults to `{}`) ---- - patterns: (string[]) List of patterns to use when searching for modules. ---- A pattern is a string added to the basename of the Lua module being searched. ---- (defaults to `{"/init.lua", ".lua"}`) ---- - all: (boolean) Return all matches instead of just the first one (defaults to `false`) ----@return ModuleInfo[] (table) A list of results with the following properties: ---- - modpath: (string) the path to the module ---- - modname: (string) the name of the module ---- - stat: (table|nil) the fs_stat of the module path. Won't be returned for `modname="*"` +---@param opts? vim.loader.find.Opts Options for finding a module: +---@return vim.loader.ModuleInfo[] function M.find(modname, opts) opts = opts or {} @@ -306,7 +318,7 @@ function M.find(modname, opts) patterns[p] = '/lua/' .. basename .. pattern end - ---@type ModuleInfo[] + ---@type vim.loader.ModuleInfo[] local results = {} -- Only continue if we haven't found anything yet or we want to find all @@ -472,12 +484,12 @@ function Loader.track(stat, f) end end ----@class ProfileOpts +---@class (private) vim.loader._profile.Opts ---@field loaders? boolean Add profiling to the loaders --- Debug function that wraps all loaders and tracks stats ---@private ----@param opts ProfileOpts? +---@param opts vim.loader._profile.Opts? function M._profile(opts) Loader.get_rtp = Loader.track('get_rtp', Loader.get_rtp) Loader.read = Loader.track('read', Loader.read) diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 19497e40dc..8ebf4de3cb 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -108,12 +108,12 @@ function lsp._buf_get_line_ending(bufnr) end -- Tracks all clients created via lsp.start_client -local active_clients = {} --- @type table +local active_clients = {} --- @type table local all_buffer_active_clients = {} --- @type table> -local uninitialized_clients = {} --- @type table +local uninitialized_clients = {} --- @type table ---@param bufnr? integer ----@param fn fun(client: lsp.Client, client_id: integer, bufnr: integer) +---@param fn fun(client: vim.lsp.Client, client_id: integer, bufnr: integer) local function for_each_buffer_client(bufnr, fn, restrict_client_ids) validate({ fn = { fn, 'f' }, @@ -200,105 +200,15 @@ local function once(fn) end end --- FIXME: DOC: Shouldn't need to use a dummy function --- ---- LSP client object. You can get an active client object via ---- |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|. +--- @class vim.lsp.start.Opts +--- @inlinedoc --- ---- - Methods: ---- - request(method, params, [handler], bufnr) ---- Sends a request to the server. ---- This is a thin wrapper around {client.rpc.request} with some additional ---- checking. ---- If {handler} is not specified, If one is not found there, then an error will occur. ---- Returns: {status}, {[client_id]}. {status} is a boolean indicating if ---- the notification was successful. If it is `false`, then it will always ---- be `false` (the client has shutdown). ---- If {status} is `true`, the function returns {request_id} as the second ---- result. You can use this with `client.cancel_request(request_id)` ---- to cancel the request. +--- 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: table): boolean --- ---- - request_sync(method, params, timeout_ms, bufnr) ---- Sends a request to the server and synchronously waits for the response. ---- This is a wrapper around {client.request} ---- Returns: { err=err, result=result }, a dictionary, where `err` and `result` come from ---- the |lsp-handler|. On timeout, cancel or error, returns `(nil, err)` where `err` is a ---- string describing the failure reason. If the request was unsuccessful returns `nil`. ---- ---- - notify(method, params) ---- Sends a notification to an LSP server. ---- Returns: a boolean to indicate if the notification was successful. If ---- it is false, then it will always be false (the client has shutdown). ---- ---- - cancel_request(id) ---- Cancels a request with a given request id. ---- Returns: same as `notify()`. ---- ---- - stop([force]) ---- Stops a client, optionally with force. ---- By default, it will just ask the server to shutdown without force. ---- If you request to stop a client which has previously been requested to ---- shutdown, it will automatically escalate and force shutdown. ---- ---- - is_stopped() ---- Checks whether a client is stopped. ---- Returns: true if the client is fully stopped. ---- ---- - on_attach(client, bufnr) ---- Runs the on_attach function from the client's config if it was defined. ---- Useful for buffer-local setup. ---- ---- - supports_method(method, [opts]): boolean ---- Checks if a client supports a given method. ---- Always returns true for unknown off-spec methods. ---- [opts] is a optional `{bufnr?: integer}` table. ---- Some language server capabilities can be file specific. ---- ---- - Members ---- - {id} (number): The id allocated to the client. ---- ---- - {name} (string): If a name is specified on creation, that will be ---- used. Otherwise it is just the client id. This is used for ---- logs and messages. ---- ---- - {rpc} (table): RPC client object, for low level interaction with the ---- client. See |vim.lsp.rpc.start()|. ---- ---- - {offset_encoding} (string): The encoding used for communicating ---- with the server. You can modify this in the `config`'s `on_init` method ---- before text is sent to the server. ---- ---- - {handlers} (table): The handlers used by the client as described in |lsp-handler|. ---- ---- - {commands} (table): Table of command name to function which is called if ---- any LSP action (code action, code lenses, ...) triggers the command. ---- Client commands take precedence over the global command registry. ---- ---- - {requests} (table): The current pending requests in flight ---- to the server. Entries are key-value pairs with the key ---- being the request ID while the value is a table with `type`, ---- `bufnr`, and `method` key-value pairs. `type` is either "pending" ---- for an active request, or "cancel" for a cancel request. It will ---- be "complete" ephemerally while executing |LspRequest| autocmds ---- when replies are received from the server. ---- ---- - {config} (table): Reference of the table that was passed by the user ---- to |vim.lsp.start_client()|. ---- ---- - {server_capabilities} (table): Response from the server sent on ---- `initialize` describing the server's capabilities. ---- ---- - {progress} A ring buffer (|vim.ringbuf()|) containing progress messages ---- sent by the server. ---- ---- - {settings} Map with language server specific settings. ---- See {config} in |vim.lsp.start_client()| ---- ---- - {flags} A table with flags for the client. See {config} in |vim.lsp.start_client()| -lsp.client = nil - ---- @class lsp.StartOpts ---- @field reuse_client fun(client: lsp.Client, config: table): boolean +--- Buffer handle to attach to if starting or re-using a client (0 for current). --- @field bufnr integer --- Create a new LSP client and start a language server or reuses an already @@ -337,17 +247,9 @@ lsp.client = nil --- Either use |:au|, |nvim_create_autocmd()| or put the call in a --- `ftplugin/.lua` (See |ftplugin-name|) --- ----@param config lsp.ClientConfig Same configuration as documented in |vim.lsp.start_client()| ----@param opts lsp.StartOpts? Optional keyword arguments: ---- - reuse_client (fun(client: client, config: table): 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 (number) ---- Buffer handle to attach to if starting or re-using a ---- client (0 for current). ----@return integer? client_id +--- @param config vim.lsp.ClientConfig Configuration for the server. +--- @param opts vim.lsp.start.Opts? Optional keyword arguments +--- @return integer? client_id function lsp.start(config, opts) opts = opts or {} local reuse_client = opts.reuse_client @@ -428,7 +330,7 @@ local function is_empty_or_default(bufnr, option) end ---@private ----@param client lsp.Client +---@param client vim.lsp.Client ---@param bufnr integer function lsp._set_defaults(client, bufnr) if @@ -482,7 +384,7 @@ local function reset_defaults(bufnr) end) end ---- @param client lsp.Client +--- @param client vim.lsp.Client local function on_client_init(client) local id = client.id uninitialized_clients[id] = nil @@ -552,121 +454,9 @@ local function on_client_exit(code, signal, client_id) end) end --- FIXME: DOC: Currently all methods on the `vim.lsp.client` object are --- documented twice: Here, and on the methods themselves (e.g. --- `client.request()`). This is a workaround for the vimdoc generator script --- not handling method names correctly. If you change the documentation on --- either, please make sure to update the other as well. --- --- Starts and initializes a client with the given configuration. ---- ---- Field `cmd` in {config} is required. ---- ----@param config (lsp.ClientConfig) Configuration for the server: ---- - cmd: (string[]|fun(dispatchers: table):table) command string[] that launches the language ---- server (treated as in |jobstart()|, must be absolute or on `$PATH`, shell constructs like ---- "~" are not expanded), or function that creates an RPC client. Function receives ---- a `dispatchers` table and returns a table with member functions `request`, `notify`, ---- `is_closing` and `terminate`. ---- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|. ---- For TCP there is a builtin RPC client factory: |vim.lsp.rpc.connect()| ---- ---- - cmd_cwd: (string, default=|getcwd()|) Directory to launch ---- the `cmd` process. Not related to `root_dir`. ---- ---- - cmd_env: (table) Environment flags to pass to the LSP on ---- spawn. Must be specified using a table. ---- Non-string values are coerced to string. ---- Example: ---- ``` ---- { PORT = 8080; HOST = "0.0.0.0"; } ---- ``` ---- ---- - detached: (boolean, default true) Daemonize the server process so that it runs in a ---- separate process group from Nvim. Nvim will shutdown the process on exit, but if Nvim fails to ---- exit cleanly this could leave behind orphaned server processes. ---- ---- - workspace_folders: (table) List of workspace folders passed to the ---- language server. For backwards compatibility rootUri and rootPath will be ---- derived from the first workspace folder in this list. See `workspaceFolders` in ---- the LSP spec. ---- ---- - capabilities: Map overriding the default capabilities defined by ---- \|vim.lsp.protocol.make_client_capabilities()|, passed to the language ---- server on initialization. Hint: use make_client_capabilities() and modify ---- its result. ---- ---- - Note: To send an empty dictionary use |vim.empty_dict()|, else it will be encoded as an ---- array. ---- ---- - handlers: Map of language server method names to |lsp-handler| ---- ---- - settings: Map with language server specific settings. These are ---- returned to the language server if requested via `workspace/configuration`. ---- Keys are case-sensitive. ---- ---- - commands: table Table that maps string of clientside commands to user-defined functions. ---- Commands passed to start_client take precedence over the global command registry. Each key ---- must be a unique command name, and the value is a function which is called if any LSP action ---- (code action, code lenses, ...) triggers the command. ---- ---- - init_options Values to pass in the initialization request ---- as `initializationOptions`. See `initialize` in the LSP spec. ---- ---- - name: (string, default=client-id) Name in log messages. ---- ---- - get_language_id: function(bufnr, filetype) -> language ID as string. ---- Defaults to the filetype. ---- ---- - offset_encoding: (default="utf-16") One of "utf-8", "utf-16", ---- or "utf-32" which is the encoding that the LSP server expects. Client does ---- not verify this is correct. ---- ---- - on_error: Callback with parameters (code, ...), invoked ---- when the client operation throws an error. `code` is a number describing ---- the error. Other arguments may be passed depending on the error kind. See ---- `vim.lsp.rpc.client_errors` for possible errors. ---- Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name. ---- ---- - before_init: Callback with parameters (initialize_params, config) ---- invoked before the LSP "initialize" phase, where `params` contains the ---- parameters being sent to the server and `config` is the config that was ---- passed to |vim.lsp.start_client()|. You can use this to modify parameters before ---- they are sent. ---- ---- - on_init: Callback (client, initialize_result) invoked after LSP ---- "initialize", where `result` is a table of `capabilities` and anything else ---- the server may send. For example, clangd sends ---- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was ---- sent to it. You can only modify the `client.offset_encoding` here before ---- any notifications are sent. ---- ---- - on_exit Callback (code, signal, client_id) invoked on client ---- exit. ---- - code: exit code of the process ---- - signal: number describing the signal used to terminate (if any) ---- - client_id: client handle ---- ---- - on_attach: Callback (client, bufnr) invoked when client ---- attaches to a buffer. ---- ---- - trace: ("off" | "messages" | "verbose" | nil) passed directly to the language ---- server in the initialize request. Invalid/empty values will default to "off" ---- ---- - flags: A table with flags for the client. The current (experimental) flags are: ---- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits ---- - debounce_text_changes (number, default 150): Debounce didChange ---- notifications to the server by the given number in milliseconds. No debounce ---- occurs if nil ---- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to ---- exit cleanly after sending the "shutdown" request before sending kill -15. ---- If set to false, nvim exits immediately after sending the "shutdown" request to the server. ---- ---- - root_dir: (string) Directory where the LSP ---- server will base its workspaceFolders, rootUri, and rootPath ---- on initialization. ---- ----@return integer|nil client_id. |vim.lsp.get_client_by_id()| Note: client may not be +--- @param config vim.lsp.ClientConfig Configuration for the server. +--- @return integer|nil client_id |vim.lsp.get_client_by_id()| Note: client may not be --- fully initialized. Use `on_init` to do any actions once --- the client has been initialized. function lsp.start_client(config) @@ -927,7 +717,7 @@ end --- ---@param client_id integer client id --- ----@return (nil|lsp.Client) client rpc object +---@return (nil|vim.lsp.Client) client rpc object function lsp.get_client_by_id(client_id) return active_clients[client_id] or uninitialized_clients[client_id] end @@ -943,7 +733,7 @@ end --- Stops a client(s). --- ---- You can also use the `stop()` function on a |vim.lsp.client| object. +--- You can also use the `stop()` function on a |vim.lsp.Client| object. --- To stop all clients: --- --- ```lua @@ -953,7 +743,7 @@ end --- By default asks the server to shutdown, unless stop was requested --- already for this client, then force-shutdown is attempted. --- ----@param client_id integer|table id or |vim.lsp.client| object, or list thereof +---@param client_id integer|vim.lsp.Client id or |vim.lsp.Client| object, or list thereof ---@param force boolean|nil shutdown forcefully function lsp.stop_client(client_id, force) local ids = type(client_id) == 'table' and client_id or { client_id } @@ -968,28 +758,32 @@ function lsp.stop_client(client_id, force) end end ----@class vim.lsp.get_clients.filter ----@field id integer|nil Match clients by id ----@field bufnr integer|nil match clients attached to the given buffer ----@field name string|nil match clients by name ----@field method string|nil match client by supported method name +--- Key-value pairs used to filter the returned clients. +--- @class vim.lsp.get_clients.Filter +--- @inlinedoc +--- +--- Only return clients with the given id +--- @field id? integer +--- +--- Only return clients attached to this buffer +--- @field bufnr? integer +--- +--- Only return clients with the given name +--- @field name? string +--- +--- Only return clients supporting the given method +--- @field method? string --- Get active clients. --- ----@param filter vim.lsp.get_clients.filter|nil (table|nil) A table with ---- key-value pairs used to filter the returned clients. ---- The available keys are: ---- - id (number): Only return clients with the given id ---- - bufnr (number): Only return clients attached to this buffer ---- - name (string): Only return clients with the given name ---- - method (string): Only return clients supporting the given method ----@return lsp.Client[]: List of |vim.lsp.client| objects +---@param filter? vim.lsp.get_clients.Filter +---@return vim.lsp.Client[]: List of |vim.lsp.Client| objects function lsp.get_clients(filter) validate({ filter = { filter, 't', true } }) filter = filter or {} - local clients = {} --- @type lsp.Client[] + local clients = {} --- @type vim.lsp.Client[] local t = filter.bufnr and (all_buffer_active_clients[resolve_bufnr(filter.bufnr)] or {}) or active_clients @@ -1233,15 +1027,20 @@ function lsp.omnifunc(findstart, base) return vim.lsp._completion.omnifunc(findstart, base) end +--- @class vim.lsp.formatexpr.Opts +--- @inlinedoc +--- +--- The timeout period for the formatting request. +--- (default: 500ms). +--- @field timeout_ms integer + --- Provides an interface between the built-in client and a `formatexpr` function. --- --- Currently only supports a single client. This can be set via --- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach` --- via `vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`. --- ----@param opts table options for customizing the formatting expression which takes the ---- following optional keys: ---- * timeout_ms (default 500ms). The timeout period for the formatting request. +---@param opts? vim.lsp.formatexpr.Opts function lsp.formatexpr(opts) opts = opts or {} local timeout_ms = opts.timeout_ms or 500 @@ -1313,14 +1112,14 @@ function lsp.client_is_stopped(client_id) end --- Gets a map of client_id:client pairs for the given buffer, where each value ---- is a |vim.lsp.client| object. +--- is a |vim.lsp.Client| object. --- ---@param bufnr (integer|nil): Buffer handle, or 0 for current ---@return table result is table of (client_id, client) pairs ---@deprecated Use |vim.lsp.get_clients()| instead. function lsp.buf_get_clients(bufnr) vim.deprecate('vim.lsp.buf_get_clients()', 'vim.lsp.get_clients()', '0.12') - local result = {} --- @type table + local result = {} --- @type table for _, client in ipairs(lsp.get_clients({ bufnr = resolve_bufnr(bufnr) })) do result[client.id] = client end diff --git a/runtime/lua/vim/lsp/_changetracking.lua b/runtime/lua/vim/lsp/_changetracking.lua index 3ecdec1659..b2be53269f 100644 --- a/runtime/lua/vim/lsp/_changetracking.lua +++ b/runtime/lua/vim/lsp/_changetracking.lua @@ -61,7 +61,7 @@ local state_by_group = setmetatable({}, { end, }) ----@param client lsp.Client +---@param client vim.lsp.Client ---@return vim.lsp.CTGroup local function get_group(client) local allow_inc_sync = vim.F.if_nil(client.flags.allow_incremental_sync, true) --- @type boolean @@ -127,7 +127,7 @@ local function incremental_changes(state, encoding, bufnr, firstline, lastline, return incremental_change end ----@param client lsp.Client +---@param client vim.lsp.Client ---@param bufnr integer function M.init(client, bufnr) assert(client.offset_encoding, 'lsp client must have an offset_encoding') @@ -165,7 +165,7 @@ function M.init(client, bufnr) end end ---- @param client lsp.Client +--- @param client vim.lsp.Client --- @param bufnr integer --- @param name string --- @return string @@ -189,7 +189,7 @@ local function reset_timer(buf_state) end end ---- @param client lsp.Client +--- @param client vim.lsp.Client --- @param bufnr integer function M.reset_buf(client, bufnr) M.flush(client, bufnr) @@ -207,7 +207,7 @@ function M.reset_buf(client, bufnr) end end ---- @param client lsp.Client +--- @param client vim.lsp.Client function M.reset(client) local state = state_by_group[get_group(client)] if not state then @@ -350,7 +350,7 @@ function M.send_changes(bufnr, firstline, lastline, new_lastline) end --- Flushes any outstanding change notification. ----@param client lsp.Client +---@param client vim.lsp.Client ---@param bufnr? integer function M.flush(client, bufnr) local group = get_group(client) diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index d2e92de083..377c8680c7 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -11,7 +11,7 @@ local M = {} --- ---@param method (string) LSP method name ---@param params (table|nil) Parameters to send to the server ----@param handler (function|nil) See |lsp-handler|. Follows |lsp-handler-resolution| +---@param handler lsp.Handler? See |lsp-handler|. Follows |lsp-handler-resolution| --- ---@return table client_request_ids Map of client-id:request-id pairs ---for all successful requests. @@ -31,7 +31,7 @@ end --- Checks whether the language servers attached to the current buffer are --- ready. --- ----@return boolean if server responds. +---@return boolean : if server responds. ---@deprecated function M.server_ready() vim.deprecate('vim.lsp.buf.server_ready()', nil, '0.10') @@ -57,35 +57,57 @@ local function request_with_options(name, params, options) request(name, params, req_handler) end ---- Jumps to the declaration of the symbol under the cursor. ----@note Many servers do not implement this method. Generally, see |vim.lsp.buf.definition()| instead. +--- @class vim.lsp.ListOpts +--- +--- list-handler replacing the default handler. +--- Called for any non-empty result. +--- This table can be used with |setqflist()| or |setloclist()|. E.g.: +--- ```lua +--- local function on_list(options) +--- vim.fn.setqflist({}, ' ', options) +--- vim.cmd.cfirst() +--- end --- ----@param options table|nil additional options ---- - reuse_win: (boolean) Jump to existing window if buffer is already open. ---- - on_list: (function) |lsp-on-list-handler| replacing the default handler. ---- Called for any non-empty result. +--- vim.lsp.buf.definition({ on_list = on_list }) +--- vim.lsp.buf.references(nil, { on_list = on_list }) +--- ``` +--- +--- If you prefer loclist do something like this: +--- ```lua +--- local function on_list(options) +--- vim.fn.setloclist(0, {}, ' ', options) +--- vim.cmd.lopen() +--- end +--- ``` +--- @field on_list? fun(t: vim.lsp.LocationOpts.OnList) + +--- @class vim.lsp.LocationOpts.OnList +--- @field items table[] Structured like |setqflist-what| +--- @field title? string Title for the list. +--- @field context? table `ctx` from |lsp-handler| + +--- @class vim.lsp.LocationOpts: vim.lsp.ListOpts +--- +--- Jump to existing window if buffer is already open. +--- @field reuse_win? boolean + +--- Jumps to the declaration of the symbol under the cursor. +--- @note Many servers do not implement this method. Generally, see |vim.lsp.buf.definition()| instead. +--- @param options? vim.lsp.LocationOpts function M.declaration(options) local params = util.make_position_params() request_with_options(ms.textDocument_declaration, params, options) end --- Jumps to the definition of the symbol under the cursor. ---- ----@param options table|nil additional options ---- - reuse_win: (boolean) Jump to existing window if buffer is already open. ---- - on_list: (function) |lsp-on-list-handler| replacing the default handler. ---- Called for any non-empty result. +--- @param options? vim.lsp.LocationOpts function M.definition(options) local params = util.make_position_params() request_with_options(ms.textDocument_definition, params, options) end --- Jumps to the definition of the type of the symbol under the cursor. ---- ----@param options table|nil additional options ---- - reuse_win: (boolean) Jump to existing window if buffer is already open. ---- - on_list: (function) |lsp-on-list-handler| replacing the default handler. ---- Called for any non-empty result. +--- @param options? vim.lsp.LocationOpts function M.type_definition(options) local params = util.make_position_params() request_with_options(ms.textDocument_typeDefinition, params, options) @@ -93,10 +115,7 @@ end --- Lists all the implementations for the symbol under the cursor in the --- quickfix window. ---- ----@param options table|nil additional options ---- - on_list: (function) |lsp-on-list-handler| replacing the default handler. ---- Called for any non-empty result. +--- @param options? vim.lsp.LocationOpts function M.implementation(options) local params = util.make_position_params() request_with_options(ms.textDocument_implementation, params, options) @@ -156,45 +175,55 @@ local function range_from_selection(bufnr, mode) } end +--- @class vim.lsp.buf.format.Opts +--- @inlinedoc +--- +--- Can be used to specify FormattingOptions. Some unspecified options will be +--- automatically derived from the current Nvim options. +--- See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions +--- @field formatting_options? table +--- +--- Time in milliseconds to block for formatting requests. No effect if async=true. +--- (default: `1000`) +--- @field timeout_ms? integer +--- +--- Restrict formatting to the clients attached to the given buffer. +--- (default: current buffer) +--- @field bufnr? integer +--- +--- Predicate used to filter clients. Receives a client as argument and must +--- return a boolean. Clients matching the predicate are included. Example: +--- ```lua +--- -- Never request typescript-language-server for formatting +--- vim.lsp.buf.format { +--- filter = function(client) return client.name ~= "tsserver" end +--- } +--- ``` +--- @field filter? fun(client: vim.lsp.Client): boolean? +--- +--- If true the method won't block. +--- Editing the buffer while formatting asynchronous can lead to unexpected +--- changes. +--- (Default: false) +--- @field async? boolean +--- +--- Restrict formatting to the client with ID (client.id) matching this field. +--- @field id? integer +--- +--- Restrict formatting to the client with name (client.name) matching this field. +--- @field name? string +--- +--- Range to format. +--- Table must contain `start` and `end` keys with {row,col} tuples using +--- (1,0) indexing. +--- (Default: current selection in visual mode, `nil` in other modes, +--- formatting the full buffer) +--- @field range? {start:integer[],end:integer[]} + --- Formats a buffer using the attached (and optionally filtered) language --- server clients. --- ---- @param options table|nil Optional table which holds the following optional fields: ---- - formatting_options (table|nil): ---- Can be used to specify FormattingOptions. Some unspecified options will be ---- automatically derived from the current Nvim options. ---- See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions ---- - timeout_ms (integer|nil, default 1000): ---- Time in milliseconds to block for formatting requests. No effect if async=true ---- - bufnr (number|nil): ---- Restrict formatting to the clients attached to the given buffer, defaults to the current ---- buffer (0). ---- ---- - filter (function|nil): ---- Predicate used to filter clients. Receives a client as argument and must return a ---- boolean. Clients matching the predicate are included. Example: ---- ```lua ---- -- Never request typescript-language-server for formatting ---- vim.lsp.buf.format { ---- filter = function(client) return client.name ~= "tsserver" end ---- } ---- ``` ---- ---- - async boolean|nil ---- If true the method won't block. Defaults to false. ---- Editing the buffer while formatting asynchronous can lead to unexpected ---- changes. ---- ---- - id (number|nil): ---- Restrict formatting to the client with ID (client.id) matching this field. ---- - name (string|nil): ---- Restrict formatting to the client with name (client.name) matching this field. ---- ---- - range (table|nil) Range to format. ---- Table must contain `start` and `end` keys with {row,col} tuples using ---- (1,0) indexing. ---- Defaults to current selection in visual mode ---- Defaults to `nil` in other modes, formatting the full buffer +--- @param options? vim.lsp.buf.format.Opts function M.format(options) options = options or {} local bufnr = options.bufnr or api.nvim_get_current_buf() @@ -229,8 +258,7 @@ function M.format(options) end if options.async then - local do_format - do_format = function(idx, client) + local function do_format(idx, client) if not client then return end @@ -256,17 +284,22 @@ function M.format(options) end end +--- @class vim.lsp.buf.rename.Opts +--- @inlinedoc +--- +--- Predicate used to filter clients. Receives a client as argument and +--- must return a boolean. Clients matching the predicate are included. +--- @field filter? fun(client: vim.lsp.Client): boolean? +--- +--- Restrict clients used for rename to ones where client.name matches +--- this field. +--- @field name? string + --- Renames all references to the symbol under the cursor. --- ---@param new_name string|nil If not provided, the user will be prompted for a new --- name using |vim.ui.input()|. ----@param options table|nil additional options ---- - filter (function|nil): ---- Predicate used to filter clients. Receives a client as argument and ---- must return a boolean. Clients matching the predicate are included. ---- - name (string|nil): ---- Restrict clients used for rename to ones where client.name matches ---- this field. +---@param options? vim.lsp.buf.rename.Opts Additional options: function M.rename(new_name, options) options = options or {} local bufnr = options.bufnr or api.nvim_get_current_buf() @@ -386,8 +419,7 @@ end --- ---@param context (table|nil) Context for the request ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references ----@param options table|nil additional options ---- - on_list: (function) handler for list results. See |lsp-on-list-handler| +---@param options? vim.lsp.ListOpts function M.references(context, options) validate({ context = { context, 't', true } }) local params = util.make_position_params() @@ -398,14 +430,13 @@ function M.references(context, options) end --- Lists all symbols in the current buffer in the quickfix window. ---- ----@param options table|nil additional options ---- - on_list: (function) handler for list results. See |lsp-on-list-handler| +--- @param options? vim.lsp.ListOpts function M.document_symbol(options) local params = { textDocument = util.make_text_document_params() } request_with_options(ms.textDocument_documentSymbol, params, options) end +--- @param call_hierarchy_items lsp.CallHierarchyItem[]? local function pick_call_hierarchy_item(call_hierarchy_items) if not call_hierarchy_items then return @@ -425,8 +456,10 @@ local function pick_call_hierarchy_item(call_hierarchy_items) return choice end +--- @param method string local function call_hierarchy(method) local params = util.make_position_params() + --- @param result lsp.CallHierarchyItem[]? request(ms.textDocument_prepareCallHierarchy, params, function(err, result, ctx) if err then vim.notify(err.message, vim.log.levels.WARN) @@ -545,9 +578,8 @@ end --- call, the user is prompted to enter a string on the command line. An empty --- string means no filtering is done. --- ----@param query string|nil optional ----@param options table|nil additional options ---- - on_list: (function) handler for list results. See |lsp-on-list-handler| +--- @param query string? optional +--- @param options? vim.lsp.ListOpts function M.workspace_symbol(query, options) query = query or npcall(vim.fn.input, 'Query: ') if query == nil then @@ -582,16 +614,36 @@ function M.clear_references() util.buf_clear_references() end +---@nodoc ---@class vim.lsp.CodeActionResultEntry ---@field error? lsp.ResponseError ---@field result? (lsp.Command|lsp.CodeAction)[] ---@field ctx lsp.HandlerContext ----@class vim.lsp.buf.code_action.opts ----@field context? lsp.CodeActionContext ----@field filter? fun(x: lsp.CodeAction|lsp.Command):boolean ----@field apply? boolean ----@field range? {start: integer[], end: integer[]} +--- @class vim.lsp.buf.code_action.Opts +--- @inlinedoc +--- +--- Corresponds to `CodeActionContext` of the LSP specification: +--- - {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred from the current +--- position if not provided. +--- - {only}? (`table`) List of LSP `CodeActionKind`s used to filter the code actions. +--- Most language servers support values like `refactor` +--- or `quickfix`. +--- - {triggerKind}? (`integer`) The reason why code actions were requested. +--- @field context? lsp.CodeActionContext +--- +--- Predicate taking an `CodeAction` and returning a boolean. +--- @field filter? fun(x: lsp.CodeAction|lsp.Command):boolean +--- +--- When set to `true`, and there is just one remaining action +--- (after filtering), the action is applied without user query. +--- @field apply? boolean +--- +--- Range for which code actions should be requested. +--- If in visual mode this defaults to the active selection. +--- Table must contain `start` and `end` keys with {row,col} tuples +--- using mark-like indexing. See |api-indexing| +--- @field range? {start: integer[], end: integer[]} --- This is not public because the main extension point is --- vim.ui.select which can be overridden independently. @@ -602,7 +654,7 @@ end --- need to be able to link a `CodeAction|Command` to the right client for --- `codeAction/resolve` ---@param results table ----@param opts? vim.lsp.buf.code_action.opts +---@param opts? vim.lsp.buf.code_action.Opts local function on_code_action_results(results, opts) ---@param a lsp.Command|lsp.CodeAction local function action_filter(a) @@ -647,14 +699,15 @@ local function on_code_action_results(results, opts) end ---@param action lsp.Command|lsp.CodeAction - ---@param client lsp.Client + ---@param client vim.lsp.Client ---@param ctx lsp.HandlerContext local function apply_action(action, client, ctx) if action.edit then util.apply_workspace_edit(action.edit, client.offset_encoding) end - if action.command then - local command = type(action.command) == 'table' and action.command or action + local a_cmd = action.command + if a_cmd then + local command = type(a_cmd) == 'table' and a_cmd or action client:_exec_cmd(command, ctx) end end @@ -676,7 +729,6 @@ local function on_code_action_results(results, opts) -- command: string -- arguments?: any[] -- - ---@type lsp.Client local client = assert(vim.lsp.get_client_by_id(choice.ctx.client_id)) local action = choice.action local bufnr = assert(choice.ctx.bufnr, 'Must have buffer number') @@ -726,29 +778,7 @@ end --- Selects a code action available at the current --- cursor position. --- ----@param options table|nil Optional table which holds the following optional fields: ---- - context: (table|nil) ---- Corresponds to `CodeActionContext` of the LSP specification: ---- - diagnostics (table|nil): ---- LSP `Diagnostic[]`. Inferred from the current ---- position if not provided. ---- - only (table|nil): ---- List of LSP `CodeActionKind`s used to filter the code actions. ---- Most language servers support values like `refactor` ---- or `quickfix`. ---- - triggerKind (number|nil): The reason why code actions were requested. ---- - filter: (function|nil) ---- Predicate taking an `CodeAction` and returning a boolean. ---- - apply: (boolean|nil) ---- When set to `true`, and there is just one remaining action ---- (after filtering), the action is applied without user query. ---- ---- - range: (table|nil) ---- Range for which code actions should be requested. ---- If in visual mode this defaults to the active selection. ---- Table must contain `start` and `end` keys with {row,col} tuples ---- using mark-like indexing. See |api-indexing| ---- +---@param options? vim.lsp.buf.code_action.Opts ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction ---@see vim.lsp.protocol.CodeActionTriggerKind function M.code_action(options) @@ -814,9 +844,8 @@ function M.code_action(options) end --- Executes an LSP server command. ---- ----@param command_params table A valid `ExecuteCommandParams` object ----@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand +--- @param command_params lsp.ExecuteCommandParams +--- @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand function M.execute_command(command_params) validate({ command = { command_params.command, 's' }, diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua index c1b41a7183..fcbaadbc57 100644 --- a/runtime/lua/vim/lsp/client.lua +++ b/runtime/lua/vim/lsp/client.lua @@ -6,38 +6,125 @@ local ms = lsp.protocol.Methods local changetracking = lsp._changetracking local validate = vim.validate ---- @alias vim.lsp.client.on_init_cb fun(client: lsp.Client, initialize_result: lsp.InitializeResult) ---- @alias vim.lsp.client.on_attach_cb fun(client: lsp.Client, bufnr: integer) +--- @alias vim.lsp.client.on_init_cb fun(client: vim.lsp.Client, initialize_result: lsp.InitializeResult) +--- @alias vim.lsp.client.on_attach_cb fun(client: vim.lsp.Client, bufnr: integer) --- @alias vim.lsp.client.on_exit_cb fun(code: integer, signal: integer, client_id: integer) ---- @alias vim.lsp.client.before_init_cb fun(params: lsp.InitializeParams, config: lsp.ClientConfig) - ---- @class lsp.ClientConfig +--- @alias vim.lsp.client.before_init_cb fun(params: lsp.InitializeParams, config: vim.lsp.ClientConfig) + +--- @class vim.lsp.ClientConfig +--- command string[] that launches the language +--- server (treated as in |jobstart()|, must be absolute or on `$PATH`, shell constructs like +--- "~" are not expanded), or function that creates an RPC client. Function receives +--- a `dispatchers` table and returns a table with member functions `request`, `notify`, +--- `is_closing` and `terminate`. +--- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|. +--- For TCP there is a builtin RPC client factory: |vim.lsp.rpc.connect()| --- @field cmd string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient? +--- +--- Directory to launch the `cmd` process. Not related to `root_dir`. +--- (default: cwd) --- @field cmd_cwd? string +--- +--- Environment flags to pass to the LSP on spawn. +--- Must be specified using a table. +--- Non-string values are coerced to string. +--- Example: +--- ```lua +--- { PORT = 8080; HOST = "0.0.0.0"; } +--- ``` --- @field cmd_env? table +--- +--- Daemonize the server process so that it runs in a separate process group from Nvim. +--- Nvim will shutdown the process on exit, but if Nvim fails to exit cleanly this could leave +--- behind orphaned server processes. +--- (default: true) --- @field detached? boolean +--- +--- List of workspace folders passed to the language server. +--- For backwards compatibility rootUri and rootPath will be derived from the first workspace +--- folder in this list. See `workspaceFolders` in the LSP spec. --- @field workspace_folders? lsp.WorkspaceFolder[] +--- +--- Map overriding the default capabilities defined by |vim.lsp.protocol.make_client_capabilities()|, +--- passed to the language server on initialization. Hint: use make_client_capabilities() and modify +--- its result. +--- - Note: To send an empty dictionary use |vim.empty_dict()|, else it will be encoded as an +--- array. --- @field capabilities? lsp.ClientCapabilities +--- +--- Map of language server method names to |lsp-handler| --- @field handlers? table +--- +--- Map with language server specific settings. These are returned to the language server if +--- requested via `workspace/configuration`. Keys are case-sensitive. --- @field settings? table +--- +--- Table that maps string of clientside commands to user-defined functions. +--- Commands passed to start_client take precedence over the global command registry. Each key +--- must be a unique command name, and the value is a function which is called if any LSP action +--- (code action, code lenses, ...) triggers the command. --- @field commands? table +--- +--- Values to pass in the initialization request as `initializationOptions`. See `initialize` in +--- the LSP spec. --- @field init_options? table +--- +--- Name in log messages. +--- (default: client-id) --- @field name? string +--- +--- Language ID as string. Defaults to the filetype. --- @field get_language_id? fun(bufnr: integer, filetype: string): string ---- @field offset_encoding? string +--- +--- The encoding that the LSP server expects. Client does not verify this is correct. +--- @field offset_encoding? 'utf-8'|'utf-16'|'utf-32' +--- +--- Callback invoked when the client operation throws an error. `code` is a number describing the error. +--- Other arguments may be passed depending on the error kind. See `vim.lsp.rpc.client_errors` +--- for possible errors. Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name. --- @field on_error? fun(code: integer, err: string) +--- +--- Callback invoked before the LSP "initialize" phase, where `params` contains the parameters +--- being sent to the server and `config` is the config that was passed to |vim.lsp.start_client()|. +--- You can use this to modify parameters before they are sent. --- @field before_init? vim.lsp.client.before_init_cb +--- +--- Callback invoked after LSP "initialize", where `result` is a table of `capabilities` +--- and anything else the server may send. For example, clangd sends +--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was sent to it. +--- You can only modify the `client.offset_encoding` here before any notifications are sent. --- @field on_init? elem_or_list +--- +--- Callback invoked on client exit. +--- - code: exit code of the process +--- - signal: number describing the signal used to terminate (if any) +--- - client_id: client handle --- @field on_exit? elem_or_list +--- +--- Callback invoked when client attaches to a buffer. --- @field on_attach? elem_or_list +--- +--- Passed directly to the language server in the initialize request. Invalid/empty values will +--- (default: "off") --- @field trace? 'off'|'messages'|'verbose' +--- +--- A table with flags for the client. The current (experimental) flags are: +--- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits +--- - debounce_text_changes (number, default 150): Debounce didChange +--- notifications to the server by the given number in milliseconds. No debounce +--- occurs if nil +--- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to +--- exit cleanly after sending the "shutdown" request before sending kill -15. +--- If set to false, nvim exits immediately after sending the "shutdown" request to the server. --- @field flags? table +--- +--- Directory where the LSP server will base its workspaceFolders, rootUri, and rootPath on initialization. --- @field root_dir? string ---- @class lsp.Client.Progress: vim.Ringbuf<{token: integer|string, value: any}> +--- @class vim.lsp.Client.Progress: vim.Ringbuf<{token: integer|string, value: any}> --- @field pending table ---- @class lsp.Client +--- @class vim.lsp.Client --- --- The id allocated to the client. --- @field id integer @@ -67,7 +154,7 @@ local validate = vim.validate --- --- copy of the table that was passed by the user --- to |vim.lsp.start_client()|. ---- @field config lsp.ClientConfig +--- @field config vim.lsp.ClientConfig --- --- Response from the server sent on --- initialize` describing the server's capabilities. @@ -75,7 +162,7 @@ local validate = vim.validate --- --- A ring buffer (|vim.ringbuf()|) containing progress messages --- sent by the server. ---- @field progress lsp.Client.Progress +--- @field progress vim.lsp.Client.Progress --- --- @field initialized true? --- @@ -239,7 +326,7 @@ local function default_get_language_id(_bufnr, filetype) end --- Validates a client configuration as given to |vim.lsp.start_client()|. ---- @param config lsp.ClientConfig +--- @param config vim.lsp.ClientConfig local function validate_config(config) validate({ config = { config, 't' }, @@ -285,7 +372,7 @@ local function get_trace(trace) end --- @param id integer ---- @param config lsp.ClientConfig +--- @param config vim.lsp.ClientConfig --- @return string local function get_name(id, config) local name = config.name @@ -328,8 +415,8 @@ local function ensure_list(x) end --- @package ---- @param config lsp.ClientConfig ---- @return lsp.Client? +--- @param config vim.lsp.ClientConfig +--- @return vim.lsp.Client? function Client.create(config) validate_config(config) @@ -337,7 +424,7 @@ function Client.create(config) local id = client_index local name = get_name(id, config) - --- @class lsp.Client + --- @class vim.lsp.Client local self = { id = id, config = config, @@ -370,7 +457,7 @@ function Client.create(config) --- - lsp.WorkDoneProgressBegin, --- - lsp.WorkDoneProgressReport (extended with title from Begin) --- - lsp.WorkDoneProgressEnd (extended with title from Begin) - progress = vim.ringbuf(50) --[[@as lsp.Client.Progress]], + progress = vim.ringbuf(50) --[[@as vim.lsp.Client.Progress]], --- @deprecated use client.progress instead messages = { name = name, messages = {}, progress = {}, status = {} }, @@ -421,6 +508,7 @@ function Client.create(config) return self end +--- @private --- @param cbs function[] --- @param error_id integer --- @param ... any @@ -698,7 +786,7 @@ function Client:_cancel_request(id) return self.rpc.notify(ms.dollar_cancelRequest, { id = id }) end ---- @nodoc +--- @private --- Stops a client, optionally with force. --- --- By default, it will just ask the - server to shutdown without force. If @@ -853,6 +941,7 @@ function Client:write_error(code, err) err_message(self._log_prefix, ': Error ', client_error, ': ', vim.inspect(err)) end +--- @private --- @param method string --- @param opts? {bufnr: integer?} function Client:_supports_method(method, opts) diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 7aed6f99e3..48c096c0c1 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -279,7 +279,8 @@ function M.on_codelens(err, result, ctx, _) end) end ---- @class vim.lsp.codelens.RefreshOptions +--- @class vim.lsp.codelens.refresh.Opts +--- @inlinedoc --- @field bufnr integer? filter by buffer. All buffers if nil, 0 for current buffer --- Refresh the lenses. @@ -292,8 +293,7 @@ end --- autocmd BufEnter,CursorHold,InsertLeave lua vim.lsp.codelens.refresh({ bufnr = 0 }) --- ``` --- ---- @param opts? vim.lsp.codelens.RefreshOptions Table with the following fields: ---- - `bufnr` (integer|nil): filter by buffer. All buffers if nil, 0 for current buffer +--- @param opts? vim.lsp.codelens.refresh.Opts Optional fields function M.refresh(opts) opts = opts or {} local bufnr = opts.bufnr and resolve_bufnr(opts.bufnr) diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 1fa67fc473..6156821093 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -390,7 +390,7 @@ local function clear(bufnr) end end ----@class lsp.diagnostic.bufstate +---@class (private) lsp.diagnostic.bufstate ---@field enabled boolean Whether inlay hints are enabled for this buffer ---@type table local bufstates = {} diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 781d720486..d816fb1482 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -412,6 +412,7 @@ M[ms.textDocument_hover] = M.hover ---@param _ nil not used ---@param result (table) result of LSP method; a location or a list of locations. ---@param ctx (lsp.HandlerContext) table containing the context of the request, including the method +---@param config? vim.lsp.buf.LocationOpts ---(`textDocument/definition` can return `Location` or `Location[]` local function location_handler(_, result, ctx, config) if result == nil or vim.tbl_isempty(result) then diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua index 49dc35fdf6..ec676ea97f 100644 --- a/runtime/lua/vim/lsp/inlay_hint.lua +++ b/runtime/lua/vim/lsp/inlay_hint.lua @@ -4,12 +4,12 @@ local ms = require('vim.lsp.protocol').Methods local api = vim.api local M = {} ----@class lsp.inlay_hint.bufstate +---@class (private) vim.lsp.inlay_hint.bufstate ---@field version? integer ---@field client_hints? table> client_id -> (lnum -> hints) ---@field applied table Last version of hints applied to this line ---@field enabled boolean Whether inlay hints are enabled for this buffer ----@type table +---@type table local bufstates = {} local namespace = api.nvim_create_namespace('vim_lsp_inlayhint') @@ -103,11 +103,14 @@ function M.on_refresh(err, _, ctx, _) return vim.NIL end ---- @class vim.lsp.inlay_hint.get.filter +--- Optional filters |kwargs|: +--- @class vim.lsp.inlay_hint.get.Filter +--- @inlinedoc --- @field bufnr integer? --- @field range lsp.Range? ---- + --- @class vim.lsp.inlay_hint.get.ret +--- @inlinedoc --- @field bufnr integer --- @field client_id integer --- @field inlay_hint lsp.InlayHint @@ -130,17 +133,8 @@ end --- }) --- ``` --- ---- @param filter vim.lsp.inlay_hint.get.filter? ---- Optional filters |kwargs|: ---- - bufnr (integer?): 0 for current buffer ---- - range (lsp.Range?) ---- +--- @param filter vim.lsp.inlay_hint.get.Filter? --- @return vim.lsp.inlay_hint.get.ret[] ---- Each list item is a table with the following fields: ---- - bufnr (integer) ---- - client_id (integer) ---- - inlay_hint (lsp.InlayHint) ---- --- @since 12 function M.get(filter) vim.validate({ filter = { filter, 'table', true } }) @@ -241,7 +235,7 @@ end --- Refresh inlay hints, only if we have attached clients that support it ---@param bufnr (integer) Buffer handle, or 0 for current ----@param opts? lsp.util.RefreshOptions Additional options to pass to util._refresh +---@param opts? vim.lsp.util._refresh.Opts Additional options to pass to util._refresh ---@private local function _refresh(bufnr, opts) opts = opts or {} diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index e52c06a1bd..8e014b1063 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -26,7 +26,7 @@ local function format_message_with_content_length(message) }) end ----@class vim.lsp.rpc.Headers: {string: any} +---@class (private) vim.lsp.rpc.Headers: {string: any} ---@field content_length integer --- Parses an LSP Message's header @@ -193,7 +193,9 @@ function M.rpc_response_error(code, message, data) }) end +--- Dispatchers for LSP message types. --- @class vim.lsp.rpc.Dispatchers +--- @inlinedoc --- @field notification fun(method: string, params: table) --- @field server_request fun(method: string, params: table): any?, lsp.ResponseError? --- @field on_exit fun(code: integer, signal: integer) @@ -266,8 +268,7 @@ function M.create_read_loop(handle_body, on_no_chunk, on_error) end end ----@private ----@class vim.lsp.rpc.Client +---@class (private) vim.lsp.rpc.Client ---@field message_index integer ---@field message_callbacks table dict of message_id to callback ---@field notify_reply_callbacks table dict of message_id to callback @@ -522,7 +523,7 @@ function Client:handle_body(body) end end ----@class vim.lsp.rpc.Transport +---@class (private) vim.lsp.rpc.Transport ---@field write fun(msg: string) ---@field is_closing fun(): boolean ---@field terminate fun() @@ -721,32 +722,21 @@ function M.domain_socket_connect(pipe_path) end end ----@class vim.lsp.rpc.ExtraSpawnParams ----@field cwd? string Working directory for the LSP server process ----@field detached? boolean Detach the LSP server process from the current process ----@field env? table Additional environment variables for LSP server process. See |vim.system| +--- Additional context for the LSP server process. +--- @class vim.lsp.rpc.ExtraSpawnParams +--- @inlinedoc +--- @field cwd? string Working directory for the LSP server process +--- @field detached? boolean Detach the LSP server process from the current process +--- @field env? table Additional environment variables for LSP server process. See |vim.system()| --- Starts an LSP server process and create an LSP RPC client object to --- interact with it. Communication with the spawned process happens via stdio. For --- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect()| --- ----@param cmd string[] Command to start the LSP server. ---- ----@param dispatchers? vim.lsp.rpc.Dispatchers Dispatchers for LSP message types. ---- Valid dispatcher names are: ---- - `"notification"` ---- - `"server_request"` ---- - `"on_error"` ---- - `"on_exit"` ---- ----@param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams Additional context for the LSP ---- server process. May contain: ---- - {cwd} (string) Working directory for the LSP server process ---- - {detached?} (boolean) Detach the LSP server process from the current process. ---- Defaults to false on Windows and true otherwise. ---- - {env?} (table) Additional environment variables for LSP server process ---- ----@return vim.lsp.rpc.PublicClient? Client RPC object, with these methods: +--- @param cmd string[] Command to start the LSP server. +--- @param dispatchers? vim.lsp.rpc.Dispatchers +--- @param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams +--- @return vim.lsp.rpc.PublicClient? : Client RPC object, with these methods: --- - `notify()` |vim.lsp.rpc.notify()| --- - `request()` |vim.lsp.rpc.request()| --- - `is_closing()` returns a boolean indicating if the RPC is closing. diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua index fe8638bdfa..92546e8520 100644 --- a/runtime/lua/vim/lsp/semantic_tokens.lua +++ b/runtime/lua/vim/lsp/semantic_tokens.lua @@ -4,7 +4,7 @@ local ms = require('vim.lsp.protocol').Methods local util = require('vim.lsp.util') local uv = vim.uv ---- @class STTokenRange +--- @class (private) STTokenRange --- @field line integer line number 0-based --- @field start_col integer start column 0-based --- @field end_col integer end column 0-based @@ -12,23 +12,23 @@ local uv = vim.uv --- @field modifiers table token modifiers as a set. E.g., { static = true, readonly = true } --- @field marked boolean whether this token has had extmarks applied --- ---- @class STCurrentResult +--- @class (private) STCurrentResult --- @field version? integer document version associated with this result --- @field result_id? string resultId from the server; used with delta requests --- @field highlights? STTokenRange[] cache of highlight ranges for this document version --- @field tokens? integer[] raw token array as received by the server. used for calculating delta responses --- @field namespace_cleared? boolean whether the namespace was cleared for this result yet --- ---- @class STActiveRequest +--- @class (private) STActiveRequest --- @field request_id? integer the LSP request ID of the most recent request sent to the server --- @field version? integer the document version associated with the most recent request --- ---- @class STClientState +--- @class (private) STClientState --- @field namespace integer --- @field active_request STActiveRequest --- @field current_result STCurrentResult ----@class STHighlighter +---@class (private) STHighlighter ---@field active table ---@field bufnr integer ---@field augroup integer augroup for buffer events @@ -92,7 +92,7 @@ end --- ---@param data integer[] ---@param bufnr integer ----@param client lsp.Client +---@param client vim.lsp.Client ---@param request STActiveRequest ---@return STTokenRange[] local function tokens_to_ranges(data, bufnr, client, request) @@ -646,6 +646,7 @@ function M.stop(bufnr, client_id) end end +--- @nodoc --- @class STTokenRangeInspect : STTokenRange --- @field client_id integer @@ -727,6 +728,13 @@ function M.force_refresh(bufnr) end end +--- @class vim.lsp.semantic_tokens.highlight_token.Opts +--- @inlinedoc +--- +--- Priority for the applied extmark. +--- (Default: `vim.highlight.priorities.semantic_tokens + 3`) +--- @field priority? integer + --- Highlight a semantic token. --- --- Apply an extmark with a given highlight group for a semantic token. The @@ -735,11 +743,9 @@ end --- use inside |LspTokenUpdate| callbacks. ---@param token (table) a semantic token, found as `args.data.token` in |LspTokenUpdate|. ---@param bufnr (integer) the buffer to highlight ----@param client_id (integer) The ID of the |vim.lsp.client| +---@param client_id (integer) The ID of the |vim.lsp.Client| ---@param hl_group (string) Highlight group name ----@param opts (table|nil) Optional parameters. ---- - priority: (integer|nil) Priority for the applied extmark. Defaults ---- to `vim.highlight.priorities.semantic_tokens + 3` +---@param opts? vim.lsp.semantic_tokens.highlight_token.Opts Optional parameters: function M.highlight_token(token, bufnr, client_id, hl_group, opts) local highlighter = STHighlighter.active[bufnr] if not highlighter then diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 0553d39851..60d0f0cc83 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -675,13 +675,15 @@ local function get_bufs_with_prefix(prefix) return buffers end +--- @class vim.lsp.util.rename.Opts +--- @inlinedoc +--- @field overwrite? boolean +--- @field ignoreIfExists? boolean + --- Rename old_fname to new_fname ---- ----@param old_fname string ----@param new_fname string ----@param opts? table options ---- - overwrite? boolean ---- - ignoreIfExists? boolean +--- @param old_fname string +--- @param new_fname string +--- @param opts? vim.lsp.util.rename.Opts Options: function M.rename(old_fname, new_fname, opts) opts = opts or {} local skip = not opts.overwrite or opts.ignoreIfExists @@ -1450,7 +1452,7 @@ function M.stylize_markdown(bufnr, contents, opts) return stripped end ---- @class lsp.util.NormalizeMarkdownOptions +--- @class (private) vim.lsp.util._normalize_markdown.Opts --- @field width integer Thematic breaks are expanded to this size. Defaults to 80. --- Normalizes Markdown input to a canonical form. @@ -1466,7 +1468,7 @@ end --- ---@private ---@param contents string[] ----@param opts? lsp.util.NormalizeMarkdownOptions +---@param opts? vim.lsp.util._normalize_markdown.Opts ---@return string[] table of lines containing normalized Markdown ---@see https://github.github.com/gfm function M._normalize_markdown(contents, opts) @@ -1537,7 +1539,7 @@ local function close_preview_autocmd(events, winnr, bufnrs) end end ----@internal +---@private --- Computes size of float needed to show contents (with optional wrapping) --- ---@param contents table of lines to show in window @@ -1613,24 +1615,50 @@ function M._make_floating_popup_size(contents, opts) return width, height end +--- @class vim.lsp.util.open_floating_preview.Opts +--- @inlinedoc +--- +--- Height of floating window +--- @field height? integer +--- +--- Width of floating window +--- @field width? integer +--- +--- Wrap long lines +--- (default: `true`) +--- @field wrap? boolean +--- +--- Character to wrap at for computing height when wrap is enabled +--- @field wrap_at? integer +--- +--- Maximal width of floating window +--- @field max_width? integer +--- +--- Maximal height of floating window +--- @field max_height? integer +--- +--- If a popup with this id is opened, then focus it +--- @field focus_id? string +--- +--- List of events that closes the floating window +--- @field close_events? table +--- +--- Make float focusable. +--- (default: `true`) +--- @field focusable? boolean +--- +--- If `true`, and if {focusable} is also `true`, focus an existing floating +--- window with the same {focus_id} +--- (default: `true`) +--- @field focus? boolean + --- Shows contents in a floating window. --- ---@param contents table of lines to show in window ---@param syntax string of syntax to set for opened buffer ----@param opts table with optional fields (additional keys are filtered with |vim.lsp.util.make_floating_popup_options()| ---- before they are passed on to |nvim_open_win()|) ---- - height: (integer) height of floating window ---- - width: (integer) width of floating window ---- - wrap: (boolean, default true) wrap long lines ---- - wrap_at: (integer) character to wrap at for computing height when wrap is enabled ---- - max_width: (integer) maximal width of floating window ---- - max_height: (integer) maximal height of floating window ---- - focus_id: (string) if a popup with this id is opened, then focus it ---- - close_events: (table) list of events that closes the floating window ---- - focusable: (boolean, default true) Make float focusable ---- - focus: (boolean, default true) If `true`, and if {focusable} ---- is also `true`, focus an existing floating window with the same ---- {focus_id} +---@param opts? vim.lsp.util.open_floating_preview.Opts with optional fields +--- (additional keys are filtered with |vim.lsp.util.make_floating_popup_options()| +--- before they are passed on to |nvim_open_win()|) ---@return integer bufnr of newly created float window ---@return integer winid of newly created float window preview window function M.open_floating_preview(contents, syntax, opts) @@ -1794,7 +1822,8 @@ local position_sort = sort_by_key(function(v) return { v.start.line, v.start.character } end) ----@class vim.lsp.util.LocationItem +---@class vim.lsp.util.locations_to_items.ret +---@inlinedoc ---@field filename string ---@field lnum integer 1-indexed line number ---@field col integer 1-indexed column @@ -1813,7 +1842,7 @@ end) ---@param locations lsp.Location[]|lsp.LocationLink[] ---@param offset_encoding string offset_encoding for locations utf-8|utf-16|utf-32 --- default to first client of buffer ----@return vim.lsp.util.LocationItem[] list of items +---@return vim.lsp.util.locations_to_items.ret[] function M.locations_to_items(locations, offset_encoding) if offset_encoding == nil then vim.notify_once( @@ -2221,16 +2250,16 @@ local function make_line_range_params(bufnr, start_line, end_line, offset_encodi } end ----@private ---- Request updated LSP information for a buffer. ---- ----@class lsp.util.RefreshOptions +---@class (private) vim.lsp.util._refresh.Opts ---@field bufnr integer? Buffer to refresh (default: 0) ---@field only_visible? boolean Whether to only refresh for the visible regions of the buffer (default: false) ---@field client_id? integer Client ID to refresh (default: all clients) --- + +---@private +--- Request updated LSP information for a buffer. +--- ---@param method string LSP method to call ----@param opts? lsp.util.RefreshOptions Options table +---@param opts? vim.lsp.util._refresh.Opts Options table function M._refresh(method, opts) opts = opts or {} local bufnr = opts.bufnr diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua index d29c356af3..3992eef78a 100644 --- a/runtime/lua/vim/secure.lua +++ b/runtime/lua/vim/secure.lua @@ -108,22 +108,25 @@ function M.read(path) return contents end ----@class vim.trust.opts ----@field action string ----@field path? string ----@field bufnr? integer +--- @class vim.trust.opts +--- @inlinedoc +--- +--- - `'allow'` to add a file to the trust database and trust it, +--- - `'deny'` to add a file to the trust database and deny it, +--- - `'remove'` to remove file from the trust database +--- @field action 'allow'|'deny'|'remove' +--- +--- Path to a file to update. Mutually exclusive with {bufnr}. +--- Cannot be used when {action} is "allow". +--- @field path? string +--- Buffer number to update. Mutually exclusive with {path}. +--- @field bufnr? integer --- Manage the trust database. --- --- The trust database is located at |$XDG_STATE_HOME|/nvim/trust. --- ----@param opts (table): ---- - action (string): "allow" to add a file to the trust database and trust it, ---- "deny" to add a file to the trust database and deny it, ---- "remove" to remove file from the trust database ---- - path (string|nil): Path to a file to update. Mutually exclusive with {bufnr}. ---- Cannot be used when {action} is "allow". ---- - bufnr (number|nil): Buffer number to update. Mutually exclusive with {path}. +---@param opts? vim.trust.opts ---@return boolean success true if operation was successful ---@return string msg full path if operation was successful, else error message function M.trust(opts) diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 83fdfede89..ec70630df3 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -65,8 +65,13 @@ function vim.deepcopy(orig, noref) end --- @class vim.gsplit.Opts ---- @field plain? boolean Use `sep` literally (as in string.find). ---- @field trimempty? boolean Discard empty segments at start and end of the sequence. +--- @inlinedoc +--- +--- Use `sep` literally (as in string.find). +--- @field plain? boolean +--- +--- Discard empty segments at start and end of the sequence. +--- @field trimempty? boolean --- Gets an |iterator| that splits a string at each instance of a separator, in "lazy" fashion --- (as opposed to |vim.split()| which is "eager"). @@ -96,10 +101,8 @@ end --- --- @param s string String to split --- @param sep string Separator or pattern ---- @param opts? vim.gsplit.Opts (table) Keyword arguments |kwargs|: ---- - plain: (boolean) Use `sep` literally (as in string.find). ---- - trimempty: (boolean) Discard empty segments at start and end of the sequence. ----@return fun():string|nil (function) Iterator over the split components +--- @param opts? vim.gsplit.Opts Keyword arguments |kwargs|: +--- @return fun():string|nil (function) Iterator over the split components function vim.gsplit(s, sep, opts) local plain --- @type boolean? local trimempty = false @@ -192,7 +195,7 @@ end --- ---@param s string String to split ---@param sep string Separator or pattern ----@param opts? table Keyword arguments |kwargs| accepted by |vim.gsplit()| +---@param opts? vim.gsplit.Opts Keyword arguments |kwargs|: ---@return string[] : List of split components function vim.split(s, sep, opts) local t = {} @@ -276,6 +279,9 @@ function vim.tbl_filter(func, t) end --- @class vim.tbl_contains.Opts +--- @inlinedoc +--- +--- `value` is a function reference to be checked (default false) --- @field predicate? boolean --- Checks if a table contains a given value, specified either directly or via @@ -294,8 +300,7 @@ end --- ---@param t table Table to check ---@param value any Value to compare or predicate function reference ----@param opts? vim.tbl_contains.Opts (table) Keyword arguments |kwargs|: ---- - predicate: (boolean) `value` is a function reference to be checked (default false) +---@param opts? vim.tbl_contains.Opts Keyword arguments |kwargs|: ---@return boolean `true` if `t` contains `value` function vim.tbl_contains(t, value, opts) vim.validate({ t = { t, 't' }, opts = { opts, 't', true } }) @@ -764,6 +769,7 @@ do ['userdata'] = 'userdata', } + --- @nodoc --- @class vim.validate.Spec {[1]: any, [2]: string|string[], [3]: boolean } --- @field [1] any Argument value --- @field [2] string|string[]|fun(v:any):boolean, string? Type name, or callable diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua index 09b7576d97..5e60efa778 100644 --- a/runtime/lua/vim/snippet.lua +++ b/runtime/lua/vim/snippet.lua @@ -101,7 +101,7 @@ local function get_extmark_range(bufnr, extmark_id) return { mark[1], mark[2], mark[3].end_row, mark[3].end_col } end ---- @class vim.snippet.Tabstop +--- @class (private) vim.snippet.Tabstop --- @field extmark_id integer --- @field bufnr integer --- @field index integer @@ -177,7 +177,7 @@ function Tabstop:set_right_gravity(right_gravity) }) end ---- @class vim.snippet.Session +--- @class (private) vim.snippet.Session --- @field bufnr integer --- @field extmark_id integer --- @field tabstops table diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua index 9b69f95f54..61c5d66958 100644 --- a/runtime/lua/vim/treesitter.lua +++ b/runtime/lua/vim/treesitter.lua @@ -1,6 +1,6 @@ local api = vim.api ----@type table +---@type table local parsers = setmetatable({}, { __mode = 'v' }) local M = vim._defer_require('vim.treesitter', { @@ -30,7 +30,7 @@ M.minimum_language_version = vim._ts_get_minimum_language_version() ---@param lang string Language of the parser ---@param opts (table|nil) Options to pass to the created language tree --- ----@return LanguageTree object to use for parsing +---@return vim.treesitter.LanguageTree object to use for parsing function M._create_parser(bufnr, lang, opts) if bufnr == 0 then bufnr = vim.api.nvim_get_current_buf() @@ -80,7 +80,7 @@ end ---@param lang (string|nil) Filetype of this parser (default: buffer filetype) ---@param opts (table|nil) Options to pass to the created language tree --- ----@return LanguageTree object to use for parsing +---@return vim.treesitter.LanguageTree object to use for parsing function M.get_parser(bufnr, lang, opts) opts = opts or {} @@ -119,7 +119,7 @@ end ---@param lang string Language of this string ---@param opts (table|nil) Options to pass to the created language tree --- ----@return LanguageTree object to use for parsing +---@return vim.treesitter.LanguageTree object to use for parsing function M.get_string_parser(str, lang, opts) vim.validate({ str = { str, 'string' }, @@ -172,7 +172,7 @@ end ---to get the range with directives applied. ---@param node TSNode ---@param source integer|string|nil Buffer or string from which the {node} is extracted ----@param metadata TSMetadata|nil +---@param metadata vim.treesitter.query.TSMetadata|nil ---@return Range6 function M.get_range(node, source, metadata) if metadata and metadata.range then @@ -326,10 +326,21 @@ function M.get_captures_at_cursor(winnr) return captures end ---- @class vim.treesitter.GetNodeOpts +--- Optional keyword arguments: +--- @class vim.treesitter.get_node.Opts +--- @inlinedoc +--- +--- Buffer number (nil or 0 for current buffer) --- @field bufnr integer? +--- +--- 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 }? +--- +--- Parser language. (default: from buffer filetype) --- @field lang string? +--- +--- Ignore injected languages (default true) --- @field ignore_injections boolean? --- Returns the smallest named node at the given position @@ -342,12 +353,7 @@ end --- vim.treesitter.get_parser(bufnr):parse(range) --- ``` --- ----@param opts vim.treesitter.GetNodeOpts? Optional keyword arguments: ---- - bufnr integer|nil Buffer number (nil or 0 for current buffer) ---- - pos table|nil 0-indexed (row, col) tuple. Defaults to cursor position in the ---- current window. Required if {bufnr} is not the current buffer ---- - lang string|nil Parser language. (default: from buffer filetype) ---- - ignore_injections boolean Ignore injected languages (default true) +---@param opts vim.treesitter.get_node.Opts? --- ---@return TSNode | nil Node at the given position function M.get_node(opts) diff --git a/runtime/lua/vim/treesitter/_query_linter.lua b/runtime/lua/vim/treesitter/_query_linter.lua index 6ec997eb4a..b91e8ac38d 100644 --- a/runtime/lua/vim/treesitter/_query_linter.lua +++ b/runtime/lua/vim/treesitter/_query_linter.lua @@ -45,7 +45,7 @@ local function guess_query_lang(buf) end --- @param buf integer ---- @param opts QueryLinterOpts|QueryLinterNormalizedOpts|nil +--- @param opts vim.treesitter.query.lint.Opts|QueryLinterNormalizedOpts|nil --- @return QueryLinterNormalizedOpts local function normalize_opts(buf, opts) opts = opts or {} @@ -122,7 +122,7 @@ local parse = vim.func._memoize(hash_parse, function(node, buf, lang) end) --- @param buf integer ---- @param match TSMatch +--- @param match vim.treesitter.query.TSMatch --- @param query Query --- @param lang_context QueryLinterLanguageContext --- @param diagnostics Diagnostic[] @@ -153,7 +153,7 @@ end --- @private --- @param buf integer Buffer to lint ---- @param opts QueryLinterOpts|QueryLinterNormalizedOpts|nil Options for linting +--- @param opts vim.treesitter.query.lint.Opts|QueryLinterNormalizedOpts|nil Options for linting function M.lint(buf, opts) if buf == 0 then buf = api.nvim_get_current_buf() diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 4c8f6e466f..dc2a14d238 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -1,23 +1,21 @@ local api = vim.api ----@class TSDevModule local M = {} ----@private ----@class TSTreeView +---@class (private) vim.treesitter.dev.TSTreeView ---@field ns integer API namespace ----@field opts TSTreeViewOpts ----@field nodes TSP.Node[] ----@field named TSP.Node[] +---@field opts vim.treesitter.dev.TSTreeViewOpts +---@field nodes vim.treesitter.dev.Node[] +---@field named vim.treesitter.dev.Node[] local TSTreeView = {} ---@private ----@class TSTreeViewOpts +---@class (private) vim.treesitter.dev.TSTreeViewOpts ---@field anon boolean If true, display anonymous nodes. ---@field lang boolean If true, display the language alongside each node. ---@field indent number Number of spaces to indent nested lines. ----@class TSP.Node +---@class (private) vim.treesitter.dev.Node ---@field node TSNode Treesitter node ---@field field string? Node field ---@field depth integer Depth of this node in the tree @@ -25,7 +23,7 @@ local TSTreeView = {} --- inspector is drawn. ---@field lang string Source language of this node ----@class TSP.Injection +---@class (private) vim.treesitter.dev.Injection ---@field lang string Source language of this injection ---@field root TSNode Root node of the injection @@ -45,9 +43,9 @@ local TSTreeView = {} ---@param depth integer Current recursion depth ---@param field string|nil The field of the current node ---@param lang string Language of the tree currently being traversed ----@param injections table Mapping of node ids to root nodes +---@param injections table Mapping of node ids to root nodes --- of injected language trees (see explanation above) ----@param tree TSP.Node[] Output table containing a list of tables each representing a node in the tree +---@param tree vim.treesitter.dev.Node[] Output table containing a list of tables each representing a node in the tree local function traverse(node, depth, field, lang, injections, tree) table.insert(tree, { node = node, @@ -73,7 +71,7 @@ end ---@param bufnr integer Source buffer number ---@param lang string|nil Language of source buffer --- ----@return TSTreeView|nil +---@return vim.treesitter.dev.TSTreeView|nil ---@return string|nil Error message, if any --- ---@package @@ -88,7 +86,7 @@ function TSTreeView:new(bufnr, lang) -- the primary tree that contains that root. Add a mapping from the node in the primary tree to -- the root in the child tree to the {injections} table. local root = parser:parse(true)[1]:root() - local injections = {} ---@type table + local injections = {} ---@type table parser:for_each_tree(function(parent_tree, parent_ltree) local parent = parent_tree:root() @@ -109,7 +107,7 @@ function TSTreeView:new(bufnr, lang) local nodes = traverse(root, 0, nil, parser:lang(), injections, {}) - local named = {} ---@type TSP.Node[] + local named = {} ---@type vim.treesitter.dev.Node[] for _, v in ipairs(nodes) do if v.node:named() then named[#named + 1] = v @@ -120,7 +118,7 @@ function TSTreeView:new(bufnr, lang) ns = api.nvim_create_namespace('treesitter/dev-inspect'), nodes = nodes, named = named, - ---@type TSTreeViewOpts + ---@type vim.treesitter.dev.TSTreeViewOpts opts = { anon = false, lang = false, @@ -171,7 +169,7 @@ end --- Updates the cursor position in the inspector to match the node under the cursor. --- ---- @param treeview TSTreeView +--- @param treeview vim.treesitter.dev.TSTreeView --- @param lang string --- @param source_buf integer --- @param inspect_buf integer @@ -278,7 +276,7 @@ end --- The node number is dependent on whether or not anonymous nodes are displayed. --- ---@param i integer Node number to get ----@return TSP.Node +---@return vim.treesitter.dev.Node ---@package function TSTreeView:get(i) local t = self.opts.anon and self.nodes or self.named @@ -287,7 +285,7 @@ end --- Iterate over all of the nodes in this View. --- ----@return (fun(): integer, TSP.Node) Iterator over all nodes in this View +---@return (fun(): integer, vim.treesitter.dev.Node) Iterator over all nodes in this View ---@return table ---@return integer ---@package @@ -295,22 +293,31 @@ function TSTreeView:iter() return ipairs(self.opts.anon and self.nodes or self.named) end ---- @class InspectTreeOpts ---- @field lang string? The language of the source buffer. If omitted, the ---- filetype of the source buffer is used. ---- @field bufnr integer? Buffer to draw the tree into. If omitted, a new ---- buffer is created. ---- @field winid integer? Window id to display the tree buffer in. If omitted, ---- a new window is created with {command}. ---- @field command string? Vimscript command to create the window. Default ---- value is "60vnew". Only used when {winid} is nil. ---- @field title (string|fun(bufnr:integer):string|nil) Title of the window. If a ---- function, it accepts the buffer number of the source ---- buffer as its only argument and should return a string. +--- @class vim.treesitter.dev.inspect_tree.Opts +--- @inlinedoc +--- +--- The language of the source buffer. If omitted, the filetype of the source +--- buffer is used. +--- @field lang string? +--- +--- Buffer to draw the tree into. If omitted, a new buffer is created. +--- @field bufnr integer? +--- +--- Window id to display the tree buffer in. If omitted, a new window is +--- created with {command}. +--- @field winid integer? +--- +--- Vimscript command to create the window. Default value is "60vnew". +--- Only used when {winid} is nil. +--- @field command string? +--- +--- Title of the window. If a function, it accepts the buffer number of the +--- source buffer as its only argument and should return a string. +--- @field title (string|fun(bufnr:integer):string|nil) --- @private --- ---- @param opts InspectTreeOpts? +--- @param opts vim.treesitter.dev.inspect_tree.Opts? function M.inspect_tree(opts) vim.validate({ opts = { opts, 't', true }, diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 8fb591bc46..388680259a 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -4,9 +4,9 @@ local Range = require('vim.treesitter._range') local ns = api.nvim_create_namespace('treesitter/highlighter') ----@alias vim.treesitter.highlighter.Iter fun(end_line: integer|nil): integer, TSNode, TSMetadata +---@alias vim.treesitter.highlighter.Iter fun(end_line: integer|nil): integer, TSNode, vim.treesitter.query.TSMetadata ----@class vim.treesitter.highlighter.Query +---@class (private) vim.treesitter.highlighter.Query ---@field private _query vim.treesitter.Query? ---@field private lang string ---@field private hl_cache table @@ -52,22 +52,23 @@ function TSHighlighterQuery:query() return self._query end ----@class vim.treesitter.highlighter.State +---@class (private) vim.treesitter.highlighter.State ---@field tstree TSTree ---@field next_row integer ---@field iter vim.treesitter.highlighter.Iter? ---@field highlighter_query vim.treesitter.highlighter.Query +---@nodoc ---@class vim.treesitter.highlighter ---@field active table ---@field bufnr integer ----@field orig_spelloptions string +---@field private orig_spelloptions string --- A map of highlight states. --- This state is kept during rendering across each line update. ----@field _highlight_states vim.treesitter.highlighter.State[] ----@field _queries table ----@field tree LanguageTree ----@field redraw_count integer +---@field private _highlight_states vim.treesitter.highlighter.State[] +---@field private _queries table +---@field tree vim.treesitter.LanguageTree +---@field private redraw_count integer local TSHighlighter = { active = {}, } @@ -78,7 +79,7 @@ TSHighlighter.__index = TSHighlighter --- --- Creates a highlighter for `tree`. --- ----@param tree LanguageTree parser object to use for highlighting +---@param tree vim.treesitter.LanguageTree parser object to use for highlighting ---@param opts (table|nil) Configuration of the highlighter: --- - queries table overwrite queries used by the highlighter ---@return vim.treesitter.highlighter Created highlighter object diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua index 0f6d5ecbd0..78c73c698c 100644 --- a/runtime/lua/vim/treesitter/language.lua +++ b/runtime/lua/vim/treesitter/language.lua @@ -56,10 +56,17 @@ function M.require_language(lang, path, silent, symbol_name) return true end ----@class vim.treesitter.language.RequireLangOpts ----@field path? string ----@field silent? boolean +---@class vim.treesitter.language.add.Opts +---@inlinedoc +--- +---Default filetype the parser should be associated with. +---(Default: {lang}) ---@field filetype? string|string[] +--- +---Optional path the parser is located at +---@field path? string +--- +---Internal symbol name for the language to load ---@field symbol_name? string --- Load parser with name {lang} @@ -67,13 +74,8 @@ end --- Parsers are searched in the `parser` runtime directory, or the provided {path} --- ---@param lang string Name of the parser (alphanumerical and `_` only) ----@param opts (table|nil) Options: ---- - filetype (string|string[]) Default filetype the parser should be associated with. ---- Defaults to {lang}. ---- - path (string|nil) Optional path the parser is located at ---- - symbol_name (string|nil) Internal symbol name for the language to load +---@param opts? vim.treesitter.language.add.Opts Options: function M.add(lang, opts) - ---@cast opts vim.treesitter.language.RequireLangOpts opts = opts or {} local path = opts.path local filetype = opts.filetype or lang diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index d01da8be71..2f1aa36d18 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -67,10 +67,11 @@ local TSCallbackNames = { on_child_removed = 'child_removed', } ----@class LanguageTree +---@nodoc +---@class vim.treesitter.LanguageTree ---@field private _callbacks table Callback handlers ---@field package _callbacks_rec table Callback handlers (recursive) ----@field private _children table Injected languages +---@field private _children table Injected languages ---@field private _injection_query Query Queries defining injected languages ---@field private _injections_processed boolean ---@field private _opts table Options @@ -89,7 +90,9 @@ local TSCallbackNames = { ---@field private _logfile? file* local LanguageTree = {} ----@class LanguageTreeOpts +---Optional arguments: +---@class vim.treesitter.LanguageTree.new.Opts +---@inlinedoc ---@field queries table -- Deprecated ---@field injections table @@ -102,14 +105,11 @@ LanguageTree.__index = LanguageTree --- ---@param source (integer|string) Buffer or text string to parse ---@param lang string Root language of this tree ----@param opts (table|nil) Optional arguments: ---- - injections table Map of language to injection query strings. Overrides the ---- built-in runtime file searching for language injections. +---@param opts vim.treesitter.LanguageTree.new.Opts? ---@param parent_lang? string Parent language name of this tree ----@return LanguageTree parser object +---@return vim.treesitter.LanguageTree parser object function LanguageTree.new(source, lang, opts, parent_lang) language.add(lang) - ---@type LanguageTreeOpts opts = opts or {} if source == 0 then @@ -118,7 +118,7 @@ function LanguageTree.new(source, lang, opts, parent_lang) local injections = opts.injections or {} - --- @type LanguageTree + --- @type vim.treesitter.LanguageTree local self = { _source = source, _lang = lang, @@ -194,7 +194,7 @@ local function tcall(f, ...) end ---@private ----@vararg any +---@param ... any function LanguageTree:_log(...) if not self._logger then return @@ -464,7 +464,7 @@ end --- add recursion yourself if needed. --- Invokes the callback for each |LanguageTree| and its children recursively --- ----@param fn fun(tree: LanguageTree, lang: string) +---@param fn fun(tree: vim.treesitter.LanguageTree, lang: string) ---@param include_self boolean|nil Whether to include the invoking tree in the results function LanguageTree:for_each_child(fn, include_self) vim.deprecate('LanguageTree:for_each_child()', 'LanguageTree:children()', '0.11') @@ -481,7 +481,7 @@ end --- --- Note: This includes the invoking tree's child trees as well. --- ----@param fn fun(tree: TSTree, ltree: LanguageTree) +---@param fn fun(tree: TSTree, ltree: vim.treesitter.LanguageTree) function LanguageTree:for_each_tree(fn) for _, tree in pairs(self._trees) do fn(tree, self) @@ -498,7 +498,7 @@ end --- ---@private ---@param lang string Language to add. ----@return LanguageTree injected +---@return vim.treesitter.LanguageTree injected function LanguageTree:add_child(lang) if self._children[lang] then self:remove_child(lang) @@ -668,7 +668,7 @@ end ---@param node TSNode ---@param source string|integer ----@param metadata TSMetadata +---@param metadata vim.treesitter.query.TSMetadata ---@param include_children boolean ---@return Range6[] local function get_node_ranges(node, source, metadata, include_children) @@ -702,13 +702,14 @@ local function get_node_ranges(node, source, metadata, include_children) return ranges end ----@class TSInjectionElem +---@nodoc +---@class vim.treesitter.languagetree.InjectionElem ---@field combined boolean ---@field regions Range6[][] ----@alias TSInjection table> +---@alias vim.treesitter.languagetree.Injection table> ----@param t table +---@param t table ---@param tree_index integer ---@param pattern integer ---@param lang string @@ -783,7 +784,7 @@ end --- Extract injections according to: --- https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection ---@param match table ----@param metadata TSMetadata +---@param metadata vim.treesitter.query.TSMetadata ---@return string?, boolean, Range6[] function LanguageTree:_get_injection(match, metadata) local ranges = {} ---@type Range6[] @@ -836,7 +837,7 @@ function LanguageTree:_get_injections() return {} end - ---@type table + ---@type table local injections = {} for index, tree in pairs(self._trees) do @@ -1150,7 +1151,7 @@ end --- Gets the appropriate language that contains {range}. --- ---@param range Range4 `{ start_line, start_col, end_line, end_col }` ----@return LanguageTree Managing {range} +---@return vim.treesitter.LanguageTree Managing {range} function LanguageTree:language_for_range(range) for _, child in pairs(self._children) do if child:contains(range) then diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 57272dbd60..6c7f713fd7 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -3,6 +3,7 @@ local language = require('vim.treesitter.language') local M = {} +---@nodoc ---Parsed query, see |vim.treesitter.query.parse()| --- ---@class vim.treesitter.Query @@ -31,6 +32,7 @@ function Query.new(lang, ts_query) return self end +---@nodoc ---Information for Query, see |vim.treesitter.query.parse()| ---@class vim.treesitter.QueryInfo --- @@ -296,7 +298,7 @@ end --- handling the "any" vs "all" semantics. They are called from the --- predicate_handlers table with the appropriate arguments for each predicate. local impl = { - --- @param match TSMatch + --- @param match vim.treesitter.query.TSMatch --- @param source integer|string --- @param predicate any[] --- @param any boolean @@ -331,7 +333,7 @@ local impl = { return not any end, - --- @param match TSMatch + --- @param match vim.treesitter.query.TSMatch --- @param source integer|string --- @param predicate any[] --- @param any boolean @@ -371,7 +373,7 @@ local impl = { end, }) - --- @param match TSMatch + --- @param match vim.treesitter.query.TSMatch --- @param source integer|string --- @param predicate any[] --- @param any boolean @@ -394,7 +396,7 @@ local impl = { end end)(), - --- @param match TSMatch + --- @param match vim.treesitter.query.TSMatch --- @param source integer|string --- @param predicate any[] --- @param any boolean @@ -421,12 +423,13 @@ local impl = { end, } ----@class TSMatch +---@nodoc +---@class vim.treesitter.query.TSMatch ---@field pattern? integer ---@field active? boolean ---@field [integer] TSNode[] ----@alias TSPredicate fun(match: TSMatch, pattern: integer, source: integer|string, predicate: any[]): boolean +---@alias TSPredicate fun(match: vim.treesitter.query.TSMatch, pattern: integer, source: integer|string, predicate: any[]): boolean -- Predicate handler receive the following arguments -- (match, pattern, bufnr, predicate) @@ -534,13 +537,14 @@ local predicate_handlers = { predicate_handlers['vim-match?'] = predicate_handlers['match?'] predicate_handlers['any-vim-match?'] = predicate_handlers['any-match?'] ----@class TSMetadata +---@nodoc +---@class vim.treesitter.query.TSMetadata ---@field range? Range ---@field conceal? string ----@field [integer] TSMetadata +---@field [integer] vim.treesitter.query.TSMetadata ---@field [string] integer|string ----@alias TSDirective fun(match: TSMatch, _, _, predicate: (string|integer)[], metadata: TSMetadata) +---@alias TSDirective fun(match: vim.treesitter.query.TSMatch, _, _, predicate: (string|integer)[], metadata: vim.treesitter.query.TSMetadata) -- Predicate handler receive the following arguments -- (match, pattern, bufnr, predicate) @@ -767,7 +771,7 @@ local function is_directive(name) end ---@private ----@param match TSMatch +---@param match vim.treesitter.query.TSMatch ---@param pattern integer ---@param source integer|string function Query:match_preds(match, pattern, source) @@ -806,8 +810,8 @@ function Query:match_preds(match, pattern, source) end ---@private ----@param match TSMatch ----@param metadata TSMetadata +---@param match vim.treesitter.query.TSMatch +---@param metadata vim.treesitter.query.TSMetadata function Query:apply_directives(match, pattern, source, metadata) local preds = self.info.patterns[pattern] @@ -871,7 +875,7 @@ end ---@param start? integer Starting line for the search. Defaults to `node:start()`. ---@param stop? integer Stopping line for the search (end-exclusive). Defaults to `node:end_()`. --- ----@return (fun(end_line: integer|nil): integer, TSNode, TSMetadata): +---@return (fun(end_line: integer|nil): integer, TSNode, vim.treesitter.query.TSMetadata): --- capture id, capture node, metadata function Query:iter_captures(node, source, start, stop) if type(source) == 'number' and source == 0 then @@ -880,7 +884,7 @@ function Query:iter_captures(node, source, start, stop) start, stop = value_or_node_range(start, stop, node) - local raw_iter = node:_rawquery(self.query, true, start, stop) ---@type fun(): integer, TSNode, TSMatch + local raw_iter = node:_rawquery(self.query, true, start, stop) ---@type fun(): integer, TSNode, vim.treesitter.query.TSMatch local function iter(end_line) local capture, captured_node, match = raw_iter() local metadata = {} @@ -952,7 +956,7 @@ function Query:iter_matches(node, source, start, stop, opts) start, stop = value_or_node_range(start, stop, node) - local raw_iter = node:_rawquery(self.query, false, start, stop, opts) ---@type fun(): integer, TSMatch + local raw_iter = node:_rawquery(self.query, false, start, stop, opts) ---@type fun(): integer, vim.treesitter.query.TSMatch local function iter() local pattern, match = raw_iter() local metadata = {} @@ -982,9 +986,16 @@ function Query:iter_matches(node, source, start, stop, opts) return iter end ----@class QueryLinterOpts ----@field langs (string|string[]|nil) ----@field clear (boolean) +--- Optional keyword arguments: +--- @class vim.treesitter.query.lint.Opts +--- @inlinedoc +--- +--- Language(s) to use for checking the query. +--- If multiple languages are specified, queries are validated for all of them +--- @field langs? string|string[] +--- +--- Just clear current lint errors +--- @field clear boolean --- Lint treesitter queries using installed parser, or clear lint errors. --- @@ -999,10 +1010,7 @@ end --- of the query file, e.g., if the path ends in `/lua/highlights.scm`, the parser for the --- `lua` language will be used. ---@param buf (integer) Buffer handle ----@param opts? QueryLinterOpts (table) Optional keyword arguments: ---- - langs (string|string[]|nil) Language(s) to use for checking the query. ---- If multiple languages are specified, queries are validated for all of them ---- - clear (boolean) if `true`, just clear current lint errors +---@param opts? vim.treesitter.query.lint.Opts function M.lint(buf, opts) if opts and opts.clear then vim.treesitter._query_linter.clear(buf) diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua index 09a6fa825b..f97e81273e 100644 --- a/runtime/lua/vim/version.lua +++ b/runtime/lua/vim/version.lua @@ -54,7 +54,8 @@ local M = {} ----@class Version +---@nodoc +---@class vim.Version ---@field [1] number ---@field [2] number ---@field [3] number @@ -111,7 +112,7 @@ function Version:__newindex(key, value) end end ----@param other Version +---@param other vim.Version function Version:__eq(other) for i = 1, 3 do if self[i] ~= other[i] then @@ -132,7 +133,7 @@ function Version:__tostring() return ret end ----@param other Version +---@param other vim.Version function Version:__lt(other) for i = 1, 3 do if self[i] > other[i] then @@ -144,7 +145,7 @@ function Version:__lt(other) return -1 == cmp_prerel(self.prerelease, other.prerelease) end ----@param other Version +---@param other vim.Version function Version:__le(other) return self < other or self == other end @@ -153,9 +154,9 @@ end --- --- Creates a new Version object, or returns `nil` if `version` is invalid. --- ---- @param version string|number[]|Version +--- @param version string|number[]|vim.Version --- @param strict? boolean Reject "1.0", "0-x", "3.2a" or other non-conforming version strings ---- @return Version? +--- @return vim.Version? function M._version(version, strict) -- Adapted from https://github.com/folke/lazy.nvim if type(version) == 'table' then if version.major then @@ -203,7 +204,7 @@ end ---TODO: generalize this, move to func.lua --- ----@generic T: Version +---@generic T: vim.Version ---@param versions T[] ---@return T? function M.last(versions) @@ -216,14 +217,15 @@ function M.last(versions) return last end ----@class VersionRange ----@field from Version ----@field to? Version +---@class vim.VersionRange +---@inlinedoc +---@field from vim.Version +---@field to? vim.Version local VersionRange = {} --- @private --- ----@param version string|Version +---@param version string|vim.Version function VersionRange:has(version) if type(version) == 'string' then ---@diagnostic disable-next-line: cast-local-type @@ -272,6 +274,7 @@ end --- @see # https://github.com/npm/node-semver#ranges --- --- @param spec string Version range "spec" +--- @return vim.VersionRange function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim if spec == '*' or spec == '' then return setmetatable({ from = M.parse('0.0.0') }, { __index = VersionRange }) @@ -300,8 +303,8 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim local semver = M.parse(version) if semver then - local from = semver --- @type Version? - local to = vim.deepcopy(semver, true) --- @type Version? + local from = semver --- @type vim.Version? + local to = vim.deepcopy(semver, true) --- @type vim.Version? ---@diagnostic disable: need-check-nil if mods == '' or mods == '=' then to.patch = to.patch + 1 @@ -340,7 +343,7 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim end end ----@param v string|Version +---@param v string|vim.Version ---@return string local function create_err_msg(v) if type(v) == 'string' then @@ -369,8 +372,8 @@ end --- --- @note Per semver, build metadata is ignored when comparing two otherwise-equivalent versions. --- ----@param v1 Version|number[]|string Version object. ----@param v2 Version|number[]|string Version to compare with `v1`. +---@param v1 vim.Version|number[]|string Version object. +---@param v2 vim.Version|number[]|string Version to compare with `v1`. ---@return integer -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`. function M.cmp(v1, v2) local v1_parsed = assert(M._version(v1), create_err_msg(v1)) @@ -385,40 +388,40 @@ function M.cmp(v1, v2) end ---Returns `true` if the given versions are equal. See |vim.version.cmp()| for usage. ----@param v1 Version|number[]|string ----@param v2 Version|number[]|string +---@param v1 vim.Version|number[]|string +---@param v2 vim.Version|number[]|string ---@return boolean function M.eq(v1, v2) return M.cmp(v1, v2) == 0 end ---Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage. ----@param v1 Version|number[]|string ----@param v2 Version|number[]|string +---@param v1 vim.Version|number[]|string +---@param v2 vim.Version|number[]|string ---@return boolean function M.le(v1, v2) return M.cmp(v1, v2) <= 0 end ---Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage. ----@param v1 Version|number[]|string ----@param v2 Version|number[]|string +---@param v1 vim.Version|number[]|string +---@param v2 vim.Version|number[]|string ---@return boolean function M.lt(v1, v2) return M.cmp(v1, v2) == -1 end ---Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage. ----@param v1 Version|number[]|string ----@param v2 Version|number[]|string +---@param v1 vim.Version|number[]|string +---@param v2 vim.Version|number[]|string ---@return boolean function M.ge(v1, v2) return M.cmp(v1, v2) >= 0 end ---Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage. ----@param v1 Version|number[]|string ----@param v2 Version|number[]|string +---@param v1 vim.Version|number[]|string +---@param v2 vim.Version|number[]|string ---@return boolean function M.gt(v1, v2) return M.cmp(v1, v2) == 1 @@ -438,7 +441,7 @@ end --- - strict (boolean): Default false. If `true`, no coercion is attempted on --- input not conforming to semver v2.0.0. If `false`, `parse()` attempts to --- coerce input such as "1.0", "0-x", "tmux 3.2a" into valid versions. ----@return Version? parsed_version Version object or `nil` if input is invalid. +---@return vim.Version? parsed_version Version object or `nil` if input is invalid. function M.parse(version, opts) assert(type(version) == 'string', create_err_msg(version)) opts = opts or { strict = false } @@ -447,9 +450,9 @@ end setmetatable(M, { --- Returns the current Nvim version. - ---@return Version + ---@return vim.Version __call = function() - local version = vim.fn.api_info().version ---@type Version + local version = vim.fn.api_info().version ---@type vim.Version -- Workaround: vim.fn.api_info().version reports "prerelease" as a boolean. version.prerelease = version.prerelease and 'dev' or nil return setmetatable(version, Version) -- cgit From 72e0ef2f4616c0b41c333a1e4e8490020755930a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 2 Mar 2024 09:48:57 +0100 Subject: vim-patch:100a665634a0 runtime(java): Improve the recognition of literals (vim/vim#14120) * Emend the Unicode and octal escape sequence patterns; * Accept the (repeated) underscore separators in all numerical literals; * Recognise hexadecimal floating-point literals. (The space escape sequence '\s' will be introduced along with text blocks in another PR.) References: https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.3 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.1 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.2 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7 https://github.com/vim/vim/commit/100a665634a0a2edbc755daf453c4915800684dd Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> --- runtime/syntax/java.vim | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 1b940ebd39..aec2955533 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2024 Feb 27 +" Last Change: 2024 Mar 01 " Please check :help java.vim for comments on some of the options available. @@ -226,20 +226,28 @@ syn match javaComment "/\*\*/" " Strings and constants syn match javaSpecialError contained "\\." syn match javaSpecialCharError contained "[^']" -syn match javaSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" +" Escape Sequences (JLS-17, §3.10.7): +syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell -" next line disabled, it can cause a crash for a long line +" The next line is commented out, it can cause a crash for a long line "syn match javaStringError +"\([^"\\]\|\\.\)*$+ syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" -syn match javaNumber "\<\(0[bB][0-1]\+\|0[0-7]*\|0[xX]\x\+\|\d\(\d\|_\d\)*\)[lL]\=\>" -syn match javaNumber "\(\<\d\(\d\|_\d\)*\.\(\d\(\d\|_\d\)*\)\=\|\.\d\(\d\|_\d\)*\)\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\=" -syn match javaNumber "\<\d\(\d\|_\d\)*[eE][-+]\=\d\(\d\|_\d\)*[fFdD]\=\>" -syn match javaNumber "\<\d\(\d\|_\d\)*\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\>" - -" unicode characters -syn match javaSpecial "\\u\d\{4\}" +" Integer literals (JLS-17, §3.10.1): +syn keyword javaNumber 0 0l 0L +syn match javaNumber "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" +" Decimal floating-point literals (JLS-17, §3.10.2): +" Against "\<\d\+\>\.": +syn match javaNumber "\<\d\%(_*\d\)*\." +syn match javaNumber "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" +syn match javaNumber "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" +syn match javaNumber "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>" +" Hexadecimal floating-point literals (JLS-17, §3.10.2): +syn match javaNumber "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>" + +" Unicode characters +syn match javaSpecial "\\u\x\x\x\x" syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError @@ -265,16 +273,19 @@ endif if exists("java_highlight_debug") " Strings and constants - syn match javaDebugSpecial contained "\\\d\d\d\|\\." + syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial - syn match javaDebugStringError +"\([^"\\]\|\\.\)*$+ + syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ syn match javaDebugCharacter contained "'[^\\]'" syn match javaDebugSpecialCharacter contained "'\\.'" syn match javaDebugSpecialCharacter contained "'\\''" - syn match javaDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" - syn match javaDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" - syn match javaDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" - syn match javaDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" + syn keyword javaDebugNumber contained 0 0l 0L + syn match javaNumber contained "\<\d\%(_*\d\)*\." + syn match javaDebugNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" + syn match javaDebugNumber contained "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" + syn match javaDebugNumber contained "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" + syn match javaDebugNumber contained "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>" + syn match javaDebugNumber contained "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>" syn keyword javaDebugBoolean contained true false syn keyword javaDebugType contained null this super syn region javaDebugParen start=+(+ end=+)+ contained contains=javaDebug.*,javaDebugParen -- cgit From 39cc38a87b29d61e7e5342bad2e5156446eb8649 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 2 Mar 2024 18:51:10 +0900 Subject: fix(lsp): defer writing error msgs (#27688) Context: Nvim catches errors from the user's `on_exit` and rpc handler callbacks and prints the error message. Problem: Printing the error message uses Nvim api functions. But callbacks mentioned above run in `:h lua-loop-callbacks` where most of `vim.api` is not allowed, so Nvim itself raises error. Solution: `vim.schedule()` the error reporting when necessary. --- runtime/lua/vim/lsp/client.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua index dfb5137e2a..0f47c57cd5 100644 --- a/runtime/lua/vim/lsp/client.lua +++ b/runtime/lua/vim/lsp/client.lua @@ -691,8 +691,16 @@ local wait_result_reason = { [-1] = 'timeout', [-2] = 'interrupted', [-3] = 'err --- --- @param ... string List to write to the buffer local function err_message(...) - api.nvim_err_writeln(table.concat(vim.tbl_flatten({ ... }))) - api.nvim_command('redraw') + local message = table.concat(vim.tbl_flatten({ ... })) + if vim.in_fast_event() then + vim.schedule(function() + api.nvim_err_writeln(message) + api.nvim_command('redraw') + end) + else + api.nvim_err_writeln(message) + api.nvim_command('redraw') + end end --- @private -- cgit From dc8c086c7e73a9035c34be6416e7c465d61edc0e Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 2 Mar 2024 23:21:53 +0900 Subject: fix(lsp): directly rename the existing buffers when renaming (#27690) Problem: `vim.lsp.util.rename()` deletes the buffers that are affected by renaming. This has undesireable side effects. For example, when renaming a directory, all buffers under that directory are deleted and windows displaying those buffers are closed. Also, buffer options may change after renaming. Solution: Rename the buffers with :saveas. An alternative approach is to record all the relevant states and restore it after renaming, but that seems to be more complex. In fact, the older version was attempting to restore the states but only partially and incorrectly. --- runtime/doc/lsp.txt | 8 +++++ runtime/lua/vim/lsp/util.lua | 78 ++++++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 28 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index d78189780d..511fb590cc 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2068,6 +2068,14 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()* rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()* Rename old_fname to new_fname + Existing buffers are renamed as well, while maintaining their bufnr. + + It deletes existing buffers that conflict with the renamed file name only + when + • `opts` requests overwriting; or + • the conflicting buffers are not loaded, so that deleting thme does not + result in data loss. + Parameters: ~ • {old_fname} (`string`) • {new_fname} (`string`) diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 60d0f0cc83..f8e5b6a90d 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -675,12 +675,23 @@ local function get_bufs_with_prefix(prefix) return buffers end +local function escape_gsub_repl(s) + return (s:gsub('%%', '%%%%')) +end + --- @class vim.lsp.util.rename.Opts --- @inlinedoc --- @field overwrite? boolean --- @field ignoreIfExists? boolean --- Rename old_fname to new_fname +--- +--- Existing buffers are renamed as well, while maintaining their bufnr. +--- +--- It deletes existing buffers that conflict with the renamed file name only when +--- * `opts` requests overwriting; or +--- * the conflicting buffers are not loaded, so that deleting thme does not result in data loss. +--- --- @param old_fname string --- @param new_fname string --- @param opts? vim.lsp.util.rename.Opts Options: @@ -700,24 +711,36 @@ function M.rename(old_fname, new_fname, opts) return end - local oldbufs = {} - local win = nil - - if vim.fn.isdirectory(old_fname_full) == 1 then - oldbufs = get_bufs_with_prefix(old_fname_full) - else - local oldbuf = vim.fn.bufadd(old_fname_full) - table.insert(oldbufs, oldbuf) - win = vim.fn.win_findbuf(oldbuf)[1] - end - - for _, b in ipairs(oldbufs) do - -- There may be pending changes in the buffer - if api.nvim_buf_is_loaded(b) then - api.nvim_buf_call(b, function() - vim.cmd('update!') - end) + local buf_rename = {} ---@type table + local old_fname_pat = '^' .. vim.pesc(old_fname_full) + for b in + vim.iter(get_bufs_with_prefix(old_fname_full)):filter(function(b) + -- No need to care about unloaded or nofile buffers. Also :saveas won't work for them. + return api.nvim_buf_is_loaded(b) + and not vim.list_contains({ 'nofile', 'nowrite' }, vim.bo[b].buftype) + end) + do + -- Renaming a buffer may conflict with another buffer that happens to have the same name. In + -- most cases, this would have been already detected by the file conflict check above, but the + -- conflicting buffer may not be associated with a file. For example, 'buftype' can be "nofile" + -- or "nowrite", or the buffer can be a normal buffer but has not been written to the file yet. + -- Renaming should fail in such cases to avoid losing the contents of the conflicting buffer. + local old_bname = vim.api.nvim_buf_get_name(b) + local new_bname = old_bname:gsub(old_fname_pat, escape_gsub_repl(new_fname)) + if vim.fn.bufexists(new_bname) == 1 then + local existing_buf = vim.fn.bufnr(new_bname) + if api.nvim_buf_is_loaded(existing_buf) and skip then + vim.notify( + new_bname .. ' already exists in the buffer list. Skipping rename.', + vim.log.levels.ERROR + ) + return + end + -- no need to preserve if such a buffer is empty + api.nvim_buf_delete(existing_buf, {}) end + + buf_rename[b] = { from = old_bname, to = new_bname } end local newdir = assert(vim.fs.dirname(new_fname)) @@ -733,17 +756,16 @@ function M.rename(old_fname, new_fname, opts) os.rename(old_undofile, new_undofile) end - if vim.fn.isdirectory(new_fname) == 0 then - local newbuf = vim.fn.bufadd(new_fname) - if win then - vim.fn.bufload(newbuf) - vim.bo[newbuf].buflisted = true - api.nvim_win_set_buf(win, newbuf) - end - end - - for _, b in ipairs(oldbufs) do - api.nvim_buf_delete(b, {}) + for b, rename in pairs(buf_rename) do + -- Rename with :saveas. This does two things: + -- * Unset BF_WRITE_MASK, so that users don't get E13 when they do :write. + -- * Send didClose and didOpen via textDocument/didSave handler. + api.nvim_buf_call(b, function() + vim.cmd('keepalt saveas! ' .. vim.fn.fnameescape(rename.to)) + end) + -- Delete the new buffer with the old name created by :saveas. nvim_buf_delete and + -- :bwipeout are futile because the buffer will be added again somewhere else. + vim.cmd('bdelete! ' .. vim.fn.bufnr(rename.from)) end end -- cgit From bf695b5ef436b9fb8cb0872b05aa2e0e5e2ee110 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 2 Mar 2024 19:29:12 +0100 Subject: vim-patch:e93afc2e6126 runtime(r,rhelp,rmd,rnoweb,rrst): Update ftplugin, browsefilter labels (vim/vim#14126) Use the standard format for browsefilter labels: "File Description (*.ext1, *.ext2, *.ext3)" https://github.com/vim/vim/commit/e93afc2e612647e79e1082096ffd6c61e01ac691 Co-authored-by: dkearns --- runtime/ftplugin/r.vim | 14 ++++++-------- runtime/ftplugin/rhelp.vim | 12 ++++++------ runtime/ftplugin/rmd.vim | 12 ++++++------ runtime/ftplugin/rnoweb.vim | 14 ++++++-------- runtime/ftplugin/rrst.vim | 14 ++++++-------- 5 files changed, 30 insertions(+), 36 deletions(-) (limited to 'runtime') diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index b3ffc91abc..6b07744c4a 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: R -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2022 Apr 24 09:14AM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: R +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -25,7 +23,7 @@ setlocal comments=:#',:###,:##,:# if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R)\t*.R\n" . - \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + \ "Files that include R (*.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index 6086b440f0..0fa1e56573 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file -" Language: R help file -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2022 Apr 24 09:12AM -" 2024 Jan 14 by Vim Project (browsefilter) +" Language: R help file +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -19,7 +19,7 @@ set cpo&vim setlocal iskeyword=@,48-57,_,. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 74b920f19a..a537017aad 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file -" Language: R Markdown file -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 May 29 06:31AM -" 2024 Jan 14 by Vim Project (browsefilter) +" Language: R Markdown file +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer @@ -65,7 +65,7 @@ runtime ftplugin/pandoc.vim let b:did_ftplugin = 1 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index 3bed4b42cb..8dfdf1e80f 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: Rnoweb -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 Feb 27 07:16PM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: Rnoweb +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -28,7 +26,7 @@ setlocal suffixesadd=.bib,.tex setlocal comments=b:%,b:#,b:##,b:###,b:#' if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 04a9737e42..d088f98224 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: reStructuredText documentation format with R code -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 Feb 27 07:16PM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: reStructuredText documentation format with R code +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Original work by Alex Zvoleff " Only do this when not yet done for this buffer @@ -41,7 +39,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else -- cgit From 3971797be125a958432fb439575ae31b544f4083 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 3 Mar 2024 16:07:23 +0100 Subject: vim-patch:b3030b653bbd runtime(java): Recognise text blocks (vim/vim#14128) Also, accept as valid the space escape sequence `\s`. Also, consistently use the claimed `javaDebug` prefix for syntax group definitions kept under `g:java_highlight_debug`. Since `javaStringError` is commented out for its generality, let's comment out `javaDebugStringError`, its copy, as well. References: https://openjdk.org/jeps/378 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7 Closes vim/vim#10910. https://github.com/vim/vim/commit/b3030b653bbdc08c91138001d1987d804f6ebf46 Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> --- runtime/syntax/java.vim | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index aec2955533..f6d2660277 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2024 Mar 01 +" Last Change: 2024 Mar 02 " Please check :help java.vim for comments on some of the options available. @@ -179,15 +179,18 @@ syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaCo " Comments syn keyword javaTodo contained TODO FIXME XXX + if exists("java_comment_strings") syn region javaCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell - syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell + syn region javaCommentString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell,javaSpecialError,javaTextBlockError + syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell syn match javaCommentCharacter contained "'\\[^']\{1,6\}'" contains=javaSpecialChar syn match javaCommentCharacter contained "'\\''" contains=javaSpecialChar syn match javaCommentCharacter contained "'[^\\]'" syn cluster javaCommentSpecial add=javaCommentString,javaCommentCharacter,javaNumber syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber endif + syn region javaComment start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,@Spell syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 syn match javaCommentStar contained "^\s*\*$" @@ -227,10 +230,12 @@ syn match javaComment "/\*\*/" syn match javaSpecialError contained "\\." syn match javaSpecialCharError contained "[^']" " Escape Sequences (JLS-17, §3.10.7): -syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" +syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)" syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell +syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell +syn match javaTextBlockError +"""\s*"""+ " The next line is commented out, it can cause a crash for a long line -"syn match javaStringError +"\([^"\\]\|\\.\)*$+ +"syn match javaStringError +"\%([^"\\]\|\\.\)*$+ syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" @@ -249,7 +254,7 @@ syn match javaNumber "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%( " Unicode characters syn match javaSpecial "\\u\x\x\x\x" -syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError +syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError,javaTextBlockError if exists("java_highlight_functions") if java_highlight_functions == "indent" @@ -271,16 +276,18 @@ if exists("java_highlight_functions") endif if exists("java_highlight_debug") - " Strings and constants - syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" + syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)" syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial - syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ + syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError +" The next line is commented out, it can cause a crash for a long line +" syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ + syn match javaDebugTextBlockError contained +"""\s*"""+ syn match javaDebugCharacter contained "'[^\\]'" syn match javaDebugSpecialCharacter contained "'\\.'" syn match javaDebugSpecialCharacter contained "'\\''" syn keyword javaDebugNumber contained 0 0l 0L - syn match javaNumber contained "\<\d\%(_*\d\)*\." + syn match javaDebugNumber contained "\<\d\%(_*\d\)*\." syn match javaDebugNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" syn match javaDebugNumber contained "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" syn match javaDebugNumber contained "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" @@ -301,6 +308,7 @@ if exists("java_highlight_debug") hi def link javaDebug Debug hi def link javaDebugString DebugString hi def link javaDebugStringError javaError + hi def link javaDebugTextBlockError javaDebugStringError hi def link javaDebugType DebugType hi def link javaDebugBoolean DebugBoolean hi def link javaDebugNumber Debug @@ -373,6 +381,7 @@ hi def link javaSpecialChar SpecialChar hi def link javaNumber Number hi def link javaError Error hi def link javaStringError Error +hi def link javaTextBlockError javaStringError hi def link javaStatement Statement hi def link javaOperator Operator hi def link javaComment Comment -- cgit From b86799a07692368ae35639603a0aa516b796ceb2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 4 Mar 2024 06:35:29 +0800 Subject: vim-patch:c4aef9a97b36 runtime(vim): Update base-syntax, improve :augroup highlighting (vim/vim#14125) - Explicitly match the bang and group name in :aug! {name}. - Allow any characters in a group name. - Match default group switch marker, END. - Match :aug without arguments (list command). https://github.com/vim/vim/commit/c4aef9a97b3673a12de7a131d239e7f49d11f630 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 1020975b1d..b033b47b24 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -154,7 +154,8 @@ syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst1,v syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment " All vimCommands are contained by vimIsCommand. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSubst1,vimSyntax,vimUnlet,vimUnmap,vimUserCmd +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" @@ -195,17 +196,21 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. -syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimOption +syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimFunctionError,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue +syn match vimAugroup "\" contains=vimAugroupKey,vimAugroupBang skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' - syn region vimAugroup fold matchgroup=vimAugroupKey start="\\ze\s\+\K\k*" end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList + syn region vimAugroup fold start="\\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd else - syn region vimAugroup matchgroup=vimAugroupKey start="\\ze\s\+\K\k*" end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList + syn region vimAugroup start="\\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd endif -syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror") - syn match vimAugroupError "\\s\+[eE][nN][dD]\>" + syn match vimAugroupError "\\s\+[eE][nN][dD]\>" endif -syn keyword vimAugroupKey contained aug[roup] + +syn match vimAutoCmdGroup contained "\S\+" +syn match vimAugroupEnd contained "\c\" +syn match vimAugroupBang contained "\a\@1<=!" skipwhite nextgroup=vimAutoCmdGroup +syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup,vimAugroupEnd " Operators: {{{2 " ========= @@ -222,7 +227,7 @@ endif " Functions : Tag is provided for those who wish to highlight tagged functions {{{2 " ========= syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID -syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimEnvvar,vimExecute,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLetHereDoc,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand +syn cluster vimFuncBodyList contains=@vimCmdList,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimLetHereDoc,vimLineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimSynLine syn match vimFunction "\<\(fu\%[nction]\)!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody syn match vimFunction "\.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter syn match vimUserAttrbError contained "-\a\+\ze\s" @@ -924,6 +929,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimAbb vimCommand hi def link vimAddress vimMark + hi def link vimAugroupBang vimBang hi def link vimAugroupError vimError hi def link vimAugroupKey vimCommand hi def link vimAuHighlight vimHighlight -- cgit From fc2be84e44048d41801211b61e0930faaccda2f9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 4 Mar 2024 06:43:36 +0800 Subject: vim-patch:691aee8b0705 runtime(vim): Update base-syntax, fix issue vim/vim#14135 (vim/vim#14136) Fix incorrect error highlighting for function calls in :command definitions. vimFunctionError should be restricted to :function header lines. fixes: vim/vim#14135 https://github.com/vim/vim/commit/691aee8b070506e6eea8ec166bf69d9a03002790 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index b033b47b24..5fc86bee01 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -196,7 +196,7 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. -syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimFunctionError,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue +syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue syn match vimAugroup "\" contains=vimAugroupKey,vimAugroupBang skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' syn region vimAugroup fold start="\\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd @@ -271,7 +271,7 @@ syn match vimSpecFileMod "\(:[phtre]\)\+" contained " User-Specified Commands: {{{2 " ======================= -syn cluster vimUserCmdList contains=@vimCmdList,vimCmplxRepeat,vimComment,vim9Comment,vimCtrlChar,vimEscapeBrace,vimFunc,vimFunctionError,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine +syn cluster vimUserCmdList contains=@vimCmdList,vimCmplxRepeat,vimComment,vim9Comment,vimCtrlChar,vimEscapeBrace,vimFunc,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine syn keyword vimUserCommand contained com[mand] syn match vimUserCmd "\.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter syn match vimUserAttrbError contained "-\a\+\ze\s" -- cgit From 3df1211ebc4c7ec4562d0ad0fa51a24569b81e15 Mon Sep 17 00:00:00 2001 From: Luna Saphie Mittelbach Date: Mon, 4 Mar 2024 00:33:09 +0100 Subject: docs(lua): clarify when `vim.bo`/`vim.wo` acts like `:setlocal` (#27708) --- runtime/doc/lua.txt | 16 +++++++++------- runtime/lua/vim/_options.lua | 12 ++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index b4d66f11ae..c785106ca8 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1409,11 +1409,12 @@ Option:remove({value}) *vim.opt:remove()* • {value} (`string`) Value to remove vim.bo *vim.bo* - Get or set buffer-scoped |options| for the buffer with number {bufnr}. - Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current - buffer is used. Invalid {bufnr} or key is an error. + Get or set buffer-scoped |options| for the buffer with number {bufnr}. If + [{bufnr}] is omitted then the current buffer is used. Invalid {bufnr} or + key is an error. - Note: this is equivalent to both `:set` and `:setlocal`. + Note: this is equivalent to `:setlocal` for |global-local| options and + `:set` otherwise. Example: >lua local bufnr = vim.api.nvim_get_current_buf() @@ -1462,9 +1463,10 @@ vim.o *vim.o* vim.wo *vim.wo* Get or set window-scoped |options| for the window with handle {winid} and - buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like - `:set` otherwise. If [{winid}] is omitted then the current window is used. - Invalid {winid}, {bufnr} or key is an error. + buffer with number {bufnr}. Like `:setlocal` if setting a |global-local| + option or if {bufnr} is provided, like `:set` otherwise. If [{winid}] is + omitted then the current window is used. Invalid {winid}, {bufnr} or key + is an error. Note: only {bufnr} with value `0` (the current buffer in the window) is supported. diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua index bde9421552..b661ddfb22 100644 --- a/runtime/lua/vim/_options.lua +++ b/runtime/lua/vim/_options.lua @@ -271,10 +271,10 @@ vim.go = setmetatable({}, { }) --- Get or set buffer-scoped |options| for the buffer with number {bufnr}. ---- Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current ---- buffer is used. Invalid {bufnr} or key is an error. +--- If [{bufnr}] is omitted then the current buffer is used. +--- Invalid {bufnr} or key is an error. --- ---- Note: this is equivalent to both `:set` and `:setlocal`. +--- Note: this is equivalent to `:setlocal` for |global-local| options and `:set` otherwise. --- --- Example: --- @@ -287,9 +287,9 @@ vim.go = setmetatable({}, { vim.bo = new_buf_opt_accessor() --- Get or set window-scoped |options| for the window with handle {winid} and ---- buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like ---- `:set` otherwise. If [{winid}] is omitted then the current window is ---- used. Invalid {winid}, {bufnr} or key is an error. +--- buffer with number {bufnr}. Like `:setlocal` if setting a |global-local| option +--- or if {bufnr} is provided, like `:set` otherwise. If [{winid}] is omitted then +--- the current window is used. Invalid {winid}, {bufnr} or key is an error. --- --- Note: only {bufnr} with value `0` (the current buffer in the window) is --- supported. -- cgit From a8131aee9ecc640415903d590b15863ce1c99112 Mon Sep 17 00:00:00 2001 From: altermo <107814000+altermo@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:08:23 +0100 Subject: fix(tohtml): replace hex escape with digit escape (#27728) --- runtime/lua/tohtml.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua index 52e0742ef3..d15412edee 100644 --- a/runtime/lua/tohtml.lua +++ b/runtime/lua/tohtml.lua @@ -906,7 +906,9 @@ local function styletable_listchars(state) if listchars.nbsp then for _, match in - ipairs(vim.fn.matchbufline(state.bufnr, '\xe2\x80\xaf\\|\xa0', 1, '$') --[[@as (table[])]]) + ipairs( + vim.fn.matchbufline(state.bufnr, '\226\128\175\\|\194\160', 1, '$') --[[@as (table[])]] + ) do style_line_insert_overlay_char( state.style[match.lnum], -- cgit From 56734226afaca893f37b462e2a4787d2d2a13ce2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 4 Mar 2024 22:36:01 +0100 Subject: vim-patch:e84490311ba3 runtime(css): update syntax script https://github.com/vim/vim/commit/e84490311ba32cb258cc738bc3caa8b448c84c8b Co-authored-by: Jay Sitter --- runtime/syntax/css.vim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/css.vim b/runtime/syntax/css.vim index f8104ea2c5..f4d09cfa4e 100644 --- a/runtime/syntax/css.vim +++ b/runtime/syntax/css.vim @@ -7,7 +7,7 @@ " Nikolai Weibull (Add CSS2 support) " URL: https://github.com/vim-language-dept/css-syntax.vim " Maintainer: Jay Sitter -" Last Change: 2021 Oct 20 +" Last Change: 2024 Mar 2 " quit when a syntax file was already loaded if !exists("main_syntax") @@ -127,7 +127,7 @@ syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline syn region cssMathGroup contained matchgroup=cssMathParens start="(" end=")" containedin=cssFunction,cssMathGroup contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline -syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline +syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssURL,cssColor,cssStringQ,cssStringQQ oneline syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\|conic-\)\=\gradient\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma @@ -176,6 +176,8 @@ syn keyword cssBackgroundAttr contained cover contain syn match cssBorderProp contained "\" syn match cssBorderProp contained "\" +syn match cssBorderProp contained "\" +syn match cssBorderProp contained "\" syn match cssBorderProp contained "\" syn match cssBorderProp contained "\" syn match cssBorderProp contained "\" @@ -195,6 +197,7 @@ syn keyword cssBorderAttr contained clone slice syn match cssBoxProp contained "\" syn match cssBoxProp contained "\" +syn match cssBoxProp contained "\<\(margin\|padding\)\(-\(inline\|block\)\(-\(start\|end\)\)\)\=\>" syn match cssBoxProp contained "\" syn match cssBoxProp contained "\" syn keyword cssBoxAttr contained visible hidden scroll auto @@ -227,7 +230,7 @@ syn match cssFlexibleBoxAttr contained "\" +syn match cssFontProp contained "\" " font attributes syn keyword cssFontAttr contained icon menu caption @@ -248,6 +251,8 @@ syn keyword cssFontAttr contained italic oblique syn keyword cssFontAttr contained weight style " font-weight attributes syn keyword cssFontAttr contained bold bolder lighter +" font-display attributes +syn keyword cssFontAttr contained auto block swap fallback optional " TODO: font-variant-* attributes "------------------------------------------------ @@ -282,7 +287,7 @@ syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>" " https://www.w3.org/TR/css-grid-1/ syn match cssGridProp contained "\" syn match cssGridProp contained "\" -syn match cssGridProp contained "\" +syn match cssGridProp contained "\<\(grid-\)\=\(column\|row\)\(-\(start\|end\|gap\)\)\=\>" syn match cssGridProp contained "\" syn match cssGridProp contained "\" syn match cssGridProp contained "\" @@ -452,12 +457,12 @@ syn match cssAttrComma "," " Pseudo class " https://www.w3.org/TR/selectors-4/ syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn -syn keyword cssPseudoClassId contained link visited active hover before after left right any-link -syn keyword cssPseudoClassId contained root empty target enabled disabled checked invalid default defined autofill fullscreen host indeterminate in-range modal optional out-of-range picture-in-picture placeholder-shown paused playing read-only read-write required scope +syn keyword cssPseudoClassId contained link visited active hover before after left right +syn keyword cssPseudoClassId contained root empty target enabled disabled checked invalid syn match cssPseudoClassId contained "\" syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>" syn match cssPseudoClassId contained "\" -syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(where\|has\|host\|not\|is\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ,cssTagName,cssAttributeSelector,cssClassName,cssIdentifier +syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|is\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ,cssTagName,cssAttributeSelector,cssClassName,cssIdentifier " ------------------------------------ " Vendor specific properties syn match cssPseudoClassId contained "\" -- cgit From 66c9f987e703d780a68b2d688082c39db8468ad4 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 4 Mar 2024 22:36:35 +0100 Subject: vim-patch:1bdc9435c1a1 runtime(sh): Update syntax file, fix issue vim/vim#962 (vim/vim#14138) Allow the opening parenthesis of a multiline array assignment, within an if statement, to appear at EOL. Fixes issue vim/vim#962. https://github.com/vim/vim/commit/1bdc9435c1a14ca1a30e5b5927ab63f603ec4409 Co-authored-by: dkearns --- runtime/syntax/sh.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 4c591736b7..97e74d205f 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -3,8 +3,7 @@ " Maintainer: This runtime file is looking for a new maintainer. " Previous Maintainers: Charles E. Campbell " Lennart Schultz -" Last Change: Feb 28, 2023 -" 2024 Feb 19 by Vim Project (announce adoption) +" Last Change: 2024 Mar 04 by Vim Project " Version: 208 " Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax @@ -354,7 +353,7 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") elseif !exists("g:sh_no_error") syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList endif -syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList +syn region shCmdParenRegion matchgroup=shCmdSubRegion start="((\@!" skip='\\\\\|\\.' end=")" contains=@shCommandSubList if exists("b:is_bash") syn cluster shCommandSubList add=bashSpecialVariables,bashStatement -- cgit From 971602029311c33353c88175f761557431330528 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 4 Mar 2024 22:36:57 +0100 Subject: vim-patch:d9ebd46bd090 runtime(mswin): Use unnamed register when clipboard not working (vim/vim#13813) * Use unnamed register while clipboard not exist * Do not need to specify the unnamed register explicitly fixes: vim/vim#13809 https://github.com/vim/vim/commit/d9ebd46bd090c598adc82e683b4462909f2d4ea5 Co-authored-by: Shixian Li <34830785+znsoooo@users.noreply.github.com> --- runtime/mswin.vim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 815667ead9..107a2acc2e 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,7 +1,7 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2024 Mar 3 " Former Maintainer: Bram Moolenaar " Bail out if this isn't wanted. @@ -27,7 +27,7 @@ set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap d -if has("clipboard") +if has("clipboard_working") " CTRL-X and SHIFT-Del are Cut vnoremap "+x vnoremap "+x @@ -42,6 +42,23 @@ if has("clipboard") cmap + cmap + +else + " Use unnamed register while clipboard not exist + + " CTRL-X and SHIFT-Del are Cut + vnoremap x + vnoremap x + + " CTRL-C and CTRL-Insert are Copy + vnoremap y + vnoremap y + + " CTRL-V and SHIFT-Insert are Paste + noremap gP + noremap gP + + inoremap " + inoremap " endif " Pasting blockwise and linewise selections is not possible in Insert and @@ -50,7 +67,7 @@ endif " Uses the paste.vim autoload script. " Use CTRL-G u to have CTRL-Z only undo the paste. -if 1 +if has("clipboard_working") exe 'inoremap