summaryrefslogtreecommitdiff
path: root/contrib/vim/ftplugin/ledger.vim
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2009-06-25 13:47:57 +0200
committerJohann Klähn <kljohann@gmail.com>2009-06-29 16:41:34 +0200
commit4156a0488c08478298109f52bfa9c94d124397ac (patch)
tree1a8c8475a016da621e5f494fe8fbd711b3282b13 /contrib/vim/ftplugin/ledger.vim
parent3b1898f3e809ec00f807da6108c130d003161e38 (diff)
downloadfork-ledger-4156a0488c08478298109f52bfa9c94d124397ac.tar.gz
fork-ledger-4156a0488c08478298109f52bfa9c94d124397ac.tar.bz2
fork-ledger-4156a0488c08478298109f52bfa9c94d124397ac.zip
vim. fix for accounts with spaces
Diffstat (limited to 'contrib/vim/ftplugin/ledger.vim')
-rw-r--r--contrib/vim/ftplugin/ledger.vim12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim
index c965c153..f56864f5 100644
--- a/contrib/vim/ftplugin/ledger.vim
+++ b/contrib/vim/ftplugin/ledger.vim
@@ -55,7 +55,7 @@ function! LedgerFoldText() "{{{1
let line = getline(lnum)
" Skip metadata/leading comment
- if line !~ '^\s\+;'
+ if line !~ '^\%(\s\+;\|\d\)'
" No comment, look for amount...
let groups = matchlist(line, s:rx_amount)
if ! empty(groups)
@@ -111,11 +111,11 @@ function! LedgerComplete(findstart, base)
return -1
elseif line =~ '^\s\+'
let b:compl_context = 'account'
- let firstcol = lastcol
- while firstcol >= 0 && (matchend(line, '^\%(\S\|\S \S\)\+', (firstcol - 1))-1) == lastcol
- let firstcol -= 1
- endwhile
- return firstcol
+ if matchend(line, '^\s\+\%(\S \S\|\S\)\+') <= lastcol
+ " only allow completion when in or at end of account name
+ return -1
+ endif
+ return matchend(line, '^\s\+')
else
return -1
endif