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.

I'm running cygwin on my Windows box, and everytime I open up a php file using vim, i get this error:

sendgrid-test.php" 7L, 46C
Error detected while processing /usr/share/vim/syntax/php.vim:
line  112:
E108: No such variable: "b:current_syntax"
Press ENTER or type command to continue

The file opens just fine, but the highlighting is very messed up, it's difficult to get in there and code. I'm not sure where to start so that I can ensure vim has proper syntaxing for PHP on this machine. Does anybody have any ideas?

Thanks, Arie

share|improve this question
    
Did you try just deleting the line 112 from the file mentioned? It might just work. –  Rudolf Mühlbauer Oct 12 '12 at 18:04
    
The file syntax/php.vim sources other syntax files and apparently expects b:current_syntax to have been set by one of them, syntax/sql.vim, I think. I don't see that error so I wonder if some files are missing from your installation. Try executing ":scriptnames". Towards the bottom of that list you should see /usr/share/vim/syntax/php.vim followed by .../html.vim, .../javascript.vim, .../vb.vim, .../css.vim, .../sql.vim and .../sqloracle.vim. At least that's what I see. –  garyjohn Oct 12 '12 at 18:20
    
Here is the result of running :scriptnames: : /usr/share/vim/vimrc 2: /usr/share/vim/syntax/syntax.vim 3: /usr/share/vim/syntax/synload.vim 4: /usr/share/vim/syntax/syncolor.vim 5: /usr/share/vim/filetype.vim 6: /usr/share/vim/plugin/matchparen.vim 7: /usr/share/vim/syntax/php.vim 8: /usr/share/vim/syntax/html.vim 9: /usr/share/vim/syntax/javascript.vim 10: /usr/share/vim/syntax/vb.vim 11: /usr/share/vim/syntax/css.vim 12: /usr/share/vim/syntax/sql.vim –  ariestav Oct 12 '12 at 18:22
    
Which version of Vim? (:version within Vim, or vim --version on the command line) –  Heptite Oct 12 '12 at 18:45
1  
Very much outdated. If you're using cygwin, you should be able to re-run the cygwin installer and it will update Vim (and probably a lot of other stuff). –  Heptite Oct 12 '12 at 19:12
show 3 more comments

1 Answer

You seem to be missing the syntax/sql.vim script, which syntax/php.vim is including. As others have pointed out in the comments, you Vim installation is pretty outdated, so an update might fix things already.

To just pragmatically get rid of the error, create a ~/.vim/syntax/sql.vim file with just

:let b:current_syntax = 'sql'

in it, or change the :unlet at line 112 to :unlet!.

share|improve this answer
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.