aboutsummaryrefslogtreecommitdiffstats
path: root/syntax
diff options
context:
space:
mode:
authorNathan Grigg2014-12-31 06:13:25 -0800
committerNathan Grigg2014-12-31 06:13:25 -0800
commite8fb2c66efc0d7e72e1fe3b42572bcca0f0aa794 (patch)
tree031b8e113108f1be2c3d63ec1dc63f0ef039c02c /syntax
parent9dfb7a3e57ec9b4535a679572596cbe746b1f536 (diff)
downloadvim-beancount-e8fb2c66efc0d7e72e1fe3b42572bcca0f0aa794.tar.gz
tags, links, and metadata syntax highlighting
Diffstat (limited to '')
-rw-r--r--syntax/beancount.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/syntax/beancount.vim b/syntax/beancount.vim
index 6498290..f8ca84a 100644
--- a/syntax/beancount.vim
+++ b/syntax/beancount.vim
@@ -17,6 +17,8 @@ syn match beanAmount "\v[-+]?[[:digit:].,]+" nextgroup=beanCurrency contained
syn match beanCurrency "\v\w+" contained
" Account name: alphanumeric with at least one colon.
syn match beanAccount "\v[[:alnum:]]+:[[:alnum:]:]+" contained
+syn match beanTag "\v#[a-z]+" contained
+syn match beanLink "\v\^\S+" contained
" Most directives start with a date.
@@ -47,12 +49,13 @@ syn region beanPad matchgroup=beanKeyword start="^pad" end="$" contained
\ contains=beanAccount,beanComment
syn region beanTxn matchgroup=beanKeyword start="\v(txn)?\s+[*!]" skip="^\s"
- \ end="^" contains=beanString,beanPost,beanComment contained
-syn region beanPost start="^\v\s+" end="$"
+ \ end="^" contains=beanString,beanPost,beanComment,beanTag,beanLink,beanMeta contained
+syn region beanPost start="^\v\C\s+[A-Z]@=" end="$"
\ contains=beanAccount,beanAmount,beanComment,beanCost,beanPrice
+syn region beanMeta matchgroup=beanTag start="^\v\C\s+[a-z]+:(\s|$)@=" end="$"
+
syn region beanCost start="{" end="}" contains=beanAmount contained
syn match beanPrice "\V@@\?" nextgroup=beanAmount contained
-" TODO: tags and links
highlight default link beanKeyword Keyword
highlight default link beanOptionTitle Keyword
@@ -64,3 +67,6 @@ highlight default link beanAmount Number
highlight default link beanCurrency Number
highlight default link beanCost Number
highlight default link beanPrice Number
+highlight default link beanTag Comment
+highlight default link beanLink Comment
+highlight default link beanMeta Comment