1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
This is the ledger filetype for vim.
Copy each file to the corresponding directory in your ~/.vim directory.
Then include the following line in your .vimrc or in ~/.vim/filetype.vim
au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger
You can also use a modeline like this in every ledger file
vim:filetype=ledger
Configuration
======================================================================
Include the following let-statements somewhere in your .vimrc
to modify the behaviour of the ledger filetype.
* Number of colums that will be used to display the foldtext.
Set this when you think that the amount is too far off to the right.
let g:ledger_maxwidth = 80
* String that will be used to fill the space between account name
and amount in the foldtext. Set this to get some kind of lines
or visual aid.
let g:ledger_fillstring = ' -'
My special tip is to use so-called digraphs:
Press <C-K> followed by the two-characters key sequence below.
(in insert-mode)
'. = ˙ or ': = ¨ --> ˙˙˙˙˙˙ or ¨¨¨¨¨¨
', = ¸ --> ¸¸¸¸¸¸
.M = · --> ······
>> = » --> »»»»»»
All those look rather unobstrusive
and provide a good visual aid to find the correct amount.
* 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
Completion
======================================================================
Omni completion is implemented for account names and tags.
Accounts
----------------------------------------------------------------------
Account names are matched by the start of every sub-level.
When you insert an account name like this:
Asse<C-X><C-O>
You will get a list of top-level accounts that start like this.
Go ahead and try something like:
As:Ban:Che<C-X><C-O>
When you have an account like this, 'Assets:Bank:Checking' should show up.
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.
Tags
----------------------------------------------------------------------
The support for completing tags is pretty basic right now
but it's useful to keep the spelling of your tags consistent.
You can call the completion after the ';' to get a list of all tags.
When you have a list of tags (:like: :this:) you can call
the completion too and everything up to the last ':' (excluding whitespace)
will be considered the beginning of the tag to search for.
Revision history (major changes)
======================================================================
2009-06-23 & 2009-06-25
J. Klähn: Omni-Completion for account names and tags
2009-06-17 J. Klähn: Highlight account text
Updated documentation and added fillstring option.
2009-06-15 J. Klähn: Split into multiple files
2009-06-12 J. Klähn: Use all available columns for foldtext
Also rewrote foldtext generation.
2009-03-25 J. Klähn: Allow Metadata
in transactions and postings (Ledger 3.0)
Also fixed alignment for multi-byte-characters
2009-01-28 S.Karrmann: minor fixes
2009-01-27 third version by S.Karrmann.
better extraction of the amount of the posting
decimal separator can be one of '.' and ','.
2005-02-05 first version (partly copied from ledger.vim 0.0.1)
License
======================================================================
Copyright 2009 by Johann Klähn
Copyright 2009 by Stefan Karrmann
Copyright 2005 by Wolfgang Oertl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
|