Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable syntax highlighting for various filetypes in vim

Tags:

vim

I can enable syntax highlighting for a file that has an extension that is unknown to vim by doing the following

set syntax=c

Every time I switch tabs however, I have to renter the command. Is there any way to let vim know that a file with an extension .xyz should be coloured with C syntax?

like image 896
Samaursa Avatar asked Sep 07 '25 18:09

Samaursa


1 Answers

Put this at the end of your .vimrc (I'm assuming you have autocommands enabled).

autocmd BufRead,BufNewFile *.xmlx set filetype=xml
like image 146
dwlz Avatar answered Sep 11 '25 08:09

dwlz