Skip to content

Commit

Permalink
fix(foldtext): Match (and ignore) balance assertions on postings (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtd authored May 2, 2024
1 parent 2e3355c commit 58561ed
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ftplugin/ledger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,18 @@ hi link LedgerTarget Statement
hi link LedgerImproperPerc Special
" }}}

let s:rx_amount = '\('.
\ '\%([0-9]\+\)'.
\ '\%([,.][0-9]\+\)*'.
\ '\|'.
\ '[,.][0-9]\+'.
\ '\)'.
\ '\s*\%([[:alpha:]¢$€£]\+\s*\)\?'.
let s:cursym = '[[:alpha:]¢$€£]\+'
let s:valreg = '\('.
\ '\%([0-9]\+\)'.
\ '\%([,.][0-9]\+\)*'.
\ '\|'.
\ '[,.][0-9]\+'.
\ '\)'
let s:optional_balance_assertion = '\(\s*=\s*'.s:cursym.'\s*'.s:valreg.'\)\?'

let s:rx_amount = s:valreg.
\ s:optional_balance_assertion.
\ '\s*\%('.s:cursym.'\s*\)\?'.
\ '\%(\s*;.*\)\?$'

function! LedgerFoldText() "{{{1
Expand Down

0 comments on commit 58561ed

Please sign in to comment.