From 31d8d41d0201e91b8cb2557c691df360ba982cbd Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Fri, 11 Jun 2010 13:28:23 +0200 Subject: vim. add syntax highlighting for tag/pop --- contrib/vim/syntax/ledger.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'contrib/vim') diff --git a/contrib/vim/syntax/ledger.vim b/contrib/vim/syntax/ledger.vim index c96e4c3c..61f9a2e5 100644 --- a/contrib/vim/syntax/ledger.vim +++ b/contrib/vim/syntax/ledger.vim @@ -43,14 +43,24 @@ let s:currency = '\([$€£¢]\|\w\+\)' let s:figures = '\d\+\([.,]\d\+\)*' let s:amount = '-\?\('.s:figures.'\s*'.s:currency.'\|'.s:currency.'\s*'.s:figures.'\)' exe 'syn match Amount /'.s:amount.'/ contained' -syn match MetadataTag /:\zs[^:]\+\ze:\|;\s*\zs[^:]\+\ze:[^:]\+$/ contained +syn match MetadataTag /:[^:]\+:/hs=s+1,he=e-1 contained +syn match MetadataTag /;\s*\zs[^:]\+\ze:[^:]\+$/ contained +syn region TagStack + \ matchgroup=TagPush start=/^tag\>/ + \ matchgroup=TagPop end=/^pop\>/ + \ contains=TagHead,TagStack,transNorm +syn match TagHead /\%(^tag\s\+\)\@<=\S.*$/ contained contains=tagKey transparent +syn match TagKey /:[^:]\+:/hs=s+1,he=e-1 contained +syn match TagKey /\%(^tag\s\+\)\@<=[^:]\+\ze:[^:]\+$/ contained highlight default link transDate Constant highlight default link Metadata Tag highlight default link MetadataTag Type +highlight default link TagPop Tag +highlight default link TagPush Tag +highlight default link TagKey Type highlight default link Amount Number -highlight default link Comment Comment highlight default link Account Identifier " syncinc is easy: search for the first transaction. -- cgit v1.2.3