> Have you tried to edit "mixed" files? PHP files containing HTML and or
> javascript or other languages, I think it was mostly to prevent this
> kind of interferences but I really don't remember...
Yep. Most of my files are 'mixed.'
> The patch is simple, you just have to add two times the same line at
> different places:
>
> add
>
> call ResetPhpOptions()
>
> right after the function is defined and replace
>
> if exists("*GetPhpIndent")
> finish " XXX
> endif
> by
>
> if exists("*GetPhpIndent")
> call ResetPhpOptions()
> finish " XXX
> endif
>
> (it was not right after 'if exists("b:did_indent")' like I said in my
> previous message)
>
> and finally comment the line
>
> au BufWinEnter,Syntax *.php,*.php\d,*.phtml,*.ctp,*.inc call
> ResetPhpOptions()
You also have to move the whole function definition of ResetPhpOptions,
or it's called before it's defined. I guess it's more a larger change
than a more complicated change, which is really what I meant.
> That will break things. *.inc can be other file types, and if you edit
> one of them after editing a plain .php file or such, which isn't all
> that unlikely, your new autocommand will kick in when it shouldn't.
>
> No, I've added a check for &filetype=php in ResetPhpOptions()
OK, cool.
> Of course, it'll break if new file extensions are added to
> filetype.vim :/
>
> Yes. A much bigger problem, though, is that it will break when users add
> new extensions or patterns to their .vimrc, or issue :set ft=php on the
> commandline (I personally do that a lot). Both those things really
> should get the formatoptions set correctly but don't unless the filetype
> autocommand alone can trigger the setting of formatoptions.
>
> I've applyed the patch above to my version of the script, I'll see if
> something is interfering,
Cool. If you post it or send it to me, I'm happy to install it and see
if I notice any ill effects, too.
> The real problem is that all of this has nothing to do in the
> indent script, it should be set in ftplugin/php.vim
> (I CC the maintainer)
>
> True. How about moving this stuff into there, Dan?
>
> I remember something now about why I did put those format options in my
> script, it's clear that the 'comments' option should be set in the
> ftplugin but the formatoptions are more a user choice that should only
> be set in user pref files. I've set the formatoptions in my script
> because I know that if I don't, almost noone will set them ever... and
> most people will just not know this feature exists:/ (I stumble on it by
> accident myself...)
You don't think? I personally use filetype plugins often but indent
rarely (I often reverse their effects with an after-script) and I think
a lot of people are similar.
I don't suppose it matters all that much, but my personal opinion is
that indent should really just be about indent, and formatting features
should be in the ftplugins.
Ben.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---