robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
446b9d8c55
master
1*news-0.12.txt* Nvim 2 3 4 NVIM REFERENCE MANUAL 5 6 7Notable changes since Nvim 0.11 *news-0.12* 8 9For changes in the previous release, see |news-0.11|. 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• |nvim_get_commands()| returns `complete` as a Lua function, if it was 21 defined as such. 22 23DIAGNOSTICS 24 25• |diagnostic-signs| can no longer be configured with |:sign-define| or 26 |sign_define()| (deprecated in Nvim 0.10 |deprecated-0.10|). 27• Removed vim.diagnostic.disable() and vim.diagnostic.is_disabled() 28 (deprecated in Nvim 0.10 |deprecated-0.10|). 29• The legacy signature of |vim.diagnostic.enable()| (deprecated in Nvim 0.10 30 |deprecated-0.10|) is no longer supported. 31 32EDITOR 33 34• |i_CTRL-R| inserts named/clipboard registers (A-Z,a-z,0-9+) literally, like 35 pasting instead of like user input. Improves performance, avoids broken 36 formatting. To get the old behavior you can use `<C-R>=@x`. 37• Parsing of URI-like buffer names more closely follows RFC3986, so for example 38 "svn+ssh:", "ed2k:", and "iris.xpc:" are recognized as URI schemes. 39• Security: Nvim on Windows no longer searches the current directory for 40 external command executables; prefix a relative or absolute path if you 41 want the old behavior |$NoDefaultCurrentDirectoryInExePath|. 42 43EVENTS 44 45• |ui-messages| no longer emits the `msg_show.return_prompt`, and 46 `msg_history_clear` events. The `msg_clear` event was repurposed and is now 47 emitted after the screen is cleared. These events arbitrarily assumed a 48 message UI that mimics the legacy message grid. Benefit: reduced UI event 49 traffic and more flexibility for UIs. 50 The `msg_history_show` event has an additional "prev_cmd" argument. 51 52LSP 53 54• JSON "null" values in LSP messages are represented as |vim.NIL| instead of `nil`. 55 Missing fields (as opposed to JSON "null") are still represented as `nil`. 56• The function set with |vim.lsp.log.set_format_func()| is now given all 57 arguments corresponding to a log entry instead of the individual arguments. 58• Renamed `vim.lsp.semantic_tokens` `start()/stop()` to `enable()`. 59• |vim.lsp.util.convert_signature_help_to_markdown_lines()| activeParameter 60 handling updated: 61 • Values < 0 are now treated as `nil` instead of 0. 62 • Values outside the range of `signatures[activeSignature].parameters` 63 are now treated as `nil` instead of `#signatures[activeSignature].parameters` 64 65LUA 66 67• Renamed `vim.diff` to `vim.text.diff`. 68 69OPTIONS 70 71• 'shelltemp' defaults to "false". 72 73PLUGINS 74 75• Removed "shellmenu" plugin, an old menu-based quasi-snippet plugin for shell scripts. 76• |package-tohtml| is now an "opt-in" plugin. Use |:packadd| to activate it: > 77 :packadd nvim.tohtml 78 79TREESITTER 80 81• |ft-query-plugin| no longer enables |vim.treesitter.query.lint()| by default. 82• |treesitter-directive-offset!| can now be applied to quantified captures. It 83 no longer sets `metadata[capture_id].range`; it instead sets 84 `metadata[capture_id].offset`. The offset will be applied in 85 |vim.treesitter.get_range()|, which should be preferred over reading 86 metadata directly for retrieving node ranges. 87• The "all" option to |Query:iter_matches()|, which was introduced in Nvim 88 0.11 to aid in transitioning to the new behavior, has been removed. 89 90============================================================================== 91NEW FEATURES 92 93The following new features were added. 94 95API 96 97• |api-contract| allows existing functions to change return-type from `void => non-void`. 98• |nvim_win_text_height()| can limit the lines checked when a certain 99 `max_height` is reached, and returns the `end_row` and `end_vcol` for which 100 `max_height` or the calculated height is reached. 101• |vim.secure.read()| now returns `true` for trusted directories. Previously 102 it would return `nil`, thus impossible to tell if the directory was actually 103 trusted. 104• |nvim_ui_send()| writes arbitrary data to a UI's stdout. Use this to write 105 escape sequences to the terminal when Nvim is running in the |TUI|. 106• |nvim_echo()| can set the |ui-messages| kind with which to emit the message. 107• |nvim_echo()| can create |Progress| messages 108• |nvim_get_commands()| returns `preview` and `callback` as Lua functions if 109 they were so specified in `nvim_create_user_command()`. 110• |nvim_open_tabpage()| can open a new |tabpage|. 111• |nvim_open_win()| floating windows can show a 'statusline'. Plugins can use 112 `style='minimal'` or `:setlocal statusline=` to hide the statusline. 113• |nvim_win_set_config()| can move |floating-windows| to other tabpages. 114• EXPERIMENTAL: |nvim__exec_lua_fast()| allows remote API clients to execute 115 Lua while Nvim is blocking for input. |api-fast| 116• Decoration provider gained an `on_range` callback (deprecates `on_line`). 117• |vim.secure.trust()| accepts `path` for the `allow` action. 118• |nvim_get_chan_info()| includes `exitcode` field for :terminal buffers. 119• |nvim_set_hl()| supports updating specified attributes only. 120 121BUILD 122 123• EXPERIMENTAL: Zig-based build is available as an alternative to CMake. It is 124 currently limited in functionality, and CMake remains the recommended option 125 for the time being. 126• Nvim can be built without Unibilium (terminfo implementation), in which case 127 the user's terminfo database won't be loaded and only internal definitions 128 for the most common terminals are used: > 129 make distclean && make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_UNIBILIUM=0" 130• On Windows, `tee.exe` is included with `nvim.exe` by default so that 131 commands like :make, :grep work out of the box. 132 133DEFAULTS 134 135• 'diffopt' default value now includes "indent-heuristic" and "inline:char". 136• 'statusline' default is exposed as a statusline expression (previously it 137 was implemented as an internal C routine). 138• Default 'statusline' shows: 139 • |vim.diagnostic.status()| 140 • |vim.ui.progress_status()| 141 • :terminal exit code 142• Project-local configuration ('exrc') is also loaded from parent directories. 143 Unset 'exrc' to stop further search. 144• Mappings: 145 • |grt| in Normal mode maps to |vim.lsp.buf.type_definition()| 146 • |grx| in Normal mode maps to |vim.lsp.codelens.run()| 147• 'shada' default now excludes "/tmp/" and "/private/" paths to reduce clutter in |:oldfiles|. 148• Enabled treesitter highlighting for Markdown files. 149 150DIAGNOSTICS 151 152• |vim.diagnostic.setloclist()| and |vim.diagnostic.setqflist()| now support a 153 `format` function to modify (or filter) diagnostics before being set in the 154 location/quickfix list. 155• |vim.diagnostic.get()| now accepts an `enabled` filter to only return 156 enabled or disabled diagnostics. 157• |vim.diagnostic.status()| returns a status description of current buffer 158 diagnostics. 159• |vim.diagnostic.fromqflist()| accepts `opts.merge_lines` to merge multiline 160 compiler messages. 161 162EDITOR 163 164• |:iput| works like |:put| but adjusts indent. 165• |:retab| accepts new optional parameter -indentonly to only change leading 166 whitespace in indented lines. 167• |:uniq| deduplicates text in the current buffer. 168• |omnicompletion| is available when editing |help| buffers. |ft-help-omni| 169• |:help!| has DWIM ("Do What I Mean") behavior: it tries to guess the help 170 tag at cursor. In help buffers, 'keywordprg' defaults to ":help!". For 171 example, try "K" anywhere in this code: > 172 local v = vim.version.parse(vim.system({'foo'}):wait().stdout) 173• Setting "'0" in 'shada' prevents storing the jumplist in the shada file. 174• 'shada' now correctly respects "/0" and "f0". 175• |prompt-buffer| supports multiline input/paste, undo/redo, and o/O normal 176 commands. 177• 'wildchar' now enables completion in search contexts using |/|, |?|, |:g|, |:v| 178 and |:vimgrep| commands. 179• Security: 'exrc' no longer shows "(a)llow". Instead you must "(v)iew", 180 then run `:trust` (or `:trust [file]`, but that has a TOCTOU risk). 181• |gx| in help buffers opens the online documentation for the tag at cursor. 182• |:source| with a range in non-Lua files (e.g., vimdoc) now detects Lua 183 codeblocks via treesitter and executes them as Lua instead of Vimscript. 184 (Or use `:{range}lua` to skip the detection.) 185• |:wall| with |++p| auto-creates missing parent directories. 186 187EVENTS 188 189• In the |ui-protocol|, message kind `empty` is emitted for empty messages 190 (e.g. `:echo ""`). 191• |CmdlineLeave| sets |v:char| to the character that stops the Cmdline mode. 192• |CmdlineLeavePre| triggered before preparing to leave the command line. 193• New `append`, `id` and `trigger` parameter for |ui-messages| `msg_show` event. 194• 'rulerformat' is emitted as `msg_ruler` when not part of the statusline. 195• Creating or updating a progress message with |nvim_echo()| triggers a |Progress| event. 196• |MarkSet| is triggered after a |mark| is set by the user (currently doesn't 197 support implicit marks like |'[| or |'<|, …). 198• |SessionLoadPre| is triggered before loading a |Session| file. 199• |TabClosedPre| is triggered before closing a |tabpage|. 200• |TermRequest| event gained a `terminator` parameter. 201 202HIGHLIGHTS 203 204• |hl-DiffTextAdd| highlights added text within a changed line. 205• |hl-OkMsg| |hl-StderrMsg| |hl-StdoutMsg| 206• |hl-SnippetTabstopActive| highlights the currently active tabstop. 207• |hl-PmenuBorder| |hl-PmenuShadow| |hl-PmenuShadowThrough| see 'pumborder'. 208• |nvim_set_hl()| and |nvim_get_hl()| support the SGR attributes "dim", 209 "blink", "conceal", and "overline". 210 211LSP 212 213• |lsp-completion|: 214 • |vim.lsp.completion.enable()| gained a `cmp` option for custom ordering. 215 • Supports colored symbol preview for color items. 216 • Shows a preview ("completionItem/resolve") if 'completeopt' has "popup". 217 • Support for `textDocument/inlineCompletion` |lsp-inline_completion| 218 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_inlineCompletion 219 See |lsp-inline_completion| for quickstart instructions. 220• |:lsp| can be used to interactively manage LSP clients. 221• |vim.lsp.ClientConfig| gained `workspace_required`. 222• You can control the priority of |vim.lsp.Config| `root_markers`. 223• LSP capabilities: 224 • `textDocument/codeLens` |lsp-codelens| was reimplemented. 225 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_codeLens 226 • `textDocument/colorPresentation` |lsp-document_color| 227 https://microsoft.github.io/language-server-protocol/specification/#textDocument_colorPresentation 228 • `textDocument/diagnostic` 229 • `textDocument/documentColor` |lsp-document_color| 230 https://microsoft.github.io/language-server-protocol/specification/#textDocument_documentColor 231 • `textDocument/documentLink`: |gx| opens "documentLink" items at cursor. 232 • `textDocument/inlineCompletion` 233 • `textDocument/linkedEditingRange` |lsp-linked_editing_range| 234 https://microsoft.github.io/language-server-protocol/specification/#textDocument_linkedEditingRange 235 • `textDocument/onTypeFormatting` |lsp-on_type_formatting| 236 https://microsoft.github.io/language-server-protocol/specification/#textDocument_onTypeFormatting 237 • `textDocument/selectionRange` Incremental selection. 238 |v_an| selects outwards, |v_in| selects inwards. 239 • `textDocument/semanticTokens/range` 240 • `workspace/codeLens/refresh` 241 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeLens_refresh 242 • `workspace/diagnostic/refresh` 243 https://microsoft.github.io/language-server-protocol/specification/#diagnostic_refresh 244 • `workspace/diagnostic` |vim.lsp.buf.workspace_diagnostics()| 245 https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_dagnostics 246• Support for dynamic registration: 247 • `textDocument/diagnostic` 248• The `textDocument/diagnostic` request now includes the previous id in its 249 parameters. 250• |vim.lsp.enable()| start/stops clients as necessary and detaches 251 non-applicable LSP clients. 252• |vim.lsp.is_enabled()| checks if a LSP config is enabled (without 253 "resolving" it). 254• |vim.lsp.get_configs()| gets all LSP configs matching an optional filter. 255• Support for multiline semantic tokens. 256• Support for the `disabled` field on code actions. 257• The function form of `cmd` in a vim.lsp.Config or vim.lsp.ClientConfig 258 receives the resolved config as the second arg: `cmd(dispatchers, config)`. 259• Support for annotated text edits. 260• `:checkhealth vim.lsp` is now available to check which buffers the active LSP features are attached to. 261• LSP `DiagnosticRelatedInformation` is now shown in 262 |vim.diagnostic.open_float()|. It is read from the LSP diagnostic object 263 stored in the `user_data` field. 264• When inside the float created by |vim.diagnostic.open_float()| and the 265 cursor is on a line with `DiagnosticRelatedInformation`, |gf| can be used to 266 jump to the problematic location. 267• Support for related documents in pull diagnostics: 268 https://microsoft.github.io/language-server-protocol/specifications/specification-current/#relatedFullDocumentDiagnosticReport 269• |vim.lsp.buf.signature_help()| supports "noActiveParameterSupport". 270• The filter option of |vim.lsp.buf.code_action()| now receives the client ID as an argument. 271• |vim.lsp.ClientConfig| `exit_timeout` decides the time waited before "stop" 272 escalates to "force-stop" for |vim.lsp.enable()|, |Client:stop()|, and 273 during Nvim shutdown. 274 • `exit_timeout` graduated from "experimental" `flags.exit_timeout` 275 to a top-level field. Defaults to `false`. 276• |Client:stop()| accepts `force` as an integer, which is treated as the time 277 to wait before before stop escalates to force-stop. 278• |vim.lsp.buf.rename()| now highlights the symbol being renamed using the 279 |hl-LspReferenceTarget| highlight group. 280• Code lenses now display as virtual lines 281 282LUA 283 284• |vim.net.request()| can fetch/download HTTP content. 285• |vim.wait()| returns the callback results. 286• Lua type annotations for `vim.uv`. 287• |vim.hl.range()| now allows multiple timed highlights. 288• |vim.tbl_extend()|, |vim.tbl_deep_extend()| `behavior` argument can be a function. 289• |vim.fs.root()| can define "equal priority" via nested lists. 290• |vim.fs.ext()| returns the last extension of a file. 291• |vim.version.range()| can output human-readable string via |tostring()|. 292• |vim.version.intersect()| computes intersection of two version ranges. 293• |Iter:take()| and |Iter:skip()| now optionally accept predicates. 294• |Iter:peek()| now works for all iterator types, not just |list-iterator|. 295• |vim.list.unique()| and |Iter:unique()| to deduplicate lists and iterators, 296 respectively. 297• |vim.list.bisect()| performs binary search. 298• |vim.json.encode()| `indent` option performs pretty-formatting. 299• |vim.json.encode()| `sort_keys` option sorts by key. 300• |vim.json.decode()| `skip_comments` option allows comments in JSON data. 301• EXPERIMENTAL: |vim.pos|, |vim.range| provide Position/Range abstraction. 302 303OPTIONS 304 305• 'autocomplete' enables |ins-autocompletion|. 306• 'autowriteall' writes all buffers upon receiving `SIGHUP`, `SIGQUIT` or `SIGTSTP`. 307• 'chistory' and 'lhistory' set size of the |quickfix-stack|. 308• 'complete' new flags: 309 • "F{func}" complete using given function 310 • "F" complete using 'completefunc' 311 • "o" complete using 'omnifunc' 312• 'complete' allows limiting matches for sources using "{flag}^<limit>". 313• 'completeopt' flag "nearest" sorts completion results by distance to cursor. 314• 'diffanchors' specifies addresses to anchor a diff. 315• 'diffopt' `inline:` configures diff highlighting for changes within a line. 316• 'diffopt' with `inline:word` now automatically merges adjacent diff blocks 317 separated by gaps and punctuation by 5 bytes to improve readability. 318• 'fillchars' has new flag "foldinner". 319• 'fsync' and 'grepformat' are now |global-local| options. 320• 'listchars' has new flag "leadtab". 321• 'jumpoptions' flag "view" now applies when popping the |tagstack|. 322• 'maxsearchcount' sets maximum value for |searchcount()| and defaults to 999. 323• 'pummaxwidth' sets maximum width for the completion popup menu. 324• 'winborder' "bold" style, custom border style. 325• 'busy' sets a buffer "busy" status. Indicated in the default statusline. 326• 'pumborder' adds a border to the popup menu. 327• |g:clipboard| accepts a string name to force any builtin clipboard tool. 328• |g:clipboard| autodetection selects tmux only when running inside tmux. 329• 'statusline' allows "stacking" highlight groups (groups inherit from 330 previous highlight attributes) 331• 'messagesopt' "progress:c" flag controls whether progress messages are shown 332 in the cmdline message area. 333• Improved |:set+=|, |:set^=| and |:set-=| handling of comma-separated "key:value" 334 pairs (e.g. 'listchars', 'fillchars', 'diffopt'). 335 336PERFORMANCE 337 338• |vim.glob.to_lpeg()| uses a new LPeg-based implementation (Peglob) that 339 provides ~50% speedup for complex patterns. The implementation restores 340 support for nested braces and follows LSP 3.17 specification with 341 additional constraints for improved correctness and resistance to 342 backtracking edge cases. 343• |i_CTRL-R| inserts named/clipboard registers literally, 10x speedup. 344• LSP `textDocument/semanticTokens/range` is supported, which requests tokens 345 for the viewport (visible screen) only. 346• |:packadd| doesn't invalidate the cached Lua package path. Instead the cache 347 gets updated in place. This might make a big startuptime difference for 348 certain |init.lua| patterns where multiple |:packadd| or |vim.pack.add()| 349 calls are interspersed with other code. 350 351PLUGINS 352 353• Built-in plugin manager: |vim.pack| 354• |:DiffTool| compares directories (and files). 355• |:Undotree| lets you visually navigate the |undo-tree|. 356• Customize :checkhealth by handling a `FileType checkhealth` event. 357 |health-usage| 358• Simplify Python provider setup to a single step: `uv tool install pynvim` 359 Nvim will detect the plugin's location without user configuration, even if 360 unrelated Python virtual environments are activated. 361 |provider-python| 362• |:checkhealth| now checks for an available |vim.ui.open()| handler. 363• spellfile.vim : Replaced by |package-spellfile|. 364 365STARTUP 366 367• |v:argf| provides file arguments given at startup. 368• Nvim shows a warning if the log file path is inaccessible. 369 370TERMINAL 371 372• |nvim_open_term()| can be called with a non-empty buffer. The buffer 373 contents are piped to the PTY and displayed as terminal output. 374• CSI 3 J (the sequence to clear terminal scrollback) is now supported. 375• DEC private mode 2026 (synchronized output) is now supported. Applications 376 running in |:terminal| can batch screen updates to avoid tearing. 377• A suspended PTY process is now indicated by "[Process suspended]" at the 378 bottom-left of the buffer and can be resumed by pressing a key. 379• On terminal exit, "[Process exited]" is shown as virtual text (instead of 380 modifying buffer contents), and exit code is shown in statusline. 381 • You can disable "[Process exited]" entirely, see |terminal-config|. 382 383TREESITTER 384 385• |Query:iter_captures()| supports specifying starting and ending columns. 386• |:EditQuery| command gained tab-completion, works with injected languages. 387• |LanguageTree:parse()| now accepts a list of ranges. 388• |v_an| |v_in| |v_]n| |v_[n| incremental selection of treesitter nodes. 389 390TUI 391 392• |TermResponse| now supports DA1 and APC query responses. 393• Native progress bars are displayed for |Progress| events using the OSC 9;4 394 sequence. 395• The TUI now renders the SGR dim (faint), blink, conceal, and overline 396 attributes. 397 398UI 399 400• |ui2| is a redesign of the core messages and commandline UI, which will 401 replace the legacy message grid in the TUI. 402 • Avoids "Press ENTER" interruptions. 403 • Avoids delays from |W10| "Changing a readonly file" and other warnings. 404 • Highlights the cmdline as you type. 405 • Provides the |pager| as a buffer + window. 406 • Currently experimental. To enable it: `require('vim._core.ui2').enable()` 407• |:restart| restarts Nvim and reattaches all UIs. 408• |:connect| dynamically connects the current UI to the server at the given 409 address. 410• |:checkhealth| shows a summary in the header for every healthcheck. 411• |ui-multigrid| provides composition information and absolute coordinates. 412• Error messages are more concise: 413 • "Error detected while processing:" changed to "Error in:". 414 • "Error executing Lua:" changed to "Lua:". 415• 'busy' status is shown in default statusline with symbol ◐ 416• Cursor shape indicates when it is behind an unfocused floating window. 417• Improved LSP signature help rendering. 418• Multigrid UIs can call nvim_input_mouse with grid 0 to let Nvim decide the grid. 419• |vim.ui.progress_status()| returns a status description of currently running 420 |progress-message|s. 421 422VIMSCRIPT 423 424• |chdir()| allows optionally specifying a scope argument. 425• |cmdcomplete_info()| gets current cmdline completion info. 426• |getcompletiontype()| gets command-line completion type for any string. 427• |has()| gained two new system dependent feature flags, |android| and |termux|. 428• |prompt_getinput()| gets current user-input in prompt-buffer. 429• |wildtrigger()| triggers command-line expansion. 430• |v:vim_did_init| is set after sourcing |init.vim| but before |load-plugins|. 431• |prompt_appendbuf()| appends text to prompt-buffer. 432 433============================================================================== 434CHANGED FEATURES 435 436These existing features changed their behavior. 437 438• 'pumblend' does not apply special attributes (bold, underline) from the 439 background layer to the foreground layer. 440• |gv| works in operator pending mode and does not abort. 441• 'smartcase' applies to completion filtering. 442• 'spellfile' location defaults to `stdpath("data").."/site/spell/"` instead of 443 the first writable directory in 'runtimepath'. 444• |vim.version.range()| doesn't exclude `to` if it is equal to `from`. 445• |$VIM| and |$VIMRUNTIME| no longer check for Vim version-specific runtime 446 directory `vim{number}` (e.g. `vim82`). 447• 'scrollback' maximum value increased from 100000 to 1000000 448• |matchfuzzy()| and |matchfuzzypos()| use an improved fuzzy matching algorithm 449 (same as fzy). 450• Windows: Paths like "\Windows" and "/Windows" are now considered to be 451 absolute paths (to the current drive) and no longer relative. 452• When 'shelltemp' is off, shell commands now use `pipe()` and not `socketpair()` 453 for input and output. This matters mostly for Linux where some command lines 454 using "/dev/stdin" and similar would break as these special files can be 455 reopened when backed by pipes but not when backed by socket pairs. 456 457============================================================================== 458REMOVED FEATURES 459 460These deprecated features were removed. 461 462• |vim.treesitter.get_parser()| instead of throwing an error 463 `get_parser()` now always returns nil when it fails to create a parser. 464 465============================================================================== 466DEPRECATIONS 467 468See |deprecated-0.12|. 469 470 vim:tw=78:ts=8:sw=2:et:ft=help:norl: