Vim and Drupal Modules

I just finished upgrading a server to Ubuntu 8.04 which came with Vim 7.1 rather than 6.3 on the older server. It seems 7.1 does things slightly differently to 6.3.

In 6.3 I could create ~/.vim/filetype.vim and in there define a line as follows:

au BufRead,BufNewFile *.module,*.install,*.theme setf php

However in 7.1, it looks like a line similar to this has to go into ~/.vimrc instead…

au BufReadPost *.module,*.install,*.theme set syntax=php

This tip took me about half an hour to find… Hopefully it'll help someone else programming Drupal with Vim figure out how to get modules, themes and install files to associate with the PHP filetype (specifically for highlighting).