# -*- muttrc -*-
#
# Mutt configuration file
# 2008,  kolter <kolter@openics.org>
#
#  This file is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY
#
# Macros settings for Mutt.
#

macro   generic \em "<enter-command>source ~/.muttrc<enter>"    "Reloading Mutt's configuration"

macro   index,pager <f1>    "<change-folder> =<enter>"          "Change folder for INBOX"
macro   index,pager <f2>    "<change-folder> =.Sent<enter>"         "Change folder for Sent"
macro   index,pager <f3>    "<change-folder> =.Draft<enter>"        "Change folder for Draft"
macro   index,pager <f4>    "<change-folder> =.Spam<enter>"         "Change folder for Spam"
macro   index,pager <f5>    "<change-folder> =.Trash<enter>"        "Change folder for Trash"
macro   index,pager <f10>   "<change-folder> =<enter>"          "Change folder for INBOX"

macro   index,pager B   "<enter-command>toggle sidebar_visible<enter>"  "Toggle sidebar visibility"
macro   index,pager X   "<enter-command>toggle sidebar_newmail_only<enter>" "Toggle sidebar only new mails"
macro   index       \cx "<tag-pattern>~N|~O<enter><tag-prefix><toggle-new><tag-prefix><clear-flag>*" "Mark all new messages as read"

#macro  index,pager S   "<enter-command>unset wait_key<enter><bounce-message>spam@localhost<enter><enter-command>set wait_key<delete-message>" "Bounce message to AntiSpam (spam)"
#macro  index,pager H   "<enter-command>unset wait_key<enter><bounce-message>ham@localhost<enter><enter-command>set wait_key" "Bounce message to AntiSpam (ham)"

macro index S "<enter-command>set confirmappend=no delete=yes auto_tag=yes resolve=no<enter><clear-flag>N<clear-flag>O<save-message>=.Spam\n<sync-mailbox><enter-command>set confirmappend=yes delete=ask-yes resolve=yes<enter>"

# Search
macro index "<Esc>f" "<enter-command>unset wait_key<enter><shell-escape>read -p'Search pattern: ' search_pattern; mu find --clearlinks --linksdir ~/Mail/imap/.search --format links \$search_pattern<enter>\<change-folder-readonly>~/Mail/imap/.search\n" "Search"
macro index "<Esc>s" "<change-folder-readonly>~/Mail/imap/.search\n" "Show search results"

# labels
macro index y "<enter-command>set editor=~/.bin/mutt-edit-label\n<edit><sync-mailbox>\n<previous-undeleted><clear-flag>O<previous-undeleted><enter-command>set editor=vim\n" "Edit label(s)"
macro index \Cy "<limit>~y " "Limit view to label"
