Skip to content

Commit a53b3b9

Browse files
committed
highlight posting amount
Please file an issue if this slows down your Vim too much, we may then decide to make some of the syntax groups optional.
1 parent 01c76d8 commit a53b3b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

syntax/ledger.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ syn region ledgerTransaction start=/^[[:digit:]~=]/ skip=/^\s/ end=/^/
2323
syn match ledgerTransactionDate /^\d\S\+/ contained
2424
syn match ledgerTransactionExpression /^[=~]\s\+\zs.*/ contained
2525
syn match ledgerPosting /^\s\+[^[:blank:];][^;]*\ze\%($\|;\)/
26-
\ contained transparent contains=ledgerAccount,ledgerMetadata
26+
\ contained transparent contains=ledgerAccount,ledgerAmount,ledgerMetadata
2727
" every space in an account name shall be surrounded by two non-spaces
2828
" every account name ends with a tab, two spaces or the end of the line
2929
syn match ledgerAccount /^\s\+\zs\%(\S\@<= \S\|\S\)\+\ze\%( \|\t\|\s*$\)/ contained
30+
syn match ledgerAmount /\S\@<=\%( \|\t\)\s*\zs\%([^;[:space:]]\|\s\+[^;[:space:]]\)\+/ contained
3031

3132
syn region ledgerPreDeclaration start=/^\(account\|payee\|commodity\|tag\)/ skip=/^\s/ end=/^/
3233
\ keepend transparent
@@ -61,6 +62,7 @@ highlight default link ledgerStartApply Tag
6162
highlight default link ledgerEndApply Tag
6263
highlight default link ledgerApplyHead Type
6364
highlight default link ledgerAccount Identifier
65+
highlight default link ledgerAmount Number
6466
highlight default link ledgerPreDeclarationType Type
6567
highlight default link ledgerPreDeclarationName Identifier
6668
highlight default link ledgerPreDeclarationDirective Type

0 commit comments

Comments
 (0)