Let’s say you have a file type whose contents are in XML format but have a different file extension such as .tim . If you want to edit these files with Vim with syntax highlighting, simply add the following to ~/.vimrc (affects only your Vim environment) or /etc/vim/vimrc (affects everyone’s Vim environment):

au BufNewFile,BufRead *.tim set filetype=xml

This can be done for any file type. To give another example, if you’re storing PostgreSQL code in a file called setup.psql and want SQL syntax highlighting in Vim, add the following line:

au BufNewFile,BufRead *.psql set filetype=sql

  1. Thava says:

    That is a good Tip. Thanks!

  2. […] source Author: WladyX on 24 February, 2012 Category: Uncategorized Older: PSAD on Ubuntu […]