Monday, January 07, 2008

Stupid Ubuntu Tricks

One of the reason d’etre for a blog like this is to record hacks that make software work the way I want, rather than the way some software developer thinks is best. If I was a Windows drone I'd be doing the same kind of thing, except that the blog would have a lot more posts and a ton more whining.

Anyway, one of the irritations of Ubuntu, as opposed to other Linux distributions I've used, is the lack of file-name completion in the vim editor and in gnuplot. If you don't know, file-name completion allows you to start typing the name of the file, and then hit tab to complete the file-name, or to cycle through a list of file names. It's extremely useful, and in most Linux distributions is based on calls to the GNU readline library.

The default Ubuntu distribution has a vim editor and gnuplot with the file completion mode disabled. This annoyed me, but not so much that I was prompted to do something about it until we started installing Ubuntu at work. So today I did a little web searching and found that the lack of support has different causes for the two programs:

  • vim: Ubuntu installs vim-tiny by default. That's fine, if you want to save space, but all of the neat features of vim are in vim-full, which has all the bells and whistles.
  • gnuplot: I've tried to fix this before by compling gnuplot from source, but the problem is in Ubuntu's implementation of the readline library. We need a work-around, a program called rlwrap, which force-feeds file-name completion to gnuplot or other misbehaving programs.

So to fix both problems at once, install the appropriate files:

$ sudo apt-get install vim-full rlwrap

vim is fixed, as vim-tiny has been replaced by vim-full. For gnuplot, we need one more step. Add

alias gnuplot "rlwrap -a -c /usr/bin/gnuplot"

to your ~/.cshrc file, or

alias gnuplot='rlwrap -a -c /usr/bin/gnuplot'

to your ~/.bashrc or ~/.bash_aliases file.

And two programs, at least, work the way I want.

0 comments: