Karl Merkley wrote:
>>> I would like to create a syntax file for an analysis code that I
>>> use. I'm having some problems figuring out how to do a couple of
>>> things in my syntax file. So I have several questions.
>>>
>>> For this portion of the text the basic syntax is a keyword/value
>>> pair.
>>>
>>> I am trying something like the following:
>>>
>>> syntax match adgAST /AdaptiveStrategyType/ nextgroup=adgASTEnum
>>> syntax match adgASTEnum /Default None/ contained
>>>
>>> I get highlighting for the AdaptiveStrategyType keyword but the next
>>> word on the line should be one of Default or None. No other values
>>> are allowed after the keyword and I'm not getting any syntax
>>> highlighting for these values.
>> /Default None/ means the string "Default None", not "Default" or
>> "None". To match `+/-', you might do something like this:
>> syn match GroupName "+/-"
>> (The pattern delimiters don't have to be /.../, but can be any 2
>> identical characters.
>> :help syn-pattern
>>
>> Brett S.
>>
>>> I also have values of the form "+/-" or paths like /usr/local/
>>> adagio. How do I escape the /? Doing a simple backslash to escape
>>> the slash doesn't seem to work.
>>>
>>> I also have values that are space separated, like "is one of." How
>>> do match just that entire string and not just the parts?
>>>
>>> Are there any additional tutorials on creating syntax files other than
>>> what is in the vim docs?
>>>
>>> Also, is there anything special that have to do to get this syntax
>>> file to work with omni-complete?
>>>
>>> Any pointers would be appreciated.
>
> Thanks for the pointer to patterns. That helped a lot! OK so this is what
> I ended up with here.
>
> syntax match adgAST /AdaptiveStrategyType/ nextgroup=adgASTEnum skipwhite
> syntax match adgASTEnum /Default\|NONE\|Refine_fixed_fraction/ contained
>
> Once I read about patterns a little more I also got the slashes / escaped
> properly and I also got the spaces taken care of.
>
> There are still a couple of things that I want to do. If the user places
> something that is _not_ in the pattern branch (an error situation) I would
> like to highlight the error red.
One thing you might want to take advantage of here is the fact that when
multiple matches exist, the group defined *last* takes precedence.
Taking a very simplistic example to illustrate the point...
syn match Err /\S\+/
syn match A /abc\|def\|ghi/
The Err group will be used for any sequence of non-whitespace characters
other than abc, def, and ghi.
>
> Also, I still don't understand the omni-complete with the syntax file. I
> do
>
> setlocal omnifunc=syntaxcomplete#Complete
>
> but it doesn't find any completions. What else do I need to do?
For one thing, I believe omnifunc syntax completion works only for
keywords. Have you defined any?
Brett Stahlman
>
> Thanks,
> Karl
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---