Skip to content

Commit 3ddfb14

Browse files
authored
Merge pull request #66 from abobov/master
Disable spell highlighting for amount fields
2 parents babb13c + b84b720 commit 3ddfb14

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

doc/ledger.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ behaviour of the ledger filetype.
304304

305305
let g:ledger_commodity_sep = ''
306306

307+
* Flag that enable the spelling of the amount:
308+
309+
let g:ledger_commodity_spell = 1
310+
307311
* Format of transaction date:
308312

309313
let g:ledger_date_format = '%Y/%m/%d'

syntax/ledger.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ if s:fb == 1
2121
let s:skip .= '\n\@!'
2222
endif
2323

24+
let s:ledgerAmount_contains = ''
25+
if get(g:, 'ledger_commodity_spell', 0) == 0
26+
let s:ledgerAmount_contains .= '@NoSpell'
27+
endif
28+
2429
" for debugging
2530
syntax clear
2631

@@ -39,7 +44,7 @@ syn match ledgerPosting /^\s\+[^[:blank:];][^;]*\ze\%($\|;\)/
3944
exe 'syn match ledgerAccount '.
4045
\ '/'.s:oe.'^\s\+\zs\%(\S'.s:lb1.' \S\|\S\)\+\ze\%( \|\t\|\s*$\)/ contained'
4146
exe 'syn match ledgerAmount '.
42-
\ '/'.s:oe.'\S'.s:lb1.'\%( \|\t\)\s*\zs\%([^;[:space:]]\|\s\+[^;[:space:]]\)\+/ contained'
47+
\ '/'.s:oe.'\S'.s:lb1.'\%( \|\t\)\s*\zs\%([^;[:space:]]\|\s\+[^;[:space:]]\)\+/ contains='.s:ledgerAmount_contains.' contained'
4348

4449
syn region ledgerPreDeclaration start=/^\(account\|payee\|commodity\|tag\)/ skip=/^\s/ end=/^/
4550
\ keepend transparent

0 commit comments

Comments
 (0)