I assume there's no such default key, am I right?

So, in order to achieve this I have to define something like this?

macro index   gi "<change-folder>=INBOX<Enter>"              "go to Inbox"
macro browser gi "<exit><Enter><change-folder>=INBOX<Enter>" "go to Inbox"
macro pager   gi "<exit><change-folder>=INBOX<Enter>"        "go to Inbox"

Or may be there's a fancier way? If by any chance you have something related in your configs, I'd be grateful if you could share.


Yes, you are right. There are no such default keys.
But you can simplify your calls.

# Switch between mailboxes (in case you have multiple mailboxes)
macro index,pager <f2> "<change-folder>+<MAILBOX1>/INBOX<enter>"
macro index,pager <f3> "<change-folder>+<MAILBOX2>/INBOX<enter>"

In addition to that I have the sibebar enabled and use the arrow keys to switch folders.

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

EDIT: Here can find my whole .muttrc

EDIT2: Regarding the comment to have conditional mappings: Yes this is possible in case the condition is another mail account. You can have account specific configuration files where you are able to overwrite existing mappings. Load them via a folder hook which get executed as soon as you enter a corresponding folder.

Put this in your .muttrc

folder-hook MAILBOX1/*   source ~/.mutt/accounts/MAILBOX1
folder-hook MAILBOX2/*   source ~/.mutt/accounts/MAILBOX2

Create account specific configurations in ~/.mutt/accounts/MAILBOX#

For example, switch between two different INBOX folders with the same key.

~/.mutt/accounts/MAILBOX1 contains:

macro index,pager <f2> "<change-folder>+MAILBOX2/INBOX<enter>"

~/.mutt/accounts/MAILBOX2 contains:

macro index,pager <f2> "<change-folder>+MAILBOX1/INBOX<enter>"
  • Thanks! BTW, I understand, it's not possible in any way to have a conditional mapping? Like, if in index but the active folder is not INBOX, then do A, and if in index AND in INBOX, then do B. Right? – A S Aug 27 '18 at 14:15
  • 1
    You can even do that iff your condition relates to another mailbox (second mail account). You can have account specific configuration files where you can overwrite existing mappings. I edit my answer. – ploth Aug 27 '18 at 17:49
macro index H g!\rm
macro index S g=sent\rm
macro index V g!!\rm

is what I have to go to the "home", "sent", or "previous" mailbox via "g" (change-folder). You may or may not need the "m" (move entry to middle of screen) at the end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.