Sidebar

The Sidebar shows a list of all your mailboxes. The list can be turned on and off, it can be themed and the list style can be configured.

This part of the manual is suitable for beginners. If you already know Mutt you could skip ahead to the main Sidebar guide. If you just want to get started, you could use the sample Sidebar muttrc.

To check if Mutt supports Sidebar, look for the string +USE_SIDEBARin the mutt version.

mutt -v

Let's turn on the Sidebar:

set sidebar_visible
set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
set mail_check_stats

You will see something like this. A list of mailboxes on the left. A list of emails, from the selected mailbox, on the right.

Fruit [1]     3/8|  1    + Jan 24  Rhys Lee         (192)  Yew
Animals [1]   2/6|  2    + Feb 11  Grace Hall       (167)  Ilama
Cars            4|  3      Feb 23  Aimee Scott      (450)  Nectarine
Seas          1/7|  4    ! Feb 28  Summer Jackson   (264)  Lemon
                 |  5      Mar 07  Callum Harrison  (464)  Raspberry
                 |  6 N  + Mar 24  Samuel Harris    (353)  Tangerine          
                 |  7 N  + Sep 05  Sofia Graham     (335)  Cherry
                 |  8 N    Sep 16  Ewan Brown       (105)  Ugli
                 |
                 |

This user has four mailboxes: Fruit, Cars, Animalsand Seas.

The current, open, mailbox is Fruit. We can also see information about the other mailboxes. For example: The Animalsmailbox contains, 1 flagged email, 2 new emails out of a total of 6 emails.

1. Navigation

The Sidebar adds some new functionsto Mutt.

The user pressed the ckey to <change-folder>to the Animalsmailbox. The Sidebar automatically updated the indicator to match.

Fruit [1]     3/8|  1      Jan 03  Tia Gibson       (362)  Caiman
Animals [1]   2/6|  2    + Jan 22  Rhys Lee         ( 48)  Dolphin
Cars            4|  3    ! Aug 16  Ewan Brown       (333)  Hummingbird
Seas          1/7|  4      Sep 25  Grace Hall       ( 27)  Capybara
                 |  5 N  + Nov 12  Evelyn Rogers    (453)  Tapir              
                 |  6 N  + Nov 16  Callum Harrison  (498)  Hedgehog
                 |
                 |
                 |
                 |

Let's map some functions:

bind index,pager \CP sidebar-prev       # Ctrl-Shift-P - Previous Mailbox
bind index,pager \CN sidebar-next       # Ctrl-Shift-N - Next Mailbox
bind index,pager \CO sidebar-open       # Ctrl-Shift-O - Open Highlighted Mailbox

Press Ctrl-Shift-N(Next mailbox) twice will move the Sidebar highlight to down to the Seasmailbox.

Fruit [1]     3/8|  1      Jan 03  Tia Gibson       (362)  Caiman
Animals [1]   2/6|  2    + Jan 22  Rhys Lee         ( 48)  Dolphin
Cars            4|  3    ! Aug 16  Ewan Brown       (333)  Hummingbird
Seas          1/7|  4      Sep 25  Grace Hall       ( 27)  Capybara
                 |  5 N  + Nov 12  Evelyn Rogers    (453)  Tapir              
                 |  6 N  + Nov 16  Callum Harrison  (498)  Hedgehog
                 |
                 |
                 |
                 |

Note

Functions <sidebar-next>and <sidebar-prev>move the Sidebar highlight . They do not change the open mailbox.

Press Ctrl-Shift-O( <sidebar-open>) to open the highlighted mailbox.

Fruit [1]     3/8|  1    ! Mar 07  Finley Jones     (139)  Molucca Sea
Animals [1]   2/6|  2    + Mar 24  Summer Jackson   ( 25)  Arafura Sea
Cars            4|  3    + Feb 28  Imogen Baker     (193)  Pechora Sea
Seas          1/7|  4 N  + Feb 23  Isla Hussain     (348)  Balearic Sea       
                 |
                 |
                 |
                 |
                 |
                 |

2. Features

