robin/laufey

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

robinmerge: 8c77b5be50c50ab119

master
23.4 KiB472 linesraw
1*news-0.10.txt*    Nvim
2
3
4                            NVIM REFERENCE MANUAL
5
6
7Notable changes since Nvim 0.9                                  *news-0.10*
8
9For changes in the previous release, see |news-0.9|.
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
18• API:
19  • |nvim_open_win()| now blocks all autocommands when `noautocmd` is set,
20    rather than just those from setting the `buffer` to display in the window.
21
22• Defaults:
23  • Default color scheme has been updated to be "Nvim branded" and accessible.
24    Use `:colorscheme vim` to revert to the old legacy color scheme.
25    • These Nvim specific highlight groups are now defined in a meaningfully
26      different way and might need an update:
27      • |hl-FloatBorder| is linked to |hl-NormalFloat| instead of |hl-WinSeparator|.
28      • |hl-NormalFloat| is not linked to |hl-Pmenu|.
29      • |hl-WinBar| has different background.
30      • |hl-WinBarNC| is similar to |hl-WinBar| but not bold.
31      • |hl-WinSeparator| is linked to |hl-Normal| instead of |hl-VertSplit|.
32    • This also might result into some color schemes looking differently due
33      to them relying on implicit assumptions about how highlight groups are
34      defined by default. To account for this, define all attributes of
35      highlight groups explicitly. Alternatively, use `:colorscheme vim` or
36      `:source $VIMRUNTIME/colors/vim.lua` to restore previous definitions.
37  • 'termguicolors' is enabled by default when Nvim is able to determine that
38    the host terminal emulator supports 24-bit color.
39
40• Editor:
41  • When switching windows, |CursorMoved| autocommands trigger when Nvim is
42    back on the main loop rather than immediately. This is more compatible
43    with Vim.
44  • "#" followed by a digit no longer stands for a function key at the start
45    of the lhs of a mapping.
46  • |shm-q| now fully hides macro recording message instead of only shortening it.
47  • Signs placed through the legacy |sign-commands| are now stored and
48    displayed as |extmarks| internally. Along with the following changes:
49    • A sign placed twice in the same group with the same identifier will be
50      moved.
51    • Legacy signs are always deleted along with the line it is placed on.
52    • Legacy and extmark signs will show up in both |:sign-place-list| and
53      |nvim_buf_get_extmarks()|.
54    • Legacy and extmark signs are displayed and listed with the same priority:
55        line number -> priority -> sign id -> recently placed
56  • `:behave` was removed.
57    • If you used `:behave xterm`, the following is equivalent: >vim
58
59      set mousemodel=extend
60<
61    • If you used `:behave mswin`, the following is equivalent: >vim
62
63      set selection=exclusive
64      set selectmode=mouse,key
65      set mousemodel=popup
66      set keymodel=startsel,stopsel
67<
68• Events:
69  • Returning any truthy value from a callback passed to
70    |nvim_create_autocmd()| (rather than just `true`) will delete the
71    autocommand.
72
73• LSP:
74  • |LanguageTree:parse()| will no longer parse injections by default and now
75    requires an explicit range argument to be passed. If injections are
76    required, provide an explicit range via `parser:parse({ start_row, end_row })`.
77  • |vim.lsp.util.parse_snippet()| will now strictly follow the snippet
78    grammar defined by LSP, and hence previously parsed snippets might now be
79    considered invalid input.
80  • |vim.lsp.codelens.refresh()| now takes an `opts` argument. With this
81    change, the default behavior of just refreshing the current buffer has
82    been replaced by refreshing all buffers.
83  • |vim.lsp.util.extract_completion_items()| will no longer return reliable
84    results, since it does not apply `itemDefaults` when its input is
85    a `CompletionList`. Moreover, since support for LSP
86    `completionList.itemDefaults` was added, some third party plugins might be
87    negatively impacted in case the language servers support the feature but
88    the plugin does not. If necessary, the respective capability can be
89    removed when calling |vim.lsp.protocol.make_client_capabilities()|.
90  • |LspRequest| and LspProgressUpdate (renamed to |LspProgress|) autocmds
91    were promoted from |User| autocmds to first class citizens.
92
93• Lua:
94  • |-l| ensures output ends with a newline if the script prints messages and
95    doesn't cause Nvim to exit.
96  • Removed functions from the |vim.json| module:
97    • Unnecessary, undocumented functions which caused global side-effects.
98    • `vim.json.null` is redundant with `vim.NIL`.
99    • `vim.json.array_mt` (and related) is redundant with `vim.empty_dict()`.
100  • |vim.islist()| now checks whether a table is actually list-like (i.e., has
101    integer keys without gaps and starting from 1). For the previous behavior
102    (only check for integer keys, allow gaps or not starting with 1), use
103    |vim.isarray()|.
104  • Renamed `vim.treesitter.playground` to `vim.treesitter.dev`.
105
106• Options:
107  • Removed some Vim 5.0<= option compatibilities:
108    • 'backspace' no longer supports number values. Instead:
109      • for `backspace=0` set `backspace=` (empty)
110      • for `backspace=1` set `backspace=indent,eol`
111      • for `backspace=2` set `backspace=indent,eol,start` (default behavior in Nvim)
112      • for `backspace=3` set `backspace=indent,eol,nostop`
113    • 'backupdir' and 'directory' will no longer remove a `>` at the start of
114      the option.
115  • |OptionSet| autocommand args |v:option_new|, |v:option_old|,
116    |v:option_oldlocal|, |v:option_oldglobal| now have the type of the option
117    instead of always being strings. |v:option_old| is now the old global
118    value for all global-local options, instead of just string global-local
119    options.
120  • Local value for a global-local number/boolean option is now unset when the
121    option is set (e.g. using |:set| or |nvim_set_option_value()|) without
122    a scope, which means they now behave the same way as string options.
123
124• Plugins:
125  • |:TOhtml| has been rewritten in Lua to support Nvim-specific decorations,
126    and many options have been removed.
127
128• Treesitter:
129  • Treesitter highlight groups have been renamed to be more in line with
130    upstream tree-sitter and Helix to make it easier to share queries. The
131    full list is documented in |treesitter-highlight-groups|.
132
133• TUI:
134  • In some cases, the cursor in the Nvim |TUI| used to blink even without
135    configuring 'guicursor' as mentioned in |cursor-blinking|. This was a bug
136    that has now been fixed. If your cursor has stopped blinking, add the
137    following (or similar, adapted to user preference) to your |config| file: >vim
138      set guicursor+=n-v-c:blinkon500-blinkoff500
139<
140
141==============================================================================
142NEW FEATURES
143
144The following new features were added.
145
146• API:
147  • Passing 0 to |nvim_get_chan_info()| gets info about the current channel.
148  • |nvim_buf_set_extmark()| supports inline virtual text.
149  • |nvim_win_text_height()| computes the number of screen lines occupied
150    by a range of text in a given window.
151  • New RPC client type `msgpack-rpc` is added for |nvim_set_client_info()| to
152    support fully MessagePack-RPC compliant clients.
153  • Floating windows can now be hidden by setting `hide` in |nvim_open_win()| or
154    |nvim_win_set_config()|.
155  • |nvim_input_mouse()| supports mouse buttons "x1" and "x2".
156  • Added "force_crlf" option field in |nvim_open_term()|.
157  • Added |nvim_tabpage_set_win()| to set the current window of a tabpage.
158  • Mapping APIs now support abbreviations when mode short-name has suffix "a".
159  • Floating windows can now show footer with new `footer` and `footer_pos`
160    config fields. Uses |hl-FloatFooter| by default.
161  • |extmarks| can set a "url" highlight attribute, so the text region can
162    become a clickable hyperlink (assuming UI support). The TUI renders URLs
163    using the OSC 8 control sequence, enabling clickable text in supporting
164    terminals.
165  • |nvim_open_win()| and |nvim_win_set_config()| now support opening normal
166    (split) windows, moving floating windows into split windows, and opening
167    windows in non-current tabpages.
168  • Flags added to |nvim_buf_set_extmark()|:
169    • "undo_restore": opt-out extmarks of precise undo tracking.
170    • "invalidate": automatically hide or delete extmarks.
171    • "virt_text_repeat_linebreak": repeat virtual text on wrapped lines.
172  • Extmarks now fully support multi-line ranges, and a single extmark can be
173    used to highlight a range of arbitrary length. The |nvim_buf_set_extmark()|
174    API function already allowed you to define such ranges, but highlight
175    regions were not rendered consistently for a range that covers more than
176    one line break. This has now been fixed. Signs defined as part of
177    a multi-line extmark also apply to every line in the range, not just the
178    first. In addition, |nvim_buf_get_extmarks()| has gained an "overlap"
179    option to return such ranges even if they started before the specified
180    position.
181
182• Defaults:
183  • The `workspace/didChangeWatchedFiles` LSP client capability is now enabled
184    by default on Mac and Windows. Disabled on Linux since there currently
185    isn't a viable backend for watching files that scales well for large
186    directories.
187  • On Windows 'isfname' does not include ":". Drive letters are handled
188    correctly without it. (Use |gF| for filepaths suffixed with ":line:col").
189  • 'comments' includes "fb:•".
190  • 'shortmess' includes the "C" flag.
191  • 'grepprg' uses the -H and -I flags for grep by default,
192    and defaults to using ripgrep if available.
193  • "]d" and "[d" in Normal mode map to |vim.diagnostic.goto_next()| and
194    |vim.diagnostic.goto_prev()|, respectively. |]d-default| |[d-default|
195  • <C-W>d (and <C-W><C-D>) map to |vim.diagnostic.open_float()|
196    |CTRL-W_d-default|
197  • |vim.lsp.start()| sets the following default keymaps (assuming server
198    support):
199    • |K| in Normal mode maps to |vim.lsp.buf.hover()|, unless 'keywordprg'
200      was customized before calling |vim.lsp.start()|.
201  • Automatic linting of treesitter query files (see |ft-query-plugin|).
202    Can be disabled via: >lua
203      vim.g.query_lint_on = {}
204<
205  • Enabled treesitter highlighting for:
206    • Treesitter query files
207    • Vim help files
208    • Lua files
209
210• Editor:
211  • Better cmdline completion for string option value. |complete-set-option|
212    • Try it with `:set listchars=<Tab>`
213  • By default, the swapfile "ATTENTION" |E325| dialog is skipped if the
214    swapfile is owned by a running Nvim process, instead of prompting. If you
215    always want the swapfile dialog, delete the default SwapExists handler:
216    `autocmd! nvim.swapfile`. |default-autocmds|
217  • Navigating the |jumplist| with CTRL+O, CTRL+I behaves more intuitively
218    when deleting buffers, and avoids "invalid buffer" cases. #25461
219  • |:fclose| command.
220  • v_Q-default and |v_@-default| repeat a register for each line of a linewise
221    visual selection.
222  • Clicking on a tabpage in the tabline with the middle mouse button closes it.
223  • |:checkhealth| buffer can be opened in a split window using modifiers like
224    |:vertical|, |:horizontal| and |:botright|.
225
226• Events:
227  • |vim.on_key()| callbacks receive a second argument for keys typed before
228    mappings are applied.
229
230• LSP:
231  • LSP method names are available in `vim.lsp.protocol.Methods`.
232  • Implemented LSP inlay hints: |lsp-inlay_hint|
233    https://microsoft.github.io/language-server-protocol/specification/#textDocument_inlayHint
234  • Implemented pull diagnostic textDocument/diagnostic: |vim.lsp.diagnostic.on_diagnostic()|
235    https://microsoft.github.io/language-server-protocol/specification/#textDocument_diagnostic
236  • Implemented LSP type hierarchy: |vim.lsp.buf.typehierarchy()|
237    https://microsoft.github.io/language-server-protocol/specification/#textDocument_prepareTypeHierarchy
238  • |vim.lsp.status()| consumes the last progress messages as a string.
239  • LSP client now always saves and restores named buffer marks when applying
240    text edits.
241  • LSP client now supports the `positionEncoding` server capability. If a server
242    responds with the `positionEncoding` capability in its initialization
243    response, Nvim automatically sets the client's `offset_encoding` field.
244  • Dynamic registration of LSP capabilities. An implication of this change is
245    that checking a client's `server_capabilities` is no longer a sufficient
246    indicator to see if a server supports a feature. Instead use
247    `client.supports_method(<method>)`. It considers both the dynamic
248    capabilities and static `server_capabilities`.
249  • `anchor_bias` option to lsp-handlers aids in positioning of floating
250    windows.
251  • |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to
252    the original LSP `Location` or `LocationLink`.
253  • Added support for connecting to servers using named pipes (Windows) or
254    Unix domain sockets (Unix) via |vim.lsp.rpc.connect()|.
255  • Added support for `completionList.itemDefaults`, reducing overhead when
256    computing completion items where properties often share the same value
257    (e.g. `commitCharacters`). Note that this might affect plugins and
258    language servers that don't support the feature, and in such cases the
259    respective capability can be unset.
260  • |vim.lsp.start()| accepts a "silent" option for suppressing messages
261    if an LSP server failed to start.
262  • |vim.lsp.buf.definition()|, |vim.lsp.buf.declaration()|,
263    |vim.lsp.buf.type_definition()|, and |vim.lsp.buf.implementation()| now
264    support the `loclist` field of |vim.lsp.ListOpts|.
265
266• Lua:
267  • |:lua| with a |[range]| executes that range as Lua code, in any buffer.
268  • |:source| without arguments treats a buffer with 'filetype' of "lua" as
269    Lua code regardless of its extension.
270  • Vimscript function |exists()| supports checking |v:lua| functions.
271  • |vim.iter()| is a generic interface for all |iterable| objects (tables,
272    |iterator|s).
273  • |vim.snippet| provides a mode for expanding and navigating snippets.
274  • |vim.ringbuf()| is a generic ring buffer (data structure).
275  • |vim.deepcopy()| gained a `noref` argument to avoid hashing table values.
276  • |vim.keycode()| translates keycodes in a string.
277  • |vim.system()| runs commands / starts processes.
278  • |vim.lpeg| and |vim.re| expose the bundled Lpeg expression grammar parser
279    and its regex interface.
280  • |vim.base64.encode()| and |vim.base64.decode()| encode and decode strings
281    using Base64 encoding.
282  • |vim.text.hexencode()| and |vim.text.hexdecode()| convert strings to and
283    from byte representations.
284  • |vim.ui.open()| opens URIs using the system default handler (macOS `open`,
285    Windows `explorer`, Linux `xdg-open`, etc.)
286  • |vim.wo| can now be double indexed for |:setlocal| behaviour. Currently
287    only `0` for the buffer index is supported.
288  • Improved messages for type errors in `vim.api.*` calls (including `opts` params).
289  • Lua type annotations for:
290    • `vim.*`
291    • `vim.fn.*`
292    • `vim.api.*`
293    • `vim.v.*`
294  • Functions that take a severity as an optional parameter (e.g.
295    |vim.diagnostic.get()|) now also accept a list of severities |vim.diagnostic.severity|
296  • |vim.diagnostic.count()| returns the number of diagnostics for a given
297    buffer and/or namespace, by severity. This is a faster alternative to
298    |vim.diagnostic.get()| when only the number of diagnostics is needed, but
299    not the diagnostics themselves.
300  • |vim.diagnostic.is_enabled()|
301  • |vim.version.le()|, |vim.version.ge()|
302  • |vim.fs.root()| finds project root directories from a list of "root
303    markers".
304  • |vim.tbl_contains()| now works for general tables and allows specifying
305    a predicate function that is checked for each value. (Use
306    |vim.list_contains()| for checking list-like tables (integer keys without
307    gaps) for literal values.)
308  • vim.region() can use a string accepted by |getpos()| as position.
309
310• Options:
311  • 'winfixbuf' keeps a window focused onto a specific buffer
312  • 'smoothscroll' option to scroll by screen line rather than by text line
313    when 'wrap' is set.
314  • 'foldtext' now supports virtual text format. |fold-foldtext|
315  • 'foldtext' can be set to an empty string to disable and render the line:
316    as normal with regular highlighting and no line wrapping.
317  • 'complete' option supports "f" flag for completing buffer names.
318  • 'completeopt' option supports "popup" flag to show extra information in
319    a floating window.
320  • 'errorfile' (|-q|) accepts `-` as an alias for stdin.
321
322• Performance:
323  • 'diffopt' "linematch" scoring algorithm now favours larger and less groups
324    https://github.com/neovim/neovim/pull/23611
325  • Treesitter highlighting now parses injections incrementally during
326    screen redraws only for the line range being rendered. This significantly
327    improves performance in large files with many injections.
328  • 'breakindent' performance is significantly improved for wrapped lines.
329  • Cursor movement, insertion with [count] and |screenpos()| are now faster.
330
331• Plugins:
332  • Nvim now includes |commenting| support.
333  • |:Man| supports the `:hide` modifier to open page in the current window.
334  • |:Man| respects 'wrapmargin'
335
336• Startup:
337  • |$NVIM_APPNAME| can be set to a relative path instead of only a name.
338  • |--startuptime| reports startup times for both processes (TUI + server) as
339    separate sections.
340
341• Terminal:
342  • |:terminal| accepts some |:command-modifiers| (specifically |:horizontal|
343    and those that affect splitting a window).
344  • Terminal buffers emit a |TermRequest| autocommand event when the child
345    process emits an OSC or DCS control sequence.
346  • Terminal buffers respond to OSC background and foreground requests.
347    |default-autocmds|
348
349• Treesitter:
350  • Bundled parser and queries (highlight, folds) for Markdown (used for LSP
351    hover).
352  • |:InspectTree| shows root nodes.
353  • |:InspectTree| now supports |folding|.
354  • |:InspectTree| shows node ranges in 0-based instead of 1-based indexing.
355  • |vim.treesitter.foldexpr()| now recognizes folds captured using a
356    quantified query pattern.
357  • |vim.treesitter.query.omnifunc()| provides completion in treesitter query
358    files (set by default).
359  • |vim.treesitter.query.edit()| provides live editing of treesitter queries.
360  • |Query:iter_matches()| now has the ability to set the maximum start depth
361    for matches.
362  • `@injection.language` now has smarter resolution and will fall back to
363    language aliases (e.g., filetype or custom shorthands) registered via
364    |vim.treesitter.language.register()| and/or attempt lower case variants of
365    the text.
366  • `@injection.filename` will try to match the node text via
367    |vim.filetype.match()| and treat the result as a language name in the same
368    way as `@injection.language`.
369  • The `#set!` directive supports `injection.self` and `injection.parent` for
370    injecting either the current node's language or the parent
371    |LanguageTree|'s language, respectively.
372  • The `#set!` directive can set the "url" property of a node to have the
373    node emit a hyperlink. Hyperlinks are UI specific: in the TUI, the OSC 8
374    control sequence is used.
375  • Improved error messages for query parsing.
376
377• TUI:
378  • Builtin TUI can now recognize "super" (|<D-|) and "meta" (|<T-|) modifiers
379    in a terminal emulator that supports |tui-csiu|.
380  • The |TermResponse| event can be used with |v:termresponse| to read escape
381    sequence responses from the host terminal.
382  • A clipboard provider which uses OSC 52 to copy the selection to the system
383    clipboard is now bundled by default and will be automatically enabled under
384    certain conditions. |clipboard-osc52|
385  • 'termsync' option asks the host terminal to buffer screen updates until
386    the redraw cycle is complete. Requires support from the host terminal.
387
388• UI:
389  • Enhanced support for rendering multibyte characters using composing
390    characters: the maximum limit was increased from 1+6 codepoints to
391    31 bytes, which is guaranteed to fit all chars from before but often more.
392    • NOTE: the regexp engine still has a hard-coded limit of considering
393      6 composing chars only.
394
395
396==============================================================================
397CHANGED FEATURES
398
399These existing features changed their behavior.
400
401• API:
402  • |nvim_buf_call()| and |nvim_win_call()| now preserve any return value (NB:
403    not multiple return values)
404
405• Editor:
406  • |gx| now uses |vim.ui.open()| and not netrw. To customize, you can redefine
407    `vim.ui.open` or remap `gx`. To continue using netrw (deprecated): >vim
408    :packadd netrw
409    :call netrw#BrowseX(expand(exists("g:netrw_gx") ? g:netrw_gx : '<cfile>'), netrw#CheckIfRemote())<CR>
410
411• LSP:
412  • LSP hover and signature help now use Treesitter for highlighting of
413    Markdown content. Note that highlighting of code examples requires
414    a matching parser and may be affected by custom queries.
415  • |LspRequest| autocmd callbacks contain more information about the LSP
416    request status update that occurred.
417
418• Lua:
419  • |vim.wait()| cannot be called in |api-fast|.
420  • |vim.diagnostic.config()| now accepts virtual text relevant options to
421    |nvim_buf_set_extmark()| (e.g. "virt_text_pos" and "hl_mode") in its
422    "virtual_text" table, which gives users more control over how diagnostic
423    virtual text is displayed.
424  • |vim.diagnostic.get()| and |vim.diagnostic.count()| accept multiple
425    namespaces rather than just a single namespace.
426  • |vim.diagnostic.enable()| gained new parameters, and the old signature is
427    deprecated.
428  • |vim.diagnostic.config()| now accepts a function for the virtual_text.prefix
429    option, which allows for rendering e.g., diagnostic severities differently.
430
431• Options:
432  • Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no
433    longer gives an error.
434
435• Terminal:
436  • Terminal buffers started with no arguments (and use 'shell') close
437    automatically if the job exited without error, eliminating the (often
438    unwanted) "[Process exited 0]" message. |default-autocmds|
439
440• Treesitter:
441  • |Query:iter_matches()|, |vim.treesitter.query.add_predicate()|, and
442    |vim.treesitter.query.add_directive()| accept a new `all` option which
443    ensures that all matching nodes are returned as a table. The default option
444    `all=false` returns only a single node, breaking captures with quantifiers
445    like `(comment)+ @comment`; it is only provided for backward compatibility
446    and will be removed after Nvim 0.10.
447  • |vim.treesitter.query.add_predicate()| and
448    |vim.treesitter.query.add_directive()| now accept an options table rather
449    than a boolean "force" argument. To force a predicate or directive to
450    override an existing predicate or directive, use `{ force = true }`.
451
452==============================================================================
453REMOVED FEATURES
454
455These deprecated features were removed.
456
457• Vimball support, including `:Vimuntar` command
458
459• Support for legacy treesitter injection queries
460
461• 'shortmess' flags:
462  • |shm-f|. Always use "(3 of 5)", never "(file 3 of 5)".
463  • |shm-i|. Always use "[noeol]".
464  • |shm-x|. Always use "[dos]", "[unix]" and "[mac]".
465  • |shm-n|. Always use "[New]".
466
467==============================================================================
468DEPRECATIONS
469
470See |deprecated-0.10|.
471
472 vim:tw=78:ts=8:sw=2:et:ft=help:norl: