Mutt provides several means to
achieve dynamic configuration: the various "*-hook" cmds, the
"` `" (backticks) cmd-substitution known from many shells, and
"macros". You can do already a lot with them as they are, but you can
combine them to achieve more or use them in ways not used before. Add,
correct, or expand the list with your ideas. Keep in mind that with some
variation the tricks can do things not listed here. Get creative.
(ab)use "macros" as variables.
You can use Mutt macros to store things, some what like the usage of
variables. The key idea is to use macros that dynamically define other
macros or themselves. One use of this is to toggle an option between two
values, so the macro must "remember" the last setting. For example, if
you want the 'S' key to toggle between `sort=threads` and
`sort=date`, write two muttrc snippets:
# ~/.mutt/sort-threads.rc set sort=threads macro index S "<enter-command>source ~/.mutt/sort-date.rc<enter>" # ~/.mutt/sort-date.rc set sort=date macro index S "<enter-command>source ~/.mutt/sort-threads.rc<enter>"
Then add "`source ~/.mutt/sort-threads.rc`" (or `-date`) to your
main muttrc. You can also use macros instead of the auxillary files (see
MacroSamples), but this is a bit harder due to the quoting necessary.
Another idea was here:
NOTE: since 1.5.13 there is real "generic-vars in mutt" support
("`my_...`"), some things can be done easier with real vars, others
with this trick.
The last line lists any regular file that is not under a new/ or cur/
directory while taking maildirs. Note: if "find" has no -printf, there
is no simple solution to work with "sed", because mbox folders can be
named "new" and "cur", too;
would tag all messages older than 1 week except flagged ones when
entering a mailbox matching "ubuntu-users". Then apply function
`` with "`~T`" as pattern, and all tagged messages
will be erased as soon as you leave the folder or press the "$" key. Or
NOTE: Vim 7 has spell-checking built-in, use "`:set spell`" to
To enable it "automatically" when you're
using vim within mutt, put
` set editor="vim -c 'set spell spelllang=de,en'" `
in your .muttrc-file. You can use more than one language, e.g. de,en. To
get new language files, please read the vim-help ":help spelling"
and ":help spell-load".
The following is for Vim 6:
You can automatically
start a spell checker if you use vim as your editor. Download the
engspchk.tar.bz2 script from
http://www.vim.org/scripts/script.php?script_id=195 and uncompress it
in your $HOME/.vim dir. Then change your .muttrc file to include the
`set editor='vim "+normal \\ec" +/^$/'`
This will start up the e-mail editing session in
Spell checking mode, auto-highlighting spelling mistakes for you.
Sanity check for missing parts/attachments before sending.
Have a look at the ConfigTricks/CheckAttach script to be used as
"$sendmail" replacement to remind you of missing attachments. Can be
adapted to make any test you need, if you don't trust yourself. Take
care, advanced shell-knowledge recommended.
Set From header before sending
Add your identities,
alias identity_1 Chuck Norris <chuck@example.COM> alias identity_2 Harry Callahan <harry@example.ORG> ...
Macro: macro compose v "<edit-from>^Uidentity\_<tab>" "Select from"
Write email and while in compose menu press 'v' -
you should see a menu with all your identities, choose one, press Enter,
Mutt does not have support for conditional statements in its
configuration file. However, you can create a shell script which outputs
muttrc commands and have Mutt read the output of the script instead.
Example: Suppose you want to set the value of
"$editor" based upon whether or not you are currently using a
graphical user desktop. You might create the following shell script as
#!/bin/shif[ x$DISPLAY!= x ];thenecho'set editor="gvim -f"'elseecho'set editor=vim'fi
Then in your `~/.muttrc`, you can use the following command:
` source '~/bin/detectgui.sh|'`
Generating send-hooks from addresses in a flat text file
You dont like to use procmail to move pgp-inline message into pgp-mime
like here http://tldp.org/HOWTO/Mutt-GnuPG-PGP-HOWTO-8.html ?
You can economize this very large procmail-recipe
into one message-hook. This hook also does not destroy german
If you configure mutt to edit the headers of your mail while composing
your mails with vim, you can use the autocomplete feature to save some
install the mutt-evo-query script in your path
(included in the zip file), copy `address-search.vim` to
`~/.mutt/address-search.vim`, add to your vimrc:
au !BufRead /tmp/mutt* source ~/.mutt/address-search.vim
Now while editing your mail type:
And a you will be presented with a list of all
contact that have "start" as a substring, with you cycle through