aboutsummaryrefslogtreecommitdiffstats
path: root/.mutt/muttrc
blob: cf30a889419e14b5db6556294a2982bd8e2aafad (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
##
## Mutt configuration
##
## Weitian LI <liweitianux@gmail.com>
## 2015/02/02
##
## Reference:
## [1] The Homely Mutt
##     http://stevelosh.com/blog/2012/10/the-homely-mutt/
## [2] Mutt + offlineimap + notmuch + nottoomuch
##     http://blog.tshirtman.fr/2013/3/17/mutt-offlineimap-notmuch-nottoomuch
## [3] ArchWiki - Mutt
##     https://wiki.archlinux.org/index.php/Mutt
## [4] Using Two IMAP Accounts in Mutt
##     http://pbrisbin.com/posts/two_accounts_in_mutt
## [5] The Mutt E-Mail Client
##     http://www.mutt.org/doc/devel/manual.html
## [6] A Quick Guide to Mutt
##     http://srobb.net/mutt.html
## [7] Multi-window Mutt with Screen
##     http://op-co.de/blog/posts/mulit-window_mutt/
## [8] Github - proycon/dotfiles - mutt with tmux
##     https://github.com/proycon/dotfiles
##

### Mail boxes
source ~/.mutt/mailboxes                    # Generated by OfflineIMAP

### Mail accounts
folder-hook .               source ~/.mutt/accounts/default
folder-hook 'gmail-aly.*'   source ~/.mutt/accounts/gmail-aly
folder-hook 'gmail-li.*'    source ~/.mutt/accounts/gmail-li
folder-hook 'outlook-aly.*' source ~/.mutt/accounts/outlook-aly
folder-hook 'outlook-li.*'  source ~/.mutt/accounts/outlook-li
folder-hook 'sjtu.*'        source ~/.mutt/accounts/sjtu
folder-hook 'autistici.*'   source ~/.mutt/accounts/autistici
# Default account
source ~/.mutt/accounts/default

### Files and directories
set alias_file          = ~/.mutt/aliases
set certificate_file    = ~/.mutt/certificates
set mailcap_path        = ~/.mutt/mailcap
set history_file        = ~/.mutt/history
set header_cache        = ~/.mutt/cache/headers
set message_cachedir    = ~/.mutt/cache/bodies
set tmpdir              = ~/.mutt/tmp

### General settings
set mbox_type       = Maildir
set folder          = ~/Mail
set timeout         = 3
set mail_check      = 0
set beep_new
set wrap_search                 # searches wrap around the end
set copy                        # always save a copy of outgoing messages
set delete                      # purge deleted messages without asking
set use_from                    # always generate the `From:' header field
set quit            = ask-no    # ask for confirmation when quit mutt
set history         = 256
set save_history    = 256
set sendmail_wait   = 0         # Wait forever for sendmail to finish
unset wait_key
unset move
unset confirmappend
unset mark_old

### Compose view
set editor          = "vim +/^$/+1 -c 'set ft=mail enc=utf-8 tw=72'"
set envelope_from               # which from?
set sig_dashes                  # dashes before my 'signature'
set autoedit                    # go to the editor right away when composing
                                # set, cannot use 'send-hooks' depend on recipients
set edit_headers                # show headers when composing
set askcc                       # ask for CC:
set fcc_attach                  # save attachments with the body
set forward_format  = "Fwd: %s"
set forward_quote               # include message in forwards
set forward_decode              # decode when forwarding
set attribution     = "On %d, %n wrote:"
set fast_reply                  # skip to compose when replying
set reply_to                    # reply to 'Reply to:' field
set reverse_name                # reply as whomever it was to
set include                     # include message in replies
#set postpone                    # auto postpone message not sent when exit
#set recall                      # prompt to recall postponed messages
unset mime_forward              # forward attachments as part of body

### Headers
ignore      *
unignore    from: to: cc: bcc: date: subject: X-Label:
unhdr_order *
hdr_order   from: to: cc: date: subject: X-Label:

### Encoding
set send_charset        = "us-ascii:utf-8"
# if no charset given on incoming messages
set assumed_charset     = "iso-8859-1:gb2312:gbk:gb18030:utf-8"
set rfc2047_parameters          # to fix attachment filename encoding

### Index view
# first bang ("!") to expand month week names in the C locale
set date_format         = "!%a %m/%d %I:%M"
set index_format        = "[%Z] %d %2M %-15.15L %4c%?X?[%X]&   ? %s"
set folder_format       = "%2C %t %N %8s %f"
set sort                = threads
set sort_aux            = reverse-last-date-received
set uncollapse_jump             # don't collapse on an unread message
set sort_re                     # thread based on regex
set reply_regexp        = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"

### Status bar
set status_chars  = " *%A"
set status_format = "---[ Folder: %f %r ]---[ Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l? ]---%>-(%P)---"

### Pager
#set pager_format        = "-%S- %-20.20f %s"
set pager_index_lines   = 8     # number of index lines to show
set pager_context       = 8     # number of context lines to show
set pager_stop                  # don't go to next message automatically
set menu_scroll                 # scroll in menus
set smart_wrap                  # don't split words
set tilde                       # show tildes like in vim
set quote_regexp        = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
unset markers                   # no ugly '+' signs for wrapped lines
alternative_order       text/plain text/enriched text/html

### Key bindings
bind index          i           noop
bind index          <TAB>       sync-mailbox
bind index          <SPACE>     collapse-thread
bind index          p           recall-message
bind index          K           previous-unread
bind index          J           next-unread
bind index,browser  gg          first-entry
bind index,browser  G           last-entry
bind index,pager    R           group-reply
bind index,pager    N           search-opposite
bind index,pager    \#          noop
bind pager          i           exit
bind pager          /           search
bind pager          <UP>        previous-line
bind pager          <DOWN>      next-line
bind pager          k           previous-line
bind pager          j           next-line
bind pager          gg          top
bind pager          G           bottom
bind pager          K           previous-undeleted
bind pager          J           next-undeleted
bind attach         <RETURN>    view-mailcap
bind compose        p           pgp-menu
bind editor         <TAB>       complete-query
bind editor         ^T          complete

### Macros
macro index         q       "<sync-mailbox><change-folder>?<toggle-mailboxes>" \
        "Leaves Index to folder list"
macro index         \Cr     "<tag-prefix><clear-flag>N" \
        "mark tagged messages as read"
macro index         C       "<copy-message>?<toggle-mailboxes>" \
        "copy a message to a mailbox"
macro index         S       "<save-message>?<toggle-mailboxes>" \
        "copy a message to a mailbox"
macro index         B       "<limit>~b " \
        "search message bodies"
macro index         I       "<change-folder>!<enter>" \
        "go to Inbox"
# Save a decoded copy in ~/
macro index,pager   >       "<pipe-message>cat > ~/" \
        "save message as"
# Open in vim
macro index,pager   V       "<pipe-message>vim -c 'setlocal ft=mail buftype=nofile' -<enter>" \
        "open in vim"
# Sync mails with offlineimap
macro index,browser Z       "<shell-escape>offlineimap -o -u ttyui<enter>" \
        "offlineimap sync ..."
macro browser       q       "<exit><quit>" \
        "Exit mutt"
macro browser       <Tab>   "<toggle-mailboxes><check-new>" \
        "Check New"
macro compose       Y       pfy \
        "send mail without GPG"
# urlview
macro pager         \Cu     "<pipe-entry>urlview<enter>" \
        "Follow links with urlview"
macro pager         ';'     "<exit><tag-prefix>" \
        "q+ ;"
# notmuch
macro index         s       "<enter-command>unset wait_key<enter><shell-escape>~/.mutt/mutt-notmuch.py -G $folder/search<enter><change-folder-readonly>+search<enter>" \
        "search mail (using notmuch)"
# labels
macro index,pager   x       '<enter-command>set my_oldeditor=$editor<enter><enter-command>set editor="~/.mutt/mutt-xlabel.py"<enter><edit><previous-undeleted><clear-flag>N<sync-mailbox><enter-command>set editor=$my_oldeditor<enter>' \
        "edit X-Label"
macro index         \Cx     "<limit>~y " \
        "limit view to label"

### aliases
set sort_alias      = alias     # sort alias file by alias
set reverse_alias               # show names from alias file in index
source $alias_file              # enable auto-completion

### abook
set query_command   = "abook --mutt-query '%s'"
macro generic,index,pager \Ca "<shell-escape>abook<return>" "launch abook"
macro index,pager A "<pipe-message>abook --add-email<return>" "add the sender address to abook"

### Misc settings
## Mailing lists: lists and subscribe
set followup_to                 # generate 'Mail-Followup-To:' header field
set honor_followup_to           # 'Mail-Followup-To' header is honored
source ~/.mutt/mailinglists

## Multiplexing using tmux
# compose mail in tmux window
macro index,pager   M       '<enter-command>set my_oldeditor=$editor<enter><enter-command>set editor="cp %s %s.2; tmux new-window -a -t mutt \"~/.mutt/compose.sh %s.2\""<enter><enter-command>unset recall<enter><mail><enter-command>set editor=$my_oldeditor<enter>' \
        "mail in new tmux window"
#unset wait_key                  # already set above
# forward messages
# override the <recall-message> hotkey
macro index,pager   P       "<shell-escape>tmux new-window -a -t mutt 'mutt -F ~/.mutt/compose.rc -p'<enter>" \
        "recall postponed message in new tmux window"
# Set the editor for for editing messages in-place,
# allows re-editing before sending, e.g. for use in forwarding messages.
macro compose       E       '<enter-command>set my_oldeditor=$editor<enter><enter-command>set editor="vim"<enter><edit><enter-command>set editor=$my_oldeditor<enter>' \
        "edit message in-place"
# open mailbox listing in a new window
macro index,pager   Y       '<shell-escape>tmux new-window -a -t mutt "mutt -y"<enter>' \
        "open mailbox listing in new tmux window"

## Attachment searching and counting
source ~/.mutt/attachments

## Colors
source ~/.mutt/colors

## GnuPG
source ~/.mutt/gpg.rc

## auto view
auto_view text/html application/x-tar-gz application/x-compressed-tar \
          application/x-bzip-compressed-tar

## MIME types that should *not* be treated according to their mailcap entry
mime_lookup application/octet-stream application/X-Lotus-Manuscript

### Local Settings
source `FILE=$HOME/.muttrc.local; if [ ! -s "$FILE" ]; then FILE=/dev/null; fi; echo "$FILE"`

# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=muttrc: #