neovim/runtime/doc/vim_diff.txt

403 lines
14 KiB
Plaintext
Raw Normal View History

*vim_diff.txt* Nvim
NVIM REFERENCE MANUAL
Differences between Nvim and Vim *vim-differences*
Throughout the help files, differences between Nvim and Vim are indicated via
the "{Nvim}" tag. This document is a complete and centralized list of all
these differences.
Type <M-]> to see the table of contents.
==============================================================================
1. Configuration *nvim-configuration*
2016-04-07 18:36:14 -07:00
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for storing
configuration.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
2016-04-07 18:36:14 -07:00
- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
session information.
==============================================================================
2. Defaults *nvim-defaults*
- Syntax highlighting is enabled by default
2016-04-10 22:59:32 -07:00
- ":filetype plugin indent on" is enabled by default
- 'autoindent' is set by default
- 'autoread' is set by default
- 'backspace' defaults to "indent,eol,start"
2016-10-06 00:45:24 -07:00
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
- 'belloff' defaults to "all"
- 'complete' doesn't include "i"
2016-10-06 00:45:24 -07:00
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline"
- 'formatoptions' defaults to "tcqj"
- 'history' defaults to 10000 (the maximum)
- 'hlsearch' is set by default
- 'incsearch' is set by default
- 'langnoremap' is enabled by default
- 'langremap' is disabled by default
2015-06-20 14:45:03 -07:00
- 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'nocompatible' is always set
2016-02-15 11:55:51 -07:00
- 'nrformats' defaults to "bin,hex"
- 'ruler' is set by default
- 'sessionoptions' doesn't include "options"
- 'showcmd' is set by default
- 'smarttab' is set by default
- 'tabpagemax' defaults to 50
- 'tags' defaults to "./tags;,tags"
- 'ttyfast' is always set
2016-10-06 00:45:24 -07:00
- 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created
- 'viminfo' includes "!"
- 'wildmenu' is set by default
==============================================================================
2016-06-15 18:33:47 -07:00
3. New Features *nvim-features*
MAJOR COMPONENTS ~
2016-06-15 18:33:47 -07:00
Embedded terminal emulator |terminal-emulator|
RPC API |RPC|
2016-08-09 21:47:04 -07:00
Shared data |shada|
XDG base directories |xdg|
2016-06-15 18:33:47 -07:00
Job control |job-control|
Remote plugins |remote-plugin|
Python plugins |provider-python|
Clipboard integration |provider-clipboard|
2016-10-15 18:54:22 -07:00
USER EXPERIENCE ~
Working intuitively and consistently is a major goal of Nvim. Examples:
2016-10-15 18:54:22 -07:00
- Nvim does not have `-X`, a platform-specific option "sometimes" available in
Vim (with potential surprises: http://stackoverflow.com/q/14635295). Nvim
avoids features that cannot be provided on all platforms--instead that is
delegated to external plugins/extensions.
2017-07-28 15:28:41 -07:00
- Vim's internal test functions (test_autochdir(), test_settime(), etc.) are
not exposed (nor implemented); instead Nvim has a robust API.
2016-10-15 18:54:22 -07:00
ARCHITECTURE ~
2016-06-15 18:33:47 -07:00
External plugins run in separate processes. |remote-plugin| This improves
2017-05-20 14:49:46 -07:00
stability and allows those plugins to work without blocking the editor. Even
"legacy" Python and Ruby plugins which use the old Vim interfaces (|if_py| and
|if_ruby|) run out-of-process.
2017-07-28 15:28:41 -07:00
Platform and I/O facilities are built upon libuv. Nvim benefits from libuv
features and bug fixes, and other projects benefit from improvements to libuv
by Nvim developers.
FEATURES ~
2016-06-15 18:33:47 -07:00
"Outline": Type <M-]> in |:Man| and |:help| pages to see a document outline.
2016-06-15 18:33:47 -07:00
|META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping
will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>,
<M-\>, <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
META chords are case-sensitive: <M-a> and <M-A> are two different keycodes.
2016-06-15 18:33:47 -07:00
Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
(even in the terminal). Specifically, the following are known to work:
<C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter>
2016-06-15 18:33:47 -07:00
Options:
'cpoptions' flags: |cpo-_|
'guicursor' works in the terminal
'inccommand' shows interactive results for |:substitute|-like commands
'scrollback'
2016-06-15 18:33:47 -07:00
'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click
'winhighlight' window-local highlights
Variables:
2016-10-27 20:07:51 -07:00
|v:event|
2017-03-13 06:07:55 -07:00
|v:exiting|
|v:progpath| is always absolute ("full")
|v:windowid| is always available (for use by external UIs)
2016-06-15 18:33:47 -07:00
Commands:
|:CheckHealth|
|:drop| is available on all platforms
|:Man| is available by default, with many improvements such as completion
2016-06-15 18:33:47 -07:00
2016-06-26 15:26:10 -07:00
Functions:
|dictwatcheradd()| notifies a callback whenever a |Dict| is modified
|dictwatcherdel()|
|execute()| works with |:redir|
2017-07-27 17:31:03 -07:00
|menu_get()|
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
2016-06-26 15:26:10 -07:00
2016-06-15 18:33:47 -07:00
Events:
2017-01-13 03:03:43 -07:00
|DirChanged|
2016-06-15 18:33:47 -07:00
|TabNewEntered|
|TermClose|
|TermOpen|
|TextYankPost|
2016-06-15 18:33:47 -07:00
Highlight groups:
|hl-QuickFixLine|
|hl-Substitute|
2016-06-15 18:33:47 -07:00
|hl-TermCursor|
|hl-TermCursorNC|
|hl-Whitespace| highlights 'listchars' whitespace
2016-06-15 18:33:47 -07:00
==============================================================================
4. Changed features *nvim-features-changed*
Nvim always builds with all features, in contrast to Vim which may have
certain features removed/added at compile-time. This is like if Vim's "HUGE"
build was the only Vim release type (except Nvim is smaller than Vim's "HUGE"
build).
If a Python interpreter is available on your `$PATH`, |:python| and |:python3|
are always available and may be used simultaneously in separate plugins. The
`neovim` pip package must be installed to use Python plugins in Nvim (see
|provider-python|).
Because of general |256-color| usage whereever possible, Nvim will even use
256-colour capability on Linux virtual terminals. Vim uses only 8 colours
plus bright foreground on Linux VTs.
Vim combines what is in its |builtin-terms| with what it reads from termcap,
and has a |ttybuiltin| setting to control how that combination works. Nvim
uses either one or the other of an external |terminfo| entry or the built-in
one. It does not attempt to mix data from the two.
|:!| does not support "interactive" commands. Use |:terminal| instead.
(GUI Vim has a similar limitation, see ":help gui-pty" in Vim.)
|system()| does not support writing/reading "backgrounded" commands. |E5677|
2016-06-26 15:26:10 -07:00
Nvim may throttle (skip) messages from shell commands (|:!|, |:grep|, |:make|)
if there is too much output. No data is lost, this only affects display and
makes things faster. |:terminal| output is never throttled.
2015-07-18 02:23:42 -07:00
|mkdir()| behaviour changed:
2016-04-07 18:36:14 -07:00
1. Assuming /tmp/foo does not exist and /tmp can be written to
2015-07-18 02:23:42 -07:00
mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and /tmp/foo/bar
with 0700 permissions. Vim mkdir will create /tmp/foo with 0755.
2016-04-07 18:36:14 -07:00
2. If you try to create an existing directory with `'p'` (e.g. mkdir('/',
2015-07-18 02:23:42 -07:00
'p')) mkdir() will silently exit. In Vim this was an error.
3. mkdir() error messages now include strerror() text when mkdir fails.
2016-01-27 04:20:44 -07:00
'encoding' is always "utf-8".
|string()| and |:echo| behaviour changed:
2016-04-07 18:36:14 -07:00
1. No maximum recursion depth limit is applied to nested container
structures.
2016-04-07 18:36:14 -07:00
2. |string()| fails immediately on nested containers, not when recursion limit
was exceeded.
2. When |:echo| encounters duplicate containers like >
let l = []
echo [l, l]
<
2016-04-07 18:36:14 -07:00
it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is
only used for recursive containers.
2016-04-07 18:36:14 -07:00
3. |:echo| printing nested containers adds "@level" after "..." designating
the level at which recursive container was printed: |:echo-self-refer|.
Same thing applies to |string()| (though it uses construct like
"{E724@level}"), but this is not reliable because |string()| continues to
error out.
2016-04-07 18:36:14 -07:00
4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled
back.
5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in
nothing, |E908|, in Neovim it is internal error.
2016-02-13 11:39:28 -07:00
|json_decode()| behaviour changed:
2016-02-01 11:22:07 -07:00
1. It may output |msgpack-special-dict|.
2016-02-13 11:39:28 -07:00
2. |msgpack-special-dict| is emitted also in case of duplicate keys, while in
Vim it errors out.
3. It accepts only valid JSON. Trailing commas are not accepted.
2016-02-01 11:22:07 -07:00
2016-02-13 11:39:28 -07:00
|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values
are accepted, but |v:none| is not.
*v:none* variable is absent. In Vim it represents “no value” in “js” strings
like "[,]" parsed as "[v:none]" by |js_decode()|.
*js_encode()* and *js_decode()* functions are also absent.
2016-04-07 18:36:14 -07:00
Viminfo text files were replaced with binary (messagepack) ShaDa files.
2015-07-05 04:08:50 -07:00
Additional differences:
- |shada-c| has no effect.
- |shada-s| now limits size of every item and not just registers.
2016-04-07 18:36:14 -07:00
- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for
compatibility reasons.
2016-04-07 18:36:14 -07:00
- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
commands are still kept.
2016-04-07 18:36:14 -07:00
- ShaDa file format was designed with forward and backward compatibility in
mind. |shada-compatibility|
2016-04-07 18:36:14 -07:00
- Some errors make ShaDa code keep temporary file in-place for user to decide
what to do with it. Vim deletes temporary file in these cases.
|shada-error-handling|
- ShaDa file keeps search direction (|v:searchforward|), viminfo does not.
2015-07-05 04:08:50 -07:00
|printf()| returns something meaningful when used with `%p` argument: in Vim
it used to return useless address of the string (strings are copied to the
newly allocated memory all over the place) and fail on types which cannot be
coerced to strings. See |id()| for more details, currently it uses
`printf("%p", {expr})` internally.
|c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>.
2017-01-29 12:07:24 -07:00
Lua interface (|if_lua.txt|):
- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
that prints `a` and `b` on separate lines, exactly like
`:lua print("a\nb")` .
- `:lua error('TEST')` will print “TEST” as the error in Vim and “E5105: Error
while calling lua chunk: [string "<VimL compiled string>"]:1: TEST” in
Neovim.
2017-05-11 08:45:11 -07:00
- Lua has direct access to Nvim |API| via `vim.api`.
- Lua package.path and package.cpath are automatically updated according to
'runtimepath': |lua-require|.
2017-05-11 08:45:11 -07:00
- Currently, most legacy Vim features are missing.
2017-01-29 12:07:24 -07:00
2017-05-13 08:16:41 -07:00
|input()| and |inputdialog()| gained support for each others features (return
on cancel and completion respectively) via dictionary argument (replaces all
other arguments if used).
==============================================================================
5. Missing legacy features *nvim-features-missing*
2017-05-11 08:45:11 -07:00
Some legacy Vim features are not implemented:
- |if_py|: vim.bindeval() and vim.Function() are not supported
2017-05-11 08:45:11 -07:00
- |if_lua|: the `vim` object currently only supports `vim.api`
- *if_perl*
- *if_mzscheme*
- *if_tcl*
==============================================================================
6. Removed features *nvim-features-removed*
These features are in Vim, but have been intentionally removed from Nvim.
*'cp'* *'nocompatible'* *'nocp'* *'compatible'*
Nvim is always "non-compatible" with Vi.
":set nocompatible" is ignored
":set compatible" is an error
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
Ed-compatible mode:
":set noedcompatible" is ignored
":set edcompatible" is an error
*t_xx* *:set-termcap* *termcap-options* *t_AB* *t_Sb* *t_vb* *t_SI*
Nvim does not have special `t_XX` options nor <t_XX> keycodes to configure
terminal capabilities. Instead Nvim treats the terminal as any other UI. For
example, 'guicursor' sets the terminal cursor style if possible.
*'term'* *E529* *E530* *E531*
The 'term' option has a fixed value, present only for script compatibility and
intentionally not the same as any known terminal type name. It should be a
rare case in Nvim where one needs |term-dependent-settings|, for which use the
|TERM| environment variable.
*termcap*
Nvim never uses the termcap database and only uses |terminfo|. See
|builtin-terms| for what happens on operating systems without a terminfo
database.
*xterm-8bit* *xterm-8-bit*
Xterm can be run in a mode where it uses true 8-bit CSI. Supporting this
requires autodetection of whether the terminal is in UTF-8 mode or non-UTF-8
mode, as the 8-bit CSI character has to be written differently in each case.
Vim issues a "request version" sequence to the terminal at startup and looks
at how the terminal is sending CSI. Nvim does not issue such a sequence and
always uses 7-bit control sequences.
'ttyfast':
":set ttyfast" is ignored
":set nottyfast" is an error
Encryption support:
*'cryptmethod'* *'cm'*
*'key'*
MS-DOS support:
'bioskey'
'conskey'
Test functions:
test_alloc_fail()
test_autochdir()
test_disable_char_avail()
test_garbagecollect_now()
test_null_channel()
test_null_dict()
test_null_job()
test_null_list()
test_null_partial()
test_null_string()
test_settime()
Other options:
'antialias'
'cpoptions' (g j k H w < * - and all POSIX flags were removed)
2016-01-27 04:20:44 -07:00
'encoding' ("utf-8" is always used)
'esckeys'
'guioptions' "t" flag was removed
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
'highlight' (the builtin |highlight-groups| cannot be changed)
*'imactivatefunc'* *'imaf'*
*'imactivatekey'* *'imak'*
*'imstatusfunc'* *'imsf'*
*'macatsui'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'shelltype'
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
*'swapsync'* *'sws'*
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
'textauto'
'textmode'
*'toolbar'* *'tb'*
*'toolbariconsize'* *'tbis'*
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
*'ttymouse'* *'ttym'*
*'ttyscroll'* *'tsl'*
*'ttytype'* *'tty'*
'weirdinvert'
Other commands:
:Print
:fixdel
:helpfind
:mode (no longer accepts an argument)
:open
:shell
:smile
:tearoff
Other compile-time features:
EBCDIC
Emacs tags support
X11 integration (see |x11-selection|)
Nvim does not have a built-in GUI and hence the following aliases have been
removed: gvim, gex, gview, rgvim, rgview
"Easy mode" (eview, evim, nvim -y)
"(g)vimdiff" (alias for "(g)nvim -d" |diff-mode|)
"Vi mode" (nvim -v)
The ability to start nvim via the following aliases has been removed in favor
of just using their command line arguments:
ex nvim -e
exim nvim -E
view nvim -R
rvim nvim -Z
rview nvim -RZ
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl: