views:

75

answers:

4

In my vim files, when I have a closing php tag in a string, my syntax highlighting stops at that point

Example:

<?php

...  Everything good up to this point

$xml = '<?xml version="1.0"?>';

$foo = 'bar'  <-- starting here I loose highlighting to the end of the file

?>

I'm running version 7.2.245. anyone have ideas why this happens? is it only me? or is this a known bug?

A: 

It isnt a bug, you have actually ended the PHP string. you need to just break it up. Do like "'.'?'.'>' or something

webdestroya
Not true. PHP only honours the ?> tag outside a string context. Putting it in a string just works as expected. In other words, you cannot break out of PHP mode from inside a string literal.
tdammers
+1  A: 

This is normal. Notice the SO syntax highlighter stopped highlighting at that point too ;)

My windows editor does the same thing.

Byron Whitlock
I hope it has other redeeming features, I have been searching for the last couple of minutes, and under debian I cannot find an editor which _doesn't_ get it :)
Wrikken
A: 

Even PHP's built in function works this way (or used to for a long time)

Mchl
used to it is then: `highlight_file` works correct here.
Wrikken
A: 
  • Make sure you have the latest version of the runtime files, or at least the very latest version of the php syntax file.

  • Try using this syntax file instead: www.vim.org/scripts/script.php?script_id=1571

too much php