On 12-Mar-2012 23:31:02 +0700, Charles wrote:

> On 3/12/12, Ben Fritz <fritzophre...@gmail.com> wrote:
>> On Monday, March 12, 2012 12:43:30 AM UTC-5, char101 wrote:
>>
>> You are correct that runtime! will run all the matched files, but what
>> you're missing is that most (all?) syntax files distributed with Vim have
>> something like the following at the top:
> 
> Hi,
> 
> Yes, that's right, but before that there is also this check
> 
> if ! exists('main_syntax')
>   " check if current_syntax has been defined
> endif
> 
> Now, when a syntax file is include using syn include, the main syntax
> is already defined, so that check will not be performed. One of the
> most common case is when editing a html file. I have a custom
> javascript syntax in my .vim. And I have checked that my custom syntax
> is being overriden by the default syntax (both are using the same
> syntax group name).
> 
> I realize that vim is using runtime! to be able to handle /after/
> directories, because they are put in runtimepath. Without using
> runtime!, the /after/ directories will not be sourced.

I have run into this issue, too. Normally, b:current_syntax is used as an
inclusion guard, giving precedence of .vim/syntax/foo.vim over
$VIMRUNTIME/syntax/foo.vim, but with main_syntax set, this check isn't active,
and _all_ syntax plugins are actually executed.

> I have changed source_runtime is ex_misc2.c so that it will always
> source the files in /after/ directories regardless of the "all"
> parameter. And I have changed the usage of runtime! in
> syntax/synload.vim and indon.vim to runtime only. So far vim runs fine
> and I think it's a more correct way of sourcing syntax and indent
> files (now only my custom syntax and indent files that show up in
> :scriptnames, but all /after/ syntax are still being sourced, e.g. the
> css3-syntax files).

I'm skeptical that changing the core logic is the right way to solve this,
though it can be effective. Isn't it confusing that part of the complex logic is
now in Vim, and part in the syntax files? Why then not go the full way and
introduce a :syntaxsource command that hides all of this?
I would favor updating all individual syntax files with an improved logic; I
know that this is tedious, but it has been done before (recently for :set cpo
robustness).

-- regards, ingo

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to