*version8.txt* For Vim version 8.2. Last change: 2022 Feb 26
VIM REFERENCE MANUAL by Bram Moolenaar
*vim8* *vim-8* *version-8.0* *version8.0*
Welcome to Vim 8! A large number of bugs have been fixed and several nice
features have been added. This file mentions all the new items and changes to
existing features since Vim 7.4. The patches up to Vim 7.4 can be found here:
|vim-7.4|.
Use this command to see the full version and features information of the Vim
program you are using: >
:version
NEW FEATURES |new-8|
Vim script enhancements |new-vim-script-8|
Various new items |new-items-8|
INCOMPATIBLE CHANGES |incompatible-8|
IMPROVEMENTS |improvements-8|
COMPILE TIME CHANGES |compile-changes-8|
PATCHES |patches-8|
VERSION 8.1 |version-8.1|
Changed |changed-8.1|
Added |added-8.1|
Patches |patches-8.1|
VERSION 8.2 |version-8.2|
Changed |changed-8.2|
Added |added-8.2|
Patches |patches-8.2|
See |vi_diff.txt| for an overview of differences between Vi and Vim 8.0.
See |version4.txt|, |version5.txt|, |version6.txt| and |version7.txt| for
differences between other versions.
*vim-changelog*
You can find an overview of the most important changes (according to Martin
Tournoij) on this site: https://www.arp242.net/vimlog/
==============================================================================
NEW FEATURES *new-8*
First an overview of the more interesting new features. A comprehensive list
is below.
Asynchronous I/O support, channels ~
Vim can now exchange messages with other processes in the background. This
makes it possible to have servers do work and send back the results to Vim.
See |channel-demo| for an example, this shows communicating with a Python
server.
Closely related to channels is JSON support. JSON is widely supported and can
easily be used for inter-process communication, allowing for writing a server
in any language. The functions to use are |json_encode()| and |json_decode()|.
This makes it possible to build very complex plugins, written in any language
and running in a separate process.
Jobs ~
Vim can now start a job, communicate with it and stop it. This is very useful
to run a process for completion, syntax checking, etc. Channels are used to
communicate with the job. Jobs can also read from or write to a buffer or a
file. See |job_start()|.
Timers ~
Also asynchronous are timers. They can fire once or repeatedly and invoke a
function to do any work. For example: >
let tempTimer = timer_start(4000, 'CheckTemp')
This will call the CheckTemp() function four seconds (4000 milliseconds)
later. See |timer_start()|.
Partials ~
Vim already had a Funcref, a reference to a function. A partial also refers
to a function, and additionally binds arguments and/or a dictionary. This is
especially useful for callbacks on channels and timers. E.g., for the timer
example above, to pass an argument to the function: >
let tempTimer = timer_start(4000, function('CheckTemp', ['out']))
This will call CheckTemp('out') four seconds later.
Lambda and Closure ~
A short way to create a function has been added: {args -> expr}. See |lambda|.
This is useful for functions such as `filter()` and `map()`, which now also
accept a function argument. Example: >
:call filter(mylist, {idx, val -> val > 20})
A lambda can use variables defined in the scope where the lambda is defined.
This is usually called a |closure|.
User defined functions can also be a closure by adding the "closure" argument
|:func-closure|.
Packages ~
Plugins keep growing and more of them are available than ever before. To keep
the collection of plugins manageable package support has been added. This is
a convenient way to get one or more plugins, drop them in a directory and
possibly keep them updated. Vim will load them automatically, or only when
desired. See |packages|.
New style tests ~
This is for Vim developers. So far writing tests for Vim has not been easy.
Vim 8 adds assert functions and a framework to run tests. This makes it a lot
simpler to write tests and keep them updated. Also new are several functions
that are added specifically for testing. See |test-functions|.
Window IDs ~
Previously windows could only be accessed by their number. And every time a
window would open, close or move that number changes. Each window now has a
unique ID, so that they are easy to find. See |win_getid()| and |win_id2win()|.
Viminfo uses timestamps ~
Previously the information stored in viminfo was whatever the last Vim wrote
there. Now timestamps are used to always keep the most recent items.
See |viminfo-timestamp|.
Wrapping lines with indent ~
The 'breakindent' option has been added to be able to wrap lines without
changing the amount of indent.
Windows: DirectX support ~
This adds the 'renderoptions' option to allow for switching on DirectX
(DirectWrite) support on MS-Windows.
GTK+ 3 support ~
The GTK+ 3 GUI works just like GTK+ 2 except for hardly noticeable technical
differences between them. Configure still chooses GTK+ 2 if both 2 and 3 are
available. See src/Makefile for how to use GTK+ 3 instead. See
|gui-x11-compiling| for other details.
Vim script enhancements *new-vim-script-8*
-----------------------
In Vim script the following types have been added:
|Special| |v:false|, |v:true|, |v:none| and |v:null|
|Channel| connection to another process for asynchronous I/O
|Job| process control
Many functions and commands have been added to support the new types.
On some systems the numbers used in Vim script are now 64 bit. This can be
checked with the |+num64| feature.
Many items were added to support |new-style-testing|.
printf() now accepts any type of argument for %s. It is converted to a string
like with string().
Various new items *new-items-8*
-----------------
Visual mode commands: ~
|v_CTRL-A| CTRL-A add N to number in highlighted text
|v_CTRL-X| CTRL-X subtract N from number in highlighted text
|v_g_CTRL-A| g CTRL-A add N to number in highlighted text
|v_g_CTRL-X| g CTRL-X subtract N from number in highlighted text
Insert mode commands: ~
|i_CTRL-G_U| CTRL-G U don't break undo with next cursor movement
Cmdline mode commands: ~
|/_CTRL-G| CTRL-G move to the next match in 'incsearch' mode
|/_CTRL-T| CTRL-T move to the previous match in 'incsearch' mode
Options: ~
'belloff' do not ring the bell for these reasons
'breakindent' wrapped line repeats indent
'breakindentopt' settings for 'breakindent'.
'emoji' emoji characters are considered full width
'fixendofline' make sure last line in file has <EOL>
'langremap' do apply 'langmap' to mapped characters
'luadll' name of the Lua dynamic library
'packpath' list of directories used for packages
'perldll' name of the Perl dynamic library
'pythondll' name of the Python 2 dynamic library
'pythonthreedll' name of the Python 3 dynamic library
'renderoptions' options for text rendering on Windows
'rubydll' name of the Ruby dynamic library
'signcolumn' when to display the sign column
'tagcase' how to handle case when searching in tags files
'tcldll' name of the Tcl dynamic library
'termguicolors' use GUI colors for the terminal
Ex commands: ~
|:cbottom| scroll to the bottom of the quickfix window
|:cdo| execute command in each valid error list entry
|:cfdo| execute command in each file in error list
|:chistory| display quickfix list stack
|:clearjumps| clear the jump list
|:filter| only output lines that (do not) match a pattern
|:helpclose| close one help window
|:lbottom| scroll to the bottom of the location window
|:ldo| execute command in valid location list entries
|:lfdo| execute command in each file in location list
|:lhistory| display location list stack
|:noswapfile| following commands don't create a swap file
|:packadd| add a plugin from 'packpath'
|:packloadall| load all packages under 'packpath'
|:smile| make the user
评论0