aboutsummaryrefslogtreecommitdiff
path: root/.mutt/muttrc.macros
blob: 2dc8eba9e65409064742d596c7cecfbfb884ee64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Common macros
macro index \eR "|~/bin/mutt-remember-mail\n"
macro pager \cu <pipe-entry>'urlview'<enter> 'Follow links with urlview'

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"

# Sidebar
macro index,pager B '<enter-command>toggle sidebar_visible<enter>'

macro index <right> "<enter-command>toggle sidebar_visible<enter><display-message>"
macro pager <left> "<enter-command>toggle sidebar_visible<enter><exit>"

macro index,pager D "<delete-message><sync-mailbox><enter>" "Delete message"

macro index <F6> \
"<enter-command>unset wait_key<enter><pipe-message>notmuch new<enter>" \
"notmuch: Index new messages"


macro index <F7> \
        "<enter-command>unset wait_key<enter><shell-escape>~/bin/mutt-fetchbug --prompt search<enter><change-folder-readonly>~/.cache/mutt_btsresults<enter><enter-command>set wait_key<enter>" \
        "fetch bug(s) (using bts show)"

macro index <F8> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<shell-escape>notmuch-mutt -r --prompt search<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: search mail"

macro index <F9> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt -r thread<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: reconstruct thread"

macro index <esc>m "T~N<enter>;WN^T~T<enter>T~O<enter>;WN^T~T<enter>" "mark all messages read"


# toggle TOFU protection with ESC-0 (off) and ESC-1 (on)
macro generic \e0 ":unset display_filter\n" "Turn TOFU protection off"
macro generic \e1 ":set display_filter='t-prot -cmekatlS --max-lines=250 --bigq --pgp-short --pgp-move --pgp-move-vrf -Mmutt -L/etc/t-prot/footers -A/etc/t-prot/ads'\n" "Turn TOFU protection on"

# same in pager mode - ugly but what the hell...
macro pager \e0 ":unset display_filter; exec exit\n:exec display-message\n" "Turn TOFU protection off"
macro pager \e1 ":set display_filter='t-prot -cmekatlS --max-lines=250 --bigq --pgp-short --pgp-move --pgp-move-vrf -Mmutt -L/etc/t-prot/footers -A/etc/t-prot/ads'; exec exit\n:exec display-message\n" "Turn TOFU protection on"

macro attach 'V' "<pipe-entry>cat > ~/tmp/mail.html && xdg-open ~/tmp/mail.html && rm -f ~/tmp/mail.html<enter>"

source "$HOME/.mutt/muttrc.macros.env|"
nihil fit ex nihilo