Yesterday, July 6, 2013, Bram Moolenaar
announced the release of the first beta version of Vim 7.4: one of the world's best text editors * nix.
The most significant change in the new version is the new regular expression engine. Python support has also been greatly improved.
Changes:
New regular expression engine
The engine, now called the old one, uses an algorithm based on returns. He tries to match the text of the regular expression in one way, and if he fails, he goes back and tries to use another method (translation
: h new-regexp-engine ). This algorithm works well with simple regular expressions, but more complex ones can work too long on long texts.
The new engine uses a state machine. It checks all possible alternatives for the given symbol and saves the possible states of the regular expression. This approach works slightly slower on simple regular expressions, but it is also very fast when working with complex expressions and long texts.
This change is most noticeable when viewing Javascript and XML files containing long lines: now Vim works at a normal speed in these cases, whereas earlier you could see strong brakes.
At the moment, the engine is quite stable, but even now sometimes find complex regular expressions that change their behavior when using a new engine. Deleting the old engine from the Vim source code is not planned: on the contrary, Bram said that he would like to make a certain heuristic analyzer that will select the engine that will quickly work out the regular expression.
It should also be noted that the new engine based on non-deterministic finite state machine is the only popular engine supporting lookbehind of unlimited length. However, to improve performance, it is recommended to directly indicate what the maximum number of characters can correspond to the lookbehind subexpression.
To select a specific engine, you can use the
'regexpengine' setting (changes the used engine for all new regular expressions) or
/ \% # = at the beginning of the expression (changes the engine for this expression).
More interoperability between Vim and the Python built-in interpreter
- Added function
vim.bindeval
. Unlike vim.eval
, this function returns objects of type vim.Dictionary
and vim.List
, changing which also changes the corresponding variable VimL, and vim.Function
, the call of which calls the built-in function Vim, or a user-defined function written in VimL.
For simple types, the new function returns the corresponding Python types, but, unlike vim.eval
, the numbers are returned as numbers, not as their string representations. For strings in Python 3, there is a significant difference between vim.bindeval
and vim.eval
: the new function returns byte strings ( bytes()
), and the old one returns unicode strings ( str()
) and can cause UnicodeDecodeError
.
The interface of these objects to a certain extent corresponds to the interface of the built-in Python types. Compliance will continue to improve. - Added special objects
vim.vars
, buffer
.vars
and window
.vars
, which facilitate access to variables. - Added special objects
vim.options
, buffer
.options
and window
.options
that facilitate access to settings. - Now, to import modules from
{runtimepath}/python2
, {runtimepath}/python3
and {runtimepath}/pythonx
do not need to add anything to sys.path
: import occurs automatically (unless you have removed '_vim_path_'
from sys.path
or the corresponding function from sys.path_hooks
). - Added the ability to work with tabs.
- Now exceptions and VimL errors automatically turn into Python exceptions.
- Changed the behavior of vim.buffers : previously, the keys were the sequence numbers of the buffers in the internal structures of Vim, which could only be found by passing through this object, now the keys are the numbers of the buffers.
- Added command
:pydo
. - Added pyeval () function.
- Now, wherever strings were previously used, you can use both unicode and byte strings in both versions of Python. Where numbers were used, you can now use any object that supports conversion into a number (more precisely, the "numeric protocol"). In some places, iterators can now be used instead of lists.
- Using
vim.window.col
and vim.window.row
is currently the only way to know the location of a window. - Fixed or added support for
dir(vim.*)
. - Older versions of Python (2.2 * and earlier) are no longer supported. However, they had not previously met because of the many incompatibilities.
Other changes
(changes from version 7.3.000 are indicated)
- Added support for saving lists and dictionaries in viminfo .
- Added auto-completion of command arguments
:language
. - Added the ability to influence indenting inside the C ++ namespace.
- Added the ability to influence the alignment of the
if
/ while
/ for
condition separately from the alignment of function arguments. - Added the ability to use dictionary functions for sorting : the third argument is
sort()
. - Added bit operations: functions and () , or () , invert () and xor () .
- Improved support for cmd.exe as a shell.
- Added InsertCharPre event that occurs before the character set.
- Added a CompleteDone event that occurs after completion of auto-completion in input mode.
- A GUIFailed event has been added , which occurs if the GUI failed to start.
- Added a QuitPre event that occurs when trying to close Vim using commands that can close the window instead of closing Vim.
- Added TextChanged and TextChangedI events that occur when changing text.
- Added the ability to automatically delete the comment start character when using J : j flag for the 'formatoptions' setting.
- Added the ability to delete all icons for a given buffer or file.
- Added the ability to automatically save the selection to the system clipboard when using the command line (the
autoselectplus
option of the 'clipboard' setting). Also added is the ability to make the system clipboard a clipboard by default (previously it was only possible to make such a “mouse” buffer, which, however, is called the main one). - Added the ability to select the found string in two clicks and various manipulations (copying, deleting, replacing) with it: the
gn
command. - Added a special shiftwidth value that has the same effect as the shiftwidth value equal to the tabstop . In connection with the difficulties encountered, the shiftwidth () function has been added. Also, a similar special value was added to the 'softtabstop' setting.
- Added a special argument expand () , which expands to the current line number:
<slnum>
. - The : diffoff command now saves the values of the settings, rather than returning the default values.
- Added a variable containing the unique number of the current window (only for the graphical interface): v: windowid .
- Added the ability to return the character number in unicode regardless of the current encoding: the second argument is char2nr () .
- Functions that generate a list of files can now create a list , and not a string value, divided into file names with newline characters.
- Functions that receive variable values in a given window / tab / buffer can now return the specified value if the variable being searched for does not exist, and not just an empty string.
- Added luaeval () function.
- In the lua interface, there are also types associated with VimL variables ( list , dictionary , function reference ).
- In the lua interface, the
vim.isbuffer()
and vim.iswindow()
functions vim.isbuffer()
been replaced by vim.type()
. - Added sha256 () function.
- Added the wildmenumode () function, which allows you to find out if command line auto-completion is currently active.
- Added the ability to specify that the left side of this binding should not be the beginning of the left side of another binding (i.e.
map <buffer><nowait> , <Nop>
makes it difficult to start bindings map ,a A
and map ,b B
for this buffer) : When using the <nowait>
argument, Vim stops waiting for the next character as soon as the user <nowait>
all the characters needed to start the binding with this setting. - Added a few additional types of autocompletion : arguments : behave , color schemes, compilers, arguments : cscope , files in directories specified in 'path' , arguments : history , locale names, arguments : sign , arguments : syntime , user names.
- Added the ability to use VimL functions to enable / disable and get the status of external input methods.
- Added the ability to see the number of the current line in the column with line numbers when the 'relativenumber' setting is turned on: it turns on when 'relativenumber' and 'number' are simultaneously enabled.
- Added mouse support in rxvt-unicode and> xterm-277.
- Added the ability to ignore case for auto-completion.
- Added screen * () debugging functions to get information about what is displayed on the screen.
- Added a debug command : syntime , which allows to find out the speed of the regular expressions used by the backlight.
- Many bugs fixed.