Vim and X terminals

By Abhijit Menon-Sen <ams@toroid.org>

2011-05-28

I've been using vim for more than a decade(!) now, but every so often, I still learn something new that makes my life a bit easier. Here are two things I learned today.

conque

Emacs users have enjoyed the convenience of using M-x shell to run shell programs inside an Emacs buffer for years. I found a Python plugin named conque that does the same for vim. It works well enough to run vim inside vim (not that I plan to do that often), and using it to talk to psql while experimenting with schema changes is very convenient.

+xterm_clipboard

A friend pointed out that vim built with X11 support could yank text to and from the X clipboard using "*yy and "*p. Ubuntu's vim-gnome package gave me a console vim built with +X11 and +xterm_clipboard support, and I got the feature working as advertised after I set "clipboard" to just "autoselect" (the default setting of "autoselect,exclude:cons\|linux" caused vim to not connect to the X server at all).

I can now use * and + like any other registers, but one uses the primary X selection, and the other the X clipboard.

After less than a day of using this feature, I'm already hooked. It's so much nicer than pasting text into vim in insert mode, and also makes it easier to exchange text between two vims running in different terminals.