diff options
-rw-r--r-- | autoload/beancount.vim | 2 | ||||
-rw-r--r-- | syntax/beancount.vim | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/autoload/beancount.vim b/autoload/beancount.vim index 2096679..ecd423b 100644 --- a/autoload/beancount.vim +++ b/autoload/beancount.vim @@ -18,7 +18,7 @@ function! beancount#align_commodity(line1, line2) " This matches an account name followed by a space. There may be " some conflicts with non-transaction syntax that I don't know about. " It won't match a comment or any non-indented line. - let end_acc = matchend(s, '^\v([\-/[:digit:]]+\s+(balance|price))? +\S+[^:] ') + let end_acc = matchend(s, '^\v(([\-/[:digit:]]+\s+(balance|price))|\s+[!&#?%PSTCURM])?\s+\S+[^:] ') if end_acc < 0 | continue | endif " Where does commodity amount begin? let end_space = matchend(s, '^ *', end_acc) 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 |