03 January 2009

"Error ... ../php.vim" Update

I wrote about this annoying "E10" error once before. It doesn't crash anything, it just gives a long error message and pause (/"Enter to continue") every time you open a php file in vim with syntax high-lighting enabled. It's probably triggered by other syntax rule files as well. (Several variants of vim are found in FreeBSD ports under the editors category.)

I wrote to the port maintainer and he pointed out that the "problem" file, "php.vim", is not modified by the ports system. So, I poked around the vim site -- I couldn't possibly be the only person who's run into this -- and I found a setting that can prevent this problem. The E10 error message is described here. The issue is simply a vi-compatibility option that prevents vim from allowing backslashed line-continuations in sourced files (like the php.vim syntax rules script). The error will no longer appear when you disable this option with this vim command:
:set cpo-=C
... which can be put into your vimrc file. Which should be "~/.vimrc" for your personal startup file and "/usr/local/share/vim/vimrc" for the system-wide file. (You may need to create the system-wide file.) ... A much more elegant solution than modifying the php.vim file!

With great functionality comes great complexity.

Still, there's a better solution that avoids the error from the beginning regardless of the 'cpo' options: the vim developers ought to modify the php.vim file to remove the backslashed line-continuations. I'm all for neatly formatted code -- but not at the expense of user irritation!