>
> Nothing else seems to be interfering for me.
>
>
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...
> In fact your patch could be simplified by just calling ResetPhpOption()
>> after its definition and before returning when 'b:did_indent' exists since
>> the indent script is called on 'au filetype php' by indent.vim
>>
>
> Well, that would simplify the script, but would be a more major change,
> so a more complicated patch, I think. To be honest, when I looked at the
> script, I wondered why it wasn't done that way, because that seems the
> obvious solution. Given that at the moment anyway, nothing seems to be
> interfering with formatoptions after your indent script sets it, is this
> worth a try?
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 finaly comment the line
au BufWinEnter,Syntax *.php,*.php\d,*.phtml,*.ctp,*.inc call
ResetPhpOptions()
In the version 1.29 of the indent script I've "fixed" this issue by using
>> the same detection scheme as filtype.vim:
>> au BufWinEnter,Syntax *.php,*.php\d,*.phtml,*.ctp,*.inc call
>> ResetOptions()
>> http://www.2072productions.com/vim/indent/php.vim (this version was
>> released 3 days ago)
>>
>
> 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()
>
> 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 interferring,
>
>
> 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...)
John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---