From ed6f2154e964116e36de601702f1ac4010d74aaf Mon Sep 17 00:00:00 2001 From: Konstantin Mikhailov Date: Fri, 7 Oct 2016 17:23:25 +0000 Subject: Improve flag support Beancount allows to attach flags to transactions and even to the postings themselves. At the moment it supports 12 different flags. Full list can be found in beancount sources https://bitbucket.org/blais/beancount/src/tip/src/python/beancount/parser/lexer.l?fileviewer=file-view-default#lexer.l-199 The commit updates syntax highlighting and AlignCommodity function to respect all flags. --- syntax/beancount.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'syntax') diff --git a/syntax/beancount.vim b/syntax/beancount.vim index 814c3f3..fd61d81 100644 --- a/syntax/beancount.vim +++ b/syntax/beancount.vim @@ -19,7 +19,7 @@ syn match beanCurrency "\v\w+" contained syn match beanAccount "\v[[:alnum:]]+:[-[:alnum:]:]+" contained syn match beanTag "\v#[-[:alnum:]]+" contained syn match beanLink "\v\^\S+" contained - +syn match beanFlag "\v[!&#?%PSTCURM]" contained " Most directives start with a date. syn match beanDate "^\v\d{4}[-/]\d{2}[-/]\d{2}" skipwhite @@ -51,11 +51,11 @@ syn region beanPushTag matchgroup=beanKeyword start="\v^(push|pop)tag" end="$" syn region beanPad matchgroup=beanKeyword start="pad" end="$" contained \ keepend contains=beanAccount,beanComment -syn region beanTxn matchgroup=beanKeyword start="\v\s+(txn|[*!])" skip="^\s" +syn region beanTxn matchgroup=beanKeyword start="\v\s+(txn|[!&#?%PSTCURM])" skip="^\s" \ end="^" keepend contained fold \ contains=beanString,beanPost,beanComment,beanTag,beanLink,beanMeta -syn region beanPost start="^\v\C\s+[A-Z]@=" end="$" - \ contains=beanAccount,beanAmount,beanComment,beanCost,beanPrice +syn region beanPost start="^\v\C\s+(([!&#?%PSTCURM]\s+)?[A-Z])@=" end="$" + \ contains=beanFlag,beanAccount,beanAmount,beanComment,beanCost,beanPrice syn region beanMeta matchgroup=beanTag start="^\v\C\s+[a-z][-_a-zA-Z0-9]*:(\s|$)@=" end="$" syn region beanCost start="{" end="}" contains=beanAmount contained @@ -86,3 +86,4 @@ highlight default link beanPrice Number highlight default link beanTag Comment highlight default link beanLink Comment highlight default link beanMeta Comment +highlight default link beanFlag Keyword -- cgit v1.2.3-2-gb3c3