# NeoMutt keybindings

# Attachment
bind attach <return> view-mailcap
bind attach l view-mailcap

# Editor
bind editor <space> noop
bind editor <Tab> complete-query
bind editor ^T complete

# Pager
bind pager c imap-fetch-mail
bind pager j next-line
bind pager k previous-line
bind pager J next-entry
bind pager K previous-entry
bind pager l view-attachments
bind pager,attach h exit
bind pager \031 previous-line
bind pager \005 next-line
bind pager,browser gg top-page
bind pager,browser G bottom-page

# Index
bind index G last-entry
bind index g noop
bind index gg first-entry
bind index D delete-message
bind index U undelete-message
bind index L limit
bind index h noop
bind index l display-message
bind index R group-reply
bind index \031 previous-undeleted
bind index \005 next-undeleted
bind index <tab> sync-mailbox
bind index <space> collapse-thread

# Browser
bind browser h goto-parent
bind browser l select-entry
bind browser,pager,index n search-next
bind browser,pager,index N search-opposite

# Navigation (half page)
bind index,pager,browser d half-down
bind index,pager,browser u half-up

# Sidebar
bind index,pager \Cp sidebar-prev
bind index,pager \Cn sidebar-next
bind index,pager o sidebar-open
bind index,pager B sidebar-toggle-visible

# Misc
bind index,pager @ compose-to-sender
bind index,pager D purge-message

# Macros
macro index,pager a ":set confirmappend=no delete=yes\n<tag-prefix><save-message>=Archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"
macro index,pager n "<tag-prefix><clear-flag>N<untag-pattern>.<enter>\n"
macro attach O "<enter-command>unset wait_key<enter><shell-escape>rm -f /tmp/mutt-attach<enter><save-entry><kill-line>/tmp/mutt-attach<enter>^A"
macro attach,pager A "|git apply<enter>" "Apply git patch"
macro attach,pager P "|git-apply-patch<enter>" "Apply git patch (interactive)"
