# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
<C-p> = :prev-tab<Enter>
<C-PgUp> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-PgDn> = :next-tab<Enter>
\[t = :prev-tab<Enter>
\]t = :next-tab<Enter>
<C-t> = :term<Enter>
? = :help keys<Enter>
<C-c> = :prompt 'Quit?' quit<Enter>
<C-q> = :prompt 'Quit?' quit<Enter>
<C-z> = :suspend<Enter>

[messages]
# Switch between Adresses
,1 = :change-tab phil_live<Enter>
,2 = :change-tab phil_notmuch<Enter>
,3 = :change-tab spam_live<Enter>
,4 = :change-tab spam_notmuch<Enter>
,5 = :change-tab proton<Enter>

# d = :modify -inbox +deleted<Enter>
# a = :modify -inbox<Enter>
# # Delete = tag as deleted and remove from inbox
# d = :tag +deleted -inbox<Enter>

# # Archive = remove from inbox
# a = :tag -inbox +archive<Enter>
# d = :move Trash<Enter>
# a = :archive flat<Enter>

# Expunge = actually delete (run this in Trash folder)
D = :prompt 'Really delete? ' 'tag +deleted'

# Quick folder navigation
,i = :cf Inbox<Enter>
,u = :cf Unread<Enter>
,n = :cf Newsletters<Enter>
,f = :cf Finance<Enter>
,s = :cf Shopping<Enter>
,t = :cf Travel<Enter>
,d = :cf Development<Enter>
,x = :cf Spam<Enter>
,tr = :cf Trash<Enter>
,a = :cf All Mail<Enter>

# o1 = :compose -H "From: Liph \<liiph@proton.me\>"<enter>
# o2 = :compose -H "From: Liph \<liiph@protonmail.com\>"<enter>
# o3 = :compose -H "From: Liph \<liiph@pm.me\>"<enter>
# o4 = :compose -H "From: Philipp Waibel \<ph.waibel@proton.me\>"<enter>
# o5 = :compose -H "From: P.Waibel \<ph.waibel@pm.me\>"<enter>

# Delete and sync
#d = :modify-labels +trash -inbox<Enter>:archive flat<Enter>
d = :modify-labels +deleted -inbox<Enter>
#d = :modify-labels +deleted -inbox<Enter>
#d = :move Trash<Enter>:exec mbsync -a && notmuch new<Enter>
# Permanently delete (Shift+D)
#D = :prompt 'Really delete?' :move Trash<Enter>

#B = :compose -H "From: waibel ph.waibel@proton.me"<Enter>
# for url handling

j = :next<Enter>
<Down> = :next<Enter>
<C-d> = :next 50%<Enter>
<C-f> = :next 100%<Enter>
<PgDn> = :next 100%<Enter>

k = :prev<Enter>
<Up> = :prev<Enter>
<C-u> = :prev 50%<Enter>
<C-b> = :prev 100%<Enter>
<PgUp> = :prev 100%<Enter>
g = :select 0<Enter>
G = :select -1<Enter>

J = :next-folder<Enter>
<C-Down> = :next-folder<Enter>
K = :prev-folder<Enter>
<C-Up> = :prev-folder<Enter>
H = :collapse-folder<Enter>
<C-Left> = :collapse-folder<Enter>
L = :expand-folder<Enter>
<C-Right> = :expand-folder<Enter>

v = :mark -t<Enter>
<Space> = :mark -t<Enter>:next<Enter>
V = :mark -v<Enter>

T = :toggle-threads<Enter>
zc = :fold<Enter>
zo = :unfold<Enter>
za = :fold -t<Enter>
zM = :fold -a<Enter>
zR = :unfold -a<Enter>
<tab> = :fold -t<Enter>

zz = :align center<Enter>
zt = :align top<Enter>
zb = :align bottom<Enter>

<Enter> = :view<Enter>
#d = :choose -o y 'Really delete this message' delete-message<Enter>
#D = :delete<Enter>
a = :archive flat<Enter>
A = :unmark -a<Enter>:mark -T<Enter>:archive flat<Enter>

C = :compose<Enter>
m = :compose<Enter>

b = :bounce<space>

rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>

c = :cf<space>
$ = :term<space>
! = :term<space>
| = :pipe<space>

/ = :search<space>
\ = :filter<space>
n = :next-result<Enter>
N = :prev-result<Enter>
<Esc> = :clear<Enter>

s = :split<Enter>
S = :vsplit<Enter>

pl = :patch list<Enter>
pa = :patch apply <Tab>
pd = :patch drop <Tab>
pb = :patch rebase<Enter>
pt = :patch term<Enter>
ps = :patch switch <Tab>

[messages:folder=Drafts]
<Enter> = :recall<Enter>

[view]

,l = :pipe urlscan<Enter>

/ = :toggle-key-passthrough<Enter>/
q = :close<Enter>
O = :open<Enter>
o = :open<Enter>
S = :save<space>
| = :pipe<space>
D = :delete<Enter>
A = :archive flat<Enter>

<C-l> = :open-link <space>

f = :forward<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>

H = :toggle-headers<Enter>
<C-k> = :prev-part<Enter>
<C-Up> = :prev-part<Enter>
<C-j> = :next-part<Enter>
<C-Down> = :next-part<Enter>
J = :next<Enter>
<C-Right> = :next<Enter>
K = :prev<Enter>
<C-Left> = :prev<Enter>

[view::passthrough]
$noinherit = true
$ex = <C-x>
<Esc> = :toggle-key-passthrough<Enter>

[compose]
# Keybindings used when the embedded terminal is not selected in the compose
# view
$noinherit = true
$ex = <C-x>
$complete = <C-o>
<C-k> = :prev-field<Enter>
<C-Up> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<C-Down> = :next-field<Enter>
<A-p> = :switch-account -p<Enter>
<C-Left> = :switch-account -p<Enter>
<A-n> = :switch-account -n<Enter>
<C-Right> = :switch-account -n<Enter>
<tab> = :next-field<Enter>
<backtab> = :prev-field<Enter>
<C-p> = :prev-tab<Enter>
<C-PgUp> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-PgDn> = :next-tab<Enter>

[compose::editor]
# Keybindings used when the embedded terminal is selected in the compose view
$noinherit = true
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-Up> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<C-Down> = :next-field<Enter>
<C-p> = :prev-tab<Enter>
<C-PgUp> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-PgDn> = :next-tab<Enter>


# Insert signatures with Ctrl+s + number
<C-s>1 = :exec cat /home/liph/.config/aerc/sigs/formal.txt<Enter>
<C-s>2 = :read ~/.config/aerc/sigs/formal_eng.txt<Enter>
<C-s>3 = :read ~/.config/aerc/sigs/liph.txt<Enter>
<C-s>4 = :read ~/.config/aerc/sigs/phil.txt<Enter>

[compose::review]
# Keybindings used when reviewing a message to be sent
# Inline comments are used as descriptions on the review screen
y = :send<Enter> # Send
n = :abort<Enter> # Abort (discard message, no confirmation)
s = :sign<Enter> # Toggle signing
x = :encrypt<Enter> # Toggle encryption to all recipients
v = :preview<Enter> # Preview message
p = :postpone<Enter> # Postpone
q = :choose -o d discard abort -o p postpone postpone<Enter> # Abort or postpone
e = :edit<Enter> # Edit (body and headers)
a = :attach<space> # Add attachment
d = :detach<space> # Remove attachment

[terminal]
$noinherit = true
$ex = <C-x>

<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-PgUp> = :prev-tab<Enter>
<C-PgDn> = :next-tab<Enter>
