From 4e3699d13a13ab07cb344f43c3fdd474ca72535e Mon Sep 17 00:00:00 2001 From: Maverun Date: Tue, 19 Jul 2022 05:03:22 -0400 Subject: fix(docs): remove internal function from docs (nvim__*) --- runtime/doc/api.txt | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index c67187d857..9758959f4e 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -536,12 +536,6 @@ created for extmark changes. ============================================================================== Global Functions *api-global* -nvim__get_hl_defs({ns_id}) *nvim__get_hl_defs()* - TODO: Documentation - -nvim__get_lib_dir() *nvim__get_lib_dir()* - TODO: Documentation - nvim__get_runtime({pat}, {all}, {*opts}) *nvim__get_runtime()* Find files in runtime directories @@ -608,15 +602,6 @@ nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()* NB: if your UI doesn't use hlstate, this will not return hlstate first time. -nvim__runtime_inspect() *nvim__runtime_inspect()* - TODO: Documentation - -nvim__screenshot({path}) *nvim__screenshot()* - TODO: Documentation - - Attributes: ~ - |api-fast| - nvim__set_hl_ns({ns_id}) *nvim__set_hl_ns()* Set active namespace for highlights. @@ -638,12 +623,6 @@ nvim__stats() *nvim__stats()* Return: ~ Map of various internal stats. -nvim__unpack({str}) *nvim__unpack()* - TODO: Documentation - - Attributes: ~ - |api-fast| - nvim_call_atomic({calls}) *nvim_call_atomic()* Calls many API methods atomically. @@ -2124,13 +2103,6 @@ affected. You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()| to check whether a buffer is loaded. - *nvim__buf_redraw_range()* -nvim__buf_redraw_range({buffer}, {first}, {last}) - TODO: Documentation - -nvim__buf_stats({buffer}) *nvim__buf_stats()* - TODO: Documentation - nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()* Activates buffer-update events on a channel, or as Lua callbacks. -- cgit From 61302fb39106424997626359df826051df3f202e Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Tue, 19 Jul 2022 10:12:10 -0500 Subject: docs: fix vim.filetype.add by avoiding quotes (#19433) * Problem Quotes are special in doxygen, and should be escaped. *Sometimes* they cause doc generation issues. Like in #17785 * Solution Replace double quotes with single quotes --- runtime/doc/lua.txt | 24 ++++++++++++------------ runtime/lua/vim/filetype.lua | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 089cf0ce9d..aeb1699908 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2029,30 +2029,30 @@ add({filetypes}) *vim.filetype.add()* vim.filetype.add({ extension = { - foo = "fooscript", + foo = 'fooscript', bar = function(path, bufnr) if some_condition() then - return "barscript", function(bufnr) + return 'barscript', function(bufnr) -- Set a buffer variable vim.b[bufnr].barscript_version = 2 end end - return "bar" + return 'bar' end, }, filename = { - [".foorc"] = "toml", - ["/etc/foo/config"] = "toml", + ['.foorc'] = 'toml', + ['/etc/foo/config'] = 'toml', }, pattern = { - [".*‍/etc/foo/.*"] = "fooscript", + ['.*/etc/foo/.*'] = 'fooscript', -- Using an optional priority - [".*‍/etc/foo/.*%.conf"] = { "dosini", { priority = 10 } }, - ["README.(%a+)$"] = function(path, bufnr, ext) - if ext == "md" then - return "markdown" - elseif ext == "rst" then - return "rst" + ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } }, + ['README.(a+)$'] = function(path, bufnr, ext) + if ext == 'md' then + return 'markdown' + elseif ext == 'rst' then + return 'rst' end end, }, diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 70c8cd15eb..c2dcc2a2c8 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2241,30 +2241,30 @@ end ---
 ---  vim.filetype.add({
 ---    extension = {
----      foo = "fooscript",
+---      foo = 'fooscript',
 ---      bar = function(path, bufnr)
 ---        if some_condition() then
----          return "barscript", function(bufnr)
+---          return 'barscript', function(bufnr)
 ---            -- Set a buffer variable
 ---            vim.b[bufnr].barscript_version = 2
 ---          end
 ---        end
----        return "bar"
+---        return 'bar'
 ---      end,
 ---    },
 ---    filename = {
----      [".foorc"] = "toml",
----      ["/etc/foo/config"] = "toml",
+---      ['.foorc'] = 'toml',
+---      ['/etc/foo/config'] = 'toml',
 ---    },
 ---    pattern = {
----      [".*/etc/foo/.*"] = "fooscript",
+---      ['.*/etc/foo/.*'] = 'fooscript',
 ---      -- Using an optional priority
----      [".*/etc/foo/.*%.conf"] = { "dosini", { priority = 10 } },
----      ["README.(%a+)$"] = function(path, bufnr, ext)
----        if ext == "md" then
----          return "markdown"
----        elseif ext == "rst" then
----          return "rst"
+---      ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
+---      ['README.(%a+)$'] = function(path, bufnr, ext)
+---        if ext == 'md' then
+---          return 'markdown'
+---        elseif ext == 'rst' then
+---          return 'rst'
 ---        end
 ---      end,
 ---    },
-- 
cgit 


From 559ef3e90393a8f02c8350a9d60f4b7849815d97 Mon Sep 17 00:00:00 2001
From: Lewis Russell 
Date: Wed, 20 Jul 2022 12:29:24 +0100
Subject: feat(lua): allow vim.cmd to be indexed (#19238)

---
 runtime/doc/lua.txt         | 21 ++++++++++++++-
 runtime/lua/vim/_editor.lua | 66 ++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 79 insertions(+), 8 deletions(-)

(limited to 'runtime')

diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index aeb1699908..0e58d1b1fe 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1291,6 +1291,9 @@ Lua module: vim                                                      *lua-vim*
 cmd({command})                                                     *vim.cmd()*
                 Execute Vim script commands.
 
+                Note that `vim.cmd` can be indexed with a command name to
+                return a callable function to the command.
+
                 Example: >
 
                    vim.cmd('echo 42')
@@ -1300,7 +1303,23 @@ cmd({command})                                                     *vim.cmd()*
                        autocmd FileType c setlocal cindent
                      augroup END
                    ]])
-                   vim.cmd({ cmd = 'echo', args = { '"foo"' } })
+
+                   -- Ex command :echo "foo"
+                   -- Note string literals need to be double quoted.
+                   vim.cmd('echo "foo"')
+                   vim.cmd { cmd = 'echo', args = { '"foo"' } }
+                   vim.cmd.echo({ args = { '"foo"' } })
+                   vim.cmd.echo('"foo"')
+
+                   -- Ex command :write! myfile.txt
+                   vim.cmd('write! myfile.txt')
+                   vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true }
+                   vim.cmd.write { args = { "myfile.txt" }, bang = true }
+                   vim.cmd.write {"myfile.txt", bang = true })
+
+                   -- Ex command :colorscheme blue
+                   vim.cmd('colorscheme blue')
+                   vim.cmd.colorscheme('blue')
 <
 
                 Parameters: ~
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 442d7b07d8..094fb2f909 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -288,6 +288,9 @@ end
 
 --- Execute Vim script commands.
 ---
+--- Note that `vim.cmd` can be indexed with a command name to return a callable function to the
+--- command.
+---
 --- Example:
 --- 
 ---   vim.cmd('echo 42')
@@ -297,7 +300,23 @@ end
 ---       autocmd FileType c setlocal cindent
 ---     augroup END
 ---   ]])
----   vim.cmd({ cmd = 'echo', args = { '"foo"' } })
+---
+---   -- Ex command :echo "foo"
+---   -- Note string literals need to be double quoted.
+---   vim.cmd('echo "foo"')
+---   vim.cmd { cmd = 'echo', args = { '"foo"' } }
+---   vim.cmd.echo({ args = { '"foo"' } })
+---   vim.cmd.echo('"foo"')
+---
+---   -- Ex command :write! myfile.txt
+---   vim.cmd('write! myfile.txt')
+---   vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true }
+---   vim.cmd.write { args = { "myfile.txt" }, bang = true }
+---   vim.cmd.write {"myfile.txt", bang = true })
+---
+---   -- Ex command :colorscheme blue
+---   vim.cmd('colorscheme blue')
+---   vim.cmd.colorscheme('blue')
 --- 
