Bill Powell Is Alive
{ Man Found Alive With Two Legs }

A personal blog about Linux and literature, distributism and Catholicism, adventures in permaculture, and being alive.

VimOutliner (and a tweak to use colorschemes)

by Bill Powell | updated: 2007 Jan 24 Wed | published: 2007 Jan 24, 03:36 Wed
tags: linux, vim, and vimoutliner

I mentioned Vim, most amazing of editors, awhile back, and since then I’ve realized one of its greatest features is how easy it is for you to extend its powers. Or at least, to download the work of others who have. (Ironically, this extensibility used to be, I mean, is, one of the key advantages of Emacs in its ancient rivalry to vi, the wizened old editor on which vim is based.) You could meander the archive of scripts for days, and they (usually) work no matter what OS you run Vim on: Linux, Mac, Windows, whatever. I use some so often that I forget they’re not part of Vim.

One such tool is VimOutliner. As this screenshot shows, you can organize your thoughts in a plain text file that VimOutliner color codes simply by indent. In the picture, level 1 headings are black, level 2 red, level 3 blue, and level 4 purple. Comments are dark green; these are chunks of text that can live anywhere in the tree, and go on as long as you like. Thanks to folding, you can tuck these chunks into a single line; in fact, as the picture shows, you can fold headings, too.

So far, you’ve probably seen these features in other outliners too. What the picture doesn’t show is how fast it works. Like anything in Vim, complex actions are reduced to quick keystrokes. You can fold the whole thing up, showing only level 1 headings, with ,,1. Or ,,2 to expand to level 2, etc. With Vim’s usual folding and editing commands, you can shift stuff around in seconds. Since headings are based on indents, you use the usual >> and << to move lines back and forth. Or I might be working on a character and realize an entire section belongs under “plot.” Very well, I jump to the heading ([z), fold it up (zc), select and cut my folded heading (Vd), then move to its new location and put it in (p). No pointing and clicking necessary.

There are even a few more features, but this basic functionality is worth the hour or so it’d take you to download Vim, run the included vimtutor and get comfortable, then try VimOutliner. Seriously, you can use this for almost any kind of notes you can think of. And it’s all plain text; you need VimOutliner to do the fancy stuff, but if you’re ever without it, you can still read your work.

I’ve only ever had a couple complaints. First, on really large, complex files, it can get a wee bit slow. But this may be a function of my venerable Pentium III, and, given the structure of an outline, it’s no big deal to separate a couple high-level headings into separate files. (There’s even a nifty tag you can insert to jump between files.)

Secondly, it ships with one or two colorschemes. That’s great, but when you start using it for everything, you want some variation. Now, most colorschemes play nice with any kind of file, from bash to LaTeX to Z-code. But I found (after repeated attempts) that whenever I opened an .otl (VimOutliner) file, the colors snapped back to the default VimOutliner colorscheme. Occasionally, pieces of the former scheme (like the background, I think) would remain, which could make for some odd effects.

Fix for VimOutliner and Colorschemes

So I dug in the syntax file ($VIM/syntax/vo_base.vim), and found that I could easily link the syntax items to established Vim groups, like Normal, Comment, and so on. Never mind if you don’t know what I mean, the point is, with some slight tweaks, you can now open a VimOutliner file in any colorscheme you like. You’ll still get some occasional weirdnesses (certain elements can default to invisible), in which case you can either change colorschemes, tweak the colorscheme itself, or tweak syntax/vo_base.vim. Anyhow, it usually works.

To use it (assuming you’ve already gotten VimOutliner), download the file here. Rename the file you already have at $VIM/syntax/vo_base.vim to something else, in case this doesn’t work ($VIM is your base directory for Vim; on Linux it’s $HOME/.vim). Then move the new file you downloaded to $VIM/syntax/vo_base.vim, and open a VimOutliner file to try it out.

Of course, the next version of VimOutliner will wipe the changes out. But I’m posting this on that site; maybe this tweak’ll be in the next version.

Anyhow, I’ll stop so you can go get them (Vim and VimOutliner). Enjoy.

  1. chrs says:

    It works - thanks. Do you have any pointers to a beginner’s introduction to VimOutliner? The help is not very good - it dives straight into details and doesn’t seem to cover the basics. I’ve had to work out what it does by experimentation…

  2. Bill Powell says:

    Hi! Thanks for your comment, I’m so glad to hear this worked for you.

    As to an introduction to VimOutliner, the help file gets to actual usage down around RUNNING VIMOUTLINER. (Note: there’s currently an error in the help file: you can use the “exectuable lines” with ,,e. You don’t have to add anything to your .vimoutlinerrc file.)

    Some of the links at the bottom of the helpfile are good too; I just browsed around the author’s website, www.troubleshooters.com. He seems to have a gentle introduction to using VimOutliner here, though I didn’t look carefully to see how similar it is to the help file.

    There’s also the mailing list, which could probably help with specific questions.

    Hope that helps! Bill Powell

  3. Bill Powell says:

    Chris wrote me back to mention that he not only found those links helpful, but also wrote his own quick introduction to VimOutliner too.


This page last generated: Sun Jul 18 14:11:02 -0400 2010