@@ -77,12 +77,9 @@ Tips and useful commands
77
77
The decimal separator can be set using `g: ledger_decimal_sep ` . The default
78
78
value of `g: ledger_decimal_sep ` is `' .' ` .
79
79
80
- It is convenient to remap the command, for example to ` <Leader> a ` :
80
+ See below for the recommended mappings.
81
81
82
- au FileType ledger vnoremap <silent><buffer> <Leader> a \
83
- :LedgerAlign<CR>
84
-
85
- * :call ledger#align_amount_at_cursor()
82
+ * `:call ledger#align_amount_at_cursor()`
86
83
87
84
aligns the amount under the cursor and append/prepend the default currency.
88
85
The default currency can be set using `g: ledger_default_commodity ` . Whether
@@ -91,13 +88,23 @@ Tips and useful commands
91
88
value is 1). A separator between the commodity and the amount may be set
92
89
using `g: ledger_commodity_sep ` .
93
90
94
- It is convenient to define a mapping like the following:
91
+ See below for the recommended mappings.
92
+
93
+ * `:call ledger#autocomplete_and_align()`
94
+
95
+ when the cursor is on a number or immediately after it, invokes
96
+ `ledger#align_amount_at_cursor ()` to align it and add the default currency;
97
+ otherwise, performs autocompletion. If you define the following mappings
98
+ then you may perform both autocompletion and alignment using the <Tab> key:
95
99
96
- au FileType ledger inoremap <silent><buffer> <C-l> \
97
- <Esc> :call ledger#align_amount_at_cursor()<CR>
100
+ au FileType ledger inoremap <silent> <Tab> \
101
+ <C-r> =ledger#autocomplete_and_align()<CR>
102
+ au FileType ledger vnoremap <silent> <Tab> :LedgerAlign<CR>
98
103
99
- Now, you may type `123.45 <C-l> ` , and have `$123 .45 ` properly aligned (assuming
100
- your default commodity is set to `' $' ` ).
104
+ Now, you may type `asset:check<Tab><Space> 123.45 <Tab> ` , and have the
105
+ account name autocompleted and `$123 .45 ` properly aligned (assuming your
106
+ default commodity is set to `' $' ` ). Or you may press <Tab> in Visual mode
107
+ to align a number of transactions at once.
101
108
102
109
* `:call ledger#entry()`
103
110
0 commit comments