jasonwryan.com

Miscellaneous ephemera…

Building Vim

Apart from a brief, but nevertheless instructive, flirtation with Emacs1 I have been a consistent Vim user over the last three or four years. Like most Vim users, I have made some progress over that time in spite of Vim’s notorious learning curve and have now reached the point where, belatedly, I think I understand it just enough to really grasp how little I actually know. It’s a milestone that speaks more to necessity than gratification, granted.

In any event, as part of confronting my Vim shortcomings (no golfing for me), I have been able to land on the features of Vim that I require to be enabled so that I am moderately productive (in my own, admittedly cloistered, working environment). That, you will probably not be surprised to read, does not include needing support for Arabic or Farsi to be built into Vim.

Part of the beauty of Vim is that, unlike it’s operating system counterpart Emacs, you can choose how much functionality you wish to enable at compile-time. You do want support for Farsi? Then the --with-features=big option is what you are looking for. If, on the other hand, you just want the barest of bones, editor-wise, you could opt for the austere minimalism that is --with-features=tiny and find yourself happily transported back in time to Bill Joy’s lab in 1976.

You can peruse all of the various features available to Vim using the :help version command.2 There is also this table where the various features are listed against the respective feature flags (tiny, small, normal, big & huge).

After this bug report late last year, the default Arch PKGBUILD ships with huge as the feature set. Make what you will of that, but for my purposes it is overkill. With all the magic of ABS and makepkg, however, it is simple enough to build a Vim package that is tailored to exactly your requirements. For me, that means this set of simplified configure options:

1
2
3
4
5
6
7
8
9
10
11
  ./configure \
    --prefix=/usr \
    --localstatedir=/var/lib/vim \
    --with-features=normal \
    --with-compiledby=Arch:jwr \
    --with-x=yes \
    --enable-acl \
    --disable-gui \
    --disable-signs \
    --disable-netbeans \
    --enable-multibyte

With these options, I have the minimum amount of functionality I comfortably require (including the ability to access the system clipboard, --with-x=yes) but without the other bloat.

In addition to these changes to the config options, I also strip out all of the gvim-related stuff from the PKGBUILD as I do not require it. Even though it is a split package, just building vim still includes options superfluous to my needs. As a result, I get Vim with just the features I need, without the dependencies of ruby and lua and god knows what else.

I’m not operating under any illusions about the fact that this is really saving a huge amount of space or, for that matter, drastically reducing the number of dependencies I have installed. It is partly about understanding how Vim works at another level while also catering for the obsessive-compulsive drive to micro-control what is and isn’t installed on my systems. If you want to scratch either of the same itches, you can see the full PKGBUILD in Bitbucket.

Notes

  1. Still visible in some of my early Arch screenshots on Flickr
  2. The official documentation for the features is also online.

Comments