Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My GVIM 7.3.46 install on Windows XP Professional SP3 32bit does not seem to have PHP syntax highlighting. I have added this file to C:\Documents and Settings\myUsername\vimfiles\syntax and set this in VIM:

au! Syntax php source C:\Documents and Settings\dotancohen\vimfiles\syntax\vim.php

However, running set syntax=php does not highlight files as PHP, neither for files with the .php extension nor for no-extension files.

How can I fix this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

GVim should have PHP syntax enabled by default.

1) Check for the existance of the file:

C:\Program Files\Vim\vim73\syntax\php.vim

2)

C:\Program Files\Vim\vim73\filetype.vim
should include the line:

au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp       setf php

It sounds like you might want to try uninstalling GVim and reinstalling it again.

share|improve this answer
    
Thank you jfuga, both the conditions that you mention are true. What else might cause GVIM to refuse to syntax-highlight PHP files? –  dotancohen Apr 17 '12 at 14:00
    
Do you have a _vimrc file? If so, make sure "syntax on" is listed as a command within this file. –  jftuga Apr 17 '12 at 14:04
    
Thanks, I do have that file. In fact, I just found out that removing _vimrc enables syntax highlighting! –  dotancohen Apr 17 '12 at 14:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.