vim_diff.txt 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  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. - |-s| reads Normal commands from stdin if the script name is "-".
  357. - Reading text (instead of commands) from stdin |--|:
  358. - works by default: "-" file is optional
  359. - works in more cases: |-Es|, file args
  360. TUI:
  361. *:set-termcap*
  362. - Start Nvim with 'verbose' level 3 to show terminal capabilities: >
  363. nvim -V3
  364. <
  365. *'term'* *E529* *E530* *E531*
  366. - 'term' reflects the terminal type derived from |$TERM| and other environment
  367. checks. For debugging only; not reliable during startup. >vim
  368. :echo &term
  369. - "builtin_x" means one of the |builtin-terms| was chosen, because the expected
  370. terminfo file was not found on the system.
  371. - Nvim will use 256-colour capability on Linux virtual terminals. Vim uses
  372. only 8 colours plus bright foreground on Linux VTs.
  373. - Vim combines what is in its |builtin-terms| with what it reads from terminfo,
  374. and has a 'ttybuiltin' setting to control how that combination works. Nvim
  375. uses one or the other, it does not attempt to merge the two.
  376. UI/Display:
  377. - |Visual| selection highlights the character at cursor. |visual-use|
  378. - messages: When showing messages longer than 'cmdheight', only
  379. scroll the message lines, not the entire screen. The
  380. separator line is decorated by |hl-MsgSeparator| and
  381. the "msgsep" flag of 'fillchars'. *msgsep*
  382. Variables:
  383. - |v:progpath| is always absolute ("full")
  384. - |v:windowid| is always available (for use by external UIs)
  385. - |OptionSet| autocommand args |v:option_new|, |v:option_old|,
  386. - |v:option_oldlocal|, |v:option_oldglobal| have the type of the option
  387. instead of always being strings. |v:option_old| is now the old global value
  388. for all global-local options, instead of just string global-local options.
  389. Vimscript:
  390. - |:redir| nested in |execute()| works.
  391. ==============================================================================
  392. Upstreamed features *nvim-upstreamed*
  393. These Nvim features were later integrated into Vim.
  394. - 'fillchars' flags: "eob"
  395. - 'jumpoptions' "stack" behavior
  396. - 'wildoptions' flags: "pum" enables popupmenu for wildmode completion
  397. - |<Cmd>|
  398. - |WinClosed|
  399. - |WinScrolled|
  400. - |:sign-define| "numhl" argument
  401. - |:source| works with anonymous (no file) scripts
  402. - 'statusline' supports unlimited alignment sections
  403. ==============================================================================
  404. Other changes *nvim-changed*
  405. This section documents various low-level behavior changes.
  406. |mkdir()| behaviour changed:
  407. - 1. Assuming /tmp/foo does not exist and /tmp can be written to
  408. mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and
  409. /tmp/foo/bar with 0700 permissions. Vim mkdir will create /tmp/foo with
  410. 0755.
  411. - 2. If you try to create an existing directory with `'p'` (e.g. mkdir('/',
  412. 'p')) mkdir() will silently exit. In Vim this was an error.
  413. - 3. mkdir() error messages now include strerror() text when mkdir fails.
  414. |string()| and |:echo| behaviour changed:
  415. - 1. No maximum recursion depth limit is applied to nested container
  416. structures.
  417. - 2. |string()| fails immediately on nested containers, not when recursion
  418. limit was exceeded.
  419. - 3. When |:echo| encounters duplicate containers like >vim
  420. let l = []
  421. echo [l, l]
  422. < it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is
  423. only used for recursive containers.
  424. - 4. |:echo| printing nested containers adds "@level" after "..." designating
  425. the level at which recursive container was printed: |:echo-self-refer|.
  426. Same thing applies to |string()| (though it uses construct like
  427. "{E724@level}"), but this is not reliable because |string()| continues to
  428. error out.
  429. - 5. Stringifyed infinite and NaN values now use |str2float()| and can be
  430. evaled back.
  431. - 6. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in
  432. nothing, E908, in Nvim it is internal error.
  433. |json_decode()| behaviour changed:
  434. - 1. It may output |msgpack-special-dict|.
  435. - 2. |msgpack-special-dict| is emitted also in case of duplicate keys, while
  436. in Vim it errors out.
  437. - 3. It accepts only valid JSON. Trailing commas are not accepted.
  438. |json_encode()| behaviour slightly changed: now |msgpack-special-dict| values
  439. are accepted, but |v:none| is not.
  440. Viminfo text files were replaced with binary (messagepack) |shada| files.
  441. Additional differences:
  442. - |shada-c| has no effect.
  443. - |shada-s| now limits size of every item and not just registers.
  444. - 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for
  445. compatibility reasons.
  446. - |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
  447. commands are still kept.
  448. - ShaDa file format was designed with forward and backward compatibility in
  449. mind. |shada-compatibility|
  450. - Some errors make ShaDa code keep temporary file in-place for user to decide
  451. what to do with it. Vim deletes temporary file in these cases.
  452. |shada-error-handling|
  453. - ShaDa file keeps search direction (|v:searchforward|), viminfo does not.
  454. |printf()| returns something meaningful when used with `%p` argument: in Vim
  455. it used to return useless address of the string (strings are copied to the
  456. newly allocated memory all over the place) and fail on types which cannot be
  457. coerced to strings. See |id()| for more details, currently it uses
  458. `printf("%p", {expr})` internally.
  459. |c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>.
  460. |CursorMoved| triggers when moving between windows.
  461. Lua interface (|lua.txt|):
  462. - `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
  463. that prints `a` and `b` on separate lines, exactly like
  464. `:lua print("a\nb")` .
  465. - `:lua error('TEST')` emits the error: >
  466. E5108: Error executing lua: [string "<Vimscript compiled string>"]:1: TEST
  467. < whereas Vim emits only "TEST".
  468. - Lua has direct access to Nvim |API| via `vim.api`.
  469. - Lua package.path and package.cpath are automatically updated according to
  470. 'runtimepath'. |lua-module-load|
  471. Commands:
  472. - |:doautocmd| does not warn about "No matching autocommands".
  473. - |:wincmd| accepts a count.
  474. - `:write!` does not show a prompt if the file was updated externally.
  475. - |:=| does not accept |ex-flags|. With an arg it is equivalent to |:lua=|
  476. Command-line:
  477. - The meanings of arrow keys do not change depending on 'wildoptions'.
  478. Functions:
  479. - |input()| and |inputdialog()| support for each other’s features (return on
  480. cancel and completion respectively) via dictionary argument (replaces all
  481. other arguments if used), and "cancelreturn" can have any type if passed in
  482. a dictionary.
  483. - |input()| and |inputdialog()| support user-defined cmdline highlighting.
  484. Highlight groups:
  485. - |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other
  486. groups
  487. - |hl-CursorLine| is low-priority unless foreground color is set
  488. - |hl-VertSplit| superseded by |hl-WinSeparator|
  489. - Highlight groups names are allowed to contain `@` characters.
  490. - It is an error to define a highlight group with a name that doesn't match
  491. the regexp `[a-zA-Z0-9_.@-]*` (see |group-name|).
  492. - |hl-StatusLineTerm| |hl-StatusLineTermNC| are implemented as 'winhighlight'
  493. window-local highlights which are set by the default |TermOpen| handler.
  494. - The |ins-completion-menu| has cascading highlight styles. |hl-PmenuSel| and
  495. |hl-PmenuMatch| both inherit from |hl-Pmenu|, and |hl-PmenuMatchSel|
  496. inherits highlights from both |hl-PmenuSel| and |hl-PmenuMatch|.
  497. Macro (|recording|) behavior:
  498. - Replay of a macro recorded during :lmap produces the same actions as when it
  499. was recorded. In Vim if a macro is recorded while using :lmap'ped keys then
  500. the behaviour during record and replay differs.
  501. - 'keymap' is implemented via :lmap instead of :lnoremap so that you can use
  502. macros and 'keymap' at the same time. This also means you can use |:imap| on
  503. the results of keys from 'keymap'.
  504. Mappings:
  505. - Creating a mapping for a simplifiable key (e.g. <C-I>) doesn't replace an
  506. existing mapping for its simplified form (e.g. <Tab>).
  507. - "#" followed by a digit doesn't stand for a function key at the start of the
  508. lhs of a mapping.
  509. Motion:
  510. - The |jumplist| avoids useless/phantom jumps.
  511. Syntax highlighting:
  512. - syncolor.vim has been removed. Nvim now sets up default highlighting groups
  513. automatically for both light and dark backgrounds, regardless of whether or
  514. not syntax highlighting is enabled. This means that |:syntax-on| and
  515. |:syntax-enable| are now identical. Users who previously used an
  516. after/syntax/syncolor.vim file should transition that file into a
  517. colorscheme. |:colorscheme|
  518. Vimscript compatibility:
  519. - `count` does not alias to |v:count|
  520. - `errmsg` does not alias to |v:errmsg|
  521. - `shell_error` does not alias to |v:shell_error|
  522. - `this_session` does not alias to |v:this_session|
  523. Working directory (Vim implemented some of these after Nvim):
  524. - |DirChanged| and |DirChangedPre| can be triggered when switching to another
  525. window or tab.
  526. - |getcwd()| and |haslocaldir()| may throw errors if the tab page or window
  527. cannot be found. *E5000* *E5001* *E5002*
  528. - |haslocaldir()| checks for tab-local directory if and only if -1 is passed as
  529. window number, and its only possible returns values are 0 and 1.
  530. - `getcwd(-1)` is equivalent to `getcwd(-1, 0)` instead of returning the global
  531. working directory. Use `getcwd(-1, -1)` to get the global working directory.
  532. Options:
  533. - 'titlestring' uses printf-style '%' items (see: 'statusline') to implement
  534. the default behaviour. The implementation is equivalent to setting
  535. 'titlestring' to `%t%(\ %M%)%(\ \(%{expand(\"%:~:h\")}\)%)%a\ -\ Nvim`.
  536. ==============================================================================
  537. Missing features *nvim-missing*
  538. These legacy Vim features are not yet implemented:
  539. - *:gui*
  540. - *:gvim*
  541. - *'browsedir'* *'bsdir'*
  542. - *'completepopup'*
  543. - *'guioptions'* *'go'*
  544. - *'guitablabel'* *'gtl'*
  545. - *'guitabtooltip'* *'gtt'*
  546. - *'mouseshape'* *'mouses'*
  547. - *'previewpopup'*
  548. ==============================================================================
  549. Removed legacy features *nvim-removed*
  550. These Vim features were intentionally removed from Nvim.
  551. Aliases:
  552. - ex (alias for "nvim -e")
  553. - exim (alias for "nvim -E")
  554. - gex (GUI)
  555. - gview (GUI)
  556. - gvim (GUI)
  557. - gvimdiff (GUI)
  558. - rgview (GUI)
  559. - rgvim (GUI)
  560. - rview
  561. - rvim
  562. - view (alias for "nvim -R")
  563. - vimdiff (alias for "nvim -d" |diff-mode|)
  564. Commands:
  565. - :behave
  566. - :fixdel
  567. - *hardcopy* `:hardcopy` was removed. Instead, use `:TOhtml` and print the
  568. resulting HTML using a web browser or other HTML viewer.
  569. - :helpfind
  570. - :mode (no longer accepts an argument)
  571. - :open
  572. - :Print
  573. - :promptfind
  574. - :promptrepl
  575. - :scriptversion (always version 1)
  576. - :shell
  577. - :smile
  578. - :tearoff
  579. - :cstag
  580. - :cscope
  581. - :lcscope
  582. - :scscope
  583. - :Vimuntar
  584. - `:TOhtml` was replaced by a Lua version (with various differences)
  585. Compile-time features:
  586. - Emacs tags support
  587. - X11 integration (see |x11-selection|)
  588. Cscope:
  589. *cscope*
  590. - Cscope support was removed in favour of plugin-based solutions such as:
  591. https://github.com/dhananjaylatkar/cscope_maps.nvim
  592. Eval:
  593. - *Vim9script* (the Vim 9+ flavor of Vimscript) is not supported.
  594. - *cscope_connection()*
  595. - *err_teapot()*
  596. - *js_encode()*
  597. - *js_decode()*
  598. - *v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
  599. - *v:sizeofint*
  600. - *v:sizeoflong*
  601. - *v:sizeofpointer*
  602. Events:
  603. - *SafeStateAgain*
  604. - *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
  605. Options:
  606. - *'aleph'* *'al'*
  607. - antialias
  608. - 'backspace' no longer supports number values. Instead:
  609. - for `backspace=0` set `backspace=` (empty)
  610. - for `backspace=1` set `backspace=indent,eol`
  611. - for `backspace=2` set `backspace=indent,eol,start` (default behavior in Nvim)
  612. - for `backspace=3` set `backspace=indent,eol,nostop`
  613. - *'balloondelay'* *'bdlay'*
  614. - *'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'*
  615. - *'balloonexpr'* *'bexpr'*
  616. - bioskey (MS-DOS)
  617. - conskey (MS-DOS)
  618. - *'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
  619. - 'cpoptions' (gjpkHw<*- and all POSIX flags were removed)
  620. - *'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation)
  621. - cscopepathcomp
  622. - cscopeprg
  623. - cscopequickfix
  624. - cscoperelative
  625. - cscopetag
  626. - cscopetagorder
  627. - cscopeverbose
  628. - *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
  629. - 'encoding' ("utf-8" is always used)
  630. - esckeys
  631. - 'guioptions' "t" flag was removed
  632. - *'guifontset'* *'gfs'* (Use 'guifont' instead.)
  633. - *'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
  634. - 'highlight' (Names of builtin |highlight-groups| cannot be changed.)
  635. - *'hkmap'* *'hk'* use `set keymap=hebrew` instead.
  636. - *'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
  637. - keyprotocol
  638. - *'pastetoggle'* *'pt'* Just Paste It.™ |paste| is handled automatically when
  639. you paste text using your terminal's or GUI's paste feature (CTRL-SHIFT-v,
  640. CMD-v (macOS), middle-click, …).
  641. - *'imactivatefunc'* *'imaf'*
  642. - *'imactivatekey'* *'imak'*
  643. - *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'*
  644. - *'imdisable'* *'imd'* *'noimdisable'* *'noimd'*
  645. - *'imstatusfunc'* *'imsf'*
  646. - *'insertmode'* *'im'* Use the following script to emulate 'insertmode': >vim
  647. autocmd BufWinEnter * startinsert
  648. inoremap <Esc> <C-X><C-Z><C-]>
  649. inoremap <C-C> <C-X><C-Z>
  650. inoremap <C-L> <C-X><C-Z><C-]><Esc>
  651. inoremap <C-Z> <C-X><C-Z><Cmd>suspend<CR>
  652. noremap <C-C> <Esc>
  653. snoremap <C-C> <Esc>
  654. noremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR>
  655. cnoremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR>
  656. inoremap <C-\><C-G> <C-X><C-Z>
  657. autocmd CmdWinEnter * noremap <buffer> <C-C> <C-C>
  658. autocmd CmdWinEnter * inoremap <buffer> <C-C> <C-C>
  659. lua << EOF
  660. vim.on_key(function(c)
  661. if c == '\27' then
  662. local mode = vim.api.nvim_get_mode().mode
  663. if mode:find('^[nvV\22sS\19]') and vim.fn.getcmdtype() == '' then
  664. vim.schedule(function()
  665. vim.cmd('startinsert')
  666. end)
  667. end
  668. end
  669. end)
  670. EOF
  671. - *'macatsui'*
  672. - *'maxcombine'* *'mco'* : Nvim counts maximum character sizes in bytes, not
  673. codepoints. This is guaranteed to be big enough to always fit all chars
  674. properly displayed in vim with 'maxcombine' set to 6.
  675. - You can still edit text with larger characters than fits in the screen
  676. buffer, you just can't see them. Use |g8| or |ga|. See |mbyte-combining|.
  677. - NOTE: the rexexp engine still has a hard-coded limit of considering
  678. 6 composing chars only.
  679. - *'maxmem'* Nvim delegates memory-management to the OS.
  680. - *'maxmemtot'* Nvim delegates memory-management to the OS.
  681. - *'opendevice'* *'odev'* *'noopendevice'* *'noodev'*
  682. - printoptions
  683. - *'printdevice'*
  684. - *'printencoding'*
  685. - *'printexpr'*
  686. - *'printfont'*
  687. - *'printheader'*
  688. - *'printmbcharset'*
  689. - *'prompt'* *'noprompt'*
  690. - *'remap'* *'noremap'*
  691. - *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
  692. - *'secure'* : Everything is allowed in 'exrc' files, because they must be
  693. explicitly marked as "trusted".
  694. - *'shelltype'*
  695. - 'shortmess' flags: *shm-f* *shm-n* *shm-x* *shm-i* (behave like always on)
  696. - *'shortname'* *'sn'* *'noshortname'* *'nosn'*
  697. - *'swapsync'* *'sws'*
  698. - *'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
  699. - *'terse'* *'noterse'* (Add "s" to 'shortmess' instead)
  700. - textauto
  701. - textmode
  702. - *'toolbar'* *'tb'*
  703. - *'toolbariconsize'* *'tbis'*
  704. - *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
  705. - *'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
  706. - *'ttymouse'* *'ttym'*
  707. - *'ttyscroll'* *'tsl'*
  708. - *'ttytype'* *'tty'*
  709. - weirdinvert
  710. Plugins:
  711. - logiPat
  712. - rrhelper
  713. - *vimball*
  714. - macmap.vim
  715. - tools/check_colors.vim
  716. - macros/{justify,matchit,shellmenu,swapmous}.vim: use `packadd! justify` etc.
  717. directly
  718. Providers:
  719. - *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua".
  720. - *if_mzscheme*
  721. - |if_pyth|: *python-bindeval* *python-Function* are not supported.
  722. - *if_tcl*
  723. Startup:
  724. - `--literal`: File args are always literal; to expand wildcards on Windows,
  725. use |:n| e.g. `nvim +"n *"`
  726. - Easy mode: eview, evim, nvim -y
  727. - Restricted mode: rview, rvim, nvim -Z
  728. - Vi mode: nvim -v
  729. Test functions:
  730. - test_alloc_fail()
  731. - test_autochdir()
  732. - test_disable_char_avail()
  733. - test_feedinput()
  734. - test_garbagecollect_soon
  735. - test_getvalue()
  736. - test_ignore_error()
  737. - test_null_blob()
  738. - test_null_channel()
  739. - test_null_dict()
  740. - test_null_function()
  741. - test_null_job()
  742. - test_null_list()
  743. - test_null_partial()
  744. - test_null_string()
  745. - test_option_not_set()
  746. - test_override()
  747. - test_refcount()
  748. - test_scrollbar()
  749. - test_setmouse()
  750. - test_settime()
  751. - test_srand_seed()
  752. TUI:
  753. *t_xx* *termcap-options* *t_AB* *t_Sb* *t_vb* *t_SI*
  754. - Nvim does not have special `t_XX` options nor <t_XX> keycodes to configure
  755. terminal capabilities. Instead Nvim treats the terminal as any other UI,
  756. e.g. 'guicursor' sets the terminal cursor style if possible.
  757. *termcap*
  758. - Nvim never uses the termcap database, only |terminfo| and |builtin-terms|.
  759. *xterm-8bit* *xterm-8-bit*
  760. - Xterm can be run in a mode where it uses true 8-bit CSI. Supporting this
  761. requires autodetection of whether the terminal is in UTF-8 mode or non-UTF-8
  762. mode, as the 8-bit CSI character has to be written differently in each case.
  763. Vim issues a "request version" sequence to the terminal at startup and looks
  764. at how the terminal is sending CSI. Nvim does not issue such a sequence and
  765. always uses 7-bit control sequences.
  766. ==============================================================================
  767. vim:tw=78:ts=8:sw=2:et:ft=help:norl: