news.txt 21 KB

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