diff options
author | Wynn Wolf Arbor | 2020-03-10 17:37:03 +0100 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-04-28 17:59:15 +0200 |
commit | 9f853addd1fdb44966eaaf904114542061a38c5b (patch) | |
tree | 126393f337a17262711f2cdefdbe46bf3297caca /ftplugin | |
parent | 22eb7ac8970394a881946f408a5bc972a72c785d (diff) | |
download | vim-beancount-9f853addd1fdb44966eaaf904114542061a38c5b.tar.gz |
Replace AlignCommodity with bean-format
AlignCommodity replicates the functionality of the bean-format command
that is shipped with beancount itself. Therefore, we can fully replace
it by having vim invoke bean-format through formatprg.
Even though bean-format's output might differ from AlignCommodity in
significant ways, we feel that using one unified tool is superior to
having several (possibly incompatible) custom implementations. That way,
if bean-format is improved upon in the future, all downstream consumers
profit. For regular usage, however, this change should be transparent.
Note that while bean-format supports a few different ways of formatting
the ledger, we have opted to hard-code one specific setting. This will
match the default behaviour of fava, aligning currencies in column 61.
Managing the arguments passed to bean-format dynamically is considered
out of scope, especially given the fact that the user need only override
formatprg to get a custom setting.
This commit will also drop the g:beancount_separator_col variable and
the tests for AlignCommodity. Ideally, testing will now done upstream
for bean-format itself.
Diffstat (limited to '')
-rw-r--r-- | ftplugin/beancount.vim | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ftplugin/beancount.vim b/ftplugin/beancount.vim index b6e3540..ab54905 100644 --- a/ftplugin/beancount.vim +++ b/ftplugin/beancount.vim @@ -3,17 +3,14 @@ if exists('b:did_ftplugin') endif let b:did_ftplugin = 1 -let b:undo_ftplugin = 'setlocal foldmethod< comments< commentstring<' +let b:undo_ftplugin = 'setlocal foldmethod< formatprg< comments< commentstring<' setl foldmethod=syntax +setl formatprg=bean-format\ -c61 setl comments=b:; setl commentstring=;%s compiler beancount -" This variable customizes the behavior of the AlignCommodity command. -if !exists('g:beancount_separator_col') - let g:beancount_separator_col = 50 -endif if !exists('g:beancount_account_completion') let g:beancount_account_completion = 'default' endif @@ -21,9 +18,6 @@ if !exists('g:beancount_detailed_first') let g:beancount_detailed_first = 0 endif -command! -buffer -range AlignCommodity - \ :call beancount#align_commodity(<line1>, <line2>) - command! -buffer -range GetContext \ :call beancount#get_context() |