StanAngeloff / php.vim

An up-to-date Vim syntax for PHP (7.x supported)
477 stars 69 forks source link

Undefined variable: main_syntax #50

Closed wilfredjonathanjames closed 8 years ago

wilfredjonathanjames commented 8 years ago

Quite often when switching to a php buffer, I get this error:

Error detected while processing /Users/wgodfrey/dotfiles/vim/bundle/php.vim/syntax/php.vim:
line  850:
E121: Undefined variable: main_syntax
E15: Invalid expression: main_syntax == 'php'

I'm really not sure what to make of it but it's quite frustrating. Closing and reopening vim seems to fix it. If you need any more information please ask.

StanAngeloff commented 8 years ago

Do you run the latest version of php.vim? Do you have any specific bundles/plugins for HTML?

If you are comfortable editing your vimfiles, can you update line 850 of syntax/php.vim to:

if (exists("main_syntax") && main_syntax == 'php')

Run Vim for a while, are any errors reported?

wilfredjonathanjames commented 8 years ago

I'll give it a go and get back to you, thanks Stan

On Mon, Feb 1, 2016 at 9:29 PM, Stan Angeloff notifications@github.com wrote:

Do you run the latest version of php.vim? Do you have any specific bundles/plugins for HTML?

If you are comfortable editing your vimfiles, can you update line 850 of syntax/php.vim to:

if (exists("main_syntax") && main_syntax == 'php')

Run Vim for a while, are any errors reports?

— Reply to this email directly or view it on GitHub https://github.com/StanAngeloff/php.vim/issues/50#issuecomment-177841210 .

wilfredjonathanjames commented 8 years ago

@StanAngeloff That seems to fix the problem. Removed it and it came back, put it back in and it went away.