From f5d160e91486431235dbfdf9a6bb13089a69ce74 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Sun, 10 Dec 2017 22:59:53 +0500 Subject: [PATCH 1/2] Disable spell highlighting for an amounts. --- doc/ledger.txt | 4 ++++ syntax/ledger.vim | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/ledger.txt b/doc/ledger.txt index 1913d62..cd8faea 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 disable the spelling of the amount: + + let g:ledger_commodity_spell = 0 + * Format of transaction date: let g:ledger_date_format = '%Y/%m/%d' diff --git a/syntax/ledger.vim b/syntax/ledger.vim index 7fd202f..c5a2b9f 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', 1) == 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 From b84b7208091b9769ba0a7f0867e42da836c57c0e Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Tue, 2 Jul 2019 15:06:10 +0500 Subject: [PATCH 2/2] Disable spelling of the amount by default. --- doc/ledger.txt | 4 ++-- syntax/ledger.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ledger.txt b/doc/ledger.txt index cd8faea..c0ccf97 100644 --- a/doc/ledger.txt +++ b/doc/ledger.txt @@ -304,9 +304,9 @@ behaviour of the ledger filetype. let g:ledger_commodity_sep = '' -* Flag that disable the spelling of the amount: +* Flag that enable the spelling of the amount: - let g:ledger_commodity_spell = 0 + let g:ledger_commodity_spell = 1 * Format of transaction date: diff --git a/syntax/ledger.vim b/syntax/ledger.vim index c5a2b9f..3538bbd 100644 --- a/syntax/ledger.vim +++ b/syntax/ledger.vim @@ -22,7 +22,7 @@ if s:fb == 1 endif let s:ledgerAmount_contains = '' -if get(g:, 'ledger_commodity_spell', 1) == 0 +if get(g:, 'ledger_commodity_spell', 0) == 0 let s:ledgerAmount_contains .= '@NoSpell' endif