diff options
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/api.txt | 29 | ||||
-rw-r--r-- | runtime/doc/change.txt | 23 | ||||
-rw-r--r-- | runtime/doc/cmdline.txt | 6 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 159 | ||||
-rw-r--r-- | runtime/doc/index.txt | 2 | ||||
-rw-r--r-- | runtime/doc/intro.txt | 1 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 229 | ||||
-rw-r--r-- | runtime/doc/lua.txt | 312 | ||||
-rw-r--r-- | runtime/doc/map.txt | 16 | ||||
-rw-r--r-- | runtime/doc/mlang.txt | 12 | ||||
-rw-r--r-- | runtime/doc/options.txt | 38 | ||||
-rw-r--r-- | runtime/doc/pi_netrw.txt | 4 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 69 | ||||
-rw-r--r-- | runtime/doc/repeat.txt | 5 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 12 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 13 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 12 | ||||
-rw-r--r-- | runtime/doc/usr_42.txt | 4 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 3 |
19 files changed, 786 insertions, 163 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 2783640c3c..bdabc6a9ee 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -993,7 +993,7 @@ nvim_get_option_info({name}) *nvim_get_option_info()* Resulting dictionary has keys: • name: Name of the option (like 'filetype') • shortname: Shortened name of the option (like 'ft') - • type: type of option ("string", "integer" or "boolean") + • type: type of option ("string", "number" or "boolean") • default: The default value for the option • was_set: Whether the option was set. • last_set_sid: Last set script id (if any) @@ -1299,6 +1299,17 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* an external top-level window. Currently accepts no other positioning configuration together with this. + • `zindex`: Stacking order. floats with higher`zindex`go on top on floats with lower indices. Must + be larger than zero. The following screen + elements have hard-coded z-indices: + • 100: insert completion popupmenu + • 200: message scrollback + • 250: cmdline completion popupmenu (when + wildoptions+=pum) The default value for + floats are 50. In general, values below 100 + are recommended, unless there is a good + reason to overshadow builtin elements. + • `style`: Configure the appearance of the window. Currently only takes one non-empty value: • "minimal" Nvim will display the window with @@ -1342,6 +1353,11 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* by character: [ {"+", "MyCorner"}, {"x", "MyBorder"} ] + • `noautocmd` : If true then no buffer-related + autocommand events such as |BufEnter|, + |BufLeave| or |BufWinEnter| may fire from + calling this function. + Return: ~ Window handle, or 0 on error @@ -1705,6 +1721,12 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* |nvim_get_hl_by_name|. in addition the following keys are also recognized: `default` : don't override existing definition, like `hi default` + `ctermfg` : sets foreground of cterm color + `ctermbg` : sets background of cterm color + `cterm` : cterm attribute map. sets attributed + for cterm colors. similer to `hi cterm` Note: by + default cterm attributes are same as attributes + of gui color nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()* Sets a global |mapping| for the given mode. @@ -2269,7 +2291,12 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) • "overlay": display over the specified column, without shifting the underlying text. + • "right_align": display right aligned in the + window. + • virt_text_win_col : position the virtual text + at a fixed window column (starting from the + first text column) • virt_text_hide : hide the virtual text when the background text is selected or hidden due to horizontal scroll 'nowrap' diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 19a8be1102..924401be74 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1091,6 +1091,11 @@ inside of strings can change! Also see 'softtabstop' option. > Using the mouse only works when 'mouse' contains 'n' or 'a'. +["x]zp or *zp* *zP* +["x]zP Like "p" and "P", except without adding trailing spaces + when pasting a block. Thus the inserted text will not + always be a rectangle. + You can use these commands to copy text from one place to another. Do this by first getting the text into a register with a yank, delete or change command, then inserting the register contents with a put command. You can @@ -1130,6 +1135,9 @@ a register, a paste on a visual selected area will paste that single line on each of the selected lines (thus replacing the blockwise selected region by a block of the pasted line). +Use |zP|/|zp| to paste a blockwise yanked register without appending trailing +spaces. + *blockwise-register* If you use a blockwise Visual mode command to get the text into the register, the block of text will be inserted before ("P") or after ("p") the cursor @@ -1771,7 +1779,7 @@ Vim has a sorting function and a sorting command. The sorting function can be found here: |sort()|, |uniq()|. *:sor* *:sort* -:[range]sor[t][!] [b][f][i][n][o][r][u][x] [/{pattern}/] +:[range]sor[t][!] [b][f][i][l][n][o][r][u][x] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. @@ -1779,6 +1787,16 @@ found here: |sort()|, |uniq()|. With [i] case is ignored. + With [l] sort uses the current collation locale. + Implementation details: strcoll() is used to compare + strings. See |:language| to check or set the collation + locale. Example: > + :language collate en_US.UTF-8 + :%sort l +< |v:collate| can also used to check the current locale. + Sorting using the locale typically ignores case. + This does not work properly on Mac. + Options [n][f][x][o][b] are mutually exclusive. With [n] sorting is done on the first decimal number @@ -1847,8 +1865,7 @@ found here: |sort()|, |uniq()|. Note that using `:sort` with `:global` doesn't sort the matching lines, it's quite useless. -The details about sorting depend on the library function used. There is no -guarantee that sorting obeys the current locale. You will have to try it out. +`:sort` does not use the current locale unless the l flag is used. Vim does do a "stable" sort. The sorting can be interrupted, but if you interrupt it too late in the diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index ae43aeeb25..dcdc2384dc 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -759,13 +759,15 @@ three lines: > 3:d<CR> is translated into: .,.+2d<CR> < -Visual Mode and Range *v_:* - *:star-visual-range* +Visual Mode and Range + *v_:* {Visual}: Starts a command-line with the Visual selected lines as a range. The code `:'<,'>` is used for this range, which makes it possible to select a similar line from the command-line history for repeating a command on different Visually selected lines. + +:* *:star* *:star-visual-range* When Visual mode was already ended, a short way to use the Visual area for a range is `:*`. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 885fc2d790..b7214d1390 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1508,6 +1508,15 @@ v:cmdarg This variable is used for two purposes: the argument for the ":hardcopy" command. This can be used in 'printexpr'. + *v:collate* *collate-variable* +v:collate The current locale setting for collation order of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_COLLATE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + *v:cmdbang* *cmdbang-variable* v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" was used the value is 1, otherwise it is 0. Note that this @@ -2385,6 +2394,7 @@ screenpos({winid}, {lnum}, {col}) Dict screen row and col of a text character screenrow() Number current cursor row search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) Number search for {pattern} +searchcount([{options}]) Dict Get or update the last search count searchdecl({name} [, {global} [, {thisblock}]]) Number search for variable declaration searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) @@ -4763,8 +4773,9 @@ getqflist([{what}]) *getqflist()* id get information for the quickfix list with |quickfix-ID|; zero means the id for the current list or the list specified by "nr" - idx index of the current entry in the quickfix - list specified by 'id' or 'nr'. + idx get information for the quickfix entry at this + index in the list specified by 'id' or 'nr'. + If set to zero, then uses the current entry. See |quickfix-index| items quickfix list entries lines parse a list of lines using 'efm' and return @@ -4797,7 +4808,7 @@ getqflist([{what}]) *getqflist()* If not present, set to "". id quickfix list ID |quickfix-ID|. If not present, set to 0. - idx index of the current entry in the list. If not + idx index of the quickfix entry in the list. If not present, set to 0. items quickfix list entries. If not present, set to an empty list. @@ -7284,6 +7295,126 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* The 'n' flag tells the function not to move the cursor. +searchcount([{options}]) *searchcount()* + Get or update the last search count, like what is displayed + without the "S" flag in 'shortmess'. This works even if + 'shortmess' does contain the "S" flag. + + This returns a Dictionary. The dictionary is empty if the + previous pattern was not set and "pattern" was not specified. + + key type meaning ~ + current |Number| current position of match; + 0 if the cursor position is + before the first match + exact_match |Boolean| 1 if "current" is matched on + "pos", otherwise 0 + total |Number| total count of matches found + incomplete |Number| 0: search was fully completed + 1: recomputing was timed out + 2: max count exceeded + + For {options} see further down. + + To get the last search count when |n| or |N| was pressed, call + this function with `recompute: 0` . This sometimes returns + wrong information because |n| and |N|'s maximum count is 99. + If it exceeded 99 the result must be max count + 1 (100). If + you want to get correct information, specify `recompute: 1`: > + + " result == maxcount + 1 (100) when many matches + let result = searchcount(#{recompute: 0}) + + " Below returns correct result (recompute defaults + " to 1) + let result = searchcount() +< + The function is useful to add the count to |statusline|: > + function! LastSearchCount() abort + let result = searchcount(#{recompute: 0}) + if empty(result) + return '' + endif + if result.incomplete ==# 1 " timed out + return printf(' /%s [?/??]', @/) + elseif result.incomplete ==# 2 " max count exceeded + if result.total > result.maxcount && + \ result.current > result.maxcount + return printf(' /%s [>%d/>%d]', @/, + \ result.current, result.total) + elseif result.total > result.maxcount + return printf(' /%s [%d/>%d]', @/, + \ result.current, result.total) + endif + endif + return printf(' /%s [%d/%d]', @/, + \ result.current, result.total) + endfunction + let &statusline .= '%{LastSearchCount()}' + + " Or if you want to show the count only when + " 'hlsearch' was on + " let &statusline .= + " \ '%{v:hlsearch ? LastSearchCount() : ""}' +< + You can also update the search count, which can be useful in a + |CursorMoved| or |CursorMovedI| autocommand: > + + autocmd CursorMoved,CursorMovedI * + \ let s:searchcount_timer = timer_start( + \ 200, function('s:update_searchcount')) + function! s:update_searchcount(timer) abort + if a:timer ==# s:searchcount_timer + call searchcount(#{ + \ recompute: 1, maxcount: 0, timeout: 100}) + redrawstatus + endif + endfunction +< + This can also be used to count matched texts with specified + pattern in the current buffer using "pattern": > + + " Count '\<foo\>' in this buffer + " (Note that it also updates search count) + let result = searchcount(#{pattern: '\<foo\>'}) + + " To restore old search count by old pattern, + " search again + call searchcount() +< + {options} must be a Dictionary. It can contain: + key type meaning ~ + recompute |Boolean| if |TRUE|, recompute the count + like |n| or |N| was executed. + otherwise returns the last + result by |n|, |N|, or this + function is returned. + (default: |TRUE|) + pattern |String| recompute if this was given + and different with |@/|. + this works as same as the + below command is executed + before calling this function > + let @/ = pattern +< (default: |@/|) + timeout |Number| 0 or negative number is no + timeout. timeout milliseconds + for recomputing the result + (default: 0) + maxcount |Number| 0 or negative number is no + limit. max count of matched + text while recomputing the + result. if search exceeded + total count, "total" value + becomes `maxcount + 1` + (default: 0) + pos |List| `[lnum, col, off]` value + when recomputing the result. + this changes "current" result + value. see |cursor()|, |getpos() + (default: cursor's position) + + searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* Search for the declaration of {name}. @@ -7744,6 +7875,11 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()* nr list number in the quickfix stack; zero means the current quickfix list and "$" means the last quickfix list. + quickfixtextfunc + function to get the text to display in the + quickfix window. Refer to + |quickfix-window-function| for an explanation + of how to write the function and an example. title quickfix list title text. See |quickfix-title| Unsupported keys in {what} are ignored. If the "nr" item is not present, then the current quickfix list @@ -8007,6 +8143,23 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* When {func} is given and it is '1' or 'i' then case is ignored. + When {func} is given and it is 'l' then the current collation + locale is used for ordering. Implementation details: strcoll() + is used to compare strings. See |:language| check or set the + collation locale. |v:collate| can also be used to check the + current locale. Sorting using the locale typically ignores + case. Example: > + " ö is sorted similarly to o with English locale. + :language collate en_US.UTF8 + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') +< ['n', 'o', 'O', 'ö', 'p', 'z'] ~ +> + " ö is sorted after z with Swedish locale. + :language collate sv_SE.UTF8 + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') +< ['n', 'o', 'O', 'p', 'z', 'ö'] ~ + This does not work properly on Mac. + When {func} is given and it is 'n' then all items will be sorted numerical (Implementation detail: this uses the strtod() function to parse numbers, Strings, Lists, Dicts and diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index e7d891bc33..17258f896d 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -851,6 +851,8 @@ tag char note action in Normal mode ~ |zm| zm subtract one from 'foldlevel' |zn| zn reset 'foldenable' |zo| zo open fold +|zp| zp paste in block-mode without trailing spaces +|zP| zP paste in block-mode without trailing spaces |zr| zr add one to 'foldlevel' |zs| zs when 'wrap' off scroll horizontally to position the cursor at the start (left diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 925b3e5dbb..f739e2e88b 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -169,6 +169,7 @@ Vim would never have become what it is now, without the help of these people! Ken Takata fixes and features Kazunobu Kuriyama GTK 3 Christian Brabandt many fixes, features, user support, etc. + Yegappan Lakshmanan many quickfix features I wish to thank all the people that sent me bug reports and suggestions. The list is too long to mention them all here. Vim would not be the same without diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 5c2ee568c5..531374620a 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -619,15 +619,15 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) Calls |vim.lsp.buf_request_all()| but blocks Nvim while awaiting the result. Parameters are the same as |vim.lsp.buf_request()| but the return result is different. - Wait maximum of {timeout_ms} (default 100) ms. + Wait maximum of {timeout_ms} (default 1000) ms. Parameters: ~ {bufnr} (number) Buffer handle, or 0 for current. {method} (string) LSP method name {params} (optional, table) Parameters to send to the server - {timeout_ms} (optional, number, default=100) Maximum time - in milliseconds to wait for a result. + {timeout_ms} (optional, number, default=1000) Maximum + time in milliseconds to wait for a result. Return: ~ Map of client_id:request_result. On timeout, cancel or @@ -651,6 +651,14 @@ client() *vim.lsp.client* {status} is `true` , the function returns {request_id} as the second result. You can use this with `client.cancel_request(request_id)` to cancel the request. + • request_sync(method, params, timeout_ms, bufnr) Sends a + request to the server and synchronously waits for the + response. This is a wrapper around {client.request} + Returns: { err=err, result=result }, a dictionary, where + `err` and `result` come from the |lsp-handler|. On + timeout, cancel or error, returns `(nil, err)` where `err` + is a string describing the failure reason. If the request + was unsuccessful returns `nil` . • notify(method, params) Sends a notification to an LSP server. Returns: a boolean to indicate if the notification was successful. If it is false, then it will always be @@ -939,6 +947,9 @@ add_workspace_folder({workspace_folder}) not provided, the user will be prompted for a path using |input()|. +call_hierarchy({method}) *vim.lsp.buf.call_hierarchy()* + TODO: Documentation + clear_references() *vim.lsp.buf.clear_references()* Removes document highlights from current buffer. @@ -1017,6 +1028,32 @@ formatting({options}) *vim.lsp.buf.formatting()* See also: ~ https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting + *vim.lsp.buf.formatting_seq_sync()* +formatting_seq_sync({options}, {timeout_ms}, {order}) + Formats the current buffer by sequentially requesting + formatting from attached clients. + + Useful when multiple clients with formatting capability are + attached. + + Since it's synchronous, can be used for running on save, to + make sure buffer is formatted prior to being saved. + {timeout_ms} is passed on to the |vim.lsp.client| `request_sync` method. Example: > + + vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]] +< + + Parameters: ~ + {options} (optional, table) `FormattingOptions` + entries + {timeout_ms} (optional, number) Request timeout + {order} (optional, table) List of client names. + Formatting is requested from clients in the + following order: first all clients that are + not in the `order` list, then the remaining + clients in the order as they occur in the + `order` list. + *vim.lsp.buf.formatting_sync()* formatting_sync({options}, {timeout_ms}) Performs |vim.lsp.buf.formatting()| synchronously. @@ -1033,6 +1070,9 @@ formatting_sync({options}, {timeout_ms}) {options} Table with valid `FormattingOptions` entries {timeout_ms} (number) Request timeout + See also: ~ + |vim.lsp.buf.formatting_seq_sync| + hover() *vim.lsp.buf.hover()* Displays hover information about the symbol under the cursor in a floating window. Calling the function twice will jump @@ -1156,11 +1196,16 @@ get({bufnr}, {client_id}) *vim.lsp.diagnostic.get()* diagnostics. Else, return just the diagnostics associated with the client_id. -get_all() *vim.lsp.diagnostic.get_all()* - Get all diagnostics for all clients +get_all({client_id}) *vim.lsp.diagnostic.get_all()* + Get all diagnostics for clients + + Parameters: ~ + {client_id} number Restrict included diagnostics to the + client If nil, diagnostics of all clients are + included. Return: ~ - {bufnr:Diagnostic[]} + table with diagnostics grouped by bufnr (bufnr:Diagnostic[]) *vim.lsp.diagnostic.get_count()* get_count({bufnr}, {severity}, {client_id}) @@ -1405,6 +1450,9 @@ set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* "Warning" means { "Error", "Warning" } will be valid. + • {workspace}: (boolean, default false) + • Set the list with workspace diagnostics + *vim.lsp.diagnostic.set_signs()* set_signs({diagnostics}, {bufnr}, {client_id}, {sign_ns}, {opts}) Set signs for given diagnostics @@ -1570,6 +1618,12 @@ apply_workspace_edit({workspace_edit}) Parameters: ~ {workspace_edit} (table) `WorkspaceEdit` +border_height({id}) *vim.lsp.util.border_height()* + TODO: Documentation + +border_width({id}) *vim.lsp.util.border_width()* + TODO: Documentation + buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()* Removes document highlights from a buffer. @@ -1585,7 +1639,11 @@ buf_highlight_references({bufnr}, {references}) {references} List of `DocumentHighlight` objects to highlight -character_offset({buf}, {row}, {col}) *vim.lsp.util.character_offset()* +buf_lines({bufnr}) *vim.lsp.util.buf_lines()* + TODO: Documentation + + *vim.lsp.util.character_offset()* +character_offset({bufnr}, {row}, {col}) Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. @@ -1650,12 +1708,15 @@ convert_input_to_markdown_lines({input}, {contents}) https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover *vim.lsp.util.convert_signature_help_to_markdown_lines()* -convert_signature_help_to_markdown_lines({signature_help}) +convert_signature_help_to_markdown_lines({signature_help}, {ft}) Converts `textDocument/SignatureHelp` response to markdown lines. Parameters: ~ {signature_help} Response of `textDocument/SignatureHelp` + {ft} optional filetype that will be use as + the `lang` for the label markdown code + block Return: ~ list of lines of converted markdown. @@ -1669,6 +1730,19 @@ create_file({change}) *vim.lsp.util.create_file()* delete_file({change}) *vim.lsp.util.delete_file()* TODO: Documentation + *vim.lsp.util.diagnostics_to_items()* +diagnostics_to_items({diagnostics_by_bufnr}, {predicate}) + Convert diagnostics grouped by bufnr to a list of items for + use in the quickfix or location list. + + Parameters: ~ + {diagnostics_by_bufnr} table bufnr -> Diagnostic [] + {predicate} an optional function to filter the + diagnostics. + + Return: ~ + table (A list of items) + *vim.lsp.util.extract_completion_items()* extract_completion_items({result}) Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null. @@ -1683,65 +1757,6 @@ extract_completion_items({result}) See also: ~ https://microsoft.github.io/language-server-protocol/specification#textDocument_completion - *vim.lsp.util.fancy_floating_markdown()* -fancy_floating_markdown({contents}, {opts}) - Converts markdown into syntax highlighted regions by stripping - the code blocks and converting them into highlighted code. - This will by default insert a blank line separator after those - code block regions to improve readability. The result is shown - in a floating preview. - - Parameters: ~ - {contents} table of lines to show in window - {opts} dictionary with optional fields - • height of floating window - • width of floating window - • wrap_at character to wrap at for computing - height - • max_width maximal width of floating window - • max_height maximal height of floating window - • pad_left number of columns to pad contents - at left - • pad_right number of columns to pad contents - at right - • pad_top number of lines to pad contents at - top - • pad_bottom number of lines to pad contents - at bottom - • separator insert separator after code block - - Return: ~ - width,height size of float - -focusable_float({unique_name}, {fn}) *vim.lsp.util.focusable_float()* - Parameters: ~ - {unique_name} (string) Window variable - {fn} (function) should return create a new - window and return a tuple of - ({focusable_buffer_id}, {window_id}). if - {focusable_buffer_id} is a valid buffer id, - the newly created window will be the new - focus associated with the current buffer - via the tag `unique_name` . - - Return: ~ - (pbufnr, pwinnr) if `fn()` has created a new window; nil - otherwise - - *vim.lsp.util.focusable_preview()* -focusable_preview({unique_name}, {fn}) - Focuses/unfocuses the floating preview window associated with - the current buffer via the window variable `unique_name` . If - no such preview window exists, makes a new one. - - Parameters: ~ - {unique_name} (string) Window variable - {fn} (function) The return values of this - function will be passed directly to - |vim.lsp.util.open_floating_preview()|, in - the case that a new floating window should - be created - get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* Returns visual width of tabstop. @@ -1755,6 +1770,22 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* See also: ~ |softtabstop| +get_line({uri}, {row}) *vim.lsp.util.get_line()* + Parameters: ~ + {uri} string uri of the resource to get the line from + {row} number zero-indexed line number + + Return: ~ + string the line at row in filename + +get_lines({uri}, {rows}) *vim.lsp.util.get_lines()* + Parameters: ~ + {uri} string uri of the resource to get the lines from + {rows} number[] zero-indexed line numbers + + Return: ~ + table<number string> a table mapping rows to lines + get_progress_messages() *vim.lsp.util.get_progress_messages()* TODO: Documentation @@ -1883,6 +1914,28 @@ open_floating_preview({contents}, {syntax}, {opts}) {contents} table of lines to show in window {syntax} string of syntax to set for opened buffer {opts} dictionary with optional fields + • height of floating window + • width of floating window + • wrap boolean enable wrapping of long lines + (defaults to true) + • wrap_at character to wrap at for computing + height when wrap is enabled + • max_width maximal width of floating window + • max_height maximal height of floating window + • pad_left number of columns to pad contents + at left + • pad_right number of columns to pad contents + at right + • pad_top number of lines to pad contents at + top + • pad_bottom number of lines to pad contents + at bottom + • focus_id if a popup with this id is opened, + then focus it + • close_events list of events that closes the + floating window + • focusable (boolean, default true): Make + float focusable Return: ~ bufnr,winnr buffer and window number of the newly created @@ -1897,7 +1950,7 @@ parse_snippet({input}) *vim.lsp.util.parse_snippet()* Return: ~ (string) parsed snippet -preview_location({location}) *vim.lsp.util.preview_location()* +preview_location({location}, {opts}) *vim.lsp.util.preview_location()* Previews a location in a floating window behavior depends on type of location: @@ -1932,9 +1985,10 @@ set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()* Return: ~ (table) The modified {lines} object -set_loclist({items}) *vim.lsp.util.set_loclist()* - Fills current window's location list with given list of items. +set_loclist({items}, {win_id}) *vim.lsp.util.set_loclist()* + Fills target window's location list with given list of items. Can be obtained with e.g. |vim.lsp.util.locations_to_items()|. + Defaults to current window. Parameters: ~ {items} (table) list of items @@ -1946,6 +2000,41 @@ set_qflist({items}) *vim.lsp.util.set_qflist()* Parameters: ~ {items} (table) list of items + *vim.lsp.util.stylize_markdown()* +stylize_markdown({bufnr}, {contents}, {opts}) + Converts markdown into syntax highlighted regions by stripping + the code blocks and converting them into highlighted code. + This will by default insert a blank line separator after those + code block regions to improve readability. + + This method configures the given buffer and returns the lines + to set. + + If you want to open a popup with fancy markdown, use + `open_floating_preview` instead + + Parameters: ~ + {contents} table of lines to show in window + {opts} dictionary with optional fields + • height of floating window + • width of floating window + • wrap_at character to wrap at for computing + height + • max_width maximal width of floating window + • max_height maximal height of floating window + • pad_left number of columns to pad contents + at left + • pad_right number of columns to pad contents + at right + • pad_top number of lines to pad contents at + top + • pad_bottom number of lines to pad contents + at bottom + • separator insert separator after code block + + Return: ~ + width,height size of float + symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()* Converts symbols to quickfix list items. diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index be01966d42..fd1bedd8ef 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -650,42 +650,6 @@ vim.empty_dict() *vim.empty_dict()* Note: if numeric keys are added to the table, the metatable will be ignored and the dict converted to a list/array anyway. -vim.region({bufnr}, {pos1}, {pos2}, {type}, {inclusive}) *vim.region()* - Converts a selection specified by the buffer ({bufnr}), starting - position ({pos1}, a zero-indexed pair `{line1,column1}`), ending - position ({pos2}, same format as {pos1}), the type of the register - for the selection ({type}, see |regtype|), and a boolean indicating - whether the selection is inclusive or not, into a zero-indexed table - of linewise selections of the form `{linenr = {startcol, endcol}}` . - - *vim.register_keystroke_callback()* -vim.register_keystroke_callback({fn}, {ns_id}) - Register a lua {fn} with an {ns_id} to be run after every keystroke. - - Parameters: ~ - {fn}: (function): Function to call on keystroke. - It should take one argument, which is a string. - The string will contain the literal keys typed. - See |i_CTRL-V| - - If {fn} is `nil`, it removes the callback for the - associated {ns_id}. - - {ns_id}: (number) Namespace ID. If not passed or 0, will generate - and return a new namespace ID from |nvim_create_namespace()| - - Return: ~ - (number) Namespace ID associated with {fn} - - NOTE: {fn} will be automatically removed if an error occurs while - calling. This is to prevent the annoying situation of every keystroke - erroring while trying to remove a broken callback. - - NOTE: {fn} will receive the keystrokes after mappings have been - evaluated - - NOTE: {fn} will *NOT* be cleared from |nvim_buf_clear_namespace()| - vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()* Sends {event} to {channel} via |RPC| and returns immediately. If {channel} is 0, the event is broadcast to all channels. @@ -912,9 +876,167 @@ vim.env *vim.env* print(vim.env.TERM) < - *lua-vim-options* -From Lua you can work with editor |options| by reading and setting items in -these Lua tables: + *lua-vim-options* + *lua-vim-opt* + *lua-vim-set* + *lua-vim-optlocal* + *lua-vim-setlocal* + +In vimL, there is a succint and simple way to set options. For more +information, see |set-option|. In Lua, the corresponding method is `vim.opt`. + +`vim.opt` provides several conveniences for setting and controlling options +from within Lua. + + Examples: ~ + + To set a boolean toggle: + In vimL: + `set number` + + In Lua: + `vim.opt.number = true` + + To set an array of values: + In vimL: + `set wildignore=*.o,*.a,__pycache__` + + In Lua, there are two ways you can do this now. One is very similar to + the vimL way: + `vim.opt.wildignore = '*.o,*.a,__pycache__'` + + However, vim.opt also supports a more elegent way of setting + list-style options, but using lua tables: + `vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }` + + To replicate the behavior of |:set+=|, use: > + + -- vim.opt supports appending options via the "+" operator + vim.opt.wildignore = vim.opt.wildignore + { "*.pyc", "node_modules" } + + -- or using the `:append(...)` method + vim.opt.wildignore:append { "*.pyc", "node_modules" } +< + + To replicate the behavior of |:set^=|, use: > + + -- vim.opt supports prepending options via the "^" operator + vim.opt.wildignore = vim.opt.wildignore ^ { "new_first_value" } + + -- or using the `:prepend(...)` method + vim.opt.wildignore:prepend { "new_first_value" } +< + To replicate the behavior of |:set-=|, use: > + + -- vim.opt supports removing options via the "-" operator + vim.opt.wildignore = vim.opt.wildignore - { "node_modules" } + + -- or using the `:remove(...)` method + vim.opt.wildignore:remove { "node_modules" } +< + To set a map of values: + In vimL: + `set listchars=space:_,tab:>~` + + In Lua: + `vim.opt.listchars = { space = '_', tab = '>~' }` + + +In any of the above examples, to replicate the behavior |setlocal|, use +`vim.opt_local`. Additionally, to replicate the behavior of |setglobal|, use +`vim.opt_global`. + *vim.opt* + +|vim.opt| returns an Option object. + +For example: `local listchar_object = vim.opt.listchar` + +An `Option` has the following methods: + + + *vim.opt:get()* +Option:get() + + Returns a lua-representation of the option. Boolean, number and string + values will be returned in exactly the same fashion. + + For values that are comma-separated lists, an array will be returned with + the values as entries in the array: > + vim.cmd [[set wildignore=*.pyc,*.o]] + + print(vim.inspect(vim.opt.wildignore:get())) + -- { "*.pyc", "*.o", } + + for _, ignore_pattern in ipairs(vim.opt.wildignore:get()) do + print("Will ignore:", ignore_pattern) + end + -- Will ignore: *.pyc + -- Will ignore: *.o +< + For values that are comma-separated maps, a table will be returned with + the names as keys and the values as entries: > + vim.cmd [[set listchars=space:_,tab:>~]] + + print(vim.inspect(vim.opt.listchars:get())) + -- { space = "_", tab = ">~", } + + for char, representation in pairs(vim.opt.listchars:get()) do + print(char, "->", representation) + end +< + For values that are lists of flags, a set will be returned with the flags + as keys and `true` as entries. > + vim.cmd [[set formatoptions=njtcroql]] + + print(vim.inspect(vim.opt.formatoptions:get())) + -- { n = true, j = true, c = true, ... } + + local format_opts = vim.opt.formatoptions:get() + if format_opts.j then + print("J is enabled!") + end +< + *vim.opt:append()* +Option:append(value) + + Append a value to string-style options. See |:set+=| + + These are equivalent: + `vim.opt.formatoptions:append('j')` + `vim.opt.formatoptions = vim.opt.formatoptions + 'j'` + + *vim.opt:prepend()* +Option:prepend(value) + + Prepend a value to string-style options. See |:set^=| + + These are equivalent: + `vim.opt.wildignore:prepend('*.o')` + `vim.opt.wildignore = vim.opt.wildignore ^ '*.o'` + + *vim.opt:remove()* +Option:remove(value) + + Remove a value from string-style options. See |:set-=| + + These are equivalent: + `vim.opt.wildignore:remove('*.pyc')` + `vim.opt.wildignore = vim.opt.wildignore - '*.pyc'` + + +In general, using `vim.opt` will provide the expected result when the user is +used to interacting with editor |options| via `set`. There are still times +where the user may want to set particular options via a shorthand in Lua, +which is where |vim.o|, |vim.bo|, |vim.wo|, and |vim.go| come into play. + +The behavior of |vim.o|, |vim.bo|, |vim.wo|, and |vim.go| is designed to +follow that of |:set|, |:setlocal|, and |:setglobal| which can be seen in the +table below: + + lua command global_value local_value ~ +vim.o :set set set +vim.bo/vim.wo :setlocal - set +vim.go :setglobal set - vim.o *vim.o* Get or set editor options, like |:set|. Invalid key is an error. @@ -922,14 +1044,36 @@ vim.o *vim.o* vim.o.cmdheight = 4 print(vim.o.columns) + +vim.go *vim.go* + Get or set an |option|. Invalid key is an error. + + This is a wrapper around |nvim_set_option()| and |nvim_get_option()|. + + NOTE: This is different than |vim.o| because this ONLY sets the global + option, which generally produces confusing behavior for options with + |global-local| values. + + Example: > + vim.go.cmdheight = 4 +< + vim.bo *vim.bo* Get or set buffer-scoped |local-options|. Invalid key is an error. + + This is a wrapper around |nvim_buf_set_option()| and + |nvim_buf_get_option()|. + Example: > vim.bo.buflisted = true print(vim.bo.comments) vim.wo *vim.wo* Get or set window-scoped |local-options|. Invalid key is an error. + + This is a wrapper around |nvim_win_set_option()| and + |nvim_win_get_option()|. + Example: > vim.wo.cursorcolumn = true print(vim.wo.foldmarker) @@ -938,6 +1082,23 @@ vim.wo *vim.wo* ============================================================================== Lua module: vim *lua-vim* +defer_fn({fn}, {timeout}) *vim.defer_fn()* + Defers calling `fn` until `timeout` ms passes. + + Use to do a one-shot timer that calls `fn` Note: The {fn} is |schedule_wrap|ped automatically, so API + functions are safe to call. + + Parameters: ~ + {fn} Callback to call once `timeout` expires + {timeout} Number of milliseconds to wait before calling + `fn` + + Return: ~ + timer luv timer object + +insert_keys({obj}) *vim.insert_keys()* + TODO: Documentation + inspect({object}, {options}) *vim.inspect()* Return a human-readable representation of the given object. @@ -945,9 +1106,19 @@ inspect({object}, {options}) *vim.inspect()* https://github.com/kikito/inspect.lua https://github.com/mpeterv/vinspect -make_meta_accessor({get}, {set}, {del}) *vim.make_meta_accessor()* +make_dict_accessor({scope}) *vim.make_dict_accessor()* TODO: Documentation +notify({msg}, {log_level}, {_opts}) *vim.notify()* + Notification provider without a runtime, writes to :Messages + + Parameters: ~ + {msg} Content of the notification to show to the + user + {log_level} Optional log level + {opts} Dictionary with optional options (timeout, + etc) + paste({lines}, {phase}) *vim.paste()* Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the |TUI|) pastes text into the editor. @@ -980,6 +1151,53 @@ paste({lines}, {phase}) *vim.paste()* See also: ~ |paste| +region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()* + Get a table of lines with start, end columns for a region + marked by two points + + Parameters: ~ + {bufnr} number of buffer + {pos1} (line, column) tuple marking beginning of + region + {pos2} (line, column) tuple marking end of region + {regtype} type of selection (:help setreg) + {inclusive} boolean indicating whether the selection is + end-inclusive + + Return: ~ + region lua table of the form {linenr = {startcol,endcol}} + + *vim.register_keystroke_callback()* +register_keystroke_callback({fn}, {ns_id}) + Register a lua {fn} with an {id} to be run after every + keystroke. + + If {fn} is nil, it removes the callback for the associated + {ns_id} + Note: + {fn} will not be cleared from |nvim_buf_clear_namespace()| + + Note: + {fn} will receive the keystrokes after mappings have been + evaluated + + Parameters: ~ + {fn} function: Function to call. It should take one + argument, which is a string. The string will contain + the literal keys typed. See |i_CTRL-V| + {ns_id} number? Namespace ID. If not passed or 0, will + generate and return a new namespace ID from + |nvim_create_namesapce()| + + Return: ~ + number Namespace ID associated with {fn} + + Note: + {fn} will be automatically removed if an error occurs + while calling. This is to prevent the annoying situation + of every keystroke erroring while trying to remove a + broken callback. + schedule_wrap({cb}) *vim.schedule_wrap()* Defers callback `cb` until the Nvim API is safe to call. @@ -1287,12 +1505,14 @@ validate({opt}) *vim.validate()* vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}} => NOP (success) - - vim.validate{arg1={1, 'table'}} - => error('arg1: expected table, got number') - - vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} - => error('arg1: expected even number, got 3') +< +> + vim.validate{arg1={1, 'table'}} + => error('arg1: expected table, got number') +< +> + vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} + => error('arg1: expected even number, got 3') < Parameters: ~ diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ee42edf154..77cbf7d9b7 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -360,6 +360,22 @@ Overview of which map command works in which mode. More details below. :cmap :cnoremap :cunmap Command-line :tmap :tnoremap :tunmap Terminal +Same information in a table: + *map-table* + Mode | Norm | Ins | Cmd | Vis | Sel | Opr | Term | Lang | ~ +Command +------+-----+-----+-----+-----+-----+------+------+ ~ +[nore]map | yes | - | - | yes | yes | yes | - | - | +n[nore]map | yes | - | - | - | - | - | - | - | +[nore]map! | - | yes | yes | - | - | - | - | - | +i[nore]map | - | yes | - | - | - | - | - | - | +c[nore]map | - | - | yes | - | - | - | - | - | +v[nore]map | - | - | - | yes | yes | - | - | - | +x[nore]map | - | - | - | yes | - | - | - | - | +s[nore]map | - | - | - | - | yes | - | - | - | +o[nore]map | - | - | - | - | - | yes | - | - | +t[nore]map | - | - | - | - | - | - | yes | - | +l[nore]map | - | yes | yes | - | - | - | - | yes | + COMMANDS MODES ~ Normal Visual+Select Operator-pending ~ diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index b57d2b592a..9d3a51302d 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -31,6 +31,7 @@ use of "-" and "_". :lan[guage] mes[sages] :lan[guage] cty[pe] :lan[guage] tim[e] +:lan[guage] col[late] Print the current language (aka locale). With the "messages" argument the language used for messages is printed. Technical: LC_MESSAGES. @@ -38,15 +39,19 @@ use of "-" and "_". character encoding is printed. Technical: LC_CTYPE. With the "time" argument the language used for strftime() is printed. Technical: LC_TIME. + With the "collate" argument the language used for + collation order is printed. Technical: LC_COLLATE. Without argument all parts of the locale are printed (this is system dependent). The current language can also be obtained with the - |v:lang|, |v:ctype| and |v:lc_time| variables. + |v:lang|, |v:ctype|, |v:collate| and |v:lc_time| + variables. :lan[guage] {name} :lan[guage] mes[sages] {name} :lan[guage] cty[pe] {name} :lan[guage] tim[e] {name} +:lan[guage] col[late] {name} Set the current language (aka locale) to {name}. The locale {name} must be a valid locale on your system. Some systems accept aliases like "en" or @@ -66,7 +71,10 @@ use of "-" and "_". With the "time" argument the language used for time and date messages is set. This affects strftime(). This sets $LC_TIME. - Without an argument both are set, and additionally + With the "collate" argument the language used for the + collation order is set. This affects sorting of + characters. This sets $LC_COLLATE. + Without an argument all are set, and additionally $LANG is set. The LC_NUMERIC value will always be set to "C" so that floating point numbers use '.' as the decimal diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 269080e750..cc9696e536 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -595,10 +595,6 @@ A jump table for the options with a short description can be found at |Q_op|. set to one of CJK locales. See Unicode Standard Annex #11 (http://www.unicode.org/reports/tr11). - Vim may set this option automatically at startup time when Vim is - compiled with the |+termresponse| feature and if t_u7 is set to the - escape sequence to request cursor position report. - *'autochdir'* *'acd'* *'noautochdir'* *'noacd'* 'autochdir' 'acd' boolean (default off) global @@ -4603,6 +4599,19 @@ 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. + *'quickfixtextfunc'* *'qftf'* +'quickfixtextfunc' 'qftf' string (default "") + global + This option specifies a function to be used to get the text to display + in the quickfix and location list windows. This can be used to + customize the information displayed in the quickfix or location window + for each entry in the corresponding quickfix or location list. See + |quickfix-window-function| for an explanation of how to write the + function and an example. + + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'quoteescape'* *'qe'* 'quoteescape' 'qe' string (default "\") local to buffer @@ -5043,6 +5052,7 @@ A jump table for the options with a short description can be found at |Q_op|. global values for local options) options all options and mappings (also global values for local options) + skiprtp exclude 'runtimepath' and 'packpath' from the options resize size of the Vim window: 'lines' and 'columns' sesdir the directory in which the session file is located will become the current directory (useful with @@ -5267,9 +5277,9 @@ A jump table for the options with a short description can be found at |Q_op|. in a file and echoed to the screen. If the 'shell' option is "csh" or "tcsh" after initializations, the default becomes "|& tee". If the 'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta", - "bash" or "fish" the default becomes "2>&1| tee". This means that - stderr is also included. Before using the 'shell' option a path is - removed, thus "/bin/sh" uses "sh". + "bash", "fish", "ash" or "dash" the default becomes "2>&1| tee". This + means that stderr is also included. Before using the 'shell' option a + path is removed, thus "/bin/sh" uses "sh". The initialization of this option is done after reading the vimrc and the other initializations, so that when the 'shell' option is set there, the 'shellpipe' option changes automatically, unless it was @@ -5923,6 +5933,18 @@ A jump table for the options with a short description can be found at |Q_op|. Note that there is no '%' before the closing '}'. The expression cannot contain a '}' character, call a function to work around that. See |stl-%{| below. + {% - This is almost same as { except the result of the expression is + re-evaluated as a statusline format string. Thus if the + return value of expr contains % items they will get expanded. + The expression can contain the } character, the end of + expression is denoted by %}. + The For example: > + func! Stl_filename() abort + return "%t" + endfunc +< `stl=%{Stl_filename()}` results in `"%t"` + `stl=%{%Stl_filename()%}` results in `"Name of current file"` + } - End of `{%` expression ( - Start of item group. Can be used for setting the width and alignment of a section. Must be followed by %) somewhere. ) - End of item group. No width fields allowed. @@ -6417,7 +6439,7 @@ A jump table for the options with a short description can be found at |Q_op|. a single <Esc> is assumed. Many TUI cursor key codes start with <Esc>. On very slow systems this may fail, causing cursor keys not to work - sometimes. If you discover this problem you can ":set ttimeout=9999". + sometimes. If you discover this problem you can ":set ttimeoutlen=9999". Nvim will wait for the next character to arrive after an <Esc>. *'timeoutlen'* *'tm'* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 5adafd7877..4b61cd4c25 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -3181,8 +3181,8 @@ window, then the one window will be horizontally split (by default). If there's more than one window, the previous window will be re-used on the selected file/directory. If the previous window's associated buffer has been modified, and there's only one window with that buffer, then -the user will be asked if s/he wishes to save the buffer first (yes, -no, or cancel). +the user will be asked if they wish to save the buffer first (yes, no, or +cancel). Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v| Associated setting variables: diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index db6b759af6..a937cfee98 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1014,13 +1014,6 @@ commands can be combined to create a NewGrep command: > updated. With the [!] any changes in the current buffer are abandoned. - 'f' When the 'f' flag is specified, fuzzy string - matching is used to find matching lines. In this - case, {pattern} is treated as a literal string - instead of a regular expression. See - |matchfuzzy()| for more info about fuzzy - matching. - |QuickFixCmdPre| and |QuickFixCmdPost| are triggered. A file that is opened for matching may use a buffer number, but it is reused if possible to avoid @@ -1889,5 +1882,67 @@ be used. See the description further above how to make such a filter known by Vim. +============================================================================= +10. Customizing the quickfix window *quickfix-window-function* + +The default format for the lines displayed in the quickfix window and location +list window is: + + <filename>|<lnum> col <col>|<text> + +The values displayed in each line correspond to the "bufnr", "lnum", "col" and +"text" fields returned by the |getqflist()| function. + +For some quickfix/location lists, the displayed text need to be customized. +For example, if only the filename is present for a quickfix entry, then the +two "|" field separator characters after the filename are not needed. Another +use case is to customize the path displayed for a filename. By default, the +complete path (which may be too long) is displayed for files which are not +under the current directory tree. The file path may need to be simplified to a +common parent directory. + +The displayed text can be customized by setting the 'quickfixtextfunc' option +to a Vim function. This function will be called with a dict argument and +should return a List of strings to be displayed in the quickfix or location +list window. The dict argument will have the following fields: + + quickfix set to 1 when called for a quickfix list and 0 when called for + a location list. + winid for a location list, set to the id of the window with the + location list. For a quickfix list, set to 0. Can be used in + getloclist() to get the location list entry. + id quickfix or location list identifier + start_idx index of the first entry for which text should be returned + end_idx index of the last entry for which text should be returned + +The function should return a single line of text to display in the quickfix +window for each entry from start_idx to end_idx. The function can obtain +information about the entries using the |getqflist()| function and specifying +the quickfix list identifier "id". For a location list, getloclist() function +can be used with the 'winid' argument. + +If a quickfix or location list specific customization is needed, then the +'quickfixtextfunc' attribute of the list can be set using the |setqflist()| or +|setloclist()| function. This overrides the global 'quickfixtextfunc' option. + +The example below displays the list of old files (|v:oldfiles|) in a quickfix +window. As there is no line, column number and error text information +associated with each entry, the 'quickfixtextfunc' function returns only the +filename. +Example: > + " create a quickfix list from v:oldfiles + call setqflist([], ' ', {'lines' : v:oldfiles, 'efm' : '%f', + \ 'quickfixtextfunc' : 'QfOldFiles'}) + func QfOldFiles(info) + " get information about a range of quickfix entries + let items = getqflist({'id' : a:info.id, 'items' : 1}).items + let l = [] + for idx in range(a:info.start_idx - 1, a:info.end_idx - 1) + " use the simplified file name + call add(l, fnamemodify(bufname(items[idx].bufnr), ':p:.')) + endfor + return l + endfunc +< vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index b237d70760..dd05084652 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -50,6 +50,11 @@ Multiple repeats *multi-repeat* :[range]v[global]/{pattern}/[cmd] Same as :g!. +Example: > + :g/^Obsolete/d _ +Using the underscore after `:d` avoids clobbering registers or the clipboard. +This also makes it faster. + Instead of the '/' which surrounds the {pattern}, you can use any other single byte character, but not an alphabetic character, '\', '"' or '|'. This is useful if you want to include a '/' in the search pattern or diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 95e00720b1..b159f655fa 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1969,7 +1969,7 @@ LEX *lex.vim* *ft-lex-syntax* Lex uses brute-force synchronizing as the "^%%$" section delimiter gives no clue as to what section follows. Consequently, the value for > :syn sync minlines=300 -may be changed by the user if s/he is experiencing synchronization +may be changed by the user if they are experiencing synchronization difficulties (such as may happen with large lex files). @@ -3009,11 +3009,11 @@ variables in your vimrc: < (dash users should use posix) -If there's no "#! ..." line, and the user hasn't availed himself/herself of a -default sh.vim syntax setting as just shown, then syntax/sh.vim will assume -the Bourne shell syntax. No need to quote RFCs or market penetration -statistics in error reports, please -- just select the default version of the -sh your system uses and install the associated "let..." in your <.vimrc>. +If there's no "#! ..." line, and the user hasn't availed themself of a default +sh.vim syntax setting as just shown, then syntax/sh.vim will assume the Bourne +shell syntax. No need to quote RFCs or market penetration statistics in error +reports, please -- just select the default version of the sh your system uses +and install the associated "let..." in your <.vimrc>. The syntax/sh.vim file provides several levels of syntax-based folding: > diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 1f4b5d3097..d6bca55bd6 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -212,6 +212,11 @@ Here is a list of built-in predicates : ((identifier) @foo (#contains? @foo "foo")) ((identifier) @foo-bar (#contains @foo-bar "foo" "bar")) < + `any-of?` *ts-predicate-any-of?* + Will check if the text is the same as any of the following + arguments : > + ((identifier) @foo (#any-of? @foo "foo" "bar")) +< *lua-treesitter-not-predicate* Each predicate has a `not-` prefixed predicate that is just the negation of the predicate. @@ -464,9 +469,11 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) for id, node in pairs(match) do local name = query.captures[id] -- `node` was captured by the `name` capture in the match - - local node_data = metadata[id] -- Node level metadata - +< +> + local node_data = metadata[id] -- Node level metadata +< +> ... use the info here ... end end diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 4cba5a33d0..f92cb3c509 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1875,7 +1875,7 @@ NOT LOADING It's possible that a user doesn't always want to load this plugin. Or the system administrator has dropped it in the system-wide plugin directory, but a -user has his own plugin he wants to use. Then the user must have a chance to +user has their own plugin they want to use. Then the user must have a chance to disable loading this specific plugin. This will make it possible: > 6 if exists("g:loaded_typecorr") @@ -1908,7 +1908,7 @@ item can be used: > The "<Plug>TypecorrAdd;" thing will do the work, more about that further on. -The user can set the "mapleader" variable to the key sequence that he wants +The user can set the "mapleader" variable to the key sequence that they want this mapping to start with. Thus if the user has done: > let mapleader = "_" @@ -1919,7 +1919,7 @@ will be used, which is a backslash. Then a map for "\a" will be defined. Note that <unique> is used, this will cause an error message if the mapping already happened to exist. |:map-<unique>| -But what if the user wants to define his own key sequence? We can allow that +But what if the user wants to define their own key sequence? We can allow that with this mechanism: > 21 if !hasmapto('<Plug>TypecorrAdd;') @@ -1928,7 +1928,7 @@ with this mechanism: > This checks if a mapping to "<Plug>TypecorrAdd;" already exists, and only defines the mapping from "<Leader>a" if it doesn't. The user then has a -chance of putting this in his vimrc file: > +chance of putting this in their vimrc file: > map ,c <Plug>TypecorrAdd; @@ -2033,7 +2033,7 @@ Now let's add a user command to add a correction: > The user command is defined only if no command with the same name already exists. Otherwise we would get an error here. Overriding the existing user command with ":command!" is not a good idea, this would probably make the user -wonder why the command he defined himself doesn't work. |:command| +wonder why the command they defined themself doesn't work. |:command| SCRIPT VARIABLES @@ -2285,7 +2285,7 @@ An example of how to define functionality in a filetype plugin: > |hasmapto()| is used to check if the user has already defined a map to <Plug>JavaImport;. If not, then the filetype plugin defines the default mapping. This starts with |<LocalLeader>|, which allows the user to select -the key(s) he wants filetype plugin mappings to start with. The default is a +the key(s) they want filetype plugin mappings to start with. The default is a backslash. "<unique>" is used to give an error message if the mapping already exists or overlaps with an existing mapping. diff --git a/runtime/doc/usr_42.txt b/runtime/doc/usr_42.txt index 99da1359c2..ff3ae7057a 100644 --- a/runtime/doc/usr_42.txt +++ b/runtime/doc/usr_42.txt @@ -209,8 +209,8 @@ argument: > :amenu <silent> Mine.Next\ File :call <SID>NextFile()<CR> Don't use "<silent>" too often. It is not needed for short commands. If you -make a menu for someone else, being able to see the executed command will give -him a hint about what he could have typed, instead of using the mouse. +make a menu for someone else, being able to see the executed command will +give them a hint about what they could have typed, instead of using the mouse. LISTING MENUS diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 2c39fdb53c..bb30495d77 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -194,8 +194,7 @@ Options: 'cpoptions' flags: |cpo-_| 'display' flags: "msgsep" minimizes scrolling when showing messages 'guicursor' works in the terminal - 'fillchars' flags: "msgsep" (see 'display'), "foldopen", "foldsep", - "foldclose" + 'fillchars' flags: "msgsep" (see 'display') 'foldcolumn' supports up to 9 dynamic/fixed columns 'inccommand' shows interactive results for |:substitute|-like commands 'pumblend' pseudo-transparent popupmenu |