Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use vim syntax definition with sublime-text2

Does anyone know if you can use (or convert) vim Syntax Highlight Definition Files with Sublime Text?

I am searching for a highlighter for promela and only found one for vim, but am using sublime-text as my default editor

The Definition i've found https://github.com/vim-scripts/promela.vim/blob/master/syntax/promela.vim

like image 267
Tobi Avatar asked Dec 19 '13 17:12

Tobi


People also ask

How do I use syntax in Sublime Text 3?

To enable Syntax Highlighting click on “View” in the top bar, then hover your mouse over “Syntax”, and select your programming language from the list. Alternatively, if you save a document with a supported file extension, Sublime Text 3 will automatically apply the Syntax Highlighting for that language.

How do I enable syntax in Vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

How do I change the syntax highlighting in Sublime Text?

The colors of the syntax highlighting depend on Sublime Text's color theme. You can change the theme by going to Preferences > Color Scheme.

Where does sublime save syntax?

Go to Tools | Packages | Package Development | New Syntax Definition. Save the new file in your Packages/User folder as a . YAML-tmLanguage file.


1 Answers

Sublime Text uses the XML-based PLIST .tmLanguage format for language definitions, and to my knowledge no one has written a converter for vim syntaxes. However, if you'd like to take a stab at creating one yourself, I'd recommend installing the PackageDev plugin for ST2 (it doesn't really work on ST3 yet). It allows you to define syntaxes using YAML, which is much easier to work with than XML, and the regexes are in Onigurama format. You can then use the YAML to PLIST converter to translate everything into a .tmLanguage format that Sublime will understand.

EDIT

PackageDev recently released a new version with full compatibility for ST3. It is available via Package Control.

like image 97
MattDMo Avatar answered Oct 13 '22 05:10

MattDMo