Update 2026-01-25 09:38 OpenBSD/amd64-t14
This commit is contained in:
@@ -47,10 +47,14 @@ Tips and useful commands
|
||||
:silent make | redraw! | cwindow
|
||||
|
||||
It is recommended to set the value of `g:ledger_extra_options` (see below)
|
||||
as follows:
|
||||
as follows for ledger:
|
||||
|
||||
let g:ledger_extra_options = '--pedantic --explicit --check-payees'
|
||||
|
||||
and as follows for hledger:
|
||||
|
||||
let g:ledger_extra_options = '--strict ordereddates payees uniqueleafnames'
|
||||
|
||||
to catch most potential problems in your source file.
|
||||
|
||||
* Remap vim paragraph motion to move by transaction.
|
||||
@@ -65,7 +69,7 @@ Tips and useful commands
|
||||
The default definitions already work in ledger files that separate
|
||||
transactions with blank lines.
|
||||
|
||||
* `:call ledger#transaction_date_set('.'), "auxiliary")`
|
||||
* `:call ledger#transaction_date_set(line('.'), "auxiliary")`
|
||||
|
||||
will set today's date as the auxiliary date of the current transaction. You
|
||||
can use also "primary" or "unshift" in place of "auxiliary". When you pass
|
||||
@@ -87,6 +91,16 @@ Tips and useful commands
|
||||
noremap <silent><buffer> <2-LeftMouse>\
|
||||
:call ledger#transaction_state_toggle(line('.'), ' *?!')<CR>
|
||||
|
||||
* `:call ledger#transaction_post_state_set(line('.'), '*')`
|
||||
|
||||
is similar to ledger#transaction_state_set but can set state of individual
|
||||
post.
|
||||
|
||||
* `:call ledger#transaction_post_state_toggle(line('.'), ' *?!')`
|
||||
|
||||
is similar to ledger#transaction_state_toggle but can toggle state of
|
||||
individual post.
|
||||
|
||||
* `:LedgerAlign`
|
||||
|
||||
moves the amount expression of a posting so that the decimal separator is
|
||||
@@ -96,10 +110,29 @@ Tips and useful commands
|
||||
being the current line.
|
||||
|
||||
The decimal separator can be set using `g:ledger_decimal_sep`. The default
|
||||
value of `g:ledger_decimal_sep` is `'.'`.
|
||||
value of `g:ledger_decimal_sep` is `'.'`. More than one possible character
|
||||
may be specified and any matches will count, e.g. `'.,'`.
|
||||
|
||||
By default the alignment is done on the first matching decimal separator.
|
||||
This may be changed by setting `g:ledger_align_last` to `v:true`, in which
|
||||
case the last possible decimal separator will be used. This is useful for
|
||||
mixed-currency ledgers where decimal and thousands separators in different
|
||||
currencies may clash and/or aligning on the right hand side of rate
|
||||
conversions is desired.
|
||||
|
||||
See below for the recommended mappings.
|
||||
|
||||
* `:LedgerAlignBuffer`
|
||||
|
||||
This command aligns the commodity for each posting in the entire buffer,
|
||||
similar to the command `:LedgerAlign`. It differs from manually specifying
|
||||
the entire buffer as the range to `:LedgerAlign` or
|
||||
`ledger#align_commodity()` by saving and restoring the cursor and window
|
||||
position.
|
||||
|
||||
Due to performance concerns, it is not recommended to call this command
|
||||
on large buffers.
|
||||
|
||||
* `:call ledger#align_amount_at_cursor()`
|
||||
|
||||
aligns the amount under the cursor and append/prepend the default currency.
|
||||
@@ -246,14 +279,111 @@ Configuration
|
||||
Include the following let-statements somewhere in your `.vimrc` to modify the
|
||||
behaviour of the ledger filetype.
|
||||
|
||||
=== Ledger / HLedger Configuration ===
|
||||
|
||||
* Path to the `ledger` executable:
|
||||
|
||||
let g:ledger_bin = 'ledger'
|
||||
|
||||
* Whether to use ledger or hledger specific features. Setting this value is
|
||||
optional and in most cases will be guessed correctly based on g:ledger_bin,
|
||||
but in the event it isn't guessed correctly or you want to use different
|
||||
syntax features even with your default tooling setup for the other engine
|
||||
this flag can be set to override the value.
|
||||
|
||||
let g:ledger_is_hledger = v:true
|
||||
|
||||
* Additional default options for the `ledger` executable:
|
||||
|
||||
let g:ledger_extra_options = ''
|
||||
|
||||
* The file to be used to generate reports:
|
||||
|
||||
let g:ledger_main = '%:p'
|
||||
|
||||
The default is to use the current file.
|
||||
|
||||
* Disable automatic detection and use of ledger binary:
|
||||
|
||||
let g:ledger_no_bin = 1
|
||||
|
||||
=== Completion Settings ===
|
||||
|
||||
* To use a custom external system command to generate a list of account names
|
||||
for completion, set the following. If g:ledger_bin is set, this will default
|
||||
to running that command with arguments to parse the current file using the
|
||||
accounts subcommand (works with ledger or hledger), otherwise it will parse
|
||||
the postings in the current file itself.
|
||||
|
||||
let g:ledger_accounts_cmd = 'ledger accounts'
|
||||
|
||||
* To use a custom external system command to generate a list of descriptions
|
||||
for completion, set the following. If g:ledger_bin is set, this will default
|
||||
to running that command with arguments to parse the current file using the
|
||||
descriptions subcommand (works with ledger or hledger), otherwise it will
|
||||
parse the transactions in the current file itself.
|
||||
|
||||
let g:ledger_descriptions_cmd = 'ledger payees'
|
||||
|
||||
* If you want account completion based on fuzzy matching instead of the
|
||||
default sub-level completion:
|
||||
|
||||
let g:ledger_fuzzy_account_completion = 1
|
||||
|
||||
* If you want the account completion to be sorted by level of detail/depth
|
||||
instead of alphabetical:
|
||||
|
||||
let g:ledger_detailed_first = 1
|
||||
|
||||
* Show only exact matches in completion:
|
||||
|
||||
let g:ledger_exact_only = 1
|
||||
|
||||
* Include the original text in completion results:
|
||||
|
||||
let g:ledger_include_original = 1
|
||||
|
||||
* Enable spell checking for account names:
|
||||
|
||||
let g:ledger_accounts_spell = 1
|
||||
|
||||
=== Alignment and Formatting Settings ===
|
||||
|
||||
* Specify at which column decimal separators should be aligned:
|
||||
|
||||
let g:ledger_align_at = 60
|
||||
|
||||
* Decimal separator for alignment:
|
||||
|
||||
let g:ledger_decimal_sep = '.'
|
||||
|
||||
* Specify alignment on first or last matching separator:
|
||||
|
||||
let g:ledger_align_last = v:false
|
||||
|
||||
* Default commodity used by `ledger#align_amount_at_cursor()`:
|
||||
|
||||
let g:ledger_default_commodity = ''
|
||||
|
||||
* Align on the commodity location instead of the amount:
|
||||
|
||||
let g:ledger_align_commodity = 1
|
||||
|
||||
* Flag that tells whether the commodity should be prepended or appended to the
|
||||
amount:
|
||||
|
||||
let g:ledger_commodity_before = 1
|
||||
|
||||
* String to be put between the commodity and the amount:
|
||||
|
||||
let g:ledger_commodity_sep = ''
|
||||
|
||||
* Enable spell checking for commodity symbols:
|
||||
|
||||
let g:ledger_commodity_spell = 1
|
||||
|
||||
=== Folding Settings ===
|
||||
|
||||
* Number of columns that will be used to display the foldtext. Set this when
|
||||
you think that the amount is too far off to the right.
|
||||
|
||||
@@ -264,11 +394,6 @@ behaviour of the ledger filetype.
|
||||
|
||||
let g:ledger_fillstring = ' -'
|
||||
|
||||
* If you want the account completion to be sorted by level of detail/depth
|
||||
instead of alphabetical, include the following line:
|
||||
|
||||
let g:ledger_detailed_first = 1
|
||||
|
||||
* By default vim will fold ledger transactions, leaving surrounding blank lines
|
||||
unfolded. You can use 'g:ledger_fold_blanks' to hide blank lines following a
|
||||
transaction.
|
||||
@@ -283,40 +408,13 @@ behaviour of the ledger filetype.
|
||||
folding. You can take advantage of this to disable this feature on a
|
||||
case-by-case basis.
|
||||
|
||||
* Decimal separator:
|
||||
|
||||
let g:ledger_decimal_sep = '.'
|
||||
|
||||
* Specify at which column decimal separators should be aligned:
|
||||
|
||||
let g:ledger_align_at = 60
|
||||
|
||||
* Default commodity used by `ledger#align_amount_at_cursor()`:
|
||||
|
||||
let g:ledger_default_commodity = ''
|
||||
|
||||
* Flag that tells whether the commodity should be prepended or appended to the
|
||||
amount:
|
||||
|
||||
let g:ledger_commodity_before = 1
|
||||
|
||||
* String to be put between the commodity and the amount:
|
||||
|
||||
let g:ledger_commodity_sep = ''
|
||||
|
||||
* Flag that enable the spelling of the amount:
|
||||
|
||||
let g:ledger_commodity_spell = 1
|
||||
=== Date Format ===
|
||||
|
||||
* Format of transaction date:
|
||||
|
||||
let g:ledger_date_format = '%Y/%m/%d'
|
||||
|
||||
* The file to be used to generate reports:
|
||||
|
||||
let g:ledger_main = '%'
|
||||
|
||||
The default is to use the current file.
|
||||
=== Report Window Settings ===
|
||||
|
||||
* Position of a report buffer:
|
||||
|
||||
@@ -325,19 +423,7 @@ behaviour of the ledger filetype.
|
||||
Use `b` for bottom, `t` for top, `l` for left, `r` for right. Use uppercase letters
|
||||
if you want the window to always occupy the full width or height.
|
||||
|
||||
* Format of quickfix register reports (see |:Register|):
|
||||
|
||||
let g:ledger_qf_register_format = \
|
||||
'%(date) %-50(payee) %-30(account) %15(amount) %15(total)\n'
|
||||
|
||||
The format is specified using the standard Ledger syntax for --format.
|
||||
|
||||
* Format of the reconcile quickfix window (see |:Reconcile|):
|
||||
|
||||
let g:ledger_qf_reconcile_format = \
|
||||
'%(date) %-4(code) %-50(payee) %-30(account) %15(amount)\n'
|
||||
|
||||
The format is specified using the standard Ledger syntax for --format.
|
||||
=== Quickfix Window Settings ===
|
||||
|
||||
* Flag that tells whether a location list or a quickfix list should be used:
|
||||
|
||||
@@ -362,8 +448,30 @@ behaviour of the ledger filetype.
|
||||
|
||||
let g:ledger_qf_hide_file = 1
|
||||
|
||||
Filenames in the quickfix window are hidden by default. Set this to 1 is
|
||||
you want filenames to be visible.
|
||||
Filenames in the quickfix window are hidden by default. Set this to 0
|
||||
if you want filenames to be visible.
|
||||
|
||||
* Format of quickfix register reports (see |:Register|):
|
||||
|
||||
let g:ledger_qf_register_format =
|
||||
\ '%(date) %(justify(payee, 50)) '.
|
||||
\ '%(justify(account, 30)) %(justify(amount, 15, -1, true)) '.
|
||||
\ '%(justify(total, 15, -1, true))\n'
|
||||
|
||||
The format is specified using the standard Ledger syntax for --format.
|
||||
|
||||
* Format of the reconcile quickfix window (see |:Reconcile|):
|
||||
|
||||
let g:ledger_qf_reconcile_format =
|
||||
\ '%(date) %(justify(code, 4)) '.
|
||||
\ '%(justify(payee, 50)) %(justify(account, 30)) '.
|
||||
\ '%(justify(amount, 15, -1, true))\n'
|
||||
|
||||
The format is specified using the standard Ledger syntax for --format.
|
||||
|
||||
Note that Reconcile is only available with Ledger, not HLedger.
|
||||
|
||||
=== Balance Display Settings ===
|
||||
|
||||
* Text of the output of the |:Balance| command:
|
||||
|
||||
@@ -371,6 +479,14 @@ behaviour of the ledger filetype.
|
||||
let g:ledger_pending_string = 'Cleared or pending: '
|
||||
let g:ledger_target_string = 'Difference from target: '
|
||||
|
||||
=== Advanced Settings ===
|
||||
|
||||
* Enable automatic formatting with the ledger binary (potentially dangerous):
|
||||
|
||||
let g:ledger_dangerous_formatprg = 1
|
||||
|
||||
WARNING: This feature can cause data loss when run on non-transaction blocks.
|
||||
|
||||
==============================================================================
|
||||
COMPLETION *ledger-completion*
|
||||
|
||||
@@ -378,8 +494,8 @@ Omni completion is currently implemented for account names only.
|
||||
|
||||
### Accounts
|
||||
|
||||
Account names are matched by the start of every sub-level. When you
|
||||
insert an account name like this:
|
||||
By default, account names are matched by the start of every sub-level. When
|
||||
you insert an account name like this:
|
||||
|
||||
Asse<C-X><C-O>
|
||||
|
||||
@@ -391,6 +507,16 @@ Go ahead and try something like:
|
||||
|
||||
When you have an account like this, 'Assets:Bank:Checking' should show up.
|
||||
|
||||
If fuzzy matching based account completion is enabled, the matches are
|
||||
loaded based on string similarity and without regard for the sub-levels.
|
||||
|
||||
In the previous example, with fuzzy matching enabled, you could load up
|
||||
matches by doing something like:
|
||||
|
||||
Chec<C-X><C-O>
|
||||
|
||||
Notice that we did not need to write the initial account components.
|
||||
|
||||
When you want to complete on a virtual transaction, it's currently best
|
||||
to keep the cursor in front of the closing bracket. Of course you can
|
||||
insert the closing bracket after calling the completion, too.
|
||||
@@ -400,7 +526,7 @@ LICENSE *ledger-license*
|
||||
|
||||
https://github.com/ledger/vim-ledger
|
||||
|
||||
Copyright 2019 Caleb Maclennan
|
||||
Copyright 2019–2025 Caleb Maclennan
|
||||
Copyright 2009–2017 Johann Klähn
|
||||
Copyright 2009 Stefan Karrmann
|
||||
Copyright 2005 Wolfgang Oertl
|
||||
|
||||
Reference in New Issue
Block a user