On Monday, March 12, 2012 12:43:30 AM UTC-5, char101 wrote:
> Hi,
> 
> I found these two explanations to be incompatible:
> 
> :help syntax-loading
> 
> The step before the last step is:
> 
>       When the 'syntax' option was set above, this triggers an autocommand
>     | from |synload-1| (and |synload-2|).  This find the main syntax file in
>     | 'runtimepath', with this command:
>     |         runtime! syntax/<name>.vim
> 
> :help mysyntax-replace
> 
> REPLACING AN EXISTING SYNTAX FILE                     *mysyntaxfile-replace*
> 
> If you don't like a distributed syntax file, or you have downloaded a new
> version, follow the same steps as for |mysyntaxfile| above.  Just make sure
> that you write the syntax file in a directory that is early in 'runtimepath'.
> Vim will only load the first syntax file found.
> 
> Running runtime! will include *all* syntax files, while the second
> explanation says
> "Vim will only load the first syntax file found".
> 
> I think the right command should be runtime (not runtime!) because
> using runtime!
> is problematic with syntax files loaded using syn include (both custom
> syntax and
> default syntax will be loaded and both will run resulting in the default 
> syntax
> overriding the custom syntax).

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:

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

and later:

let b:current_syntax = "c"

So, only the first matching syntax file actually does anything, any other files 
which run will abort early if written properly.

-- 
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

Raspunde prin e-mail lui