Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM not highlighting PHP files, highlights others

VIM is unable to highlight PHP files or indent it (using '='). It is working fine for other file types (.html, .c, .java etc.)

I tried manually setting filetype/syntax without any results.

What should I do?

OS: Ubuntu 11.04 VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 6 2011 10:34:41) Included patches: 1-154

Should I give more information?

PS: php.vim file is present in syntax folder.

like image 521
chinmayv Avatar asked Dec 10 '22 04:12

chinmayv


2 Answers

The default syntax plugin for PHP requires to include <?php at the beginning of the file to highlight anything.

like image 141
mike3996 Avatar answered Jan 01 '23 04:01

mike3996


I'm not sure what would cause this issue but try adding below to .vimrc

au BufNewFile,BufRead *.php set filetype=php
like image 36
Kirill Avatar answered Jan 01 '23 02:01

Kirill