Skip to content

Commit 0b6f86b

Browse files
committed
fix: improve vim syntax highlighting
1 parent 52ee88e commit 0b6f86b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

vim-ledger/syntax/ledger.vim

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
syn match ledgerComment /;.*/
66

7-
syn match ledgerFloatAmount /\<-\?\d\+\.\d\+\>/
8-
syn match ledgerIntAmount /\<-\?\d\+\>/
7+
syn match ledgerFloatAmount /\<-\?\d\+\.\d\+\>/ contained
8+
syn match ledgerIntAmount /\<-\?\d\+\>/ contained
99

10-
syn match ledgerAccount /\<\%(\%(\w\|\s\)\+:\)\+\%(\w\|\s\)\+\D\>/
11-
syn match ledgerAccountEOL /\<\%(\%(\w\|\s\)\+:\)\+\w\+\>$/
10+
syn match ledgerAccount /\<\%(\%(\w\|\s\)\+:\)\+\%(\w\|\s\)*\w\+\s\{2}/me=e-2 contained
11+
syn match ledgerAccountEOL /\<\%(\%(\w\|\s\)\+:\)\+\%(\w\|\s\)*\w\+\>$/ contained
12+
13+
syn match ledgerPostingEmpty /^\s\{2,}.*$/ contains=ledgerAccountEOL
14+
syn match ledgerPostingAmount /^\s\{2,}\S.\+\s\{2,}.\+$/ contains=ledgerAccount,ledgerFloatAmount,ledgerIntAmount
1215

1316
syn match ledgerPayeeComment /;.*/ contained
1417
syn match ledgerDate /^\d\{4}\%(\/\|-\)\d\{2}\%(\/\|-\)\d\{2}\>/ contained

0 commit comments

Comments
 (0)