Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I receive a lot of emails daily, and with the ever-growing amount of maildirs I'm in need to structure/optimize the browsing in mutt.

My maildirs follow this naming scheme: .domain.category.sub_category

My goal is to break domain, category and sub_category into nested levels when browsing through the mailboxes. This is sort of achieved through the use of imap. But I stumble upon a few snags, so my questions are:

(See my configuration below)

  1. Is this nested mailboxes view possible by directly accessing ~/Mail and not using IMAP?
    E.g. set folder="~/Mail" and set spoolfile="~/Mail/.INBOX"

  2. When I start mutt I'm presented with all mailboxes available, which is what I want to get away from. I want to get directed directly into my default/main inbox like I do when accessing ~/Mail directly. How?

  3. When hitting c (a defined macro, see configuration below) I again get presented with all the mailboxes available, and not the mailboxes at the current browsing level, e.g. mailboxes containing a specific category.
    To get this view I need to hit c+TAB. I've solved this by adding a <tab> to the c macro's. Is this the right way? If not, what would be a better way to solve this?

  4. When finally getting mutt to present me mailboxes in nested levels they are only enumerated and not annotated with N, indicating new mail, or even better, total number of new mails in or under a folder. I know it's possible to define format on the different views, but is there one for this view? If so, which?

I know my lingo and description of the problem might be off, so in advance, sorry. Please don't hesitate to ask me if something seems unclear or doesn't make sense.

My mutt configuration:

set autoedit
set edit_headers
set reverse_name
set from='blapp'
set realname='Blapp'
set use_from

set folder="imap://foo@bar/"
set spoolfile="imap://foo@bar/"
#set folder="~/Mail"
#set spoolfile="~/Mail/.INBOX"

mailboxes `awk '{printf("+%s ", $1)}' ~/Mail/subscriptions`
set mask="!^\\.[^.]"

set mail_check = 15
set strict_threads = "yes"

set header_cache = ~/var/mutt_cache

set copy=yes 
set delete=ask-yes   
set include=yes       

set postpone=ask-yes   
set print=ask-no       
set followup_to=no  
set edit_hdrs        
set abort_unmodified    
set bounce_delivered=no
set pager_index_lines=6 
set pager_stop=yes  
set arrow_cursor=no 
set read_inc=25  
set write_inc=25  
set check_new=yes      
set forward_quote=no 
set help=yes     
set indent_string="> "  
set status_on_top 

set folder_format="%t%N  %2C %-30f %8s %d "

set hdr_format="%4C %Z %{%b %d} %-15.15n (%4l) %s"

set pager_format="%S [%T] %n / %s"

set status_format="-%r- %f %?n?[ New:%n ]?----%>-(%P)---"

set sort=threads
set sort_aux=last-date-received

bind index   \t          next-unread
bind pager   \t          next-unread
bind index  ,\t      previous-unread
bind pager  ,\t      previous-unread
bind index  -        collapse-thread

macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"

set read_inc=1000 # Speed up opening of large mboxes
set write_inc=1000

set charset=utf-8
set send_charset=utf-8

set record="+sent.`date +%Y`.`date +%m`"
set postponed="+drafts"

# Automatic viewing of html mail, but always prefer text/plain
set implicit_autoview
alternative_order text/plain text/html
share|improve this question
up vote 2 down vote accepted

Answering questions 2-4:

The mutt mailbox browser window has two modes. One shows the contents of your mailboxes variable. This looks like a shell ls -l listing, but on the lefthand side has numbers and a spot to put N if there's new mail. I believe this view is customizable but I'm not sure offhand what its name is. Doing man muttrc and searching for "_format" suggests that it's the folder_format setting.

The other mode is just to display a filesystem hierarchy. On my machine there's no N shown in that mode either; I don't think this is configurable but I may well be wrong. You can move around to anywhere on your disk with this. The change-dir keybinding (assigned to "c" on my machine, but perhaps differently for you) allows you to just type the directory you want to see. Or you can navigate up by selecting the ".." entries, etc.

The first mode is shown first, and Tab switches between the modes. So to answer Q2 and Q3: yes, just add a Tab to your macros if you want the other display mode to be invoked.

To answer Q4: I suspect that the N field only shows up in the display mode that shows all the mailboxes mutt checks at once. If I'm right, you won't be able to get it in the hierarchical display. Unless you write a patch for mutt. (Maybe someone already has.)

share|improve this answer

You must log in to answer this question.