# $Id: mutt.bind,v 1.1 2003/06/19 03:11:59 dope Exp dope $
#
# This file is mainly based upon »The ultimative Key-Bindings for Mutt«
# (Version 1.35), written by Roland Rosenfeld. You can find the original
# version of this file under . I was very
# fond of this bindings as I see them the first time, so i decided to take
# them into my setup (see '/usr/local/doc/mutt/html/manual-6.html#ss6.4' for
# details.
#
# The command 'bind' binds the given key for the given map to the given
# function.
# Valid maps are:
# 'generic', 'alias', 'attach' 'browser', 'editor', 'index', 'compose',
# 'pager', 'pgp', 'postpone' and 'mix'.
#
# Valid Strings are:
# '\t', '', '\t', '\n', '\e', '', '', '', '',
# '', '', '', '', '', '',
# '', '', '', '', '' and ''.
# Generic key bindings.
# Quick change Mailfolders
macro generic E "/var/spool/mail/dope" "Show my local mailbox"
macro generic I "!" "Go to =INBOX"
# Show documentation when pressing
macro generic "!w3m ~/.mutt/doc/manual.html\n" "Show Mutt documentation"
# toggle TOFU protection with ESC-0 and ESC-1
macro generic \e0 ":unset display_filter\n" "Turn TOFU protection off"
macro generic \e1 ":set display_filter='t-prot -acelmtS -Mmutt --spass -L$HOME/.mutt/mlfooters -A$HOME/.mutt/adfooters'\n" "Turn TOFU protection on"
# Bindings for INDEX
# Next/Prev/Del/Flag - Message
bind index previous-entry
bind index next-entry
bind index delete-message
bind index \Cw flag-message
bind editor "\e" kill-word
macro index \eb '/~b ' 'Search in message bodies'
macro index "?" "Show mailboxes"
macro index _ "?" "Show Newsgroups"
# Quick change Mailfolders
macro index E "/var/spool/mail/dope" "Show my local mailbox"
macro index I "!" "Go to =INBOX"
macro index \ej "~/nslrn/Posts" "Show my Usenet postings"
# Show documentation when pressing
macro index " !w3m ~/.mutt/doc/manual.html\n" "Show Mutt documentation"
# SPAM? AOL? Trojans? $LUSER? welcome in my killfile (requires mailfilter ()).
macro index "| ~/.mutt/kill-from.sh\n" "Add Sender to Killfile"
macro index "| ~/.mutt/kill-sub.sh\n" "Add Subject to Killfile"
# Answers of messages from me are highlightet (F2) or not (F3)
macro index ':color index brightyellow default "!~f strcat@gmx.net ~b strcat"' 'Highlight ON for answers to me'
macro index ':uncolor index brightyellow default "!~f strcat@gmx.net ~b strcat"' 'Highlight OFF for answers to me'
# reload ~/.muttrc
macro index "source ~/.muttrc" "Reload ~/.muttrc"
# Mark all messages as read (useful for NG's ;))
macro index M "T \n;WN^t \n" "Mark all messages read"
# *I* *HATE* *OUTLOOK*
macro index \eK '~h "X-Mailer: Microsoft Outlook"' "Mark all Outlook-Messages as read"
# Main menu arrows
bind index display-message
bind pager exit
macro index "?" "Browser"
# show only new / all messages
macro index .n "l~N\n" "Show only new messages"
macro index .a "l~A\n" "Show all messages"
# Sho folder with new mails
macro index . "" "list mailboxes with new mail"
# Relocate deleted messages in =Trash
macro index d s=trash/trash-`date +%Y-%m`\n "Move to Trash"
# Jumping to the next mail that is still unread.
bind index \t next-unread
# use getmail for multiple POP - Accounts
macro index G "!echo 'Check for new Mails... ' ; gmail.sh 2>&1 > /dev/null &\n " "Check for new mail via getmail"
# Saving the current message into SPAM folder: spamassassin report and classify as spam
# macro index S "| sudo spamassassin --debug --report\n." "Submit message to spam-databases and train Bayes (and flag it)"
# macro index S "|/usr/bin/spamassassin -D -r" "report message to Vipul's Razor"
# macro index H "|sudo /usr/bin/sa-learn --ham --no-sync --single" "Add message to no-spam"
# According to notmuch-mutt(1)
macro index S "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\
notmuch-mutt -r --prompt search\
`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\
set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \
"notmuch: search mail"
macro index H "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\
notmuch-mutt -r thread\
`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\
set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \
"notmuch: reconstruct thread"
macro index A "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\
notmuch-mutt tag -- -inbox\
set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \
"notmuch: remove message from inbox"
# View good/bad mails
macro index "\em" "~h \"X-Spam-Flag: YES\"" "Show only SPAM"
macro index "\ef" "~h \"X-Spam-Status: No\"" "Hide SPAM"
# Tag Spam!
macro index "\eq" "~h 'X-Spam-Flag: YES'\n"
# Prints the contents of the recieved headers
macro index \eh "| ~/bin/mailhops | less -c\n" "View the path of the mail."
# Edit the Bindings And Macros File
macro index \eB "!vim ~/.mutt/mutt.bind\n:source ~/.mutt/mutt.bind\n" "Edit the bindings and macros file and reload it"
macro index \eC "!vim ~/.mutt/mutt.color\n:source ~/.mutt/mutt.color\n" "Edit the colour file and reload it"
macro index \eS "!vim ~/.mutt/mutt.scoring\n:source ~/.mutt/mutt.scoring\n" "Edit the scores file and reload it"
# Quicksearch
macro index / ":set simple_search='~f %s | ~s %s'\r"
macro index \\ ":set simple_search='~b %s'\r"
macro index \e/ ":set simple_search='~f %s | ~s %s'\r"
macro index \e\\ ":set simple_search='~b %s'\r"
# Bindings for PAGER (Message Pager)
# Jumping to the next mail that is still unread ('\t' means (Tabulator)!).
bind pager \t next-unread
# Jump to bottom of a message
bind pager ( bottom
# urlview rulez
macro pager \ew "|urlview\n"
# Change »pager_index_lines«
macro pager \Cw 'set pager_index_lines=0' "Toggle pager_index_lines to 0 lines"
macro pager \Ct 'set pager_index_lines=20' "Toggle pager_index_lines to 20 lines"
macro pager \Cb 'set pager_index_lines=10' "Toggle pager_index_lines back to default (10)"
# Prints the contents of the recieved headers
macro pager \eh "| ~/bin/mailhops | less -c\n" "View the path of the mail."
# Edit the Bindings And Macros File (~/.mutt/mutt.bind)
macro pager \eB "!vim ~/.mutt/mutt.bind\n:source ~/.mutt/mutt.bind\n" "Edit the bindings and macros file and reload it"
macro pager \eC "!vim ~/.mutt/mutt.color\n:source ~/.mutt/mutt.color\n" "Edit the colour and macros file and reload it"
macro pager \eS "!vim ~/.mutt/mutt.scoring\n:source ~/.mutt/mutt.scoring\n" "Edit the scores file and reload it"
# Rot13
macro pager r "set display_filter = \"tr a-zA-Z n-za-mN-ZA-M\"unset display_filter" "ROT13"
# Getting PGP/GnuPG-Key from server
macro pager P "!gpg --keyserver pgp.mit.edu --recv-key 0x" "Get PGP Key"
# Change folders
macro pager I "!" "Go to =INBOX"
macro pager E "/var/spool/mail/dope" "Show my local mailbox"
# Show documentation
macro pager "!w3m ~/.mutt/doc/manual.html\n" "Show Mutt documentation"
# SPAM? AOL? Trojans? $LUSER? welcome in my killfile (requires mailfilter ())
macro pager "| ~/.mutt/kill-from.sh\n" "Add Sender to Killfile"
macro pager "| ~/.mutt/kill-sub.sh\n" "Add Subject to Killfile"
# Answers of messages from me are highlightet (F2) or not (F3)
macro pager ':color index brightyellow default "!~f strcat@gmx.net ~b strcat"' 'Highlight ON for answers to me'
macro pager ':uncolor index brightyellow default "!~f strcat@gmx.net ~b strcat"' 'Highlight OFF for answers to me'
# reload ~/.muttrc
macro pager "source ~/.muttrc" "Reload ~/.muttrc"
# same in pager mode - ugly but what the hell...
macro pager \e0 ":unset display_filter; exec exit\n:exec display-message\n" "Turn TOFU protection off"
macro pager \e1 ":set display_filter='t-prot -acelmtS -Mmutt --spass -L$HOME/.mutt/mlfooters -A$HOME/.mutt/adfooters'; exec exit\n:exec display-message\n" "Turn TOFU protection on"
# blind out this fucking GPG - Header
macro pager \e4 'set display_filter="/bin/sh $HOME/bin/gpg-wrap.sh"' "Strip GPG /PGP"
macro pager \e5 'unset display_filter' "Show GPG / PGP"
# Mark all messages as read (useful for NG's ;))
macro pager M "T \n;WN^t \n" "Mark all messages read"
bind editor "\e" kill-word
bind editor delete-char
# main menus arrows
macro browser "..\n" "Upper directory"
bind browser select-entry
bind pager view-attachments
bind attach exit
bind attach view-attach
# show folders which new mails
macro pager . "" "list mailboxes with new mail"
# Defining a default directory for saving attachments to.
# The trick used here is to "jump" to the beginning of the input
# (using ^A) which leaves default value on the input.
# Then you can add the default directory, eg "~/Mail/ATTACH/".
macro attach S "~/MuttMail/Attach/" "Save attachements"
# Relocate deleted messages in =Trash
macro pager d s=trash/trash-`date +%Y-%m`\n "Move to Trash"