diff --git a/autoload/ytt.vim b/autoload/ytt.vim index 2eab339..46b4f09 100644 --- a/autoload/ytt.vim +++ b/autoload/ytt.vim @@ -4,6 +4,14 @@ let s:save_cpo = &cpo set cpo&vim +function! YttEnter() + if getline('.') =~# '^#@.*$' + return "\o#@ " + else + return "\" + endif +endfunction + function! ytt#enable() if exists(':ALEDisable') != 0 :ALEDisable @@ -20,19 +28,28 @@ function! ytt#enable() syn match yttConditional "if/end" contains=starlarkConditional contained syn match yttRepeat "for/end" contains=starlarkRepeat contained - syn match yttEnd "end" contained + syn match yttEnd "\" contained syn match yttSpecial "#@" contained + syn match yttOperator "[+|=|!|:|\.]" contained + syn match yttFunction "[A-Za-z_]*(" contained + syn match yttFunction "[)|,]" contained + syn match yttBlock "[{|}]" contained hi def link yttConditional Conditional hi def link yttRepeat Repeat hi def link yttEnd Statement hi def link yttSpecial Special + hi def link yttOperator Operator + hi def link yttFunction Function + hi def link yttBlock Operator syn region yttStatement start="#@" end="$" - \ contains=starlarkStatement,starlarkConditional,starlarkRepeat,starlarkOperator,starlarkType,starlarkBuitin,starlarkInclude,starlarkBlock,starlarkParen,starlarkString,,yttSpecial,yttConditional,yttRepeat,yttEnd - hi def link yttStatement Comment + \ contains=starlarkStatement,starlarkConditional,starlarkRepeat,starlarkOperator,starlarkType,starlarkBuitin,starlarkInclude,starlarkBlock,starlarkParen,starlarkString,,yttSpecial,yttConditional,yttRepeat,yttEnd,yttOperator,yttFunction,yttBlock + highlight yttStatement guifg=Pink syn sync minlines=500 + + imap YttEnter() endfunction function! ytt#disable()