Thursday, June 30, 2011

Re: vimSubst

Charles Smith wrote:
> The "after" directory is new to me, thank you for introducing it to me. Unfortunately, I can find very little information about how it works exactly (vim version 7.2.264).
>
> I don't understand this mechanism...
>
> Normally, when a file matching a particular name pattern is loaded
> into a buffer, a syntax file matching that pattern is loaded and
> invoked. Now, the rules that are causing me trouble are defined in a
> file called vim.vim and I don't find any matching patterns using
> that syntax file in my own filetypes.vim or the system-wide one.
>
> In general, it seems a pity that new features should break such
> simple, unambiguous, and useful functionality as, e.g. "syn clear":
>
> "This command should be used when you want to switch off syntax
> highlighting, or when you want to switch to using another syntax.
> It's normally not needed in a syntax file itself, because syntax is
> cleared by the autocommands that load the syntax file. The command
> also deletes the "b:current_syntax" variable, since no syntax is
> loaded after this command."
>
> Hopefully, I'm still missing something ...
>
"syn clear" is not broken. If one loads syntax definitions after a "syn
clear", then that new syntax applies; in fact, many of the syntax files
distributed with vim have "syn clear" embedded in them.

So your difficulty I suspect is in understanding the loading sequence.
Here's some reading on the subject:

:help .vimrc
:help load-plugins
:help 'runtimepath'

Your first email mentioned that "syn clear" didn't work in your syntax
file. What is it named, in what directory is it in (so we may infer
when it gets loaded), how are you triggering your syntax to be loaded
(.vim/filetype.vim?) and how does syntax/vim.vim get involved?

Remember that things that are loaded later can modify what's happened
thus far. So, if your syntax file is loaded with its "syn clear" and
then syntax/vim.vim is loaded, naturally vim.vim's definitions have not
been cleared; in this case they weren't even loaded and defined when
that "syn clear" was issued.

Regards,
Chip Campbell

--
You received this message from the "vim_use" 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

No comments:

Post a Comment