How to disable all HTML syntax highlighting while editing a Php file in Vim -


i want write php template generates apache configuration files.

for matter, while editing template, don't need html syntax highlighting outside php tags, because raw code outside tags apache configuration, not html code.

apache syntax, html, uses <angle brackets>... standard php.vim syntax file causes disturbing visual highlightings.

question: there way disable highlighting of html tags inside php file (while keeping php syntax), using vim, , without forking / tweaking original syntax file?

note: ideal thing replace html syntax apache configuration syntax (still outside php tags), important remove unwanted html syntax highlighting.

this isn't hard do, there ongoing maintenance cost if want keep syntax file date.

first, find vim library. on mac/linux systems someplace /usr/share/vim/vim74/syntax/. there file named php.vim there. that's file containing of syntax highlighting rules php.

make personal syntax directory, if don't have 1 already. make copy of global php.vim file in directory.

mkdir -p $home/.vim/syntax cp /usr/share/vim/vim74/syntax/php.vim $home/.vim/syntax 

then modify copy made. file found on system has section near top.

if version < 600   unlet! php_folding   if exists("php_sync_method") && !php_sync_method     let php_sync_method=-1   endif   <sfile>:p:h/html.vim else   runtime! syntax/html.vim   unlet b:current_syntax endif 

as can see, there 2 cases reads/imports html.vim file. can comment cases out (changes on 3 lines):

if version < 600   unlet! php_folding   if exists("php_sync_method") && !php_sync_method     let php_sync_method=-1   endif   " <sfile>:p:h/html.vim else   " runtime! syntax/html.vim   " unlet b:current_syntax endif 

the ongoing maintenance cost comes in form: vim upgraded, periodically global php.vim file updated. if have made own copy being used instead, not updates (unless make , patch copy). whether that's issue you.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -