Vim 7.3 released

Breaking news Vim 7.3 has been released. Hooray, vim users rejoice! It has been two years, so it is about time for an upgrade.

Change log

The new features are

  • Persistent undo and undo for reload
  • Blowfish encryption, encryption of the swap file
  • Conceal text
  • Lua interface
  • Python 3 interface
:help version-7.3

offers more detailed information. So I downloaded the latest version of MacVim and installed vim with MacPorts

sudo port install vim

I checked the enabled features with :version and

vim --version

I noticed that the Python 3 and Lua interface are disabled.

Undo persistence

Undo persistence is a new vim feature. You can find information about undo persistence with

:help undo-persistence

In my .vimrc I put these lines

set undofile
set undodir=/tmp/undos

The first line turns on undo persistence, which is off by default. The second line specifies a directory where to store the undo files, otherwise vim would use the same directory where the edited file is.

Bag of tips and tricks (pre 7.3)

My bag of vim gems and tidbits is full of stuff I would like to share no matter what. I admit that the usefulness varies and some of this stuff you may never ever need.

XML folding

I think that XML folding is a really neat feature. The xmledit vim plugin lets you do this the easy way. Download the plugin, put it in the .vim/ftplugin directory and add these lines to .vimrc

let g:xml_syntax_folding=1
au FileType xml setlocal foldmethod=syntax

If you open a XML file, it will be folded already. You can close and open folds with zo and zc.

Save a file with sudo

:w !sudo tee %

The ! calls an external command – in this case tee. % is the vim register containing the name of the file.

Encoding files

Vim allows you to encode data with a password

vim -x secretfile

Now vim asks you to enter an encryption key also known as a password and then you need to repeat it. Next time you try to open this file you will be prompted for your password. Of course, if you try viewing the file with other editors or cat for example, you will only see gibberish.

MySQL shell vi mode

I tested this under Ubuntu only, but in theory it should work on other operating systems as well. Apparently if MySQL is compiled with readline support, you can set vi mode for the MySQL CLI. Add this line to ~/.inputrc

set keymap vi 
set editing-mode vi

Vim questions on Stack Overflow

I assembled a list of vim questions on Stack Overflow. The answers contain lots of useful tips and ideas. I highly recommend going through them. The signal to noise ratio is really good.

Random links of interest

As a free service here are some interesting links

By the author of NumPy Beginner's Guide, NumPy Cookbook and Instant Pygame. If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
This entry was posted in editors and tagged , . Bookmark the permalink.