diff --git a/ftplugin/ledger.vim b/ftplugin/ledger.vim index 257916d..554e8cd 100644 --- a/ftplugin/ledger.vim +++ b/ftplugin/ledger.vim @@ -160,12 +160,11 @@ endif " }}} " Highlight groups for Ledger reports {{{ -hi! link LedgerNumber Number -hi! link LedgerNegativeNumber Special -hi! link LedgerCleared Constant -hi! link LedgerPending Todo -hi! link LedgerTarget Statement -hi! link LedgerImproperPerc Special +hi link LedgerNumber Number +hi link LedgerNegativeNumber Special +hi link LedgerPending Todo +hi link LedgerTarget Statement +hi link LedgerImproperPerc Special " }}} let s:rx_amount = '\('. diff --git a/syntax/ledger.vim b/syntax/ledger.vim index 449968b..0926ab3 100644 --- a/syntax/ledger.vim +++ b/syntax/ledger.vim @@ -29,7 +29,9 @@ syntax clear exe 'syn region ledgerTransaction start=/^[[:digit:]~=]/ '. \ 'skip=/^\s'. s:skip . '/ end=/^/ fold keepend transparent '. - \ 'contains=ledgerTransactionDate,ledgerMetadata,ledgerPosting,ledgerTransactionExpression' + \ 'contains=ledgerCleared,ledgerUncleared,ledgerMetadata,ledgerPosting,ledgerTransactionExpression' +syn match ledgerCleared /^\d\S\+ \* .*$/ contained contains=ledgerTransactionDate +syn match ledgerUncleared /^\d\S\+ [^*].*$/ contained contains=ledgerTransactionDate syn match ledgerTransactionDate /^\d\S\+/ contained syn match ledgerTransactionExpression /^[=~]\s\+\zs.*/ contained syn match ledgerPosting /^\s\+[^[:blank:];][^;]*\ze\%($\|;\)/ @@ -70,9 +72,8 @@ exe 'syn match ledgerApplyHead '. \ '/'.s:oe.'\%(^apply\s\+\)\@<=\S.*$/ contained' highlight default link ledgerComment Comment -highlight default link ledgerTransactionDate Constant highlight default link ledgerTransactionExpression Statement -highlight default link ledgerMetadata Tag +highlight default link ledgerMetadata Comment highlight default link ledgerTypedTag Keyword highlight default link ledgerValueTag Type highlight default link ledgerTag Type @@ -84,9 +85,12 @@ highlight default link ledgerAmount Number highlight default link ledgerPreDeclarationType Type highlight default link ledgerPreDeclarationName Identifier highlight default link ledgerPreDeclarationDirective Type - +highlight default link ledgerTransactionDate String +highlight default link ledgerCleared String +highlight default link ledgerUncleared Statement + " syncinc is easy: search for the first transaction. syn sync clear syn sync match ledgerSync grouphere ledgerTransaction "^[[:digit:]~=]" - + let b:current_syntax = "ledger"