Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/ledger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 6 additions & 1 deletion syntax/ledger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down