Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: associate extension with language

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?

like image 833
hasen Avatar asked May 30 '09 05:05

hasen


People also ask

How do I enable syntax in Vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

What language does Vimrc use?

Vim is written in C language. The source code of Vim is available here, on Github. /src : 26.321M , mostly written in C. Most of the files are . c and .

Where is filetype Vim?

vim (Unix-based systems) $HOME\vimfiles\filetype.


1 Answers

This ought to do it in .vimrc:

au BufNewFile,BufRead *.di setlocal ft=d 

There are probably other ways, too.

like image 123
derobert Avatar answered Oct 28 '22 18:10

derobert