]> git.cworth.org Git - notmuch-wiki/blobdiff - vimtips.mdwn
correction of the notmuch-mutt page, and added muttips/vimtips pages
[notmuch-wiki] / vimtips.mdwn
diff --git a/vimtips.mdwn b/vimtips.mdwn
new file mode 100644 (file)
index 0000000..b531a77
--- /dev/null
@@ -0,0 +1,63 @@
+[[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
+
+Notmuch is a great mail indexing tool that can also be used *in conjunction*
+with existing Mail User Agents (MUA) instead of replacing them. The advantage of
+such mixed solutions is that users can benefit from notmuch features (such as
+full-text search and thread reconstruction) without *having to* change MUA.
+
+A popular geek MUA is [the Mutt e-mail client](http://www.mutt.org); integrating
+notmuch with Mutt is not seamless, but fairly straightforward. There are two
+principal possibilities, either using a patched mutt that handles internally
+notmuch, or use a sets of scripts/handler within mutt to achieve something close.
+
+[[!toc levels=2]]
+
+
+## Addressbook management and vim
+
+There are some emacs tips over [here](http://notmuchmail.org/emacstips/#index15h2) that
+explains how to configure emacs with an addressbook, but the few solutions were not fast enough
+for me. And I never could test the vala-based code. So I updated the notmuch_addresses code to
+use a cache to be able to make better matches and still be lightning fast.
+
+And finally, [I needed](http://i.got.nothing.to/blog/2013/03/20/how-i-learned-to-stop-worrying-and-love-the-mail/) to have a way to autocomplete my recipients' addresses 
+automagically from within `vim`. So that's why I created the [notmuch_abook](https://github.com/guyzmo/notmuch-abook) code.
+You can either install it as a plugin in vim, using vundle:
+
+        Vundle 'guyzmo/notmuch-abook'
+
+Or if you're not using vim (which is objectively the best editor ever), you may
+want to use it as standalone:
+
+        % pip install notmuch_abook
+
+To configure the address book, append to `~/.notmuch-config` the following:
+
+        % cat > ~/.notmuch-config << EOF
+        
+        [addressbook]
+        path=/home/YOURUSERNAME/.notmuch-abook.db
+        backend=sqlite3
+
+        EOF
+
+where YOURUSERNAME is your home directory. Then, you can sync the addressbook cache
+by running. It will create the database file specified in configuration, and go through
+all notmuch's indexed mails to get all addresses headers and cache them. It takes around
+20 seconds on my 10000 mails index:
+
+        % notmuch_abook create
+
+And you can query for addresses using the lookup command, which will match the beginning
+of each word in the name and address, as follows:
+
+        % notmuch_abook lookup Foo
+        Foobar Bar <bar@bar.com>
+        Bar Foobar <bar@bar.com>
+        Bar Bar <foobar@bar.com>
+        Bar Bar <bar@foobar.com>
+        Bar Bar <bar@bar.foo>
+
+If you're using vim, when you edit a mail having a filetype set to mail, you will be
+able to open a completion menu when you do <C-x><C-u> at every address header.
+