bartman's blog

notmuch for vim

bartman

Quite some time ago now, I tried sup but found it’s indexing latencies unacceptable for my workflow. I also found the user interface a bit foreign and hard to get into.

More recently I’ve found notmuch, a project that started as a C rewrite of the core bits of sup. Basically, it’s a program that indexes and searches through your existing mail.

I had two issues with it.

The latter is a problem because maildir is horrible at managing large collections of mail… and even more so over NFS. I guess I’ll have to part with NFS as a medium of sharing my my mail… well, either that, or consider adding mbox indexing to notmuch.

The former problem, of using emacs to interface with notmuch, I solved by writing a script to do the same for vim. The result of a couple of days of vim scripting are here: git.jukie.net/notmuch.git (see the vim branch).

notmuch.vim currently has two modes of operation:

It actually works very similarly to gmail. You tag email as it comes in, and the display engines lets you recall email by a tag or new search criteria.

When you start the vim interface, by running vim -c NotMuch you get something like this:

notmuch-vim-folders

On this screen you can see I have 3 folders, which actually overlap completely in this case. The left column shows the count, the middle is an arbitrary name, and the right is the search used to locate the messages. Pressing <Enter> moves me into the thread list, or the search mode.

Here is what notmuch.vim looks like in search mode:

notmuch-vim-search

Notable in the above image are notmuch’s ability to filter on various attributes of email messages, namely: tags, and word matches. Here, I have chosen to filter messages having the unread and index tags assigned, and also those that had PATCH in the subject.

If you select one of the messages, you’ll get something like this:

notmuch-vim-show

In this display you get all messages that belong to the thread displayed in chronological order – again, similar to gmail. By default the interface hides most of the unimportant detail with vim folds, but there are shortcuts defined to show the details.

So far supported features in notmuch.vim are:

More about the interface of notmuch.vim can be found here: README.

To try it run:

git clone git://git.jukie.net/notmuch.git
cd notmuch
git checkout vim

make
make install

cd vim
make install

notmuch setup
notmuch new

vim -c :NotMuch
Tags: