I noticed recently that vim does not always set 'filetype' to "mail" when I edit mutt temporary files, e.g., postponed messages. I traced the problem to mutt's use of mktemp() with the pattern "muttXXXXXX". I don't know about other OSs, but mktemp() on SunOS 5.8 replaces those Xs with characters from the POSIX portable filename character set:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 . _ - The pattern used in filetype.vim to match file names of this form is mutt\w\{6\} The "\w" character class does not include the characters '.' or '-'. I replaced that pattern with this one: mutt[[:alnum:]._-]\{6\} I was surprised that [:alnum:] worked in the context of an autocommand filename pattern. I didn't want to use "\f" because it included too much. A patch is attached. I have posted it here rather than sending it to Bram directly to allow others to comment in case I missed something. Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
*** filetype.vim.orig Mon May 8 16:43:45 2006 --- filetype.vim Tue Jul 25 13:27:55 2006 *************** *** 877,883 **** au BufNewFile,BufRead *.mgp setf mgp " Mail (for Elm, trn, mutt, rn, slrn) ! au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail " Mail aliases au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases --- 877,883 ---- au BufNewFile,BufRead *.mgp setf mgp " Mail (for Elm, trn, mutt, rn, slrn) ! au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]._-]\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail " Mail aliases au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases