robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #39626 docsdf5d559878

master
23.5 KiB499 linesraw
1*news-0.11.txt*    Nvim
2
3
4                            NVIM REFERENCE MANUAL
5
6
7Notable changes since Nvim 0.10                                 *news-0.11*
8
9For changes in the previous release, see |news-0.10|.
10
11                                       Type |gO| to see the table of contents.
12
13==============================================================================
14BREAKING CHANGES
15
16These changes may require adaptations in your config or plugins.
17
18API
19
20• `vim.rpcnotify(0)` and `rpcnotify(0)` broadcast to ALL channels. Previously
21  they would "multicast" only to subscribed channels (controlled by
22  `nvim_subscribe()`). Plugins and clients that want "multicast" behavior must
23  now maintain their own list of channels.
24  • In the future, |vim.rpcnotify()| may accept a list of channels, if there
25    is demand for this use-case.
26• "Dictionary" was renamed to "Dict" internally and in the RPC |api-metadata|.
27  This is not expected to break clients because there are no known clients
28  that actually use the `return_type` field or the parameter type names
29  reported by |--api-info| or |nvim_get_api_info()|.
30• Renamed `nvim__id_dictionary` (unsupported/experimental API) to
31  `nvim__id_dict`.
32
33BUILD
34
35• On Windows, only building with the UCRT runtime is supported.
36• Translations are turned off by default. Enable by building Nvim with the
37  CMake flag `ENABLE_TRANSLATIONS=ON`.
38
39DIAGNOSTICS
40
41• The "underline" diagnostics handler sorts diagnostics by severity when using
42  the "severity_sort" option.
43• Diagnostics are filtered by severity before being passed to a diagnostic
44  handler |diagnostic-handlers|.
45• The "virtual_text" handler is disabled by default. Enable with >lua
46    vim.diagnostic.config({ virtual_text = true })
47<
48EDITOR
49
50• The order in which signs are placed was changed. Higher priority signs will
51  now appear left of lower priority signs.
52• |hl-CurSearch| now behaves the same as Vim and no longer updates on every
53  cursor movement.
54• Moving in the buffer list using |:bnext| and similar commands behaves as
55  documented and skips help buffers if run from a non-help buffer, otherwise
56  it moves to another help buffer.
57• Bells from a |terminal| buffer are now silent by default, unless 'belloff'
58  option doesn't contain "term" or "all".
59• Renamed autocmd group `nvim_swapfile` to `nvim.swapfile`. |default-autocmds|
60  If you always want the swapfile dialog, delete the `nvim.swapfile` group:
61  `autocmd! nvim.swapfile`.
62
63EVENTS
64
65• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in
66  |api-fast| context.
67• New/enhanced arguments in these existing UI events:
68  • `cmdline_hide`: Includes `level` and `abort` arguments, `abort` argument indicating if the cmdline was aborted.
69  • `cmdline_show`:
70    • Prompts that were previously emitted as `msg_show` events, are now routed
71      through `cmdline_show`.
72    • `hl_id` argument to highlight the prompt text.
73  • `msg_show`:
74    • `history` argument indicating if the message was added to the history.
75    • new message kinds: "bufwrite", "completion", "list_cmd", "lua_print",
76      "search_cmd", "shell_out/err/ret", "undo", "verbose", wildlist".
77• |TermRequest| and |TermResponse| |event-data| is now a table. The "sequence"
78  field contains the received sequence. |TermRequest| also contains a "cursor"
79  field indicating the cursor's position when the sequence was received.
80
81HIGHLIGHTS
82
83• |TermCursorNC| is removed and no longer supported. Unfocused terminals no
84  longer have a cursor.
85
86LSP
87
88• |vim.lsp.buf.references()|, |vim.lsp.buf.declaration()|, |vim.lsp.buf.definition()|,
89  |vim.lsp.buf.type_definition()|, |vim.lsp.buf.implementation()| and
90  |vim.lsp.buf.hover()| now support merging the results of multiple clients
91  but no longer trigger the global handlers from `vim.lsp.handlers`
92• |vim.lsp.buf.typehierarchy()| now passes the correct params for each
93  client request.
94• |vim.lsp.handlers.signature_help()| is no longer used.
95• |vim.lsp.diagnostic.on_publish_diagnostics()| and
96  |vim.lsp.diagnostic.on_diagnostic()| no longer accept a config parameter and
97  can no longer be configured with |vim.lsp.with()|.
98  Instead use: >lua
99    vim.diagnostic.config(config, vim.lsp.diagnostic.get_namespace(client_id))
100<
101• |vim.lsp.util.make_position_params()|, |vim.lsp.util.make_range_params()|
102  and |vim.lsp.util.make_given_range_params()| now require the `position_encoding`
103  parameter.
104• |vim.lsp.util.symbols_to_items()| now requires the `position_encoding` parameter.
105
106LUA
107
108• API functions now consistently return an empty dictionary as
109  |vim.empty_dict()|. Earlier, a |lua-special-tbl| was sometimes used.
110• |vim.json.encode()| no longer escapes forward slashes "/" by default
111
112OPTIONS
113
114• The 'statuscolumn' `%l` item can now be used as a number column segment that
115  changes according to related options. It takes care of alignment, 'number',
116  'relativenumber' and 'signcolumn' set to "number". The now redundant `%r` item
117  is no longer treated specially for 'statuscolumn'.
118• `:set {option}<` removes the local value for all |global-local| options instead
119  of just string |global-local| options.
120• `:setlocal {option}<` copies the global value to the local value for number
121  and boolean |global-local| options instead of removing the local value.
122• Setting |hidden-options| now gives an error. In particular, setting
123  'noshellslash' is now only allowed on Windows.
124
125TREESITTER
126
127• |Query:iter_matches()| correctly returns all matching nodes in a match
128  instead of only the last node. This means that the returned table maps
129  capture IDs to a list of nodes that need to be iterated over. For
130  backwards compatibility, an option `all=false` (only return the last
131  matching node) is provided that will be removed in a future release.
132• |vim.treesitter.language.get_filetypes()| always includes the {language}
133  argument in addition to explicitly registered filetypes.
134• |vim.treesitter.language.get_lang()| falls back to the {filetype} argument
135  if no languages are explicitly registered.
136• |vim.treesitter.language.add()| returns `true` if a parser was loaded
137  successfully and `nil,errmsg` otherwise instead of throwing an error.
138• |vim.treesitter.get_parser()| and |vim.treesitter.start()| no longer parse the
139  tree before returning. Scripts must call |LanguageTree:parse()| explicitly. >lua
140    local p = vim.treesitter.get_parser(0, 'c')
141    p:parse()
142• |vim.treesitter.get_parser()| expects its buffer to be loaded.
143
144TUI
145
146• OSC 52 is used as a fallback clipboard provider when no other
147  |clipboard-tool| is found, even when not using SSH |clipboard-osc52|. To
148  disable OSC 52 queries, set the "osc52" key of |g:termfeatures| to false.
149
150VIMSCRIPT
151
152• |v:msgpack_types| has the type "binary" removed. |msgpackparse()| no longer
153  treats BIN, STR and FIXSTR as separate types. Any of these is returned as a
154  string if possible, or a |blob| if the value contained embedded NUL:s.
155
156==============================================================================
157NEW FEATURES
158
159The following new features were added.
160
161API
162
163• Improved API "meta" docstrings and :help documentation.
164• |nvim__ns_set()| can set properties for a namespace
165• |nvim_echo()| `err` field to print error messages and `chunks` accepts
166  highlight group IDs.
167• |nvim_open_win()| supports a `mouse` field that allows configuring mouse
168  interaction with the window separately from `focusable` field.
169• |nvim_open_win()| `relative` field can be set to "laststatus" and "tabline".
170• Additions to |nvim_buf_set_extmark()|:
171  • `conceal_lines` field to conceal an entire line.
172  • `hl_group` field can be an array of layered groups.
173  • `virt_text_pos` field accepts value `eol_right_align` to allow for right
174    aligned text that truncates before covering up buffer text.
175  • `virt_lines_overflow` field accepts value `scroll` to enable horizontal
176    scrolling for virtual lines with 'nowrap'.
177
178DEFAULTS
179
180• Highlighting:
181  • Improved styling of :checkhealth and :help buffers.
182
183• Mappings:
184  • |grn| in Normal mode maps to |vim.lsp.buf.rename()|
185  • |grr| in Normal mode maps to |vim.lsp.buf.references()|
186  • |gri| in Normal mode maps to |vim.lsp.buf.implementation()|
187  • |gO| in Normal mode maps to |vim.lsp.buf.document_symbol()|
188  • |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|
189  • CTRL-S in Insert and Select mode maps to |vim.lsp.buf.signature_help()|
190  • Mouse |popup-menu| includes an "Open in web browser" item when you right-click
191    on a URL.
192  • Mouse |popup-menu| includes a "Go to definition" item when LSP is active
193    in the buffer.
194  • Mouse |popup-menu| includes "Show Diagnostics", "Show All Diagnostics" and
195    "Configure Diagnostics" items when there are diagnostics in the buffer.
196  • |]d-default| and |[d-default| accept a count.
197  • |[D-default| and |]D-default| jump to the first and last diagnostic in the
198    current buffer, respectively.
199  • Mappings inspired by Tim Pope's vim-unimpaired:
200    • |[q|, |]q|, |[Q|, |]Q|, |[_CTRL-Q|, |]_CTRL-Q| navigate through the |quickfix| list
201    • |[l|, |]l|, |[L|, |]L|, |[_CTRL-L|, |]_CTRL-L| navigate through the |location-list|
202    • |[t|, |]t|, |[T|, |]T|, |[_CTRL-T|, |]_CTRL-T| navigate through the |tag-matchlist|
203    • |[a|, |]a|, |[A|, |]A| navigate through the |argument-list|
204    • |[b|, |]b|, |[B|, |]B| navigate through the |buffer-list|
205    • |[<Space>|, |]<Space>| add an empty line above and below the cursor
206  • |[[| and |]]| in Normal mode jump between shell prompts for shells which emit
207    OSC 133 sequences ("shell integration" or "semantic prompts").
208
209• Options:
210  • 'diffopt' default includes "linematch:40".
211  • 'number', 'relativenumber', 'signcolumn', and 'foldcolumn' are disabled in
212    |terminal| buffers. |terminal-config| shows how to change these defaults.
213  • Lua |ftplugin| sets 'omnifunc' to "v:lua.vim.lua_omnifunc".
214  • Lua |ftplugin| sets 'foldexpr' to "v:lua.vim.treesitter.foldexpr()".
215
216• Snippet:
217  • `<Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = 1 })`
218    when a snippet is active and jumpable forwards.
219  • `<S-Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = -1 })`
220    when a snippet is active and jumpable backwards.
221
222DIAGNOSTICS
223
224• |vim.diagnostic.config()| accepts a "jump" table to specify defaults for
225  |vim.diagnostic.jump()|.
226• A "virtual_lines" diagnostic handler was added to render diagnostics using
227  virtual lines below the respective code.
228• The "virtual_text" diagnostic handler accepts a `current_line` option to
229  only show virtual text at the cursor's line.
230
231EDITOR
232
233• Improved |paste| handling for redo (dot-repeat) and macros (|recording|):
234  • Redoing a large paste is significantly faster and ignores 'autoindent'.
235  • Replaying a macro with |@| also replays pasted text.
236• On Windows, filename arguments on the command-line prefixed with "~\" or
237  "~/" are now expanded to the user's profile directory, not a relative path
238  to a literal "~" directory.
239• |hl-ComplMatchIns| shows matched text of the currently inserted completion.
240• |hl-PmenuMatch| and |hl-PmenuMatchSel| show matched text in completion popup.
241• |gO| now works in `help`, `checkhealth`, and `markdown` buffers.
242• Jump between sections in `help` and `checkhealth` buffers with `[[` and `]]`.
243
244EVENTS
245
246• |CompleteDone| now sets the `reason` key in `v:event` which specifies the reason
247  for completion being done.
248• |vim.on_key()| callbacks can consume the key by returning an empty string.
249
250LSP
251
252• Improved rendering of LSP hover docs. |K-lsp-default|
253• |vim.lsp.completion.enable()| gained the `convert` callback which enables
254  customizing the transformation of an LSP CompletionItem to |complete-items|.
255• |vim.lsp.diagnostic.from()| can be used to convert a list of
256  |vim.Diagnostic| objects into their LSP diagnostic representation.
257• `:checkhealth vim.lsp` displays the server version (if available).
258• Completion side effects (including snippet expansion, execution of commands
259  and application of additional text edits) is now built-in.
260• |vim.lsp.util.locations_to_items()| and |vim.lsp.util.symbols_to_items()| now
261  sets `end_col` and `end_lnum` fields.
262• |vim.lsp.buf.format()| now supports passing a list of ranges
263  via the `range` parameter (this requires support for the
264  `textDocument/rangesFormatting` request).
265• |vim.lsp.buf.code_action()| actions show client name when there are multiple
266  clients.
267• |vim.lsp.buf.signature_help()| can now cycle through different signatures
268  using `<C-s>` and also support multiple clients.
269• The client now supports `'utf-8'` and `'utf-32'` position encodings.
270• |vim.lsp.buf.hover()| now highlights hover ranges using the
271  |hl-LspReferenceTarget| highlight group.
272• Functions in |vim.lsp.Client| can now be called as methods.
273• Implemented LSP folding: |vim.lsp.foldexpr()|
274  https://microsoft.github.io/language-server-protocol/specification/#textDocument_foldingRange
275• |vim.lsp.config()| has been added to define default configurations for
276  servers. In addition, configurations can be specified in `lsp/<name>.lua`.
277• |vim.lsp.enable()| has been added to enable servers.
278• |vim.lsp.buf.code_action()| resolves the `command` property during the
279  `codeAction/resolve` request.
280• The `textDocument/completion` request now includes the completion context in
281  its parameters.
282
283LUA
284
285• Command-line completions for: `vim.g`, `vim.t`, `vim.w`, `vim.b`, `vim.v`,
286  `vim.o`, `vim.wo`, `vim.bo`, `vim.opt`, `vim.opt_local`, `vim.opt_global`,
287  `vim.env` and `vim.fn`.
288• Documentation for |lua-bit|.
289• |gf| in Lua buffers can go to module in same repo, |runtime-search-path| and
290  |package.path|.
291• |vim.fs.rm()| can delete files and directories.
292• |vim.validate()| now has a new signature which uses less tables,
293  is more performant and easier to read.
294• |vim.str_byteindex()| and |vim.str_utfindex()| gained overload signatures
295  supporting two new parameters, `encoding` and `strict_indexing`.
296• |vim.json.encode()| has an option to enable forward slash escaping
297• |vim.fs.abspath()| converts paths to absolute paths.
298• |vim.fs.relpath()| gets relative path compared to base path.
299• |vim.fs.dir()| and |vim.fs.find()| can now follow symbolic links,
300  the behavior can be turn on using the new `follow` option.
301• |vim.hl.range()| now has a optional `timeout` field which allows for a timed
302  highlight.
303• |vim.text.indent()| indents/dedents text.
304
305OPTIONS
306
307• 'completeopt' flag "fuzzy" enables |fuzzy-matching| during |ins-completion|.
308• 'completeopt' flag "preinsert" highlights text to be inserted.
309• 'wildmode' flag "noselect" shows 'wildmenu' without selecting an entry.
310• 'messagesopt' configures |:messages| and |hit-enter| prompt.
311• 'tabclose' controls which tabpage to focus when closing a tabpage.
312• 'eventignorewin' to persistently ignore events in a window.
313• 'winborder' sets the default border for |floating-windows|.
314
315PERFORMANCE
316
317• Significantly reduced redraw time for long lines with treesitter
318  highlighting.
319• LSP diagnostics and inlay hints are de-duplicated (new requests cancel
320  inflight requests). This greatly improves performance with slow LSP servers.
321• 10x speedup for |vim.treesitter.foldexpr()| (when no parser exists for the
322  buffer).
323• Strong |treesitter-query| caching makes repeat  |vim.treesitter.query.get()|
324  and |vim.treesitter.query.parse()| calls significantly faster for large
325  queries.
326• Treesitter highlighting is now asynchronous. To force synchronous parsing,
327  use `vim.g._ts_force_sync_parsing = true`.
328• Treesitter folding is now calculated asynchronously.
329• |LanguageTree:parse()| now only runs the injection query on the provided
330  range (as long as the language does not have a combined injection),
331  significantly improving |treesitter-highlight| performance.
332• Treesitter injection query iteration is now asynchronous, making edits in
333  large buffers with combined injections much quicker.
334• 10x reduction in blocking time when attaching an LSP to a large buffer.
335
336PLUGINS
337
338• EditorConfig
339  • spelling_language property is now supported.
340• 'inccommand' incremental preview can run on 'nomodifiable' buffers and
341  restores their 'modifiable' state
342• Commenting
343  • 'commentstring' values can now be specified in a Treesitter capture's
344    `bo.commentstring` metadata field, providing finer grained support for
345    languages like `JSX`.
346
347STARTUP
348
349• |-es| ("script mode") disables shada by default.
350• Nvim will fail if the |--listen| or |$NVIM_LISTEN_ADDRESS| address is
351  invalid, instead of silently skipping an invalid address.
352
353TERMINAL
354
355• The |terminal| now understands the OSC 52 escape sequence to write to the
356  system clipboard (copy). Querying with OSC 52 (paste) is not supported.
357• |hl-StatusLineTerm| and |hl-StatusLineTermNC| define highlights for the
358  status line in |terminal| windows.
359• The terminal buffer now supports reflow (wrapped lines adapt when the buffer
360  is resized horizontally). Note: Lines that are not visible and kept in
361  'scrollback' are not reflown.
362• The |terminal| now supports OSC 8 escape sequences and will display
363  hyperlinks in supporting host terminals.
364• The |terminal| now uses the actual cursor, rather than a "virtual" cursor.
365  This means that escape codes sent by applications running in a terminal
366  buffer can change the cursor shape and visibility. However, it also
367  means that the |TermCursorNC| highlight group is no longer supported: an
368  unfocused terminal window will have no cursor at all (so there is nothing to
369  highlight).
370• |jobstart()| gained the "term" flag.
371• The |terminal| will send theme update notifications when 'background' is
372  changed and DEC mode 2031 is enabled.
373• The |terminal| has experimental support for the Kitty keyboard protocol
374  (sometimes called "CSI u" key encoding). Only the "Disambiguate escape
375  codes" mode is currently supported.
376• The |terminal| emits a |TermRequest| autocommand event when the child process
377  emits an APC control sequence.
378• |TermRequest| has a "cursor" field in its |event-data| indicating the
379  cursor position when the sequence was received.
380
381TREESITTER
382
383• |LanguageTree:node_for_range()| gets anonymous and named nodes for a range
384• |vim.treesitter.get_node()| now takes an option `include_anonymous`, default
385  false, which allows it to return anonymous nodes as well as named nodes.
386• |treesitter-directive-trim!| can trim all whitespace (not just empty lines)
387  from both sides of a node.
388• |vim.treesitter.get_captures_at_pos()| now returns the `id` of each capture
389• New |TSNode:child_with_descendant()|, which efficiently gets the node's
390  child that contains a given node as descendant.
391• |LanguageTree:parse()| optionally supports asynchronous invocation, which is
392  activated by passing the `on_parse` callback parameter.
393• |vim.treesitter.query.set()| can now inherit and/or extend runtime file
394  queries in addition to overriding.
395• |LanguageTree:is_valid()| now accepts a range parameter to narrow the scope
396  of the validity check.
397• |:InspectTree| now shows which nodes are missing.
398• Bundled markdown highlight queries use `conceal_lines` metadata to conceal
399  code block fence lines vertically.
400• |vim.treesitter.language.inspect()| shows additional information, including
401  parser version for ABI 15 parsers.
402• |TSQuery:disable_pattern()| and |TSQuery:disable_capture()| to turn off
403  a specific pattern or capture in a query.
404• |vim.treesitter.get_captures_at_pos()| returns the `pattern_id` of the
405  pattern used to match each capture.
406• |Query:iter_captures()| now accepts an `opts` parameter, similar to
407  |Query:iter_matches()|.
408
409TUI
410
411• The builtin UI declares info |nvim_set_client_info()| on its channel. See
412  |startup-tui|. To see the current UI info, try this: >
413    :lua =vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan)
414• |log| messages written by the builtin UI client (TUI, |--remote-ui|) are
415  now prefixed with "ui" instead of "?".
416• The TUI will re-query the terminal's background color when a theme update
417  notification is received and Nvim will update 'background' accordingly.
418
419UI
420
421• |:detach| the current UI, let the Nvim server continue running as a background
422  process. Works with the builtin TUI, and all GUIs.
423• |vim.ui.open()| (by default bound to |gx|) accepts an `opt.cmd` parameter
424  which controls the tool used to open the given path or URL. If you want to
425  globally set this, you can override vim.ui.open using the same approach
426  described at |vim.paste()|.
427• `vim.ui.open()` now supports
428  [lemonade](https://github.com/lemonade-command/lemonade) as an option for
429  opening urls/files. This is handy if you are in an ssh connection and use
430  `lemonade`.
431• The |ins-completion-menu| now supports cascading highlight styles.
432  |hl-PmenuSel| and |hl-PmenuMatch| both inherit from |hl-Pmenu|, and
433  |hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and
434  |hl-PmenuMatch|.
435• |vim.diagnostic.setqflist()| updates an existing quickfix list with the
436  given title if found
437• |ui-messages| content chunks now also contain the highlight group ID.
438• |:checkhealth| can display in a floating window, controlled by the
439  |g:health| variable.
440
441VIMSCRIPT
442
443• |getchar()| and |getcharstr()| have optional {opts} |Dict| argument to control:
444  cursor behavior, return type, and whether to simplify the returned key.
445
446==============================================================================
447CHANGED FEATURES
448
449These existing features changed their behavior.
450
451• 'scrollbind' now works properly with buffers that contain virtual lines.
452
453  Scrollbind works by aligning to a target top line of each window in a tab
454  page. Previously this was done by calculating the difference between the old
455  top line and the target top line, and scrolling by that amount. Now the
456  top lines are calculated using screen line numbers which take virtual lines
457  into account.
458
459• The implementation of grapheme clusters (or combining chars |mbyte-combining|)
460  was upgraded to closely follow extended grapheme clusters as defined by UAX#29
461  in the unicode standard. Noteworthily, this enables proper display of many
462  more emoji characters than before, including those encoded with multiple
463  emoji codepoints combined with ZWJ (zero width joiner) codepoints.
464
465  This also applies to :terminal output, where width of cells will be calculated
466  using the upgraded implementation.
467
468• Custom highlights in 'rulerformat', 'statuscolumn', 'statusline', 'tabline',
469  'winbar', and the sign/number column are stacked with their respective
470  highlight groups, as opposed to |hl-Normal|.
471  This is also reflected in the `highlights` from |nvim_eval_statusline()|,
472  with a new `groups` field containing an array of stacked highlight groups.
473
474• |vim.on_key()| callbacks won't be invoked recursively when a callback itself
475  consumes input.
476
477• "q" in man pages now uses |CTRL-W_q| instead of |CTRL-W_c| to close the
478  current window, and it no longer throws |E444| when there is only one window
479  on the screen. Global variable `vim.g.pager` is removed.
480
481• Default 'titlestring' is now implemented with 'statusline' "%" format items.
482  This means the default, empty value is essentially an alias to:
483  `%t%(\ %M%)%(\ \(%{expand(\"%:~:h\")}\)%)%a\ -\ Nvim`. This is only an
484  implementation simplification, not a behavior change.
485
486==============================================================================
487REMOVED FEATURES
488
489These deprecated features were removed.
490
491• option `severity_limit` for `vim.lsp.diagnostic` (use `min=severity`
492  instead |vim.diagnostic.severity|).
493
494==============================================================================
495DEPRECATIONS
496
497See |deprecated-0.11|.
498
499 vim:tw=78:ts=8:sw=2:et:ft=help:norl: