From 4156a0488c08478298109f52bfa9c94d124397ac Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Thu, 25 Jun 2009 13:47:57 +0200 Subject: vim. fix for accounts with spaces --- contrib/vim/ftplugin/ledger.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'contrib/vim/ftplugin/ledger.vim') 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 -- cgit v1.2.3