--- ---@param command string|table Command(s) to execute. @@ -307,14 +326,47 @@ end --- If a table, executes a single command. In this case, it is an alias --- to |nvim_cmd()| where `opts` is empty. ---@see |ex-cmd-index| -function vim.cmd(command) - if type(command) == 'table' then - return vim.api.nvim_cmd(command, {}) - else - return vim.api.nvim_exec(command, false) - end +function vim.cmd(command) -- luacheck: no unused + error(command) -- Stub for gen_vimdoc.py end +local VIM_CMD_ARG_MAX = 20 + +vim.cmd = setmetatable({}, { + __call = function(_, command) + if type(command) == 'table' then + return vim.api.nvim_cmd(command, {}) + else + return vim.api.nvim_exec(command, false) + end + end, + __index = function(t, command) + t[command] = function(...) + local opts + if select('#', ...) == 1 and type(select(1, ...)) == 'table' then + opts = select(1, ...) + + -- Move indexed positions in opts to opt.args + if opts[1] and not opts.args then + opts.args = {} + for i = 1, VIM_CMD_ARG_MAX do + if not opts[i] then + break + end + opts.args[i] = opts[i] + opts[i] = nil + end + end + else + opts = { args = { ... } } + end + opts.cmd = command + return vim.api.nvim_cmd(opts, {}) + end + return t[command] + end, +}) + -- These are the vim.env/v/g/o/bo/wo variable magic accessors. do local validate = vim.validate -- cgit From eb77122823f35c2296cc332aec7f4380db6dafe7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Jun 2022 07:28:16 +0800 Subject: fix(input): do no reinterpret mouse keys with ALT modifiers Remove check for MOD_MASK_META as it is for * *c_Esc* Note: If your key is hard to hit on your keyboard, train yourself to use CTRL-[. *c_META* *c_ALT* - ALT (|META|) acts like if the chord is not mapped. + ALT (|META|) may act like if the chord is not mapped. For example acts like x if does not have a command-line mode mapping. *c_CTRL-C* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index a16d88b4e9..27f1fed751 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -39,7 +39,7 @@ char action ~ abbreviation. Note: If your key is hard to hit, try CTRL-[ instead. *i_META* *i_ALT* - ALT (|META|) acts like if the chord is not mapped. + ALT (|META|) may act like if the chord is not mapped. For example acts like x if does not have an insert-mode mapping. *i_CTRL-C* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 51e823b75f..92ba7b4079 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -383,8 +383,8 @@ Note: , ..., and will not work. - Nvim supports mapping multibyte chars with modifiers such as ``. Which combinations actually work depends on the the UI or host terminal. -- When a key is pressed using a meta or alt modifier and no mapping exists - for that keypress, Nvim behaves as though was pressed before the key. +- When a key is pressed using a meta or alt modifier and no mapping exists for + that keypress, Nvim may behave as though was pressed before the key. - It is possible to notate combined modifiers (e.g. for CTRL-ALT-T), but your terminal must encode the input for that to work. |tui-input| diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index a74149d050..27c953a460 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -250,7 +250,7 @@ Input/Mappings: , , , , , , , , etc. Case-sensitive: and are two different keycodes. - ALT behaves like if not mapped. |i_ALT| |v_ALT| |c_ALT| + ALT may behave like if not mapped. |i_ALT| |v_ALT| |c_ALT| Normal commands: |gO| shows a filetype-defined "outline" of the current buffer. diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 905ae49887..5383ea4f72 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -161,9 +161,10 @@ If you want to highlight exactly the same area as the last time, you can use *v_* In Visual mode: Stop Visual mode. *v_META* *v_ALT* - ALT (|META|) acts like if the chord is not mapped. + ALT (|META|) may act like if the chord is not mapped. For example acts like x if does not have a visual-mode mapping. + *v_CTRL-C* CTRL-C In Visual mode: Stop Visual mode. When insert mode is pending (the mode message shows -- cgit From 3ded2ab55a1d894234163f82ced026e1423c9915 Mon Sep 17 00:00:00 2001 From: Dalius Dobravolskas Date: Tue, 26 Jul 2022 00:02:51 +0300 Subject: feat(lsp): allow passing custom list handler to LSP functions that return lists (#19213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently LSP allows only using loclist or quickfix list window. I normally prefer to review all quickfix items without opening quickfix window. This fix allows passing `on_list` option which allows full control what to do with list. Here is example how to use it with quick fix list: ```lua local function on_list(options) vim.fn.setqflist({}, ' ', options) vim.api.nvim_command('cfirst') end local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', 'ad', function() vim.lsp.buf.declaration{on_list=on_list} end, bufopts) vim.keymap.set('n', 'd', function() vim.lsp.buf.definition{on_list=on_list} end, bufopts) vim.keymap.set('n', 'ai', function() vim.lsp.buf.implementation{on_list=on_list} end, bufopts) vim.keymap.set('n', 'at', function() vim.lsp.buf.type_definition{on_list=on_list} end, bufopts) vim.keymap.set('n', 'af', function() vim.lsp.buf.references(nil, {on_list=on_list}) end, bufopts) ``` 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 ``` close #19182 Co-authored-by: Mathias Fußenegger --- runtime/doc/lsp.txt | 57 ++++++++++++++++++++++++++++++++++++---- runtime/lua/vim/lsp/buf.lua | 28 ++++++++++++++------ runtime/lua/vim/lsp/handlers.lua | 51 +++++++++++++++++------------------ 3 files changed, 98 insertions(+), 38 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 78100d5277..5632a1ad78 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -412,6 +412,31 @@ For the format of the response message, see: For the format of the notification message, see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage + *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.: + + 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: + + local function on_list(options) + vim.fn.setloclist(0, {}, ' ', options) + vim.api.nvim_command('lopen') + end + ================================================================================ LSP HIGHLIGHT *lsp-highlight* @@ -1114,6 +1139,8 @@ declaration({options}) *vim.lsp.buf.declaration()* {options} (table|nil) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. + • on_list: (function) handler for list results. + See |on-list-handler| definition({options}) *vim.lsp.buf.definition()* Jumps to the definition of the symbol under the cursor. @@ -1122,6 +1149,8 @@ definition({options}) *vim.lsp.buf.definition()* {options} (table|nil) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. + • on_list: (function) handler for list results. + See |on-list-handler| document_highlight() *vim.lsp.buf.document_highlight()* Send request to the server to resolve document highlights for @@ -1139,10 +1168,15 @@ document_highlight() *vim.lsp.buf.document_highlight()* to see the actual highlights. |LspReferenceText| |LspReferenceRead| |LspReferenceWrite| -document_symbol() *vim.lsp.buf.document_symbol()* +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 + • on_list: (function) handler for list results. + See |on-list-handler| + execute_command({command_params}) *vim.lsp.buf.execute_command()* Executes an LSP server command. @@ -1251,10 +1285,15 @@ hover() *vim.lsp.buf.hover()* in a floating window. Calling the function twice will jump into the floating window. -implementation() *vim.lsp.buf.implementation()* +implementation({options}) *vim.lsp.buf.implementation()* Lists all the implementations for the symbol under the cursor in the quickfix window. + Parameters: ~ + {options} (table|nil) additional options + • on_list: (function) handler for list results. + See |on-list-handler| + incoming_calls() *vim.lsp.buf.incoming_calls()* Lists all the call sites of the symbol under the cursor in the |quickfix| window. If the symbol can resolve to multiple @@ -1300,12 +1339,15 @@ range_formatting({options}, {start_pos}, {end_pos}) position. Defaults to the end of the last visual selection. -references({context}) *vim.lsp.buf.references()* +references({context}, {options}) *vim.lsp.buf.references()* Lists all the references to the symbol under the cursor in the quickfix window. Parameters: ~ {context} (table) Context for the request + {options} (table|nil) additional options + • on_list: (function) handler for list results. + See |on-list-handler| See also: ~ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references @@ -1351,8 +1393,10 @@ type_definition({options}) *vim.lsp.buf.type_definition()* {options} (table|nil) additional options • reuse_win: (boolean) Jump to existing window if buffer is already open. + • on_list: (function) handler for list results. + See |on-list-handler| -workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()* +workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()* Lists all symbols in the current workspace in the quickfix window. @@ -1362,7 +1406,10 @@ workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()* done. Parameters: ~ - {query} (string, optional) + {query} (string, optional) + {options} (table|nil) additional options + • on_list: (function) handler for list results. + See |on-list-handler| ============================================================================== diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 50a51e897c..34ca96d1ff 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -61,6 +61,7 @@ end --- ---@param options table|nil additional options --- - reuse_win: (boolean) Jump to existing window if buffer is already open. +--- - on_list: (function) handler for list results. See |on-list-handler| function M.declaration(options) local params = util.make_position_params() request_with_options('textDocument/declaration', params, options) @@ -70,6 +71,7 @@ end --- ---@param options table|nil additional options --- - reuse_win: (boolean) Jump to existing window if buffer is already open. +--- - on_list: (function) handler for list results. See |on-list-handler| function M.definition(options) local params = util.make_position_params() request_with_options('textDocument/definition', params, options) @@ -79,6 +81,7 @@ end --- ---@param options table|nil additional options --- - reuse_win: (boolean) Jump to existing window if buffer is already open. +--- - on_list: (function) handler for list results. See |on-list-handler| function M.type_definition(options) local params = util.make_position_params() request_with_options('textDocument/typeDefinition', params, options) @@ -86,9 +89,12 @@ end --- Lists all the implementations for the symbol under the cursor in the --- quickfix window. -function M.implementation() +--- +---@param options table|nil additional options +--- - on_list: (function) handler for list results. See |on-list-handler| +function M.implementation(options) local params = util.make_position_params() - request('textDocument/implementation', params) + request_with_options('textDocument/implementation', params, options) end --- Displays signature information about the symbol under the cursor in a @@ -496,20 +502,24 @@ end --- ---@param context (table) Context for the request ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references -function M.references(context) +---@param options table|nil additional options +--- - on_list: (function) handler for list results. See |on-list-handler| +function M.references(context, options) validate({ context = { context, 't', true } }) local params = util.make_position_params() params.context = context or { includeDeclaration = true, } - request('textDocument/references', params) + request_with_options('textDocument/references', params, options) end --- Lists all symbols in the current buffer in the quickfix window. --- -function M.document_symbol() +---@param options table|nil additional options +--- - on_list: (function) handler for list results. See |on-list-handler| +function M.document_symbol(options) local params = { textDocument = util.make_text_document_params() } - request('textDocument/documentSymbol', params) + request_with_options('textDocument/documentSymbol', params, options) end ---@private @@ -648,13 +658,15 @@ end --- string means no filtering is done. --- ---@param query (string, optional) -function M.workspace_symbol(query) +---@param options table|nil additional options +--- - on_list: (function) handler for list results. See |on-list-handler| +function M.workspace_symbol(query, options) query = query or npcall(vim.fn.input, 'Query: ') if query == nil then return end local params = { query = query } - request('workspace/symbol', params) + request_with_options('workspace/symbol', params, options) end --- Send request to the server to resolve document highlights for the current diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 3b869d8f5c..cfc35f0b51 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -189,19 +189,17 @@ M['textDocument/references'] = function(_, result, ctx, config) 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) + if config.loclist then - vim.fn.setloclist(0, {}, ' ', { - title = 'References', - items = util.locations_to_items(result, client.offset_encoding), - context = ctx, - }) + 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 = 'References', - items = util.locations_to_items(result, client.offset_encoding), - context = ctx, - }) + vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) api.nvim_command('botright copen') end end @@ -224,19 +222,17 @@ local function response_to_list(map_result, entity, title_fn) vim.notify('No ' .. entity .. ' found') 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_fn(ctx), - items = map_result(result, ctx.bufnr), - context = ctx, - }) + 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_fn(ctx), - items = map_result(result, ctx.bufnr), - context = ctx, - }) + vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) api.nvim_command('botright copen') end end @@ -354,11 +350,16 @@ local function location_handler(_, result, ctx, config) util.jump_to_location(result[1], client.offset_encoding, config.reuse_win) if #result > 1 then - vim.fn.setqflist({}, ' ', { - title = 'LSP locations', - items = util.locations_to_items(result, client.offset_encoding), - }) - api.nvim_command('botright copen') + local title = 'LSP locations' + local items = util.locations_to_items(result, client.offset_encoding) + + if config.on_list then + assert(type(config.on_list) == 'function', 'on_list is not a function') + config.on_list({ title = title, items = items }) + else + vim.fn.setqflist({}, ' ', { title = title, items = items }) + api.nvim_command('botright copen') + end end else util.jump_to_location(result, client.offset_encoding, config.reuse_win) -- cgit From 4cbeedf57bf48a00890349f5b4624737f4f3fce6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 26 Jul 2022 11:26:23 +0200 Subject: vim-patch:b529cfbd04c0 (#19501) Update runtime files https://github.com/vim/vim/commit/b529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d --- runtime/autoload/bitbake.vim | 95 +++++++++ runtime/autoload/python.vim | 228 +++++++++++++++++++++ runtime/doc/builtin.txt | 12 +- runtime/doc/ft_sql.txt | 8 +- runtime/doc/insert.txt | 18 +- runtime/doc/map.txt | 21 +- runtime/doc/options.txt | 2 +- runtime/doc/pi_netrw.txt | 2 +- runtime/doc/undo.txt | 10 +- runtime/ftplugin/bitbake.vim | 16 ++ runtime/ftplugin/expect.vim | 24 +++ runtime/ftplugin/html.vim | 60 +++--- runtime/indent/bitbake.vim | 22 ++ runtime/indent/expect.vim | 11 + runtime/indent/python.vim | 203 +----------------- runtime/indent/testdir/bitbake.in | 19 ++ runtime/indent/testdir/bitbake.ok | 19 ++ .../pack/dist/opt/shellmenu/plugin/shellmenu.vim | 178 ++++++++-------- runtime/synmenu.vim | 4 + runtime/syntax/bitbake.vim | 126 ++++++++++++ runtime/syntax/html.vim | 219 +++++++++++--------- runtime/syntax/make.vim | 12 +- 22 files changed, 856 insertions(+), 453 deletions(-) create mode 100644 runtime/autoload/bitbake.vim create mode 100644 runtime/autoload/python.vim create mode 100644 runtime/ftplugin/bitbake.vim create mode 100644 runtime/ftplugin/expect.vim create mode 100644 runtime/indent/bitbake.vim create mode 100644 runtime/indent/expect.vim create mode 100644 runtime/indent/testdir/bitbake.in create mode 100644 runtime/indent/testdir/bitbake.ok create mode 100644 runtime/syntax/bitbake.vim (limited to 'runtime') diff --git a/runtime/autoload/bitbake.vim b/runtime/autoload/bitbake.vim new file mode 100644 index 0000000000..bb3fc5c0e2 --- /dev/null +++ b/runtime/autoload/bitbake.vim @@ -0,0 +1,95 @@ +" Support for bitbake indenting, see runtime/indent/bitbake.vim + +function s:is_bb_python_func_def(lnum) + let stack = synstack(a:lnum, 1) + if len(stack) == 0 + return 0 + endif + + return synIDattr(stack[0], "name") == "bbPyFuncDef" +endfunction + +function bitbake#Indent(lnum) + if !has('syntax_items') + return -1 + endif + + let stack = synstack(a:lnum, 1) + if len(stack) == 0 + return -1 + endif + + let name = synIDattr(stack[0], "name") + + " TODO: support different styles of indentation for assignments. For now, + " we only support like this: + " VAR = " \ + " value1 \ + " value2 \ + " " + " + " i.e. each value indented by shiftwidth(), with the final quote " completely unindented. + if name == "bbVarValue" + " Quote handling is tricky. kernel.bbclass has this line for instance: + " EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" " HOSTCPP="${BUILD_CPP}"" + " Instead of trying to handle crazy cases like that, just assume that a + " double-quote on a line by itself (following an assignment) means the + " user is closing the assignment, and de-dent. + if getline(a:lnum) =~ '^\s*"$' + return 0 + endif + + let prevstack = synstack(a:lnum - 1, 1) + if len(prevstack) == 0 + return -1 + endif + + let prevname = synIDattr(prevstack[0], "name") + + " Only indent if there was actually a continuation character on + " the previous line, to avoid misleading indentation. + let prevlinelastchar = synIDattr(synID(a:lnum - 1, col([a:lnum - 1, "$"]) - 1, 1), "name") + let prev_continued = prevlinelastchar == "bbContinue" + + " Did the previous line introduce an assignment? + if index(["bbVarDef", "bbVarFlagDef"], prevname) != -1 + if prev_continued + return shiftwidth() + endif + endif + + if !prev_continued + return 0 + endif + + " Autoindent can take it from here + return -1 + endif + + if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1 + let ret = python#GetIndent(a:lnum, function('s:is_bb_python_func_def')) + " Should normally always be indented by at least one shiftwidth; but allow + " return of -1 (defer to autoindent) or -2 (force indent to 0) + if ret == 0 + return shiftwidth() + elseif ret == -2 + return 0 + endif + return ret + endif + + " TODO: GetShIndent doesn't detect tasks prepended with 'fakeroot' + " Need to submit a patch upstream to Vim to provide an extension point. + " Unlike the Python indenter, the Sh indenter is way too large to copy and + " modify here. + if name == "bbShFuncRegion" + return GetShIndent() + endif + + " TODO: + " + heuristics for de-denting out of a bbPyDefRegion? e.g. when the user + " types an obvious BB keyword like addhandler or addtask, or starts + " writing a shell task. Maybe too hard to implement... + + return -1 +endfunction diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim new file mode 100644 index 0000000000..7e7bca6fb6 --- /dev/null +++ b/runtime/autoload/python.vim @@ -0,0 +1,228 @@ +" Support for Python indenting, see runtime/indent/python.vim + +let s:keepcpo= &cpo +set cpo&vim + +" See if the specified line is already user-dedented from the expected value. +function s:Dedented(lnum, expected) + return indent(a:lnum) <= a:expected - shiftwidth() +endfunction + +let s:maxoff = 50 " maximum number of lines to look backwards for () + +" Some other filetypes which embed Python have slightly different indent +" rules (e.g. bitbake). Those filetypes can pass an extra funcref to this +" function which is evaluated below. +function python#GetIndent(lnum, ...) + let ExtraFunc = a:0 > 0 ? a:1 : 0 + + " If this line is explicitly joined: If the previous line was also joined, + " line it up with that one, otherwise add two 'shiftwidth' + if getline(a:lnum - 1) =~ '\\$' + if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' + return indent(a:lnum - 1) + endif + return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2)) + endif + + " If the start of the line is in a string don't change the indent. + if has('syntax_items') + \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$" + return -1 + endif + + " Search backwards for the previous non-empty line. + let plnum = prevnonblank(v:lnum - 1) + + if plnum == 0 + " This is the first non-empty line, use zero indent. + return 0 + endif + + call cursor(plnum, 1) + + " Identing inside parentheses can be very slow, regardless of the searchpair() + " timeout, so let the user disable this feature if he doesn't need it + let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) + + if disable_parentheses_indenting == 1 + let plindent = indent(plnum) + let plnumstart = plnum + else + " searchpair() can be slow sometimes, limit the time to 150 msec or what is + " put in g:pyindent_searchpair_timeout + let searchpair_stopline = 0 + let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) + + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if parlnum > 0 + if a:0 > 0 && ExtraFunc(parlnum) + " We may have found the opening brace of a bitbake Python task, e.g. 'python do_task {' + " If so, ignore it here - it will be handled later. + let parlnum = 0 + let plindent = indent(plnum) + let plnumstart = plnum + else + let plindent = indent(parlnum) + let plnumstart = parlnum + endif + else + let plindent = indent(plnum) + let plnumstart = plnum + endif + + " When inside parenthesis: If at the first line below the parenthesis add + " two 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if p > 0 + if a:0 > 0 && ExtraFunc(p) + " Currently only used by bitbake + " Handle first non-empty line inside a bitbake Python task + if p == plnum + return shiftwidth() + endif + + " Handle the user actually trying to close a bitbake Python task + let line = getline(a:lnum) + if line =~ '^\s*}' + return -2 + endif + + " Otherwise ignore the brace + let p = 0 + else + if p == plnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if pp > 0 + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + endif + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) + endif + if plnumstart == p + return indent(plnum) + endif + return plindent + endif + endif + endif + + + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + let pline = getline(plnum) + let pline_len = strlen(pline) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let min = 1 + let max = pline_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let max = col + else + let min = col + 1 + endif + endwhile + let pline = strpart(pline, 0, min - 1) + endif + else + let col = 0 + while col < pline_len + if pline[col] == '#' + let pline = strpart(pline, 0, col) + break + endif + let col = col + 1 + endwhile + endif + + " If the previous line ended with a colon, indent this line + if pline =~ ':\s*$' + return plindent + shiftwidth() + endif + + " If the previous line was a stop-execution statement... + if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' + " See if the user has already dedented + if s:Dedented(a:lnum, indent(plnum)) + " If so, trust the user + return -1 + endif + " If not, recommend one dedent + return indent(plnum) - shiftwidth() + endif + + " If the current line begins with a keyword that lines up with "try" + if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' + let lnum = a:lnum - 1 + while lnum >= 1 + if getline(lnum) =~ '^\s*\(try\|except\)\>' + let ind = indent(lnum) + if ind >= indent(a:lnum) + return -1 " indent is already less than this + endif + return ind " line up with previous try or except + endif + let lnum = lnum - 1 + endwhile + return -1 " no matching "try"! + endif + + " If the current line begins with a header keyword, dedent + if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' + + " Unless the previous line was a one-liner + if getline(plnumstart) =~ '^\s*\(for\|if\|elif\|try\)\>' + return plindent + endif + + " Or the user has already dedented + if s:Dedented(a:lnum, plindent) + return -1 + endif + + return plindent - shiftwidth() + endif + + " When after a () construct we probably want to go back to the start line. + " a = (b + " + c) + " here + if parlnum > 0 + " ...unless the user has already dedented + if s:Dedented(a:lnum, plindent) + return -1 + else + return plindent + endif + endif + + return -1 +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index df5a636070..668c738e0a 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1885,7 +1885,9 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is To check for a supported command always check the return value to be 2. :2match The |:2match| command. - :3match The |:3match| command. + :3match The |:3match| command (but you + probably should not use it, it is + reserved for internal usage) #event autocommand defined for this event #event#pattern autocommand defined for this event and pattern (the pattern is taken @@ -4905,8 +4907,10 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) message will appear and the match will not be added. An ID is specified as a positive integer (zero excluded). IDs 1, 2 and 3 are reserved for |:match|, |:2match| and |:3match|, - respectively. If the {id} argument is not specified or -1, - |matchadd()| automatically chooses a free ID. + respectively. 3 is reserved for use by the + |matchparen| plugin. + If the {id} argument is not specified or -1, |matchadd()| + automatically chooses a free ID. The optional {dict} argument allows for further custom values. Currently this is used to specify a match specific @@ -6397,7 +6401,7 @@ searchcount([{options}]) *searchcount()* " to 1) let result = searchcount() < - The function is useful to add the count to |statusline|: > + The function is useful to add the count to 'statusline': > function! LastSearchCount() abort let result = searchcount(#{recompute: 0}) if empty(result) diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt index 6972fe0768..335faf266e 100644 --- a/runtime/doc/ft_sql.txt +++ b/runtime/doc/ft_sql.txt @@ -502,7 +502,7 @@ documentation. Assuming you have followed the dbext-tutorial you can press t to display a list of tables. There is a delay while dbext is creating the table list. After the list is displayed press . This will remove both the -popup window and the table name already chosen when the list became active. > +popup window and the table name already chosen when the list became active. 4.3.1 Table Completion: *sql-completion-tables* @@ -510,7 +510,7 @@ Press t to display a list of tables from within the database you have connected via the dbext plugin. NOTE: All of the SQL completion popups support typing a prefix before pressing the key map. This will limit the contents of the popup window to just items -beginning with those characters. > +beginning with those characters. 4.3.2 Column Completion: *sql-completion-columns* @@ -583,13 +583,13 @@ popup a list of columns for the customer table. It does this by looking back to the beginning of the select statement and finding a list of the tables specified in the FROM clause. In this case it notes that in the string "customer c", "c" is an alias for the customer table. The optional "AS" -keyword is also supported, "customer AS c". > +keyword is also supported, "customer AS c". 4.3.3 Procedure Completion: *sql-completion-procedures* Similar to the table list, p, will display a list of stored -procedures stored within the database. > +procedures stored within the database. 4.3.4 View Completion: *sql-completion-views* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 27f1fed751..6b0899334b 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -374,10 +374,10 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J* move window one page right *i_* CTRL-O execute one command, return to Insert mode *i_CTRL-O* CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* -CTRL-G u break undo sequence, start new change *i_CTRL-G_u* -CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U* - movement, if the cursor stays within the - same the line +CTRL-G u close undo sequence, start new change *i_CTRL-G_u* +CTRL-G U don't start a new undo block with the next *i_CTRL-G_U* + left/right cursor movement, if the cursor + stays within the same line ----------------------------------------------------------------------- The CTRL-O command sometimes has a side effect: If the cursor was beyond the @@ -411,8 +411,8 @@ that, with CTRL-O u. Another example: > :inoremap u -This breaks undo at each line break. It also expands abbreviations before -this. +This starts a new undo block at each line break. It also expands +abbreviations before this. An example for using CTRL-G U: > @@ -426,9 +426,9 @@ An example for using CTRL-G U: > inoremap repeat('U', col('$') - col('.')) inoremap ( ()U -This makes it possible to use the cursor keys in Insert mode, without breaking -the undo sequence and therefore using |.| (redo) will work as expected. -Also entering a text like (with the "(" mapping from above): +This makes it possible to use the cursor keys in Insert mode, without starting +a new undo block and therefore using |.| (redo) will work as expected. Also +entering a text like (with the "(" mapping from above): Lorem ipsum (dolor diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 7e94167e07..1e1f4e46af 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -610,19 +610,20 @@ two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then or otherwise it would be impossible to type the á character. ** *mapleader* -To define a mapping which uses the "mapleader" variable, the special string -"" can be used. It is replaced with the string value of "mapleader". -If "mapleader" is not set or empty, a backslash is used instead. Example: > - :map A oanother line +To define a mapping which uses the "g:mapleader" variable, the special string +"" can be used. It is replaced with the string value of +"g:mapleader". If "g:mapleader" is not set or empty, a backslash is used +instead. Example: > + map A oanother line Works like: > - :map \A oanother line -But after: > - :let mapleader = "," + map \A oanother line +But after: + let mapleader = "," It works like: > - :map ,A oanother line + map ,A oanother line -Note that the value of "mapleader" is used at the moment the mapping is -defined. Changing "mapleader" after that has no effect for already defined +Note that the value of "g:mapleader" is used at the moment the mapping is +defined. Changing "g:mapleader" after that has no effect for already defined mappings. ** *maplocalleader* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0f1c2051a6..68723e4889 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3571,7 +3571,7 @@ A jump table for the options with a short description can be found at |Q_op|. help. (Note that previously setting the global option to the empty value did this, which is now deprecated.) When the first character is ":", the command is invoked as a Vim - command prefixed with [count]. + Ex command with [count] added as an argument if it is not zero. 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. diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 6f7b53722c..1eaa76264f 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -3917,7 +3917,7 @@ netrw: * Installed |g:netrw_clipboard| setting * Installed option bypass for |'guioptions'| a/A settings - * Changed popup_beval() to |popup_atcursor|() + * Changed popup_beval() to |popup_atcursor()| in netrw#ErrorMsg (lacygoill). Apparently popup_beval doesn't reliably close the popup when the mouse is moved. diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 67f24103cd..98ab60c7e7 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -108,13 +108,13 @@ change again. But you can do something like this: > After this a "u" command will undo the delete command and the previous change. - *undo-break* -To do the opposite, break a change into two undo blocks, in Insert mode use -CTRL-G u. This is useful if you want an insert command to be undoable in + *undo-break* *undo-close-block* +To do the opposite, use a new undo block for the next change, in Insert mode +use CTRL-G u. This is useful if you want an insert command to be undoable in parts. E.g., for each sentence. |i_CTRL-G_u| -Setting the value of 'undolevels' also breaks undo. Even when the new value -is equal to the old value: > +Setting the value of 'undolevels' also closes the undo block. Even when the +new value is equal to the old value: > let &undolevels = &undolevels ============================================================================== diff --git a/runtime/ftplugin/bitbake.vim b/runtime/ftplugin/bitbake.vim new file mode 100644 index 0000000000..99fe334627 --- /dev/null +++ b/runtime/ftplugin/bitbake.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: Bitbake +" Maintainer: Gregory Anders +" Repository: https://github.com/openembedded/bitbake +" Latest Revision: 2022-07-23 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s +setlocal comments=:# +setlocal suffixesadd=.bb,.bbclass + +let b:undo_ftplugin = "setl cms< com< sua<" diff --git a/runtime/ftplugin/expect.vim b/runtime/ftplugin/expect.vim new file mode 100644 index 0000000000..a4c6af96ce --- /dev/null +++ b/runtime/ftplugin/expect.vim @@ -0,0 +1,24 @@ +" Vim filetype plugin file +" Language: Expect +" Maintainer: Doug Kearns +" Last Change: 2022 Jul 16 + +if exists("b:did_ftplugin") + finish +endif + +" Syntax is similar to Tcl +runtime! ftplugin/tcl.vim + +let s:cpo_save = &cpo +set cpo&vim + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Expect Command Files (*.exp)\t*.exp\n" .. + \ "All Files (*.*)\t*.*\n" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim index 3179aa2e88..94cb62653f 100644 --- a/runtime/ftplugin/html.vim +++ b/runtime/ftplugin/html.vim @@ -1,16 +1,14 @@ " Vim filetype plugin file -" Language: html -" -" This runtime file is looking for a new maintainer. -" -" Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 - -if exists("b:did_ftplugin") | finish | endif +" Language: HTML +" Maintainer: Doug Kearns +" Previous Maintainer: Dan Sharp +" Last Changed: 2022 Jul 20 + +if exists("b:did_ftplugin") + finish +endif let b:did_ftplugin = 1 -" Make sure the continuation lines below do not cause problems in -" compatibility mode. let s:save_cpo = &cpo set cpo-=C @@ -18,36 +16,40 @@ setlocal matchpairs+=<:> setlocal commentstring= setlocal comments=s: -if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1) - setlocal formatoptions-=t formatoptions+=croql +let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<" + +if get(g:, "ft_html_autocomment", 0) + setlocal formatoptions-=t formatoptions+=croql + let b:undo_ftplugin ..= " | setlocal formatoptions<" endif if exists('&omnifunc') setlocal omnifunc=htmlcomplete#CompleteTags call htmlcomplete#DetectOmniFlavor() + let b:undo_ftplugin ..= " | setlocal omnifunc<" endif -" HTML: thanks to Johannes Zellner and Benji Fisher. -if exists("loaded_matchit") - let b:match_ignorecase = 1 - let b:match_words = '<:>,' . - \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . - \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . - \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +" HTML: thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 1 + let b:match_words = ',' .. + \ '<:>,' .. + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .. + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .. + \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' + let b:html_set_match_words = 1 + let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words" endif " Change the :browse e filter to primarily show HTML-related files. -if has("gui_win32") - let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" . - \ "JavaScript Files (*.js)\t*.js\n" . - \ "Cascading StyleSheets (*.css)\t*.css\n" . - \ "All Files (*.*)\t*.*\n" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "HTML Files (*.html *.htm)\t*.htm;*.html\n" .. + \ "JavaScript Files (*.js)\t*.js\n" .. + \ "Cascading StyleSheets (*.css)\t*.css\n" .. + \ "All Files (*.*)\t*.*\n" + let b:html_set_browsefilter = 1 + let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter" endif -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" . - \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter" - -" Restore the saved compatibility options. let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/indent/bitbake.vim b/runtime/indent/bitbake.vim new file mode 100644 index 0000000000..f45ba74816 --- /dev/null +++ b/runtime/indent/bitbake.vim @@ -0,0 +1,22 @@ +" Vim indent file +" Language: BitBake +" Copyright: Copyright (C) 2019 Agilent Technologies, Inc. +" Maintainer: Chris Laplante +" License: You may redistribute this under the same terms as Vim itself + +if exists("b:did_indent") + finish +endif + +runtime! indent/sh.vim + +setlocal indentexpr=bitbake#Indent(v:lnum) +setlocal autoindent +setlocal nolisp +setlocal shiftwidth=4 +setlocal expandtab +setlocal indentkeys+=<:>,=elif,=except,0=\" + +let b:undo_indent .= ' inde< ai< lisp< sw< et< indk<' + +let b:did_indent = 1 diff --git a/runtime/indent/expect.vim b/runtime/indent/expect.vim new file mode 100644 index 0000000000..f2a1f05917 --- /dev/null +++ b/runtime/indent/expect.vim @@ -0,0 +1,11 @@ +" Vim indent file +" Language: Expect +" Maintainer: Doug Kearns +" Last Change: 2022 Jul 16 + +if exists("b:did_indent") + finish +endif + +" Syntax is similar to Tcl +runtime! indent/tcl.vim diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 668122993e..8c3d0b0670 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -14,7 +14,7 @@ let b:did_indent = 1 setlocal nolisp " Make sure lisp indenting doesn't supersede us setlocal autoindent " indentexpr isn't much help otherwise -setlocal indentexpr=GetPythonIndent(v:lnum) +setlocal indentexpr=python#GetIndent(v:lnum) setlocal indentkeys+=<:>,=elif,=except let b:undo_indent = "setl ai< inde< indk< lisp<" @@ -23,206 +23,11 @@ let b:undo_indent = "setl ai< inde< indk< lisp<" if exists("*GetPythonIndent") finish endif -let s:keepcpo= &cpo -set cpo&vim - -" Come here when loading the script the first time. - -let s:maxoff = 50 " maximum number of lines to look backwards for () - -" See if the specified line is already user-dedented from the expected value. -function s:Dedented(lnum, expected) - return indent(a:lnum) <= a:expected - shiftwidth() -endfunction +" Keep this for backward compatibility, new scripts should use +" python#GetIndent() function GetPythonIndent(lnum) - - " If this line is explicitly joined: If the previous line was also joined, - " line it up with that one, otherwise add two 'shiftwidth' - if getline(a:lnum - 1) =~ '\\$' - if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' - return indent(a:lnum - 1) - endif - return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2)) - endif - - " If the start of the line is in a string don't change the indent. - if has('syntax_items') - \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$" - return -1 - endif - - " Search backwards for the previous non-empty line. - let plnum = prevnonblank(v:lnum - 1) - - if plnum == 0 - " This is the first non-empty line, use zero indent. - return 0 - endif - - call cursor(plnum, 1) - - " Identing inside parentheses can be very slow, regardless of the searchpair() - " timeout, so let the user disable this feature if he doesn't need it - let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) - - if disable_parentheses_indenting == 1 - let plindent = indent(plnum) - let plnumstart = plnum - else - " searchpair() can be slow sometimes, limit the time to 150 msec or what is - " put in g:pyindent_searchpair_timeout - let searchpair_stopline = 0 - let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) - - " If the previous line is inside parenthesis, use the indent of the starting - " line. - " Trick: use the non-existing "dummy" variable to break out of the loop when - " going too far back. - let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', - \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if parlnum > 0 - let plindent = indent(parlnum) - let plnumstart = parlnum - else - let plindent = indent(plnum) - let plnumstart = plnum - endif - - " When inside parenthesis: If at the first line below the parenthesis add - " two 'shiftwidth', otherwise same as previous line. - " i = (a - " + b - " + c) - call cursor(a:lnum, 1) - let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if p > 0 - if p == plnum - " When the start is inside parenthesis, only indent one 'shiftwidth'. - let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if pp > 0 - return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) - endif - return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) - endif - if plnumstart == p - return indent(plnum) - endif - return plindent - endif - - endif - - - " Get the line and remove a trailing comment. - " Use syntax highlighting attributes when possible. - let pline = getline(plnum) - let pline_len = strlen(pline) - if has('syntax_items') - " If the last character in the line is a comment, do a binary search for - " the start of the comment. synID() is slow, a linear search would take - " too long on a long line. - if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" - let min = 1 - let max = pline_len - while min < max - let col = (min + max) / 2 - if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" - let max = col - else - let min = col + 1 - endif - endwhile - let pline = strpart(pline, 0, min - 1) - endif - else - let col = 0 - while col < pline_len - if pline[col] == '#' - let pline = strpart(pline, 0, col) - break - endif - let col = col + 1 - endwhile - endif - - " If the previous line ended with a colon, indent this line - if pline =~ ':\s*$' - return plindent + shiftwidth() - endif - - " If the previous line was a stop-execution statement... - if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' - " See if the user has already dedented - if s:Dedented(a:lnum, indent(plnum)) - " If so, trust the user - return -1 - endif - " If not, recommend one dedent - return indent(plnum) - shiftwidth() - endif - - " If the current line begins with a keyword that lines up with "try" - if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' - let lnum = a:lnum - 1 - while lnum >= 1 - if getline(lnum) =~ '^\s*\(try\|except\)\>' - let ind = indent(lnum) - if ind >= indent(a:lnum) - return -1 " indent is already less than this - endif - return ind " line up with previous try or except - endif - let lnum = lnum - 1 - endwhile - return -1 " no matching "try"! - endif - - " If the current line begins with a header keyword, dedent - if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' - - " Unless the previous line was a one-liner - if getline(plnumstart) =~ '^\s*\(for\|if\|elif\|try\)\>' - return plindent - endif - - " Or the user has already dedented - if s:Dedented(a:lnum, plindent) - return -1 - endif - - return plindent - shiftwidth() - endif - - " When after a () construct we probably want to go back to the start line. - " a = (b - " + c) - " here - if parlnum > 0 - " ...unless the user has already dedented - if s:Dedented(a:lnum, plindent) - return -1 - else - return plindent - endif - endif - - return -1 - + return python#GetIndent(a:lnum) endfunction -let &cpo = s:keepcpo -unlet s:keepcpo - " vim:sw=2 diff --git a/runtime/indent/testdir/bitbake.in b/runtime/indent/testdir/bitbake.in new file mode 100644 index 0000000000..afd19be182 --- /dev/null +++ b/runtime/indent/testdir/bitbake.in @@ -0,0 +1,19 @@ +# vim: set filetype=bitbake : + +# START_INDENT +FOO = " \ + bar \ + baz \ + qux \ + " + +do_configure() { +oe_conf +} + +python do_task() { +def foo(x): +if y: +print(x) +} +# END_INDENT diff --git a/runtime/indent/testdir/bitbake.ok b/runtime/indent/testdir/bitbake.ok new file mode 100644 index 0000000000..1bc5a18c6f --- /dev/null +++ b/runtime/indent/testdir/bitbake.ok @@ -0,0 +1,19 @@ +# vim: set filetype=bitbake : + +# START_INDENT +FOO = " \ + bar \ + baz \ + qux \ +" + +do_configure() { + oe_conf +} + +python do_task() { + def foo(x): + if y: + print(x) +} +# END_INDENT diff --git a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim index 6175d1d9a6..04b48b9ce8 100644 --- a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim +++ b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim @@ -7,88 +7,98 @@ " Attached is a Vim script file for turning gvim into a shell script editor. " It may also be used as an example how to use menus in Vim. " -" Written by: Lennart Schultz +" Maintainer: Ada (Haowen) Yu +" Original author: Lennart Schultz (mail unreachable) -imenu Stmts.for for in do doneki kk0elli -imenu Stmts.case case in ) ;; esacbki k0elli -imenu Stmts.if if then fiki kk0elli -imenu Stmts.if-else if then else fiki kki kk0elli -imenu Stmts.elif elif then ki kk0elli -imenu Stmts.while while do doneki kk0elli -imenu Stmts.break break -imenu Stmts.continue continue -imenu Stmts.function () { }ki k0i -imenu Stmts.return return -imenu Stmts.return-true return 0 -imenu Stmts.return-false return 1 -imenu Stmts.exit exit -imenu Stmts.shift shift -imenu Stmts.trap trap -imenu Test.existence [ -e ]hi -imenu Test.existence - file [ -f ]hi -imenu Test.existence - file (not empty) [ -s ]hi -imenu Test.existence - directory [ -d ]hi -imenu Test.existence - executable [ -x ]hi -imenu Test.existence - readable [ -r ]hi -imenu Test.existence - writable [ -w ]hi -imenu Test.String is empty [ x = "x$" ]hhi -imenu Test.String is not empty [ x != "x$" ]hhi -imenu Test.Strings is equal [ "" = "" ]hhhhhhhi -imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi -imenu Test.Values is greater than [ -gt ]hhhhhhi -imenu Test.Values is greater equal [ -ge ]hhhhhhi -imenu Test.Values is equal [ -eq ]hhhhhhi -imenu Test.Values is not equal [ -ne ]hhhhhhi -imenu Test.Values is less than [ -lt ]hhhhhhi -imenu Test.Values is less equal [ -le ]hhhhhhi -imenu ParmSub.Substitute word if parm not set ${:-}hhi -imenu ParmSub.Set parm to word if not set ${:=}hhi -imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi -imenu ParmSub.If parm not set print word and exit ${:?}hhi -imenu SpShVars.Number of positional parameters ${#} -imenu SpShVars.All positional parameters (quoted spaces) ${*} -imenu SpShVars.All positional parameters (unquoted spaces) ${@} -imenu SpShVars.Flags set ${-} -imenu SpShVars.Return code of last command ${?} -imenu SpShVars.Process number of this shell ${$} -imenu SpShVars.Process number of last background command ${!} -imenu Environ.HOME ${HOME} -imenu Environ.PATH ${PATH} -imenu Environ.CDPATH ${CDPATH} -imenu Environ.MAIL ${MAIL} -imenu Environ.MAILCHECK ${MAILCHECK} -imenu Environ.PS1 ${PS1} -imenu Environ.PS2 ${PS2} -imenu Environ.IFS ${IFS} -imenu Environ.SHACCT ${SHACCT} -imenu Environ.SHELL ${SHELL} -imenu Environ.LC_CTYPE ${LC_CTYPE} -imenu Environ.LC_MESSAGES ${LC_MESSAGES} -imenu Builtins.cd cd -imenu Builtins.echo echo -imenu Builtins.eval eval -imenu Builtins.exec exec -imenu Builtins.export export -imenu Builtins.getopts getopts -imenu Builtins.hash hash -imenu Builtins.newgrp newgrp -imenu Builtins.pwd pwd -imenu Builtins.read read -imenu Builtins.readonly readonly -imenu Builtins.return return -imenu Builtins.times times -imenu Builtins.type type -imenu Builtins.umask umask -imenu Builtins.wait wait -imenu Set.set set -imenu Set.unset unset -imenu Set.mark modified or modified variables set -a -imenu Set.exit when command returns non-zero exit code set -e -imenu Set.Disable file name generation set -f -imenu Set.remember function commands set -h -imenu Set.All keyword arguments are placed in the environment set -k -imenu Set.Read commands but do not execute them set -n -imenu Set.Exit after reading and executing one command set -t -imenu Set.Treat unset variables as an error when substituting set -u -imenu Set.Print shell input lines as they are read set -v -imenu Set.Print commands and their arguments as they are executed set -x +" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise +" would not be recognized. See ":help 'cpoptions'". +let s:cpo_save = &cpo +set cpo&vim + +imenu ShellMenu.Statements.for for in dodoneki kk0elli +imenu ShellMenu.Statements.case case in) ;;esacbki k0elli +imenu ShellMenu.Statements.if if thenfiki kk0elli +imenu ShellMenu.Statements.if-else if thenelsefiki kki kk0elli +imenu ShellMenu.Statements.elif elif thenki kk0elli +imenu ShellMenu.Statements.while while dodoneki kk0elli +imenu ShellMenu.Statements.break break +imenu ShellMenu.Statements.continue continue +imenu ShellMenu.Statements.function () {}ki k0i +imenu ShellMenu.Statements.return return +imenu ShellMenu.Statements.return-true return 0 +imenu ShellMenu.Statements.return-false return 1 +imenu ShellMenu.Statements.exit exit +imenu ShellMenu.Statements.shift shift +imenu ShellMenu.Statements.trap trap +imenu ShellMenu.Test.Existence [ -e ]hi +imenu ShellMenu.Test.Existence\ -\ file [ -f ]hi +imenu ShellMenu.Test.Existence\ -\ file\ (not\ empty) [ -s ]hi +imenu ShellMenu.Test.Existence\ -\ directory [ -d ]hi +imenu ShellMenu.Test.Existence\ -\ executable [ -x ]hi +imenu ShellMenu.Test.Existence\ -\ readable [ -r ]hi +imenu ShellMenu.Test.Existence\ -\ writable [ -w ]hi +imenu ShellMenu.Test.String\ is\ empty [ x = "x$" ]hhi +imenu ShellMenu.Test.String\ is\ not\ empty [ x != "x$" ]hhi +imenu ShellMenu.Test.Strings\ are\ equal [ "" = "" ]hhhhhhhi +imenu ShellMenu.Test.Strings\ are\ not\ equal [ "" != "" ]hhhhhhhhi +imenu ShellMenu.Test.Value\ is\ greater\ than [ -gt ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ greater\ equal [ -ge ]hhhhhhi +imenu ShellMenu.Test.Values\ are\ equal [ -eq ]hhhhhhi +imenu ShellMenu.Test.Values\ are\ not\ equal [ -ne ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ less\ than [ -lt ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ less\ equal [ -le ]hhhhhhi +imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ not\ set ${:-}hhi +imenu ShellMenu.ParmSub.Set\ parm\ to\ word\ if\ not\ set ${:=}hhi +imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ set\ else\ nothing ${:+}hhi +imenu ShellMenu.ParmSub.If\ parm\ not\ set\ print\ word\ and\ exit ${:?}hhi +imenu ShellMenu.SpShVars.Number\ of\ positional\ parameters ${#} +imenu ShellMenu.SpShVars.All\ positional\ parameters\ (quoted\ spaces) ${*} +imenu ShellMenu.SpShVars.All\ positional\ parameters\ (unquoted\ spaces) ${@} +imenu ShellMenu.SpShVars.Flags\ set ${-} +imenu ShellMenu.SpShVars.Return\ code\ of\ last\ command ${?} +imenu ShellMenu.SpShVars.Process\ number\ of\ this\ shell ${$} +imenu ShellMenu.SpShVars.Process\ number\ of\ last\ background\ command ${!} +imenu ShellMenu.Environ.HOME ${HOME} +imenu ShellMenu.Environ.PATH ${PATH} +imenu ShellMenu.Environ.CDPATH ${CDPATH} +imenu ShellMenu.Environ.MAIL ${MAIL} +imenu ShellMenu.Environ.MAILCHECK ${MAILCHECK} +imenu ShellMenu.Environ.PS1 ${PS1} +imenu ShellMenu.Environ.PS2 ${PS2} +imenu ShellMenu.Environ.IFS ${IFS} +imenu ShellMenu.Environ.SHACCT ${SHACCT} +imenu ShellMenu.Environ.SHELL ${SHELL} +imenu ShellMenu.Environ.LC_CTYPE ${LC_CTYPE} +imenu ShellMenu.Environ.LC_MESSAGES ${LC_MESSAGES} +imenu ShellMenu.Builtins.cd cd +imenu ShellMenu.Builtins.echo echo +imenu ShellMenu.Builtins.eval eval +imenu ShellMenu.Builtins.exec exec +imenu ShellMenu.Builtins.export export +imenu ShellMenu.Builtins.getopts getopts +imenu ShellMenu.Builtins.hash hash +imenu ShellMenu.Builtins.newgrp newgrp +imenu ShellMenu.Builtins.pwd pwd +imenu ShellMenu.Builtins.read read +imenu ShellMenu.Builtins.readonly readonly +imenu ShellMenu.Builtins.return return +imenu ShellMenu.Builtins.times times +imenu ShellMenu.Builtins.type type +imenu ShellMenu.Builtins.umask umask +imenu ShellMenu.Builtins.wait wait +imenu ShellMenu.Set.set set +imenu ShellMenu.Set.unset unset +imenu ShellMenu.Set.Mark\ created\ or\ modified\ variables\ for\ export set -a +imenu ShellMenu.Set.Exit\ when\ command\ returns\ non-zero\ status set -e +imenu ShellMenu.Set.Disable\ file\ name\ expansion set -f +imenu ShellMenu.Set.Locate\ and\ remember\ commands\ when\ being\ looked\ up set -h +imenu ShellMenu.Set.All\ assignment\ statements\ are\ placed\ in\ the\ environment\ for\ a\ command set -k +imenu ShellMenu.Set.Read\ commands\ but\ do\ not\ execute\ them set -n +imenu ShellMenu.Set.Exit\ after\ reading\ and\ executing\ one\ command set -t +imenu ShellMenu.Set.Treat\ unset\ variables\ as\ an\ error\ when\ substituting set -u +imenu ShellMenu.Set.Print\ shell\ input\ lines\ as\ they\ are\ read set -v +imenu ShellMenu.Set.Print\ commands\ and\ their\ arguments\ as\ they\ are\ executed set -x + +" Restore the previous value of 'cpoptions'. +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index d1e4becb2b..ba9e6a198d 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -18,6 +18,10 @@ fun! SetSyn(name) else let name = a:name endif + if a:name == "whitespace" + " do not replace the filetype but add whitespace on top + let name = &ft .. ".whitespace" + endif if !exists("s:syntax_menu_synonly") exe "set ft=" . name if exists("g:syntax_manual") diff --git a/runtime/syntax/bitbake.vim b/runtime/syntax/bitbake.vim new file mode 100644 index 0000000000..30f34474ad --- /dev/null +++ b/runtime/syntax/bitbake.vim @@ -0,0 +1,126 @@ +" Vim syntax file +" Language: BitBake bb/bbclasses/inc +" Author: Chris Larson +" Ricardo Salveti +" Copyright: Copyright (C) 2004 Chris Larson +" Copyright (C) 2008 Ricardo Salveti +" +" This file is licensed under the MIT license, see COPYING.MIT in +" this source distribution for the terms. +" +" Syntax highlighting for bb, bbclasses and inc files. +" +" It's an entirely new type, just has specific syntax in shell and python code + +if v:version < 600 + finish +endif +if exists("b:current_syntax") + finish +endif + +syn include @python syntax/python.vim +unlet! b:current_syntax + +" BitBake syntax + +" Matching case +syn case match + +" Indicates the error when nothing is matched +syn match bbUnmatched "." + +" Comments +syn cluster bbCommentGroup contains=bbTodo,@Spell +syn keyword bbTodo COMBAK FIXME TODO XXX contained +syn match bbComment "#.*$" contains=@bbCommentGroup + +" String helpers +syn match bbQuote +['"]+ contained +syn match bbDelimiter "[(){}=]" contained +syn match bbArrayBrackets "[\[\]]" contained + +" BitBake strings +syn match bbContinue "\\$" +syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ end=+"+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell +syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell + +" Vars definition +syn match bbExport "^export" nextgroup=bbIdentifier skipwhite +syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite +syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained +syn match bbVarDeref "${[a-zA-Z0-9\-_:\.\/\+]\+}" contained +syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue +syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+][${}a-zA-Z0-9\-_:\.\/\+]*\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbOverrideOperator,bbVarDeref nextgroup=bbVarEq +syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue +syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python + +" Vars metadata flags +syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.+]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag +syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq + +" Includes and requires +syn keyword bbInclude inherit include require contained +syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref +syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest + +" Add taks and similar +syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained +syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement +syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest + +" OE Important Functions +syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained + +" Generic Functions +syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions + +syn keyword bbOverrideOperator append prepend remove contained + +" BitBake shell metadata +syn include @shell syntax/sh.vim +unlet! b:current_syntax + +syn keyword bbShFakeRootFlag fakeroot contained +syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_:${}\-\.]\+\)\(python\)\@ -" Previous Maintainer: Claudio Fleiner -" Repository: https://notabug.org/jorgesumle/vim-html-syntax -" Last Change: 2021 Mar 02 -" Included patch #7900 to fix comments -" Included patch #7916 to fix a few more things -" +" Language: HTML +" Maintainer: Doug Kearns +" Previous Maintainers: Jorge Maldonado Ventura +" Claudio Fleiner +" Last Change: 2022 Jul 20 " Please check :help html.vim for some comments and a description of the options @@ -23,6 +20,9 @@ set cpo&vim syntax spell toplevel +syn include @htmlXml syntax/xml.vim +unlet b:current_syntax + syn case ignore " mark illegal characters @@ -30,13 +30,13 @@ syn match htmlError "[<>&]" " tags -syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc -syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc -syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc -syn region htmlEndTag start=++ contains=htmlTagN,htmlTagError -syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster -syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster -syn match htmlTagN contained +][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc +syn region htmlEndTag start=++ contains=htmlTagN,htmlTagError +syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster +syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster +syn match htmlTagN contained +]<"ms=s+1 @@ -47,13 +47,13 @@ syn keyword htmlTagName contained cite code dd dfn dir div dl dt font syn keyword htmlTagName contained form hr html img syn keyword htmlTagName contained input isindex kbd li link map menu syn keyword htmlTagName contained meta ol option param pre p samp span -syn keyword htmlTagName contained select small sub sup +syn keyword htmlTagName contained select small strike sub sup syn keyword htmlTagName contained table td textarea th tr tt ul var xmp -syn match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" +syn match htmlTagName contained "\<\%(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" " new html 4.0 tags -syn keyword htmlTagName contained abbr acronym bdo button col label -syn keyword htmlTagName contained colgroup fieldset iframe ins legend +syn keyword htmlTagName contained abbr acronym bdo button col colgroup +syn keyword htmlTagName contained del fieldset iframe ins label legend syn keyword htmlTagName contained object optgroup q s tbody tfoot thead " new html 5 tags @@ -65,6 +65,15 @@ syn keyword htmlTagName contained progress rb rp rt rtc ruby section syn keyword htmlTagName contained slot source summary template time track syn keyword htmlTagName contained video wbr +" svg and math tags +syn keyword htmlMathTagName contained math +syn keyword htmlSvgTagName contained svg + +syn region htmlMath start="" end="" contains=@htmlXml transparent keepend +syn region htmlSvg start="" end="" contains=@htmlXml transparent keepend + +syn cluster xmlTagHook add=htmlMathTagName,htmlSvgTagName + " legal arg names syn keyword htmlArg contained action syn keyword htmlArg contained align alink alt archive background bgcolor @@ -77,7 +86,7 @@ syn keyword htmlArg contained marginwidth maxlength method name prompt syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape 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 +syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 " aria attributes exe 'syn match htmlArg contained "\" +syn keyword htmlArg contained frameborder noresize pagex pagey above below +syn keyword htmlArg contained left top visibility clip id noshade +syn match htmlArg contained "\" " Microsoft extensions syn keyword htmlTagName contained marquee " html 4.0 arg names -syn match htmlArg contained "\<\(accept-charset\|label\)\>" +syn match htmlArg contained "\<\%(accept-charset\|label\)\>" syn keyword htmlArg contained abbr accept accesskey axis char charoff charset syn keyword htmlArg contained cite classid codetype compact data datetime syn keyword htmlArg contained declare defer dir disabled for frame @@ -113,51 +122,57 @@ syn keyword htmlArg contained rules scheme scope span standby style syn keyword htmlArg contained summary tabindex valuetype version " html 5 arg names -syn keyword htmlArg contained allowfullscreen async autocomplete autofocus -syn keyword htmlArg contained autoplay challenge contenteditable contextmenu -syn keyword htmlArg contained controls crossorigin default dirname download -syn keyword htmlArg contained draggable dropzone form formaction formenctype -syn keyword htmlArg contained formmethod formnovalidate formtarget hidden -syn keyword htmlArg contained high icon inputmode keytype kind list loop low -syn keyword htmlArg contained max min minlength muted nonce novalidate open -syn keyword htmlArg contained optimum pattern placeholder poster preload -syn keyword htmlArg contained radiogroup required reversed sandbox spellcheck -syn keyword htmlArg contained sizes srcset srcdoc srclang step title translate -syn keyword htmlArg contained typemustmatch +syn keyword htmlArg contained allow autocapitalize as blocking decoding +syn keyword htmlArg contained enterkeyhint imagesizes imagesrcset inert +syn keyword htmlArg contained integrity is itemid itemprop itemref itemscope +syn keyword htmlArg contained itemtype loading nomodule ping playsinline +syn keyword htmlArg contained referrerpolicy slot allowfullscreen async +syn keyword htmlArg contained autocomplete autofocus autoplay challenge +syn keyword htmlArg contained contenteditable contextmenu controls crossorigin +syn keyword htmlArg contained default dirname download draggable dropzone form +syn keyword htmlArg contained formaction formenctype formmethod formnovalidate +syn keyword htmlArg contained formtarget hidden high icon inputmode keytype +syn keyword htmlArg contained kind list loop low max min minlength muted nonce +syn keyword htmlArg contained novalidate open optimum pattern placeholder +syn keyword htmlArg contained poster preload radiogroup required reversed +syn keyword htmlArg contained sandbox spellcheck sizes srcset srcdoc srclang +syn keyword htmlArg contained step title translate typemustmatch +syn match htmlArg contained "\+ contains=@Spell + syn region htmlComment start=+ " Idem 8.2.4.43,44: Except and are parser errors " Idem 8.2.4.52: dash-dash-bang (--!>) is error ignored by parser, also closes comment - syn region htmlComment matchgroup=htmlComment start=+ is all right syn match htmlCommentNested contained "\@!" syn match htmlCommentError contained "[^>+ keepend +syn region htmlComment start=++ keepend " server-parsed commands syn region htmlPreProc start=++ contains=htmlPreStmt,htmlPreError,htmlPreAttr -syn match htmlPreStmt contained "\)" + syn match htmlCssStyleComment contained "\%(\)" syn region htmlCssDefinition matchgroup=htmlArg start='style="' keepend matchgroup=htmlString end='"' contains=css.*Attr,css.*Prop,cssComment,cssLength,cssColor,cssURL,cssImportant,cssError,cssString,@htmlPreproc hi def link htmlStyleArg htmlString endif @@ -258,68 +273,70 @@ if main_syntax == "html" endif " The default highlighting. -hi def link htmlTag Function -hi def link htmlEndTag Identifier -hi def link htmlArg Type -hi def link htmlTagName htmlStatement -hi def link htmlSpecialTagName Exception -hi def link htmlValue String -hi def link htmlSpecialChar Special +hi def link htmlTag Function +hi def link htmlEndTag Identifier +hi def link htmlArg Type +hi def link htmlTagName htmlStatement +hi def link htmlSpecialTagName Exception +hi def link htmlMathTagName htmlTagName +hi def link htmlSvgTagName htmlTagName +hi def link htmlValue String +hi def link htmlSpecialChar Special if !exists("html_no_rendering") - hi def link htmlH1 Title - hi def link htmlH2 htmlH1 - hi def link htmlH3 htmlH2 - hi def link htmlH4 htmlH3 - hi def link htmlH5 htmlH4 - hi def link htmlH6 htmlH5 - hi def link htmlHead PreProc - hi def link htmlTitle Title - hi def link htmlBoldItalicUnderline htmlBoldUnderlineItalic - hi def link htmlUnderlineBold htmlBoldUnderline - hi def link htmlUnderlineItalicBold htmlBoldUnderlineItalic - hi def link htmlUnderlineBoldItalic htmlBoldUnderlineItalic - hi def link htmlItalicUnderline htmlUnderlineItalic - hi def link htmlItalicBold htmlBoldItalic - hi def link htmlItalicBoldUnderline htmlBoldUnderlineItalic - hi def link htmlItalicUnderlineBold htmlBoldUnderlineItalic - hi def link htmlLink Underlined - hi def link htmlLeadingSpace None + hi def link htmlH1 Title + hi def link htmlH2 htmlH1 + hi def link htmlH3 htmlH2 + hi def link htmlH4 htmlH3 + hi def link htmlH5 htmlH4 + hi def link htmlH6 htmlH5 + hi def link htmlHead PreProc + hi def link htmlTitle Title + hi def link htmlBoldItalicUnderline htmlBoldUnderlineItalic + hi def link htmlUnderlineBold htmlBoldUnderline + hi def link htmlUnderlineItalicBold htmlBoldUnderlineItalic + hi def link htmlUnderlineBoldItalic htmlBoldUnderlineItalic + hi def link htmlItalicUnderline htmlUnderlineItalic + hi def link htmlItalicBold htmlBoldItalic + hi def link htmlItalicBoldUnderline htmlBoldUnderlineItalic + hi def link htmlItalicUnderlineBold htmlBoldUnderlineItalic + hi def link htmlLink Underlined + hi def link htmlLeadingSpace None if !exists("html_my_rendering") - hi def htmlBold term=bold cterm=bold gui=bold - hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline - hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic + hi def htmlBold term=bold cterm=bold gui=bold + hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline + hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline - hi def htmlUnderline term=underline cterm=underline gui=underline - hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline - hi def htmlItalic term=italic cterm=italic gui=italic + hi def htmlUnderline term=underline cterm=underline gui=underline + 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 -hi def link htmlPreStmt PreProc -hi def link htmlPreError Error -hi def link htmlPreProc PreProc -hi def link htmlPreAttr String +hi def link htmlPreStmt PreProc +hi def link htmlPreError Error +hi def link htmlPreProc PreProc +hi def link htmlPreAttr String hi def link htmlPreProcAttrName PreProc hi def link htmlPreProcAttrError Error -hi def link htmlString String -hi def link htmlStatement Statement -hi def link htmlComment Comment -hi def link htmlCommentNested htmlError -hi def link htmlCommentError htmlError -hi def link htmlTagError htmlError -hi def link htmlEvent javaScript -hi def link htmlError Error - -hi def link javaScript Special +hi def link htmlString String +hi def link htmlStatement Statement +hi def link htmlComment Comment +hi def link htmlCommentNested htmlError +hi def link htmlCommentError htmlError +hi def link htmlTagError htmlError +hi def link htmlEvent javaScript +hi def link htmlError Error + +hi def link javaScript Special hi def link javaScriptExpression javaScript hi def link htmlCssStyleComment Comment -hi def link htmlCssDefinition Special +hi def link htmlCssDefinition Special let b:current_syntax = "html" diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim index d0d7f1523b..68f7ee21ea 100644 --- a/runtime/syntax/make.vim +++ b/runtime/syntax/make.vim @@ -3,7 +3,7 @@ " Maintainer: Roland Hieber , " Previous Maintainer: Claudio Fleiner " URL: https://github.com/vim/vim/blob/master/runtime/syntax/make.vim -" Last Change: 2020 May 03 +" Last Change: 2020 Oct 16 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -45,19 +45,19 @@ syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 syn region makeTarget transparent matchgroup=makeTarget - \ start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 - \ end=";"re=e-1,me=e-1 end="[^\\]$" + \ start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*&\?:\?:\{1,2}[^:=]"rs=e-1 + \ end="[^\\]$" \ keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment,makeDString \ skipnl nextGroup=makeCommands -syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" +syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*&\?::\=\s*$" \ contains=makeIdent,makeSpecTarget,makeComment \ skipnl nextgroup=makeCommands,makeCommandError syn region makeSpecTarget transparent matchgroup=makeSpecTarget - \ start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 + \ start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\|ONESHELL\)\>\s*:\{1,2}[^:=]"rs=e-1 \ end="[^\\]$" keepend \ contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands -syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" +syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\|ONESHELL\)\>\s*::\=\s*$" \ contains=makeIdent,makeComment \ skipnl nextgroup=makeCommands,makeCommandError -- cgit From 2a9c9371bc6d7e3c92eace673d1ed3740b12a270 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 26 Jul 2022 14:16:46 +0200 Subject: vim-patch:9.0.0073: too many files recognized as bsdl (#19504) Problem: Too many files recognized as bsdl. Solution: Use pattern "*.bsd" instead of "*bsd". (Martin Tournoij, closes vim/vim#10783) https://github.com/vim/vim/commit/1b67f07f7626b87d9ce3e16815970988983a2ddc --- runtime/filetype.vim | 2 +- runtime/lua/vim/filetype.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/filetype.vim b/runtime/filetype.vim index f28118e272..f91d7e1929 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -260,7 +260,7 @@ au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/ au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml " BSDL -au BufNewFile,BufRead *bsd,*.bsdl setf bsdl +au BufNewFile,BufRead *.bsd,*.bsdl setf bsdl " Bazel (http://bazel.io) autocmd BufRead,BufNewFile *.bzl,*.bazel,WORKSPACE setf bzl diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index c2dcc2a2c8..8746f9e294 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -176,6 +176,7 @@ local extension = { bbappend = 'bitbake', bbclass = 'bitbake', bl = 'blank', + bsd = 'bsdl', bsdl = 'bsdl', bst = 'bst', btm = function(path, bufnr) @@ -1668,7 +1669,6 @@ local pattern = { ['.*/build/conf/.*%.conf'] = 'bitbake', ['.*/meta/conf/.*%.conf'] = 'bitbake', ['.*/meta%-.*/conf/.*%.conf'] = 'bitbake', - ['.*bsd'] = 'bsdl', ['bzr_log%..*'] = 'bzr', ['.*enlightenment/.*%.cfg'] = 'c', ['cabal%.project%..*'] = starsetf('cabalproject'), -- cgit From 7e939ddb874b66414fc09bb1b33c34838b45b184 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 26 Jul 2022 23:08:48 +0200 Subject: vim-patch:9.0.0084: using "terraform" filetype for .tfvars file is bad (#19526) Problem: Using "terraform" filetype for .tfvars file is bad. Solution: use "terraform-vars", so that different completion and other mechanisms can be used. (Radek Simko, closes vim/vim#10755) https://github.com/vim/vim/commit/15b87b6610bfce0c6296bbbad019c944f88a74ca --- runtime/filetype.vim | 4 ++-- runtime/lua/vim/filetype.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/filetype.vim b/runtime/filetype.vim index f91d7e1929..5a5937a209 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1983,8 +1983,8 @@ au BufRead,BufNewFile *.ttl " Terminfo au BufNewFile,BufRead *.ti setf terminfo -" Terraform -au BufRead,BufNewFile *.tfvars setf terraform +" Terraform variables +au BufRead,BufNewFile *.tfvars setf terraform-vars " TeX au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 8746f9e294..10eff6598c 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -969,7 +969,7 @@ local extension = { txi = 'texinfo', texinfo = 'texinfo', text = 'text', - tfvars = 'terraform', + tfvars = 'terraform-vars', tla = 'tla', tli = 'tli', toml = 'toml', -- cgit From 9b447c7ce5bd81d576bcc9253ed77416d9baf59b Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Wed, 27 Jul 2022 10:06:09 -0600 Subject: vim-patch:9.0.0088: pattern for detecting bitbake files is not sufficient (#19547) Problem: Pattern for detecting bitbake files is not sufficient. Solution: Adjust the pattern. (Gregory Anders, closes vim/vim#10743) https://github.com/vim/vim/commit/30e212dac1d29536883c36918a465a38d81d6413 --- runtime/autoload/dist/ft.vim | 2 +- runtime/lua/vim/filetype/detect.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 9e30ae1f51..a2f485dd67 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -519,7 +519,7 @@ func dist#ft#FTinc() " headers so assume POV-Ray elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords setf pascal - elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = ' + elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '[A-Z][A-Za-z0-9_:${}]*\s\+\%(??\|[?:+]\)\?= ' setf bitbake else call dist#ft#FTasmsyntax() diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 8c10517687..14f076717f 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -554,7 +554,7 @@ function M.inc(bufnr) -- headers so assume POV-Ray elseif findany(lines, { '^%s{', '^%s%(%*' }) or matchregex(lines, pascal_keywords) then return 'pascal' - elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%w+%s+= ' }) then + elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%u[%w_:${}]*%s+%??[?:+]?= ' }) then return 'bitbake' else local syntax = M.asm_syntax(bufnr) -- cgit From 4c3104819baa5c0667ce3a41f3b03bdd4b40cb30 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 27 Jul 2022 18:11:59 +0200 Subject: vim-patch:9.0.0093: sway config files are recognized as i3config (#19545) Problem: Sway config files are recognized as i3config. Solution: Recognize swayconfig separately. (James Eapen, closes vim/vim#10672) https://github.com/vim/vim/commit/7abd1c6d8e777bde1700633bafc1a40be9e9c1aa --- runtime/filetype.vim | 10 +++++++--- runtime/lua/vim/filetype.lua | 8 ++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'runtime') diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5a5937a209..fbb4b9f6aa 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -860,9 +860,13 @@ au BufNewFile,BufRead *.hb setf hb " Httest au BufNewFile,BufRead *.htt,*.htb setf httest -" i3 (and sway) -au BufNewFile,BufRead */i3/config,*/sway/config setf i3config -au BufNewFile,BufRead */.i3/config,*/.sway/config setf i3config +" i3 +au BufNewFile,BufRead */i3/config setf i3config +au BufNewFile,BufRead */.i3/config setf i3config + +" sway +au BufNewFile,BufRead */sway/config setf swayconfig +au BufNewFile,BufRead */.sway/config setf swayconfig " Icon au BufNewFile,BufRead *.icn setf icon diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 10eff6598c..9c59442caf 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1384,10 +1384,6 @@ local filename = { ['/etc/host.conf'] = 'hostconf', ['/etc/hosts.allow'] = 'hostsaccess', ['/etc/hosts.deny'] = 'hostsaccess', - ['/i3/config'] = 'i3config', - ['/sway/config'] = 'i3config', - ['/.sway/config'] = 'i3config', - ['/.i3/config'] = 'i3config', ['/.icewm/menu'] = 'icemenu', ['.indent.pro'] = 'indent', indentrc = 'indent', @@ -1835,9 +1831,7 @@ local pattern = { ['.*/etc/hosts%.allow'] = 'hostsaccess', ['.*%.html%.m4'] = 'htmlm4', ['.*/%.i3/config'] = 'i3config', - ['.*/sway/config'] = 'i3config', ['.*/i3/config'] = 'i3config', - ['.*/%.sway/config'] = 'i3config', ['.*/%.icewm/menu'] = 'icemenu', ['.*/etc/initng/.*/.*%.i'] = 'initng', ['JAM.*%..*'] = starsetf('jam'), @@ -2076,6 +2070,8 @@ local pattern = { end, ['.*/etc/sudoers'] = 'sudoers', ['svn%-commit.*%.tmp'] = 'svn', + ['.*/sway/config'] = 'swayconfig', + ['.*/%.sway/config'] = 'swayconfig', ['.*%.swift%.gyb'] = 'swiftgyb', ['.*%.[Ss][Yy][Ss]'] = function(path, bufnr) return require('vim.filetype.detect').sys(bufnr) -- cgit From 888f12858add8b16ce7d83129cbf20670df38f37 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Wed, 27 Jul 2022 18:55:44 +0200 Subject: fix(lsp): set workspace.configuration capability (#19548) Neovim implements `workspace/configuration` It should set the capability accordingly. From https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities: /** * The client supports `workspace/configuration` requests. * * @since 3.6.0 */ configuration?: boolean; --- runtime/lua/vim/lsp/protocol.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 6ecb9959d5..27da60b4ae 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -759,6 +759,7 @@ function protocol.make_client_capabilities() }, hierarchicalWorkspaceSymbolSupport = true, }, + configuration = true, workspaceFolders = true, applyEdit = true, workspaceEdit = { -- cgit From f5d558c8ea2e0637f105521806edc8a27d549847 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Wed, 27 Jul 2022 18:56:27 +0200 Subject: feat(lsp): provide feedback if server can't compute rename result (#19546) Without some form of feedback a user cannot easily tell if the server is still computing the result (which can take a while in large projects), or whether the server couldn't compute the rename result. --- runtime/lua/vim/lsp/handlers.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index cfc35f0b51..1e6ac8dddf 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -257,6 +257,7 @@ end) --see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename M['textDocument/rename'] = function(_, result, ctx, _) if not result then + 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) -- cgit From 7d9e68669c4c379b77e76eb02a1a4a7c2cceafd7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 28 Jul 2022 05:19:38 +0800 Subject: vim-patch:9.0.0092: plugins cannot change v:completed_item (#19542) Problem: Plugins cannot change v:completed_item. Solution: Make v:completed_item writeable. (Shougo Matsushita, closes vim/vim#10801) https://github.com/vim/vim/commit/61021aa318ca4c4a6b0182ee93388b2e9b5eefba --- runtime/doc/eval.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 17af40bdb9..376adfec7f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1736,6 +1736,8 @@ 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 -- cgit From 98915f88b2d4b0e7f2ca643cd4648316ec9cddb8 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Thu, 28 Jul 2022 19:19:07 +0200 Subject: feat(lsp): add range option to code_action; deprecate range_code_action (#19551) `code_action` gained extra functions (`filter` and `apply`) which `range_code_action` didn't have. To close this gap, this adds a `range` option to `code_action` and deprecates `range_code_action`. The option defaults to the current selection if in visual mode. This allows users to setup a mapping like `vim.keymap.set({'v', 'n'}, '', vim.lsp.buf.code_action)` `range_code_action` used to use the `<` and `>` markers to get the _last_ selection which required using a `lua vim.lsp.buf.range_code_action()` (note the ``) mapping. --- runtime/doc/lsp.txt | 56 ++++++++++++++++++----------------- runtime/lua/vim/lsp/buf.lua | 69 +++++++++++++++++++++++++++++++++----------- runtime/lua/vim/lsp/util.lua | 24 +++++++-------- 3 files changed, 94 insertions(+), 55 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 5632a1ad78..12ed17a7cc 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1096,7 +1096,7 @@ 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 @@ -1104,13 +1104,18 @@ code_action({options}) *vim.lsp.buf.code_action()* actions. Most language servers support values like `refactor` or `quickfix`. - • filter (function|nil): Predicate function - taking an `CodeAction` and returning a - boolean. - • apply (boolean|nil): When set to `true`, and + • 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| See also: ~ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction @@ -1606,7 +1611,7 @@ character_offset({buf}, {row}, {col}, {offset_encoding}) certain buffer. Parameters: ~ - {buf} buffer id (0 for current) + {buf} (number) 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|nil @@ -1768,17 +1773,17 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding}) that is similar to |vim.lsp.util.make_range_params()|. Parameters: ~ - {start_pos} ({number, number}, optional) - mark-indexed position. Defaults to the - start of the last visual selection. - {end_pos} ({number, number}, optional) - mark-indexed position. Defaults to the - end of the last visual selection. - {bufnr} (optional, number): buffer handle or 0 - for current, defaults to current - {offset_encoding} (string) utf-8|utf-16|utf-32|nil - defaults to `offset_encoding` of first - client of `bufnr` + {start_pos} number[]|nil {row, col} mark-indexed + position. Defaults to the start of the + last visual selection. + {end_pos} number[]|nil {row, col} mark-indexed + position. Defaults to the end of the + last visual selection. + {bufnr} (number|nil) buffer handle or 0 for + current, defaults to current + {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults + to `offset_encoding` of first client of + `bufnr` Return: ~ { textDocument = { uri = `current_file_uri` }, range = { @@ -1790,8 +1795,8 @@ make_position_params({window}, {offset_encoding}) buffer and cursor position. Parameters: ~ - {window} (optional, number): window handle or 0 - for current, defaults to current + {window} number|nil: window handle or 0 for + current, defaults to current {offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window` @@ -1811,11 +1816,11 @@ make_range_params({window}, {offset_encoding}) `textDocument/rangeFormatting`. Parameters: ~ - {window} (optional, number): window handle or 0 - for current, defaults to current - {offset_encoding} (string) utf-8|utf-16|utf-32|nil - defaults to `offset_encoding` of first - client of buffer of `window` + {window} number|nil: window handle or 0 for + current, defaults to current + {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults + to `offset_encoding` of first client of + buffer of `window` Return: ~ { textDocument = { uri = `current_file_uri` }, range = { @@ -1827,8 +1832,7 @@ make_text_document_params({bufnr}) buffer. Parameters: ~ - {bufnr} (optional, number): Buffer handle, defaults to - current + {bufnr} number|nil: Buffer handle, defaults to current Return: ~ `TextDocumentIdentifier` diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 34ca96d1ff..7f19618e0f 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -11,8 +11,8 @@ local M = {} --- buffer. --- ---@param method (string) LSP method name ----@param params (optional, table) Parameters to send to the server ----@param handler (optional, functionnil) See |lsp-handler|. Follows |lsp-handler-resolution| +---@param params (table|nil) Parameters to send to the server +---@param handler (function|nil) See |lsp-handler|. Follows |lsp-handler-resolution| -- ---@returns 2-tuple: --- - Map of client-id:request-id pairs for all successful requests. @@ -842,20 +842,27 @@ end --- 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`. ---- - filter (function|nil): ---- Predicate function 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. +--- - 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`. +--- - 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| +--- ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction function M.code_action(options) validate({ options = { options, 't', true } }) @@ -870,7 +877,34 @@ function M.code_action(options) local bufnr = api.nvim_get_current_buf() context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr) end - local params = util.make_range_params() + local params + local mode = api.nvim_get_mode().mode + if options.range then + assert(type(options.range) == 'table', 'code_action range must be a table') + local start = assert(options.range.start, 'range must have a `start` property') + local end_ = assert(options.range['end'], 'range must have a `end` property') + params = util.make_given_range_params(start, end_) + elseif mode == 'v' or mode == 'V' then + -- [bufnum, lnum, col, off]; both row and column 1-indexed + local start = vim.fn.getpos('v') + local end_ = vim.fn.getpos('.') + local start_row = start[2] + local start_col = start[3] + local end_row = end_[2] + local end_col = end_[3] + + -- A user can start visual selection at the end and move backwards + -- Normalize the range to start < end + if start_row == end_row and end_col < start_col then + end_col, start_col = start_col, end_col + elseif end_row < start_row then + start_row, end_row = end_row, start_row + start_col, end_col = end_col, start_col + end + params = util.make_given_range_params({ start_row, start_col - 1 }, { end_row, end_col - 1 }) + else + params = util.make_range_params() + end params.context = context code_action_request(params, options) end @@ -891,6 +925,7 @@ end ---@param end_pos ({number, number}, optional) mark-indexed position. ---Defaults to the end of the last visual selection. function M.range_code_action(context, start_pos, end_pos) + vim.deprecate('vim.lsp.buf.range_code_action', 'vim.lsp.buf.code_action', '0.9.0') validate({ context = { context, 't', true } }) context = context or {} if not context.diagnostics then diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 70f5010256..8e89d92a56 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1821,7 +1821,7 @@ function M.try_trim_markdown_code_blocks(lines) end ---@private ----@param window (optional, number): window handle or 0 for current, defaults to current +---@param window number|nil: window handle or 0 for current, defaults to current ---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window` local function make_position_param(window, offset_encoding) window = window or 0 @@ -1841,7 +1841,7 @@ end --- Creates a `TextDocumentPositionParams` object for the current buffer and cursor position. --- ----@param window (optional, number): window handle or 0 for current, defaults to current +---@param window number|nil: window handle or 0 for current, defaults to current ---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window` ---@returns `TextDocumentPositionParams` object ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams @@ -1894,8 +1894,8 @@ end --- `textDocument/codeAction`, `textDocument/colorPresentation`, --- `textDocument/rangeFormatting`. --- ----@param window (optional, number): window handle or 0 for current, defaults to current ----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window` +---@param window number|nil: window handle or 0 for current, defaults to current +---@param offset_encoding "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of buffer of `window` ---@returns { textDocument = { uri = `current_file_uri` }, range = { start = ---`current_position`, end = `current_position` } } function M.make_range_params(window, offset_encoding) @@ -1911,12 +1911,12 @@ end --- Using the given range in the current buffer, creates an object that --- is similar to |vim.lsp.util.make_range_params()|. --- ----@param start_pos ({number, number}, optional) mark-indexed position. ----Defaults to the start of the last visual selection. ----@param end_pos ({number, number}, optional) mark-indexed position. ----Defaults to the end of the last visual selection. ----@param bufnr (optional, number): buffer handle or 0 for current, defaults to current ----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of `bufnr` +---@param start_pos number[]|nil {row, col} mark-indexed position. +--- Defaults to the start of the last visual selection. +---@param end_pos number[]|nil {row, col} mark-indexed position. +--- Defaults to the end of the last visual selection. +---@param bufnr number|nil buffer handle or 0 for current, defaults to current +---@param offset_encoding "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of `bufnr` ---@returns { textDocument = { uri = `current_file_uri` }, range = { start = ---`start_position`, end = `end_position` } } function M.make_given_range_params(start_pos, end_pos, bufnr, offset_encoding) @@ -1956,7 +1956,7 @@ end --- Creates a `TextDocumentIdentifier` object for the current buffer. --- ----@param bufnr (optional, number): Buffer handle, defaults to current +---@param bufnr number|nil: Buffer handle, defaults to current ---@returns `TextDocumentIdentifier` ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier function M.make_text_document_params(bufnr) @@ -2000,7 +2000,7 @@ end --- Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. --- ----@param buf buffer id (0 for current) +---@param buf number buffer number (0 for current) ---@param row 0-indexed line ---@param col 0-indexed byte offset in line ---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of `buf` -- cgit From b25abbf4b8a08899bba87809124c882928d99e21 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Thu, 28 Jul 2022 19:41:30 +0200 Subject: docs(lsp): use direct link to formattingOptions in format docs (#19558) Also changes `@see` to `See` to avoid the break to a dedicated "See also" block in the generated vimdoc --- runtime/doc/lsp.txt | 41 +++++++++++++++++++++-------------------- runtime/lua/vim/lsp/buf.lua | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 12ed17a7cc..11f96db8c9 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1202,32 +1202,33 @@ format({options}) *vim.lsp.buf.format()* • formatting_options (table|nil): Can be used to specify FormattingOptions. Some unspecified options will be automatically - derived from the current Neovim options. - - See also: ~ - https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting - • 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: • > + derived from the current Neovim options. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/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: • > -- 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. + • 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. formatting({options}) *vim.lsp.buf.formatting()* Formats the current buffer. diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 7f19618e0f..63f4688d94 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -157,7 +157,7 @@ end --- - formatting_options (table|nil): --- Can be used to specify FormattingOptions. Some unspecified options will be --- automatically derived from the current Neovim options. ---- @see https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting +--- See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions --- - timeout_ms (integer|nil, default 1000): --- Time in milliseconds to block for formatting requests. No effect if async=true --- - bufnr (number|nil): -- cgit From 6237ac84024f048ec60475276fbf0663d9d17879 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Jul 2022 15:48:32 +0200 Subject: vim-patch:2ecbe53f452e (#19577) Update runtime files https://github.com/vim/vim/commit/2ecbe53f452e92e941aff623f6a0b72f80e43d07 --- runtime/doc/builtin.txt | 4 +- runtime/doc/change.txt | 2 + runtime/doc/spell.txt | 2 +- runtime/ftplugin/debchangelog.vim | 101 +++++++++++++++++++++----------------- runtime/ftplugin/desktop.vim | 13 +++++ runtime/ftplugin/swayconfig.vim | 16 ++++++ runtime/indent/html.vim | 2 +- runtime/indent/javascript.vim | 6 +++ runtime/syntax/autohotkey.vim | 17 ++++--- runtime/syntax/debchangelog.vim | 12 ++--- runtime/syntax/debsources.vim | 12 ++--- runtime/syntax/i3config.vim | 12 +++-- runtime/syntax/python.vim | 10 +++- runtime/syntax/swayconfig.vim | 92 ++++++++++++++++++++++++++++++++++ 14 files changed, 228 insertions(+), 73 deletions(-) create mode 100644 runtime/ftplugin/desktop.vim create mode 100644 runtime/ftplugin/swayconfig.vim create mode 100644 runtime/syntax/swayconfig.vim (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 668c738e0a..9d33c442c2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4907,8 +4907,8 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) message will appear and the match will not be added. An ID is specified as a positive integer (zero excluded). IDs 1, 2 and 3 are reserved for |:match|, |:2match| and |:3match|, - respectively. 3 is reserved for use by the - |matchparen| plugin. + respectively. 3 is reserved for use by the |matchparen| + plugin. If the {id} argument is not specified or -1, |matchadd()| automatically chooses a free ID. diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index b905f53db7..a4ff4474e6 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -765,6 +765,8 @@ When the {string} starts with "\=" it is evaluated as an expression, see |sub-replace-expression|. You can use that for complex replacement or special characters. +The substitution is limited in recursion to 4 levels. *E1290* + Otherwise these characters in {string} have a special meaning: magic nomagic action ~ diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index bc45b0e511..23d5905ec3 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -92,7 +92,7 @@ zuW *zuG* *zuW* zuG Undo |zW| and |zG|, remove the word from the internal word list. Count used as with |zg|. - *:spe* *:spellgood* + *:spe* *:spellgood* *E1280* :[count]spe[llgood] {word} Add {word} as a good word to 'spellfile', like with |zg|. Without count the first name is used, with a diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index a78f7811f1..cf8dd17c44 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file (GUI menu, folding and completion) " Language: Debian Changelog -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel " Stefano Zacchiroli -" Last Change: 2018-01-28 +" Last Change: 2022 Jul 25 " License: Vim License " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim @@ -35,6 +35,11 @@ if exists('g:did_changelog_ftplugin') finish endif +" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise +" would not be recognized. See ":help 'cpoptions'". +let s:cpo_save = &cpo +set cpo&vim + " Don't load another plugin (this is global) let g:did_changelog_ftplugin = 1 @@ -101,13 +106,13 @@ endfunction " These functions implement the menus function NewVersion() " The new entry is unfinalised and shall be changed - amenu disable Changelog.New\ Version - amenu enable Changelog.Add\ Entry - amenu enable Changelog.Close\ Bug - amenu enable Changelog.Set\ Distribution - amenu enable Changelog.Set\ Urgency - amenu disable Changelog.Unfinalise - amenu enable Changelog.Finalise + amenu disable &Changelog.&New\ Version + amenu enable &Changelog.&Add\ Entry + amenu enable &Changelog.&Close\ Bug + amenu enable &Changelog.Set\ &Distribution + amenu enable &Changelog.Set\ &Urgency + amenu disable &Changelog.U&nfinalise + amenu enable &Changelog.&Finalise call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', '')) call append(1, '') call append(2, '') @@ -117,7 +122,9 @@ function NewVersion() normal! 1G0 call search(')') normal! h - normal!  + " ':normal' doens't support key annotation () directly. + " Vim's manual recommends using ':exe' to use key annotation indirectly (backslash-escaping needed though). + exe "normal! \" call setline(1, substitute(getline(1), '-\$\$', '-', '')) if exists('g:debchangelog_fold_enable') foldopen @@ -161,13 +168,13 @@ endfunction function UnfinaliseMenu() " This means the entry shall be changed - amenu disable Changelog.New\ Version - amenu enable Changelog.Add\ Entry - amenu enable Changelog.Close\ Bug - amenu enable Changelog.Set\ Distribution - amenu enable Changelog.Set\ Urgency - amenu disable Changelog.Unfinalise - amenu enable Changelog.Finalise + amenu disable &Changelog.&New\ Version + amenu enable &Changelog.&Add\ Entry + amenu enable &Changelog.&Close\ Bug + amenu enable &Changelog.Set\ &Distribution + amenu enable &Changelog.Set\ &Urgency + amenu disable &Changelog.U&nfinalise + amenu enable &Changelog.&Finalise endfunction function Unfinalise() @@ -179,13 +186,13 @@ endfunction function FinaliseMenu() " This means the entry should not be changed anymore - amenu enable Changelog.New\ Version - amenu disable Changelog.Add\ Entry - amenu disable Changelog.Close\ Bug - amenu disable Changelog.Set\ Distribution - amenu disable Changelog.Set\ Urgency - amenu enable Changelog.Unfinalise - amenu disable Changelog.Finalise + amenu enable &Changelog.&New\ Version + amenu disable &Changelog.&Add\ Entry + amenu disable &Changelog.&Close\ Bug + amenu disable &Changelog.Set\ &Distribution + amenu disable &Changelog.Set\ &Urgency + amenu enable &Changelog.U&nfinalise + amenu disable &Changelog.&Finalise endfunction function Finalise() @@ -198,26 +205,26 @@ endfunction function MakeMenu() amenu &Changelog.&New\ Version :call NewVersion() - amenu Changelog.&Add\ Entry :call AddEntry() - amenu Changelog.&Close\ Bug :call CloseBug() - menu Changelog.-sep- - - amenu Changelog.Set\ &Distribution.&unstable :call Distribution("unstable") - amenu Changelog.Set\ Distribution.&frozen :call Distribution("frozen") - amenu Changelog.Set\ Distribution.&stable :call Distribution("stable") - menu Changelog.Set\ Distribution.-sep- - amenu Changelog.Set\ Distribution.frozen\ unstable :call Distribution("frozen unstable") - amenu Changelog.Set\ Distribution.stable\ unstable :call Distribution("stable unstable") - amenu Changelog.Set\ Distribution.stable\ frozen :call Distribution("stable frozen") - amenu Changelog.Set\ Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable") - - amenu Changelog.Set\ &Urgency.&low :call Urgency("low") - amenu Changelog.Set\ Urgency.&medium :call Urgency("medium") - amenu Changelog.Set\ Urgency.&high :call Urgency("high") - - menu Changelog.-sep- - amenu Changelog.U&nfinalise :call Unfinalise() - amenu Changelog.&Finalise :call Finalise() + amenu &Changelog.&Add\ Entry :call AddEntry() + amenu &Changelog.&Close\ Bug :call CloseBug() + menu &Changelog.-sep- + + amenu &Changelog.Set\ &Distribution.&unstable :call Distribution("unstable") + amenu &Changelog.Set\ &Distribution.&frozen :call Distribution("frozen") + amenu &Changelog.Set\ &Distribution.&stable :call Distribution("stable") + menu &Changelog.Set\ &Distribution.-sep- + amenu &Changelog.Set\ &Distribution.frozen\ unstable :call Distribution("frozen unstable") + amenu &Changelog.Set\ &Distribution.stable\ unstable :call Distribution("stable unstable") + amenu &Changelog.Set\ &Distribution.stable\ frozen :call Distribution("stable frozen") + amenu &Changelog.Set\ &Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable") + + amenu &Changelog.Set\ &Urgency.&low :call Urgency("low") + amenu &Changelog.Set\ &Urgency.&medium :call Urgency("medium") + amenu &Changelog.Set\ &Urgency.&high :call Urgency("high") + + menu &Changelog.-sep- + amenu &Changelog.U&nfinalise :call Unfinalise() + amenu &Changelog.&Finalise :call Finalise() if Finalised() call FinaliseMenu() @@ -228,7 +235,7 @@ endfunction augroup changelogMenu au BufEnter * if &filetype == "debchangelog" | call MakeMenu() | endif -au BufLeave * if &filetype == "debchangelog" | silent! aunmenu Changelog | endif +au BufLeave * if &filetype == "debchangelog" | silent! aunmenu &Changelog | endif augroup END " }}} @@ -380,4 +387,8 @@ setlocal omnifunc=DebCompleteBugs " }}} +" Restore the previous value of 'cpoptions'. +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: set foldmethod=marker: diff --git a/runtime/ftplugin/desktop.vim b/runtime/ftplugin/desktop.vim new file mode 100644 index 0000000000..bd6fd7097c --- /dev/null +++ b/runtime/ftplugin/desktop.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: XDG desktop entry +" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com ) +" Last Change: 2022-07-26 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = v:true + +setl comments=:# +setl commentstring=#%s +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/ftplugin/swayconfig.vim b/runtime/ftplugin/swayconfig.vim new file mode 100644 index 0000000000..45d6bdb3e5 --- /dev/null +++ b/runtime/ftplugin/swayconfig.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: sway config file +" Original Author: James Eapen +" Maintainer: James Eapen +" Version: 0.1 +" Last Change: 2022 June 07 + +if exists("b:did_ftplugin") + finish +endif + +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal cms<" + +setlocal commentstring=#\ %s diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index a3c32d6342..65e0ffc40c 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -600,7 +600,7 @@ func s:Alien3() endif if b:hi_indent.scripttype == "javascript" " indent for further lines - return eval(b:hi_js1indent) + GetJavascriptIndent() + return GetJavascriptIndent() else return -1 endif diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim index f3bf96aa97..8077442ed0 100644 --- a/runtime/indent/javascript.vim +++ b/runtime/indent/javascript.vim @@ -473,6 +473,12 @@ function GetJavascriptIndent() elseif num return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op) endif + + let nest = get(get(b:, 'hi_indent', {}), 'blocklnr') + if nest + return indent(nextnonblank(nest + 1)) + b_l + is_op + endif + return b_l + is_op endfunction diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim index c6a68f7a21..a888394923 100644 --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -2,7 +2,7 @@ " Language: AutoHotkey script file " Maintainer: Michael Wong " https://github.com/mmikeww/autohotkey.vim -" Latest Revision: 2017-04-03 +" Latest Revision: 2022-07-25 " Previous Maintainers: SungHyun Nam " Nikolai Weibull @@ -31,7 +31,7 @@ syn region autohotkeyString \ matchgroup=autohotkeyStringDelimiter \ start=+"+ \ end=+"+ - \ contains=autohotkeyEscape + \ contains=autohotkeyEscape,autohotkeyMatchClass syn match autohotkeyVariable \ display @@ -49,9 +49,9 @@ syn keyword autohotkeyBuiltinVariable \ A_Sec A_MSec A_Now A_NowUTC A_TickCount \ A_IsSuspended A_IsPaused A_IsCritical A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_StringCaseSense - \ A_FileEncoding A_FormatInteger A_FormatFloat A_KeyDelay A_WinDelay A_ControlDelay - \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDelayDuration - \ A_KeyDelayPlay A_KeyDelayPlayDuration A_MouseDelayPlay + \ A_FileEncoding A_FormatInteger A_FormatFloat A_WinDelay A_ControlDelay + \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDuration + \ A_KeyDelayPlay A_KeyDurationPlay A_MouseDelayPlay \ A_MouseDelay A_DefaultMouseSpeed A_RegView A_IconHidden A_IconTip A_IconFile \ A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu \ A_IconNumber @@ -73,6 +73,7 @@ syn keyword autohotkeyBuiltinVariable \ A_LoopFileShortName A_LoopFileDir A_LoopFileTimeModified A_LoopFileTimeCreated \ A_LoopFileTimeAccessed A_LoopFileAttrib A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB \ A_LoopRegType A_LoopRegKey A_LoopRegSubKey A_LoopRegTimeModified + \ A_TimeIdleKeyboard A_TimeIdleMouse A_ListLines A_ComSpec A_LoopFilePath A_Args syn match autohotkeyBuiltinVariable \ contained @@ -118,6 +119,7 @@ syn keyword autohotkeyCommand \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose \ SetCapsLockState SetNumLockState SetScrollLockState + \ Hotstring LoadPicture MenuGetHandle MenuGetName OnError OnClipboardChange syn keyword autohotkeyFunction \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func @@ -127,7 +129,7 @@ syn keyword autohotkeyFunction \ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen \ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet \ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject - \ Format Exception + \ Format Exception Ord InputHook syn keyword autohotkeyStatement \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return @@ -140,7 +142,8 @@ syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else \ IfWinExist IfWinNotExist IfWinActive IfWinNotActive \ IfNotEqual IfLessOrEqual IfGreaterOrEqual - \ while until for in try catch finally + \ while until for in try catch finally not + \ switch case default syn match autohotkeyPreProcStart \ nextgroup= diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 2efd919772..9bd836801e 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2022 May 01 +" Last Change: 2022 Jul 25 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -20,22 +20,22 @@ let s:binNMU='binary-only=yes' let s:cpo = &cpo set cpo-=C let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', - \ 'trixie', 'sid', 'rc-buggy', + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', + \ 'buster', 'bullseye', 'bookworm', 'trixie', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', \ 'devel' \ ] let s:unsupported = [ \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', + \ 'jessie', 'stretch', \ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'groovy' + \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index e3ec6e6598..ea9e59ea8e 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2022 May 01 +" Last Change: 2022 Jul 25 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -22,22 +22,22 @@ syn match debsourcesComment /#.*/ contains=@Spell let s:cpo = &cpo set cpo-=C let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', - \ 'trixie', 'sid', 'rc-buggy', + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', + \ 'buster', 'bullseye', 'bookworm', 'trixie', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', \ 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', + \ 'jessie', 'stretch', \ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'groovy' + \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/i3config.vim b/runtime/syntax/i3config.vim index 0018081da7..caef244ce5 100644 --- a/runtime/syntax/i3config.vim +++ b/runtime/syntax/i3config.vim @@ -17,6 +17,9 @@ endif scriptencoding utf-8 +" Error +syn match i3ConfigError /.*/ + " Todo syn keyword i3ConfigTodo TODO FIXME XXX contained @@ -54,8 +57,8 @@ syn match i3ConfigInclude /^\s*include\s\+.*$/ contains=i3ConfigIncludeKeyword,i " Gaps syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained syn match i3ConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=i3ConfigGapStyleKeyword,i3ConfigNumber,i3ConfigVariable -syn keyword i3ConfigSmartGapKeyword on inverse_outer contained -syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=i3ConfigSmartGapKeyword +syn keyword i3ConfigSmartGapKeyword on inverse_outer off contained +syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\|off\)\s\?$/ contains=i3ConfigSmartGapKeyword syn keyword i3ConfigSmartBorderKeyword on no_gaps contained syn match i3ConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=i3ConfigSmartBorderKeyword @@ -74,7 +77,7 @@ syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVaria syn keyword i3ConfigSizeSpecial x contained syn match i3ConfigNegativeSize /-/ contained syn match i3ConfigSize /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=i3ConfigSizeSpecial,i3ConfigNumber,i3ConfigNegativeSize -syn match i3ConfigFloating /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable +syn match i3ConfigFloatingModifier /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable syn match i3ConfigFloating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=i3ConfigSize " Orientation @@ -183,6 +186,7 @@ syn region i3ConfigBlock start=+^\s*[^#]*s\?{$+ end=+^\s*[^#]*}$+ contains=i3Con syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend " Define the highlighting. +hi def link i3ConfigError Error hi def link i3ConfigTodo Todo hi def link i3ConfigComment Comment hi def link i3ConfigFontContent Type @@ -213,6 +217,7 @@ hi def link i3ConfigTimeUnit Constant hi def link i3ConfigModifier Constant hi def link i3ConfigString Constant hi def link i3ConfigNegativeSize Constant +hi def link i3ConfigInclude Constant hi def link i3ConfigFontSeparator Special hi def link i3ConfigVariableModifier Special hi def link i3ConfigSizeSpecial Special @@ -233,6 +238,7 @@ hi def link i3ConfigLayout Identifier hi def link i3ConfigBorderStyle Identifier hi def link i3ConfigEdge Identifier hi def link i3ConfigFloating Identifier +hi def link i3ConfigFloatingModifier Identifier hi def link i3ConfigCommandKeyword Identifier hi def link i3ConfigNoFocusKeyword Identifier hi def link i3ConfigInitializeKeyword Identifier diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 2293163a5b..ef4da1b448 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2021 Dec 10 +" Last Change: 2022 Jun 28 " Credits: Neil Schemenauer " Dmitry Vasiliev " @@ -84,13 +84,19 @@ syn keyword pythonStatement as assert break continue del global syn keyword pythonStatement lambda nonlocal pass return with yield syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite syn keyword pythonConditional elif else if -syn keyword pythonConditional case match syn keyword pythonRepeat for while syn keyword pythonOperator and in is not or syn keyword pythonException except finally raise try syn keyword pythonInclude from import syn keyword pythonAsync async await +" Soft keywords +" These keywords do not mean anything unless used in the right context +" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords +" for more on this. +syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" +syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" + " Decorators " A dot must be allowed because of @MyClass.myfunc decorators. syn match pythonDecorator "@" display contained diff --git a/runtime/syntax/swayconfig.vim b/runtime/syntax/swayconfig.vim new file mode 100644 index 0000000000..2abfa38bd9 --- /dev/null +++ b/runtime/syntax/swayconfig.vim @@ -0,0 +1,92 @@ +" Vim syntax file +" Language: sway window manager config +" Original Author: James Eapen +" Maintainer: James Eapen +" Version: 0.11.0 +" Last Change: 2022 Jun 07 + +" References: +" http://i3wm.org/docs/userguide.html#configuring +" https://github.com/swaywm/sway/blob/b69d637f7a34e239e48a4267ae94a5e7087b5834/sway/sway.5.scd +" http://vimdoc.sourceforge.net/htmldoc/syntax.html +" +" +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +runtime! syntax/i3config.vim + +scriptencoding utf-8 + +" Error +"syn match swayConfigError /.*/ + +" Group mode/bar +syn keyword swayConfigBlockKeyword set input contained +syn region swayConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,swayConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend + +" binding +syn keyword swayConfigBindKeyword bindswitch bindgesture contained +syn match swayConfigBind /^\s*\(bindswitch\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,swayConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword,i3ConfigBorderStyleKeyword + +" bindgestures +syn keyword swayConfigBindGestureCommand swipe pinch hold contained +syn keyword swayConfigBindGestureDirection up down left right next prev contained +syn keyword swayConfigBindGesturePinchDirection inward outward clockwise counterclockwise contained +syn match swayConfigBindGestureHold /^\s*\(bindgesture\)\s\+hold\(:[1-5]\)\?\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction +syn match swayConfigBindGestureSwipe /^\s*\(bindgesture\)\s\+swipe\(:[1-5]\)\?:\(up\|down\|left\|right\)\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction +syn match swayConfigBindGesturePinch /^\s*\(bindgesture\)\s\+\(pinch\):.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigBindGesturePinchDirection,i3ConfigWorkspaceKeyword,i3ConfigAction + +" floating +syn keyword swayConfigFloatingKeyword floating contained +syn match swayConfigFloating /^\s*floating\s\+\(enable\|disable\|toggle\)\s*$/ contains=swayConfigFloatingKeyword + +syn clear i3ConfigFloatingModifier +syn keyword swayConfigFloatingModifier floating_modifier contained +syn match swayConfigFloatingMouseAction /^\s\?.*floating_modifier\s.*\(normal\|inverted\)$/ contains=swayConfigFloatingModifier,i3ConfigVariable + +" Gaps +syn clear i3ConfigSmartBorderKeyword +syn clear i3ConfigSmartBorder +syn keyword swayConfigSmartBorderKeyword on no_gaps off contained +syn match swayConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\|off\)\s\?$/ contains=swayConfigSmartBorderKeyword + +" Changing colors +syn keyword swayConfigClientColorKeyword focused_tab_title contained +syn match swayConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=i3ConfigClientColorKeyword,i3ConfigColor,i3ConfigVariable,i3ConfigClientColorKeyword,swayConfigClientColorKeyword + +" set display outputs +syn match swayConfigOutput /^\s*output\s\+.*$/ contains=i3ConfigOutput + +" set display focus +syn keyword swayConfigFocusKeyword focus contained +syn keyword swayConfigFocusType output contained +syn match swayConfigFocus /^\s*focus\soutput\s.*$/ contains=swayConfigFocusKeyword,swayConfigFocusType + +" xwayland +syn keyword swayConfigXwaylandKeyword xwayland contained +syn match swayConfigXwaylandModifier /^\s*xwayland\s\+\(enable\|disable\|force\)\s\?$/ contains=swayConfigXwaylandKeyword + +"hi def link swayConfigError Error +hi def link i3ConfigFloating Error +hi def link swayConfigFloating Type +hi def link swayConfigFloatingMouseAction Type +hi def link swayConfigFocusKeyword Type +hi def link swayConfigSmartBorderKeyword Type +hi def link swayConfigBindGestureCommand Identifier +hi def link swayConfigBindGestureDirection Constant +hi def link swayConfigBindGesturePinchDirection Constant +hi def link swayConfigBindKeyword Identifier +hi def link swayConfigBlockKeyword Identifier +hi def link swayConfigClientColorKeyword Identifier +hi def link swayConfigFloatingKeyword Identifier +hi def link swayConfigFloatingModifier Identifier +hi def link swayConfigFocusType Identifier +hi def link swayConfigSmartBorder Identifier +hi def link swayConfigXwaylandKeyword Identifier +hi def link swayConfigXwaylandModifier Type +hi def link swayConfigBindGesture PreProc + +let b:current_syntax = "swayconfig" -- cgit From 29d5ca7d66796a306f63d454ad1588df8c58e5aa Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Jul 2022 16:11:02 +0200 Subject: vim-patch:9.0.0111: "nocombine" is missing from synIDattr() Problem: "nocombine" is missing from synIDattr(). Solution: Add "nocombine". (Munif Tanjim, closes vim/vim#10816) https://github.com/vim/vim/commit/de78632c41d870d5254e9ccd285f53674b955f4e --- runtime/doc/builtin.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 9d33c442c2..f973277b54 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -8041,6 +8041,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* "underdotted" "1" if dotted underlined "underdashed" "1" if dashed underlined "strikethrough" "1" if struckthrough + "nocombine" "1" if nocombine Example (echoes the color of the syntax item under the cursor): > -- cgit From abc087f4c65ca547cae58518b42aee82ff4a07f6 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 31 Jul 2022 10:46:38 +0200 Subject: docs: fix typos (#19024) Co-authored-by: zeertzjq Co-authored-by: Valery Viktorovsky --- runtime/doc/api.txt | 6 +++--- runtime/doc/builtin.txt | 11 +++++------ runtime/doc/diagnostic.txt | 12 ++++++------ runtime/doc/options.txt | 6 +++--- runtime/doc/usr_06.txt | 1 - runtime/lua/vim/diagnostic.lua | 8 ++++---- 6 files changed, 21 insertions(+), 23 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 9758959f4e..1426404da9 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1968,7 +1968,7 @@ nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()* Option value nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()* - Sets a buffer option value. Passing 'nil' as value deletes the + Sets a buffer option value. Passing `nil` as value deletes the option (only works if there's a global fallback) Parameters: ~ @@ -2075,8 +2075,8 @@ nvim_win_get_option({window}, {name}) *nvim_win_get_option()* Option value nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()* - Sets a window option value. Passing 'nil' as value deletes the - option(only works if there's a global fallback) + Sets a window option value. Passing `nil` as value deletes the + option (only works if there's a global fallback) Parameters: ~ {window} Window handle, or 0 for current window diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index f973277b54..f844ae5aaf 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6674,7 +6674,6 @@ setbufline({buf}, {lnum}, {text}) *setbufline()* |bufload()| if needed. To insert lines use |appendbufline()|. - Any text properties in {lnum} are cleared. {text} can be a string to set one line, or a list of strings to set multiple lines. If the list extends below the last @@ -8012,10 +8011,10 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* The result is a String, which is the {what} attribute of syntax ID {synID}. This can be used to obtain information about a syntax item. - {mode} can be "gui", "cterm" or "term", to get the attributes + {mode} can be "gui" or "cterm", to get the attributes for that mode. When {mode} is omitted, or an invalid value is used, the attributes for the currently active highlighting are - used (GUI, cterm or term). + used (GUI or cterm). Use synIDtrans() to follow linked highlight groups. {what} result "name" the name of the syntax item @@ -8040,15 +8039,15 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* "underdouble" "1" if double underlined "underdotted" "1" if dotted underlined "underdashed" "1" if dashed underlined - "strikethrough" "1" if struckthrough + "strikethrough" "1" if struckthrough "nocombine" "1" if nocombine + Returns an empty string on error. + Example (echoes the color of the syntax item under the cursor): > :echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg") < - Returns an empty string on error. - Can also be used as a |method|: > :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg") diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 2446506dec..7fb10f2a66 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -74,7 +74,7 @@ Functions that take a severity as an optional parameter (e.g. 2. A table with a "min" or "max" key (or both): > - vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN} }) + vim.diagnostic.get(0, { severity = { min = vim.diagnostic.severity.WARN } }) The latter form allows users to specify a range of severities. @@ -298,7 +298,7 @@ EVENTS *diagnostic-events* DiagnosticChanged After diagnostics have changed. Example: > - autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({open = false }) + autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({ open = false }) < ============================================================================== Lua module: vim.diagnostic *diagnostic-api* @@ -315,12 +315,12 @@ config({opts}, {namespace}) *vim.diagnostic.config()* For example, if a user enables virtual text globally with > - vim.diagnostic.config({virtual_text = true}) + vim.diagnostic.config({ virtual_text = true }) < and a diagnostic producer sets diagnostics with > - vim.diagnostic.set(ns, 0, diagnostics, {virtual_text = false}) + vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false }) < then virtual text will not be enabled for those diagnostics. @@ -570,8 +570,8 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults}) local s = "WARNING filename:27:3: Variable 'foo' does not exist" local pattern = "^(%w+) %w+:(%d+):(%d+): (.+)$" - local groups = {"severity", "lnum", "col", "message"} - vim.diagnostic.match(s, pattern, groups, {WARNING = vim.diagnostic.WARN}) + local groups = { "severity", "lnum", "col", "message" } + vim.diagnostic.match(s, pattern, groups, { WARNING = vim.diagnostic.WARN }) < Parameters: ~ diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 68723e4889..f29828921d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3571,7 +3571,7 @@ A jump table for the options with a short description can be found at |Q_op|. help. (Note that previously setting the global option to the empty value did this, which is now deprecated.) When the first character is ":", the command is invoked as a Vim - Ex command with [count] added as an argument if it is not zero. + Ex command prefixed with [count]. 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. @@ -4210,14 +4210,14 @@ A jump table for the options with a short description can be found at |Q_op|. The 'mousemodel' option is set by the |:behave| command. - *mousescroll* + *'mousescroll'* 'mousescroll' string (default "ver:3,hor:6") global This option controls the number of lines / columns to scroll by when scrolling with a mouse. The option is a comma separated list of parts. Each part consists of a direction and a count as follows: direction:count,direction:count - Direction is one of either "hor" or "ver", "hor" controls horizontal + Direction is one of either "hor" or "ver". "hor" controls horizontal scrolling and "ver" controls vertical scrolling. Count sets the amount to scroll by for the given direction, it should be a non negative integer. Each direction should be set at most once. If a direction diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index b99e0fb482..8eda33b4f0 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -135,7 +135,6 @@ You could also write your own color scheme. This is how you do it: 2. Edit the color scheme file. These entries are useful: - term attributes in a B&W terminal cterm attributes in a color terminal ctermfg foreground color in a color terminal ctermbg background color in a color terminal diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index ae20b5c517..3f71d4f70d 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -586,12 +586,12 @@ end --- --- For example, if a user enables virtual text globally with ---
----   vim.diagnostic.config({virtual_text = true})
+---   vim.diagnostic.config({ virtual_text = true })
 --- 
--- --- and a diagnostic producer sets diagnostics with ---
----   vim.diagnostic.set(ns, 0, diagnostics, {virtual_text = false})
+---   vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false })
 --- 
--- --- then virtual text will not be enabled for those diagnostics. @@ -1525,8 +1525,8 @@ end ---
 --- local s = "WARNING filename:27:3: Variable 'foo' does not exist"
 --- local pattern = "^(%w+) %w+:(%d+):(%d+): (.+)$"
---- local groups = {"severity", "lnum", "col", "message"}
---- vim.diagnostic.match(s, pattern, groups, {WARNING = vim.diagnostic.WARN})
+--- local groups = { "severity", "lnum", "col", "message" }
+--- vim.diagnostic.match(s, pattern, groups, { WARNING = vim.diagnostic.WARN })
 --- 
--- ---@param str string String to parse diagnostics from. -- cgit From 81a1d26c3eee816abaa3d0e611a8b1a0e473d3a1 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 31 Jul 2022 17:06:32 +0900 Subject: vim-patch:9.0.0114: the command line takes up space even when not used Problem: The command line takes up space even when not used. Solution: Allow for 'cmdheight' to be set to zero. (Shougo Matsushita, closes vim/vim#10675, closes vim/vim#940) https://github.com/vim/vim/commit/f39cfb72629f3e7fefaf578a3faa2619cd0654f8 Omit win_redr_ruler() change: winbar may still need redraw. Omit win_update() changes: Nvim doesn't use `Rows` there. Omit redraw_asap(): removed. --- runtime/doc/options.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f29828921d..04ba9539c5 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1314,14 +1314,14 @@ A jump table for the options with a short description can be found at |Q_op|. *'cmdheight'* *'ch'* 'cmdheight' 'ch' number (default 1) - global + global or local to tab page Number of screen lines to use for the command-line. Helps avoiding |hit-enter| prompts. The value of this option is stored with the tab page, so that each tab page can have a different value. - When 'cmdheight' is zero, it disables echo area and all outputs need - |hit-enter| prompt. + When 'cmdheight' is zero, there is no command-line unless it is being + used. Any messages will cause the |hit-enter| prompt. *'cmdwinheight'* *'cwh'* 'cmdwinheight' 'cwh' number (default 7) @@ -4850,7 +4850,7 @@ A jump table for the options with a short description can be found at |Q_op|. If 'rulerformat' is set, it will determine the contents of the ruler. Each window has its own ruler. If a window has a status line, the ruler is shown there. If a window doesn't have a status line and - 'cmdheight' is 0, the ruler is not shown. Otherwise it is shown in + 'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in the last line of the screen. If the statusline is given by 'statusline' (i.e. not empty), this option takes precedence over 'ruler' and 'rulerformat'. @@ -5559,7 +5559,7 @@ A jump table for the options with a short description can be found at |Q_op|. global Show (partial) command in the last line of the screen. Set this option off if your terminal is slow. - The option is disabled if 'cmdheight' is 0. + The option has no effect when 'cmdheight' is zero. In Visual mode the size of the selected area is shown: - When selecting characters within a line, the number of characters. If the number of bytes is different it is also displayed: "2-6" @@ -5606,7 +5606,7 @@ A jump table for the options with a short description can be found at |Q_op|. global If in Insert, Replace or Visual mode put a message on the last line. The |hl-ModeMsg| highlight group determines the highlighting. - The option is disabled if 'cmdheight' is 0. + The option has no effect when 'cmdheight' is zero. *'showtabline'* *'stal'* 'showtabline' 'stal' number (default 1) -- cgit From ece0850b7393114cac651cf9f43fc2c5e1b1cf50 Mon Sep 17 00:00:00 2001 From: Gustavo Sampaio Date: Mon, 1 Aug 2022 09:13:46 -0300 Subject: fix(session): respect sessionoptions=terminal #19497 fixes #13078 Co-authored-by: Yuta Katayama <8683947+yutkat@users.noreply.github.com> --- runtime/doc/options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 04ba9539c5..ffeed6f977 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5112,7 +5112,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'sessionoptions'* *'ssop'* 'sessionoptions' 'ssop' string (default: "blank,buffers,curdir,folds, - help,tabpages,winsize") + help,tabpages,winsize,terminal") global Changes the effect of the |:mksession| command. It is a comma- separated list of words. Each word enables saving and restoring -- cgit From 9f5d5aa3da30aab40bbb38fddfc70257444d50a8 Mon Sep 17 00:00:00 2001 From: LaurenceWarne <17688577+LaurenceWarne@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:45:43 +0100 Subject: Use Strings instead of Tables in vim.filetype.matchregex Doc (#19604) docs: use strings instead of tables in vim.filetype.matchregex doc --- runtime/doc/lua.txt | 4 ++-- runtime/lua/vim/filetype.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 0e58d1b1fe..3302a00b6a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2087,9 +2087,9 @@ add({filetypes}) *vim.filetype.add()* priority = -math.huge, function(path, bufnr) local content = vim.filetype.getlines(bufnr, 1) - if vim.filetype.matchregex(content, { [[^#!.*\]] }) then + if vim.filetype.matchregex(content, [[^#!.*\]]) then return 'mine' - elseif vim.filetype.matchregex(content, { [[\]] }) then + elseif vim.filetype.matchregex(content, [[\]]) then return 'drawing' end end, diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 9c59442caf..1b209e6a9d 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2275,9 +2275,9 @@ end --- priority = -math.huge, --- function(path, bufnr) --- local content = vim.filetype.getlines(bufnr, 1) ---- if vim.filetype.matchregex(content, { [[^#!.*\\]] }) then +--- if vim.filetype.matchregex(content, [[^#!.*\\]]) then --- return 'mine' ---- elseif vim.filetype.matchregex(content, { [[\\]] }) then +--- elseif vim.filetype.matchregex(content, [[\\]]) then --- return 'drawing' --- end --- end, -- cgit From db6e93c48df551e2906c9e0f4472f9e54cea3dd9 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:35:08 +0200 Subject: feat(api): add replace_keycodes to nvim_set_keymap (#19598) --- runtime/doc/api.txt | 4 +++- runtime/doc/lua.txt | 5 +---- runtime/lua/vim/keymap.lua | 20 +++----------------- 3 files changed, 7 insertions(+), 22 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 1426404da9..aaafa21a59 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1508,7 +1508,9 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()* used to give a description to the mapping. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping - is executed. + is executed. "replace_keycodes" can be used with + "expr" to replace keycodes, see + |nvim_replace_termcodes()|. nvim_set_var({name}, {value}) *nvim_set_var()* Sets a global (g:) variable. diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 3302a00b6a..6dfb0b5791 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2228,13 +2228,10 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* • buffer: (number or boolean) Add a mapping to the given buffer. When "true" or 0, use the current buffer. - • replace_keycodes: (boolean, default true) When - both this and expr is "true", - |nvim_replace_termcodes()| is applied to the - result of Lua expr maps. • remap: (boolean) Make the mapping recursive. This is the inverse of the "noremap" option from |nvim_set_keymap()|. Default `false`. + • replace_keycodes: (boolean) defaults to true. See also: ~ |nvim_set_keymap()| diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index f4c2b507a9..3592855606 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -42,11 +42,10 @@ local keymap = {} --- listed in |nvim_set_keymap()|, this table also accepts the following keys: --- - buffer: (number or boolean) Add a mapping to the given buffer. When "true" --- or 0, use the current buffer. ---- - replace_keycodes: (boolean, default true) When both this and expr is "true", ---- |nvim_replace_termcodes()| is applied to the result of Lua expr maps. --- - remap: (boolean) Make the mapping recursive. This is the --- inverse of the "noremap" option from |nvim_set_keymap()|. --- Default `false`. +--- - replace_keycodes: (boolean) defaults to true. ---@see |nvim_set_keymap()| function keymap.set(mode, lhs, rhs, opts) vim.validate({ @@ -60,22 +59,9 @@ function keymap.set(mode, lhs, rhs, opts) local is_rhs_luaref = type(rhs) == 'function' mode = type(mode) == 'string' and { mode } or mode - if is_rhs_luaref and opts.expr then - local user_rhs = rhs - rhs = function() - local res = user_rhs() - if res == nil then - -- TODO(lewis6991): Handle this in C? - return '' - elseif opts.replace_keycodes ~= false then - return vim.api.nvim_replace_termcodes(res, true, true, true) - else - return res - end - end + if opts.expr and opts.replace_keycodes ~= false then + opts.replace_keycodes = true end - -- clear replace_keycodes from opts table - opts.replace_keycodes = nil if opts.remap == nil then -- default remap value is false -- cgit From 083865071b52d746de50294a0603bc6dbe20b3ec Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 1 Aug 2022 12:27:37 +0800 Subject: vim-patch:8.2.0807: cannot easily restore a mapping Problem: Cannot easily restore a mapping. Solution: Add mapset(). https://github.com/vim/vim/commit/4c9243f9fb708c9010867d3cc8e928f36b58509a Use MapArgument to reduce number of arguments of map_add(). N/A patches for version.c: vim-patch:8.2.0809: build failure with small features Problem: Build failure with small features. (Tony Mechelynck) Solution: Move "expr" inside #ifdef. https://github.com/vim/vim/commit/5a80f8ad5dc0b2cc63400255dcf3c63f6c1a2ef9 --- runtime/doc/builtin.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index f844ae5aaf..994f1ab7f5 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -295,6 +295,8 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) rhs of mapping {name} in mode {mode} mapcheck({name} [, {mode} [, {abbr}]]) String check for mappings matching {name} +mapset({name}, {mode}, {abbr}, {dict} + none restore mapping from |maparg()| result match({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} matches in {expr} matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) @@ -4716,6 +4718,7 @@ map({expr1}, {expr2}) *map()* Can also be used as a |method|: > mylist->map(expr2) + maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String has special @@ -4767,6 +4770,10 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* "lnum" The line number in "sid", zero if unknown. "nowait" Do not wait for other, longer mappings. (|:map-|). + "simplified" + + The dictionary can be used to restore a mapping with + |mapset()|. The mappings local to the current buffer are checked first, then the global mappings. @@ -4813,6 +4820,18 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* Can also be used as a |method|: > GetKey()->mapcheck('n') +mapset({mode}, {abbr}, {dict}) *mapset()* + Restore a mapping from a dictionary returned by |maparg()|. + {name}, {mode} and {abbr} should be the same as for the call + to |maparg()|. + {mode} is used to define the mode in which the mapping is set, + not the "mode" entry in {dict}. + Example for saving and restoring a mapping: > + let save_map = maparg('K', 'n', 0, 1) + nnoremap K somethingelse + ... + call mapset('n', 0, save_map) +< match({expr}, {pat} [, {start} [, {count}]]) *match()* 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 6963c2bdcd3cc2a2f0466b23152e80fc0d037a2c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 1 Aug 2022 14:04:55 +0800 Subject: vim-patch:8.2.0815: maparg() does not provide enough information for mapset() Problem: maparg() does not provide enough information for mapset(). Solution: Add "lhsraw" and "lhsrawalt" items. Drop "simplified" https://github.com/vim/vim/commit/9c65253fe702ea010afec11aa971acd542c35de2 vim-patch:9.0.0127: unused variable Problem: Unused variable. Solution: Remove the variable. (closes vim/vim#10829) https://github.com/vim/vim/commit/e95f22f63a1871b91e5508088e5ae4905ce28cd7 --- runtime/doc/builtin.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 994f1ab7f5..e2a8e098d2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -295,7 +295,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) rhs of mapping {name} in mode {mode} mapcheck({name} [, {mode} [, {abbr}]]) String check for mappings matching {name} -mapset({name}, {mode}, {abbr}, {dict} +mapset({mode}, {abbr}, {dict}) none restore mapping from |maparg()| result match({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} matches in {expr} @@ -4752,7 +4752,10 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is there and it is |TRUE| return a dictionary containing all the information of the mapping with the following items: - "lhs" The {lhs} of the mapping. + "lhs" The {lhs} of the mapping as it would be typed + "lhsraw" The {lhs} of the mapping as raw bytes + "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate + form, only present when it differs from "lhsraw" "rhs" The {rhs} of the mapping as typed. "silent" 1 for a |:map-silent| mapping, else 0. "noremap" 1 if the {rhs} of the mapping is not remappable. @@ -4770,7 +4773,6 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* "lnum" The line number in "sid", zero if unknown. "nowait" Do not wait for other, longer mappings. (|:map-|). - "simplified" The dictionary can be used to restore a mapping with |mapset()|. @@ -4822,8 +4824,8 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* mapset({mode}, {abbr}, {dict}) *mapset()* Restore a mapping from a dictionary returned by |maparg()|. - {name}, {mode} and {abbr} should be the same as for the call - to |maparg()|. + {mode} and {abbr} should be the same as for the call to + |maparg()|. *E460* {mode} is used to define the mode in which the mapping is set, not the "mode" entry in {dict}. Example for saving and restoring a mapping: > @@ -4831,7 +4833,11 @@ mapset({mode}, {abbr}, {dict}) *mapset()* nnoremap K somethingelse ... call mapset('n', 0, save_map) -< +< Note that if you are going to replace a map in several modes, + e.g. with `:map!`, you need to save the mapping for all of + them, since they can differe. + + match({expr}, {pat} [, {start} [, {count}]]) *match()* 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 c6181a672a2fdb2cb89ddf85b5d6ab15b10a0996 Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Mon, 1 Aug 2022 22:21:54 +0800 Subject: feat(node): add pnpm support #19461 --- runtime/autoload/health/provider.vim | 22 +++++++++++++++------- runtime/autoload/provider/node.vim | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 5cda7cfd03..d104bcfd67 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -615,10 +615,10 @@ function! s:check_node() abort return endif - if !executable('node') || (!executable('npm') && !executable('yarn')) + if !executable('node') || (!executable('npm') && !executable('yarn') && !executable('pnpm')) call health#report_warn( - \ '`node` and `npm` (or `yarn`) must be in $PATH.', - \ ['Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.']) + \ '`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 endif let node_v = get(split(s:system(['node', '-v']), "\n"), 0, '') @@ -634,15 +634,22 @@ function! s:check_node() abort let [host, err] = provider#node#Detect() if empty(host) - call health#report_warn('Missing "neovim" npm (or yarn) package.', + call health#report_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 endif call health#report_info('Nvim node.js host: '. host) - let manager = executable('npm') ? 'npm' : 'yarn' + let manager = 'npm' + if executable('yarn') + let manager = 'yarn' + elseif executable('pnpm') + let manager = 'pnpm' + endif + let latest_npm_cmd = has('win32') ? \ 'cmd /c '. manager .' info neovim --json' : \ manager .' info neovim --json' @@ -673,9 +680,10 @@ function! s:check_node() abort \ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s', \ current_npm, latest_npm), \ ['Run in shell: npm install -g neovim', - \ 'Run in shell (if you use yarn): yarn global add neovim']) + \ 'Run in shell (if you use yarn): yarn global add neovim', + \ 'Run in shell (if you use pnpm): pnpm install -g neovim']) else - call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm) + call health#report_ok('Latest "neovim" npm/yarn/pnpm package is installed: '. current_npm) endif endfunction diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 5079c07d8c..45b1dd4fd7 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -82,6 +82,13 @@ function! provider#node#Detect() abort let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts) endif + let pnpm_opts = {} + if executable('pnpm') + let pnpm_opts = deepcopy(s:NodeHandler) + let pnpm_opts.entry_point = '/neovim/bin/cli.js' + let pnpm_opts.job_id = jobstart('pnpm --loglevel silent root -g', pnpm_opts) + endif + " npm returns the directory faster, so let's check that first if !empty(npm_opts) let result = jobwait([npm_opts.job_id]) @@ -97,6 +104,13 @@ function! provider#node#Detect() abort endif endif + if !empty(pnpm_opts) + let result = jobwait([pnpm_opts.job_id]) + if result[0] == 0 && pnpm_opts.result != '' + return [pnpm_opts.result, ''] + endif + endif + return ['', 'failed to detect node'] endfunction -- cgit From 711ef4eac9e5126d37dd4acd1384b7df372d7315 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 Aug 2022 17:13:53 +0200 Subject: vim-patch:05a8061eecd9 (#19610) Update runtime files https://github.com/vim/vim/commit/05a8061eecd9969ee6cde008f54ded77462b649e --- runtime/colors/blue.vim | 4 +- runtime/colors/darkblue.vim | 4 +- runtime/colors/delek.vim | 4 +- runtime/colors/desert.vim | 8 +- runtime/colors/elflord.vim | 4 +- runtime/colors/evening.vim | 4 +- runtime/colors/habamax.vim | 519 +++++++++++++++++++++++++++++++ runtime/colors/industry.vim | 4 +- runtime/colors/koehler.vim | 4 +- runtime/colors/morning.vim | 4 +- runtime/colors/murphy.vim | 4 +- runtime/colors/pablo.vim | 4 +- runtime/colors/peachpuff.vim | 4 +- runtime/colors/quiet.vim | 707 +++++++++++++++++++++++++++++++++++++++++++ runtime/colors/ron.vim | 4 +- runtime/colors/shine.vim | 4 +- runtime/colors/slate.vim | 4 +- runtime/colors/torte.vim | 4 +- runtime/colors/zellner.vim | 4 +- 19 files changed, 1262 insertions(+), 36 deletions(-) create mode 100644 runtime/colors/habamax.vim create mode 100644 runtime/colors/quiet.vim (limited to 'runtime') diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index d072ce6058..20f87bede8 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: Sat 11 Jun 2022 11:16:14 MSK +" Last Updated: 2022-07-26 15:49:58 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'blue' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#870000', '#006400', '#878700', '#000087', '#870087', '#008787', '#bcbcbc', '#878787', '#d70000', '#00ff00', '#ffdf00', '#5fafff', '#d787d7', '#5fffff', '#ffffff'] diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index 970a8cb060..3d24c9235a 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: Sat 11 Jun 2022 14:37:41 MSK +" Last Updated: 2022-07-26 15:49:59 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'darkblue' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#8b0000', '#90f020', '#ffa500', '#00008b', '#8b008b', '#008b8b', '#c0c0c0', '#808080', '#ffa0a0', '#90f020', '#ffff60', '#0030ff', '#ff00ff', '#90fff0', '#ffffff'] diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim index 6bc1d1f699..c15d96ef33 100644 --- a/runtime/colors/delek.vim +++ b/runtime/colors/delek.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer David Schweikert " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:50:30 2022 +" Last Updated: 2022-07-26 15:50:00 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=light hi clear let g:colors_name = 'delek' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#ffffff', '#0000ff', '#00cd00', '#cd00cd', '#008b8b', '#0000ff', '#ff1493', '#bcbcbc', '#ee0000', '#0000ff', '#00cd00', '#cd00cd', '#008b8b', '#0000ff', '#ff1493', '#000000'] diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim index 6cc7c21ceb..93bc73edec 100644 --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Hans Fugal " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:51:36 2022 +" Last Updated: 2022-07-26 15:50:01 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'desert' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#7f7f8c', '#cd5c5c', '#9acd32', '#bdb76b', '#75a0ff', '#eeee00', '#cd853f', '#666666', '#8a7f7f', '#ff0000', '#89fb98', '#f0e68c', '#6dceeb', '#ffde9b', '#ffa0a0', '#c2bfa5'] @@ -40,7 +40,7 @@ hi TabLineFill guifg=NONE guibg=#c2bfa5 gui=NONE cterm=NONE hi TabLineSel guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE hi ToolbarLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE hi ToolbarButton guifg=#333333 guibg=#ffde9b gui=bold cterm=bold -hi NonText guifg=#6dceeb guibg=NONE gui=NONE cterm=NONE +hi NonText guifg=#6dceeb guibg=#4d4d4d gui=NONE cterm=NONE hi SpecialKey guifg=#9acd32 guibg=NONE gui=NONE cterm=NONE hi Folded guifg=#eeee00 guibg=#4d4d4d gui=NONE cterm=NONE hi Visual guifg=#f0e68c guibg=#6b8e24 gui=NONE cterm=NONE @@ -112,7 +112,7 @@ if s:t_Co >= 256 hi TabLineSel ctermfg=236 ctermbg=186 cterm=NONE hi ToolbarLine ctermfg=NONE ctermbg=241 cterm=NONE hi ToolbarButton ctermfg=236 ctermbg=222 cterm=bold - hi NonText ctermfg=81 ctermbg=NONE cterm=NONE + hi NonText ctermfg=81 ctermbg=239 cterm=NONE hi SpecialKey ctermfg=112 ctermbg=NONE cterm=NONE hi Folded ctermfg=226 ctermbg=239 cterm=NONE hi Visual ctermfg=186 ctermbg=64 cterm=NONE diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim index 54a6afbd79..f6e66ab06e 100644 --- a/runtime/colors/elflord.vim +++ b/runtime/colors/elflord.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:48:00 2022 +" Last Updated: 2022-07-26 15:50:02 " Generated by Colortemplate v2.2.0 @@ -12,7 +12,7 @@ set background=dark hi clear let g:colors_name = 'elflord' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 hi! link Terminal Normal hi! link Boolean Constant diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index 777c37e3ae..bc39e87b9a 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: Sun Jun 12 10:52:56 2022 +" Last Updated: 2022-07-26 15:50:03 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'evening' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#ffa500', '#2e8b57', '#ffff00', '#006faf', '#8b008b', '#008b8b', '#bebebe', '#4d4d4d', '#ff5f5f', '#00ff00', '#ffff60', '#0087ff', '#ff80ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim new file mode 100644 index 0000000000..469d1846d6 --- /dev/null +++ b/runtime/colors/habamax.vim @@ -0,0 +1,519 @@ +" Name: habamax +" Description: Hubba hubba hubba. +" Author: Maxim Kim +" Maintainer: Maxim Kim +" Website: https://github.com/vim/colorschemes +" License: Same as Vim +" Last Updated: 2022-07-26 15:50:04 + +" Generated by Colortemplate v2.2.0 + +set background=dark + +hi clear +let g:colors_name = 'habamax' + +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 + +if (has('termguicolors') && &termguicolors) || has('gui_running') + let g:terminal_ansi_colors = ['#1c1c1c', '#d75f5f', '#87af87', '#afaf87', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#df875f', '#afd7af', '#dfdf87', '#87afd7', '#dfafdf', '#87afaf', '#bcbcbc'] +endif +hi! link Terminal Normal +hi! link StatuslineTerm Statusline +hi! link StatuslineTermNC StatuslineNC +hi! link javaScriptFunction Statement +hi! link javaScriptIdentifier Statement +hi! link sqlKeyword Statement +hi! link yamlBlockMappingKey Statement +hi! link rubyMacro Statement +hi! link rubyDefine Statement +hi! link vimVar Normal +hi! link vimOper Normal +hi! link vimSep Normal +hi! link vimParenSep Normal +hi! link vimCommentString Comment +hi! link gitCommitSummary Title +hi! link markdownUrl String +hi! link elixirOperator Statement +hi! link elixirKeyword Statement +hi! link elixirBlockDefinition Statement +hi! link elixirDefine Statement +hi! link elixirPrivateDefine Statement +hi! link elixirGuard Statement +hi! link elixirPrivateGuard Statement +hi! link elixirModuleDefine Statement +hi! link elixirProtocolDefine Statement +hi! link elixirImplDefine Statement +hi! link elixirRecordDefine Statement +hi! link elixirPrivateRecordDefine Statement +hi! link elixirMacroDefine Statement +hi! link elixirPrivateMacroDefine Statement +hi! link elixirDelegateDefine Statement +hi! link elixirOverridableDefine Statement +hi! link elixirExceptionDefine Statement +hi! link elixirCallbackDefine Statement +hi! link elixirStructDefine Statement +hi! link elixirExUnitMacro Statement +hi! link elixirInclude Statement +hi! link elixirAtom PreProc +hi! link elixirDocTest String +hi ALEErrorSign guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE +hi ALEInfoSign guifg=#dfdf87 guibg=NONE gui=NONE cterm=NONE +hi ALEWarningSign guifg=#af87af guibg=NONE gui=NONE cterm=NONE +hi ALEError guifg=#1c1c1c guibg=#d75f5f gui=NONE cterm=NONE +hi ALEVirtualTextError guifg=#1c1c1c guibg=#d75f5f gui=NONE cterm=NONE +hi ALEWarning guifg=#1c1c1c guibg=#af87af gui=NONE cterm=NONE +hi ALEVirtualTextWarning guifg=#1c1c1c guibg=#af87af gui=NONE cterm=NONE +hi ALEInfo guifg=#dfdf87 guibg=NONE gui=NONE cterm=NONE +hi ALEVirtualTextInfo guifg=#dfdf87 guibg=NONE gui=NONE cterm=NONE +hi Normal guifg=#bcbcbc guibg=#1c1c1c gui=NONE cterm=NONE +hi Statusline guifg=#1c1c1c guibg=#9e9e9e gui=NONE cterm=NONE +hi StatuslineNC guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE +hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE +hi TabLine guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE +hi TabLineFill guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE +hi TabLineSel guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi ToolbarButton guifg=#9e9e9e guibg=#1c1c1c gui=bold,reverse cterm=bold,reverse +hi QuickFixLine guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE +hi CursorLineNr guifg=#ffaf5f guibg=NONE gui=bold cterm=bold +hi LineNr guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi LineNrAbove guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi LineNrBelow guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi NonText guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi SpecialKey guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi FoldColumn guifg=#585858 guibg=NONE gui=NONE cterm=NONE +hi Visual guifg=#1c1c1c guibg=#87afaf gui=NONE cterm=NONE +hi VisualNOS guifg=#1c1c1c guibg=#5f8787 gui=NONE cterm=NONE +hi Pmenu guifg=NONE guibg=#262626 gui=NONE cterm=NONE +hi PmenuThumb guifg=NONE guibg=#767676 gui=NONE cterm=NONE +hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi PmenuSel guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE +hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Error guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse +hi ErrorMsg guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse +hi ModeMsg guifg=#1c1c1c guibg=#dfdf87 gui=NONE cterm=NONE +hi MoreMsg guifg=#87af87 guibg=NONE gui=NONE cterm=NONE +hi Question guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE +hi WarningMsg guifg=#df875f guibg=NONE gui=NONE cterm=NONE +hi Todo guifg=#dfdf87 guibg=#1c1c1c gui=reverse cterm=reverse +hi MatchParen guifg=#5f8787 guibg=#1c1c1c gui=reverse cterm=reverse +hi Search guifg=#1c1c1c guibg=#87af87 gui=NONE cterm=NONE +hi IncSearch guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE +hi CurSearch guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE +hi WildMenu guifg=#1c1c1c guibg=#dfdf87 gui=NONE cterm=NONE +hi debugPC guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE +hi debugBreakpoint guifg=#1c1c1c guibg=#df875f gui=NONE cterm=NONE +hi Cursor guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE +hi lCursor guifg=#1c1c1c guibg=#5fff00 gui=NONE cterm=NONE +hi CursorLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE +hi CursorColumn guifg=NONE guibg=#303030 gui=NONE cterm=NONE +hi Folded guifg=#9e9e9e guibg=#262626 gui=NONE cterm=NONE +hi ColorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE +hi SpellBad guifg=NONE guibg=NONE guisp=#d75f5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellCap guifg=NONE guibg=NONE guisp=#5f87af gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellLocal guifg=NONE guibg=NONE guisp=#87af87 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellRare guifg=NONE guibg=NONE guisp=#dfafdf gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi Comment guifg=#767676 guibg=NONE gui=NONE cterm=NONE +hi Constant guifg=#df875f guibg=NONE gui=NONE cterm=NONE +hi String guifg=#87af87 guibg=NONE gui=NONE cterm=NONE +hi Character guifg=#afd7af guibg=NONE gui=NONE cterm=NONE +hi Identifier guifg=#87afaf guibg=NONE gui=NONE cterm=NONE +hi Statement guifg=#af87af guibg=NONE gui=NONE cterm=NONE +hi PreProc guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE +hi Type guifg=#87afd7 guibg=NONE gui=NONE cterm=NONE +hi Special guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE +hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +hi Title guifg=#dfdf87 guibg=NONE gui=bold cterm=bold +hi Directory guifg=#87afaf guibg=NONE gui=bold cterm=bold +hi Conceal guifg=#767676 guibg=NONE gui=NONE cterm=NONE +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=#000000 guibg=#87af87 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 diffSubname guifg=#af87af guibg=NONE gui=NONE cterm=NONE +hi DiffText guifg=#000000 guibg=#dfdfdf gui=NONE cterm=NONE +hi DiffChange guifg=#000000 guibg=#afafaf gui=NONE cterm=NONE + +if s:t_Co >= 256 + hi! link Terminal Normal + hi! link StatuslineTerm Statusline + hi! link StatuslineTermNC StatuslineNC + hi! link javaScriptFunction Statement + hi! link javaScriptIdentifier Statement + hi! link sqlKeyword Statement + hi! link yamlBlockMappingKey Statement + hi! link rubyMacro Statement + hi! link rubyDefine Statement + hi! link vimVar Normal + hi! link vimOper Normal + hi! link vimSep Normal + hi! link vimParenSep Normal + hi! link vimCommentString Comment + hi! link gitCommitSummary Title + hi! link markdownUrl String + hi! link elixirOperator Statement + hi! link elixirKeyword Statement + hi! link elixirBlockDefinition Statement + hi! link elixirDefine Statement + hi! link elixirPrivateDefine Statement + hi! link elixirGuard Statement + hi! link elixirPrivateGuard Statement + hi! link elixirModuleDefine Statement + hi! link elixirProtocolDefine Statement + hi! link elixirImplDefine Statement + hi! link elixirRecordDefine Statement + hi! link elixirPrivateRecordDefine Statement + hi! link elixirMacroDefine Statement + hi! link elixirPrivateMacroDefine Statement + hi! link elixirDelegateDefine Statement + hi! link elixirOverridableDefine Statement + hi! link elixirExceptionDefine Statement + hi! link elixirCallbackDefine Statement + hi! link elixirStructDefine Statement + hi! link elixirExUnitMacro Statement + hi! link elixirInclude Statement + hi! link elixirAtom PreProc + hi! link elixirDocTest String + hi ALEErrorSign ctermfg=167 ctermbg=NONE cterm=NONE + hi ALEInfoSign ctermfg=186 ctermbg=NONE cterm=NONE + hi ALEWarningSign ctermfg=139 ctermbg=NONE cterm=NONE + hi ALEError ctermfg=234 ctermbg=167 cterm=NONE + hi ALEVirtualTextError ctermfg=234 ctermbg=167 cterm=NONE + hi ALEWarning ctermfg=234 ctermbg=139 cterm=NONE + hi ALEVirtualTextWarning ctermfg=234 ctermbg=139 cterm=NONE + hi ALEInfo ctermfg=186 ctermbg=NONE cterm=NONE + hi ALEVirtualTextInfo ctermfg=186 ctermbg=NONE cterm=NONE + hi Normal ctermfg=250 ctermbg=234 cterm=NONE + hi Statusline ctermfg=234 ctermbg=247 cterm=NONE + hi StatuslineNC ctermfg=234 ctermbg=243 cterm=NONE + hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE + hi TabLine ctermfg=234 ctermbg=243 cterm=NONE + hi TabLineFill ctermfg=234 ctermbg=243 cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=247 ctermbg=234 cterm=bold,reverse + hi QuickFixLine ctermfg=234 ctermbg=67 cterm=NONE + hi CursorLineNr ctermfg=215 ctermbg=NONE cterm=bold + hi LineNr ctermfg=240 ctermbg=NONE cterm=NONE + hi LineNrAbove ctermfg=240 ctermbg=NONE cterm=NONE + hi LineNrBelow ctermfg=240 ctermbg=NONE cterm=NONE + hi NonText ctermfg=240 ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE + hi SpecialKey ctermfg=240 ctermbg=NONE cterm=NONE + hi FoldColumn ctermfg=240 ctermbg=NONE cterm=NONE + hi Visual ctermfg=234 ctermbg=109 cterm=NONE + hi VisualNOS ctermfg=234 ctermbg=66 cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=235 cterm=NONE + hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE + hi PmenuSel ctermfg=234 ctermbg=144 cterm=NONE + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=167 ctermbg=234 cterm=reverse + hi ErrorMsg ctermfg=167 ctermbg=234 cterm=reverse + hi ModeMsg ctermfg=234 ctermbg=186 cterm=NONE + hi MoreMsg ctermfg=108 ctermbg=NONE cterm=NONE + hi Question ctermfg=144 ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=173 ctermbg=NONE cterm=NONE + hi Todo ctermfg=186 ctermbg=234 cterm=reverse + hi MatchParen ctermfg=66 ctermbg=234 cterm=reverse + hi Search ctermfg=234 ctermbg=108 cterm=NONE + hi IncSearch ctermfg=234 ctermbg=215 cterm=NONE + hi CurSearch ctermfg=234 ctermbg=144 cterm=NONE + hi WildMenu ctermfg=234 ctermbg=186 cterm=NONE + hi debugPC ctermfg=234 ctermbg=67 cterm=NONE + hi debugBreakpoint ctermfg=234 ctermbg=173 cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=236 cterm=NONE + hi CursorColumn ctermfg=NONE ctermbg=236 cterm=NONE + hi Folded ctermfg=247 ctermbg=235 cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=235 cterm=NONE + hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=67 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=108 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=182 ctermbg=NONE cterm=underline + hi Comment ctermfg=243 ctermbg=NONE cterm=NONE + hi Constant ctermfg=173 ctermbg=NONE cterm=NONE + hi String ctermfg=108 ctermbg=NONE cterm=NONE + hi Character ctermfg=151 ctermbg=NONE cterm=NONE + hi Identifier ctermfg=109 ctermbg=NONE cterm=NONE + hi Statement ctermfg=139 ctermbg=NONE cterm=NONE + hi PreProc ctermfg=144 ctermbg=NONE cterm=NONE + hi Type ctermfg=110 ctermbg=NONE cterm=NONE + hi Special ctermfg=66 ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi Title ctermfg=186 ctermbg=NONE cterm=bold + hi Directory ctermfg=109 ctermbg=NONE cterm=bold + hi Conceal ctermfg=243 ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Debug ctermfg=66 ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=16 ctermbg=108 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 diffSubname ctermfg=139 ctermbg=NONE cterm=NONE + hi DiffText ctermfg=16 ctermbg=254 cterm=NONE + hi DiffChange ctermfg=16 ctermbg=145 cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 16 + hi ALEErrorSign ctermfg=darkred ctermbg=NONE cterm=NONE + hi ALEInfoSign ctermfg=yellow ctermbg=NONE cterm=NONE + hi ALEWarningSign ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi ALEError ctermfg=black ctermbg=darkred cterm=NONE + hi ALEVirtualTextError ctermfg=black ctermbg=darkred cterm=NONE + hi ALEWarning ctermfg=black ctermbg=darkmagenta cterm=NONE + hi ALEVirtualTextWarning ctermfg=black ctermbg=darkmagenta cterm=NONE + hi ALEInfo ctermfg=yellow ctermbg=NONE cterm=NONE + hi ALEVirtualTextInfo ctermfg=yellow ctermbg=NONE cterm=NONE + hi Normal ctermfg=white ctermbg=black cterm=NONE + hi Statusline ctermfg=black ctermbg=gray cterm=NONE + hi StatuslineNC ctermfg=black ctermbg=darkgray cterm=NONE + hi VertSplit ctermfg=darkgray ctermbg=darkgray cterm=NONE + hi TabLine ctermfg=black ctermbg=darkgray cterm=NONE + hi TabLineFill ctermfg=black ctermbg=darkgray cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse + hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE + hi CursorLineNr ctermfg=red ctermbg=NONE cterm=bold + hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi LineNrAbove ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi LineNrBelow ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi NonText ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi Visual ctermfg=black ctermbg=cyan cterm=NONE + hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=darkgrey cterm=NONE + hi PmenuThumb ctermfg=NONE ctermbg=darkgray cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=darkred ctermbg=black cterm=reverse + hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse + hi ModeMsg ctermfg=black ctermbg=yellow cterm=NONE + hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE + hi Todo ctermfg=yellow ctermbg=black cterm=reverse + hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse + hi Search ctermfg=black ctermbg=darkgreen cterm=NONE + hi IncSearch ctermfg=black ctermbg=red cterm=NONE + hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE + hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE + hi debugPC ctermfg=black ctermbg=blue cterm=NONE + hi debugBreakpoint ctermfg=black ctermbg=red cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE + hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline + hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline + hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline + hi Comment ctermfg=darkgray ctermbg=NONE cterm=NONE + hi Constant ctermfg=red ctermbg=NONE cterm=NONE + hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Character ctermfg=green ctermbg=NONE cterm=NONE + hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE + hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi Type ctermfg=blue ctermbg=NONE cterm=NONE + hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi Title ctermfg=yellow ctermbg=NONE cterm=bold + hi Directory ctermfg=cyan ctermbg=NONE cterm=bold + hi Conceal ctermfg=darkgray ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=black 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 diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi DiffText ctermfg=black ctermbg=lightgrey cterm=NONE + hi DiffChange ctermfg=black ctermbg=darkgray cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 8 + hi Normal ctermfg=gray ctermbg=black cterm=NONE + hi Statusline ctermfg=gray ctermbg=black cterm=bold,reverse + hi StatuslineNC ctermfg=gray ctermbg=black cterm=reverse + hi VertSplit ctermfg=gray ctermbg=black cterm=reverse + hi TabLine ctermfg=black ctermbg=gray cterm=NONE + hi TabLineFill ctermfg=black ctermbg=gray cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse + hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE + hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold + hi LineNr ctermfg=gray ctermbg=NONE cterm=bold + hi LineNrAbove ctermfg=gray ctermbg=NONE cterm=bold + hi LineNrBelow ctermfg=gray ctermbg=NONE cterm=bold + hi NonText ctermfg=gray ctermbg=NONE cterm=bold + hi EndOfBuffer ctermfg=gray ctermbg=NONE cterm=bold + hi SpecialKey ctermfg=gray ctermbg=NONE cterm=bold + hi FoldColumn ctermfg=gray ctermbg=NONE cterm=bold + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=reverse + hi Pmenu ctermfg=black ctermbg=gray cterm=NONE + hi PmenuThumb ctermfg=gray ctermbg=black cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=gray cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=darkred ctermbg=gray cterm=bold,reverse + hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=bold,reverse + hi ModeMsg ctermfg=black ctermbg=darkyellow cterm=NONE + hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE + hi Todo ctermfg=darkyellow ctermbg=black cterm=reverse + hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse + hi Search ctermfg=black ctermbg=darkgreen cterm=NONE + hi IncSearch ctermfg=black ctermbg=darkyellow cterm=NONE + hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE + hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE + hi debugPC ctermfg=black ctermbg=blue cterm=NONE + hi debugBreakpoint ctermfg=black ctermbg=darkcyan cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE + hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi SpellBad ctermfg=darkred ctermbg=gray cterm=reverse + hi SpellCap ctermfg=blue ctermbg=gray cterm=reverse + hi SpellLocal ctermfg=darkgreen ctermbg=black cterm=reverse + hi SpellRare ctermfg=darkmagenta ctermbg=gray cterm=reverse + hi Comment ctermfg=gray ctermbg=NONE cterm=bold + hi Constant ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Character ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Identifier ctermfg=gray ctermbg=NONE cterm=NONE + hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi Type ctermfg=blue ctermbg=NONE cterm=NONE + hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi Title ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold + hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=black 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 diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi DiffText ctermfg=white ctermbg=black cterm=bold,reverse + hi DiffChange ctermfg=black ctermbg=white cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 0 + hi Normal term=NONE + hi ColorColumn term=reverse + hi Conceal term=NONE + hi Cursor term=reverse + hi CursorColumn term=NONE + hi CursorLine term=underline + hi CursorLineNr term=bold + hi DiffAdd term=reverse + hi DiffChange term=NONE + hi DiffDelete term=reverse + hi DiffText term=reverse + hi Directory term=NONE + hi EndOfBuffer term=NONE + hi ErrorMsg term=bold,reverse + hi FoldColumn term=NONE + hi Folded term=NONE + hi IncSearch term=bold,reverse,underline + hi LineNr term=NONE + hi MatchParen term=bold,underline + hi ModeMsg term=bold + hi MoreMsg term=NONE + hi NonText term=NONE + hi Pmenu term=reverse + hi PmenuSbar term=reverse + hi PmenuSel term=bold + hi PmenuThumb term=NONE + hi Question term=standout + hi Search term=reverse + hi SignColumn term=reverse + hi SpecialKey term=bold + hi SpellBad term=underline + hi SpellCap term=underline + hi SpellLocal term=underline + hi SpellRare term=underline + hi StatusLine term=bold,reverse + hi StatusLineNC term=bold,underline + hi TabLine term=bold,underline + hi TabLineFill term=NONE + hi Terminal term=NONE + hi TabLineSel term=bold,reverse + hi Title term=NONE + hi VertSplit term=NONE + hi Visual term=reverse + hi VisualNOS term=NONE + hi WarningMsg term=standout + hi WildMenu term=bold + hi CursorIM term=NONE + hi ToolbarLine term=reverse + hi ToolbarButton term=bold,reverse + hi CurSearch term=reverse + hi CursorLineFold term=underline + hi CursorLineSign term=underline + hi Comment term=bold + hi Constant term=NONE + hi Error term=bold,reverse + hi Identifier term=NONE + hi Ignore term=NONE + hi PreProc term=NONE + hi Special term=NONE + hi Statement term=NONE + hi Todo term=bold,reverse + hi Type term=NONE + hi Underlined term=underline + unlet s:t_Co + finish +endif + +" Background: dark +" Color: color00 #1C1C1C 234 black +" Color: color08 #767676 243 darkgray +" Color: color01 #D75F5F 167 darkred +" Color: color09 #DF875F 173 red +" Color: color02 #87AF87 108 darkgreen +" Color: color10 #AFD7AF 151 green +" Color: color03 #AFAF87 144 darkyellow +" Color: color11 #DFDF87 186 yellow +" Color: color04 #5F87AF 67 blue +" Color: color12 #87AFD7 110 blue +" Color: color05 #AF87AF 139 darkmagenta +" Color: color13 #DFAFDF 182 magenta +" Color: color06 #5F8787 66 darkcyan +" Color: color14 #87AFAF 109 cyan +" Color: color07 #9E9E9E 247 gray +" Color: color15 #BCBCBC 250 white +" Color: colorLine #303030 236 darkgrey +" Color: colorB #262626 235 darkgrey +" Color: colorNonT #585858 240 darkgrey +" Color: colorC #FFAF5F 215 red +" Color: colorlC #5FFF00 ~ +" Color: colorV #1F3F5F 109 cyan +" Color: diffAdd #87AF87 108 darkgreen +" Color: diffDelete #af875f 137 darkyellow +" Color: diffChange #AFAFAF 145 darkgray +" Color: diffText #DFDFDF 254 lightgrey +" Color: black #000000 16 black +" Color: white #FFFFFF 231 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 diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim index 41bfe129e7..d6678b2bb2 100644 --- a/runtime/colors/industry.vim +++ b/runtime/colors/industry.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Shian Lee. " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:53:58 2022 +" Last Updated: 2022-07-26 15:50:05 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'industry' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#303030', '#870000', '#5fd75f', '#afaf00', '#87afff', '#af00af', '#00afaf', '#6c6c6c', '#444444', '#ff0000', '#00ff00', '#ffff00', '#005fff', '#ff00ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index ecbc854030..87f1893ad7 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sat 11 Jun 2022 11:24:58 MSK +" Last Updated: 2022-07-26 15:50:06 " Generated by Colortemplate v2.2.0 @@ -12,7 +12,7 @@ set background=dark hi clear let g:colors_name = 'koehler' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 hi! link Terminal Normal hi! link Boolean Constant diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index 8a76fdf928..d32f1026f0 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Bram Moolenaar " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:55:30 2022 +" Last Updated: 2022-07-26 15:50:07 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=light hi clear let g:colors_name = 'morning' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#e4e4e4', '#a52a2a', '#ff00ff', '#6a0dad', '#008787', '#2e8b57', '#6a5acd', '#bcbcbc', '#0000ff', '#a52a2a', '#ff00ff', '#6a0dad', '#008787', '#2e8b57', '#6a5acd', '#000000'] diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index 1ba096ecec..e9f31c2c8b 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: Sun Jun 12 10:56:21 2022 +" Last Updated: 2022-07-26 15:50:08 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'murphy' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#303030', '#ffa700', '#005f00', '#ffd7af', '#87afff', '#ffafaf', '#00afaf', '#bcbcbc', '#444444', '#ff0000', '#00875f', '#ffff00', '#005fff', '#ff00ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim index 1dc086d820..ee689af25e 100644 --- a/runtime/colors/pablo.vim +++ b/runtime/colors/pablo.vim @@ -3,7 +3,7 @@ " Maintainer: Original maintainerRon Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:57:11 2022 +" Last Updated: 2022-07-26 15:50:09 " Generated by Colortemplate v2.2.0 @@ -12,7 +12,7 @@ set background=dark hi clear let g:colors_name = 'pablo' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim index a540be2734..2a925b6592 100644 --- a/runtime/colors/peachpuff.vim +++ b/runtime/colors/peachpuff.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer David Ne\v{c}as (Yeti) " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 10:58:17 2022 +" Last Updated: 2022-07-26 15:50:10 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=light hi clear let g:colors_name = 'peachpuff' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#ffdab9', '#a52a2a', '#c00058', '#cd00cd', '#008b8b', '#2e8b57', '#6a5acd', '#737373', '#406090', '#a52a2a', '#c00058', '#cd00cd', '#008b8b', '#2e8b57', '#6a5acd', '#000000'] diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim new file mode 100644 index 0000000000..2ebe5e628e --- /dev/null +++ b/runtime/colors/quiet.vim @@ -0,0 +1,707 @@ +" Name: quiet +" Description: `monochrome`, but less ugly, with diffs, searches, a few other niceties, and both light and dark versions. +" Author: neutaaaaan +" Maintainer: neutaaaaan +" Website: https://github.com/vim/colorschemes +" License: Vim License (see `:help license`)` +" Last Updated: 2022-08-01 15:13:21 + +" Generated by Colortemplate v2.2.0 + +hi clear +let g:colors_name = 'quiet' + +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 + +hi! link StatusLineTerm StatusLine +hi! link StatusLineTermNC StatusLineNC +hi! link Boolean Constant +hi! link Character Constant +hi! link Conditional Statement +hi! link Define PreProc +hi! link Debug Special +hi! link Delimiter Special +hi! link Exception Statement +hi! link Float Constant +hi! link Function Identifier +hi! link Include PreProc +hi! link Keyword Statement +hi! link Label Statement +hi! link Macro PreProc +hi! link Number Constant +hi! link Operator Statement +hi! link PreCondit PreProc +hi! link Repeat Statement +hi! link SpecialChar Special +hi! link SpecialComment Special +hi! link StorageClass Type +hi! link String Constant +hi! link Structure Type +hi! link Tag Special +hi! link Typedef Type +hi! link lCursor Cursor +hi! link debugBreakpoint ModeMsg +hi! link debugPC CursorLine + +if &background ==# 'dark' + if (has('termguicolors') && &termguicolors) || has('gui_running') + let g:terminal_ansi_colors = ['#080808', '#d7005f', '#00af5f', '#d78700', '#0087d7', '#d787d7', '#00afaf', '#dadada', '#707070', '#ff005f', '#00d75f', '#ffaf00', '#5fafff', '#ff87ff', '#00d7d7', '#ffffff'] + endif + hi Normal guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi Terminal guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi ColorColumn guifg=NONE guibg=#1c1c1c gui=NONE cterm=NONE + hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn guifg=NONE guibg=#303030 gui=NONE cterm=NONE + hi CursorLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE + hi CursorLineNr guifg=#dadada guibg=#303030 gui=NONE cterm=NONE + hi DiffAdd guifg=#00af00 guibg=#080808 gui=reverse cterm=reverse + hi DiffChange guifg=#87afd7 guibg=#080808 gui=reverse cterm=reverse + hi DiffDelete guifg=#d75f5f guibg=#080808 gui=reverse cterm=reverse + hi DiffText guifg=#d787d7 guibg=#080808 gui=reverse cterm=reverse + hi Directory guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi EndOfBuffer guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi ErrorMsg guifg=#dadada guibg=#080808 gui=reverse cterm=reverse + hi FoldColumn guifg=#707070 guibg=#080808 gui=NONE cterm=NONE + hi Folded guifg=#707070 guibg=#080808 gui=NONE cterm=NONE + hi IncSearch guifg=#ffaf00 guibg=#080808 gui=reverse cterm=reverse + hi LineNr guifg=#444444 guibg=#080808 gui=NONE cterm=NONE + hi MatchParen guifg=#ff00af guibg=#080808 gui=bold cterm=bold + hi ModeMsg guifg=#dadada guibg=#080808 gui=bold cterm=bold + hi MoreMsg guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi NonText guifg=#707070 guibg=NONE gui=NONE cterm=NONE + hi Pmenu guifg=#080808 guibg=#87afd7 gui=NONE cterm=NONE + hi PmenuSbar guifg=#dadada guibg=#707070 gui=NONE cterm=NONE + hi PmenuSel guifg=#080808 guibg=#d787d7 gui=NONE cterm=NONE + hi PmenuThumb guifg=#dadada guibg=#d787d7 gui=NONE cterm=NONE + hi Question guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi QuickFixLine guifg=#d787d7 guibg=#080808 gui=reverse cterm=reverse + hi Search guifg=#00afff guibg=#080808 gui=reverse cterm=reverse + hi SignColumn guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi SpecialKey guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi SpellBad guifg=#d7005f guibg=#080808 guisp=#d7005f gui=undercurl cterm=underline + hi SpellCap guifg=#0087d7 guibg=#080808 guisp=#0087d7 gui=undercurl cterm=underline + hi SpellLocal guifg=#d787d7 guibg=#080808 guisp=#d787d7 gui=undercurl cterm=underline + hi SpellRare guifg=#00afaf guibg=#080808 guisp=#00afaf gui=undercurl cterm=underline + hi StatusLine guifg=#080808 guibg=#dadada gui=bold cterm=bold + hi StatusLineNC guifg=#707070 guibg=#080808 gui=underline cterm=underline + hi TabLine guifg=#707070 guibg=#080808 gui=underline cterm=underline + hi TabLineFill guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi TabLineSel guifg=#080808 guibg=#dadada gui=bold cterm=bold + hi Title guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi VertSplit guifg=#707070 guibg=#080808 gui=NONE cterm=NONE + hi Visual guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS guifg=NONE guibg=#303030 gui=NONE cterm=NONE + hi WarningMsg guifg=#dadada guibg=#080808 gui=NONE cterm=NONE + hi WildMenu guifg=#00afff guibg=#080808 gui=bold cterm=bold + hi Comment guifg=#707070 guibg=#080808 gui=bold cterm=bold + hi Constant guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Error guifg=#ff005f guibg=#080808 gui=bold,reverse cterm=bold,reverse + hi Identifier guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Ignore guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi PreProc guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Special guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Statement guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Todo guifg=#00ffaf guibg=NONE gui=bold,reverse cterm=bold,reverse + hi Type guifg=#dadada guibg=NONE gui=NONE cterm=NONE + hi Underlined guifg=#dadada guibg=NONE gui=underline cterm=underline + hi CursorIM guifg=#080808 guibg=#afff00 gui=NONE cterm=NONE + hi ToolbarLine guifg=NONE guibg=#080808 gui=NONE cterm=NONE + hi ToolbarButton guifg=#dadada guibg=#080808 gui=bold cterm=bold +else + " Light background + if (has('termguicolors') && &termguicolors) || has('gui_running') + let g:terminal_ansi_colors = ['#080808', '#af0000', '#005f00', '#af5f00', '#005faf', '#870087', '#008787', '#d7d7d7', '#626262', '#d70000', '#008700', '#d78700', '#0087d7', '#af00af', '#00afaf', '#ffffff'] + endif + hi Normal guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi Terminal guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi ColorColumn guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE + hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE + hi CursorLine guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE + hi CursorLineNr guifg=#080808 guibg=#eeeeee gui=NONE cterm=NONE + hi DiffAdd guifg=#87d787 guibg=#080808 gui=reverse cterm=reverse + hi DiffChange guifg=#afafd7 guibg=#080808 gui=reverse cterm=reverse + hi DiffDelete guifg=#d78787 guibg=#080808 gui=reverse cterm=reverse + hi DiffText guifg=#d787d7 guibg=#080808 gui=reverse cterm=reverse + hi Directory guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi EndOfBuffer guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi ErrorMsg guifg=#080808 guibg=#d7d7d7 gui=reverse cterm=reverse + hi FoldColumn guifg=#626262 guibg=#d7d7d7 gui=NONE cterm=NONE + hi Folded guifg=#626262 guibg=#d7d7d7 gui=NONE cterm=NONE + hi IncSearch guifg=#ffaf00 guibg=#080808 gui=reverse cterm=reverse + hi LineNr guifg=#a8a8a8 guibg=#d7d7d7 gui=NONE cterm=NONE + hi MatchParen guifg=#ff00af guibg=#d7d7d7 gui=bold cterm=bold + hi ModeMsg guifg=#080808 guibg=#d7d7d7 gui=bold cterm=bold + hi MoreMsg guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi NonText guifg=#626262 guibg=NONE gui=NONE cterm=NONE + hi Pmenu guifg=#080808 guibg=#afafd7 gui=NONE cterm=NONE + hi PmenuSbar guifg=#080808 guibg=#626262 gui=NONE cterm=NONE + hi PmenuSel guifg=#080808 guibg=#d787d7 gui=NONE cterm=NONE + hi PmenuThumb guifg=#080808 guibg=#d787d7 gui=NONE cterm=NONE + hi Question guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi QuickFixLine guifg=#d787d7 guibg=#080808 gui=reverse cterm=reverse + hi Search guifg=#00afff guibg=#080808 gui=reverse cterm=reverse + hi SignColumn guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi SpecialKey guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi SpellBad guifg=#af0000 guibg=#d7d7d7 guisp=#af0000 gui=undercurl cterm=underline + hi SpellCap guifg=#005faf guibg=#d7d7d7 guisp=#005faf gui=undercurl cterm=underline + hi SpellLocal guifg=#870087 guibg=#d7d7d7 guisp=#870087 gui=undercurl cterm=underline + hi SpellRare guifg=#008787 guibg=#d7d7d7 guisp=#008787 gui=undercurl cterm=underline + hi StatusLine guifg=#eeeeee guibg=#080808 gui=bold cterm=bold + hi StatusLineNC guifg=#080808 guibg=#a8a8a8 gui=NONE cterm=NONE + hi TabLine guifg=#080808 guibg=#a8a8a8 gui=NONE cterm=NONE + hi TabLineFill guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi TabLineSel guifg=#eeeeee guibg=#080808 gui=bold cterm=bold + hi Title guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi VertSplit guifg=#626262 guibg=#d7d7d7 gui=NONE cterm=NONE + hi Visual guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE + hi WarningMsg guifg=#080808 guibg=#d7d7d7 gui=NONE cterm=NONE + hi WildMenu guifg=#080808 guibg=#eeeeee gui=bold cterm=bold + hi Comment guifg=#080808 guibg=#d7d7d7 gui=bold cterm=bold + hi Constant guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Error guifg=#ff005f guibg=#080808 gui=bold,reverse cterm=bold,reverse + hi Identifier guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Ignore guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi PreProc guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Special guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Statement guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Todo guifg=#00ffaf guibg=#080808 gui=bold,reverse cterm=bold,reverse + hi Type guifg=#080808 guibg=NONE gui=NONE cterm=NONE + hi Underlined guifg=#080808 guibg=NONE gui=underline cterm=underline + hi CursorIM guifg=#080808 guibg=#afff00 gui=NONE cterm=NONE + hi ToolbarLine guifg=NONE guibg=#d7d7d7 gui=NONE cterm=NONE + hi ToolbarButton guifg=#080808 guibg=#d7d7d7 gui=bold cterm=bold +endif + +if s:t_Co >= 256 + if &background ==# 'dark' + hi Normal ctermfg=253 ctermbg=232 cterm=NONE + hi Terminal ctermfg=253 ctermbg=232 cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=234 cterm=NONE + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=236 cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=236 cterm=NONE + hi CursorLineNr ctermfg=253 ctermbg=236 cterm=NONE + hi DiffAdd ctermfg=34 ctermbg=232 cterm=reverse + hi DiffChange ctermfg=110 ctermbg=232 cterm=reverse + hi DiffDelete ctermfg=167 ctermbg=232 cterm=reverse + hi DiffText ctermfg=176 ctermbg=232 cterm=reverse + hi Directory ctermfg=253 ctermbg=232 cterm=NONE + hi EndOfBuffer ctermfg=253 ctermbg=232 cterm=NONE + hi ErrorMsg ctermfg=253 ctermbg=232 cterm=reverse + hi FoldColumn ctermfg=242 ctermbg=232 cterm=NONE + hi Folded ctermfg=242 ctermbg=232 cterm=NONE + hi IncSearch ctermfg=214 ctermbg=232 cterm=reverse + hi LineNr ctermfg=238 ctermbg=232 cterm=NONE + hi MatchParen ctermfg=199 ctermbg=232 cterm=bold + hi ModeMsg ctermfg=253 ctermbg=232 cterm=bold + hi MoreMsg ctermfg=253 ctermbg=232 cterm=NONE + hi NonText ctermfg=242 ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=232 ctermbg=110 cterm=NONE + hi PmenuSbar ctermfg=253 ctermbg=242 cterm=NONE + hi PmenuSel ctermfg=232 ctermbg=176 cterm=NONE + hi PmenuThumb ctermfg=253 ctermbg=176 cterm=NONE + hi Question ctermfg=253 ctermbg=232 cterm=NONE + hi QuickFixLine ctermfg=176 ctermbg=232 cterm=reverse + hi Search ctermfg=39 ctermbg=232 cterm=reverse + hi SignColumn ctermfg=253 ctermbg=232 cterm=NONE + hi SpecialKey ctermfg=253 ctermbg=232 cterm=NONE + hi SpellBad ctermfg=161 ctermbg=232 cterm=underline + hi SpellCap ctermfg=32 ctermbg=232 cterm=underline + hi SpellLocal ctermfg=176 ctermbg=232 cterm=underline + hi SpellRare ctermfg=37 ctermbg=232 cterm=underline + hi StatusLine ctermfg=232 ctermbg=253 cterm=bold + hi StatusLineNC ctermfg=242 ctermbg=232 cterm=underline + hi TabLine ctermfg=242 ctermbg=232 cterm=underline + hi TabLineFill ctermfg=253 ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=232 ctermbg=253 cterm=bold + hi Title ctermfg=253 ctermbg=232 cterm=NONE + hi VertSplit ctermfg=242 ctermbg=232 cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=236 cterm=NONE + hi WarningMsg ctermfg=253 ctermbg=232 cterm=NONE + hi WildMenu ctermfg=39 ctermbg=232 cterm=bold + hi Comment ctermfg=242 ctermbg=232 cterm=bold + hi Constant ctermfg=253 ctermbg=NONE cterm=NONE + hi Error ctermfg=197 ctermbg=232 cterm=bold,reverse + hi Identifier ctermfg=253 ctermbg=NONE cterm=NONE + hi Ignore ctermfg=253 ctermbg=NONE cterm=NONE + hi PreProc ctermfg=253 ctermbg=NONE cterm=NONE + hi Special ctermfg=253 ctermbg=NONE cterm=NONE + hi Statement ctermfg=253 ctermbg=NONE cterm=NONE + hi Todo ctermfg=49 ctermbg=NONE cterm=bold,reverse + hi Type ctermfg=253 ctermbg=NONE cterm=NONE + hi Underlined ctermfg=253 ctermbg=NONE cterm=underline + hi CursorIM ctermfg=232 ctermbg=154 cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=232 cterm=NONE + hi ToolbarButton ctermfg=253 ctermbg=232 cterm=bold + else + " Light background + hi Normal ctermfg=232 ctermbg=188 cterm=NONE + hi Terminal ctermfg=232 ctermbg=188 cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=254 cterm=NONE + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=255 cterm=NONE + hi CursorLineNr ctermfg=232 ctermbg=255 cterm=NONE + hi DiffAdd ctermfg=114 ctermbg=232 cterm=reverse + hi DiffChange ctermfg=146 ctermbg=232 cterm=reverse + hi DiffDelete ctermfg=174 ctermbg=232 cterm=reverse + hi DiffText ctermfg=176 ctermbg=232 cterm=reverse + hi Directory ctermfg=232 ctermbg=188 cterm=NONE + hi EndOfBuffer ctermfg=232 ctermbg=188 cterm=NONE + hi ErrorMsg ctermfg=232 ctermbg=188 cterm=reverse + hi FoldColumn ctermfg=241 ctermbg=188 cterm=NONE + hi Folded ctermfg=241 ctermbg=188 cterm=NONE + hi IncSearch ctermfg=214 ctermbg=232 cterm=reverse + hi LineNr ctermfg=248 ctermbg=188 cterm=NONE + hi MatchParen ctermfg=199 ctermbg=188 cterm=bold + hi ModeMsg ctermfg=232 ctermbg=188 cterm=bold + hi MoreMsg ctermfg=232 ctermbg=188 cterm=NONE + hi NonText ctermfg=241 ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=232 ctermbg=146 cterm=NONE + hi PmenuSbar ctermfg=232 ctermbg=241 cterm=NONE + hi PmenuSel ctermfg=232 ctermbg=176 cterm=NONE + hi PmenuThumb ctermfg=232 ctermbg=176 cterm=NONE + hi Question ctermfg=232 ctermbg=188 cterm=NONE + hi QuickFixLine ctermfg=176 ctermbg=232 cterm=reverse + hi Search ctermfg=39 ctermbg=232 cterm=reverse + hi SignColumn ctermfg=232 ctermbg=188 cterm=NONE + hi SpecialKey ctermfg=232 ctermbg=188 cterm=NONE + hi SpellBad ctermfg=124 ctermbg=188 cterm=underline + hi SpellCap ctermfg=25 ctermbg=188 cterm=underline + hi SpellLocal ctermfg=90 ctermbg=188 cterm=underline + hi SpellRare ctermfg=30 ctermbg=188 cterm=underline + hi StatusLine ctermfg=255 ctermbg=232 cterm=bold + hi StatusLineNC ctermfg=232 ctermbg=248 cterm=NONE + hi TabLine ctermfg=232 ctermbg=248 cterm=NONE + hi TabLineFill ctermfg=232 ctermbg=188 cterm=NONE + hi TabLineSel ctermfg=255 ctermbg=232 cterm=bold + hi Title ctermfg=232 ctermbg=188 cterm=NONE + hi VertSplit ctermfg=241 ctermbg=188 cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=255 cterm=NONE + hi WarningMsg ctermfg=232 ctermbg=188 cterm=NONE + hi WildMenu ctermfg=232 ctermbg=255 cterm=bold + hi Comment ctermfg=232 ctermbg=188 cterm=bold + hi Constant ctermfg=232 ctermbg=NONE cterm=NONE + hi Error ctermfg=197 ctermbg=232 cterm=bold,reverse + hi Identifier ctermfg=232 ctermbg=NONE cterm=NONE + hi Ignore ctermfg=232 ctermbg=NONE cterm=NONE + hi PreProc ctermfg=232 ctermbg=NONE cterm=NONE + hi Special ctermfg=232 ctermbg=NONE cterm=NONE + hi Statement ctermfg=232 ctermbg=NONE cterm=NONE + hi Todo ctermfg=49 ctermbg=232 cterm=bold,reverse + hi Type ctermfg=232 ctermbg=NONE cterm=NONE + hi Underlined ctermfg=232 ctermbg=NONE cterm=underline + hi CursorIM ctermfg=232 ctermbg=154 cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=188 cterm=NONE + hi ToolbarButton ctermfg=232 ctermbg=188 cterm=bold + endif + unlet s:t_Co + finish +endif + +if s:t_Co >= 16 + if &background ==# 'dark' + hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Terminal ctermfg=NONE ctermbg=NONE cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold + hi DiffAdd ctermfg=2 ctermbg=0 cterm=reverse + hi DiffChange ctermfg=4 ctermbg=0 cterm=reverse + hi DiffDelete ctermfg=1 ctermbg=0 cterm=reverse + hi DiffText ctermfg=5 ctermbg=0 cterm=reverse + hi Directory ctermfg=NONE ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE + hi ErrorMsg ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Folded ctermfg=NONE ctermbg=NONE cterm=NONE + hi IncSearch ctermfg=3 ctermbg=0 cterm=bold,reverse,underline + hi LineNr ctermfg=NONE ctermbg=NONE cterm=NONE + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE + hi NonText ctermfg=NONE ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE + hi Question ctermfg=NONE ctermbg=NONE cterm=standout + hi QuickFixLine ctermfg=5 ctermbg=0 cterm=reverse + hi Search ctermfg=6 ctermbg=0 cterm=reverse + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi SpecialKey ctermfg=NONE ctermbg=NONE cterm=bold + hi SpellBad ctermfg=1 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=4 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=5 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=6 ctermbg=NONE cterm=underline + hi StatusLine ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi StatusLineNC ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Title ctermfg=NONE ctermbg=NONE cterm=NONE + hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=NONE ctermbg=NONE cterm=standout + hi WildMenu ctermfg=NONE ctermbg=NONE cterm=bold + hi Comment ctermfg=NONE ctermbg=NONE cterm=bold + hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi PreProc ctermfg=NONE ctermbg=NONE cterm=NONE + hi Special ctermfg=NONE ctermbg=NONE cterm=NONE + hi Statement ctermfg=NONE ctermbg=NONE cterm=NONE + hi Todo ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Type ctermfg=NONE ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse + hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse + else + " Light background + hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Terminal ctermfg=NONE ctermbg=NONE cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold + hi DiffAdd ctermfg=2 ctermbg=0 cterm=reverse + hi DiffChange ctermfg=4 ctermbg=0 cterm=reverse + hi DiffDelete ctermfg=1 ctermbg=0 cterm=reverse + hi DiffText ctermfg=5 ctermbg=0 cterm=reverse + hi Directory ctermfg=NONE ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE + hi ErrorMsg ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Folded ctermfg=NONE ctermbg=NONE cterm=NONE + hi IncSearch ctermfg=3 ctermbg=0 cterm=bold,reverse,underline + hi LineNr ctermfg=NONE ctermbg=NONE cterm=NONE + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE + hi NonText ctermfg=NONE ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE + hi Question ctermfg=NONE ctermbg=NONE cterm=standout + hi QuickFixLine ctermfg=5 ctermbg=0 cterm=reverse + hi Search ctermfg=6 ctermbg=0 cterm=reverse + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi SpecialKey ctermfg=NONE ctermbg=NONE cterm=bold + hi SpellBad ctermfg=1 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=4 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=5 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=6 ctermbg=NONE cterm=underline + hi StatusLine ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi StatusLineNC ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Title ctermfg=NONE ctermbg=NONE cterm=NONE + hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=NONE ctermbg=NONE cterm=standout + hi WildMenu ctermfg=NONE ctermbg=NONE cterm=bold + hi Comment ctermfg=NONE ctermbg=NONE cterm=bold + hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi PreProc ctermfg=NONE ctermbg=NONE cterm=NONE + hi Special ctermfg=NONE ctermbg=NONE cterm=NONE + hi Statement ctermfg=NONE ctermbg=NONE cterm=NONE + hi Todo ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Type ctermfg=NONE ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse + hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse + endif + unlet s:t_Co + finish +endif + +if s:t_Co >= 8 + if &background ==# 'dark' + hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Terminal ctermfg=NONE ctermbg=NONE cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold + hi DiffAdd ctermfg=2 ctermbg=0 cterm=reverse + hi DiffChange ctermfg=4 ctermbg=0 cterm=reverse + hi DiffDelete ctermfg=1 ctermbg=0 cterm=reverse + hi DiffText ctermfg=5 ctermbg=0 cterm=reverse + hi Directory ctermfg=NONE ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE + hi ErrorMsg ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Folded ctermfg=NONE ctermbg=NONE cterm=NONE + hi IncSearch ctermfg=3 ctermbg=0 cterm=bold,reverse,underline + hi LineNr ctermfg=NONE ctermbg=NONE cterm=NONE + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE + hi NonText ctermfg=NONE ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE + hi Question ctermfg=NONE ctermbg=NONE cterm=standout + hi QuickFixLine ctermfg=5 ctermbg=0 cterm=reverse + hi Search ctermfg=6 ctermbg=0 cterm=reverse + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi SpecialKey ctermfg=NONE ctermbg=NONE cterm=bold + hi SpellBad ctermfg=1 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=4 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=5 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=6 ctermbg=NONE cterm=underline + hi StatusLine ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi StatusLineNC ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Title ctermfg=NONE ctermbg=NONE cterm=NONE + hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=NONE ctermbg=NONE cterm=standout + hi WildMenu ctermfg=NONE ctermbg=NONE cterm=bold + hi Comment ctermfg=NONE ctermbg=NONE cterm=bold + hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi PreProc ctermfg=NONE ctermbg=NONE cterm=NONE + hi Special ctermfg=NONE ctermbg=NONE cterm=NONE + hi Statement ctermfg=NONE ctermbg=NONE cterm=NONE + hi Todo ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Type ctermfg=NONE ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse + hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse + else + " Light background + hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Terminal ctermfg=NONE ctermbg=NONE cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse + hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi CursorLineNr ctermfg=NONE ctermbg=NONE cterm=bold + hi DiffAdd ctermfg=2 ctermbg=0 cterm=reverse + hi DiffChange ctermfg=4 ctermbg=0 cterm=reverse + hi DiffDelete ctermfg=1 ctermbg=0 cterm=reverse + hi DiffText ctermfg=5 ctermbg=0 cterm=reverse + hi Directory ctermfg=NONE ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE + hi ErrorMsg ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi FoldColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Folded ctermfg=NONE ctermbg=NONE cterm=NONE + hi IncSearch ctermfg=3 ctermbg=0 cterm=bold,reverse,underline + hi LineNr ctermfg=NONE ctermbg=NONE cterm=NONE + hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE + hi NonText ctermfg=NONE ctermbg=NONE cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE + hi Question ctermfg=NONE ctermbg=NONE cterm=standout + hi QuickFixLine ctermfg=5 ctermbg=0 cterm=reverse + hi Search ctermfg=6 ctermbg=0 cterm=reverse + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=reverse + hi SpecialKey ctermfg=NONE ctermbg=NONE cterm=bold + hi SpellBad ctermfg=1 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=4 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=5 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=6 ctermbg=NONE cterm=underline + hi StatusLine ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi StatusLineNC ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Title ctermfg=NONE ctermbg=NONE cterm=NONE + hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE + hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse + hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=NONE ctermbg=NONE cterm=standout + hi WildMenu ctermfg=NONE ctermbg=NONE cterm=bold + hi Comment ctermfg=NONE ctermbg=NONE cterm=bold + hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi PreProc ctermfg=NONE ctermbg=NONE cterm=NONE + hi Special ctermfg=NONE ctermbg=NONE cterm=NONE + hi Statement ctermfg=NONE ctermbg=NONE cterm=NONE + hi Todo ctermfg=NONE ctermbg=NONE cterm=bold,reverse + hi Type ctermfg=NONE ctermbg=NONE cterm=NONE + hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse + hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse + endif + unlet s:t_Co + finish +endif + +if s:t_Co >= 0 + hi Normal term=NONE + hi ColorColumn term=reverse + hi Conceal term=NONE + hi Cursor term=reverse + hi CursorColumn term=NONE + hi CursorLine term=underline + hi CursorLineNr term=bold + hi DiffAdd term=reverse + hi DiffChange term=NONE + hi DiffDelete term=reverse + hi DiffText term=reverse + hi Directory term=NONE + hi EndOfBuffer term=NONE + hi ErrorMsg term=bold,reverse + hi FoldColumn term=NONE + hi Folded term=NONE + hi IncSearch term=bold,reverse,underline + hi LineNr term=NONE + hi MatchParen term=bold,underline + hi ModeMsg term=bold + hi MoreMsg term=NONE + hi NonText term=NONE + hi Pmenu term=reverse + hi PmenuSbar term=reverse + hi PmenuSel term=bold + hi PmenuThumb term=NONE + hi Question term=standout + hi Search term=reverse + hi SignColumn term=reverse + hi SpecialKey term=bold + hi SpellBad term=underline + hi SpellCap term=underline + hi SpellLocal term=underline + hi SpellRare term=underline + hi StatusLine term=bold,reverse + hi StatusLineNC term=bold,underline + hi TabLine term=bold,underline + hi TabLineFill term=NONE + hi Terminal term=NONE + hi TabLineSel term=bold,reverse + hi Title term=NONE + hi VertSplit term=NONE + hi Visual term=reverse + hi VisualNOS term=NONE + hi WarningMsg term=standout + hi WildMenu term=bold + hi CursorIM term=NONE + hi ToolbarLine term=reverse + hi ToolbarButton term=bold,reverse + hi CurSearch term=reverse + hi CursorLineFold term=underline + hi CursorLineSign term=underline + hi Comment term=bold + hi Constant term=NONE + hi Error term=bold,reverse + hi Identifier term=NONE + hi Ignore term=NONE + hi PreProc term=NONE + hi Special term=NONE + hi Statement term=NONE + hi Todo term=bold,reverse + hi Type term=NONE + hi Underlined term=underline + unlet s:t_Co + finish +endif + +" Background: dark +" Color: dark0 #080808 ~ 0 +" Color: dark1 #d7005f ~ 1 +" Color: dark2 #00af5f ~ 2 +" Color: dark3 #d78700 ~ 3 +" Color: dark4 #0087d7 ~ 4 +" Color: dark5 #d787d7 ~ 5 +" Color: dark6 #00afaf ~ 6 +" Color: dark7 #dadada ~ 7 +" Color: dark8 #707070 ~ 8 +" Color: dark9 #ff005f ~ 9 +" Color: dark10 #00d75f ~ 10 +" Color: dark11 #ffaf00 ~ 11 +" Color: dark12 #5fafff ~ 12 +" Color: dark13 #ff87ff ~ 13 +" Color: dark14 #00d7d7 ~ 14 +" Color: dark15 #ffffff ~ 15 +" Color: diffred #d75f5f ~ +" Color: diffgreen #00af00 ~ +" Color: diffblue #87afd7 ~ +" Color: diffpink #d787d7 ~ +" Color: uipink #ff00af ~ +" Color: uilime #afff00 ~ +" Color: uiteal #00ffaf ~ +" Color: uiblue #00afff ~ +" Color: uipurple #af00ff ~ +" Color: uiamber #ffaf00 ~ +" Color: uiblack #303030 ~ +" Color: yasogrey #1c1c1c ~ +" Color: linenrblack #444444 ~ +" Color: errorred #ff005f ~ +" Term colors: dark0 dark1 dark2 dark3 dark4 dark5 dark6 dark7 +" Term colors: dark8 dark9 dark10 dark11 dark12 dark13 dark14 dark15 +" Background: light +" Color: brightwhite #eeeeee ~ +" Color: light0 #080808 ~ 0 +" Color: light1 #af0000 ~ 1 +" Color: light2 #005f00 ~ 2 +" Color: light3 #af5f00 ~ 3 +" Color: light4 #005faf ~ 4 +" Color: light5 #870087 ~ 5 +" Color: light6 #008787 ~ 6 +" Color: light7 #d7d7d7 ~ 7 +" Color: light8 #626262 ~ 8 +" Color: light9 #d70000 ~ 9 +" Color: light10 #008700 ~ 10 +" Color: light11 #d78700 ~ 11 +" Color: light12 #0087d7 ~ 12 +" Color: light13 #af00af ~ 13 +" Color: light14 #00afaf ~ 14 +" Color: light15 #ffffff ~ 15 +" Color: diffred #d78787 ~ +" Color: diffgreen #87d787 ~ +" Color: diffblue #afafd7 ~ +" Color: diffpink #d787d7 ~ +" Color: uipink #ff00af ~ +" Color: uilime #afff00 ~ +" Color: uiteal #00ffaf ~ +" Color: uiblue #00afff ~ +" Color: uipurple #af00ff ~ +" Color: uiamber #ffaf00 ~ +" Color: invisigrey #a8a8a8 ~ +" Color: yasogrey #e4e4e4 ~ +" Color: errorred #ff005f ~ +" 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 diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index 6aa810e54e..eb5c8f1770 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sat 11 Jun 2022 11:29:07 MSK +" Last Updated: 2022-07-26 15:50:11 " Generated by Colortemplate v2.2.0 @@ -12,7 +12,7 @@ set background=dark hi clear let g:colors_name = 'ron' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 hi! link Terminal Normal hi! link Boolean Constant diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim index 5ae6d12111..de24a88136 100644 --- a/runtime/colors/shine.vim +++ b/runtime/colors/shine.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer is Yasuhiro Matsumoto " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 11:02:11 2022 +" Last Updated: 2022-07-26 15:50:12 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=light hi clear let g:colors_name = 'shine' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#8b0000', '#006400', '#ffff00', '#00008b', '#6a0dad', '#008b8b', '#dadada', '#767676', '#ffafaf', '#90ee90', '#ffff60', '#add8e6', '#ff00ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim index 192d4162ee..63e7d0d857 100644 --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ralph Amissah " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 11:03:10 2022 +" Last Updated: 2022-07-26 15:50:14 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'slate' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#ff0000', '#5f8700', '#ffff00', '#87d7ff', '#d7d787', '#ffd7af', '#666666', '#333333', '#ffafaf', '#00875f', '#ffd700', '#5f87d7', '#afaf87', '#ff8787', '#ffffff'] diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim index bddd1c4e74..9a9124f3c1 100644 --- a/runtime/colors/torte.vim +++ b/runtime/colors/torte.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Thorsten Maerz " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 11:04:48 2022 +" Last Updated: 2022-07-26 15:50:15 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=dark hi clear let g:colors_name = 'torte' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5', '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff'] diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim index 6133538885..0d38cefc08 100644 --- a/runtime/colors/zellner.vim +++ b/runtime/colors/zellner.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ron Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Sun Jun 12 11:05:43 2022 +" Last Updated: 2022-07-26 15:50:16 " Generated by Colortemplate v2.2.0 @@ -13,7 +13,7 @@ set background=light hi clear let g:colors_name = 'zellner' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co >= 0 ? &t_Co : -1 if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#ffffff', '#a52a2a', '#ff00ff', '#a020f0', '#0000ff', '#0000ff', '#ff00ff', '#a9a9a9', '#ff0000', '#a52a2a', '#ff00ff', '#a020f0', '#0000ff', '#0000ff', '#ff00ff', '#000000'] -- cgit From e99de3f12f00662e8131fed9912792f6d43c4975 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Mon, 1 Aug 2022 22:32:53 +0200 Subject: fix(lsp): send didOpen if name changes on write (#19583) `:saveas newName` changes the name of an existing buffer. Due to the buffer re-use it skips the lsp attach phase and immediately sends a `didSave` notification to the server. Servers get confused about this, because they expect a `didOpen` notification first. Closes https://github.com/neovim/neovim/issues/18688 --- runtime/lua/vim/lsp.lua | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 61586ca44f..bf2201d9c8 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -371,7 +371,9 @@ do state_by_client[client.id] = state end if not state.buffers[bufnr] then - local buf_state = {} + local buf_state = { + name = api.nvim_buf_get_name(bufnr), + } state.buffers[bufnr] = buf_state if use_incremental_sync then buf_state.lines = nvim_buf_get_lines(bufnr, 0, -1, true) @@ -381,6 +383,15 @@ do end end + ---@private + function changetracking._get_and_set_name(client, bufnr, name) + local state = state_by_client[client.id] 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) @@ -1405,6 +1416,19 @@ local function text_document_did_save_handler(bufnr) local uri = vim.uri_from_bufnr(bufnr) local text = once(buf_get_full_text) for_each_buffer_client(bufnr, function(client) + local name = api.nvim_buf_get_name(bufnr) + local old_name = changetracking._get_and_set_name(client, bufnr, name) + if old_name and name ~= old_name then + client.notify('textDocument/didOpen', { + textDocument = { + version = 0, + uri = uri, + languageId = client.config.get_language_id(bufnr, vim.bo[bufnr].filetype), + text = buf_get_full_text(bufnr), + }, + }) + util.buf_versions[bufnr] = 0 + end local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save') if save_capability then local included_text -- cgit From 0a049c322fda5f2bb124429086c2713ff99c7142 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 2 Aug 2022 11:13:22 +0800 Subject: test: improve mapping tests and docs (#19619) --- runtime/doc/api.txt | 13 ++++++++----- runtime/doc/lua.txt | 4 +--- runtime/lua/vim/keymap.lua | 6 ++---- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index aaafa21a59..827d0318ab 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -974,7 +974,7 @@ nvim_get_keymap({mode}) *nvim_get_keymap()* {mode} Mode short-name ("n", "i", "v", ...) Return: ~ - Array of maparg()-like dictionaries describing mappings. + Array of |maparg()|-like dictionaries describing mappings. The "buffer" key is always zero. nvim_get_mark({name}, {opts}) *nvim_get_mark()* @@ -1508,9 +1508,12 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()* used to give a description to the mapping. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping - is executed. "replace_keycodes" can be used with - "expr" to replace keycodes, see - |nvim_replace_termcodes()|. + is executed. When "expr" is true, + "replace_keycodes" (boolean) can be used to + replace keycodes in the resulting string (see + |nvim_replace_termcodes()|), and a Lua callback + returning `nil` is equivalent to returning an + empty string. nvim_set_var({name}, {value}) *nvim_set_var()* Sets a global (g:) variable. @@ -2299,7 +2302,7 @@ nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()* {buffer} Buffer handle, or 0 for current buffer Return: ~ - Array of maparg()-like dictionaries describing mappings. + Array of |maparg()|-like dictionaries describing mappings. The "buffer" key holds the associated buffer handle. *nvim_buf_get_lines()* diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 6dfb0b5791..c9505429c6 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2218,9 +2218,7 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* 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 also be a Lua function. If a Lua - function and `opts.expr == true`, returning `nil` - is equivalent to an empty string. + mapping. Can also be a Lua function. {opts} (table) A table of |:map-arguments| such as "silent". In addition to the options listed in |nvim_set_keymap()|, this table also accepts the diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index 3592855606..0549f63180 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -31,12 +31,10 @@ local keymap = {} --- vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end) ---
--- ----@param mode string|table Same mode short names as |nvim_set_keymap()|. +---@param mode string|table Same mode short names as |nvim_set_keymap()|. --- Can also be list of modes to create mapping on multiple modes. ----@param lhs string Left-hand side |{lhs}| of the mapping. +---@param lhs string Left-hand side |{lhs}| of the mapping. ---@param rhs string|function Right-hand side |{rhs}| of the mapping. Can also be a Lua function. ---- If a Lua function and `opts.expr == true`, returning `nil` is ---- equivalent to an empty string. -- ---@param opts table A table of |:map-arguments| such as "silent". In addition to the options --- listed in |nvim_set_keymap()|, this table also accepts the following keys: -- cgit From 9092540315bef8a685a06825073d05c394bf6575 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sat, 30 Jul 2022 22:07:58 +0200 Subject: feat(terminal): implement for terminal mode this works similar to or in insert mode --- runtime/doc/builtin.txt | 1 + runtime/doc/index.txt | 5 ++++- runtime/doc/intro.txt | 5 +++-- runtime/doc/nvim_terminal_emulator.txt | 6 ++++-- runtime/doc/various.txt | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index e2a8e098d2..61d04c6660 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5311,6 +5311,7 @@ mode([expr]) Return a string that indicates the current mode. niV Normal using |i_CTRL-O| in |Virtual-Replace-mode| nt Normal in |terminal-emulator| (insert goes to Terminal mode) + ntT Normal using |t_CTRL-\_CTRL-O| in |terminal-mode| v Visual by character vs Visual by character using |v_CTRL-O| in Select mode V Visual by line diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 25b98ae4ab..7d8a89887a 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1101,8 +1101,11 @@ tag command action in Command-line editing mode ~ 5. Terminal mode *terminal-mode-index* In a |terminal| buffer all keys except CTRL-\ are forwarded to the terminal -job. If CTRL-\ is pressed, the next key is forwarded unless it is CTRL-N. +job. If CTRL-\ is pressed, the next key is forwarded unless it is CTRL-N +or CTRL-O. Use |CTRL-\_CTRL-N| to go to Normal mode. +Use |t_CTRL-\_CTRL-O| to execute one normal mode command and then return +to terminal mode. You found it, Arthur! *holy-grail* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 92ba7b4079..ae80935032 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -458,7 +458,7 @@ Ex mode Like Command-line mode, but after entering a command Terminal mode In Terminal mode all input (except CTRL-\) is sent to the process running in the current |terminal| buffer. If CTRL-\ is pressed, the next key is sent unless it - is CTRL-N (|CTRL-\_CTRL-N|). + is CTRL-N (|CTRL-\_CTRL-N|) or CTRL-O (|t_CTRL-\_CTRL-O|). If the 'showmode' option is on "-- TERMINAL --" is shown at the bottom of the window. @@ -550,7 +550,8 @@ Ex :vi -- -- -- -- -- *6 Go from Select mode to Insert mode by typing a printable character. The selection is deleted and the character is inserted. - *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N* + *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* + *v_CTRL-\_CTRL-N* *t_CTRL-\_CTRL-N* Additionally the command CTRL-\ CTRL-N or can be used to go to Normal mode from any other mode. This can be used to make sure Vim is in Normal mode, without causing a beep like would. However, this does not diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index a7be9ff98f..546f92e92f 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -47,8 +47,10 @@ Input *terminal-input* To send input, enter |Terminal-mode| with |i|, |I|, |a|, |A| or |:startinsert|. In this mode all keys except are sent to the underlying -program. If is pressed, the next key is sent unless it is . Use - to return to normal-mode. |CTRL-\_CTRL-N| +program. If is pressed, the next key is sent unless it is or . +Use to return to normal mode. |CTRL-\_CTRL-N| +Use to execute one normal mode command and then return to terminal +mode. *t_CTRL-\_CTRL-O* Terminal-mode forces these local options: diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 9eb6470962..cae9c76030 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -239,7 +239,8 @@ g8 Print the hex values of the bytes used in the Type |i| to enter |Terminal-mode|, then keys are sent to the job running in the terminal. Type to - leave Terminal-mode. |CTRL-\_CTRL-N| + leave Terminal-mode. |CTRL-\_CTRL-N|. Type + to execute a single normal mode command |t_CTRL-\_CTRL-O| Fails if changes have been made to the current buffer, unless 'hidden' is set. -- cgit From b8dcbcc732baf84fc48d6b272c3ade0bcb129b3b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 3 Aug 2022 03:47:16 +0200 Subject: docs: fix typos (#19588) Co-authored-by: zeertzjq Co-authored-by: notomo --- runtime/doc/api.txt | 2 +- runtime/doc/builtin.txt | 2 +- runtime/doc/lua.txt | 15 ++++++++------- runtime/doc/options.txt | 2 +- runtime/lua/vim/_editor.lua | 2 +- runtime/lua/vim/keymap.lua | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 827d0318ab..be42b7c14e 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -348,7 +348,7 @@ callbacks. These callbacks are called frequently in various contexts; |nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, -{new_lastline}, {old_byte_size}[, {old_utf32_size}, {old_utf16_size}]). +{new_lastline}, {old_byte_size} [, {old_utf32_size}, {old_utf16_size}]). Unlike remote channel events the text contents are not passed. The new text can be accessed inside the callback as diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 61d04c6660..f0f47cddf4 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5311,7 +5311,7 @@ mode([expr]) Return a string that indicates the current mode. niV Normal using |i_CTRL-O| in |Virtual-Replace-mode| nt Normal in |terminal-emulator| (insert goes to Terminal mode) - ntT Normal using |t_CTRL-\_CTRL-O| in |terminal-mode| + ntT Normal using |t_CTRL-\_CTRL-O| in |Terminal-mode| v Visual by character vs Visual by character using |v_CTRL-O| in Select mode V Visual by line diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c9505429c6..4062a35735 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -704,7 +704,7 @@ regex:match_str({str}) *regex:match_str()* As any integer is truth-y, `regex:match()` can be directly used as a condition in an if-statement. -regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()* +regex:match_line({bufnr}, {line_idx} [, {start}, {end}]) *regex:match_line()* 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 @@ -855,13 +855,13 @@ vim.empty_dict() *vim.empty_dict()* Note: If numeric keys are present in the table, Nvim ignores the metatable marker and converts the dict to a list/array anyway. -vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()* +vim.rpcnotify({channel}, {method} [, {args}...]) *vim.rpcnotify()* Sends {event} to {channel} via |RPC| and returns immediately. If {channel} is 0, the event is broadcast to all channels. This function also works in a fast callback |lua-loop-callbacks|. -vim.rpcrequest({channel}, {method}[, {args}...]) *vim.rpcrequest()* +vim.rpcrequest({channel}, {method} [, {args}...]) *vim.rpcrequest()* Sends a request to {channel} to invoke {method} via |RPC| and blocks until a response is received. @@ -873,7 +873,7 @@ vim.stricmp({a}, {b}) *vim.stricmp()* are equal, {a} is greater than {b} or {a} is lesser than {b}, respectively. -vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()* +vim.str_utfindex({str} [, {index}]) *vim.str_utfindex()* Convert byte index to UTF-32 and UTF-16 indices. If {index} is not supplied, the length of the string is used. All indices are zero-based. Returns two values: the UTF-32 and UTF-16 indices respectively. @@ -883,7 +883,7 @@ vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()* point each. An {index} in the middle of a UTF-8 sequence is rounded upwards to the end of that sequence. -vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()* +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 supplied, it defaults to false (use UTF-32). Returns the byte index. @@ -1315,7 +1315,7 @@ cmd({command}) *vim.cmd()* vim.cmd('write! myfile.txt') vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } vim.cmd.write { args = { "myfile.txt" }, bang = true } - vim.cmd.write {"myfile.txt", bang = true }) + vim.cmd.write { "myfile.txt", bang = true } -- Ex command :colorscheme blue vim.cmd('colorscheme blue') @@ -2229,7 +2229,8 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* • remap: (boolean) Make the mapping recursive. This is the inverse of the "noremap" option from |nvim_set_keymap()|. Default `false`. - • replace_keycodes: (boolean) defaults to true. + • replace_keycodes: (boolean) defaults to true if + "expr" is true. See also: ~ |nvim_set_keymap()| diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ffeed6f977..9d03397821 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4210,7 +4210,7 @@ A jump table for the options with a short description can be found at |Q_op|. The 'mousemodel' option is set by the |:behave| command. - *'mousescroll'* + *'mousescroll'* 'mousescroll' string (default "ver:3,hor:6") global This option controls the number of lines / columns to scroll by when diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 094fb2f909..b8a7f71145 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -312,7 +312,7 @@ end --- vim.cmd('write! myfile.txt') --- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } --- vim.cmd.write { args = { "myfile.txt" }, bang = true } ---- vim.cmd.write {"myfile.txt", bang = true }) +--- vim.cmd.write { "myfile.txt", bang = true } --- --- -- Ex command :colorscheme blue --- vim.cmd('colorscheme blue') diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index 0549f63180..7265beb56b 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -43,7 +43,7 @@ local keymap = {} --- - remap: (boolean) Make the mapping recursive. This is the --- inverse of the "noremap" option from |nvim_set_keymap()|. --- Default `false`. ---- - replace_keycodes: (boolean) defaults to true. +--- - replace_keycodes: (boolean) defaults to true if "expr" is true. ---@see |nvim_set_keymap()| function keymap.set(mode, lhs, rhs, opts) vim.validate({ -- cgit