How to easily add syntax highlighting for custom DSLs in Vim

I am wondering how convenient it is to add custom DSL syntax to VIM. Is there a good tutorial on this topic somewhere?

+3
source share
2 answers

vim wiki on wikia has a good tutorial on creating syntax files

http://vim.wikia.com/wiki/Creating_your_own_syntax_files

+3
source

I'm not sure there are tutorials, but the basic steps are:

  • Read :help syntaxfrom Vim, all this to understand how syntax highlighting works in Vim
  • Look at the existing syntax file in the $ VIMRUNTIME \ syntax, indicating the language closest to what you want. By adapting an existing file, you don't have to rewrite everything from scratch.
  • (+ ), , , .
  • .vimrc, :
    au BufNewFile,BufRead *.newtype set filetype=newtype

, , , - language.vim. vim.org, github.

+2

Source: https://habr.com/ru/post/1790421/


All Articles