Config

~/.config/mutt/muttrc

Rina Kawakita 2019. 12. 30. 23:46

~/.config/mutt/muttrc

## https://wiki.archlinux.org/index.php/Mutt

### Account -------------------------------------------------------------------------------------------------
## ACCOUNT1
source ~/.config/mutt/accounts/personal
folder-hook Personal/* source ~/.config/mutt/accounts/personal
#folder-hook /home/nietz/Mail/Personal/inbox source ~/.config/mutt/accounts/personal

## ACCOUNT2
source ~/.config/mutt/accounts/work
folder-hook Work/*     source ~/.config/mutt/accounts/work
#folder-hook /home/nietz/Mail/Work/inbox source ~/.config/mutt/accounts/work

## ACCOUNT3
source ~/.config/mutt/accounts/ultra
folder-hook Ultra/*     source ~/.config/mutt/accounts/ultra
#folder-hook /home/nietz/Mail/Work/inbox source ~/.config/mutt/accounts/work

# Personal is default inbox
set spoolfile       = "+Personal/INBOX"


### Directories and commands --------------------------------------------------------------------------------
set alias_file       = ~/.config/mutt/alias         # alias file
set mailcap_path     = ~/.config/mutt/mailcap       # w3m html viewing
#set header_cache     = ~/.config/mutt/cache/headers # where to store headers
#set message_cachedir = ~/.config/mutt/cache/bodies  # where to store bodies

## Store message headers locally to speed things up.
# If hcache is a folder, Mutt will create sub cache folders for each account which may speeds things up even more.
set header_cache     = ~/.cache/mutt

## Store messages locally to speed things up, like searching message bodies.
# Can be the same folder as header_cache.
# This will cost important disk usage according to your e-mail amount.
set message_cachedir = ~/.cache/mutt

set tmpdir           = ~/.cache/mutt/temp          # where to keep temp files

set certificate_file = ~/.config/mutt/certificates  # where to store certs
set signature        = ~/.config/mutt/sig           # my signature file
set editor='vim + -c "set textwidth=128" -c "set wrap" -c "set nocp" -c "set spell spelllang=en" -c "?^$"'
set sig_on_top       = yes


### Main options --------------------------------------------------------------------------------------------
set mbox_type       = Maildir           # mailbox type
set folder          = ~/Mail            # mailbox location
set timeout         = 3                 # idle time before scanning
set mail_check      = 0                 # minimum time between scans
set sort_alias      = alias             # sort alias file by alias
set reverse_alias                       # show names from alias file in index
unset move                              # gmail does that
set smart_wrap = yes
set allow_ansi = yes
set delete                            # don't ask, just do
unset confirmappend                   # don't ask, just do!
set quit                              # don't ask, just do!!
unset mark_old                        # read/new is good enough for me
set beep_new = yes                    # bell on new mails
set check_new = yes

set pipe_decode                       # strip headers and eval mimes when piping
set thorough_search                   # strip headers and eval mimes before searching
set send_charset="us-ascii:utf-8"
#set charset="utf-8:cp949"
set mail_check_stats = yes

set sleep_time = 0


### Status Bar ----------------------------------------------------------------------------------------------
set status_chars  = " *%A"
#set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
#set status_format = " [ Folder: %f ] ████ %r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ███%>░%?p?( %p postponed )?███"
set status_format = " [ Folder: %f ] ████ %r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ▊▊▊%>▊%?p?( %p postponed )?▊▊▊"
set status_on_top = no 
color status red default


### Header Options -------------------------------------------------------------------------------------------
set hdrs=yes

unignore from: to: cc: date: subject:   # show only these
unhdr_order *                           # some distros order things by default
hdr_order date: from: to: cc: subject:  # and in this order


#### index optionsa ------------------------------------------------------------------------------------------
# set sort              = threads                     # like gmail 
set sort              = reverse-last-date-received  # like gmail
set uncollapse_jump                                 # don't collapse on an unread message 
set sort_re                                         # thread based on regex
set reply_regexp      = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"


### Pager options -------------------------------------------------------------------------------------------
set pager_context     = 3
set pager_index_lines = 5  # number of index lines to show 
set pager_context     = 35  # number of context lines to show
set pager_stop        = yes # 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 markers = no             # no ugly plus signs
auto_view text/html         # view html automatically
alternative_order text/html text/enriched text/plain
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"


### Formats -------------------------------------------------------------------------------------------------
set date_format     = "[%d/%m/%y] [%I:%M%P]"
set index_format    = "%3C [%Z] %D %-20.18F ▊   %s"    # //
set alias_format    = "%4n %t %-20a %r"


### Composing mail ------------------------------------------------------------------------------------------
set realname        = "Dae Hyeon"          # who am i?
set envelope_from                        # which from?
set sig_dashes                           # dashes before my sig... sweet
set edit_headers                         # show headers when composing
set fast_reply                           # skip to compose when replying
set sendmail_wait   = 1                  # wait for sending... to complete
set askcc                                # ask for CC:
set fcc_attach                           # save attachments with the body
unset mime_forward                       # forward attachments as part of body
set forward_format  = "Fwd: %s"          # format for subject when forwarding
set forward_decode                       # decode when forwarding
set attribution     = "On %d, %n wrote:" # set the attribution
set reply_to                             # reply to Reply to: field
set reverse_name                         # reply as whomever it was to
set include                              # include message in replies
set forward_quote                        # include message in forwards
set beep_new
set ispell = "aspell -e -c"
#set skip_quoted_offset = 3


### Headers to show ------------------------------------------------------------------------------------------
# ignore *                                 # ignore all headers
unignore from: to: cc: date: subject:   # show only these
hdr_order from: to: cc: date: subject:  # and in this order


### Mail Boxes ----------------------------------------------------------------------------------------------
mailboxes +--[Ultra]----------------------------------
mailboxes +Ultra/INBOX +Ultra/[Gmail].&1zTJwNG1- +Ultra/[Gmail].&vMTUXNO4ycDVaA- +Ultra/[Gmail].&vPSwuNO4ycDVaA- +Ultra/[Gmail].&wqTTONVo- +Ultra/[Gmail].&x4TC3Lz0rQDVaA- +Ultra/[Gmail].&yATMtLz0rQDVaA- +Ultra/[Gmail].&yRHGlA-
mailboxes +--[Personal]------------------------------
mailboxes +Personal/INBOX +Personal/Trash +Personal/[Gmail].All\ Mail +Personal/[Gmail].Sent\ Mail 
mailboxes +--[Work]----------------------------------
mailboxes +Work/INBOX +Work/Trash +Work/[Gmail].All\ Mail +Work/[Gmail].Sent\ Mail 

# progress bar patch
#color progress white magenta

### Always sourced ------------------------------------------------------------------------------------------
source $alias_file              # required for functionality
source ~/.config/mutt/colors    # source colors file
source ~/.config/mutt/sidebar.muttrc   # any muttng options are here


### Bindings
#------------------------------------------------------------------------------------------------------------
# these just give me headaches
bind index,pager \#    noop
bind index i           noop
bind index,pager g     noop                     # for neomutt

bind pager q           exit
bind pager /           search
bind pager         previous-line
bind pager       next-line
bind pager k           previous-line
bind pager j           next-line
bind pager gg          top
bind pager G           bottom
bind index gg          first-entry
bind index G           last-entry
bind pager K           previous-undeleted
bind pager J           next-undeleted
bind index K           previous-unread
bind index J           next-unread
bind index,pager R     group-reply


### Macros --------------------------------------------------------------------------------------------------
macro index \Cr "N" "mark tagged messages as read"
macro index m "T~N;WNT~O;WO\CT~T" "mark all messages read"
#macro index B   "~b "                "search message bodies"
macro index I   "!"   "go to Inbox"

# save a decoded copy in ~
macro index P   "cat > ~/"    "save message as"

## Viewing content
# \cb embedded and redefine
# ~/.urlview file  --> luakit
macro pager \cb 'urlview' 'Follow links with urlview'

# quick-sync ~/Mail immediately with offlineimap
macro index Z   "/usr/bin/offlineimap -q -o" "sync IMAP"

# for browser charset problem
# https://dev.mutt.org/trac/wiki/MuttFaq/Charset
charset-hook ^us-ascii$ cp949
charset-hook ^iso-8859-1$ cp949
#charset-hook ^euc-kr$ cp949
set assumed_charset="cp949"
set rfc2047_parameters

# 1. for korean charset encoding problem
# for attach file. mailcap.  equal to "m" key --> luakit
bind attach  view-mailcap

# 2. for korean charset encoding problem
#macro attach  "cat >~/.cache/mutt/mail.html && qutebrowser --target tab ~/.cache/mutt/mail.html &>/dev/null && rm ~/.cache/mutt/mail.html"
macro attach 'V' "cat >~/.cache/mutt/mail.html && luakit ~/.cache/mutt/mail.html &>/dev/null && rm ~/.cache/mutt/mail.html"

 

~/.config/mutt/mailcap

audio/*                 ; /usr/bin/xdg-open %s

image/*                 ; /usr/bin/xdg-open %s

application/msword      ; /usr/bin/xdg-open %s
#application/msword      ; antiword '%s'; copiousoutput; description=Word Document; nametemplate=%s.doc

application/postscript  ; /usr/bin/xdg-open %s

#application/pdf         ; /usr/bin/xdg-open %s
application/pdf         ; zathura '%s' -; copiousoutput; description=PDF Document; nametemplate=%s.pdf

application/haansofthwp ; ~/.local/bin/hwpview '%s'; copiousoutput; description=HWP Document; nametemplate=%s.hwp


#text/html               ; /usr/bin/xdg-open %s ; copiousoutput
# for attached file correct encoding
#text/html               ; vivaldi-stable %s ; test=test -n "$DISPLAY"; needsterminal;
#text/html; cat %s | /home/nietz/.xmonad/scripts/pipe2w3m.sh
text/html               ; luakit %s &>/dev/null; test=test -n "$DISPLAY"; needsterminal;
# auto view using w3m
text/html               ; w3m -I %{charset} -T text/html; copiousoutput;

 

~/.config/mutt/colors

# vim: filetype=muttrc 

# set default
color normal        default         default

# main colors
color tree          magenta         default
color error         brightred       default
color message       brightgreen     default
color status        default         black
color indicator     default         magenta

# color all ML mails
color index         cyan            default     "~u"

# uncolor certain messages
#uncolor index "~E"
#uncolor index "~P"
#uncolor index "~C @.com"
#uncolor index "~N ~u"
#uncolor index "~N !~u" 
#uncolor index "~T"
#uncolor index "~D"

# and recolor them appropriately
#color index      brightred     default "~E"
#color index      brightyellow  default "~P"
#color index      green         default "~C @.com"
#color index      red           default "~N ~u"  # new ML mail
#color index      brightred     default "~N !~u" # new non-ML mail
#color index      brightgreen   default "~T"
#color index      white         red     "~D"
#color index default         default   "~N !~T !~F !~p !~P"



#color index_author  brightcyan      default     ".*"
#color index_date    brightblue      default
#color index_number  white           default
#color index_size    blue            default
#color index_flags   white           default     "~F"


color index         green           default     "~A"                        # all messages
color index         brightblack     default     "~E"                        # expired messages
color index         brightblue      black       "~N"                        # new messages
color index         brightblack     default     "~O"                        # old messages
color index         brightyellow    default     "~Q"                        # messages that have been replied to
color index         yellow          default     "~R"                        # read messages
color index         brightblue      default     "~U"                        # unread messages
color index         brightyellow    default     "~U~$"                      # unread, unreferenced messages
#color index         color241        default     "~v"                        # messages part of a collapsed thread
color index         default         default     "~v"                        # messages part of a collapsed thread
color index         magenta         default     "~P"                        # messages from me
color index         red             default     "~p!~F"                     # messages to me
color index         magenta         default     "~N~p!~F"                   # new messages to me
color index         brightblue      default     "~U~p!~F"                   # unread messages to me
color index         cyan            default     "~R~p!~F"                   # messages to me, and read
color index         brightyellow    default     "~F"                        # flagged messages
color index         brightgreen     default     "~F~p"                      # flagged messages to me
color index         brightgreen     default     "~N~F"                      # new flagged messages
color index         brightgreen     default     "~N~F~p"                    # new flagged messages to me
color index         brightgreen     default     "~U~F~p"                    # new flagged messages to me
#color index         brightred       cyan        "~D"                        # deleted messages
color index         cyan           blue        "~D"                        # deleted messages
#color index         color245        default     "~v~(!~N)"                  # collapsed thread with no unread
color index         default         default     "~v~(!~N)"                  # collapsed thread with no unread
#color index         color136        default     "~v~(~N)"                   # collapsed thread with some unread
color index         default         default     "~v~(~N)"                   # collapsed thread with some unread
#color index         color64         default     "~N~v~(~N)"                 # collapsed thread with unread parent
color index         default         default     "~N~v~(~N)"                 # collapsed thread with unread parent

# set up the headers
color header     brightmagenta default "^from:"
color header     green         default "^to:"
color header     yellow        default "^cc:"
color header     blue          default "^date:"
color header     cyan          default "^subject:"

# message bodies
color attachment brightblack   default
color search     red           brightblack
color signature  cyan          default
color tilde      brightblack   default
color hdrdefault yellow        default
color bold       brightyellow  default

# urls
color body       brightblue    default "(^|<| )mailto:[^ ]+@[^ ]( |>|$)"
color body       brightblue    default "(^|<| )(http|https|ftp|file|telnet|news|finger)://[^ ]+( |>|$)"
# urls regex
color body       brightblue    default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
# email regex
color body       brightblue    default "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])"
color body       brightblue    default "(my regex 1)"
color body       brightcyan    default "(my regex 2)"
color body       brightred     default "(my regex 3|my regex 4|my regex 5)"

# smileys, the right way and the backward-ass euro way
color body       brightmagenta default "(^| )+(|[<>|])[8;:](|[^ ])[)(/|DOPS]( |$)+"
color body       brightmagenta default "(^| )+[)(/|DOPS](|[^ ])[8;:](|[<>|])( |$)+"

# *bold*, _underline_, and /italic/
color body       brightcyan    default "(^| )\\*[^ ]+\\*( |$)"
color body       brightcyan    default "(^| )_[^ ]+_( |$)"
color body       brightcyan    default "(^| )/[^ ]+/( |$)"

# quote blocks
color quoted     magenta       default
color quoted1    cyan          default
color quoted2    green         default
color quoted3    yellow        default
color quoted4    brightmagenta default
color quoted5    brightgreen   default
color quoted6    brightyellow  default
color quoted7    brightcyan    default

# PGP messages
color body      brightgreen    default "^gpg signature OK.*"
color body      yellow         default "^gpg "
color body      brightred      default "^gpg signature NOT OK. *"

 

~/.config/mutt/sidebar.muttrc

# This is a complete list of sidebar-related configuration.

# --------------------------------------------------------------------------
# VARIABLES - shown with their default values
# --------------------------------------------------------------------------

# Should the Sidebar be shown?
#set sidebar_visible = no
set sidebar_visible = yes

# How wide should the Sidebar be in screen columns?
# Note: Some characters, e.g. Chinese, take up two columns each.
#set sidebar_width = 20
set sidebar_width = 45

# Should the mailbox paths be abbreviated?
set sidebar_short_path = no

# When abbreviating mailbox path names, use any of these characters as path
# separators.  Only the part after the last separators will be shown.
# For file folders '/' is good.  For IMAP folders, often '.' is useful.
set sidebar_delim_chars = '/.'

# If the mailbox path is abbreviated, should it be indented?
set sidebar_folder_indent = no

# Indent mailbox paths with this string.
set sidebar_indent_string = '  '

# Make the Sidebar only display mailboxes that contain new, or flagged,
# mail.
set sidebar_new_mail_only = no

# Any mailboxes that are whitelisted will always be visible, even if the
# sidebar_new_mail_only option is enabled.
sidebar_whitelist '/home/user/mailbox1'
sidebar_whitelist '/home/user/mailbox2'

# When searching for mailboxes containing new mail, should the search wrap
# around when it reaches the end of the list?
set sidebar_next_new_wrap = no

# The character to use as the divider between the Sidebar and the other Mutt
# panels.
# Note: Only the first character of this string is used.
#set sidebar_divider_char = '|'
set sidebar_divider_char = ' | '

# Enable extended buffy mode to calculate total, new, and flagged
# message counts for each mailbox.
set mail_check_stats

# Display the Sidebar mailboxes using this format string.
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'

# Sort the mailboxes in the Sidebar using this method:
#       count    - total number of messages
#       flagged  - number of flagged messages
#       new      - number of new messages
#       path     - mailbox path
#       unsorted - do not sort the mailboxes
set sidebar_sort_method = 'unsorted'

# --------------------------------------------------------------------------
# FUNCTIONS - shown with an example mapping
# --------------------------------------------------------------------------

# Move the highlight to the previous mailbox
bind index,pager \Cp sidebar-prev

# Move the highlight to the next mailbox
bind index,pager \Cn sidebar-next

# Open the highlighted mailbox
bind index,pager \Co sidebar-open

# Move the highlight to the previous page
# This is useful if you have a LOT of mailboxes.
bind index,pager  sidebar-page-up

# Move the highlight to the next page
# This is useful if you have a LOT of mailboxes.
bind index,pager  sidebar-page-down

# Move the highlight to the previous mailbox containing new, or flagged,
# mail.
bind index,pager  sidebar-prev-new

# Move the highlight to the next mailbox containing new, or flagged, mail.
bind index,pager  sidebar-next-new

# Toggle the visibility of the Sidebar.
bind index,pager B sidebar-toggle-visible

# --------------------------------------------------------------------------
# COLORS - some unpleasant examples are given
# --------------------------------------------------------------------------
# Note: All color operations are of the form:
#       color OBJECT FOREGROUND BACKGROUND

# Color of the current, open, mailbox
# Note: This is a general Mutt option which colors all selected items.
#color indicator cyan black
color sidebar_indicator black magenta

# Color of the highlighted, but not open, mailbox.
color sidebar_highlight default magenta

# Color of the divider separating the Sidebar from Mutt panels
#color sidebar_divider color8 black
color sidebar_divider black black

# Color to give mailboxes containing flagged mail
color sidebar_flagged red black

# Color to give mailboxes containing new mail
#color sidebar_new green black
color sidebar_new blue black

# Ordinary color : Only for neomutt
color sidebar_ordinary cyan default

# --------------------------------------------------------------------------

# vim: syntax=muttrc

 

~/.config/mutt/accounts/personal

set from      = "uberxxxxxxxxxx@gmail.com"
set sendmail  = "/usr/bin/msmtp -a personal"
set mbox      = "+Personal/archive"
set postponed = "+Personal/drafts"

color status cyan default

macro index D \
    "+Personal/Trash" \
    "move message to the trash"

macro index S \
    "+Personal/Spam"  \
    "mark message as spam"

 

~/.config/mutt/accounts/ultra

set from      = "ultrxxxxxxxxxx@gmail.com"
set sendmail  = "/usr/bin/msmtp -a ultra"
set mbox      = "+Work/archive"
set postponed = "+Work/drafts"

color status black cyan

macro index D \
    "+Work/Trash" \
    "move message to the trash"

macro index S \
    "+Work/Spam"  \
    "mark message as spam"

 

~/.config/mutt/accounts/work

set from      = "frixxxxxxxxxx@gmail.com"
set sendmail  = "/usr/bin/msmtp -a work"
set mbox      = "+Work/archive"
set postponed = "+Work/drafts"

color status black cyan

macro index D \
    "+Work/Trash" \
    "move message to the trash"

macro index S \
    "+Work/Spam"  \
    "mark message as spam"