Skip to content

Commit 58561ed

Browse files
authored
fix(foldtext): Match (and ignore) balance assertions on postings (#154)
1 parent 2e3355c commit 58561ed

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ftplugin/ledger.vim

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,18 @@ hi link LedgerTarget Statement
215215
hi link LedgerImproperPerc Special
216216
" }}}
217217

218-
let s:rx_amount = '\('.
219-
\ '\%([0-9]\+\)'.
220-
\ '\%([,.][0-9]\+\)*'.
221-
\ '\|'.
222-
\ '[,.][0-9]\+'.
223-
\ '\)'.
224-
\ '\s*\%([[:alpha:]¢$€£]\+\s*\)\?'.
218+
let s:cursym = '[[:alpha:]¢$€£]\+'
219+
let s:valreg = '\('.
220+
\ '\%([0-9]\+\)'.
221+
\ '\%([,.][0-9]\+\)*'.
222+
\ '\|'.
223+
\ '[,.][0-9]\+'.
224+
\ '\)'
225+
let s:optional_balance_assertion = '\(\s*=\s*'.s:cursym.'\s*'.s:valreg.'\)\?'
226+
227+
let s:rx_amount = s:valreg.
228+
\ s:optional_balance_assertion.
229+
\ '\s*\%('.s:cursym.'\s*\)\?'.
225230
\ '\%(\s*;.*\)\?$'
226231

227232
function! LedgerFoldText() "{{{1

0 commit comments

Comments
 (0)