Skip to content

Commit 696f876

Browse files
author
Lifepillar
committed
Clarify how to define the Tab mappings.
1 parent 18b5236 commit 696f876

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

doc/ledger.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,21 @@ Tips and useful commands
9999

100100
when the cursor is on a number or immediately after it, invokes
101101
`ledger#align_amount_at_cursor()` to align it and add the default currency;
102-
otherwise, performs autocompletion. If you define the following mappings
103-
then you may perform both autocompletion and alignment using the <Tab> key:
102+
otherwise, performs autocompletion. If you define the following mappings in
103+
your `.vimrc` then you may perform both autocompletion and alignment using
104+
the <Tab> key:
104105

105106
au FileType ledger inoremap <silent> <Tab> \
106107
<C-r>=ledger#autocomplete_and_align()<CR>
107108
au FileType ledger vnoremap <silent> <Tab> :LedgerAlign<CR>
108109

110+
Alternatively, you may create a file `.vim/after/ftplugin/ledger.vim`
111+
containing the following definitions:
112+
113+
inoremap <silent> <buffer> <Tab> \
114+
<C-r>=ledger#autocomplete_and_align()<CR>
115+
vnoremap <silent> <buffer> <Tab> :LedgerAlign<CR>
116+
109117
Now, you may type `asset:check<Tab><Space>123.45<Tab>`, and have the
110118
account name autocompleted and `$123.45` properly aligned (assuming your
111119
default commodity is set to `'$'`). Or you may press <Tab> in Visual mode

0 commit comments

Comments
 (0)