# ~/.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: http://marc.theaimsgroup.com/?l=mutt-dev&m=108194999008846&w=2
NOTE: since 1.5.13 there is real "generic-vars in mutt" support, some things can be done easier with real vars, others with this trick.
source `FILE=$HOME/.muttaliases; if [ ! -s "$FILE" ]; then FILE=/dev/null;fi;echo "$FILE"`You might put this if/then/else construction into a script for easier reuse at different places.
source `muttsource $HOME/.muttaliases`
set folder=$HOME/mail/`date +"%y%m"`or
set mbox=$HOME/mail/received-`date +"%y%m"` set record=$HOME/mail/sent-`date +"%y%m"`(Beware, `date` is evaluated only once, so you have to restart Mutt (or re-source .muttrc) when the month changes)
mailboxes `echo ~/mail/inbox/*`Filename globbing must be enabled in the $SHELL for this to work.
A more advanced way for maildirs(!) that takes into account subdirs and other goodies is:
mailboxes `find ~/mail/ -type d -name cur -printf '%h '`
And finally, to list both mboxes and maildirs:
mailboxes `find ~/mail '(' -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '%h ' ')' -o '(' -type f -printf '%p ' ')'`
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;
mailboxes `$SHELL -c "echo \`find ~/mail -type d '(' -name 'cur' -o -name 'new' ')' -prune -print | sed -e '/[^/]*$' \`"`
mailboxes `$SHELL -c "echo \`find ~/mail '(' -type d '(' -name 'cur' -o -name 'new' -o name 'tmp' ')' -prune ')' -o -type f -print \`"`
-printf or the '$SHELL -c "echo' work-around is necessary to avoid new-lines because mutt takes only the 1st line of output from `` substitutions.
folder-hook ubuntu-users 'push <tag-pattern>~r>1w!~F<enter>'would tag all messages older than 1 week except flagged ones when entering a mailbox matching "ubuntu-users". Then apply function <delete-pattern> with "~T" as pattern, and all tagged messages will be erased as soon as you leave the folder or press the "$" key. Or for the brave
folder-hook ubuntu-users 'push <delete-pattern>~r>1w!~F<enter><sync>'NOTE: The usual hook-traps apply, see DebugConfig.
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 spelllang" 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 following:
set editor="vim \"+normal \\\\ec\" +/^$/"This will start up the e-mail editing session in Spell checking mode, auto-highlighting spelling mistakes for you.
alias identity_1 Chuck Norris <chuck@example.com> alias identity_2 Harry Callahan <harry@another-example.com> ...
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, done.
An extension of this, which lowers the number of keys to press and supports making other identity-specific settings (e.g. SMTP server to use), can be found at http://dione.no-ip.org/AlexisWiki/RotatingIdentitiesWithMutt.
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 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 "detectgui.sh":
#!/bin/sh if [ x$DISPLAY != x ]; then echo 'set editor="gvim -f"' else echo 'set editor=vim' fi
Then in your ~/.muttrc, you can use the following command:
source '~/bin/detectgui.sh|'
Q: For example, I have the following hook,
send-hook "~t `cat ~/recipients_list` " 'set signature=...
I want the matching of everything in the recipients_list file to be case insensitive without having to specify each address in the file with a regex.''
A: Save this script as ~/bin/hooks.sh:
#!/usr/bin/env python
for s in open('recipient_list'):
print 'send-hook ~t "' + s.lower() + '" set signature...'
In your ~/.muttrc:
source '~/bin/hook.sh|'
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 umlauts (ÜÖÄ):
message-hook '!~g !~G ~b "^-----BEGIN PGP (SIGNED )?MESSAGE"' 'exec check-traditional-pgp
Happy mutting! :-)