php "lost" syntax highlighting
I work on several php projects and it happens quite often that code turns grey at a point, indentation for all subsequent edits breaks up and so does complention.
Php files are drupal modules so I've added autocmd BufRead,BufNewFile *.module set filetype=php" to my vimrc.local but problem is still there.
I have this problem every once in a while as well. Although I don't have a fix for the root of the problem running the colon command syn sync fromstart usually fixes the issue for me after the fact.
Well, I fix that by going backward to the top of file using PgUp and usually it fixes after some hits.
EDIT
syn sync fromstart is formally better and easily to map beside EnablePHPFolds ;-) thank you for pointing this out
I find this happens from time to time when you overwrite a swap file. It's easily fixed on the file in question with something like this:
:set syntax=PHP
do any of you follks still have the csapprox plugin installed? i haven't seen this issue since i removed it, but that could just be coincidence.
On 19/11/14 at 04:10am, Adam Merrifield wrote:
I find this happens from time to time when you overwrite a swap file. It's easily fixed on the file in question with something like this:
:set syntax=PHP
not a permanent solution nor a good one, it happens really often (on big files at least)
it's better to add this line to your .vimrc.local
map
On 19/11/14 at 04:18am, Johnny Robeson wrote:
do any of you follks still have the csapprox plugin installed? i haven't seen this issue since i removed it, but that could just be coincidence.
nope, it's not in the bundle
I get this too, mostly on big files. I'm working in Ruby/Puppet so it isn't specific to any one language. Thanks for the key mapping tip, @cassiel74 .
I have the same problem with php files. It usually happens on big files with folds.
I have same issues here, with php file and folds. When I expand a fold in the beginning of the file it has colors, if I continue expanding folders in sequences, colors works, but If I skip one fold and expand the next, no colors around. Will turn off auto auto folding for now.
For the record, it just happens if file's extension is not .php, in my case, .inc
Just sharing. I've had the same problem with a PHP file. It seems to be a problem with folding. The "syn sync" command didn't solved it. When I unfold all blocks The highlight works and, after that, it still working even if I close the file and reopen it. Don't know why.
I probably stays working because of the .view built for that file in .vimviews. Try deleting it. It should go back to a broken state again.
Same problem here: Large PHP files with lots of folds. Some content within folds have syntax highlighting while others do not. Executing :syn sync fromstart works to remedy the problem.
Still looking for a way to prevent this automatically ...
Same problem, usually in connection with deleted swap files as @seyDoggy .
:syn sync fromstart didn't fix the issue for me,
setting the filetype explicitly with :set syntax=tex helped.
Thanks @jrobeson! The issue for me was .vimviews. Somehow I removed the folds from my PHP files and all the text was gray. Deleting the views via sudo rm -R ~/.vimviews/* did the trick!