The Sidebar shows a list of mailboxes in a panel.

Everything about the Sidebar can be configured.

State of the Sidebar

  • Visibility

  • Width

Which mailboxes are displayed

  • Display all

  • Limit to mailboxes with new mail

  • Whitelist mailboxes to display always

The order in which mailboxes are displayed

  • Unsorted (order of mailboxes commands)

  • Sorted alphabetically

  • Sorted by number of new mails

Color

  • Sidebar indicators and divider

  • Mailboxes depending on their type

  • Mailboxes depending on their contents

Key bindings

  • Hide/Unhide the Sidebar

  • Select previous/next mailbox

  • Select previous/next mailbox with new mail

  • Page up/down through a list of mailboxes

3. Display

Everything about the Sidebar can be configured.

3.1. Sidebar Basics

The most important variable is $sidebar_visible. You can set this in your muttrc, or bind a key to the function <sidebar-toggle-visible>.

set sidebar_visible                         # Make the Sidebar visible by default
bind index,pager B sidebar-toggle-visible   # Use 'B' to switch the Sidebar on and off

Next, decide how wide you want the Sidebar to be. 25 characters might be enough for the mailbox name and some numbers. Remember, you can hide/show the Sidebar at the press of button.

Finally, you might want to change the divider character. By default, Sidebar draws an ASCII line between it and the Index panel If your terminal supports it, you can use a Unicode line-drawing character.

set sidebar_width = 25                  # Plenty of space
set sidebar_divider_char = '│'          # Pretty line-drawing character
3.2. Sidebar Format String

$sidebar_formatallows you to customize the Sidebar display. For an introduction, read format stringsincluding the section about conditionals.

The default value is %B%* %n

A more detailed value is %B%?F? [%F]?%* %?N?%N/?%S

Which breaks down as:

  • %B- Mailbox name

  • %?F? [%F]?- If flagged emails [%F], otherwise nothing

  • %*- Pad with spaces

  • %?N?%N/?- If new emails %N/, otherwise nothing

  • %S- Total number of emails

Table 2.1. sidebar_format

Format Notes Description
%B   Name of the mailbox
%S * † Size of mailbox (total number of messages)
%F * † Number of Flagged messages in the mailbox
%N * † Number of New messages in the mailbox
%n * If there's new mail, display N, otherwise nothing
%!   !: one flagged message; !!: two flagged messages; n!: n flagged messages (for n > 2). Otherwise prints nothing.
%d * ‡ Number of deleted messages
%L * ‡ Number of messages after limiting
%t * ‡ Number of tagged messages
%>X   Right justify the rest of the string and pad with X
%|X   Pad to the end of the line with X
%*X   Soft-fill with character Xas pad

* = Can be optionally printed if nonzero

† = To use this expandos, you must first:

set mail_check_stats

‡ = Only applicable to the current folder

Here are some examples. They show the number of (F)lagged, (N)ew and (S)ize.

Table 2.2. sidebar_format

Format Example
%B%?F? [%F]?%* %?N?%N/?%S
mailbox [F]            N/S
%B%* %F:%N:%S
mailbox              F:N:S
%B %?N?(%N)?%* %S
mailbox (N)              S
%B%* ?F?%F/?%N
mailbox                F/S

3.3. Abbreviating Mailbox Names

$sidebar_delim_charstells Sidebar how to split up mailbox paths. For local directories use /; for IMAP folders use .

3.3.1. Example 1

This example works well if your mailboxes have unique names after the last separator.

Add some mailboxes of different depths.

set folder="~/mail"
mailboxes =fruit/apple          =fruit/banana          =fruit/cherry
mailboxes =water/sea/sicily     =water/sea/archipelago =water/sea/sibuyan
mailboxes =water/ocean/atlantic =water/ocean/pacific   =water/ocean/arctic

Shorten the names:

set sidebar_short_path                  # Shorten mailbox names
set sidebar_delim_chars="/"             # Delete everything up to the last / character

The screenshot below shows what the Sidebar would look like before and after shortening.

