Location of Vim Syntax files for different programming languages

If you use Vim for programming, you find that by default based on the type of the file, Vim enables syntax highlighting. That is if your file name is myfile.c or myfile.C, Vim enables Syntax highlighting for the C language. Likewise, it enables syntax highlighting for a large number of well known (programming) languages. If you are wondering where you can find these syntax highlighting files, you can check the following directory.

Currently in my system, it is located in the following directory

/usr/share/vim/vim73/syntax

Let’s check the directory contents

$ ls /usr/share/vim/vim73/syntax
...
config.vim        idl.vim           plp.vim          tf.vim
conf.vim          indent.vim        plsql.vim        tidy.vim
context.vim       inform.vim        pod.vim          tilde.vim
cpp.vim           initex.vim        postscr.vim      tli.vim
crm.vim           initng.vim        po.vim           tpp.vim
crontab.vim       inittab.vim       povini.vim       trasys.vim
....

Thus for every programming language, they have an associated .vim file. For C++, there is cpp.vim. For crontab entries (/etc/cron.d), there is crontab.vim

Since, I am using Vim 7.3, the above syntax files are located in the vim73. But if you are looking for future versions, you can run the following command to get the location

$ find /usr/share/vim/ -iname "*syntax"
/usr/share/vim/vim73/syntax
Advertisements