diff --git a/doc/ledger.txt b/doc/ledger.txt index 1913d62..c0ccf97 100644 --- a/doc/ledger.txt +++ b/doc/ledger.txt @@ -304,6 +304,10 @@ behaviour of the ledger filetype. let g:ledger_commodity_sep = '' +* Flag that enable the spelling of the amount: + + let g:ledger_commodity_spell = 1 + * Format of transaction date: let g:ledger_date_format = '%Y/%m/%d' diff --git a/syntax/ledger.vim b/syntax/ledger.vim index 7fd202f..3538bbd 100644 --- a/syntax/ledger.vim +++ b/syntax/ledger.vim @@ -21,6 +21,11 @@ if s:fb == 1 let s:skip .= '\n\@!' endif +let s:ledgerAmount_contains = '' +if get(g:, 'ledger_commodity_spell', 0) == 0 + let s:ledgerAmount_contains .= '@NoSpell' +endif + " for debugging syntax clear @@ -39,7 +44,7 @@ syn match ledgerPosting /^\s\+[^[:blank:];][^;]*\ze\%($\|;\)/ exe 'syn match ledgerAccount '. \ '/'.s:oe.'^\s\+\zs\%(\S'.s:lb1.' \S\|\S\)\+\ze\%( \|\t\|\s*$\)/ contained' exe 'syn match ledgerAmount '. - \ '/'.s:oe.'\S'.s:lb1.'\%( \|\t\)\s*\zs\%([^;[:space:]]\|\s\+[^;[:space:]]\)\+/ contained' + \ '/'.s:oe.'\S'.s:lb1.'\%( \|\t\)\s*\zs\%([^;[:space:]]\|\s\+[^;[:space:]]\)\+/ contains='.s:ledgerAmount_contains.' contained' syn region ledgerPreDeclaration start=/^\(account\|payee\|commodity\|tag\)/ skip=/^\s/ end=/^/ \ keepend transparent