Re: Recommended method to pair Notmuch with Neovim?

Subject: Re: Recommended method to pair Notmuch with Neovim?

Date: Wed, 19 Apr 2023 15:57:03 +0000

To: Michael J Gruber

Cc: notmuch@notmuchmail.org

From: James Cook


> Is there any good documentation on neomutt's notmuch support beyond what
> is on their website? I currently use alot for its great notmuch support
> (in particular tag completion with search and tag inyterfaces, multiple
> "tabs"/views) but find myself switching to neomutt for its better mime
> support (plus s/mime) and features like thread split & join, so far
> mostly maildir backed. neomutt's doc probably tell you everything you
> need to know to set up a notmuch-friendly user experience, but ...
> I know multiple views will not be a thing in neomutt. Easy tagging and
> nm-based search are a must, though. Being able to switch to the "maildir
> view" of a message (so that you can rearrange messages within your
> maildir folder tree) would be a plus.
> 
> Michael

I referred to this page a lot:

https://neomutt.org/feature/notmuch

There was an 11-month gap between releases (due to lingering bugs) so I
suggest trying to get a version released this year (though the 20220429
version was working pretty well for me too).

Searching:

The vfolder-from-query command lets you type a notmuch search query and
shows the results like a folder. To refresh the folder's content (e.g.
after updating tags) I find it helpful to type "c" to switch folders,
and type "^" as the folder name, which means "the folder I'm already
at". For some reason "$" doesn't cause the folder to reload.

The "entire-thread" command is useful too: if your search pulls in some
emails from a thread and you want to see the reast, simply run the
"entire-thread" command (I bind it to "+") with the cursor on one of
them, and the rest will be added to the current virtual mailbox.

Tagging:

The modify-labels command lets you type e.g. "-inbox +spam" to change
tags. It has tab completion. I've been meaning to add custom shortcuts
for comman changes I make, e.g. -inbox.

Maildir view:

I don't know exactly what you mean by switching to the maildir view of a
message. You can freely switch between real maildirs and notmuch search
results when changing folders (see vfolder-from-query). Maybe you want a
way to automatically go to the real Maildir folder containing the
selected search result; I don't know if that's possible (and there could
be ambiguity if files in different folders have the same message id).
You might have to run "notmuch new" after making maildir changes?

Other / example config:

"%g" in the index_format option shows a message's tags.

I've copied most of my own config below the signature.

-- 
James


##
## Folder configuration
##

set folder=~/var/mbsync/falsifian.org
set spool_file="notmuch inbox"
set postponed=+Drafts
set record=+Sent

##
## Notmuch and mailboxes
##

set nm_db_limit=10000
set nm_exclude_tags="spam"
set nm_record=yes

named-mailboxes "notmuch inbox" "notmuch://?query=tag:inbox and not tag:reading"

##
## Aliases
##

alias a-b agora-business@agoranomic.org
# etc...; instead of aliases, I mostly use my address book stored in khard by
# pressing ctrl-T after typing the beginning of a name; see the "query_command"
# option below.

##
## Key bindings, including macros
##

# Make it (hopefully) really hard to accidentally delete messages.
unbind * d
unbind * "\Cd"

bind index S vfolder-from-query

# From https://neomutt.org/feature/custom-tags
bind index,pager \` modify-labels

# From https://neomutt.org/feature/notmuch
bind index,pager + entire-thread

##
## Miscellaneous
##

set forward_format="Fwd: %s"
set from="James Cook <falsifian@falsifian.org>"
set index_format="%[%g%m%d %H%M] %Z %-15.15L %s%* |%g %?E?%e/%E?"
set pager_index_lines=5
set pager_stop
set query_command="khard email --parsable %s"
set send_charset="utf-8"
# Without this, sending mail from a DragonflyBSD machine via my SMTP server to the Agora mail lists fails because the envelope-from ends up being falsifian@<machine hostname> instead of agora@falsifian.org.
set use_envelope_from=yes

# I don't know if these are relevant to notmuch; I added these lines when I was
# using IMAP with neomutt.
#
# Caching. header_cache_backend is appended later by drist script.
# Use the same directory for both caches. (The manual says this will work.)
set header_cache="~/.cache/neomutt"
set message_cachedir="~/.cache/neomutt"

# Per-recipient settings, and generic default settings. (Without the default
# send-hook, the per-recipient settings would stick, since they last until the
# end of the session.)

send-hook . 'unmy_hdr From: ; set signature="echo James|"'
send-hook '~t ^(agora-.*@agoranomic.org\|agora@listserver.tue.nl)$' 'my_hdr From: Falsifian <agora@falsifian.org> ; set signature="echo Falsifian|"'

# Header weeding and ordering
ignore *
unignore from date subject to cc list-id reply-to
hdr_order subject from date to cc list-id reply-to
set header_cache_backend="kyotocabinet"
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: