aboutsummaryrefslogtreecommitdiff
path: root/muttrc.dot.link
blob: 0375ff3f56e97542260bbcae0fcb215f01cfaf9e (plain)
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#
#      ��     file : muttrc
#   __,��       by : rhatto at riseup.net
#    \\,_O
#    /~
#

# -----------
# Color setup
# -----------
#source "~/.mutt/colors/default"
source "~/.mutt/colors/solarized/mutt-colors-solarized-dark-256.muttrc"

# --------------------
# General mutt options
# --------------------
# reset all
set tmpdir = "~/temp/mutt/misc"
set reply_to = ask-yes
set reverse_name = yes
set reverse_realname = yes
set gecos_mask = "^[^,]*"
set hidden_host = no
set hostname = "localhost"
set beep = no
set user_agent = no
set quit = yes
set read_inc = 10
set mail_check = 120
set mail_check_recent = no
set mark_old = no
set menu_scroll = no
set help = yes
set delete = yes
set charset = "utf-8"

# ----------------------
# OS Specifiques options
# ----------------------
set ispell="aspell -e -c --lang=pt_BR"
set spoolfile = "~/mail/INBOX"

# --------
# Printing
# --------

# Disable printing entirely
#bind index p noop
#bind pager p noop
#bind pager P noop

# Always ask for confirmation
set print = ask-no

# Muttprint
# See https://unix.stackexchange.com/questions/20456/pretty-print-mails-from-mutt
#     https://unix.stackexchange.com/questions/283943/printing-email-messages-from-mutt-how-to-avoid-line-break
#     https://muttprint.sourceforge.net/
#
# Display the PDF after printing it
#set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt`; \
#        muttprint -P A4 -p TO_FILE:"$f"; zathura "$f"; rm "$f"'
#
# Simply produce the PDF
# Needs additional tuning on the mutt firejail profile in order to work
#set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt muttprint.XXXX.ps`; \
#        muttprint -P A4 -p TO_FILE:"$f"; ps2pdf "$f"; echo Saved output into `basename "$f" .ps`.pdf'

# Simply output the message to a file
set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt muttprint.XXXX.txt`; \
        cat - > "$f"; echo Saved output into "$f" \
        echo You convert it to a PDF using the following command: ; \
        echo "" ; \
        echo "cat $f | muttprint -P A4 -p TO_FILE:$f.ps ; ps2pdf $f.ps"'

# ----------
# Menu index
# ----------
set thorough_search=yes
set status_format = "-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? Novas:%n?%?o? Velhas:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---"
set strict_threads = yes
set sort = threads
set sort_aux = date-received

# --------------
# Internal Pager
# --------------
set visual = ""
set sig_dashes = yes
set smart_wrap = yes
set smileys = "(>From )|(:[-^]?[][)(><}{|/DP])"
set quote_regexp = "^([ \t]*[|>:}#])+"
set pager = "builtin"
set pager_context = 0
set pager_format = "-%Z- %C/%m: %-20.20n   %s"
set pager_index_lines = 0
set pager_stop = no
set pager_index_lines=8
set markers = no
set escape = "~"
set tilde = no

# ---------
# Composing
# ---------
set editor = "vim"
set postponed = "~/temp/mutt/postponed"
set abort_unmodified = no
macro compose q "<exit> <enter>" "Postpone message"
macro compose x "<exit> n"       "Discard message"

# --------
# Replying
# --------
#set attribution = "Em %d, %n escreveu:"

# ----------
# Forwarding
# ----------
set forward_format = "Fwd: %s"

# ------------------
# Folder and Mailbox
# ------------------
set folder = "~/mail"
set record = "mail/INBOX.Sent"
set move = no
set folder_format = "%2C %t %N %f"

# Save sent messages in the current folder, so threads get your own replies
# See http://dev.mutt.org/trac/wiki/MuttFaq/Folder
#     http://www.davep.org/mutt/muttrc/folder-hooks.html
#     http://www.earth.li/~huggie/mutt/muttrc.html
#     http://rc.vc/files/mutt/folderhooks.html
#folder-hook =INBOX$ 'set record = "mail/INBOX.Sent"'
folder-hook . 'set record="^"'

# -------
# Sending
# -------
set use_from = yes
set save_address = yes
set envelope_from = yes

# -----
# Alias
# -----
set alias_file = "~/.custom/mutt/aliases"
source "~/.custom/mutt/aliases"

# ----------------------------------------
# Attached documents
#
# http://wiki.mutt.org/?MuttFaq/Attachment
# ----------------------------------------
set attach_format = "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
set attach_sep = "\n"
set attach_split = yes
macro attach W <save-entry><kill-line>~/load/
macro attach E <save-entry><kill-line>~/load/<enter>

# ----
# MIME
# ----
set rfc2047_parameters = no
set mime_forward_rest = yes
set message_format = "%s"
set mailcap_path = ".mailcap"
set mailcap_sanitize = yes
set mime_forward = no
set mime_forward_decode = no
set implicit_autoview = no

# --------
# Sendmail
# --------
set use_8bitmime = no
set sendmail = "/usr/bin/msmtp"

# ----------------------------------------------
# OpenPGP basic options
#
# http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG
# ----------------------------------------------
macro index S ":toggle pgp_verify_sig\n" # define S to toggle sig check
macro index A ":toggle pgp_autosign\n"   # define A to toggle autosign
set crypt_replysignencrypted = yes
set crypt_replyencrypt = yes
set crypt_autosign = no
set crypt_replysign = no
set pgp_verify_sig = yes
set pgp_replyencrypt = yes
set pgp_decode_command="gpg --no-verbose --quiet --batch --output - %f"
set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
set pgp_import_command="gpg --no-verbose --import -v %f"
set pgp_export_command="gpg --no-verbose --export --armor %r"
set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r"
set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r"
set pgp_good_sign="^gpg: Assinatura correta de"

# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=172960
#set pgp_getkeys_command="gpg --recv-keys %r"
set pgp_getkeys_command="gpg --search-keys %r"

# See https://a3nm.net/blog/mutt_crypt_opportunistic_encrypt.html
set crypt_opportunistic_encrypt = yes

# Mutt hangs on "Invoking S/MIME"
# See https://github.com/neomutt/neomutt/issues/3438
#
# Unsetting this might break some things
#unset crypt_use_gpgme

# -----------------------------
# OpenPGP with gpg-agent config
# -----------------------------
set pgp_use_gpg_agent = yes
set pgp_decrypt_command="gpg --no-verbose --batch --output - %f"
set pgp_sign_command="gpg --no-verbose --batch --output - --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --output - --armor --textmode --clearsign %?a?-u %a? %f"set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"

# --------------------------------
# OpenPGP without gpg-agent config
# --------------------------------
#set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
#set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
#set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --digest-algo sha256 --detach-sign --textmode %?a?-u %a? %f"
#set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --digest-algo sha256 --textmode --clearsign %?a?-u %a? %f"set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
#set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 -v --batch --output - --digest-algo sha256 --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"

# ---------
# Mailboxes
# ---------
#mailboxes $HOME/mail/inbox `echo $HOME/mail/* | sed -e "s|$HOME/mail/inbox||g"`
mailboxes `echo $HOME/mail/*`

# --------------
# Mail reception
# --------------
#macro pager z "<enter-command>unset wait_key\n!clear ; fetchmail || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
#macro index z "<enter-command>unset wait_key\n!clear ; fetchmail || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
#macro pager z "<enter-command>unset wait_key\n!clear ; getmail || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
#macro index z "<enter-command>unset wait_key\n!clear ; getmail || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
#macro pager z "<enter-command>unset wait_key\n!clear ; getmails || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
#macro index z "<enter-command>unset wait_key\n!clear ; getmails || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
macro pager z "<enter-command>unset wait_key\n!clear ; getmails-alternative || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"
macro index z "<enter-command>unset wait_key\n!clear ; getmails-alternative || [ $? -eq 1 ]\n<change-folder>=INBOX/\n<sync-mailbox><buffy-list>" "Fetch new mail"

# ----------------------------------------
# Navigation
#
# http://blog.jwcxz.com/?p=810
# http://rc.vc/files/mutt/keybindings.html
# ----------------------------------------
bind index P collapse-all
macro index n "<next-unread-mailbox>"
macro pager n "<next-unread-mailbox>"
macro index i "<exit>"
macro pager i "<exit>"
macro index F "<flag-message>"
macro pager F "<flag-message>"
macro index,pager M "T \n;WN^t \n" "Mark all messages read"
macro index,pager c "<change-folder>?<change-dir><kill-line>~/mail<enter>" "Change folder"
macro index,pager y "<change-folder>?<toggle-mailboxes>1\n\n" "Back to INBOX"
macro index,pager \' "<search>~F<enter>" "Jump to next important message"

# -------------
# Ignore fields
# -------------
ignore X
ignore Delivered-To
ignore Precedence
ignore List
ignore Errors-To
ignore In-Reply-To
ignore Importance
ignore Mail-Followup-To
ignore Organization
ignore Thread
ignore ReSent
ignore Disposition
ignore Return
ignore RT
ignore Priority
ignore DomainKey-Signature
ignore Message
ignore MIME
ignore Received
ignore References
ignore Content
ignore DKIM-Signature
ignore X-Mailer
ignore User-Agent
unignore List-Archive

# ---------
# Auto view
# ---------
auto_view text/html
auto_view application/msword
auto_view text/richtext
auto_view image/*
macro pager \cb <pipe-entry>'urlview'<enter> 'Follow links with urlview'

# ------
# Mairix
# ------
#macro index \es "<shell-escape>mairix " "Run a Mairix search"
#macro index \em "<change-folder-readonly>=INBOX.Search/\n" "Switch to Mairix virtual folder"

# ----------------------------------------------------------------------------------------
# Notmuch
# For info look at http://upsilon.cc/~zack/blog/posts/2011/01/how_to_use_Notmuch_with_Mutt
#                  https://wiki.archlinux.org/index.php/Notmuch
# ----------------------------------------------------------------------------------------
#macro browser <F8> "<enter-command>unset wait_key<enter><shell-escape>mutt-notmuch --prompt search\
#  <enter><change-dir>../.cache/<enter><search>mutt_results<enter><enter>" "search mail (using notmuch)"
#
macro index,pager <F7> "<tag-prefix><pipe-message>~/apps/utils-mail/mutt-notmuch-tag<enter>" "Tag messages (using notmuch)"

macro index,pager <F8> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<shell-escape>notmuch-mutt -r --prompt search<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch: search mail"

macro index,pager <F9> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt -r thread<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch: reconstruct thread"

macro index,pager <F6> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt tag -- -inbox<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch: remove message from inbox"

# ----------
# Bogofilter
#
# https://www.bogofilter.org/
# https://bogofilter.bogofilter.narkive.com/dLzJfNrg/training-with-maildir-mutt
# https://github.com/tjouan/bogorb/blob/master/bin/bogolearn
# https://exstrom.com/journal/comp/bogofilter.html
# ----------
macro index s "<enter-command>unset wait_key\n<tag-prefix><pipe-entry>bogofilter -MSn\n<enter-command>set wait_key\n<tag-prefix><save-entry>?"
macro pager s "<enter-command>unset wait_key\n<pipe-entry>bogofilter -MSn\n<enter-command>set wait_key\n<save-entry>?"
macro index r "<enter-command>unset wait_key\n<tag-prefix><pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<tag-prefix><reply>"
macro pager r "<enter-command>unset wait_key\n<pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<reply>"
macro index g "<enter-command>unset wait_key\n<tag-prefix><pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<tag-prefix><group-reply>"
macro pager g "<enter-command>unset wait_key\n<pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<group-reply>"
macro index l "<enter-command>unset wait_key\n<tag-prefix><pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<tag-prefix><list-reply>"
macro pager l "<enter-command>unset wait_key\n<pipe-entry>bogofilter -Mn\n<enter-command>set wait_key\n<list-reply>"
macro index X "<enter-command>unset wait_key\n<tag-prefix><pipe-entry>bogofilter -MNs\n<enter-command>set wait_key\n<tag-prefix><delete-message>"
macro pager X "<enter-command>unset wait_key\n<pipe-entry>bogofilter -MNs\n<enter-command>set wait_key\n<delete-message>"
macro index H "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n" "Learn as ham and save"
macro pager H "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n" "Learn as ham and save"

# ----------------------------------------------------------------
# Schleuder config
#
# http://schleuder2.nadir.org/contrib/schleuder-with-mutt.html
# ----------------------------------------------------------------
#color body red default "^From: .*"
#color body red default "^To: .*"
#color body red default "^Cc: .*"
#color body red default "^Date: .*"
#color body brightred default "^Enc: unenc.*"
#color body red default "^Enc: enc.*"
#color body brightred default "^Sig: [^G]?.*"
#color body red default "^Sig: Good signature.*"
#color body red default "^Resent-to: .*"
#color body brightred default "^Note: .*"

# -----------------------------------
# Schleuder config, solarized version
# -----------------------------------
color body red color234 "^From: .*"
color body red color234 "^To: .*"
color body red color234 "^Cc: .*"
color body red color234 "^Date: .*"
color body brightred color234 "^Enc: unenc.*"
color body red color234 "^Enc: enc.*"
color body brightred color234 "^Sig: [^G]?.*"
color body red color234 "^Sig: Good signature.*"
color body red color234 "^Resent-to: .*"
color body brightred color234 "^Note: .*"

# ------------------------------------------------------------------------------------------------------------------
# Multiple accounts
#
# You cycle through accounts in the message composition menu by hitting the Tab key.
#
# http://msmtp.sourceforge.net/doc/msmtp.html
# https://www.verboom.net/blog/index.html?single=20110518.0
# http://hep.itp.tuwien.ac.at/cgi-bin/dwww/usr/share/doc/muttprofile/muttprofile.html
# http://dev.mutt.org/trac/wiki/ConfigTricks#Generatingsend-hooksfromaddressesinaflattextfile
# http://www.techrepublic.com/blog/linux-and-open-source/my-number-one-reason-to-use-mutt-managing-multiple-profiles
# ------------------------------------------------------------------------------------------------------------------
macro compose <tab> "\Cx1"
macro compose \Cx& ":macro compose \\t \\Cx"

# -----------------------------------
# Sidebar: needs mutt-patched package
# -----------------------------------
#source "~/.mutt/sidebar"
set sidebar_visible=no

# -----------------------------------------------------
# Protected Headers, aka Memory Hole
#
# http://www.mutt.org/relnotes/1.12/
# https://github.com/autocrypt/protected-headers
# https://datatracker.ietf.org/doc/draft-autocrypt-lamps-protected-headers/
# https://www.ietf.org/archive/id/draft-autocrypt-lamps-protected-headers-02.txt
# -----------------------------------------------------
set crypt_protected_headers_read    = yes
set crypt_protected_headers_write   = yes
set crypt_protected_headers_save    = yes
set crypt_protected_headers_subject = "Encrypted subject"

# ------------------------------------------------------------------------
# Autocrypt
#
# https://autocrypt.org/
# https://en.wikipedia.org/wiki/Autocrypt
# http://www.mutt.org/relnotes/1.13/
# http://www.mutt.org/doc/manual/#autocryptdoc
# https://muacrypt.readthedocs.io/mutt.html (alternative implementation)
# https://neomutt.org/guide/autocryptdoc.html (alternative, using neomutt)
# ------------------------------------------------------------------------
#set autocrypt     = yes
#set autocrypt_dir = "~/.local/share/mutt/autocrypt"

# -----------------------------------------------------
# Custom configuration
#
# We keep this section after all other stuff so custom
# configuration can overwrite all defaults.
# -----------------------------------------------------
source "~/.custom/muttrc"