robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1*vim_diff.txt* Nvim 2 3 4 NVIM REFERENCE MANUAL 5 6 7Differences between Nvim and Vim *vim-differences* 8 9Nvim differs from Vim in many ways, although editor and Vimscript (not 10Vim9script) features are mostly identical. This document is a complete and 11centralized reference of the differences. 12 13 Type |gO| to see the table of contents. 14 15============================================================================== 16Configuration *nvim-config* 17 18User configuration and data files are found in standard |base-directories| 19(see also |$NVIM_APPNAME|). Note in particular: 20 21- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for your |config|. 22- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files. 23- Use `$XDG_STATE_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent 24 session information. |shada| 25 26============================================================================== 27Defaults *defaults* *nvim-defaults* 28 29- Filetype detection is enabled by default. This can be disabled by adding 30 ":filetype off" to |init.vim|. 31- Syntax highlighting is enabled by default. This can be disabled by adding 32 ":syntax off" to |init.vim|. 33- Default color scheme has been updated. This can result in color schemes 34 looking differently due to them relying on how highlight groups are defined 35 by default. Add ":colorscheme vim" to |init.vim| or 36 ":source $VIMRUNTIME/colors/vim.lua" to your color scheme file to restore 37 the old default links and colors. See |:highlight| for a list of highlight 38 groups colorschemes should set. 39 40- 'autoindent' is enabled 41- 'autoread' is enabled (works in all UIs, including terminal) 42- 'background' defaults to "dark" (unless set automatically by the terminal/UI) 43- 'backupdir' defaults to .,~/.local/state/nvim/backup// (|xdg|), auto-created 44- 'belloff' defaults to "all" 45- 'comments' includes "fb:•" 46- 'commentstring' defaults to "" 47- 'compatible' is always disabled 48- 'complete' excludes "i" 49- 'completeopt' defaults to "menu,popup" 50- 'define' defaults to "". The C ftplugin sets it to "^\\s*#\\s*define" 51- 'diffopt' includes "linematch:40" 52- 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created 53- 'display' defaults to "lastline" 54- 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding) 55- 'fillchars' defaults (in effect) to "vert:│,fold:·,foldsep:│" 56- 'formatoptions' defaults to "tcqj" 57- 'grepprg' uses the -H and -I flags for regular grep, 58 and defaults to using ripgrep if available 59- 'hidden' is enabled 60- 'history' defaults to 10000 (the maximum) 61- 'hlsearch' is enabled 62- 'include' defaults to "". The C ftplugin sets it to "^\\s*#\\s*include" 63- 'incsearch' is enabled 64- 'isfname' does not include ":" (on Windows). Drive letters are handled 65 correctly without it. (Use |gF| for filepaths suffixed with ":line:col"). 66- 'joinspaces' is disabled 67- 'jumpoptions' defaults to "clean" 68- 'langnoremap' is enabled 69- 'langremap' is disabled 70- 'laststatus' defaults to 2 (statusline is always shown) 71- 'listchars' defaults to "tab:> ,trail:-,nbsp:+" 72- 'maxsearchcount' defaults to 999 73- 'mouse' defaults to "nvi", see |default-mouse| for details 74- 'mousemodel' defaults to "popup_setpos" 75- 'nrformats' defaults to "bin,hex" 76- 'path' defaults to ".,,". The C ftplugin adds "/usr/include" if it exists. 77- 'sessionoptions' includes "unix,slash", excludes "options" 78- 'shelltemp' is disabled 79- 'shortmess' includes "CF", excludes "S" 80- 'sidescroll' defaults to 1 81- 'smarttab' is enabled 82- 'spellfile' defaults to `stdpath("data").."/site/spell/"` 83- 'startofline' is disabled 84- 'switchbuf' defaults to "uselast" 85- 'tabpagemax' defaults to 50 86- 'tags' defaults to "./tags;,tags" 87- 'termguicolors' is enabled by default if Nvim can detect support from the 88 host terminal 89- 'ttimeout' is enabled 90- 'ttimeoutlen' defaults to 50 91- 'ttyfast' is set by default, but it can be unset during startup by setting 92 the environment variable `NVIM_NOTTYFAST` to adjust the startup sequence for 93 slow environments (such as ssh). 94- 'undodir' defaults to ~/.local/state/nvim/undo// (|xdg|), auto-created 95- 'viewoptions' includes "unix,slash", excludes "options" 96- 'viminfo' includes "!" 97- 'wildoptions' defaults to "pum,tagfile" 98 99- |dir| plugin is enabled, so editing a directory shows its contents in a 100 buffer with 'filetype' set to "directory". 101- |editorconfig| plugin is enabled, .editorconfig settings are applied. 102- |man.lua| plugin is enabled, so |:Man| is available by default. 103- |matchit| plugin is enabled. To disable it in your config: >vim 104 :let loaded_matchit = 1 105- |package-spellfile| plugin is enabled, spellfiles are installed by default 106 if missing. 107 108- |g:vimsyn_embed| defaults to "l" to enable Lua highlighting 109 110DEFAULT MOUSE 111 *default-mouse* *disable-mouse* 112By default the mouse is enabled. This means |scroll-mouse-wheel| will scroll 113the window instead of moving the cursor; <LeftMouse> click places the cursor; 114and <RightMouse> click opens the default |popup-menu| with standard actions. 115 116Mouse is NOT enabled in |Cmdline-mode| or the |more-prompt|, so you can 117temporarily disable it just by typing ":". Or if you want to partially or 118fully disable the mouse or popup-menu, do any of the following: 119 120- Disable mouse completely by unsetting the 'mouse' option: >vim 121 set mouse= 122- Change the 'mousemodel', so <RightMouse> extends selection instead of 123 showing the popup-menu: >vim 124 set mousemodel=extend 125- Map <A-LeftMouse> so that it temporarily disables mouse until the cursor 126 moves: >vim 127 nnoremap <A-LeftMouse> <Cmd> 128 \ set mouse=<Bar> 129 \ echo 'mouse OFF until next cursor-move'<Bar> 130 \ autocmd CursorMoved * ++once set mouse&<Bar> 131 \ echo 'mouse ON'<CR> 132< 133To remove the default popup-menu without disabling mouse: >vim 134 aunmenu PopUp 135 autocmd! nvim.popupmenu 136 137To remove only the "How-to disable mouse" menu item (and its separator): >vim 138 aunmenu PopUp.How-to\ disable\ mouse 139 aunmenu PopUp.-2- 140 141DEFAULT MAPPINGS 142 *default-mappings* 143Nvim creates the following default mappings at |startup|. You can disable any 144of these in your config by simply removing the mapping, e.g. ":unmap Y". If 145you never want any default mappings, call |:mapclear| early in your config. 146 147- Y |Y-default| 148- <C-U> |i_CTRL-U-default| 149- <C-W> |i_CTRL-W-default| 150- <C-L> |CTRL-L-default| 151- & |&-default| 152- - |dir-mappings| 153- @ |v_@-default| 154- # |v_#-default| 155- * |v_star-default| 156- gc |gc-default| |v_gc-default| |o_gc-default| 157- gcc |gcc-default| 158- |gO| 159- ]d |]d-default| 160- [d |[d-default| 161- [D |[D-default| 162- ]D |]D-default| 163- <C-W>d |CTRL-W_d-default| 164- |[q| |]q| |[Q| |]Q| |[_CTRL-Q| |]_CTRL-Q| 165- |[l| |]l| |[L| |]L| |[_CTRL-L| |]_CTRL-L| 166- |[t| |]t| |[T| |]T| |[_CTRL-T| |]_CTRL-T| 167- |[a| |]a| |[A| |]A| 168- |[b| |]b| |[B| |]B| 169- |[<Space>| |]<Space>| 170- LSP defaults |lsp-defaults| 171 - K |K-lsp-default| 172 - gr prefix |gr-default| 173 - |gra| |gri| |grn| |grr| |grt| 174 - <C-S> |i_CTRL-S| 175- Treesitter defaults |treesitter-defaults| 176 - |v_an| |v_in| 177 - |v_]n| |v_[n| 178 179DEFAULT AUTOCOMMANDS 180 *default-autocmds* 181Default autocommands exist in the following groups. Use ":autocmd! {group}" to 182remove them and ":autocmd {group}" to see how they're defined. 183 184nvim.terminal: 185- BufReadCmd: Treats "term://" buffers as |terminal| buffers. |terminal-start| 186- TermClose: A |terminal| buffer started with no arguments (which thus uses 187 'shell') and which exits with no error is closed automatically. 188- TermClose: Displays the "[Process exited]" virtual text. 189- TermRequest: The terminal emulator responds to OSC background and foreground 190 requests, indicating (1) a black background and white foreground when Nvim 191 option 'background' is "dark" or (2) a white background and black foreground 192 when 'background' is "light". While this may not reflect the actual 193 foreground/background color, it permits 'background' to be retained for a 194 nested Nvim instance running in the terminal emulator. 195- TermRequest: Nvim will create extmarks for shells which 196 annotate their prompts with OSC 133 escape sequences, enabling users to 197 quickly navigate between prompts using |[[| and |]]|. 198- TermOpen: Sets default options and mappings for |terminal| buffers: 199 - 'nomodifiable' 200 - 'undolevels' set to -1 201 - 'textwidth' set to 0 202 - 'nowrap' 203 - 'nolist' 204 - 'nonumber' 205 - 'norelativenumber' 206 - 'signcolumn' set to "no" 207 - 'foldcolumn' set to "0" 208 - 'winhighlight' uses |hl-StatusLineTerm| and |hl-StatusLineTermNC| in 209 place of |hl-StatusLine| and |hl-StatusLineNC| 210 - |[[| and |]]| to navigate between shell prompts 211 212nvim.cmdwin: 213- |CmdwinEnter|: Limits syntax sync to maxlines=1 in the |cmdwin|. 214 215nvim.swapfile: 216- |SwapExists|: Skips the swapfile prompt (sets |v:swapchoice| to "e") when the 217 swapfile is owned by a running Nvim process. Shows |W325| "Ignoring 218 swapfile…" message. 219 220nvim.exrc: 221- |VimEnter|: Extend 'exrc' to also search for project-local configuration files 222 in all parent directories. 223 224nvim.progress: 225- |Progress|: Display native progress bars in the TUI using the OSC 9;4 escape 226 sequence. 227 228============================================================================== 229New Features *nvim-features* 230 231MAJOR COMPONENTS 232 233- API |API| 234- Command atoms |CmdAtom| 235- Job control |job-control| 236- LSP framework |lsp| 237- Lua scripting |lua| |-l| 238- Multicursor |multicursor| 239- Parsing engine |treesitter| 240- Plugin manager |vim.pack| 241- Providers 242 - Clipboard |provider-clipboard| 243 - Node.js plugins |provider-nodejs| 244 - Python plugins |provider-python| 245 - Ruby plugins |provider-ruby| 246- Remote |--remote-ui| |:connect| |:detach| 247- Remote plugins |remote-plugin| 248- Shared data |shada| 249- Terminal emulator |terminal| 250- UI |ui| |--listen| |--server| 251- Vimscript parser |nvim_parse_expression()| 252- XDG base directories |xdg| 253 254USER EXPERIENCE 255 256Working intuitively and consistently is a major goal of Nvim. 257 258 *feature-compile* 259- Nvim always includes ALL features, in contrast to Vim (which ships various 260 combinations of 100+ optional features). |feature-compile| Think of it as 261 a leaner version of Vim's "HUGE" build. This reduces surface area for bugs, 262 and removes a common source of confusion and friction for users. 263 264- Nvim avoids features that cannot be provided on all platforms; instead that 265 is delegated to external plugins/extensions. E.g. the `-X` platform-specific 266 option is "sometimes" available in Vim (with potential surprises: 267 https://stackoverflow.com/q/14635295). 268 269- Vim's internal test functions (test_autochdir(), test_settime(), etc.) are 270 not exposed (nor implemented); instead Nvim has a robust API. 271 272- Behaviors, options, documentation are removed if they cost users more time 273 than they save. 274 275Usability details have been improved where the benefit outweighs any 276backwards-compatibility cost. Some examples: 277 278- Directories for 'directory' and 'undodir' are auto-created. 279- Terminal features such as 'guicursor' are enabled where possible. 280- Various "nvim" |cli-arguments| were redesigned. 281 282Some features are built in that otherwise required external plugins: 283 284- Highlighting the yanked region, see |vim.hl|. 285 286ARCHITECTURE 287 288The Nvim UI is "decoupled" from the core editor: all UIs, including the 289builtin |TUI| are just plugins that connect to a Nvim server (via |--server| 290or |--embed|). Multiple UI clients can |:connect| to the same editor server. 291 292External plugins run in separate processes. |remote-plugin| This improves 293stability and allows those plugins to work without blocking the editor. Even 294"legacy" Python and Ruby plugins which use the old Vim interfaces (|if_pyth|, 295|if_ruby|) run out-of-process, so they cannot crash Nvim. 296 297Platform and I/O facilities are built upon libuv. Nvim benefits from libuv 298features and bug fixes, and other projects benefit from improvements to libuv 299by Nvim developers. This enables features such as |vim.wait()| and |vim.uv|. 300 301FEATURES 302 303Command-line: 304- The expression prompt (|@=|, |c_CTRL-R_=|, |i_CTRL-R_=|) is highlighted 305 using a built-in Vimscript expression parser. |expr-highlight| 306- *E5408* *E5409* |input()|, |inputdialog()| support custom highlighting. 307 |input()-highlight| 308- (Experimental) *g:Nvim_color_cmdline* Command-line (|:|) is colored by 309 callback defined in `g:Nvim_color_cmdline` (this callback is for testing 310 only, and will be removed in the future). 311- |cmdwin| (|q:|, |q/|, |q?|, |c_CTRL-F|) is a "normal" buffer+window, instead 312 of a nested modal loop. API and Lua callbacks can run while it is open. The 313 |cmdwin-char| is shown via 'statuscolumn'. 314 315Commands: 316- |:bcd| 317- |:checkhealth| 318- |:connect| 319- |:detach| 320- |:diffget|, |:diffput| (|do|, |dp|) can be |.| repeated. 321- |:drop| is always available 322- |:EditQuery| 323- |:Inspect| 324- |:InspectTree| 325- |:log| 326- |:lsp| 327- |:Man| is available by default, with many improvements such as completion 328- |:match| can be invoked before highlight group is defined 329- |:packdel| 330- |:packupdate| 331- |:restart| 332- |:source| works with Lua 333- |:trust| 334- User commands can support |:command-preview| to show results as you type 335- |:write| with "++p" flag creates parent directories. 336- |:update| command writes new file buffers even when unmodified. 337- |:uptime| 338 339Editor: 340- |ins-repeat| replays the full Insert session, including cursor-moves: 341 "iab<Left>c<Esc>." produces "acb", not "c". 342- |visual-repeat| is "semantic" instead of "fixed-size". If you prefer Vim's 343 "fixed-size" Visual-repeat, see |visual-fixed-size|. 344- Interactive |Ex-mode| is implemented as persistent, insert-mode |cmdwin|. 345- |prompt-buffer| supports multiline input/paste, undo/redo, and o/O normal 346 commands. 347- |i_CTRL-R| inserts named/clipboard registers (A-Z,a-z,0-9+) literally, like 348 pasting instead of like user input. Improves performance, avoids broken 349 formatting. To get the old behavior you can use `<C-R>=@x`. 350 351Events (autocommands): 352- Fixed inconsistent behavior in execution of nested autocommands #23368 353- |InsertCharPre| is not triggered for stuffed text (|.| redo, |i_CTRL-R|, 354 |i_CTRL-A|), which also skips mappings and abbreviations. 355- |OptionSet| is triggered for 'modified' when writing a file, undoing changes, 356 or using |:set| modified. 357- |Progress| 358- |RecordingEnter| 359- |RecordingLeave| 360- |SearchWrapped| 361- |Signal| 362- |TabMoved| 363- |TabNewEntered| 364- |TermClose| 365- |TermOpen| 366- |TermRequest| 367- |TermResponse| is fired for DCS, OSC, and APC sequences received from the terminal, 368 in addition to the Primary Device Attributes response. |v:termresponse| 369- |UIEnter| 370- |UILeave| 371 372Functions: 373- |dictwatcheradd()| notifies a callback whenever a |Dict| is modified 374- |dictwatcherdel()| 375- |menu_get()| 376- |msgpackdump()|, |msgpackparse()| provide msgpack de/serialization 377- |stdpath()| 378- |system()|, |systemlist()| can run {cmd} directly (without 'shell') 379- |matchadd()| can be called before highlight group is defined 380- |tempname()| tries to recover if the Nvim |tempdir| disappears. 381- |writefile()| with "p" flag creates parent directories. 382- |prompt_getinput()| 383- |prompt_appendbuf()| 384 385Highlight groups: 386- |highlight-blend| controls blend level for a highlight group 387- |expr-highlight| highlight groups (prefixed with "Nvim") 388- |hl-NormalFloat| highlights floating window 389- |hl-FloatBorder| highlights border of a floating window 390- |hl-FloatTitle| highlights title of a floating window 391- |hl-FloatFooter| highlights footer of a floating window 392- |hl-NormalNC| highlights non-current windows 393- |hl-MsgArea| highlights messages/cmdline area 394- |hl-MsgSeparator| highlights separator for scrolled messages 395- |hl-OkMsg| 396- |hl-StderrMsg| 397- |hl-StdoutMsg| 398- |hl-Substitute| 399- |hl-TermCursor| 400- |hl-WinSeparator| highlights window separators 401- |hl-Whitespace| highlights 'listchars' whitespace 402- |hl-WinBar| highlights 'winbar' 403- |hl-WinBarNC| highlights non-current window 'winbar' 404 405Input/Mappings: 406- ALT (|META|) chords always work (even in the |TUI|). Map |<M-| with any key: 407 <M-1>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, <M-\>, <M-Space>, <M-Enter>, etc. 408 - Case-sensitive: <M-a> and <M-A> are two different keycodes. 409- ALT may behave like <Esc> if not mapped. |i_ALT| |v_ALT| |c_ALT| 410 411Normal commands: 412- |gO| shows a filetype-defined "outline" of the current buffer. 413- |gQ| restores |multicursor|s. 414- |Q| adds a |multicursor| instead of switching to Ex mode. 415- [count]q: enters |Ex-mode|. 416- |ZR| performs |:restart| 417- |v_al| selects the whole buffer; |v_il| selects the current line without 418 leading or trailing white space. 419 420Options: 421 422- `:set {option}<` removes local value for all |global-local| options. 423- `:setlocal {option}<` copies global value to local value for all options. 424- 'ambiwidth' cannot be set to empty. 425- 'autoread' works in the terminal (if it supports "focus" events) 426- 'background' cannot be set to empty. 427- 'completeopt' flag "preselect" selects first completion item that has the 428 "preselect" attribute set. 429- 'cpoptions' flags: |cpo-_| 430- 'eadirection' cannot be set to empty. 431- 'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The 432 user is prompted whether to trust the file. 433- 'fileformat' cannot be set to empty. 434- 'fillchars' flags: "msgsep", "horiz", "horizup", "horizdown", 435 "vertleft", "vertright", "verthoriz" 436- 'foldcolumn' supports up to 9 dynamic/fixed columns 437- 'guicursor' works in the terminal (TUI) 438- 'inccommand' shows interactive results for |:substitute|-like commands 439 and |:command-preview| commands 440- 'jumpoptions' 441 - "view" tries to restore |mark-view| when moving through the |jumplist|, 442 |changelist|, |alternate-file|, and |mark-motions|. 443 - "clean" removes unloaded buffers from the jumplist. 444- 'langmap' supports multibyte chars. 445- 'laststatus' global statusline support 446- 'mousemodel' cannot be set to empty. 447- 'mousescroll' amount to scroll by when scrolling with a mouse 448- 'pumblend' pseudo-transparent popupmenu 449- 'scrollback' 450- 'shortmess' 451 - "F" flag does not affect output from autocommands. 452 - "q" flag fully hides macro recording message. 453- 'showcmdloc' cannot be set to empty. 454- 'signcolumn' can show multiple signs (dynamic or fixed columns) 455- 'statuscolumn' full control of columns using 'statusline' format 456- 'statusline' default is exposed as a statusline expression. 457- 'statusline' and related options apply `%=` and `%<` to item groups. 458- 'splitkeep' cannot be set to empty. 459- 'tabline' middle-click on tabpage label closes tabpage, 460 and %@Func@foo%X can call any function on mouse-click 461- 'termpastefilter' 462- 'ttimeout', 'ttimeoutlen' behavior was simplified 463- 'winblend' pseudo-transparency in floating windows |api-floatwin| 464- 'winhighlight' window-local highlights 465- 'busy' busy status for buffers 466- 'messagesopt' added progress:c to control if progress messages are shown in 467 cmdline 468 469Performance: 470- Signs are implemented using Nvim's internal "marktree" (btree) structure. 471- Folds are not updated during insert-mode. 472 473Providers: 474- If a Python interpreter is available on your `$PATH`, |:python| and 475 |:python3| are always available. See |provider-python|. 476 477Shell: 478- Shell output (|:!|, |:make|, …) is always routed through the UI, so it 479 cannot "mess up" the screen. (You can still use "chansend(v:stderr,…)" if 480 you want to mess up the screen :) 481- Nvim throttles (skips) messages from shell commands (|:!|, |:grep|, |:make|) 482 if there is too much output. No data is lost, this only affects display and 483 improves performance. |:terminal| output is never throttled. 484- |:!| does not support "interactive" commands. Use |:terminal| instead. 485 (GUI Vim has a similar limitation, see ":help gui-pty" in Vim.) 486- :!start is not special-cased on Windows. 487- |system()| does not support writing/reading "backgrounded" commands. |E5677| 488 489Signs: 490- 'signcolumn' can show multiple signs. 491- Signs are removed if the associated line is deleted. 492- Signs placed twice with the same identifier in the same group are moved. 493 494Startup: 495- |-e| and |-es| invoke the same "improved Ex mode" as -E and -Es. 496- |-E| and |-Es| read stdin as text (into buffer 1). 497- |-es| and |-Es| act as a generic "script mode": 498 - Exits automatically, don't need "-c qa!". 499 - Skips swap-file dialog. 500 - Disables swapfile, shada. 501 - Various "POSIX Ex" quirks were dropped. 502- |-l| Executes Lua scripts non-interactively. 503- |-s| reads Normal commands from stdin if the script name is "-". 504- Reading text (instead of commands) from stdin |--|: 505 - works by default: "-" file is optional 506 - works in more cases: |-Es|, file args 507 508TUI: 509 *:set-termcap* 510- Start Nvim with 'verbose' level 3 to show terminal capabilities: > 511 nvim -V3 512< 513 *'term'* *E529* *E530* *E531* 514- 'term' reflects the terminal type derived from |$TERM| and other environment 515 checks. Use `:echo &term` to get its value. For debugging only; not 516 reliable during startup. 517 - Note: If you want to detect when Nvim is running in a terminal, use 518 `has('gui_running')` |has()| or see |nvim_list_uis()| for an example of 519 how to inspect the UI channel. 520- Nvim might optionally be compiled with unibilium, in which case the terminfo 521 database will be used. Otherwise, or if the terminal was not found in 522 the database, a table of builtin terminal definitions will be used. 523- Nvim will use 256-colour capability on Linux virtual terminals. Vim uses 524 only 8 colours plus bright foreground on Linux VTs. 525- Vim combines what is in its |builtin-terms| with what it reads from terminfo, 526 and has a 'ttybuiltin' setting to control how that combination works. Nvim 527 uses one or the other, it does not attempt to merge the two. 528 529UI/Display: 530- messages: When showing messages longer than 'cmdheight', only 531 scroll the message lines, not the entire screen. The 532 separator line is decorated by |hl-MsgSeparator| and 533 the "msgsep" flag of 'fillchars'. *msgsep* 534 535Variables: 536- |v:progpath| is always absolute ("full") 537- |v:windowid| is always available (for use by external UIs) 538- |OptionSet| autocommand args |v:option_new|, |v:option_old|, 539- |v:option_oldlocal|, |v:option_oldglobal| have the type of the option 540 instead of always being strings. |v:option_old| is now the old global value 541 for all global-local options, instead of just string global-local options. 542 543Vimscript: 544- |:redir| nested in |execute()| works. 545 546============================================================================== 547Upstreamed features *nvim-upstreamed* 548 549These Nvim features were later integrated into Vim. 550 551- 'diffopt' "linematch" feature 552- 'fillchars' flags: "eob" 553- 'jumpoptions' "stack" behavior 554- 'wildoptions' flags: "pum" enables popupmenu for wildmode completion 555- |<Cmd>| 556- |WinClosed| 557- |WinScrolled| 558- |:sign-define| "numhl" argument 559- |:source| works with anonymous (no file) scripts 560- 'statusline' supports unlimited alignment sections 561- |vim-tutor-mode| 562- Lua: `require()` also searches for modules in 'runtimepath'. 563- Lua: vim.g, vim.w, vim.b, vim.t, vim.v, vim.fn, vim.call() 564- |Visual| selection highlights the character at cursor. |visual-use| 565 566============================================================================== 567Other changes *nvim-changed* 568 569This section documents various low-level behavior changes. 570 571|mkdir()| behaviour changed: 572- 1. Assuming /tmp/foo does not exist and /tmp can be written to 573 mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and 574 /tmp/foo/bar with 0700 permissions. Vim mkdir will create /tmp/foo with 575 0755. 576- 2. If you try to create an existing directory with `'p'` (e.g. mkdir('/', 577 'p')) mkdir() will silently exit. In Vim this was an error. 578- 3. mkdir() error messages now include strerror() text when mkdir fails. 579 580|string()| and |:echo| behaviour changed: 581- 1. No maximum recursion depth limit is applied to nested container 582 structures. 583- 2. |string()| fails immediately on nested containers, not when recursion 584 limit was exceeded. 585- 3. When |:echo| encounters duplicate containers like >vim 586 let l = [] 587 echo [l, l] 588< it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is 589 only used for recursive containers. 590- 4. |:echo| printing nested containers adds "@level" after "..." designating 591 the level at which recursive container was printed: |:echo-self-refer|. 592 Same thing applies to |string()| (though it uses construct like 593 "{E724@level}"), but this is not reliable because |string()| continues to 594 error out. 595- 5. Stringifyed infinite and NaN values now use |str2float()| and can be 596 evaled back. 597- 6. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in 598 nothing, E908, in Nvim it is internal error. 599 600|json_decode()| behaviour changed: 601- 1. It may output |msgpack-special-dict|. 602- 2. |msgpack-special-dict| is emitted also in case of duplicate keys, while 603 in Vim it errors out. 604- 3. It accepts only valid JSON. Trailing commas are not accepted. 605 606|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values 607are accepted, but |v:none| is not. 608 609Viminfo text files were replaced with binary (messagepack) |shada| files. 610Additional differences: 611 612- |shada-c| has no effect. 613- |shada-s| now limits size of every item and not just registers. 614- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for 615 compatibility reasons. 616- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old 617 commands are still kept. 618- ShaDa file format was designed with forward and backward compatibility in 619 mind. |shada-compatibility| 620- Some errors make ShaDa code keep temporary file in-place for user to decide 621 what to do with it. Vim deletes temporary file in these cases. 622 |shada-error-handling| 623- ShaDa file keeps search direction (|v:searchforward|), viminfo does not. 624 625|printf()| returns something meaningful when used with `%p` argument: in Vim 626it used to return useless address of the string (strings are copied to the 627newly allocated memory all over the place) and fail on types which cannot be 628coerced to strings. See |id()| for more details, currently it uses 629`printf("%p", {expr})` internally. 630 631|c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>. 632 633|CursorMoved| triggers when moving between windows. 634 635Lua interface (|lua.txt|): 636- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim 637 that prints `a` and `b` on separate lines, exactly like 638 `:lua print("a\nb")` . 639- `:lua error('TEST')` emits the error: > 640 E5108: Lua: [string "<Vimscript compiled string>"]:1: TEST 641< whereas Vim emits only "TEST". 642- Lua has direct access to Nvim |API| via `vim.api`. 643 644Commands: 645- |:doautocmd| does not warn about "No matching autocommands". 646- |:wincmd| accepts a count. 647- `:write!` does not show a prompt if the file was updated externally. 648- |:=| does not accept |ex-flags|. With an arg it is equivalent to |:lua=| 649 650Command-line: 651- The meanings of arrow keys do not change depending on 'wildoptions'. 652 653Functions: 654- |input()| and |inputdialog()| support for each other’s features (return on 655 cancel and completion respectively) via dictionary argument (replaces all 656 other arguments if used), and "cancelreturn" can have any type if passed in 657 a dictionary. 658- |input()| and |inputdialog()| support user-defined cmdline highlighting. 659 660Highlight groups: 661- |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other 662 groups 663- |hl-CursorLine| is low-priority unless foreground color is set 664- |hl-VertSplit| superseded by |hl-WinSeparator| 665- Highlight groups names are allowed to contain `@` characters. 666 - It is an error to define a highlight group with a name that doesn't match 667 the regexp `[a-zA-Z0-9_.@-]*` (see |group-name|). 668- |hl-StatusLineTerm| |hl-StatusLineTermNC| are implemented as 'winhighlight' 669 window-local highlights which are set by the default |TermOpen| handler. 670- The |ins-completion-menu| has cascading highlight styles. |hl-PmenuSel| and 671 |hl-PmenuMatch| both inherit from |hl-Pmenu|, and |hl-PmenuMatchSel| 672 inherits highlights from both |hl-PmenuSel| and |hl-PmenuMatch|. 673 674Macro (|recording|) behavior: 675- Replay of a macro recorded during :lmap produces the same actions as when it 676 was recorded. In Vim if a macro is recorded while using :lmap'ped keys then 677 the behaviour during record and replay differs. 678- 'keymap' is implemented via :lmap instead of :lnoremap so that you can use 679 macros and 'keymap' at the same time. This also means you can use |:imap| on 680 the results of keys from 'keymap'. 681 682Mappings: 683- Creating a mapping for a simplifiable key (e.g. <C-I>) doesn't replace an 684 existing mapping for its simplified form (e.g. <Tab>). 685- "#" followed by a digit doesn't stand for a function key at the start of the 686 lhs of a mapping. 687 688Marks: 689- |undo| does not restore a mark that you moved (|m|, |:mark|) after the change 690 being undone; the mark shifts with the text it was moved to, the same as a 691 mark the change never touched. Vim restores its old (wrong) position. Marks 692 moved by the change itself are still restored. 693- An operator on a target that creates a Visual selection ("cgn") does not 694 change |'<| |'>|. |gv| 695 696Motion: 697- The |jumplist| avoids useless/phantom jumps. 698 699Syntax highlighting: 700- syncolor.vim has been removed. Nvim now sets up default highlighting groups 701 automatically for both light and dark backgrounds, regardless of whether or 702 not syntax highlighting is enabled. This means that |:syntax-on| and 703 |:syntax-enable| are now identical. Users who previously used an 704 after/syntax/syncolor.vim file should transition that file into a 705 colorscheme. |:colorscheme| 706 707Vimscript compatibility: 708- `count` does not alias to |v:count| 709- `errmsg` does not alias to |v:errmsg| 710- `shell_error` does not alias to |v:shell_error| 711- `this_session` does not alias to |v:this_session| 712 713Working directory (Vim implemented some of these after Nvim): 714- |DirChanged| and |DirChangedPre| can be triggered when switching to another 715 window or tab. 716- |getcwd()| and |haslocaldir()| may throw errors if the tabpage, window, or 717 buffer cannot be found. 718- |haslocaldir()| checks for tab-local directory if and only if -1 is passed as 719 window number, and its only possible returns values are 0 and 1. 720- `getcwd(-1)` is equivalent to `getcwd(-1, 0)` instead of returning the global 721 working directory. Use `getcwd(-1, -1)` to get the global working directory. 722 723Options: 724- 'titlestring' uses printf-style '%' items (see: 'statusline') to implement 725 the default behaviour. The implementation is equivalent to setting 726 'titlestring' to `%t%(\ %M%)%(\ \(%{expand(\"%:~:h\")}\)%)%a\ -\ Nvim`. 727 728|packages|: 729- "start" packages are not explicitly reported in 'runtimepath' (though they 730 are still searched for runtime files). See |runtime-search-path| 731 732============================================================================== 733Missing features *nvim-missing* 734 735These legacy Vim features are not yet implemented: 736 737- *:gui* 738- *'browsedir'* *'bsdir'* 739- *'completepopup'* 740- *'guioptions'* *'go'* 741- *'guitablabel'* *'gtl'* 742- *'guitabtooltip'* *'gtt'* 743- *'mouseshape'* *'mouses'* 744 745============================================================================== 746Removed legacy features *nvim-removed* 747 748These Vim features were intentionally removed from Nvim. 749 750Aliases: 751- ex (alias for "nvim -e") 752- exim (alias for "nvim -E") 753- gex (GUI) 754- gview (GUI) 755- gvim (GUI) 756- gvimdiff (GUI) 757- rgview (GUI) 758- rgvim (GUI) 759- rview 760- rvim 761- view (alias for "nvim -R") 762- vimdiff (alias for "nvim -d" |diff-mode|) 763 764Commands: 765- :behave 766- :fixdel 767- *:gvim* 768- *hardcopy* `:hardcopy` was removed. Instead, use `:TOhtml` and print the 769 resulting HTML using a web browser or other HTML viewer. 770- :helpfind 771- :mode (no longer accepts an argument) 772- :open 773- :Print 774- :promptfind 775- :promptrepl 776- :scriptversion (always version 1) 777- :shell 778- :smile 779- :tearoff 780- :cstag 781- :cscope 782- :lcscope 783- :scscope 784- :Vimuntar 785- `:TOhtml` was replaced by a Lua version (with various differences) 786 787Compile-time features: 788- Emacs tags support 789- X11 integration (see |x11-selection|) 790 791Editor: 792- |c_CTRL-F| cannot enter |cmdwin| from the |expr-register| prompt. 793- *cscope* support was removed in favour of plugin-based solutions such as: 794 https://github.com/dhananjaylatkar/cscope_maps.nvim 795- *popup-window* : Use |floating-windows| instead. 796- *spellfile.vim* : Replaced by |package-spellfile|. 797- *textprop* : Use |extmarks| instead. 798 799Eval: 800- *Vim9script* (the Vim 9+ flavor of Vimscript) is not supported. 801- *cscope_connection()* 802- *err_teapot()* 803- *js_encode()* 804- *js_decode()* 805- *listener_add()* , etc: use |api-buffer-updates-lua| instead. 806- *redraw_listener_add()* , etc: use |nvim_set_decoration_provider()| instead. 807- *v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead. 808- *v:sizeofint* 809- *v:sizeoflong* 810- *v:sizeofpointer* 811 812Events: 813- SafeStateAgain 814- *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead. 815 816Options: 817- *'aleph'* *'al'* 818- antialias 819- 'backspace' no longer supports number values. Instead: 820 - for `backspace=0` set `backspace=` (empty) 821 - for `backspace=1` set `backspace=indent,eol` 822 - for `backspace=2` set `backspace=indent,eol,start` (default behavior in Nvim) 823 - for `backspace=3` set `backspace=indent,eol,nostop` 824- *'balloondelay'* *'bdlay'* 825- *'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'* 826- *'balloonexpr'* *'bexpr'* 827- bioskey (MS-DOS) 828- conskey (MS-DOS) 829- *'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".) 830- 'cpoptions' (gjpkHw<*- and all POSIX flags were removed) 831- *'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation) 832- cscopepathcomp 833- cscopeprg 834- cscopequickfix 835- cscoperelative 836- cscopetag 837- cscopetagorder 838- cscopeverbose 839- *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'* 840- 'encoding' ("utf-8" is always used) 841- esckeys 842- 'guioptions' "t" flag was removed 843- *'guifontset'* *'gfs'* (Use 'guifont' instead.) 844- *'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.) 845- 'highlight' (Names of builtin |highlight-groups| cannot be changed.) 846- *'hkmap'* *'hk'* use `set keymap=hebrew` instead. 847- *'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead. 848- keyprotocol 849- *'pastetoggle'* *'pt'* Just Paste It.™ |paste| is handled automatically when 850 you paste text using your terminal's or GUI's paste feature (CTRL-SHIFT-v, 851 CMD-v (macOS), middle-click, …). 852- *'imactivatefunc'* *'imaf'* 853- *'imactivatekey'* *'imak'* 854- *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'* 855- *'imdisable'* *'imd'* *'noimdisable'* *'noimd'* 856- *'imstatusfunc'* *'imsf'* 857- *'insertmode'* *'im'* Use the following script to emulate 'insertmode': >vim 858 autocmd BufWinEnter * startinsert 859 inoremap <Esc> <C-X><C-Z><C-]> 860 inoremap <C-C> <C-X><C-Z> 861 inoremap <C-L> <C-X><C-Z><C-]><Esc> 862 inoremap <C-Z> <C-X><C-Z><Cmd>suspend<CR> 863 noremap <C-C> <Esc> 864 snoremap <C-C> <Esc> 865 noremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR> 866 cnoremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR> 867 inoremap <C-\><C-G> <C-X><C-Z> 868 autocmd CmdwinEnter * noremap <buffer> <C-C> <C-C> 869 autocmd CmdwinEnter * inoremap <buffer> <C-C> <C-C> 870 871 lua << EOF 872 vim.on_key(function(c) 873 if c == '\27' then 874 local mode = vim.api.nvim_get_mode().mode 875 if mode:find('^[nvV\22sS\19]') and vim.fn.getcmdtype() == '' then 876 vim.schedule(function() 877 vim.cmd('startinsert') 878 end) 879 end 880 end 881 end) 882 EOF 883- *'macatsui'* 884- *'maxcombine'* *'mco'* : Nvim counts maximum character sizes in bytes, not 885 codepoints. This is guaranteed to be big enough to always fit all chars 886 properly displayed in vim with 'maxcombine' set to 6. 887 - You can still edit text with larger characters than fits in the screen 888 buffer, you just can't see them. Use |g8| or |ga|. See |mbyte-combining|. 889 - NOTE: the rexexp engine still has a hard-coded limit of considering 890 6 composing chars only. 891- *'maxmem'* Nvim delegates memory-management to the OS. 892- *'maxmemtot'* Nvim delegates memory-management to the OS. 893- *'opendevice'* *'odev'* *'noopendevice'* *'noodev'* 894- printoptions 895- *'printdevice'* 896- *'printencoding'* 897- *'printexpr'* 898- *'printfont'* 899- *'printheader'* 900- *'printmbcharset'* 901- *'prompt'* *'noprompt'* 902- *'remap'* *'noremap'* 903- *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'* 904- *'secure'* : Everything is allowed in 'exrc' files, because they must be 905 explicitly marked as "trusted". 906- *'shelltype'* 907- 'shortmess' flags: *shm-f* *shm-n* *shm-x* *shm-i* (behave like always on) 908- *'shortname'* *'sn'* *'noshortname'* *'nosn'* 909- *'swapsync'* *'sws'* 910- *'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows) 911- *'terse'* *'noterse'* (Add "s" to 'shortmess' instead) 912- textauto 913- textmode 914- *'toolbar'* *'tb'* 915- *'toolbariconsize'* *'tbis'* 916- *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'* 917- *'ttymouse'* *'ttym'* 918- *'ttyscroll'* *'tsl'* 919- *'ttytype'* *'tty'* 920- weirdinvert 921 922Plugins: 923- logiPat 924- rrhelper 925- *vimball* 926- shellmenu 927- macmap.vim 928- tools/check_colors.vim 929- macros/{justify,matchit,swapmous}.vim: use `packadd! justify` etc. 930 directly 931- HelpToc: Use |gO| instead. 932 933Providers: 934- *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua". 935- *if_mzscheme* 936- |if_pyth|: *python-bindeval* *python-Function* are not supported. 937- *if_tcl* 938 939Startup: 940- `--literal`: File args are always literal; to expand wildcards on Windows, 941 use |:n| e.g. `nvim +"n *"` 942- *--serverlist* Use instead: `nvim -es -V1 +'echo serverlist()'` 943- *--servername* Use instead: |--server| or |:connect|. 944- Easy mode: eview, evim, nvim -y 945- Restricted mode: rview, rvim, nvim -Z 946- Vi mode: nvim -v 947 948Test functions: 949- test_alloc_fail() 950- test_autochdir() 951- test_feedinput() 952- test_garbagecollect_soon() 953- test_getvalue() 954- test_ignore_error() 955- test_null_blob() 956- test_null_channel() 957- test_null_dict() 958- test_null_function() 959- test_null_job() 960- test_null_list() 961- test_null_partial() 962- test_null_string() 963- test_option_not_set() 964- test_override() 965- test_refcount() 966- test_scrollbar() 967- test_setmouse() 968- test_settime() 969- test_srand_seed() 970- test_unknown() 971- test_void() 972 973TUI: 974 *t_xx* *termcap-options* *t_AB* *t_Sb* *t_vb* *t_SI* 975- Nvim does not have special `t_XX` options nor <t_XX> keycodes to configure 976 terminal capabilities. Instead Nvim treats the terminal as any other UI, 977 e.g. 'guicursor' sets the terminal cursor style if possible. You can use 978 |$NVIM_TERMDEFS| if you still need to override the builtin definitions. 979 980 *termcap* 981- Nvim never uses the termcap database, only |terminfo| and |builtin-terms|. 982 983 *xterm-8bit* *xterm-8-bit* 984- Xterm can be run in a mode where it uses true 8-bit CSI. Supporting this 985 requires autodetection of whether the terminal is in UTF-8 mode or non-UTF-8 986 mode, as the 8-bit CSI character has to be written differently in each case. 987 Vim issues a "request version" sequence to the terminal at startup and looks 988 at how the terminal is sending CSI. Nvim does not issue such a sequence and 989 always uses 7-bit control sequences. 990 991 vim:tw=78:ts=8:sw=2:et:ft=help:norl: