nix/config/neomutt/keybinds
2025-12-04 14:31:38 -06:00

92 lines
3.5 KiB
Text

# 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 index,pager V edit-raw-message
macro index,pager H "<pipe-message>~/dotfiles/bin/view-email-html<enter>" "View email in browser"
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,pager g noop
bind index gg first-entry
macro index,pager D "<delete-message><sync-mailbox>" "Delete and sync"
macro index,pager U "<undelete-message><sync-mailbox>" "Undelete and sync"
bind index L limit
bind index h noop
bind index l display-message
bind index,pager 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
# 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
# Macros
# bind index \Ca noop
macro index \Ca "<tag-pattern>.<enter>" "Tag all messages"
macro index \Cu "<untag-pattern>.<enter>" "Untag all messages"
macro attach o "<enter-command>unset wait_key<enter><pipe-entry>~/dotfiles/bin/open-attachment<enter>" "Open with default app"
macro attach O "<enter-command>unset wait_key<enter><pipe-entry>~/dotfiles/bin/mailcap-open<enter>" "Open with fzf picker"
macro attach,pager p "|git apply<enter>" "Apply git patch"
macro attach,pager P "|git-apply-patch<enter>" "Apply git patch (interactive)"
# Notmuch search
bind index,pager \\ vfolder-from-query
macro index,pager ga "<vfolder-from-query>date:30d..<enter>" "View recent mail (30 days)"
macro index,pager gA "<vfolder-from-query>*<enter>" "View all mail"
macro index,pager gn "<vfolder-from-query>tag:unread<enter>" "View unread mail"
macro index,pager gr "<vfolder-from-query>date:7d..<enter>" "View recent mail (7 days)"
# Compose
bind index c mail
bind index,pager E recall-message
# Compose menu - PGP shortcuts
bind compose S pgp-menu
macro compose a "<shell-escape>~/dotfiles/bin/yazi-pick-file<enter><enter-command>source /tmp/neomutt-yazi-pick<enter><shell-escape>~/dotfiles/bin/yazi-pick-file clean<enter>" "Attach file with yazi"
bind compose d detach-file
# Mark messages
bind index,pager m noop
macro index,pager mu "<enter-command>unset mark_old<enter><tag-prefix><toggle-new><sync-mailbox>" "Mark as unread"
macro index,pager mr "<tag-prefix><clear-flag>N<sync-mailbox>" "Mark as read"
macro index,pager m. "<tag-pattern>.<enter>" "Tag all messages"
macro index,pager m, "<untag-pattern>.<enter>" "Untag all messages"
macro index,pager ma ":set confirmappend=no delete=yes\n<tag-prefix><save-message>=Archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n" "Archive"
macro index,pager mA ":set confirmappend=no delete=yes\n<tag-prefix><save-message>=Inbox\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n" "Move to Inbox"
macro index,pager mi ":set confirmappend=no delete=yes\n<tag-prefix><save-message>=Important\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n" "Mark as important"