# some sane vim-like keybindings
bind index,pager k previous-entry
bind index,pager j next-entry
bind index,pager g noop
bind index,pager R group-reply
bind index,pager \Cu half-up
bind index,pager \Cd half-down

bind index gg first-entry
bind index G last-entry
bind index <tab> sync-mailbox
bind index <space> collapse-thread

bind pager gg top
bind pager G bottom

# View attachments properly.
bind attach <return> view-mailcap

bind compose P postpone-message
bind index p recall-message

# using neomutts trash patch
bind index,pager D purge-message

# Sync all email
# If you want to make everything indexable after syncing email, use the office-alias
macro index,pager O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail"

# Save all attachments
macro index,pager S "<pipe-message>ripmime -i - -d ~/Downloads && rm ~/Downloads/textfile*" "Save all non-text attachments using ripmime"

# write a new email to the sender of selected email
bind index,pager @ compose-to-sender

# opening urls with urlscan
macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"

# finding stuff
bind editor <tab> complete-query
macro index F "<shell-escape>mu find --clearlinks --format=links --linksdir=~/.mu/results " "mu find"
macro index \cf "<change-folder-readonly>~/.mu/results<enter>" "mu find results"

# Sidebar Navigation
bind index,pager <down> sidebar-next
bind index,pager <up> sidebar-prev
bind index,pager <right> sidebar-open

