Tim Chase wrote:
Yes, I believe that is correct. Actually it might be easier to find if "snit" is anywhere in the file at the beginning of the line (it will always be at the beginning) and then adding some extra keywords in to be colored.

Did I clarify anything? I hope so.

Very much so.

As described in

    :help mysyntaxfile-add

you can learn about how to create extensions to existing (Tcl in this case) syntax files. You'd want to create a ~/.vim/after/syntax/tcl.vim file in which you'd put your checks to see if it's a "snit" file, and then define any syntax items particlar to snit.

To check if it's a snit file, you can look at the $VIMRUNTIME/filetype.vim and search for "SetFileTypeShell", you'll see some code defining the "SetFileTypeShell" function. You can copy&modify this code to find the first non-blank line (it skips over the first shebang line by starting on line 2), and then check with a regexp to see if that line contains something. Or, you could use something like

    let l:isSnit=0
    g/^snit::/let l:isSnit=1
    if l:isSnit ...

to determine whether it's a snit file, and define syntax items accordingly.

If it's a popular OO extension for Tcl, you might then share back your work so that it gets included in the master distribution.

Hope this gets you pointed in the right direction for monkeying with it.

-tim


Thanks! That is exactly pointing me in the right direction.

Robert

Reply via email to