From 9f853addd1fdb44966eaaf904114542061a38c5b Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Tue, 10 Mar 2020 17:37:03 +0100 Subject: 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. --- doc/beancount.txt | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) (limited to 'doc') diff --git a/doc/beancount.txt b/doc/beancount.txt index 63e25f5..e3801cc 100644 --- a/doc/beancount.txt +++ b/doc/beancount.txt @@ -21,35 +21,6 @@ Contents: COMMANDS *beancount-commands* - *beancount-:AlignCommodity* -:AlignCommodity Adds spaces between an account and commodity so that the - decimal points of the commodities all occur in the column - given by |g:beancount_separator_col|. If an amount has no - decimal point, the imaginary decimal point to the right - of the least significant digit will align. - - The command acts on a range, with the default being the - current line. If the cursor happens to be inside that - range and to the right of the account name, the cursor - will be pushed to the right the appropriate amount, so - that it remains on the same character. - - The script assumes the use of spaces for alignment. It - does not understand tabs. - - You can use the following insert-mode remap to - automatically align commodities every time you type a - decimal point: > - - inoremap . .:AlignCommodity -< - You may also want to set other mappings for this. For - example, I use > - - nnoremap = :AlignCommodity - vnoremap = :AlignCommodity -< - *beancount-:GetContext* :GetContext Uses bean-doctor context to display the context of the current line. @@ -73,17 +44,16 @@ OPTIONS *beancount-options* Default value: 0 -*g:beancount_separator_col* - The column that the decimal separator is aligned to. - - Default value: 50 - *b:beancount_root* Set the root Beancount file. This is used to gather values for the completion. If not set, the current file will be used. Default value: not set +FORMATTING *beancount-formatting* + +The plugin sets |'formatprg'| to 'bean-format -c61' to provide a formatter for +beancount files. See also |gq|. COMPLETION *beancount-completion* -- cgit v1.2.3-2-gb3c3