|fruit/apple                            |apple
|fruit/banana                           |banana
|fruit/cherry                           |cherry
|water/sea/sicily                       |sicily
|water/sea/archipelago                  |archipelago
|water/sea/sibuyan                      |sibuyan
|water/ocean/atlantic                   |atlantic
|water/ocean/pacific                    |pacific
|water/ocean/arctic                     |arctic
3.3.2. Example 2

This example works well if you have lots of mailboxes which are arranged in a tree.

Add some mailboxes of different depths.

set folder="~/mail"
mailboxes =fruit
mailboxes =fruit/apple =fruit/banana =fruit/cherry
mailboxes =water
mailboxes =water/sea
mailboxes =water/sea/sicily =water/sea/archipelago =water/sea/sibuyan
mailboxes =water/ocean
mailboxes =water/ocean/atlantic =water/ocean/pacific =water/ocean/arctic

Shorten the names:

set sidebar_short_path                  # Shorten mailbox names
set sidebar_delim_chars="/"             # Delete everything up to the last / character
set sidebar_folder_indent               # Indent folders whose names we've shortened
set sidebar_indent_string="  "          # Indent with two spaces

The screenshot below shows what the Sidebar would look like before and after shortening.

|fruit                                  |fruit
|fruit/apple                            |  apple
|fruit/banana                           |  banana
|fruit/cherry                           |  cherry
|water                                  |water
|water/sea                              |  sea
|water/sea/sicily                       |    sicily
|water/sea/archipelago                  |    archipelago
|water/sea/sibuyan                      |    sibuyan
|water/ocean                            |  ocean
|water/ocean/atlantic                   |    atlantic
|water/ocean/pacific                    |    pacific
|water/ocean/arctic                     |    arctic

Sometimes, it will be necessary to add mailboxes, that you don't use, to fill in part of the tree. This will trade vertical space for horizontal space (but it looks good).

3.4. Limiting the Number of Mailboxes

If you have a lot of mailboxes, sometimes it can be useful to hide the ones you aren't using. $sidebar_new_mail_onlytells Sidebar to only show mailboxes that contain new, or flagged, email.

If you want some mailboxes to be always visible, then use the sidebar_whitelistcommand. It takes a list of mailboxes as parameters.

set sidebar_new_mail_only               # Only mailboxes with new/flagged email
sidebar_whitelist fruit fruit/apple     # Always display these two mailboxes

4. Colors

Here is a sample color scheme:

color sidebar_indicator default color17         # Dark blue background
color sidebar_highlight white   color238        # Grey background
color sidebar_spoolfile yellow  default         # Yellow
color sidebar_new       green   default         # Green
color sidebar_ordinary  default default         # Default colors
color sidebar_flagged   red     default         # Red
color sidebar_divider   color8  default         # Dark grey

There is a priority order when coloring Sidebar mailboxes. e.g. If a mailbox has new mail it will have the sidebar_newcolor, even if it also contains flagged mails.

Table 2.3. Sidebar Color Priority

Priority Color Description
Highest sidebar_indicator Mailbox is open
  sidebar_highlight Mailbox is highlighted
  sidebar_spoolfile Mailbox is the spoolfile (receives incoming mail)
  sidebar_new Mailbox contains new mail
  sidebar_flagged Mailbox contains flagged mail
Lowest sidebar_ordinary Mailbox does not match above

5. Config Changes

If you haven't used Sidebar before, you can ignore this section.

Some of the Sidebar config has been changed to make its meaning clearer. These changes have been made since the previous Sidebar release: 2015-11-11.

Table 2.4. Config Changes

Old Name New Name
$sidebar_delim $sidebar_divider_char
$sidebar_folderindent $sidebar_folder_indent
$sidebar_indentstr $sidebar_indent_string
$sidebar_newmail_only $sidebar_new_mail_only
$sidebar_shortpath $sidebar_short_path
$sidebar_sort $sidebar_sort_method
<sidebar-scroll-down> <sidebar-page-down>
<sidebar-scroll-up> <sidebar-page-up>

Search by Algolia