]> git.cworth.org Git - obsolete/notmuch-wiki/blob - vimtips.mdwn
Update news & manpages to notmuch version 0.16
[obsolete/notmuch-wiki] / vimtips.mdwn
1 [[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
2
3 Notmuch is a great mail indexing tool that can also be used *in conjunction*
4 with existing Mail User Agents (MUA) instead of replacing them. The advantage of
5 such mixed solutions is that users can benefit from notmuch features (such as
6 full-text search and thread reconstruction) without *having to* change MUA.
7
8 A popular geek MUA is [the Mutt e-mail client](http://www.mutt.org); integrating
9 notmuch with Mutt is not seamless, but fairly straightforward. There are two
10 principal possibilities, either using a patched mutt that handles internally
11 notmuch, or use a sets of scripts/handler within mutt to achieve something close.
12
13 [[!toc levels=2]]
14
15
16 ## Addressbook management and vim
17
18 There are some emacs tips over [here](http://notmuchmail.org/emacstips/#index15h2) that
19 explains how to configure emacs with an addressbook, but the few solutions were not fast enough
20 for me. And I never could test the vala-based code. So I updated the notmuch_addresses code to
21 use a cache to be able to make better matches and still be lightning fast.
22
23 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
24 automagically from within `vim`. So that's why I created the [notmuch_abook](https://github.com/guyzmo/notmuch-abook) code.
25 You can either install it as a plugin in vim, using vundle:
26
27         Vundle 'guyzmo/notmuch-abook'
28
29 Or if you're not using vim (which is objectively the best editor ever), you may
30 want to use it as standalone:
31
32         % pip install notmuch_abook
33
34 To configure the address book, append to `~/.notmuch-config` the following:
35
36         % cat >> ~/.notmuch-config << EOF
37
38         [addressbook]
39         path=/home/YOURUSERNAME/.notmuch-abook.db
40         backend=sqlite3
41
42         EOF
43
44 where YOURUSERNAME is your home directory. Then, you can sync the addressbook cache
45 by running. It will create the database file specified in configuration, and go through
46 all notmuch's indexed mails to get all addresses headers and cache them. It takes around
47 20 seconds on my 10000 mails index:
48
49         % notmuch_abook create
50
51 And you can query for addresses using the lookup command, which will match the beginning
52 of each word in the name and address, as follows:
53
54         % notmuch_abook lookup Foo
55         Foobar Bar <bar@bar.com>
56         Bar Foobar <bar@bar.com>
57         Bar Bar <foobar@bar.com>
58         Bar Bar <bar@foobar.com>
59         Bar Bar <bar@bar.foo>
60
61 If you're using vim, when you edit a mail having a filetype set to mail, you will be
62 able to open a completion menu when you do <C-x><C-u> at every address header.