4

I'm looking for a ChatScript language Syntax highlighting, of course for the Vim editor.

ChatScript is a great (underrated) open-source language to build chatbots dialog flows scripts, made by Bruce Wilcox. But it seems to me that doesn't yet exist any syntax support for Vim.

BTW, There is already a splendid syntax package for sublime text editor, see for possible inspiration:

chatscript example

So my question is: there is someone already created a syntax highlighting .vim file for ChatScript ? Or want to do a github project with me to share as open source a chatscript.vim syntax file ?

Premising I'm beginner on vim scripting (for syntax highlighting), any suggestion to how to proceed ? Is this a good start ?

UPDATE Anyone know if there is any "tmLanguage or CSON" converter to .vim syntax highlighting file (if so I could just convert work done here ?

Thanks giorgio

3

You can search for vim plugins at Vim.org, which used to be the official repository.

But nowadays many people store their plugins directly at github and doesn't provide a link no Vim.org. Fortunately there is Vim Awesome, which attempts to gather all the information about Vim plugins.

After a quick search it seems there is no syntax highlight plugin for this language; but it is not hard to write one at all.

In addition to the wiki link you mentioned and the great book (Learn Vimscript the Hard Way) mentioned by @nobe4, you should definitively check the explanation at :help usr_44:

Vim comes with highlighting for a couple of hundred different file types.  If
the file you are editing isn't included, read this chapter to find out how to
get this type of file highlighted.  Also see |:syn-define| in the reference
manual.

As you already have the syntax highlight plugin for another editors, it will probably be a matter of translating it to Vim format. Usually the part that takes more time is writing the regular expressions; but in this case you could just translate them with the aid of 'incsearch' and 'hlsearch' options, and the descriptions at :help pattern.

If you succeed you should consider including it at vim.org :)

  • thanks, yes I'll possibly try to port the great work Samuel Cousin done for sublime text editor, compiling regex grammars on .cson file. My aim is to publish result on github (and via vim Awesome also), but because I'm a very beginner I wish to know is there is someone already done (a draft/base point) to avoid start from scratch. – Giorgio Robino Jul 26 '16 at 11:37
  • 3
    I think what you can do is create a ChatScript file, and add rules one at a time, to fully understand what is happening. In terms of "inspiration" you can have a look at the included vim syntax files. – nobe4 Jul 26 '16 at 11:39
  • 2
    @GiorgioRobino I agree with @nobe4, you should start small, and use the vim built-in syntax files as a base (which can be found at $VIMRUNTIME/syntax). You could also start by reading the :h usr_44, which explains the basics with many examples. – mMontu Jul 26 '16 at 11:42
0

I allow myself to answer myself, following my shared proposal:

https://github.com/solyarisoftware/ChatScript.vim

I'm not a vimL regex expert and any suggestion/update is very welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.