-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathneomuttrc
379 lines (331 loc) · 17.4 KB
/
neomuttrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# My main NeoMutt configuration file. Lots of documentation is in neomuttrc(5) and
# <file:///usr/share/doc/neomutt/manual.html> or <https://neomutt.org/guide/>. I don't
# know if my configuration works well with unpatched Mutt anymore. It probably doesn't.
# Unbind some keys. TODO: maybe we should follow this guy's example:
# <https://github.com/iagox86/mutt/blob/master/keybindings.conf>.
bind generic z noop
bind generic Z noop
bind index,pager d noop
# I never wanted to delete a specific attachment but keep the message itself so far.
# Unbind <delete-entry> in the attachment menu.
bind attach d noop
bind index,pager g noop
bind generic ] noop
bind generic [ noop
set realname='Lukas Waymann'
# See <file:///usr/share/doc/neomutt/manual.html#set-myvar>. Setting these in
# "gmail.muttrc" and "fastmail.muttrc" would result in many more `gpg` invocations.
# Prepending `notify-send foo` is a good trick to debug that stuff.
set my_fastmail_user="`gpg -dq ~/.config/neomutt/fastmail-user.gpg`"
# See <https://www.fastmail.com/help/clients/apppassword.html>.
set my_fastmail_pass="`gpg -dq ~/.config/neomutt/fastmail-password.gpg`"
# This is used in fastmail.muttrc to set the default "from" address.
set my_fastmail_from="`gpg -dq ~/.config/neomutt/fastmail-from.gpg`"
# Call pass(1) to get the account's password. "Since initialization files are line
# oriented, only the first line of output from the Unix command will be substituted." See
# <file:///usr/share/doc/neomutt/manual.html#neomuttrc-syntax>.
set my_gmail_pass="`pass show google/lb.waym 2>/dev/null`"
# See <https://wiki.archlinux.org/title/Mutt#Multiple_accounts> and
# <file:///usr/share/doc/neomutt/manual.html#account-hook>.
source ~/.config/neomutt/gmail.muttrc
folder-hook $folder 'source ~/.config/neomutt/gmail.muttrc'
source ~/.config/neomutt/fastmail.muttrc
folder-hook $folder 'source ~/.config/neomutt/fastmail.muttrc'
# Default is "us-ascii:iso-8859-1:utf-8". Really?
# https://wiki.archlinux.org/title/Mutt#E-mail_character_encoding
set send_charset="utf-8"
# Empty by default. This fixes most messages without character encoding indication that I
# get (Mutt assumes "us-ascii" when assumed_charset is empty).
set assumed_charset="cp1252"
# Character set alias: treat iso-8859-1 as an alias for cp1252.
charset-hook ^iso-8859-1$ cp1252
# Background: US-ASCII is basically 8-bit nowadays, so misinterpreting actual ASCII as
# some ASCII-based encoding should be fine. CP-1252 (or windows-1252) is Microsoft's
# bastardized version of ISO-8859-1 (latin1). Apparently mislabeling CP-1252 encoded text
# as ISO-8859-1 is so ubiquitous that most programs assume it deliberately and HTML5
# requires that documents advertised as ISO-8859-1 are parsed as CP-1252. Computers suck.
# Enable and configure the [sidebar](http://www.mutt.org/doc/manual/#sidebar). See
# <https://stevelosh.com/blog/2012/10/the-homely-mutt/#configuring>.
set sidebar_visible=yes
set sidebar_width=24
set sidebar_short_path=yes
set sidebar_delim_chars='/'
# Taken from <https://stevelosh.com/blog/2012/10/the-homely-mutt/#reading-email>. Sort by
# [threads](http://www.mutt.org/doc/manual/#threads), displaying them as a tree structure.
# Sort entire threads (and messages that aren't part of a thread) in relation to each
# other by the date the thread's most recent message was received (or the date the message
# was received). Recent threads and messages go to the top.
set sort=threads
set sort_aux=reverse-last-date-received
set strict_threads
# Setting `autoedit` along with `edit_headers` makes Mutt immediately open Vim when
# composing a new message. Common wisdom is to "write the introduction last". Assuming
# this advice can be at all extended to writing email, it surely doesn't make sense to
# prompt for a subject line before allowing composition of a mail's body.
set autoedit
set edit_headers
# Also don't ask whether we want to recall a postponed message when hitting `m`. We can
# use `R` (`recall-message`) to do that.
set recall=no
set fast_reply
# See <https://neomutt.org/guide/tuning>.
set read_inc=100
# When in the pager (reading a message), still show a few lines of the index (list of
# messages) for context. I got this from Steve Losh's blog post.
set pager_index_lines=10
# TODO: explain.
set imap_delim_chars='/'
# Ask fewer questions. TODO: explain more.
set delete=yes
set include=yes
set reply_to=yes
# Stuff found at <https://stevelosh.com/blog/2012/10/the-homely-mutt/#configuring>. TODO:
# explain.
set wait_key=no
set pager_stop
set menu_scroll
unset markers
# From <https://wiki.archlinux.org/title/mutt#Speed_up_folders_switch>. Don't pause
# to show info messages (for example when opening another folder). See
# <https://dev.mutt.org/doc/manual.html#sleep-time>.
set sleep_time=0
# Check for new mail once per minute, 12 times less often than the default. Mutt lags
# every time it checks for new mail. Lag once a minute is much more tolerable than lag
# every 5 seconds. "All mail clients suck. This one just sucks less."
set mail_check=60
# Configure GnuPG.
set pgp_use_gpg_agent
set pgp_auto_decode
set pgp_show_unusable=no
# Use command substitution to source the first available GnuPG configuration file and
# don't complain if there is none. The first and third files are installed by the
# official [Mutt package][1] of Arch Linux and are identical as of 2017-07-25. The
# [NeoMutt package from Arch's community repository][2] includes the fourth file. On
# Ubuntu, we have `/etc/Muttrc.d/gpg.rc`. Also see [3] and [4].
#
# XXX: I think Bash-specific functionality cannot be used here (Bash is probably invoked
# as sh).
#
# TODO: all this appears to be redundant on Ubuntu. Mutt always reads `/etc/Muttrc`
# (before `~/.mutt/muttrc`) which sources `/etc/Muttrc.d/gpg.rc` (and all other `.rc`
# files in `/etc/Muttrc.d`). See [5].
#
# From /var/log/pacman.log:
# [2014-03-23 01:32] [PACMAN] Running 'pacman -S mutt'
# [2014-03-23 01:32] [ALPM-SCRIPTLET]
# [2014-03-23 01:32] [ALPM-SCRIPTLET] ==> For GPG support, add the following to your muttrc:
# [2014-03-23 01:32] [ALPM-SCRIPTLET] ==> source /etc/Muttrc.gpg.dist
# [2014-03-23 01:32] [ALPM-SCRIPTLET]
#
# [1]: https://www.archlinux.org/packages/extra/x86_64/mutt/files/
# [2]: https://www.archlinux.org/packages/community/x86_64/neomutt/
# [3]: https://wiki.archlinux.org/title/Mutt#Encrypt_and_sign_mail_.28GnuPG.29
# [4]: https://dev.mutt.org/trac/wiki/ConfigTricks
# [5]: https://dev.mutt.org/doc/manual.html#configuration-files
source `for file in /etc/Muttrc.gpg.dist /etc/Muttrc.d/gpg.rc \
/usr/share/doc/mutt/samples/gpg.rc \
/usr/share/doc/neomutt/samples/gpg.rc /dev/null; do \
if [ -f "$file" ] || [ "$file" = /dev/null ]; then \
echo "$file"; \
break; \
fi \
done`
# We need to change some variables from Muttrc.gpg.dist to also include
# "--pinentry-mode loopback" and/or "--encrypt-to 0xC4592C12" (so I can read my own sent
# mail). Other than that, the commands are the same as in /etc/Muttrc.gpg.dist.
set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0 --pinentry-mode loopback? --no-verbose --quiet --batch --output - %f"
set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0 --pinentry-mode loopback? --no-verbose --quiet --batch --output - %f"
set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0 --pinentry-mode loopback? --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0 --pinentry-mode loopback? --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="$PGPEWRAP gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xC4592C12 -- -r %r -- %f"
set pgp_encrypt_sign_command="$PGPEWRAP gpg %?p?--passphrase-fd 0 --pinentry-mode loopback? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xC4592C12 -- -r %r -- %f"
set crypt_autosign # Always attempt to cryptographically sign outgoing messages.
set pgp_sign_as="C4592C12"
source ~/.config/neomutt/per-recipient-rules
set abort_nosubject=no
set abort_unmodified=no
set alias_file="~/.config/neomutt/aliases"
source $alias_file
# Cache message headers here. This takes very little space and makes opening large
# folders much faster. See <file:///usr/share/doc/neomutt/manual.html#header-caching>.
set header_cache=~/.config/neomutt/cache/headers/
# Make things faster at the cost of a negligible amount of disk space. See
# <file:///usr/share/doc/neomutt/manual.html#body-caching>.
set message_cachedir=~/.config/neomutt/cache/
# Like GooBook, Khard is a Python program, and it's not fast enough. TODO: maybe check
# out <https://github.com/pimutils/mates.rs>.
set query_command="khard email --parsable '%s'"
# The editor menu is "command-line mode", i.e., what you when hitting colon. See
# <file:///usr/share/doc/neomutt/manual.html#editor-map>.
bind editor <Tab> complete-query
# Based on <https://wiki.archlinux.org/title/Mutt#Viewing_HTML>. TODO: add a keyboard
# macro like the one in the ArchWiki article but for viewing HTML attachments with Lynx?
set mailcap_path="~/.config/neomutt/mailcap"
# When a message contains both plain text and HTML, prefer viewing plain text.
alternative_order text/plain text/html
# When an HTML attachment doesn't have a plain text alternative, use Lynx (which is
# defined as a MIME viewer for HTML in my mailcap file) to automatically convert the HTML
# to text and display the text in the pager. See [1]. Note: most HTML mail I get
# contains an alternative plain text attachment, but this is often less readable than the
# result of rendering the HTML attachment with Lynx would be. TODO: it may therefore be
# preferable to drop the `alternative_order` command.
# [1]: https://dev.mutt.org/doc/manual.html#auto-view
auto_view text/html
# Display text representations of any attached PDFs in the pager using `pdftotext`
# (specified in the mailcap file).
auto_view application/pdf
# Customize the message [index format][]. Use the [folder-hook][] command and the
# [cond-date patch][] to keep it concise. The formats used for date and time are
# derivative of [ISO 8601][]. See printf(3) and strftime(3).
# [index format]: http://www.mutt.org/doc/manual/#index-format
# [folder-hook]: http://www.mutt.org/doc/manual/#folder-hook
# [cond-date patch]: http://www.mutt.org/doc/manual/#folder-hook
# [ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601
folder-hook . "set index_format='%4C %Z %<[y?%<[m?%<[d?%[ %H:%M]&%[ %a %d]>&%[ %m-%d]>&%[%y-%m-%d]> %-40.40a %s%* %4c'"
folder-hook [Ss]ent "set index_format='%4C %Z %<[y?%<[m?%<[d?%[ %H:%M]&%[ %a %d]>&%[ %m-%d]>&%[%y-%m-%d]> %-40.40t %s%* %4c'"
# Customize the status line at the bottom. The format string reduces the amount of
# information compared to the default and doesn't use hyphens for padding. See
# <http://www.mutt.org/doc/manual/#status-format>.
set status_format="%f%?V?/%V? [%m%?M?, %M shown?%?n?, %n new?%?o?, %o old?%?d?, %d deleted?%?F?, %F flagged?%?t?, %t tagged?%?p?, %p postponed?] %> %P"
# I don't think any of the information we can show in the status line while in the compose
# menu is useful (see <file:///usr/share/doc/neomutt/manual.html#compose-format>). Also
# get rid of the hyphens again.
set compose_format=
# Customize the status line shown when reading a message (the status line for the pager).
# See <https://dev.mutt.org/doc/manual.html#pager-format>.
set pager_format="%s%* %P"
# See <file:///usr/share/doc/neomutt/manual.html#attach-format> and
# <file:///usr/share/doc/neomutt/manual.html#nested-if>. The "%u%D" part of the default
# format string is about whether an attachment was deleted or is marked for deletion. I
# don't delete attachments, so I dropped it. TODO: can we use color and drop "%t"?
set attach_format="%T%?t?*?%<d?%d%> [%m/%M, %e%?C?, %C?] %4s&[%m/%M]%> [%e%?C?, %C?] %4s>"
# Hide the line showing a few key bindings that's normally at the top of the window. See
# <http://www.mutt.org/doc/manual/#help>.
set nohelp
# Color Scheme
# Based on colors used by [jellybeans.vim](https://github.com/nanotech/jellybeans.vim) and
# [jellyjam.vim](https://github.com/meribold/jellyjam.vim) in 256-color terminals.
# `color0` to `color15` are those defined in `Xresources`. `color16` to `color255` should
# be these: <https://commons.wikimedia.org/wiki/File:Xterm_256color_chart.svg>. See
# <file:///usr/share/doc/mutt/manual.html#color>.
# <object> <fg> <bg>
color attachment yellow color0
color error red color0
color hdrdefault color8 color0 # Default color of the message header in the pager.
color indicator color15 red
color markers red color0 # The + at the beginning of wrapped lines in the pager.
color message white color0
color normal white color0
color prompt white color0
color quoted color8 color0
color quoted1 color8 color0
color quoted2 color8 color0
color quoted3 color8 color0
color quoted4 color8 color0
color quoted5 color8 color0
color quoted6 color8 color0
color quoted7 color8 color0
color quoted8 color8 color0
color quoted9 color8 color0
color search default magenta
color signature color8 color0
color status black blue
color tilde default color0 # Used to pad blank lines in the pager.
color tree default color0
# Regexp patterns for the message header.
color header red color0 ^From
color header red color0 ^Subject
# Color the index using patterns. See <https://dev.mutt.org/doc/manual.html#patterns>.
# XXX: only one color command is ever applied to a line of the index and it's the one
# listed last here. This means we can't set a background color and a foreground color
# from separate patterns.
color index red color0 "~z 262144-" # bigger than 256 KiB
color index color8 color0 ~u # addressed to a subscribed mailing list
color index cyan color0 ~g # signed
color index blue color0 ~G # encrypted
color index color8 default ~P # from me
# TODO: it would be nice if the background color from this pattern could be active at the
# same time as another pattern's foreground color.
color index default color234 ~v # part of a collapsed thread
color index green color0 ~N # new
color index yellow color0 ~T # tagged
color index color8 color0 ~D # deleted
color sidebar_divider blue default
# Key Bindings
# Vim-ish
bind index gj next-entry
bind index gk previous-entry
bind index,browser gg first-entry
bind index,browser G last-entry
bind index,pager,browser previous-line
bind index,pager,browser next-line
bind index,pager,browser half-up
bind index,pager,browser half-down
bind pager j next-line
bind pager k previous-line
bind pager gg top
bind pager G bottom
bind index zb current-bottom
bind index zz current-middle
bind index zt current-top
bind pager,attach,browser,query exit
# TODO!
# bind index N search-opposite
# bind generic N search-opposite
# Less-inspired
bind index,pager,browser u half-up
bind index,pager,browser d half-down
# Gmail-esque
bind index,pager \# delete-message
bind index,pager c mail
bind index o display-message
bind index,browser,attach x tag-entry
bind pager x tag-message
bind index,pager s flag-message
bind index,pager a group-reply
bind index,pager v save-message
# macro index,pager v "<save-message>?<toggle-mailboxes>" ""
bind index I toggle-new
bind index U toggle-new
bind pager U mark-as-new
macro index,pager gc "<shell-escape>$BROWSER https://contacts.google.com<return>" \
"open Google Contacts in Firefox"
# Mutt-y (similar to Mutt's defaults)
bind index M middle-page # I'm pretty sure this didn't use to be necessary? Anyway,
# NeoMutt's default keybinding for M in the index menu apparently
# is `show-log-messages`.
bind index L bottom-page # Provided by default in "generic" context but overridden. M and
# H are Vim-ish by default as well.
bind pager <Space> half-down
bind pager - half-up
bind browser S unsubscribe
bind index,pager V view-attachments
# Other
bind index,pager O edit
bind index <Tab> collapse-thread
# `<BackTab>` is Shift+Tab (can be found with the `what-key` function).
bind index <BackTab> collapse-all
# By default, <Tab> is bound to this function. See
# <https://dev.mutt.org/doc/manual.html#tab-index-bindings>.
bind index <Space> next-new-then-unread
# Search everything and search on the server by default.
macro index / <search>=B\
macro index l <limit>=B\
macro index g/ "<shell-escape>$BROWSER file:///usr/share/doc/neomutt/manual.html#patterns<return>"
bind generic * tag-entry
bind index,pager \\ sidebar-toggle-visible
bind index,pager \` sidebar-toggle-visible
# TODO.
# bind generic \; enter-command
# These functions aren't available in the attachment menu (`bind index,pager,attach` isn't
# possible). The best we can do is unbind the bracket keys in screens/menus/contexts in
# which we can't get the desired behavior.
bind index,pager ] sidebar-next
bind index,pager [ sidebar-prev
bind index,pager > sidebar-open
# We can't toggle the sidebar using the <sidebar-toggle-visible> function in some contexts
# (e.g. the "compose" context). The following, OTOH, seems to work everywhere.
bind index,pager < sidebar-toggle-visible
macro generic < "<enter-command>toggle sidebar_visible<enter>" \
"make the sidebar (in)visible"
# vim: nowrap