diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
| commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
| tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /runtime/doc | |
| parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
| parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
| download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip | |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'runtime/doc')
40 files changed, 957 insertions, 939 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index dee0324a5b..c5dabeb551 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -658,12 +658,12 @@ nvim_echo({chunks}, {history}, {opts}) *nvim_echo()* Parameters: ~ • {chunks} A list of `[text, hl_group]` arrays, each representing a - text chunk with specified highlight. `hl_group` element can - be omitted for no highlight. + text chunk with specified highlight group name or ID. + `hl_group` element can be omitted for no highlight. • {history} if true, add to |message-history|. • {opts} Optional parameters. - • verbose: Message was printed as a result of 'verbose' - option if Nvim was invoked with -V3log_file, the message + • verbose: Message is printed as a result of 'verbose' + option. If Nvim was invoked with -V3log_file, the message will be redirected to the log_file and suppressed from direct output. @@ -2672,8 +2672,10 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) • id : id of the extmark to edit. • end_row : ending line of the mark, 0-based inclusive. • end_col : ending col of the mark, 0-based exclusive. - • hl_group : name of the highlight group used to highlight - this mark. + • hl_group : highlight group used for the text range. This + and below highlight groups can be supplied either as a + string or as an integer, the latter of which can be + obtained using |nvim_get_hl_id_by_name()|. • hl_eol : when true, for a multiline highlight covering the EOL of a line, continue the highlight for the rest of the screen line (just like for diff and cursorline highlight). @@ -2682,9 +2684,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) with specified highlight. `highlight` element can either be a single highlight group, or an array of multiple highlight groups that will be stacked (highest priority - last). A highlight group can be supplied either as a - string or as an integer, the latter which can be obtained - using |nvim_get_hl_id_by_name()|. + last). • virt_text_pos : position of virtual text. Possible values: • "eol": right after eol character (default). • "overlay": display over the specified column, without @@ -2750,15 +2750,14 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) buffer or end of the line respectively. Defaults to true. • sign_text: string of length 1-2 used to display in the sign column. - • sign_hl_group: name of the highlight group used to - highlight the sign column text. - • number_hl_group: name of the highlight group used to - highlight the number column. - • line_hl_group: name of the highlight group used to - highlight the whole line. - • cursorline_hl_group: name of the highlight group used to - highlight the sign column text when the cursor is on the - same line as the mark and 'cursorline' is enabled. + • sign_hl_group: highlight group used for the sign column + text. + • number_hl_group: highlight group used for the number + column. + • line_hl_group: highlight group used for the whole line. + • cursorline_hl_group: highlight group used for the sign + column text when the cursor is on the same line as the + mark and 'cursorline' is enabled. • conceal: string which should be either empty or a single character. Enable concealing similar to |:syn-conceal|. When a character is supplied it is used as |:syn-cchar|. @@ -3195,7 +3194,13 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* be fractional. • focusable: Enable focus by user actions (wincmds, mouse events). Defaults to true. Non-focusable windows can be - entered by |nvim_set_current_win()|. + entered by |nvim_set_current_win()|, or, when the `mouse` + field is set to true, by mouse events. See |focusable|. + • mouse: Specify how this window interacts with mouse + events. Defaults to `focusable` value. + • If false, mouse events pass through this window. + • If true, mouse events interact with this window + normally. • external: GUI should display the window as an external top-level window. Currently accepts no other positioning configuration together with this. diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 8e5e2628de..998ef5e9f3 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -353,15 +353,11 @@ BufWritePost After writing the whole buffer to a file ChanInfo State of channel changed, for instance the client of a RPC channel described itself. Sets these |v:event| keys: - info - See |nvim_get_chan_info()| for the format of - the info Dictionary. + info as from |nvim_get_chan_info()| *ChanOpen* ChanOpen Just after a channel was opened. Sets these |v:event| keys: - info - See |nvim_get_chan_info()| for the format of - the info Dictionary. + info as from |nvim_get_chan_info()| *CmdUndefined* CmdUndefined When a user command is used but it isn't defined. Useful for defining a command only diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 4c726f86d2..ada3b7103c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -269,16 +269,16 @@ assert_equal({expected}, {actual} [, {msg}]) *assert_equal()* Return: ~ (`0|1`) -assert_equalfile({fname-one}, {fname-two}) *assert_equalfile()* - When the files {fname-one} and {fname-two} do not contain +assert_equalfile({fname_one}, {fname_two}) *assert_equalfile()* + When the files {fname_one} and {fname_two} do not contain exactly the same text an error message is added to |v:errors|. Also see |assert-return|. - When {fname-one} or {fname-two} does not exist the error will + When {fname_one} or {fname_two} does not exist the error will mention that. Parameters: ~ - • {fname-one} (`string`) - • {fname-two} (`string`) + • {fname_one} (`string`) + • {fname_two} (`string`) Return: ~ (`0|1`) @@ -936,7 +936,7 @@ charclass({string}) *charclass()* The character class is one of: 0 blank 1 punctuation - 2 word character + 2 word character (depends on 'iskeyword') 3 emoji other specific Unicode class The class is used in patterns and word motions. @@ -959,7 +959,7 @@ charcol({expr} [, {winid}]) *charcol()* < Parameters: ~ - • {expr} (`string|integer[]`) + • {expr} (`string|any[]`) • {winid} (`integer?`) Return: ~ @@ -1100,7 +1100,7 @@ col({expr} [, {winid}]) *col()* < Parameters: ~ - • {expr} (`string|integer[]`) + • {expr} (`string|any[]`) • {winid} (`integer?`) Return: ~ @@ -3224,13 +3224,24 @@ getcharstr([{expr}]) *getcharstr()* Return: ~ (`string`) +getcmdcomplpat() *getcmdcomplpat()* + Return completion pattern of the current command-line. + Only works when the command line is being edited, thus + requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. + Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, + |getcmdprompt()|, |getcmdcompltype()| and |setcmdline()|. + Returns an empty string when completion is not defined. + + Return: ~ + (`string`) + getcmdcompltype() *getcmdcompltype()* Return the type of the current command-line completion. Only works when the command line is being edited, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. See |:command-completion| for the return string. Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, - |getcmdprompt()| and |setcmdline()|. + |getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|. Returns an empty string when completion is not defined. Return: ~ @@ -3351,6 +3362,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* runtime |:runtime| completion scriptnames sourced script names |:scriptnames| shellcmd Shell command + shellcmdline Shell command line with filename arguments sign |:sign| suboptions syntax syntax file names |'syntax'| syntime |:syntime| suboptions @@ -5746,7 +5758,7 @@ luaeval({expr} [, {expr}]) *luaeval()* map({expr1}, {expr2}) *map()* {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. - When {expr1} is a |List|| or |Dictionary|, replace each + When {expr1} is a |List| or |Dictionary|, replace each item in {expr1} with the result of evaluating {expr2}. For a |Blob| each byte is replaced. For a |String|, each character, including composing @@ -8690,7 +8702,7 @@ setcellwidths({list}) *setcellwidths()* To clear the overrides pass an empty {list}: >vim call setcellwidths([]) -< You can use the script $VIMRUNTIME/tools/emoji_list.lua to see +< You can use the script $VIMRUNTIME/scripts/emoji_list.lua to see the effect for known emoji characters. Move the cursor through the text to check if the cell widths of your terminal match with what Vim knows about each emoji. If it doesn't @@ -9027,6 +9039,8 @@ setqflist({list} [, {action} [, {what}]]) *setqflist()* clear the list: >vim call setqflist([], 'r') < + 'u' Like 'r', but tries to preserve the current selection + in the quickfix list. 'f' All the quickfix lists in the quickfix stack are freed. @@ -9083,9 +9097,9 @@ setqflist({list} [, {action} [, {what}]]) *setqflist()* `:cc 1` to jump to the first position. Parameters: ~ - • {list} (`any[]`) + • {list} (`vim.quickfix.entry[]`) • {action} (`string?`) - • {what} (`table?`) + • {what} (`vim.fn.setqflist.what?`) Return: ~ (`any`) @@ -11597,7 +11611,7 @@ virtcol({expr} [, {list} [, {winid}]]) *virtcol()* < Parameters: ~ - • {expr} (`string|integer[]`) + • {expr} (`string|any[]`) • {list} (`boolean?`) • {winid} (`integer?`) @@ -11691,7 +11705,7 @@ wildmenumode() *wildmenumode()* For example to make <c-j> work like <down> in wildmode, use: >vim cnoremap <expr> <C-j> wildmenumode() ? "\<Down>\<Tab>" : "\<c-j>" < - (Note, this needs the 'wildcharm' option set appropriately). + (Note: this needs the 'wildcharm' option set appropriately). Return: ~ (`any`) diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 928b834600..768a449581 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -561,6 +561,8 @@ with ".". Vim does not recognize a comment (starting with '"') after the program {filter} (for {Visual} see |Visual-mode|). :{range}![!]{filter} [!][arg] *:range!* + For executing external commands see |:!| + Filter {range} lines through the external program {filter}. Vim replaces the optional bangs with the latest given command and appends the optional [arg]. diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 72d2faca02..5e809ad26c 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -21,6 +21,8 @@ API LUA - vim.region() Use |getregionpos()| instead. +- *vim.highlight* Renamed to |vim.hl|. +- vim.validate(opts: table) Use form 1. See |vim.validate()|. DIAGNOSTICS - *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count=1, float=true}` instead. @@ -36,6 +38,25 @@ DIAGNOSTICS - The "cursor_position" parameter of |vim.diagnostic.JumpOpts| is renamed to "pos" +TREESITTER +• *TSNode:child_containing_descendant()* Use + |TSNode:child_with_descendant()| instead; it is identical except that it can + return the descendant itself. + +LSP +• *vim.lsp.util.jump_to_location* Use |vim.lsp.util.show_document()| with + `{focus=true}` instead. +• *vim.lsp.buf.execute_command* Use |Client:exec_cmd()| instead. +• *vim.lsp.buf.completion* Use |vim.lsp.completion.trigger()| instead. +• vim.lsp.buf_request_all The `error` key has been renamed to `err` inside + the result parameter of the handler. +• *vim.lsp.with()* Pass configuration to equivalent + functions in `vim.lsp.buf.*'. +• |vim.lsp.handlers| + No longer support client to server response handlers. Only server to + client requests/notification handlers are supported. +• *vim.lsp.handlers.signature_help()* Use |vim.lsp.buf.signature_help()| instead. + ------------------------------------------------------------------------------ DEPRECATED IN 0.10 *deprecated-0.10* diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index 32f7279704..97d5ebdb52 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -64,9 +64,8 @@ Symbols: - `extern` variables (including the `EXTERN` macro) Non-symbols: - - macros, i.e. `#define`. - - static inline functions, but only if its function declaration has a - `REAL_FATTR_ALWAYS_INLINE` attribute. + - macros, i.e. `#define` + - static inline functions with the `FUNC_ATTR_ALWAYS_INLINE` attribute - typedefs - structs - enums diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 342947595e..9ccc3102b6 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -445,10 +445,10 @@ Lua module: vim.diagnostic *diagnostic-api* updated on |InsertLeave|) • {severity_sort}? (`boolean|{reverse?:boolean}`, default: `false`) Sort diagnostics by severity. This affects the - order in which signs and virtual text are - displayed. When true, higher severities are - displayed before lower severities (e.g. ERROR is - displayed before WARN). Options: + order in which signs, virtual text, and + highlights are displayed. When true, higher + severities are displayed before lower severities + (e.g. ERROR is displayed before WARN). Options: • {reverse}? (boolean) Reverse sort order • {jump}? (`vim.diagnostic.Opts.Jump`) Default values for |vim.diagnostic.jump()|. See diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0008713025..4224709a39 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1032,6 +1032,15 @@ explanation of when the copy is made and when the file is renamed. If the creation of a backup file fails, the write is not done. If you want to write anyway add a '!' to the command. + *file-watcher* +When you notice issues with programs, that act upon when a buffer is written +(like inotify, entr or fswatch) or when external applications execute Vim to +edit the file (like git) and those programs do not seem to notice that the +original file has been changed, you may want to consider switching the +'backupcopy' option value to "yes". This makes sure, Vim writes to the same +file, that those watcher programs expect, without creating a new file (which +prevents them from detecting that the file has changed). See also |crontab| + *write-permissions* When writing a new file the permissions are read-write. For unix the mask is 0o666 with additionally umask applied. When writing a file that was read Vim @@ -1287,7 +1296,7 @@ separated by ';'. For example, to have only Vim files in the dialog, you could use the following command: > - let g:browsefilter = "Vim Scripts\t*.vim\nVim Startup Files\t*vimrc\n" + let g:browsefilter = "Vim scripts\t*.vim\nVim Startup Files\t*vimrc\n" You can override the filter setting on a per-buffer basis by setting the b:browsefilter variable. You would most likely set b:browsefilter in a diff --git a/runtime/doc/faq.txt b/runtime/doc/faq.txt index 7d2774c191..a9a7b1768e 100644 --- a/runtime/doc/faq.txt +++ b/runtime/doc/faq.txt @@ -189,7 +189,7 @@ Other hints: - The python `neovim` module was renamed to `pynvim` (long ago). - If you're using pyenv or virtualenv for the `pynvim` module - https://pypi.python.org/pypi/pynvim/, you must set `g:python3_host_prog` to + https://pypi.org/project/pynvim/, you must set `g:python3_host_prog` to the virtualenv's interpreter path. - Read |provider-python|. - Be sure you have the latest version of the `pynvim` Python module: >bash diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index a577b0c5fb..19c018bc11 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -40,7 +40,7 @@ Detail: The ":filetype on" command will load these files: $VIMRUNTIME/scripts.vim is used to detect it from the contents of the file. When the GUI is running or will start soon, the |menu.vim| script is - also sourced. See |'go-M'| about avoiding that. + also sourced. To add your own file types, see |new-filetype| below. To search for help on a filetype prepend "ft-" and optionally append "-syntax", "-indent" or @@ -630,6 +630,19 @@ HARE *ft-hare* Since the text for this plugin is rather long it has been put in a separate file: |ft_hare.txt|. +IDRIS2 *ft-idris2-plugin* + +By default the following options are set: > + + setlocal shiftwidth=2 tabstop=2 expandtab + setlocal comments=s1:{-,mb:-,ex:-},:\|\|\|,:-- + setlocal commentstring=--\ %s + setlocal wildignore+=*.ibc + +To use tabs instead of spaces for indentation, set the following variable +in your vimrc: > + + let g:idris2#allow_tabchar = 1 JAVA *ft-java-plugin* @@ -774,6 +787,12 @@ To enable folding use this: > let g:markdown_recommended_style = 0 +ORG *ft-org-plugin* + +To enable folding use this: > + let g:org_folding = 1 +< + PDF *ft-pdf-plugin* Two maps, <C-]> and <C-T>, are provided to simulate a tag stack for navigating @@ -1039,6 +1058,19 @@ TYPST *ft-typst-plugin* *g:typst_conceal* When |TRUE| the Typst filetype plugin will set the 'conceallevel' option to 2. + *g:typst_folding* +When |TRUE| the Typst filetype plugin will fold headings. (default: |FALSE|) + +To enable: > + let g:typst_folding = 1 +< + *g:typst_foldnested* +When |TRUE| the Typst filetype plugin will fold nested heading under their +parents. (default: |TRUE|) + +To disable: > + let g:typst_foldnested = 0 +< VIM *ft-vim-plugin* The Vim filetype plugin defines mappings to move to the start and end of diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 9ab5bf4e1e..21f1ba8241 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -164,7 +164,6 @@ menus and menu items. They are most useful for things that you can't remember what the key sequence was. For creating menus in a different language, see |:menutrans|. -If you don't want to use menus at all, see |'go-M'|. *menu.vim* The default menus are read from the file "$VIMRUNTIME/menu.vim". See diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index f97ae24068..49d770124a 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -809,6 +809,38 @@ Detail: : GetCSSIndent() else <!-- --> : -1 +IDRIS2 *ft-idris2-indent* + +Idris 2 indentation can be configured with several variables that control the +indentation level for different language constructs: + +The "g:idris2_indent_if" variable controls the indentation of `then` and `else` +blocks after `if` statements. Defaults to 3. + +The "g:idris2_indent_case" variable controls the indentation of patterns in +`case` expressions. Defaults to 5. + +The "g:idris2_indent_let" variable controls the indentation after `let` +bindings. Defaults to 4. + +The "g:idris2_indent_rewrite" variable controls the indentation after `rewrite` +expressions. Defaults to 8. + +The "g:idris2_indent_where" variable controls the indentation of `where` +blocks. Defaults to 6. + +The "g:idris2_indent_do" variable controls the indentation in `do` blocks. +Defaults to 3. + +Example configuration: > + + let g:idris2_indent_if = 2 + let g:idris2_indent_case = 4 + let g:idris2_indent_let = 4 + let g:idris2_indent_rewrite = 8 + let g:idris2_indent_where = 6 + let g:idris2_indent_do = 3 +< MATLAB *ft-matlab-indent* *matlab-indent* *matlab-indenting* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index d7cbb7c78e..48fd442b7e 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1177,12 +1177,12 @@ items: user_data custom data which is associated with the item and available in |v:completed_item|; it can be any type; defaults to an empty string - hl_group an additional highlight group whose attributes are + abbr_hlgroup an additional highlight group whose attributes are combined with |hl-PmenuSel| and |hl-Pmenu| or |hl-PmenuMatchSel| and |hl-PmenuMatch| highlight attributes in the popup menu to apply cterm and gui properties (with higher priority) like strikethrough - to the completion items + to the completion items abbreviation kind_hlgroup an additional highlight group specifically for setting the highlight attributes of the completion kind. When this field is present, it will override the @@ -1907,6 +1907,16 @@ These commands are used to start inserting text. You can end insert mode with <Esc>. See |mode-ins-repl| for the other special characters in Insert mode. The effect of [count] takes place after Insert mode is exited. +The following commands insert text, but stay in normal mode: + + *]<Space>* +]<Space> Insert an empty line below the cursor without leaving + Normal mode, repeat [count] times. + + *[<Space>* +[<Space> Insert an empty line above the cursor without leaving + Normal mode, repeat [count] times. + When 'autoindent' is on, the indent for a new line is obtained from the previous line. When 'smartindent' or 'cindent' is on, the indent for a line is automatically adjusted for C programs. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 41846f8eed..d099c29bdb 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -536,7 +536,7 @@ CTRL-O in Insert mode you get a beep but you are still in Insert mode, type Select *5 ^O ^G *6 -- -- -- Insert <Esc> -- -- <Insert> -- -- Replace <Esc> -- -- <Insert> -- -- - Command-line `*3` -- -- :start -- -- + Command-line *3 -- -- :start -- -- Ex :vi -- -- -- -- -- -- not possible diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 419f583c36..64bef849fc 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -71,11 +71,13 @@ options are not restored when the LSP client is stopped or detached. - |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or a custom keymap for `K` exists. - *grr* *gra* *grn* *i_CTRL-S* + *grr* *gra* *grn* *gri* *i_CTRL-S* Some keymaps are created unconditionally when Nvim starts: - "grn" is mapped in Normal mode to |vim.lsp.buf.rename()| - "gra" is mapped in Normal and Visual mode to |vim.lsp.buf.code_action()| - "grr" is mapped in Normal mode to |vim.lsp.buf.references()| +- "gri" is mapped in Normal mode to |vim.lsp.buf.implementation()| +- "gO" is mapped in Normal mode to |vim.lsp.buf.document_symbol()| - CTRL-S is mapped in Insert mode to |vim.lsp.buf.signature_help()| If not wanted, these keymaps can be removed at any time using @@ -193,41 +195,41 @@ Requests and notifications defined by the LSP specification are referred to as They are also listed below. Note that handlers depend on server support: they won't run if your server doesn't support them. -- callHierarchy/incomingCalls -- callHierarchy/outgoingCalls -- textDocument/codeAction -- textDocument/completion -- textDocument/declaration* -- textDocument/definition -- textDocument/diagnostic -- textDocument/documentHighlight -- textDocument/documentSymbol -- textDocument/formatting -- textDocument/hover -- textDocument/implementation* -- textDocument/inlayHint -- textDocument/prepareTypeHierarchy -- textDocument/publishDiagnostics -- textDocument/rangeFormatting -- textDocument/rangesFormatting -- textDocument/references -- textDocument/rename -- textDocument/semanticTokens/full -- textDocument/semanticTokens/full/delta -- textDocument/signatureHelp -- textDocument/typeDefinition* -- typeHierarchy/subtypes -- typeHierarchy/supertypes -- window/logMessage -- window/showMessage -- window/showDocument -- window/showMessageRequest -- workspace/applyEdit -- workspace/configuration -- workspace/executeCommand -- workspace/inlayHint/refresh -- workspace/symbol -- workspace/workspaceFolders +- `'callHierarchy/incomingCalls'` +- `'callHierarchy/outgoingCalls'` +- `'textDocument/codeAction'` +- `'textDocument/completion'` +- `'textDocument/declaration'` +- `'textDocument/definition'` +- `'textDocument/diagnostic'` +- `'textDocument/documentHighlight'` +- `'textDocument/documentSymbol'` +- `'textDocument/formatting'` +- `'textDocument/hover'` +- `'textDocument/implementation'` +- `'textDocument/inlayHint'` +- `'textDocument/prepareTypeHierarchy'` +- `'textDocument/publishDiagnostics'` +- `'textDocument/rangeFormatting'` +- `'textDocument/rangesFormatting'` +- `'textDocument/references'` +- `'textDocument/rename'` +- `'textDocument/semanticTokens/full'` +- `'textDocument/semanticTokens/full/delta'` +- `'textDocument/signatureHelp'` +- `'textDocument/typeDefinition*'` +- `'typeHierarchy/subtypes'` +- `'typeHierarchy/supertypes'` +- `'window/logMessage'` +- `'window/showMessage'` +- `'window/showDocument'` +- `'window/showMessageRequest'` +- `'workspace/applyEdit'` +- `'workspace/configuration'` +- `'workspace/executeCommand'` +- `'workspace/inlayHint/refresh'` +- `'workspace/symbol'` +- `'workspace/workspaceFolders'` *lsp-handler* LSP handlers are functions that handle |lsp-response|s to requests made by Nvim @@ -236,7 +238,7 @@ there is no response, so they can't be handled. |lsp-notification|) Each response handler has this signature: > - function(err, result, ctx, config) + function(err, result, ctx) < Parameters: ~ • {err} (`table|nil`) Error info dict, or `nil` if the request @@ -253,121 +255,53 @@ Each response handler has this signature: > request. Handlers can compare this to the current document version to check if the response is "stale". See also |b:changedtick|. - • {config} (`table`) Handler-defined configuration table, which allows - users to customize handler behavior. - For an example, see: - |vim.lsp.diagnostic.on_publish_diagnostics()| - To configure a particular |lsp-handler|, see: - |lsp-handler-configuration| Returns: ~ Two values `result, err` where `err` is shaped like an RPC error: > { code, message, data? } < You can use |vim.lsp.rpc.rpc_response_error()| to create this object. - *lsp-handler-configuration* - -To configure the behavior of a builtin |lsp-handler|, the convenient method -|vim.lsp.with()| is provided for users. - - To configure the behavior of |vim.lsp.diagnostic.on_publish_diagnostics()|, - consider the following example, where a new |lsp-handler| is created using - |vim.lsp.with()| that no longer generates signs for the diagnostics: >lua - - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Disable signs - signs = false, - } - ) -< - To enable signs, use |vim.lsp.with()| again to create and assign a new - |lsp-handler| to |vim.lsp.handlers| for the associated method: >lua - - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Enable signs - signs = true, - } - ) -< - To configure a handler on a per-server basis, you can use the {handlers} key - for |vim.lsp.start_client()| >lua - - vim.lsp.start_client { - ..., -- Other configuration omitted. - handlers = { - ["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Disable virtual_text - virtual_text = false, - } - ), - }, - } -< - or if using "nvim-lspconfig", you can use the {handlers} key of `setup()`: - >lua - - require('lspconfig').rust_analyzer.setup { - handlers = { - ["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Disable virtual_text - virtual_text = false - } - ), - } - } -< - Some handlers do not have an explicitly named handler function (such as - |vim.lsp.diagnostic.on_publish_diagnostics()|). To override these, first - create a reference to the existing handler: >lua - - local on_references = vim.lsp.handlers["textDocument/references"] - vim.lsp.handlers["textDocument/references"] = vim.lsp.with( - on_references, { - -- Use location list instead of quickfix list - loclist = true, - } - ) -< *lsp-handler-resolution* -Handlers can be set by: +Handlers can be set by (in increasing priority): - Setting a field in vim.lsp.handlers. *vim.lsp.handlers* - vim.lsp.handlers is a global table that contains the default mapping of - |lsp-method| names to |lsp-handlers|. To override the handler for the - `"textDocument/definition"` method: >lua + `vim.lsp.handlers` is a global table that contains the default mapping of + |lsp-method| names to lsp-handlers. - vim.lsp.handlers["textDocument/definition"] = my_custom_default_definition + Example: >lua + + vim.lsp.handlers['textDocument/publishDiagnostics'] = my_custom_diagnostics_handler < + Note: this only applies for requests/notifications made by the + server to the client. + - The {handlers} parameter of |vim.lsp.start()|. This sets the default - |lsp-handler| for the server being started. Example: >lua + |lsp-handler| for a specific server. + + Example: >lua vim.lsp.start { ..., -- Other configuration omitted. handlers = { - ["textDocument/definition"] = my_custom_server_definition + ['textDocument/publishDiagnostics'] = my_custom_server_definition }, } +< + Note: this only applies for requests/notifications made by the + server to the client. - The {handler} parameter of |vim.lsp.buf_request_all()|. This sets - the |lsp-handler| ONLY for the given request(s). Example: >lua + the |lsp-handler| ONLY for the given request(s). + + Example: >lua vim.lsp.buf_request_all( 0, - "textDocument/definition", + 'textDocument/publishDiagnostics', my_request_params, my_handler ) < -In summary, the |lsp-handler| will be chosen based on the current |lsp-method| -in the following order: - -1. Handler passed to |vim.lsp.buf_request_all()|, if any. -2. Handler defined in |vim.lsp.start()|, if any. -3. Handler defined in |vim.lsp.handlers|, if any. *vim.lsp.log_levels* Log levels are defined in |vim.log.levels| @@ -404,13 +338,16 @@ Highlight groups that are meant to be used by |vim.lsp.buf.document_highlight()| You can see more about the differences in types here: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight - *hl-LspReferenceText* + *hl-LspReferenceText* LspReferenceText used for highlighting "text" references - *hl-LspReferenceRead* + *hl-LspReferenceRead* LspReferenceRead used for highlighting "read" references - *hl-LspReferenceWrite* + *hl-LspReferenceWrite* LspReferenceWrite used for highlighting "write" references - *hl-LspInlayHint* + *hl-LspReferenceTarget* +LspReferenceTarget used for highlighting reference targets (e.g. in a + hover range) + *hl-LspInlayHint* LspInlayHint used for highlighting inlay hints @@ -463,7 +400,7 @@ Use |:Inspect| to view the highlights for a specific token. Use |:hi| or hi @lsp.mod.deprecated gui=strikethrough " deprecated is crossed out hi @lsp.typemod.function.async guifg=Blue " async functions are blue < -The value |vim.highlight.priorities|`.semantic_tokens` is the priority of the +The value |vim.hl.priorities|`.semantic_tokens` is the priority of the `@lsp.type.*` highlights. The `@lsp.mod.*` and `@lsp.typemod.*` highlights have priorities one and two higher, respectively. @@ -541,10 +478,10 @@ LspDetach *LspDetach* -- Remove the autocommand to format the buffer on save, if it exists if client.supports_method('textDocument/formatting') then - vim.api.nvim_clear_autocmds({ - event = 'BufWritePre', - buffer = args.buf, - }) + vim.api.nvim_clear_autocmds({ + event = 'BufWritePre', + buffer = args.buf, + }) end end, }) @@ -701,7 +638,10 @@ buf_request_all({bufnr}, {method}, {params}, {handler}) Parameters: ~ • {bufnr} (`integer`) Buffer handle, or 0 for current. • {method} (`string`) LSP method name - • {params} (`table?`) Parameters to send to the server + • {params} (`table|(fun(client: vim.lsp.Client, bufnr: integer): table?)?`) + Parameters to send to the server. Can also be passed as a + function that returns the params table for cases where + parameters are specific to the client. • {handler} (`function`) Handler called after all requests are completed. Server results are passed as a `client_id:result` map. @@ -866,9 +806,9 @@ start({config}, {opts}) *vim.lsp.start()* |vim.lsp.start_client()|. • `root_dir` path to the project root. By default this is used to decide if an existing client should be re-used. The example above uses - |vim.fs.root()| and |vim.fs.dirname()| to detect the root by traversing - the file system upwards starting from the current directory until either - a `pyproject.toml` or `setup.py` file is found. + |vim.fs.root()| to detect the root by traversing the file system upwards + starting from the current directory until either a `pyproject.toml` or + `setup.py` file is found. • `workspace_folders` list of `{ uri:string, name: string }` tables specifying the project root folders used by the language server. If `nil` the property is derived from `root_dir` for convenience. @@ -950,14 +890,6 @@ tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()* Return: ~ (`table[]`) tags A list of matching tags -with({handler}, {override_config}) *vim.lsp.with()* - Function to manage overriding defaults for LSP handlers. - - Parameters: ~ - • {handler} (`lsp.Handler`) See |lsp-handler| - • {override_config} (`table`) Table containing the keys to override - behavior of the {handler} - ============================================================================== Lua module: vim.lsp.client *lsp-client* @@ -1083,6 +1015,11 @@ Lua module: vim.lsp.client *lsp-client* • {is_stopped} (`fun(): boolean`) Checks whether a client is stopped. Returns: true if the client is fully stopped. + • {exec_cmd} (`fun(self: vim.lsp.Client, command: lsp.Command, context: {bufnr?: integer}?, handler: lsp.Handler?)`) + Execute a lsp command, either via client + command function (if available) or via + workspace/executeCommand (if supported by the + server) *vim.lsp.Client.Progress* Extends: |vim.Ringbuf| @@ -1153,7 +1090,8 @@ Lua module: vim.lsp.client *lsp-client* • {name}? (`string`, default: client-id) Name in log messages. • {get_language_id}? (`fun(bufnr: integer, filetype: string): string`) - Language ID as string. Defaults to the filetype. + Language ID as string. Defaults to the buffer + filetype. • {offset_encoding}? (`'utf-8'|'utf-16'|'utf-32'`) The encoding that the LSP server expects. Client does not verify this is correct. @@ -1212,6 +1150,15 @@ Lua module: vim.lsp.client *lsp-client* on initialization. +Client:exec_cmd({command}, {context}, {handler}) *Client:exec_cmd()* + Execute a lsp command, either via client command function (if available) + or via workspace/executeCommand (if supported by the server) + + Parameters: ~ + • {command} (`lsp.Command`) + • {context} (`{bufnr?: integer}?`) + • {handler} (`lsp.Handler?`) only called if a server command + ============================================================================== Lua module: vim.lsp.buf *lsp-buf* @@ -1253,6 +1200,20 @@ Lua module: vim.lsp.buf *lsp-buf* • {title}? (`string`) Title for the list. • {context}? (`table`) `ctx` from |lsp-handler| +*vim.lsp.buf.hover.Opts* + Extends: |vim.lsp.util.open_floating_preview.Opts| + + + Fields: ~ + • {silent}? (`boolean`) + +*vim.lsp.buf.signature_help.Opts* + Extends: |vim.lsp.util.open_floating_preview.Opts| + + + Fields: ~ + • {silent}? (`boolean`) + *vim.lsp.buf.add_workspace_folder()* add_workspace_folder({workspace_folder}) @@ -1294,19 +1255,6 @@ code_action({opts}) *vim.lsp.buf.code_action()* • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction • vim.lsp.protocol.CodeActionTriggerKind -completion({context}) *vim.lsp.buf.completion()* - Retrieves the completion items at the current cursor position. Can only be - called in Insert mode. - - Parameters: ~ - • {context} (`table`) (context support not yet implemented) Additional - information about the context in which a completion was - triggered (how it was triggered, and by which trigger - character, if applicable) - - See also: ~ - • vim.lsp.protocol.CompletionTriggerKind - declaration({opts}) *vim.lsp.buf.declaration()* Jumps to the declaration of the symbol under the cursor. @@ -1343,15 +1291,6 @@ document_symbol({opts}) *vim.lsp.buf.document_symbol()* Parameters: ~ • {opts} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|. -execute_command({command_params}) *vim.lsp.buf.execute_command()* - Executes an LSP server command. - - Parameters: ~ - • {command_params} (`lsp.ExecuteCommandParams`) - - See also: ~ - • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand - format({opts}) *vim.lsp.buf.format()* Formats a buffer using the attached (and optionally filtered) language server clients. @@ -1392,7 +1331,7 @@ format({opts}) *vim.lsp.buf.format()* contain `start` and `end` keys as described above, in which case `textDocument/rangesFormatting` support is required. -hover() *vim.lsp.buf.hover()* +hover({config}) *vim.lsp.buf.hover()* Displays hover information about the symbol under the cursor in a floating window. The window will be dismissed on cursor move. Calling the function twice will jump into the floating window (thus by default, "KK" will open @@ -1400,6 +1339,17 @@ hover() *vim.lsp.buf.hover()* mappings are available as usual, except that "q" dismisses the window. You can scroll the contents the same as you would any other buffer. + Note: to disable hover highlights, add the following to your config: >lua + vim.api.nvim_create_autocmd('ColorScheme', { + callback = function() + vim.api.nvim_set_hl(0, 'LspReferenceTarget', {}) + end, + }) +< + + Parameters: ~ + • {config} (`vim.lsp.buf.hover.Opts?`) See |vim.lsp.buf.hover.Opts|. + implementation({opts}) *vim.lsp.buf.implementation()* Lists all the implementations for the symbol under the cursor in the quickfix window. @@ -1454,10 +1404,14 @@ rename({new_name}, {opts}) *vim.lsp.buf.rename()* ones where client.name matches this field. • {bufnr}? (`integer`) (default: current buffer) -signature_help() *vim.lsp.buf.signature_help()* +signature_help({config}) *vim.lsp.buf.signature_help()* Displays signature information about the symbol under the cursor in a floating window. + Parameters: ~ + • {config} (`vim.lsp.buf.signature_help.Opts?`) See + |vim.lsp.buf.signature_help.Opts|. + type_definition({opts}) *vim.lsp.buf.type_definition()* Jumps to the definition of the type of the symbol under the cursor. @@ -1507,66 +1461,24 @@ get_namespace({client_id}, {is_pull}) client. Defaults to push *vim.lsp.diagnostic.on_diagnostic()* -on_diagnostic({_}, {result}, {ctx}, {config}) +on_diagnostic({_}, {result}, {ctx}) |lsp-handler| for the method "textDocument/diagnostic" - See |vim.diagnostic.config()| for configuration options. Handler-specific - configuration can be set using |vim.lsp.with()|: >lua - vim.lsp.handlers["textDocument/diagnostic"] = vim.lsp.with( - vim.lsp.diagnostic.on_diagnostic, { - -- Enable underline, use default values - underline = true, - -- Enable virtual text, override spacing to 4 - virtual_text = { - spacing = 4, - }, - -- Use a function to dynamically turn signs off - -- and on, using buffer local variables - signs = function(namespace, bufnr) - return vim.b[bufnr].show_signs == true - end, - -- Disable a feature - update_in_insert = false, - } - ) -< + See |vim.diagnostic.config()| for configuration options. Parameters: ~ • {result} (`lsp.DocumentDiagnosticReport`) • {ctx} (`lsp.HandlerContext`) - • {config} (`vim.diagnostic.Opts`) Configuration table (see - |vim.diagnostic.config()|). *vim.lsp.diagnostic.on_publish_diagnostics()* -on_publish_diagnostics({_}, {result}, {ctx}, {config}) +on_publish_diagnostics({_}, {result}, {ctx}) |lsp-handler| for the method "textDocument/publishDiagnostics" - See |vim.diagnostic.config()| for configuration options. Handler-specific - configuration can be set using |vim.lsp.with()|: >lua - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Enable underline, use default values - underline = true, - -- Enable virtual text, override spacing to 4 - virtual_text = { - spacing = 4, - }, - -- Use a function to dynamically turn signs off - -- and on, using buffer local variables - signs = function(namespace, bufnr) - return vim.b[bufnr].show_signs == true - end, - -- Disable a feature - update_in_insert = false, - } - ) -< + See |vim.diagnostic.config()| for configuration options. Parameters: ~ • {result} (`lsp.PublishDiagnosticsParams`) • {ctx} (`lsp.HandlerContext`) - • {config} (`vim.diagnostic.Opts?`) Configuration table (see - |vim.diagnostic.config()|). ============================================================================== @@ -1638,8 +1550,9 @@ Lua module: vim.lsp.completion *lsp-completion* *vim.lsp.completion.BufferOpts* Fields: ~ - • {autotrigger}? (`boolean`) Whether to trigger completion - automatically. Default: false + • {autotrigger}? (`boolean`) Default: false When true, completion + triggers automatically based on the server's + `triggerCharacters`. • {convert}? (`fun(item: lsp.CompletionItem): table`) Transforms an LSP CompletionItem to |complete-items|. @@ -1778,8 +1691,8 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) • {hl_group} (`string`) Highlight group name • {opts} (`table?`) Optional parameters: • {priority}? (`integer`, default: - `vim.highlight.priorities.semantic_tokens + 3`) - Priority for the applied extmark. + `vim.hl.priorities.semantic_tokens + 3`) Priority for + the applied extmark. start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()* Start the semantic token highlighting engine for the given buffer with the @@ -1816,54 +1729,44 @@ stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()* ============================================================================== -Lua module: vim.lsp.handlers *lsp-handlers* - -hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()* - |lsp-handler| for the method "textDocument/hover" >lua - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( - vim.lsp.handlers.hover, { - -- Use a sharp border with `FloatBorder` highlights - border = "single", - -- add the title in hover float window - title = "hover" - } - ) -< - - Parameters: ~ - • {result} (`lsp.Hover`) - • {ctx} (`lsp.HandlerContext`) - • {config} (`table`) Configuration table. - • border: (default=nil) - • Add borders to the floating window - • See |vim.lsp.util.open_floating_preview()| for more - options. - - *vim.lsp.handlers.signature_help()* -signature_help({_}, {result}, {ctx}, {config}) - |lsp-handler| for the method "textDocument/signatureHelp". - - The active parameter is highlighted with |hl-LspSignatureActiveParameter|. >lua - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - -- Use a sharp border with `FloatBorder` highlights - border = "single" - } - ) -< +Lua module: vim.lsp.util *lsp-util* - Parameters: ~ - • {result} (`lsp.SignatureHelp`) Response from the language server - • {ctx} (`lsp.HandlerContext`) Client context - • {config} (`table`) Configuration table. - • border: (default=nil) - • Add borders to the floating window - • See |vim.lsp.util.open_floating_preview()| for more - options +*vim.lsp.util.open_floating_preview.Opts* + Fields: ~ + • {height}? (`integer`) Height of floating window + • {width}? (`integer`) Width of floating window + • {wrap}? (`boolean`, default: `true`) Wrap long lines + • {wrap_at}? (`integer`) Character to wrap at for computing height + when wrap is enabled + • {max_width}? (`integer`) Maximal width of floating window + • {max_height}? (`integer`) Maximal height of floating window + • {focus_id}? (`string`) If a popup with this id is opened, then + focus it + • {close_events}? (`table`) List of events that closes the floating + window + • {focusable}? (`boolean`, default: `true`) Make float focusable. + • {focus}? (`boolean`, default: `true`) If `true`, and if + {focusable} is also `true`, focus an existing + floating window with the same {focus_id} + • {offset_x}? (`integer`) offset to add to `col` + • {offset_y}? (`integer`) offset to add to `row` + • {border}? (`string|(string|[string,string])[]`) override + `border` + • {zindex}? (`integer`) override `zindex`, defaults to 50 + • {title}? (`string`) + • {title_pos}? (`'left'|'center'|'right'`) + • {relative}? (`'mouse'|'cursor'`) (default: `'cursor'`) + • {anchor_bias}? (`'auto'|'above'|'below'`, default: `'auto'`) - + "auto": place window based on which side of the + cursor has more lines + • "above": place the window above the cursor unless + there are not enough lines to display the full + window height. + • "below": place the window below the cursor unless + there are not enough lines to display the full + window height. -============================================================================== -Lua module: vim.lsp.util *lsp-util* *vim.lsp.util.apply_text_document_edit()* apply_text_document_edit({text_document_edit}, {index}, {offset_encoding}) @@ -1874,7 +1777,7 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding}) • {text_document_edit} (`lsp.TextDocumentEdit`) • {index} (`integer?`) Optional index of the edit, if from a list of edits (or nil, if not from a list) - • {offset_encoding} (`string?`) + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit @@ -1886,7 +1789,7 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding}) Parameters: ~ • {text_edits} (`lsp.TextEdit[]`) • {bufnr} (`integer`) Buffer id - • {offset_encoding} (`string`) utf-8|utf-16|utf-32 + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'`) See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit @@ -1897,7 +1800,7 @@ apply_workspace_edit({workspace_edit}, {offset_encoding}) Parameters: ~ • {workspace_edit} (`lsp.WorkspaceEdit`) - • {offset_encoding} (`string`) utf-8|utf-16|utf-32 (required) + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'`) (required) See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit @@ -1915,7 +1818,7 @@ buf_highlight_references({bufnr}, {references}, {offset_encoding}) Parameters: ~ • {bufnr} (`integer`) Buffer id • {references} (`lsp.DocumentHighlight[]`) objects to highlight - • {offset_encoding} (`string`) One of "utf-8", "utf-16", "utf-32". + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'`) See also: ~ • https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent @@ -1928,7 +1831,7 @@ character_offset({buf}, {row}, {col}, {offset_encoding}) • {buf} (`integer`) buffer number (0 for current) • {row} (`integer`) 0-indexed line • {col} (`integer`) 0-indexed byte offset in line - • {offset_encoding} (`string`) utf-8|utf-16|utf-32 defaults to + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) defaults to `offset_encoding` of first client of `buf` Return: ~ @@ -1966,12 +1869,13 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers}) `textDocument/SignatureHelp` • {ft} (`string?`) filetype that will be use as the `lang` for the label markdown code block - • {triggers} (`table?`) list of trigger characters from the lsp - server. used to better determine parameter offsets + • {triggers} (`string[]?`) list of trigger characters from the + lsp server. used to better determine parameter + offsets Return (multiple): ~ - (`string[]?`) table list of lines of converted markdown. - (`number[]?`) table of active hl + (`string[]?`) lines of converted markdown. + (`Range4?`) highlight range for the active parameter See also: ~ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp @@ -1988,19 +1892,6 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* See also: ~ • 'shiftwidth' - *vim.lsp.util.jump_to_location()* -jump_to_location({location}, {offset_encoding}, {reuse_win}) - Jumps to a location. - - Parameters: ~ - • {location} (`lsp.Location|lsp.LocationLink`) - • {offset_encoding} (`string?`) utf-8|utf-16|utf-32 - • {reuse_win} (`boolean?`) Jump to existing window if buffer is - already open. - - Return: ~ - (`boolean`) `true` if the jump succeeded - *vim.lsp.util.locations_to_items()* locations_to_items({locations}, {offset_encoding}) Returns the items with the byte position calculated correctly and in @@ -2014,19 +1905,11 @@ locations_to_items({locations}, {offset_encoding}) Parameters: ~ • {locations} (`lsp.Location[]|lsp.LocationLink[]`) - • {offset_encoding} (`string`) offset_encoding for locations - utf-8|utf-16|utf-32 default to first client of - buffer + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) default to first + client of buffer Return: ~ - (`table[]`) A list of objects with the following fields: - • {filename} (`string`) - • {lnum} (`integer`) 1-indexed line number - • {end_lnum} (`integer`) 1-indexed end line number - • {col} (`integer`) 1-indexed column - • {end_col} (`integer`) 1-indexed end column - • {text} (`string`) - • {user_data} (`lsp.Location|lsp.LocationLink`) + (`vim.quickfix.entry[]`) See |setqflist()| for the format *vim.lsp.util.make_floating_popup_options()* make_floating_popup_options({width}, {height}, {opts}) @@ -2036,23 +1919,11 @@ make_floating_popup_options({width}, {height}, {opts}) Parameters: ~ • {width} (`integer`) window width (in character cells) • {height} (`integer`) window height (in character cells) - • {opts} (`table`) optional - • offset_x (integer) offset to add to `col` - • offset_y (integer) offset to add to `row` - • border (string or table) override `border` - • focusable (string or table) override `focusable` - • zindex (string or table) override `zindex`, defaults to 50 - • relative ("mouse"|"cursor") defaults to "cursor" - • anchor_bias ("auto"|"above"|"below") defaults to "auto" - • "auto": place window based on which side of the cursor - has more lines - • "above": place the window above the cursor unless there - are not enough lines to display the full window height. - • "below": place the window below the cursor unless there - are not enough lines to display the full window height. + • {opts} (`vim.lsp.util.open_floating_preview.Opts?`) See + |vim.lsp.util.open_floating_preview.Opts|. Return: ~ - (`table`) Options + (`vim.api.keyset.win_config`) *vim.lsp.util.make_formatting_params()* make_formatting_params({options}) @@ -2075,13 +1946,15 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding}) similar to |vim.lsp.util.make_range_params()|. Parameters: ~ - • {start_pos} (`integer[]?`) {row,col} mark-indexed position. - Defaults to the start of the last visual selection. - • {end_pos} (`integer[]?`) {row,col} mark-indexed position. - Defaults to the end of the last visual selection. + • {start_pos} (`[integer,integer]?`) {row,col} mark-indexed + position. Defaults to the start of the last visual + selection. + • {end_pos} (`[integer,integer]?`) {row,col} mark-indexed + position. Defaults to the end of the last visual + selection. • {bufnr} (`integer?`) buffer handle or 0 for current, defaults to current - • {offset_encoding} (`"utf-8"|"utf-16"|"utf-32"?`) defaults to + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) defaults to `offset_encoding` of first client of `bufnr` Return: ~ @@ -2096,7 +1969,7 @@ make_position_params({window}, {offset_encoding}) Parameters: ~ • {window} (`integer?`) window handle or 0 for current, defaults to current - • {offset_encoding} (`string?`) utf-8|utf-16|utf-32|nil defaults to + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) defaults to `offset_encoding` of first client of buffer of `window` @@ -2155,27 +2028,11 @@ open_floating_preview({contents}, {syntax}, {opts}) Parameters: ~ • {contents} (`table`) of lines to show in window • {syntax} (`string`) of syntax to set for opened buffer - • {opts} (`table?`) with optional fields (additional keys are - filtered with |vim.lsp.util.make_floating_popup_options()| - before they are passed on to |nvim_open_win()|) - • {height}? (`integer`) Height of floating window - • {width}? (`integer`) Width of floating window - • {wrap}? (`boolean`, default: `true`) Wrap long lines - • {wrap_at}? (`integer`) Character to wrap at for - computing height when wrap is enabled - • {max_width}? (`integer`) Maximal width of floating - window - • {max_height}? (`integer`) Maximal height of floating - window - • {focus_id}? (`string`) If a popup with this id is - opened, then focus it - • {close_events}? (`table`) List of events that closes the - floating window - • {focusable}? (`boolean`, default: `true`) Make float - focusable. - • {focus}? (`boolean`, default: `true`) If `true`, and if - {focusable} is also `true`, focus an existing floating - window with the same {focus_id} + • {opts} (`vim.lsp.util.open_floating_preview.Opts?`) with optional + fields (additional keys are filtered with + |vim.lsp.util.make_floating_popup_options()| before they + are passed on to |nvim_open_win()|). See + |vim.lsp.util.open_floating_preview.Opts|. Return (multiple): ~ (`integer`) bufnr of newly created float window @@ -2191,7 +2048,8 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()* Parameters: ~ • {location} (`lsp.Location|lsp.LocationLink`) - • {opts} (`table`) + • {opts} (`vim.lsp.util.open_floating_preview.Opts?`) See + |vim.lsp.util.open_floating_preview.Opts|. Return (multiple): ~ (`integer?`) buffer id of float window @@ -2221,12 +2079,12 @@ show_document({location}, {offset_encoding}, {opts}) Parameters: ~ • {location} (`lsp.Location|lsp.LocationLink`) - • {offset_encoding} (`string?`) utf-8|utf-16|utf-32 - • {opts} (`table?`) options - • reuse_win (boolean) Jump to existing window if - buffer is already open. - • focus (boolean) Whether to focus/jump to location - if possible. Defaults to true. + • {offset_encoding} (`'utf-8'|'utf-16'|'utf-32'?`) + • {opts} (`table?`) A table with the following fields: + • {reuse_win}? (`boolean`) Jump to existing window + if buffer is already open. + • {focus}? (`boolean`) Whether to focus/jump to + location if possible. (defaults: true) Return: ~ (`boolean`) `true` if succeeded @@ -2246,7 +2104,7 @@ stylize_markdown({bufnr}, {contents}, {opts}) Parameters: ~ • {bufnr} (`integer`) • {contents} (`string[]`) of lines to show in window - • {opts} (`table`) with optional fields + • {opts} (`table?`) with optional fields • height of floating window • width of floating window • wrap_at character to wrap at for computing height @@ -2261,9 +2119,12 @@ symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()* Converts symbols to quickfix list items. Parameters: ~ - • {symbols} (`table`) DocumentSymbol[] or SymbolInformation[] + • {symbols} (`lsp.DocumentSymbol[]|lsp.SymbolInformation[]`) • {bufnr} (`integer?`) + Return: ~ + (`vim.quickfix.entry[]`) See |setqflist()| for the format + ============================================================================== Lua module: vim.lsp.log *lsp-log* @@ -2300,7 +2161,7 @@ should_log({level}) *vim.lsp.log.should_log()* • {level} (`integer`) log level Return: ~ - (`bool`) true if would log, false if not + (`boolean`) true if would log, false if not ============================================================================== diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt index 5f06d51f42..b40d5a0791 100644 --- a/runtime/doc/lua-guide.txt +++ b/runtime/doc/lua-guide.txt @@ -552,7 +552,7 @@ This means that if your callback itself takes an (even optional) argument, you must wrap it in `function() end` to avoid an error: >lua vim.api.nvim_create_autocmd('TextYankPost', { - callback = function() vim.highlight.on_yank() end + callback = function() vim.hl.on_yank() end }) < (Since unused arguments can be omitted in Lua function definitions, this is @@ -576,7 +576,7 @@ Instead of using a pattern, you can create a buffer-local autocommand (see Similarly to mappings, you can (and should) add a description using `desc`: >lua vim.api.nvim_create_autocmd('TextYankPost', { - callback = function() vim.highlight.on_yank() end, + callback = function() vim.hl.on_yank() end, desc = "Briefly highlight yanked text" }) < diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 396f24a1aa..243c907180 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -636,13 +636,13 @@ A subset of the `vim.*` API is available in threads. This includes: ============================================================================== -VIM.HIGHLIGHT *vim.highlight* +VIM.HL *vim.hl* -vim.highlight.on_yank({opts}) *vim.highlight.on_yank()* +vim.hl.on_yank({opts}) *vim.hl.on_yank()* Highlight the yanked text during a |TextYankPost| event. Add the following to your `init.vim`: >vim - autocmd TextYankPost * silent! lua vim.highlight.on_yank {higroup='Visual', timeout=300} + autocmd TextYankPost * silent! lua vim.hl.on_yank {higroup='Visual', timeout=300} < Parameters: ~ @@ -655,9 +655,9 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()* true) • event event structure (default vim.v.event) • priority integer priority (default - |vim.highlight.priorities|`.user`) + |vim.hl.priorities|`.user`) -vim.highlight.priorities *vim.highlight.priorities* +vim.hl.priorities *vim.hl.priorities* Table with default priorities used for highlighting: • `syntax`: `50`, used for standard syntax highlighting • `treesitter`: `100`, used for treesitter-based highlighting @@ -666,8 +666,8 @@ vim.highlight.priorities *vim.highlight.priorities* • `user`: `200`, used for user-triggered highlights such as LSP document symbols or `on_yank` autocommands - *vim.highlight.range()* -vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) + *vim.hl.range()* +vim.hl.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) Apply highlight group to range of text. Parameters: ~ @@ -684,8 +684,7 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) • {inclusive}? (`boolean`, default: `false`) Indicates whether the range is end-inclusive • {priority}? (`integer`, default: - `vim.highlight.priorities.user`) Indicates priority of - highlight + `vim.hl.priorities.user`) Highlight priority ============================================================================== @@ -1001,22 +1000,6 @@ vim.schedule({fn}) *vim.schedule()* Parameters: ~ • {fn} (`fun()`) -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. - - Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. An {index} - in the middle of a UTF-16 sequence is rounded upwards to the end of that - sequence. - - Parameters: ~ - • {str} (`string`) - • {index} (`integer`) - • {use_utf16} (`boolean?`) - - Return: ~ - (`integer`) - vim.str_utf_end({str}, {index}) *vim.str_utf_end()* Gets the distance (in bytes) from the last byte of the codepoint (character) that {index} points to. @@ -1074,23 +1057,6 @@ vim.str_utf_start({str}, {index}) *vim.str_utf_start()* Return: ~ (`integer`) -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. - - Embedded NUL bytes are treated as terminating the string. Invalid UTF-8 - bytes, and embedded surrogates are counted as one code point each. An - {index} in the middle of a UTF-8 sequence is rounded upwards to the end of - that sequence. - - Parameters: ~ - • {str} (`string`) - • {index} (`integer?`) - - Return (multiple): ~ - (`integer`) UTF-32 index - (`integer`) UTF-16 index - vim.stricmp({a}, {b}) *vim.stricmp()* Compares strings case-insensitively. @@ -1117,6 +1083,12 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()* |ui-popupmenu| and the sections below for event format for respective events. + Callbacks for `msg_show` events are executed in |api-fast| context unless + Nvim will wait for input, in which case messages should be shown + immediately. + + Excessive errors inside the callback will result in forced detachment. + WARNING: This api is considered experimental. Usability will vary for different screen elements. In particular `ext_messages` behavior is subject to further changes and usability improvements. This is expected to @@ -1464,12 +1436,9 @@ Option:remove({value}) *vim.opt:remove()* • {value} (`string`) Value to remove vim.bo[{bufnr}] *vim.bo* - Get or set buffer-scoped |options| for the buffer with number {bufnr}. If - {bufnr} is omitted then the current buffer is used. Invalid {bufnr} or key - is an error. - - Note: this is equivalent to `:setlocal` for |global-local| options and - `:set` otherwise. + Get or set buffer-scoped |options| for the buffer with number {bufnr}. + Like `:setlocal`. If {bufnr} is omitted then the current buffer is used. + Invalid {bufnr} or key is an error. Example: >lua local bufnr = vim.api.nvim_get_current_buf() @@ -1672,7 +1641,7 @@ vim.notify_once({msg}, {level}, {opts}) *vim.notify_once()* Return: ~ (`boolean`) true if message was displayed, else false -vim.on_key({fn}, {ns_id}) *vim.on_key()* +vim.on_key({fn}, {ns_id}, {opts}) *vim.on_key()* Adds Lua function {fn} with namespace id {ns_id} as a listener to every, yes every, input key. @@ -1681,22 +1650,32 @@ vim.on_key({fn}, {ns_id}) *vim.on_key()* Note: ~ • {fn} will be removed on error. + • {fn} won't be invoked recursively, i.e. if {fn} itself consumes input, + it won't be invoked for those keys. • {fn} will not be cleared by |nvim_buf_clear_namespace()| Parameters: ~ - • {fn} (`fun(key: string, typed: string)?`) Function invoked on - every key press. |i_CTRL-V| {key} is the key after mappings - have been applied, and {typed} is the key(s) before mappings - are applied, which may be empty if {key} is produced by - non-typed keys. When {fn} is nil and {ns_id} is specified, - the callback associated with namespace {ns_id} is removed. + • {fn} (`fun(key: string, typed: string): string??`) Function + invoked for every input key, after mappings have been applied + but before further processing. Arguments {key} and {typed} + are raw keycodes, where {key} is the key after mappings are + applied, and {typed} is the key(s) before mappings are + applied. {typed} may be empty if {key} is produced by + non-typed key(s) or by the same typed key(s) that produced a + previous {key}. If {fn} returns an empty string, {key} is + discarded/ignored. When {fn} is `nil`, the callback + associated with namespace {ns_id} is removed. • {ns_id} (`integer?`) Namespace ID. If nil or 0, generates and returns a new |nvim_create_namespace()| id. + • {opts} (`table?`) Optional parameters Return: ~ (`integer`) Namespace id associated with {fn}. Or count of all callbacks if on_key() is called without arguments. + See also: ~ + • |keytrans()| + vim.paste({lines}, {phase}) *vim.paste()* Paste handler, invoked by |nvim_paste()|. @@ -1772,6 +1751,44 @@ vim.schedule_wrap({fn}) *vim.schedule_wrap()* • |vim.schedule()| • |vim.in_fast_event()| + *vim.str_byteindex()* +vim.str_byteindex({s}, {encoding}, {index}, {strict_indexing}) + Convert UTF-32, UTF-16 or UTF-8 {index} to byte index. If + {strict_indexing} is false then then an out of range index will return + byte length instead of throwing an error. + + Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. An {index} + in the middle of a UTF-16 sequence is rounded upwards to the end of that + sequence. + + Parameters: ~ + • {s} (`string`) + • {encoding} (`"utf-8"|"utf-16"|"utf-32"`) + • {index} (`integer`) + • {strict_indexing} (`boolean?`) default: true + + Return: ~ + (`integer`) + + *vim.str_utfindex()* +vim.str_utfindex({s}, {encoding}, {index}, {strict_indexing}) + Convert byte index to UTF-32, UTF-16 or UTF-8 indices. If {index} is not + supplied, the length of the string is used. All indices are zero-based. + + If {strict_indexing} is false then an out of range index will return + string length instead of throwing an error. Invalid UTF-8 bytes, and + embedded surrogates are counted as one code point each. An {index} in the + middle of a UTF-8 sequence is rounded upwards to the end of that sequence. + + Parameters: ~ + • {s} (`string`) + • {encoding} (`"utf-8"|"utf-16"|"utf-32"`) + • {index} (`integer?`) + • {strict_indexing} (`boolean?`) default: true + + Return: ~ + (`integer`) + vim.system({cmd}, {opts}, {on_exit}) *vim.system()* Runs a system command or throws an error if {cmd} cannot be run. @@ -2394,31 +2411,29 @@ vim.trim({s}) *vim.trim()* • |lua-patterns| • https://www.lua.org/pil/20.2.html -vim.validate({opt}) *vim.validate()* + *vim.validate()* +vim.validate({name}, {value}, {validator}, {optional}, {message}) Validate function arguments. This function has two valid forms: - 1. vim.validate(name: str, value: any, type: string, optional?: bool) - 2. vim.validate(spec: table) - - Form 1 validates that argument {name} with value {value} has the type - {type}. {type} must be a value returned by |lua-type()|. If {optional} is - true, then {value} may be null. This form is significantly faster and - should be preferred for simple cases. - - Example: >lua - function vim.startswith(s, prefix) + 1. `vim.validate(name, value, validator[, optional][, message])` + Validates that argument {name} with value {value} satisfies + {validator}. If {optional} is given and is `true`, then {value} may be + `nil`. If {message} is given, then it is used as the expected type in + the error message. + Example: >lua + function vim.startswith(s, prefix) vim.validate('s', s, 'string') vim.validate('prefix', prefix, 'string') ... end < - - Form 2 validates a parameter specification (types and values). Specs are - evaluated in alphanumeric order, until the first failure. - - Usage example: >lua - function user.new(name, age, hobbies) + 2. `vim.validate(spec)` (deprecated) where `spec` is of type + `table<string,[value:any, validator: vim.validate.Validator, optional_or_msg? : boolean|string]>)` + Validates a argument specification. Specs are evaluated in alphanumeric + order, until the first failure. + Example: >lua + function user.new(name, age, hobbies) vim.validate{ name={name, 'string'}, age={age, 'number'}, @@ -2429,40 +2444,44 @@ vim.validate({opt}) *vim.validate()* < Examples with explicit argument values (can be run directly): >lua - vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}} + vim.validate('arg1', {'foo'}, 'table') + --> NOP (success) + vim.validate('arg2', 'foo', 'string') --> NOP (success) - vim.validate{arg1={1, 'table'}} + vim.validate('arg1', 1, 'table') --> error('arg1: expected table, got number') - vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} + vim.validate('arg1', 3, function(a) return (a % 2) == 0 end, 'even number') --> error('arg1: expected even number, got 3') < If multiple types are valid they can be given as a list. >lua - vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}} + vim.validate('arg1', {'foo'}, {'table', 'string'}) + vim.validate('arg2', 'foo', {'table', 'string'}) -- NOP (success) - vim.validate{arg1={1, {'string', 'table'}}} + vim.validate('arg1', 1, {'string', 'table'}) -- error('arg1: expected string|table, got number') < + Note: ~ + • `validator` set to a value returned by |lua-type()| provides the best + performance. + Parameters: ~ - • {opt} (`table`) Names of parameters to validate. Each key is a - parameter name; each value is a tuple in one of these forms: - 1. (arg_value, type_name, optional) - • arg_value: argument value - • type_name: string|table type name, one of: ("table", "t", - "string", "s", "number", "n", "boolean", "b", "function", - "f", "nil", "thread", "userdata") or list of them. - • optional: (optional) boolean, if true, `nil` is valid - 2. (arg_value, fn, msg) - • arg_value: argument value - • fn: any function accepting one argument, returns true if - and only if the argument is valid. Can optionally return - an additional informative error message as the second - returned value. - • msg: (optional) error string if validation fails + • {name} (`string`) Argument name + • {value} (`string`) Argument value + • {validator} (`vim.validate.Validator`) + • (`string|string[]`): Any value that can be returned + from |lua-type()| in addition to `'callable'`: + `'boolean'`, `'callable'`, `'function'`, `'nil'`, + `'number'`, `'string'`, `'table'`, `'thread'`, + `'userdata'`. + • (`fun(val:any): boolean, string?`) A function that + returns a boolean and an optional string message. + • {optional} (`boolean?`) Argument is optional (may be omitted) + • {message} (`string?`) message when validation fails ============================================================================== @@ -2508,8 +2527,8 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()* (`table[]`) A list of objects with the following fields: • {modpath} (`string`) Path of the module • {modname} (`string`) Name of the module - • {stat}? (`uv.uv_fs_t`) The fs_stat of the module path. Won't be - returned for `modname="*"` + • {stat}? (`uv.fs_stat.result`) The fs_stat of the module path. Won't + be returned for `modname="*"` vim.loader.reset({path}) *vim.loader.reset()* WARNING: This feature is experimental/unstable. @@ -2671,7 +2690,7 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()* item shape. Plugins reimplementing `vim.ui.select` may wish to use this to infer the structure or semantics of `items`, or the context in which select() was called. - • {on_choice} (`fun(item: any?, idx: integer?)`) Called once the user + • {on_choice} (`fun(item: T?, idx: integer?)`) Called once the user made a choice. `idx` is the 1-based index of `item` within `items`. `nil` if the user aborted the dialog. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 7fd1f3bfbb..11048aee30 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -66,6 +66,8 @@ modes. where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often used to redefine a command. + Note: Keys in {rhs} also won't trigger abbreviation, + with the exception of |i_CTRL-]| and |c_CTRL-]|. Note: When <Plug> appears in the {rhs} this part is always applied even if remapping is disallowed. @@ -1411,6 +1413,8 @@ completion can be enabled: -complete=runtime file and directory names in |'runtimepath'| -complete=scriptnames sourced script names -complete=shellcmd Shell command + -complete=shellcmdline First is a shell command and subsequent ones + are filenames. The same behavior as |:!cmd| -complete=sign |:sign| suboptions -complete=syntax syntax file names |'syntax'| -complete=syntime |:syntime| suboptions diff --git a/runtime/doc/news-0.10.txt b/runtime/doc/news-0.10.txt index a5ded1ca22..35af570ec3 100644 --- a/runtime/doc/news-0.10.txt +++ b/runtime/doc/news-0.10.txt @@ -246,7 +246,7 @@ The following new features were added. indicator to see if a server supports a feature. Instead use `client.supports_method(<method>)`. It considers both the dynamic capabilities and static `server_capabilities`. - • `anchor_bias` option to |lsp-handlers| aids in positioning of floating + • `anchor_bias` option to lsp-handlers aids in positioning of floating windows. • |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to the original LSP `Location` or `LocationLink`. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index ed5bd973be..d19df84023 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -40,6 +40,8 @@ API This is not expected to break clients because there are no known clients that actually use the `return_type` field or the parameter type names reported by |--api-info| or |nvim_get_api_info()|. +• |nvim_open_win()| supports a `mouse` field that allows configuring mouse + interaction with the window separately from `focusable` field. • Renamed `nvim__id_dictionary` (unsupported/experimental API) to `nvim__id_dict`. @@ -53,6 +55,8 @@ DIAGNOSTICS • |vim.diagnostic.config()| accepts a "jump" table to specify defaults for |vim.diagnostic.jump()|. +• The "underline" diagnostics handler sorts diagnostics by severity when using + the "severity_sort" option. EDITOR @@ -63,10 +67,13 @@ EDITOR • Moving in the buffer list using |:bnext| and similar commands behaves as documented and skips help buffers if run from a non-help buffer, otherwise it moves to another help buffer. +• Bells from a |terminal| buffer are now silent by default, unless 'belloff' + option doesn't contain "term" or "all". EVENTS -• TODO +• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in + |api-fast| context. LSP @@ -75,6 +82,19 @@ LSP customizing the transformation of an LSP CompletionItem to |complete-items|. • |vim.lsp.diagnostic.from()| can be used to convert a list of |vim.Diagnostic| objects into their LSP diagnostic representation. +• |vim.lsp.buf.references()|, |vim.lsp.buf.declaration()|, |vim.lsp.buf.definition()|, + |vim.lsp.buf.type_definition()|, |vim.lsp.buf.implementation()| and + |vim.lsp.buf.hover()| now support merging the results of multiple clients + but no longer trigger the global handlers from `vim.lsp.handlers` +• |vim.lsp.buf.typehierarchy()| now passes the correct params for each + client request. +• |vim.lsp.handlers.signature_help()| is no longer used. +• |vim.lsp.diagnostic.on_publish_diagnostics()| and + |vim.lsp.diagnostic.on_diagnostic()| no longer accept a config parameter and + can no longer be configured with |vim.lsp.with()|. + Instead use: >lua + vim.diagnostic.config(config, vim.lsp.diagnostic.get_namespace(client_id)) +< LUA @@ -90,6 +110,12 @@ OPTIONS changes according to related options. It takes care of alignment, 'number', 'relativenumber' and 'signcolumn' set to "number". The now redundant `%r` item is no longer treated specially for 'statuscolumn'. +• `:set {option}<` removes the local value for all |global-local| options instead + of just string |global-local| options. +• `:setlocal {option}<` copies the global value to the local value for number + and boolean |global-local| options instead of removing the local value. +• Setting |hidden-options| now gives an error. In particular, setting + 'noshellslash' is now only allowed on Windows. PLUGINS @@ -108,6 +134,9 @@ TREESITTER if no languages are explicitly registered. • |vim.treesitter.language.add()| returns `true` if a parser was loaded successfully and `nil,errmsg` otherwise instead of throwing an error. +• New |TSNode:child_with_descendant()|, which is nearly identical to + |TSNode:child_containing_descendant()| except that it can return the + descendant itself. TUI @@ -136,8 +165,10 @@ DEFAULTS • Mappings: • |grn| in Normal mode maps to |vim.lsp.buf.rename()| • |grr| in Normal mode maps to |vim.lsp.buf.references()| + • |gri| in Normal mode maps to |vim.lsp.buf.implementation()| + • |gO| in Normal mode maps to |vim.lsp.buf.document_symbol()| • |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()| - • CTRL-S in Insert mode maps to |vim.lsp.buf.signature_help()| + • CTRL-S in Insert and Select mode maps to |vim.lsp.buf.signature_help()| • Mouse |popup-menu| includes an "Open in web browser" item when you right-click on a URL. • Mouse |popup-menu| includes a "Go to definition" item when LSP is active @@ -148,6 +179,7 @@ DEFAULTS • |[t|, |]t|, |[T|, |]T|, |[CTRL-T|, |]CTRL-T| navigate through the |tag-matchlist| • |[a|, |]a|, |[A|, |]A| navigate through the |argument-list| • |[b|, |]b|, |[B|, |]B| navigate through the |buffer-list| + • |[<Space>|, |]<Space>| add an empty line above and below the cursor • Snippet: • `<Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = 1 })` @@ -169,6 +201,7 @@ EVENTS • |CompleteDone| now sets the `reason` key in `v:event` which specifies the reason for completion being done. +• |vim.on_key()| callbacks can consume the key by returning an empty string. LSP @@ -178,14 +211,26 @@ LSP • |vim.lsp.buf.format()| now supports passing a list of ranges via the `range` parameter (this requires support for the `textDocument/rangesFormatting` request). +• |vim.lsp.buf.code_action()| actions show client name when there are multiple + clients. +• |vim.lsp.buf.signature_help()| can now cycle through different signatures + using `<C-s>` and also support multiple clients. +• The client now supports `'utf-8'` and `'utf-32'` position encodings. +• |vim.lsp.buf.hover()| now highlights hover ranges using the + |hl-LspReferenceTarget| highlight group. LUA • |vim.fs.rm()| can delete files and directories. +• |vim.validate()| now has a new signature which uses less tables, + is more peformant and easier to read. +• |vim.str_byteindex()| and |vim.str_utfindex()| gained overload signatures + supporting two new parameters, `encoding` and `strict_indexing`. OPTIONS • 'completeopt' flag "fuzzy" enables |fuzzy-matching| during |ins-completion|. +• 'msghistory' controls maximum number of messages to remember. • 'tabclose' controls which tab page to focus when closing a tab page. PERFORMANCE @@ -234,6 +279,16 @@ UI which controls the tool used to open the given path or URL. If you want to globally set this, you can override vim.ui.open using the same approach described at |vim.paste()|. +- `vim.ui.open()` now supports + [lemonade](https://github.com/lemonade-command/lemonade) as an option for + opening urls/files. This is handy if you are in an ssh connection and use + `lemonade`. +• The |ins-completion-menu| now supports cascading highlight styles. + |hl-PmenuSel| and |hl-PmenuMatch| both inherit from |hl-Pmenu|, and + |hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and + |hl-PmenuMatch|. + +• |ui-messages| content chunks now also contain the highlight group ID. ============================================================================== CHANGED FEATURES *news-changed* @@ -254,6 +309,17 @@ These existing features changed their behavior. more emoji characters than before, including those encoded with multiple emoji codepoints combined with ZWJ (zero width joiner) codepoints. +• Text in the 'statusline', 'tabline', and 'winbar' now inherits highlights + from the respective |hl-StatusLine|, |hl-TabLine|, and |hl-WinBar| highlight + groups. + +• |vim.on_key()| callbacks won't be invoked recursively when a callback itself + consumes input. + +• "q" in man pages now uses |CTRL-W_q| instead of |CTRL-W_c| to close the + current window, and it no longer throws |E444| when there is only one window + on the screen. Global variable `vim.g.pager` is removed. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/doc/nvim.txt b/runtime/doc/nvim.txt index f8eba3f7f8..86e344c654 100644 --- a/runtime/doc/nvim.txt +++ b/runtime/doc/nvim.txt @@ -4,7 +4,7 @@ NVIM REFERENCE MANUAL -Nvim *neovim* *nvim* *nvim-intro* +Nvim *nvim* *neovim* *nvim-intro* Nvim is based on Vim by Bram Moolenaar. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 6dd062124b..97d5082e9e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -306,19 +306,13 @@ created, thus they behave slightly differently: :se[t] {option}< Set the effective value of {option} to its global value. - For string |global-local| options, the local value is - removed, so that the global value will be used. + For |global-local| options, the local value is removed, + so that the global value will be used. For all other options, the global value is copied to the local value. :setl[ocal] {option}< Set the effective value of {option} to its global - value. - For number and boolean |global-local| options, the - local value is removed, so that the global value will - be used. - For all other options, including string |global-local| - options, the global value is copied to the local - value. + value by copying the global value to the local value. Note that the behaviour for |global-local| options is slightly different between string and number-based options. @@ -376,10 +370,11 @@ Note: In the future more global options can be made |global-local|. Using ":setlocal" on a global option might work differently then. *option-value-function* -Some options ('completefunc', 'omnifunc', 'operatorfunc', 'quickfixtextfunc', -'tagfunc' and 'thesaurusfunc') are set to a function name or a function -reference or a lambda function. When using a lambda it will be converted to -the name, e.g. "<lambda>123". Examples: +Some options ('completefunc', 'findfunc', 'omnifunc', 'operatorfunc', +'quickfixtextfunc', 'tagfunc' and 'thesaurusfunc') are set to a function name +or a function reference or a lambda function. When using a lambda it will be +converted to the name, e.g. "<lambda>123". +Examples: > set opfunc=MyOpFunc set opfunc=function('MyOpFunc') @@ -647,11 +642,12 @@ Hidden options *hidden-options* Not all options are supported in all versions. This depends on the supported features and sometimes on the system. A remark about this is in curly braces -below. When an option is not supported it may still be set without getting an -error, this is called a hidden option. You can't get the value of a hidden -option though, it is not stored. +below. When an option is not supported, it is called a hidden option. Trying +to get the value of a hidden option will not give an error, it will return the +default value for that option instead. You can't change the value of a hidden +option. -To test if option "foo" can be used with ":set" use something like this: > +To test if "foo" is a valid option name, use something like this: > if exists('&foo') This also returns true for a hidden option. To test if option "foo" is really supported use something like this: > @@ -897,12 +893,13 @@ A jump table for the options with a short description can be found at |Q_op|. useful for example in source trees where all the files are symbolic or hard links and any changes should stay in the local source tree, not be propagated back to the original source. - *crontab* + *crontab* One situation where "no" and "auto" will cause problems: A program that opens a file, invokes Vim to edit that file, and then tests if the open file was changed (through the file descriptor) will check the backup file instead of the newly created file. "crontab -e" is an - example. + example, as are several |file-watcher| daemons like inotify. In that + case you probably want to switch this option. When a copy is made, the original file is truncated and then filled with the new text. This means that protection bits, owner and @@ -1014,6 +1011,7 @@ A jump table for the options with a short description can be found at |Q_op|. separated list of items. For each item that is present, the bell will be silenced. This is most useful to specify specific events in insert mode to be silenced. + You can also make it flash by using 'visualbell'. item meaning when present ~ all All events. @@ -1037,6 +1035,7 @@ A jump table for the options with a short description can be found at |Q_op|. register Unknown register after <C-R> in |Insert-mode|. shell Bell from shell output |:!|. spell Error happened on spell suggest. + term Bell from |:terminal| output. wildmode More matches in |cmdline-completion| available (depends on the 'wildmode' setting). @@ -1138,16 +1137,6 @@ A jump table for the options with a short description can be found at |Q_op|. added for the 'showbreak' setting. (default: off) - *'browsedir'* *'bsdir'* -'browsedir' 'bsdir' string (default "last") - global - Which directory to use for the file browser: - last Use same directory as with last file browser, where a - file was opened or saved. - buffer Use the directory of the related buffer. - current Use the current directory. - {path} Use the specified directory - *'bufhidden'* *'bh'* 'bufhidden' 'bh' string (default "") local to buffer |local-noglobal| @@ -1414,7 +1403,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'cmdheight'* *'ch'* 'cmdheight' 'ch' number (default 1) - global or local to tab page |global-local| + 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 @@ -1585,7 +1574,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'completeslash'* *'csl'* 'completeslash' 'csl' string (default "") local to buffer - only for MS-Windows + only modifiable in MS-Windows When this option is set it overrules 'shellslash' for completion: - When this option is set to "slash", a forward slash is used for path completion in insert mode. This is useful when editing HTML tag, or @@ -2611,6 +2600,55 @@ A jump table for the options with a short description can be found at |Q_op|. eob EndOfBuffer |hl-EndOfBuffer| lastline NonText |hl-NonText| + *'findfunc'* *'ffu'* *E1514* +'findfunc' 'ffu' string (default "") + global or local to buffer |global-local| + Function that is called to obtain the filename(s) for the |:find| + command. When this option is empty, the internal |file-searching| + mechanism is used. + + The value can be the name of a function, a |lambda| or a |Funcref|. + See |option-value-function| for more information. + + The function is called with two arguments. The first argument is a + |String| and is the |:find| command argument. The second argument is + a |Boolean| and is set to |v:true| when the function is called to get + a List of command-line completion matches for the |:find| command. + The function should return a List of strings. + + The function is called only once per |:find| command invocation. + The function can process all the directories specified in 'path'. + + If a match is found, the function should return a |List| containing + one or more file names. If a match is not found, the function + should return an empty List. + + If any errors are encountered during the function invocation, an + empty List is used as the return value. + + It is not allowed to change text or jump to another window while + executing the 'findfunc' |textlock|. + + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + + Examples: + >vim + " Use glob() + func FindFuncGlob(cmdarg, cmdcomplete) + let pat = a:cmdcomplete ? $'{a:cmdarg}*' : a:cmdarg + return glob(pat, v:false, v:true) + endfunc + set findfunc=FindFuncGlob + + " Use the 'git ls-files' output + func FindGitFiles(cmdarg, cmdcomplete) + let fnames = systemlist('git ls-files') + return fnames->filter('v:val =~? a:cmdarg') + endfunc + set findfunc=FindGitFiles +< + *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* 'fixendofline' 'fixeol' boolean (default on) local to buffer @@ -3097,136 +3135,6 @@ A jump table for the options with a short description can be found at |Q_op|. When 'guifont' has a valid font and 'guifontwide' is empty Vim will attempt to set 'guifontwide' to a matching double-width font. - *'guioptions'* *'go'* -'guioptions' 'go' string (default "egmrLT" (MS-Windows)) - global - This option only has an effect in the GUI version of Vim. It is a - sequence of letters which describes what components and options of the - GUI should be used. - To avoid problems with flags that are added in the future, use the - "+=" and "-=" feature of ":set" |add-option-flags|. - - Valid letters are as follows: - *guioptions_a* *'go-a'* - 'a' Autoselect: If present, then whenever VISUAL mode is started, - or the Visual area extended, Vim tries to become the owner of - the windowing system's global selection. This means that the - Visually highlighted text is available for pasting into other - applications as well as into Vim itself. When the Visual mode - ends, possibly due to an operation on the text, or when an - application wants to paste the selection, the highlighted text - is automatically yanked into the "* selection register. - Thus the selection is still available for pasting into other - applications after the VISUAL mode has ended. - If not present, then Vim won't become the owner of the - windowing system's global selection unless explicitly told to - by a yank or delete operation for the "* register. - The same applies to the modeless selection. - *'go-P'* - 'P' Like autoselect but using the "+ register instead of the "* - register. - *'go-A'* - 'A' Autoselect for the modeless selection. Like 'a', but only - applies to the modeless selection. - - 'guioptions' autoselect Visual autoselect modeless ~ - "" - - - "a" yes yes - "A" - yes - "aA" yes yes - - *'go-c'* - 'c' Use console dialogs instead of popup dialogs for simple - choices. - *'go-d'* - 'd' Use dark theme variant if available. - *'go-e'* - 'e' Add tab pages when indicated with 'showtabline'. - 'guitablabel' can be used to change the text in the labels. - When 'e' is missing a non-GUI tab pages line may be used. - The GUI tabs are only supported on some systems, currently - Mac OS/X and MS-Windows. - *'go-i'* - 'i' Use a Vim icon. - *'go-m'* - 'm' Menu bar is present. - *'go-M'* - 'M' The system menu "$VIMRUNTIME/menu.vim" is not sourced. Note - that this flag must be added in the vimrc file, before - switching on syntax or filetype recognition (when the |gvimrc| - file is sourced the system menu has already been loaded; the - `:syntax on` and `:filetype on` commands load the menu too). - *'go-g'* - 'g' Grey menu items: Make menu items that are not active grey. If - 'g' is not included inactive menu items are not shown at all. - *'go-T'* - 'T' Include Toolbar. Currently only in Win32 GUI. - *'go-r'* - 'r' Right-hand scrollbar is always present. - *'go-R'* - 'R' Right-hand scrollbar is present when there is a vertically - split window. - *'go-l'* - 'l' Left-hand scrollbar is always present. - *'go-L'* - 'L' Left-hand scrollbar is present when there is a vertically - split window. - *'go-b'* - 'b' Bottom (horizontal) scrollbar is present. Its size depends on - the longest visible line, or on the cursor line if the 'h' - flag is included. |gui-horiz-scroll| - *'go-h'* - 'h' Limit horizontal scrollbar size to the length of the cursor - line. Reduces computations. |gui-horiz-scroll| - - And yes, you may even have scrollbars on the left AND the right if - you really want to :-). See |gui-scrollbars| for more information. - - *'go-v'* - 'v' Use a vertical button layout for dialogs. When not included, - a horizontal layout is preferred, but when it doesn't fit a - vertical layout is used anyway. Not supported in GTK 3. - *'go-p'* - 'p' Use Pointer callbacks for X11 GUI. This is required for some - window managers. If the cursor is not blinking or hollow at - the right moment, try adding this flag. This must be done - before starting the GUI. Set it in your |gvimrc|. Adding or - removing it after the GUI has started has no effect. - *'go-k'* - 'k' Keep the GUI window size when adding/removing a scrollbar, or - toolbar, tabline, etc. Instead, the behavior is similar to - when the window is maximized and will adjust 'lines' and - 'columns' to fit to the window. Without the 'k' flag Vim will - try to keep 'lines' and 'columns' the same when adding and - removing GUI components. - - *'guitablabel'* *'gtl'* -'guitablabel' 'gtl' string (default "") - global - When non-empty describes the text to use in a label of the GUI tab - pages line. When empty and when the result is empty Vim will use a - default label. See |setting-guitablabel| for more info. - - The format of this option is like that of 'statusline'. - 'guitabtooltip' is used for the tooltip, see below. - The expression will be evaluated in the |sandbox| when set from a - modeline, see |sandbox-option|. - This option cannot be set in a modeline when 'modelineexpr' is off. - - Only used when the GUI tab pages line is displayed. 'e' must be - present in 'guioptions'. For the non-GUI tab pages line 'tabline' is - used. - - *'guitabtooltip'* *'gtt'* -'guitabtooltip' 'gtt' string (default "") - global - When non-empty describes the text to use in a tooltip for the GUI tab - pages line. When empty Vim will use a default tooltip. - This option is otherwise just like 'guitablabel' above. - You can include a line break. Simplest method is to use |:let|: >vim - let &guitabtooltip = "line one\nline two" -< - *'helpfile'* *'hf'* 'helpfile' 'hf' string (default (MS-Windows) "$VIMRUNTIME\doc\help.txt" (others) "$VIMRUNTIME/doc/help.txt") @@ -3289,7 +3197,8 @@ A jump table for the options with a short description can be found at |Q_op|. global A history of ":" commands, and a history of previous search patterns is remembered. This option decides how many entries may be stored in - each of these histories (see |cmdline-editing|). + each of these histories (see |cmdline-editing| and 'msghistory' for + the number of messages to remember). The maximum value is 10000. *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* @@ -3344,23 +3253,6 @@ A jump table for the options with a short description can be found at |Q_op|. Can be overruled by using "\c" or "\C" in the pattern, see |/ignorecase|. - *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'* -'imcmdline' 'imc' boolean (default off) - global - When set the Input Method is always on when starting to edit a command - line, unless entering a search pattern (see 'imsearch' for that). - Setting this option is useful when your input method allows entering - English characters directly, e.g., when it's used to type accented - characters with dead keys. - - *'imdisable'* *'imd'* *'noimdisable'* *'noimd'* -'imdisable' 'imd' boolean (default off, on for some systems (SGI)) - global - When set the Input Method is never used. This is useful to disable - the IM when it doesn't work properly. - Currently this option is on by default for SGI/IRIX machines. This - may change in later releases. - *'iminsert'* *'imi'* 'iminsert' 'imi' number (default 0) local to buffer @@ -4392,75 +4284,18 @@ A jump table for the options with a short description can be found at |Q_op|. < Will make Nvim scroll 5 lines at a time when scrolling vertically, and scroll 2 columns at a time when scrolling horizontally. - *'mouseshape'* *'mouses'* *E547* -'mouseshape' 'mouses' string (default "i:beam,r:beam,s:updown,sd:cross, - m:no,ml:up-arrow,v:rightup-arrow") - global - This option tells Vim what the mouse pointer should look like in - different modes. The option is a comma-separated list of parts, much - like used for 'guicursor'. Each part consist of a mode/location-list - and an argument-list: - mode-list:shape,mode-list:shape,.. - The mode-list is a dash separated list of these modes/locations: - In a normal window: ~ - n Normal mode - v Visual mode - ve Visual mode with 'selection' "exclusive" (same as 'v', - if not specified) - o Operator-pending mode - i Insert mode - r Replace mode - - Others: ~ - c appending to the command-line - ci inserting in the command-line - cr replacing in the command-line - m at the 'Hit ENTER' or 'More' prompts - ml idem, but cursor in the last line - e any mode, pointer below last window - s any mode, pointer on a status line - sd any mode, while dragging a status line - vs any mode, pointer on a vertical separator line - vd any mode, while dragging a vertical separator line - a everywhere - - The shape is one of the following: - avail name looks like ~ - w x arrow Normal mouse pointer - w x blank no pointer at all (use with care!) - w x beam I-beam - w x updown up-down sizing arrows - w x leftright left-right sizing arrows - w x busy The system's usual busy pointer - w x no The system's usual "no input" pointer - x udsizing indicates up-down resizing - x lrsizing indicates left-right resizing - x crosshair like a big thin + - x hand1 black hand - x hand2 white hand - x pencil what you write with - x question big ? - x rightup-arrow arrow pointing right-up - w x up-arrow arrow pointing up - x <number> any X11 pointer number (see X11/cursorfont.h) - - The "avail" column contains a 'w' if the shape is available for Win32, - x for X11. - Any modes not specified or shapes not available use the normal mouse - pointer. - - Example: >vim - set mouseshape=s:udsizing,m:no -< will make the mouse turn to a sizing arrow over the status lines and - indicate no input when the hit-enter prompt is displayed (since - clicking the mouse has no effect in this state.) - *'mousetime'* *'mouset'* 'mousetime' 'mouset' number (default 500) global Defines the maximum time in msec between two mouse clicks for the second click to be recognized as a multi click. + *'msghistory'* *'mhi'* +'msghistory' 'mhi' number (default 500) + global + Determines how many entries are remembered in the |:messages| history. + The maximum value is 10000. + *'nrformats'* *'nf'* 'nrformats' 'nf' string (default "bin,hex") local to buffer @@ -4558,16 +4393,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - *'opendevice'* *'odev'* *'noopendevice'* *'noodev'* -'opendevice' 'odev' boolean (default off) - global - only for Windows - Enable reading and writing from devices. This may get Vim stuck on a - device that can be opened but doesn't actually do the I/O. Therefore - it is off by default. - Note that on Windows editing "aux.h", "lpt1.txt" and the like also - result in editing a device. - *'operatorfunc'* *'opfunc'* 'operatorfunc' 'opfunc' string (default "") global @@ -5363,7 +5188,7 @@ A jump table for the options with a short description can be found at |Q_op|. *shell-powershell* To use PowerShell: >vim let &shell = executable('pwsh') ? 'pwsh' : 'powershell' - let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' + let &shellcmdflag = '-NoLogo -NonInteractive -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';$PSStyle.OutputRendering=''plaintext'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' set shellquote= shellxquote= @@ -5460,9 +5285,9 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'shellslash'* *'ssl'* *'noshellslash'* *'nossl'* -'shellslash' 'ssl' boolean (default off) +'shellslash' 'ssl' boolean (default on, Windows: off) global - only for MS-Windows + only modifiable in MS-Windows When set, a forward slash is used when expanding file names. This is useful when a Unix-like shell is used instead of cmd.exe. Backward slashes can still be typed, but they are changed to forward slashes by @@ -6275,7 +6100,7 @@ A jump table for the options with a short description can be found at |Q_op|. Examples: Emulate standard status line with 'ruler' set >vim - set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P < Similar, but add ASCII value of char under the cursor (like "ga") >vim set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P < Display byte count and byte value, modified flag in red. >vim @@ -6762,7 +6587,9 @@ A jump table for the options with a short description can be found at |Q_op|. window. This happens only when the 'title' option is on. When this option contains printf-style '%' items, they will be - expanded according to the rules used for 'statusline'. + expanded according to the rules used for 'statusline'. If it contains + an invalid '%' format, the value is used as-is and no error or warning + will be given when the value is set. This option cannot be set in a modeline when 'modelineexpr' is off. Example: >vim diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 8ec02276cc..7f0938be05 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -154,7 +154,7 @@ or auto suspended with nohlsearch plugin. See |nohlsearch-install|. When 'shortmess' does not include the "S" flag, Vim will automatically show an -index, on which the cursor is. This can look like this: > +index, on which the cursor is. This can look like this: > [1/5] Cursor is on first of 5 matches. [1/>99] Cursor is on first of more than 99 matches. @@ -743,7 +743,7 @@ overview. \([a-z]\+\)\zs,\1 ",abc" in "abc,abc" \@123<= - Like "\@<=" but only look back 123 bytes. This avoids trying lots + Like "\@<=" but only look back 123 bytes. This avoids trying lots of matches that are known to fail and make executing the pattern very slow. Example, check if there is a "<" just before "span": /<\@1<=span @@ -769,7 +769,7 @@ overview. \(\/\/.*\)\@<!in "in" which is not after "//" \@123<! - Like "\@<!" but only look back 123 bytes. This avoids trying lots of + Like "\@<!" but only look back 123 bytes. This avoids trying lots of matches that are known to fail and make executing the pattern very slow. @@ -892,7 +892,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): inside the Visual area put it at the start and just before the end of the pattern, e.g.: > /\%Vfoo.*ba\%Vr -< This also works if only "foo bar" was Visually selected. This: > +< This also works if only "foo bar" was Visually selected. This: > /\%Vfoo.*bar\%V < would match "foo bar" if the Visual selection continues after the "r". Only works for the current buffer. @@ -999,7 +999,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): < To match all characters after the current virtual column (where the cursor is): > /\%>.v.* -< Column 17 is not included, because this is a |/zero-width| match. To +< Column 17 is not included, because this is a |/zero-width| match. To include the column use: > /^.*\%17v. < This command does the same thing, but also matches when there is no @@ -1123,11 +1123,11 @@ x A single character, with no special meaning, matches itself in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'. - If two characters in the sequence are separated by '-', this is shorthand for the full list of ASCII characters between them. E.g., - "[0-9]" matches any decimal digit. If the starting character exceeds - the ending character, e.g. [c-a], E944 occurs. Non-ASCII characters + "[0-9]" matches any decimal digit. If the starting character exceeds + the ending character, e.g. [c-a], E944 occurs. Non-ASCII characters can be used, but the character values must not be more than 256 apart - in the old regexp engine. For example, searching by [\u3000-\u4000] - after setting re=1 emits a E945 error. Prepending \%#=2 will fix it. + in the old regexp engine. For example, searching by [\u3000-\u4000] + after setting re=1 emits a E945 error. Prepending \%#=2 will fix it. - A character class expression is evaluated to the set of characters belonging to that character class. The following character classes are supported: @@ -1193,7 +1193,7 @@ x A single character, with no special meaning, matches itself any character that's not in "^]-\bdertnoUux". "[\xyz]" matches '\', 'x', 'y' and 'z'. It's better to use "\\" though, future expansions may use other characters after '\'. - - Omitting the trailing ] is not considered an error. "[]" works like + - Omitting the trailing ] is not considered an error. "[]" works like "[]]", it matches the ']' character. - The following translations are accepted when the 'l' flag is not included in 'cpoptions': @@ -1425,14 +1425,14 @@ Finally, these constructs are unique to Perl: display you may get unexpected results. That is because Vim looks for a match in the line where redrawing starts. - Also see |matcharg()| and |getmatches()|. The former returns + Also see |matcharg()| and |getmatches()|. The former returns the highlight group and pattern of a previous |:match| command. The latter returns a list with highlight groups and patterns defined by both |matchadd()| and |:match|. Highlighting matches using |:match| are limited to three matches (aside from |:match|, |:2match| and |:3match| are - available). |matchadd()| does not have this limitation and in + available). |matchadd()| does not have this limitation and in addition makes it possible to prioritize matches. Another example, which highlights all characters in virtual @@ -1461,7 +1461,7 @@ Finally, these constructs are unique to Perl: with the lowest number has priority if several match at the same position. It uses the match id 3. The ":3match" command is used by (older Vims) |matchparen| - plugin. You are suggested to use ":match" for manual matching + plugin. You are suggested to use ":match" for manual matching and ":2match" for another plugin or even better make use of the more flexible |matchadd()| (and similar) functions instead. @@ -1470,10 +1470,10 @@ Finally, these constructs are unique to Perl: Fuzzy matching refers to matching strings using a non-exact search string. Fuzzy matching will match a string, if all the characters in the search string -are present anywhere in the string in the same order. Case is ignored. In a +are present anywhere in the string in the same order. Case is ignored. In a matched string, other characters can be present between two consecutive -characters in the search string. If the search string has multiple words, then -each word is matched separately. So the words in the search string can be +characters in the search string. If the search string has multiple words, then +each word is matched separately. So the words in the search string can be present in any order in a string. Fuzzy matching assigns a score for each matched string based on the following @@ -1492,8 +1492,8 @@ will match the strings "GetPattern", "PatternGet", "getPattern", "patGetter", "getSomePattern", "MatchpatternGet" etc. The functions |matchfuzzy()| and |matchfuzzypos()| can be used to fuzzy search -a string in a List of strings. The matchfuzzy() function returns a List of -matching strings. The matchfuzzypos() functions returns the List of matches, +a string in a List of strings. The matchfuzzy() function returns a List of +matching strings. The matchfuzzypos() functions returns the List of matches, the matching positions and the fuzzy match scores. The "f" flag of `:vimgrep` enables fuzzy matching. diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 0652fb27e7..09d1369d46 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -54,9 +54,10 @@ Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* Browsing With A Horizontally Split Window...........|netrw-o| Browsing With A New Tab.............................|netrw-t| Browsing With A Vertically Split Window.............|netrw-v| - Change File Permission..............................|netrw-gp| - Change Listing Style.(thin wide long tree)..........|netrw-i| + Change Listing Style (thin wide long tree)..........|netrw-i| Changing To A Bookmarked Directory..................|netrw-gb| + Quick hide/unhide of dot-files......................|netrw-gh| + Changing local-only File Permission.................|netrw-gp| Changing To A Predecessor Directory.................|netrw-u| Changing To A Successor Directory...................|netrw-U| Customizing Browsing With A Special Handler.........|netrw-x| @@ -1465,98 +1466,106 @@ With either form of the command, netrw will first ask for confirmation that the removal is in fact what you want to do. If netrw doesn't have permission to remove a file, it will issue an error message. - *netrw-gx* CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2 - (also see |netrw_filehandler|) Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are best seen with a special handler (ie. a tool provided with your computer's -operating system). Netrw allows one to invoke such special handlers by: > +operating system). Netrw allows one to invoke such special handlers by: - * when Exploring, hit the "x" key - * when editing, hit gx with the cursor atop the special filename -< (latter not available if the |g:netrw_nogx| variable exists) + * hitting gx with the cursor atop the file path or alternatively x + in a netrw buffer; the former can be disabled by defining the + |g:netrw_nogx| variable + * when in command line, typing :Open <path>, see |:Open| below. -Netrw determines which special handler by the following method: - - * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to - view files. Examples of useful settings (place into your <.vimrc>): > - - :let g:netrw_browsex_viewer= "kfmclient exec" -< or > - :let g:netrw_browsex_viewer= "xdg-open" -< - If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be - used instead (see |netrw_filehandler|). - - If the viewer you wish to use does not support handling of a remote URL - directory, set |g:netrw_browsex_support_remote| to 0. - * for Windows 32 or 64, the URL and FileProtocolHandler dlls are used. - * for Gnome (with gnome-open): gnome-open is used. - * for KDE (with kfmclient) : kfmclient is used - * for Mac OS X : open is used. - * otherwise the netrwFileHandler plugin is used. - -The file's suffix is used by these various approaches to determine an -appropriate application to use to "handle" these files. Such things as -OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps, -*.eps) can be handled. - -The gx mapping extends to all buffers; apply "gx" while atop a word and netrw -will apply a special handler to it (like "x" works when in a netrw buffer). One may also use visual mode (see |visual-start|) to select the text that the -special handler will use. Normally gx uses expand("<cfile>") to pick up the -text under the cursor; one may change what |expand()| uses via the +special handler will use. Normally gx checks for a close-by URL or file name +to pick up the text under the cursor; one may change what |expand()| uses via the |g:netrw_gx| variable (options include "<cword>", "<cWORD>"). Note that expand("<cfile>") depends on the |'isfname'| setting. Alternatively, one may select the text to be used by gx by making a visual selection (see |visual-block|) and then pressing gx. +The selection function can be adapted for each filetype by adding a function +`Netrw_get_URL_<filetype>`, where <filetype> is given by the 'filetype'. +The function should return the URL or file name to be used by gx, and will +fall back to the default behavior if it returns an empty string. +For example, special handlers for links Markdown and HTML are + +" make gx work on concealed links regardless of exact cursor position: > + + function Netrw_get_URL_markdown() + " markdown URL such as [link text](http://ya.ru 'yandex search') + try + let save_view = winsaveview() + if searchpair('\[.\{-}\](', '', ')\zs', 'cbW', '', line('.')) > 0 + return matchstr(getline('.')[col('.')-1:], + \ '\[.\{-}\](\zs' .. g:netrw_regex_url .. '\ze\(\s\+.\{-}\)\?)') + endif + return '' + finally + call winrestview(save_view) + endtry + endfunction + + function Netrw_get_URL_html() + " HTML URL such as <a href='http://www.python.org'>Python is here</a> + " <a href="http://www.python.org"/> + try + let save_view = winsaveview() + if searchpair('<a\s\+href=', '', '\%(</a>\|/>\)\zs', 'cbW', '', line('.')) > 0 + return matchstr(getline('.')[col('.') - 1 : ], + \ 'href=["'.."'"..']\?\zs\S\{-}\ze["'.."'"..']\?/\?>') + endif + return '' + finally + call winrestview(save_view) + endtry + endfunction +< +Other than a file path, the text under the cursor may be a URL. Netrw uses +by default the following regular expression to determine if the text under the +cursor is a URL: +> + :let g:netrw_regex_url = '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}' +< Associated setting variables: |g:netrw_gx| control how gx picks up the text under the cursor |g:netrw_nogx| prevent gx map while editing |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages - *netrw_filehandler* +OPENING FILES AND LAUNCHING APPS *netrw-gx* *:Open* *:Launch* {{{2 -When |g:netrw_browsex_viewer| exists and is "-", then netrw will attempt to -handle the special file with a vim function. The "x" map applies a function -to a file, based on its extension. Of course, the handler function must exist -for it to be called! -> - Ex. mypgm.html x -> NFH_html("scp://user@host/some/path/mypgm.html") +Netrw determines which special handler by the following method: -< Users may write their own netrw File Handler functions to - support more suffixes with special handling. See - <autoload/netrwFileHandlers.vim> for examples on how to make - file handler functions. As an example: > + * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to + view files. + If the viewer you wish to use does not support handling of a remote URL + directory, set |g:netrw_browsex_support_remote| to 0. + * otherwise: - " NFH_suffix(filename) - fun! NFH_suffix(filename) - ..do something special with filename.. - endfun -< -These functions need to be defined in some file in your .vim/plugin -(vimfiles\plugin) directory. Vim's function names may not have punctuation -characters (except for the underscore) in them. To support suffices that -contain such characters, netrw will first convert the suffix using the -following table: > - - @ -> AT ! -> EXCLAMATION % -> PERCENT - : -> COLON = -> EQUAL ? -> QUESTION - , -> COMMA - -> MINUS ; -> SEMICOLON - $ -> DOLLAR + -> PLUS ~ -> TILDE -< -So, for example: > + * for Windows : explorer.exe is used + * for Mac OS X : open is used. + * for Linux : xdg-open is used. + +To open a path (or URL) <path> by the appropriate handler, type > - file.rcs,v -> NFH_rcsCOMMAv() + :Open <path> < -If more such translations are necessary, please send me email: > - NcampObell@SdrPchip.AorgM-NOSPAM -with a request. (remove the embedded NOSPAM first) +No escaping, neither for the shell nor for Vim's command-line, is needed. + +To launch a specific application <app> <args>, often <args> being <path> > + + :Launch <app> <args>. + +Since <args> can be arbitrarily complex, in particular contain many file +paths, the escaping is left to the user. -Associated setting variable: |g:netrw_browsex_viewer| +If you disabled the netrw plugin by setting g:loaded_netrwPlugin (see +|netrw-noload|), then you can use > + :call netrw#Launch('<app> <args>') + :call netrw#Open('<path>') +< *netrw-curdir* DELETING BOOKMARKS *netrw-mB* {{{2 @@ -2569,12 +2578,7 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_browsex_viewer* specify user's preference for a viewer: > "kfmclient exec" "gnome-open" -< If > - "-" -< is used, then netrwFileHandler() will look for - a script/function to handle the given - extension. (see |netrw_filehandler|). - +< *g:netrw_browsex_support_remote* specify if the specified viewer supports a remote URL. (see |netrw-handler|). diff --git a/runtime/doc/pi_paren.txt b/runtime/doc/pi_paren.txt index 77083362da..caa88e8d56 100644 --- a/runtime/doc/pi_paren.txt +++ b/runtime/doc/pi_paren.txt @@ -10,6 +10,7 @@ The functionality mentioned here is a |standard-plugin|. This plugin is only available if 'compatible' is not set. You can avoid loading this plugin by setting the "loaded_matchparen" variable: > + :let loaded_matchparen = 1 The plugin installs CursorMoved, CursorMovedI and WinEnter autocommands to @@ -29,6 +30,16 @@ the ":highlight" command. Example: > :hi MatchParen ctermbg=blue guibg=lightblue +By default the plugin will highlight both the paren under the cursor and the +matching one using the |hl-MatchParen| highlighting group. This may result in +the cursor briefly disappearing from the screen as the MatchParen colors take +over the cursor highlight. To prevent this from happening and have the plugin +only highlight the matching paren and not the one under the cursor +(effectively leaving the cursor style unchanged), you can set the +"matchparen_disable_cursor_hl" variable: > + + :let matchparen_disable_cursor_hl = 1 + The characters to be matched come from the 'matchpairs' option. You can change the value to highlight different matches. Note that not everything is possible. For example, you can't highlight single or double quotes, because @@ -46,10 +57,10 @@ are: closed folds. - 'synmaxcol' times 2 bytes before or after the cursor to avoid a delay in a long line with syntax highlighting. -- A timeout of 300 msec (60 msec in Insert mode). This can be changed with the - g:matchparen_timeout and g:matchparen_insert_timeout variables and their - buffer-local equivalents b:matchparen_timeout and - b:matchparen_insert_timeout. +- A timeout of 300 msec (60 msec in Insert mode). This can be changed with + the "g:matchparen_timeout" and "g:matchparen_insert_timeout" variables and + their buffer-local equivalents "b:matchparen_timeout" and + "b:matchparen_insert_timeout". If you would like the |%| command to work better, the |matchit| plugin can be used. This plugin also helps to skip matches in comments. This is unrelated diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 63109bdaf3..b3399b2766 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -349,7 +349,7 @@ processing a quickfix or location list command, it will be aborted. Example: > :g/mypattern/caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".") < - *:lad* *:addd* *:laddexpr* + *:lad* *:ladd* *:laddexpr* :lad[dexpr] {expr} Same as ":caddexpr", except the location list for the current window is used instead of the quickfix list. @@ -1366,6 +1366,32 @@ being checked. To disable this set g:perl_compiler_force_warnings to a zero value. For example: > let g:perl_compiler_force_warnings = 0 +MYPY TYPE CHECKER *compiler-mypy* + +Commonly used compiler options can be added to 'makeprg' by setting the +b/g:mypy_makeprg_params variable. For example: > + + let b:mypy_makeprg_params = "--warn-unused-ignores" + +The global default is "--strict --ignore-missing-imports". + +RUFF LINTER *compiler-ruff* + +Commonly used compiler options can be added to 'makeprg' by setting the +b/g:ruff_makeprg_params variable. For example: > + + let b:ruff_makeprg_params = "--max-line-length "..&textwidth + +The global default is "--preview". + +PYLINT LINTER *compiler-pylint* + +Commonly used compiler options can be added to 'makeprg' by setting the +b/g:pylint_makeprg_params variable. For example: > + + let b:pylint_makeprg_params = "--max-line-length "..&textwidth + +The global default is "--jobs=0" to use (almost) all cores. PYUNIT COMPILER *compiler-pyunit* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index d77750b485..f43ddb57fb 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -705,6 +705,7 @@ Short explanation of each option: *option-list* 'fileignorecase' 'fic' ignore case when using file names 'filetype' 'ft' type of file, used for autocommands 'fillchars' 'fcs' characters to use for displaying special items +'findfunc' 'ffu' function to be called for the |:find| command 'fixendofline' 'fixeol' make sure last line in file has <EOL> 'foldclose' 'fcl' close a fold when the cursor leaves it 'foldcolumn' 'fdc' width of the column used to indicate folds diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 521d690d93..abeefb980e 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -967,21 +967,24 @@ For example, to profile the one_script.vim script file: > :prof[ile] start {fname} *:prof* *:profile* *E750* - Start profiling, write the output in {fname} upon exit. + Start profiling, write the output in {fname} upon exit or when + a `:profile stop` or `:profile dump` command is invoked. "~/" and environment variables in {fname} will be expanded. If {fname} already exists it will be silently overwritten. The variable |v:profiling| is set to one. :prof[ile] stop - Write the logfile and stop profiling. + Write the collected profiling information to the logfile and + stop profiling. You can use the `:profile start` command to + clear the profiling statistics and start profiling again. :prof[ile] pause - Don't profile until the following ":profile continue". Can be - used when doing something that should not be counted (e.g., an - external command). Does not nest. + Stop profiling until the next `:profile continue` command. + Can be used when doing something that should not be counted + (e.g., an external command). Does not nest. :prof[ile] continue - Continue profiling after ":profile pause". + Continue profiling after `:profile pause`. :prof[ile] func {pattern} Profile function that matches the pattern {pattern}. @@ -999,16 +1002,24 @@ For example, to profile the one_script.vim script file: > won't work. :prof[ile] dump - Don't wait until exiting Vim and write the current state of - profiling to the log immediately. + Write the current state of profiling to the logfile + immediately. After running this command, Vim continues to + collect the profiling statistics. :profd[el] ... *:profd* *:profdel* Stop profiling for the arguments specified. See |:breakdel| - for the arguments. - + for the arguments. Examples: > + profdel func MyFunc + profdel file MyScript.vim + profdel here You must always start with a ":profile start fname" command. The resulting -file is written when Vim exits. Here is an example of the output, with line +file is written when Vim exits. For example, to profile one specific +function: > + profile start /tmp/vimprofile + profile func MyFunc + +Here is an example of the output, with line numbers prepended for the explanation: 1 FUNCTION Test2() ~ diff --git a/runtime/doc/support.txt b/runtime/doc/support.txt index 0ddf037fba..a2776fca0d 100644 --- a/runtime/doc/support.txt +++ b/runtime/doc/support.txt @@ -13,10 +13,10 @@ Supported platforms *supported-platforms* `System` `Tier` `Versions` `Tested versions` Linux 1 >= 2.6.32, glibc >= 2.12 Ubuntu 24.04 -macOS (Intel) 1 >= 11 macOS 12 +macOS (Intel) 1 >= 11 macOS 13 macOS (M1) 1 >= 11 macOS 15 Windows 64-bit 1 >= Windows 10 Version 1809 Windows Server 2022 -FreeBSD 1 >= 10 FreeBSD 13 +FreeBSD 1 >= 10 FreeBSD 14 OpenBSD 2 >= 7 MinGW 2 MinGW-w64 Windows 64-bit 3 < Windows 10 Version 1809 diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 219be92c58..75a855bbdd 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -45,7 +45,7 @@ directory where the Vim stuff is located. For example, if your syntax files are in the "/usr/vim/vim82/syntax" directory, set $VIMRUNTIME to "/usr/vim/vim82". You must do this in the shell, before starting Vim. This command also sources the |menu.vim| script when the GUI is running or -will start soon. See |'go-M'| about avoiding that. +will start soon. *:hi-normal* *:highlight-normal* If you are running in the GUI, you can get white text on a black background @@ -1209,20 +1209,20 @@ on" command in your .vimrc file. When you edit an existing Fortran file, the syntax script will assume free source form if the fortran_free_source variable has been set, and assumes fixed source form if the fortran_fixed_source variable has been set. Suppose -neither of these variables have been set. In that case, the syntax script attempts to -determine which source form has been used by examining the file extension -using conventions common to the ifort, gfortran, Cray, NAG, and PathScale -compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for -free-source). No default is used for the .fpp and .ftn file extensions because -different compilers treat them differently. If none of this works, then the -script examines the first five columns of the first 500 lines of your file. If -no signs of free source form are detected, then the file is assumed to be in -fixed source form. The algorithm should work in the vast majority of cases. -In some cases, such as a file that begins with 500 or more full-line comments, -the script may incorrectly decide that the code is in fixed form. If that -happens, just add a non-comment statement beginning anywhere in the first five -columns of the first twenty-five lines, save (:w), and then reload (:e!) the -file. +neither of these variables have been set. In that case, the syntax script +attempts to determine which source form has been used by examining the file +extension using conventions common to the ifort, gfortran, Cray, NAG, and +PathScale compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 +for free-source). No default is used for the .fpp and .ftn file extensions +because different compilers treat them differently. If none of this works, +then the script examines the first five columns of the first 500 lines of your +file. If no signs of free source form are detected, then the file is assumed +to be in fixed source form. The algorithm should work in the vast majority of +cases. In some cases, such as a file that begins with 500 or more full-line +comments, the script may incorrectly decide that the code is in fixed form. +If that happens, just add a non-comment statement beginning anywhere in the +first five columns of the first twenty-five lines, save (:w), and then reload +(:e!) the file. Vendor extensions ~ Fixed-form Fortran requires a maximum line length of 72 characters but the @@ -1750,6 +1750,20 @@ define the vim variable 'lace_case_insensitive' in your startup file: > :let lace_case_insensitive=1 +LF (LFRC) *lf.vim* *ft-lf-syntax* *g:lf_shell_syntax* + *b:lf_shell_syntax* + +For the lf file manager configuration files (lfrc) the shell commands syntax +highlighting can be changed globally and per buffer by setting a different +'include' command search pattern using these variables: > + let g:lf_shell_syntax = "syntax/dosbatch.vim" + let b:lf_shell_syntax = "syntax/zsh.vim" + +These variables are unset by default. + +The default 'include' command search pattern is 'syntax/sh.vim'. + + LEX *lex.vim* *ft-lex-syntax* Lex uses brute-force synchronizing as the "^%%$" section delimiter @@ -2051,6 +2065,13 @@ set "msql_minlines" to the value you desire. Example: > :let msql_minlines = 200 +NEOMUTT *neomutt.vim* *ft-neomuttrc-syntax* + *ft-neomuttlog-syntax* + +To disable the default NeoMutt log colors: > + + :let g:neolog_disable_default_colors = 1 + N1QL *n1ql.vim* *ft-n1ql-syntax* N1QL is a SQL-like declarative language for manipulating JSON documents in @@ -2175,7 +2196,7 @@ To specify elements that should not be concealed, set the following variable: > :let g:pandoc#syntax#conceal#blacklist = [] -This is a list of the rules wich can be used here: +This is a list of the rules which can be used here: - titleblock - image @@ -2216,9 +2237,9 @@ specified. Default = 1 > :let g:pandoc#syntax#codeblocks#embeds#use = 1 -For specify what languages and using what syntax files to highlight embeds. This is a -list of language names. When the language pandoc and vim use don't match, you -can use the "PANDOC=VIM" syntax. For example: > +For specify what languages and using what syntax files to highlight embeds. +This is a list of language names. When the language pandoc and vim use don't +match, you can use the "PANDOC=VIM" syntax. For example: > :let g:pandoc#syntax#codeblocks#embeds#langs = ["ruby", "bash=sh"] @@ -3426,7 +3447,7 @@ set "tf_minlines" to the value you desire. Example: > :let tf_minlines = your choice < TYPESCRIPT *typescript.vim* *ft-typescript-syntax* - *typescriptreact.vim* *ft-typescriptreact-syntax* + *typescriptreact.vim* *ft-typescriptreact-syntax* There is one option to control the TypeScript syntax highlighting. @@ -3472,7 +3493,7 @@ This option is disabled by default. Some folding is now supported with when 'foldmethod' is set to "syntax": > g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding - g:vimsyn_folding =~ 'a' : augroups + g:vimsyn_folding =~ 'a' : fold augroups g:vimsyn_folding =~ 'f' : fold functions g:vimsyn_folding =~ 'h' : fold heredocs g:vimsyn_folding =~ 'l' : fold Lua script @@ -5202,7 +5223,7 @@ NormalNC Normal text in non-current windows. *hl-Pmenu* Pmenu Popup menu: Normal item. *hl-PmenuSel* -PmenuSel Popup menu: Selected item. +PmenuSel Popup menu: Selected item. Combined with |hl-Pmenu|. *hl-PmenuKind* PmenuKind Popup menu: Normal item "kind". *hl-PmenuKindSel* @@ -5216,9 +5237,11 @@ PmenuSbar Popup menu: Scrollbar. *hl-PmenuThumb* PmenuThumb Popup menu: Thumb of the scrollbar. *hl-PmenuMatch* -PmenuMatch Popup menu: Matched text in normal item. +PmenuMatch Popup menu: Matched text in normal item. Combined with + |hl-Pmenu|. *hl-PmenuMatchSel* -PmenuMatchSel Popup menu: Matched text in selected item. +PmenuMatchSel Popup menu: Matched text in selected item. Combined with + |hl-PmenuMatch| and |hl-PmenuSel|. *hl-Question* Question |hit-enter| prompt and yes/no questions. *hl-QuickFixLine* @@ -5450,7 +5473,8 @@ This will set the "w:current_syntax" variable to "foo". The value of restoring "b:current_syntax", since the syntax files do set "b:current_syntax". The value set by the syntax file is assigned to "w:current_syntax". -Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options. +Note: This resets the 'spell', 'spellcapcheck', 'spellfile' and 'spelloptions' +options. Once a window has its own syntax, syntax commands executed from other windows on the same buffer (including :syntax clear) have no effect. Conversely, diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 9c47e6de7d..ed9659d6e7 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -509,6 +509,7 @@ If the current window has enough horizontal space, it will be vertically split and the Var window will be shown side by side with the source code window (and the height options won't be used). + Communication ~ *termdebug-communication* There is another, hidden, buffer, which is used for Vim to communicate with @@ -601,15 +602,19 @@ If there is no g:termdebug_config you can use: >vim Change default signs ~ *termdebug_signs* Termdebug uses the hex number of the breakpoint ID in the signcolumn to -represent breakpoints. if it is greater than "0xFF", then it will be displayed +represent breakpoints. If it is greater than "0xFF", then it will be displayed as "F+", due to we really only have two screen cells for the sign. +You may also use decimal breakpoint signs instead, in which case IDs greater +than 99 will be displayed as "9+". -If you want to customize the breakpoint signs: >vim +If you want to customize the breakpoint signs to show `>>` in the signcolumn: >vim let g:termdebug_config['sign'] = '>>' -If there is no g:terminal_config yet you can use: >vim +If you would like to use decimal (base 10) breakpoint signs: >vim + let g:termdebug_config['sign_decimal'] = 1 +If the variable g:termdebug_config does not yet exist, you can use: >vim let g:termdebug_config = {'sign': '>>'} - -After this, breakpoints will be displayed as `>>` in the signcolumn. +Likewise, to enable decimal signs: >vim + let g:termdebug_config = {'sign_decimal': 1} Vim window width ~ diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 35192cc43d..5fc6429f7a 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -622,9 +622,23 @@ TSNode:child({index}) *TSNode:child()* Return: ~ (`TSNode?`) - *TSNode:child_containing_descendant()* -TSNode:child_containing_descendant({descendant}) - Get the node's child that contains {descendant}. +TSNode:child_count() *TSNode:child_count()* + Get the node's number of children. + + Return: ~ + (`integer`) + + *TSNode:child_with_descendant()* +TSNode:child_with_descendant({descendant}) + Get the node's child that contains {descendant} (includes {descendant}). + + For example, with the following node hierarchy: > + a -> b -> c + + a:child_with_descendant(c) == b + a:child_with_descendant(b) == b + a:child_with_descendant(a) == nil +< Parameters: ~ • {descendant} (`TSNode`) @@ -632,12 +646,6 @@ TSNode:child_containing_descendant({descendant}) Return: ~ (`TSNode?`) -TSNode:child_count() *TSNode:child_count()* - Get the node's number of children. - - Return: ~ - (`integer`) - *TSNode:descendant_for_range()* TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) Get the smallest node within this node that spans the given range of (row, @@ -778,9 +786,8 @@ TSNode:next_sibling() *TSNode:next_sibling()* (`TSNode?`) TSNode:parent() *TSNode:parent()* - Get the node's immediate parent. Prefer - |TSNode:child_containing_descendant()| for iterating over the node's - ancestors. + Get the node's immediate parent. Prefer |TSNode:child_with_descendant()| + for iterating over the node's ancestors. Return: ~ (`TSNode?`) @@ -1143,8 +1150,13 @@ get_lang({filetype}) *vim.treesitter.language.get_lang()* inspect({lang}) *vim.treesitter.language.inspect()* Inspects the provided language. - Inspecting provides some useful information on the language like node - names, ... + Inspecting provides some useful information on the language like node and + field names, ABI version, and whether the language came from a WASM + module. + + Node names are returned in a table mapping each node name to a `boolean` + indicating whether or not the node is named (i.e., not anonymous). + Anonymous nodes are surrounded with double quotes (`"`). Parameters: ~ • {lang} (`string`) Language @@ -1199,7 +1211,7 @@ add_predicate({name}, {handler}, {opts}) Parameters: ~ • {name} (`string`) Name of the predicate, without leading # - • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)`) + • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata): boolean?`) • see |vim.treesitter.query.add_directive()| for argument meanings • {opts} (`table?`) A table with the following fields: @@ -1593,8 +1605,7 @@ LanguageTree:register_cbs({cbs}, {recursive}) • {cbs} (`table<TSCallbackNameOn,function>`) An |nvim_buf_attach()|-like table argument with the following handlers: - • `on_bytes` : see |nvim_buf_attach()|, but this will be - called after the parsers callback. + • `on_bytes` : see |nvim_buf_attach()|. • `on_changedtree` : a callback that will be called every time the tree has syntactical changes. It will be passed two arguments: a table of the ranges (as node diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index d37cdfb9df..4e8253c47a 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -610,11 +610,12 @@ tabs. size). If the window was previously hidden, it should now be shown again. -["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable, zindex] ~ +["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, mouse_enabled, zindex] ~ Display or reconfigure floating window `win`. The window should be displayed above another grid `anchor_grid` at the specified position - `anchor_row` and `anchor_col`. For the meaning of `anchor` and more - details of positioning, see |nvim_open_win()|. + `anchor_row` and `anchor_col`. For the meaning of `anchor` and more details + of positioning, see |nvim_open_win()|. `mouse_enabled` is true if the + window can receive mouse events. ["win_external_pos", grid, win] ~ Display or reconfigure external window `win`. The window should be @@ -795,6 +796,7 @@ must handle. "echomsg" |:echomsg| message "echoerr" |:echoerr| message "lua_error" Error in |:lua| code + "lua_print" |print()| from |:lua| code "rpc_error" Error response from |rpcrequest()| "return_prompt" |press-enter| prompt after a multiple messages "quickfix" Quickfix navigation message @@ -804,10 +806,11 @@ must handle. kinds as the empty kind. content - Array of `[attr_id, text_chunk]` tuples, building up the message - text of chunks of different highlights. No extra spacing should be - added between chunks, the `text_chunk` by itself contains any - necessary whitespace. Messages can contain line breaks "\n". + Array of `[attr_id, text_chunk, hl_id]` tuples, building up the + message text of chunks of different highlights. No extra spacing + should be added between chunks, the `text_chunk` by itself + contains any necessary whitespace. Messages can contain line + breaks "\n". replace_last Decides how multiple messages should be displayed: diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index b3a49dbb7e..7d8277d90e 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -184,7 +184,7 @@ g- Go to older text state. With a count repeat that many g+ Go to newer text state. With a count repeat that many times. *:lat* *:later* -:lat[er] {count} Go to newer text state {count} times. +:lat[er] {count} Go to newer text state {count} times. :lat[er] {N}s Go to newer text state about {N} seconds later. :lat[er] {N}m Go to newer text state about {N} minutes later. :lat[er] {N}h Go to newer text state about {N} hours later. diff --git a/runtime/doc/usr_10.txt b/runtime/doc/usr_10.txt index 3e45fda882..2f55aadef0 100644 --- a/runtime/doc/usr_10.txt +++ b/runtime/doc/usr_10.txt @@ -736,6 +736,11 @@ The "!!" command filters the current line through a filter. In Unix the "date" command prints the current time and date. "!!date<Enter>" replaces the current line with the output of "date". This is useful to add a timestamp to a file. +Note: There is a difference between "!cmd" (e.g. using it without any file +range) and "{range}!cmd". While the former will simply execute the external +command and Vim will show the output, the latter will filter {range}lines +through the filter and replace that range by the result of the filter command. +See |:!| and |:range!| for details. WHEN IT DOESN'T WORK diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 8c7ed875cf..3202a70b76 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -906,6 +906,8 @@ Buffers, windows and the argument list: swapname() get the swap file path of a buffer Command line: *command-line-functions* + getcmdcomplpat() get completion pattern of the current command + line getcmdcompltype() get the type of the current command line completion getcmdline() get the current command line input diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 33da539c66..1ded5154a7 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -267,6 +267,7 @@ gx Opens the current filepath or URL (decided by < *:!cmd* *:!* :!{cmd} Execute {cmd} with 'shell'. See also |:terminal|. + For the filter command, see |:range!|. The command runs in a non-interactive shell connected to a pipe (not a terminal). Use |:terminal| to run an @@ -548,9 +549,9 @@ gO Show a filetype-specific, navigable "outline" of the If you use the less or more program to view a file, you don't get syntax highlighting. Thus you would like to use Vim instead. You can do this by -using the shell script "$VIMRUNTIME/macros/less.sh". +using the shell script "$VIMRUNTIME/scripts/less.sh". -This shell script uses the Vim script "$VIMRUNTIME/macros/less.vim". It sets +This shell script uses the Vim script "$VIMRUNTIME/scripts/less.vim". It sets up mappings to simulate the commands that less supports. Otherwise, you can still use the Vim commands. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index e069678b30..8fa94a2601 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -150,6 +150,8 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y". - |grn| - |grr| - |gra| + - |gri| + - |gO| - <C-S> |i_CTRL-S| - ]d |]d-default| - [d |[d-default| @@ -161,6 +163,7 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y". - |[t|, |]t|, |[T|, |]T|, |[CTRL-T|, |]CTRL-T| - |[a|, |]a|, |[A|, |]A| - |[b|, |]b|, |[B|, |]B| +- |[<Space>|, |]<Space>| - Nvim LSP client defaults |lsp-defaults| - K |K-lsp-default| @@ -248,7 +251,7 @@ backwards-compatibility cost. Some examples: Some features are built in that otherwise required external plugins: -- Highlighting the yanked region, see |vim.highlight|. +- Highlighting the yanked region, see |vim.hl|. ARCHITECTURE @@ -338,10 +341,8 @@ Normal commands: Options: -Local values for global-local number/boolean options are unset when the option -is set without a scope (e.g. by using |:set|), similarly to how global-local -string options work. - +- `:set {option}<` removes local value for all |global-local| options. +- `:setlocal {option}<` copies global value to local value for all options. - 'autoread' works in the terminal (if it supports "focus" events) - 'cpoptions' flags: |cpo-_| - 'diffopt' "linematch" feature @@ -561,6 +562,9 @@ Highlight groups: the regexp `[a-zA-Z0-9_.@-]*` (see |group-name|). - |hl-StatusLineTerm| |hl-StatusLineTermNC| are implemented as 'winhighlight' window-local highlights which are set by the default |TermOpen| handler. +- The |ins-completion-menu| has cascading highlight styles. |hl-PmenuSel| and + |hl-PmenuMatch| both inherit from |hl-Pmenu|, and |hl-PmenuMatchSel| + inherits highlights from both |hl-PmenuSel| and |hl-PmenuMatch|. Macro (|recording|) behavior: - Replay of a macro recorded during :lmap produces the same actions as when it @@ -619,7 +623,12 @@ These legacy Vim features are not yet implemented: - *:gui* - *:gvim* +- *'browsedir'* *'bsdir'* - *'completepopup'* +- *'guioptions'* *'go'* +- *'guitablabel'* *'gtl'* +- *'guitabtooltip'* *'gtt'* +- *'mouseshape'* *'mouses'* - *'previewpopup'* ============================================================================== @@ -726,6 +735,8 @@ Options: CMD-v (macOS), middle-click, …). - *'imactivatefunc'* *'imaf'* - *'imactivatekey'* *'imak'* +- *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'* +- *'imdisable'* *'imd'* *'noimdisable'* *'noimd'* - *'imstatusfunc'* *'imsf'* - *'insertmode'* *'im'* Use the following script to emulate 'insertmode': >vim autocmd BufWinEnter * startinsert @@ -763,6 +774,7 @@ Options: 6 composing chars only. - *'maxmem'* Nvim delegates memory-management to the OS. - *'maxmemtot'* Nvim delegates memory-management to the OS. +- *'opendevice'* *'odev'* *'noopendevice'* *'noodev'* - printoptions - *'printdevice'* - *'printencoding'* @@ -797,6 +809,10 @@ Plugins: - logiPat - rrhelper - *vimball* +- macmap.vim +- tools/check_colors.vim +- macros/{justify,matchit,shellmenu,swapmous}.vim: use `packadd! justify` etc. + directly Providers: diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt index 15d836a83d..0c349c4e57 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -152,13 +152,14 @@ v:event an aborting condition (e.g. |c_Esc| or |c_CTRL-C| for |CmdlineLeave|). chan |channel-id| + info Dict of arbitrary event data. cmdlevel Level of cmdline. cmdtype Type of cmdline, |cmdline-char|. cwd Current working directory. inclusive Motion is |inclusive|, else exclusive. scope Event-specific scope name. operator Current |operator|. Also set for Ex - commands (unlike |v:operator|). For + commands (unlike |v:operator|). For example if |TextYankPost| is triggered by the |:yank| Ex command then `v:event.operator` is "y". diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 5729dd0874..24aa7b1b11 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -69,7 +69,8 @@ If a window is focusable, it is part of the "navigation stack", that is, editor commands such as :windo, |CTRL-W|, etc., will consider the window as one that can be made the "current window". A non-focusable window will be skipped by such commands (though it can be explicitly focused by -|nvim_set_current_win()|). +|nvim_set_current_win()|). Non-focusable windows are not listed by |:tabs|, and +are not counted by the default 'tabline'. Windows (especially floating windows) can have many other |api-win_config| properties such as "hide" and "fixed" which also affect behavior. |