From 14b328301261761b2a3e9724edc6cea045c12a0f Mon Sep 17 00:00:00 2001 From: Martin Spiewak Date: Tue, 18 Feb 2020 11:40:51 -0500 Subject: [PATCH] General improvements and additions (#1) * Don't hightlight end in the middle of a word * Highlight operators * highlight periods * Highlight function parentheses - Also combined operators and used correct highlight colors * Highlight braces * Prepend #@ to newlines if previous line had it * Highlight yttStatement in pink - Also fixes end highlighting * fix based on vint --- autoload/ytt.vim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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()