vim_diff.txt 34 KB

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