Skip to content

Commit a0670d0

Browse files
committed
fix: Disable formatprg by default to avoid potential data loss
Closes #168 For those that want to live dangerously and enable this by default, one can set a truthy value for `g:ledger_dangerous_formatprg` to re-enable the default ledger print command as a formatter. Just be aware that should only be run on transactions, not other statement types or comment blocks.
1 parent aabf197 commit a0670d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ftplugin/ledger.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ if exists('g:ledger_bin') && !exists('g:ledger_is_hledger')
5050
let g:ledger_is_hledger = g:ledger_bin =~# '.*hledger'
5151
endif
5252

53-
if exists('g:ledger_bin')
53+
" Automatic formatting is disabled by default because it can cause data loss when run
54+
" on non-transaction blocks, see https://github.com/ledger/vim-ledger/issues/168.
55+
if exists('g:ledger_bin') && exists('g:ledger_dangerous_formatprg')
5456
exe 'setl formatprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ -\ print'
5557
endif
5658

0 commit comments

Comments
 (0)