summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2009-06-29 15:06:55 +0200
committerJohann Klähn <kljohann@gmail.com>2009-06-29 16:41:35 +0200
commit396e1a5002c8152d0c9bb8b85fd711eece03f221 (patch)
tree89c9a54845477686e992006d7c792655353d34f0 /contrib
parent84e6a6e926effcb53148e8d0b0d4b5b79d8914c2 (diff)
downloadfork-ledger-396e1a5002c8152d0c9bb8b85fd711eece03f221.tar.gz
fork-ledger-396e1a5002c8152d0c9bb8b85fd711eece03f221.tar.bz2
fork-ledger-396e1a5002c8152d0c9bb8b85fd711eece03f221.zip
Fix account completion for virtual transactions
Diffstat (limited to 'contrib')
-rw-r--r--contrib/vim/ftplugin/ledger.vim7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim
index 4b1c3a5d..05a5d6d7 100644
--- a/contrib/vim/ftplugin/ledger.vim
+++ b/contrib/vim/ftplugin/ledger.vim
@@ -163,7 +163,10 @@ function! LedgerComplete(findstart, base) "{{{1
" only allow completion when in or at end of account name
return -1
endif
- return matchend(line, '^\s\+')
+ " the start of the first non-blank character
+ " (excluding virtual-transaction-marks)
+ " is the beginning of the account name
+ return matchend(line, '^\s\+[\[(]\?')
else "}}}
return -1
endif
@@ -218,6 +221,8 @@ function! LedgerGetAccountHierarchy() "{{{1
let hierarchy = {}
let accounts = s:grep_buffer('^\s\+\zs[^[:blank:];]\%(\S \S\|\S\)\+\ze')
for name in accounts
+ " remove virtual-transaction-marks
+ let name = substitute(name, '\%(^\s*[\[(]\?\|[\])]\?\s*$\)', '', 'g')
let last = hierarchy
for part in split(name, ':')
let last[part] = get(last, part, {})