Vim development doesn't move quickly, but the popular vi-replacement
continues to evolve. Maintainer Bram Moolenaar released Vim 7.3 on August 15th with support for new language interfaces and the ability to retain undo information between sessions.
The 7.3 release comes about two years after 7.2, and is primarily a maintenance and bugfix release, but does include a few notable new features and a few changes. Support for GTK+ 1.x has been removed in Vim 7.3 in favor of GTK+ 2.x, which shouldn't pose a problem for any users on modern Linux distributions. For the full list of minor changes from 7.2 in Vim 7.3, users can run
The most interesting feature in Vim 7.3, at least for most, is the addition of persistent undo. Prior to 7.3, the "undo" history for a file was lost when exiting Vim or unloading a buffer. Vim 7.3 adds the
undofile option, which allows you to save the undo history and restore it when reopening a file. Since it's possible that a file would be changed in another editor or by another process, Vim saves a hash of the file and compares it when re-opening the file. If the file being edited has changed, the undo history from the previous session is disregarded to avoid problems.
The Vim 7.x series has added a number of features that make it easier to undo changes and revert to prior versions of a file. The 7.0 release introduced the
:later operations, which can move through the file's history by time rather than stepping through and undoing operations one by one. For example, it's possible to revert to a buffer's state as it was an hour or day ago using
:earlier 1h or
:earlier 1d. Using
:later 1h or
:later 1d would restore the buffer.
Vim 7.3 builds on this by adding a file write option, in addition to the time-based options. Using
:earlier 1f moves backwards one file write,
:earlier 2f back by two writes, etc. Using
:later 1f and so on will restore the buffer to later file writes (if any).
Python 3 and Lua support is now available in Vim 7.3, so users can use
Python 3 or Lua within Vim to create macros. This is similar to the way
that Emacs uses Lisp, but users can choose to compile in support for
Python, Lua, Perl, Ruby, and others. Vim has supported Python 2 for some
time, but Vim 7.3 adds the Python 3 interface as an option. Vim can have both Python 2 and 3 compiled in, but only one version can be active at a time.
Vim has supported encryption for files for some time. Files can be encrypted using the
:X command, and then require a password to decrypt the file on opening. (Note that the swap file is not encrypted during the editing session.) Earlier versions of Vim used a weak encryption based on PkZip, but 7.3 adds Blowfish for strong encryption. The weak encryption is used by default, but this can be overridden using the
cryptmethod option. To set the option during a Vim session, you'd run
New to Vim 7
For users who haven't looked at Vim in a while, the Vim 7 series brings
quite a few new features to Vim and helps Vim stand out as far more than
just a simple vi clone.
Many users prefer Vim for programming, but those who turn to a text editor for prose will be happy to know that Vim 7 sports a spell checker. Using the spell checking feature, Vim will not only highlight words that are misspelled, but also can suggest words and replace the misspelled item.
It seems that all programs eventually trend towards a tabbed interface, and Vim is no exception. With the 7.0 release, Vim introduced a tabbing feature that allows users to open each buffer in its own tab (if they so choose). This is available in the standard text-mode version of Vim as well as GUI Vim (GVim). Vim also supports a command called :tabdo to allow users to execute commands throughout all buffers that are open in tabs, not just the current buffer.
Vim 7 also introduced an internal version of grep. Previous versions of Vim could use external grep to search files on disk, but this was a problem for Windows versions of Vim and also posed a problem because different systems come with different grep implementations. In Vim 7, users can work with
:vimgrep to search through files for a pattern, and then the
:copen command to see the files that match the pattern (if any) and edit them.
It's also worth mentioning that Vim's license is unique. Moolenaar distributes Vim under a "charityware" license that allows using and copying Vim as much as one likes, but encourages donations to needy children in Uganda via ICCF Holland. The full text of the license is available in Vim's documentation.
The recommended method for getting Vim sources is via the Mercurial repository, but source
tarballs are also available via
FTP. Vim 7.3 compiles without any problems on Ubuntu 10.04 after
installing the needed dependencies.
Overall, Vim 7 was a major leap over Vim 6, with a lot of miscellaneous new features and improvements. If you're a heavy Vim user, the 7.3 release is worth the time to download and compile just for the persistent undo feature. It's also interesting if you use Python 3 or Lua, otherwise it's fairly light on new features. If for some reason you're still on a version of Vim prior to 7.0, now would be a good time to update.
to post comments)