# These are the keybindings I currently use.

#Some real macros
macro index S <tag-prefix><save-message>? "Save tagged messages"

macro index   Y "!echo 'fetching... ' ; getmail 2>&1 > /dev/null &\n " "Check for new mail via fetchmail"
macro pager   Y "!echo 'fetching... ' ; getmail 2>&1 > /dev/null &\n " "Check for new mail via fetchmail"
macro browser Y "!echo 'fetching... ' ; getmail 2>&1 > /dev/null &\n " "Check for new mail via fetchmail"

# Show documentation when pressing F1
#macro generic <f1> "!links /usr/local/doc/mutt/html/manual.html\n" "Show Mutt documentation"
#macro index   <f1> "!links /usr/local/doc/mutt/html/manual.html\n" "Show Mutt documentation"
#macro pager   <f1> "!links /usr/local/doc/mutt/html/manual.html\n" "Show Mutt documentation"

#URLview macro's
macro attach B ":set pipe_decode\n|urlview\n:unsetpipe_decode\n" "Call urlview to extract URLs out of a message"
macro pager B  ":set pipe_decode\n|urlview\n:unsetpipe_decode\n" "Call urlview to extract URLs out of a message"
macro index B  ":set pipe_decode\n|urlview\n:unsetpipe_decode\n" "Call urlview to extract URLs out of a message"

# Get me out off here
macro index Q   ":set quit=yes\nqy"  "Quit mutt without asking"
macro browser Q ":set quit=yes\nqqy" "Quit mutt without asking"

# Moves
bind index <up> previous-entry
bind index <down> next-entry
macro index <right> <display-message>
macro index <left> <sync-mailbox><change-folder>? "Go to the folder menu"

bind index - previous-page
bind index <space> next-page

macro pager   <left>     <exit>
macro pager   <right>    <noop>
macro pager   <up>       <previous-line>
macro pager   <down>     <next-line>

macro pager   <pageup>   <previous-entry>
macro pager   <pagedown> <next-entry>

macro index   <tab>      <next-unread><enter>

macro browser <space>    <check-new>

macro browser <right>    <select-entry>
macro browser <left>     <home><return> "Goto previous folder"

#views
bind index $ sort-mailbox
bind index P collapse-all
bind index L limit

#commands
bind index x sync-mailbox
macro pager x <sync-mailbox>q
bind index l list-reply

bind pager l list-reply
bind pager \n noop
bind pager P noop # I don't have a printer. Save the trees :P

bind compose <return> send-message

# If I would bind these the d button wouldn't work anymore.
macro index <delete> d
macro pager <delete> d

macro pager s <save-message>?
macro index s <save-message>?

# From http://www.spinnaker.de/mutt/keybind
macro index A "!$EDITOR ~/.mutt/aliases\n:source ~/.mutt/aliases\n" "Edit aliases file and reload it"
macro pager A "!$EDITOR ~/.mutt/aliases\n:source ~/.mutt/aliases\n" "Edit aliases file and reload it"

# I don't have a printer. Poor trees. :'(
bind index p noop
bind pager p noop

macro index M "T \n;WN^t \n" "Mark all messages read"
macro pager M "T \n;WN^t \n" "Mark all messages read"

bind index \cr search-opposite
bind index \cs search
bind pager \cr search-opposite
bind pager \cs search