A Man And His Mutt - Hooking Up (
Page 9 of 11 )
As someone
who's gone through the experience, I can tell you that relearning the keyboard
every time you switch to a new mail client can be quite painful - which is why
one of Mutt's nicest features is the ability to customize its keymap.
For
example, I personally prefer to use
c
to compose a new message, and
m
to switch mailboxes. Mutt's default keymap, however, works in
the reverse manner. And so, my Mutt configuration file contains the following
commands:
bind index c mail # "c" -> new message in index
bind index m change-folder # "m" -> switch mailbox in index
bind pager c mail # "c" -> new message in pager
bind pager m change-folder # "m" -> switch mailbox in pager
In a similar manner, you can assign keys to other functions
as well. Here's another example, which maps the forward slash symbol (/) to the
search command, as in vi,
bind pager / search
A complete list of the functions available in each of Mutt's
menus is available in the manual, together with the default key assignment for
each.
It's also possible to create keyboard macros, which allow you to
execute a sequence of commands using a single keystroke. The most
frequently-used example of this is setting up the external "urlview" program to
harvest URLs from an email message and browse to them using lynx.
These
commands set things up so that hitting
^u (that's Ctrl-U)
within the index or pager launches urlview and displays a
list of URLs found in the message.
macro index \cu |urlview\n # "^u" -> launch urlview in index
macro pager \cu |urlview\n # "^u" -> launch urlview in pager
Mutt also allows you to alter your configuration on the basis
of specific rules - a feature referred to in Mutt-lingo as a "hook". For
example, suppose I wanted to sort all messages in one mailbox by date, and
messages in another by sender. Normally, I would have to manually resort the
data each time; however, with Mutt's folder hooks, I can have it taken care of
automatically.
folder-hook =inbox set sort=date-sent # sort inbox by
date
folder-hook =lists/melonfire-dev set sort=threads # sort mailing lists
by thread
In addition to folder hooks, Mutt also offers hooks for
saving and sending messages. Take a look at the manual, or the sample
configuration files listed at the end of this article for more
details.