views:

243

answers:

2

I have gvim 7.2, it recognizes .d files and highlights it correctly according to the syntax of the D programming language. However, .di files are not recognized as D files, and no highlighting is present.

How do I let vim highlight .di files according to D language?

+2  A: 

http://vimdoc.sourceforge.net/htmldoc/filetype.html has the (gritty) detail on filetypes. You can modify the associated plugins by editing your vimrc. look for the rule *.d, and copy/paste that line changing it to *.di

I've not used gvim, so there may be an easier way I'm unaware of

Jonathan Fingland
+7  A: 

This ought to do it in .vimrc:

au BufNewFile,BufRead *.di setlocal ft=d

There are probably other ways, too.

derobert
thanks, that did it
hasen j
If you like to keep your .vimrc relatively clean, you could alternately put this in .vim/ftdetect/d.vim
rampion
If some of your other files are D sources (but don't have name extensions that suggest it), you can add a comment containing a vim modeline like: // vim:ft=d
greyfade