diff options
author | Johann Klähn <kljohann@gmail.com> | 2010-09-08 18:10:48 +0200 |
---|---|---|
committer | Johann Klähn <kljohann@gmail.com> | 2010-09-08 23:29:36 +0200 |
commit | 1be3a793857204a8baf935af063675a0b14c09b1 (patch) | |
tree | 2649be7f3b59caa00e9a71c1e8709f56d72b77bc /contrib/vim/ftplugin | |
parent | 6c0ccd5ffd0a9ac1f97adeca1dc22a7c9db844c5 (diff) | |
download | fork-ledger-1be3a793857204a8baf935af063675a0b14c09b1.tar.gz fork-ledger-1be3a793857204a8baf935af063675a0b14c09b1.tar.bz2 fork-ledger-1be3a793857204a8baf935af063675a0b14c09b1.zip |
vim. check for most common case first (parse_body)
Diffstat (limited to 'contrib/vim/ftplugin')
-rw-r--r-- | contrib/vim/ftplugin/ledger.vim | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim index 623b0795..a50a5510 100644 --- a/contrib/vim/ftplugin/ledger.vim +++ b/contrib/vim/ftplugin/ledger.vim @@ -420,7 +420,13 @@ function! s:transaction.parse_body(...) dict "{{{2 let tag_container = postings[-1]['tags'] endif - if line =~ '^\s\+;\s*:' + if line =~ '^\s\+[^[:blank:];]' + " posting + " FIXME: comments at the eol + " FIXME: replaces original spacing in amount with single spaces + let parts = split(line, '\(\t\|\s\{2,}\)') + call add(postings, {'account': parts[0], 'amount': join(parts[1:])}) + elseif line =~ '^\s\+;\s*:' " tags without values for t in s:findall(line, ':\zs[^:[:blank:]]\([^:]*[^:[:blank:]]\)\?\ze:') let tag_container[t] = '' @@ -432,12 +438,6 @@ function! s:transaction.parse_body(...) dict "{{{2 let val = matchstr(line, ':\s*\zs.*\ze\s*$') let tag_container[key] = val endif - elseif line =~ '^\s\+[^[:blank:];]' - " posting - " FIXME: comments at the eol - " FIXME: replaces original spacing in amount with single spaces - let parts = split(line, '\(\t\|\s\{2,}\)') - call add(postings, {'account': parts[0], 'amount': join(parts[1:])}) endif let lnum += 1 endw |