Vim and Drupal Modules

Aug
18
2008

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).

Comment Icon

3 Comments

The most recent comment was on Mon, 23rd Feb 2009, 18:24

I have a similar

I have a similar configuration in ~/.vim/filetype.vim and it works fine, but it is slightly different from yours.

Here it is:

augroup filetypedetect
autocmd BufNewFile,BufRead *.module setfiletype php
autocmd BufNewFile,BufRead *.install setfiletype php
autocmd BufNewFile,BufRead *.inc setfiletype php
autocmd BufNewFile,BufRead *.info setfiletype dosini
autocmd BufNewFile,BufRead *.test setfiletype php
augroup END

Your 7.1 Fix works is 6.3

I pasted your 7.1 fix in .vimrc and it works. vim -version is 6.3. Thanks

thank you.

thank you.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <img> <p>
  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • You can enable syntax highlighting of source code with the following tags: <pre>, <code>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Follow Me

Recent comments

Answers 2 days ago
Replies.... 1 week ago
Or in 1 week ago
A few tweaks 1 week ago
Nice 1 week ago
Thanks a million 1 week ago
Syndicate content