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/doc') 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 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'runtime/doc') 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, }, -- 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 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'runtime/doc') 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: ~ -- 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 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'runtime/doc') 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| ============================================================================== -- 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/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 +++++----- 7 files changed, 39 insertions(+), 34 deletions(-) (limited to 'runtime/doc') 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 ============================================================================== -- 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/doc') 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 ++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'runtime/doc') 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` -- 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 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'runtime/doc') 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. -- 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 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/doc') 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 -- 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/doc') 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 - 5 files changed, 17 insertions(+), 19 deletions(-) (limited to 'runtime/doc') 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 -- 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/doc') 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/doc') 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 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/doc') 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, -- 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 +---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'runtime/doc') 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()| -- 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/doc') 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/doc') 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 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 +--- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'runtime/doc') 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 -- 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/doc') 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 +- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'runtime/doc') 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 -- cgit