summaryrefslogtreecommitdiff
path: root/contrib/vim/ftplugin/ledger.vim
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2010-09-08 22:31:42 +0200
committerJohann Klähn <kljohann@gmail.com>2010-09-08 22:31:42 +0200
commit58fcb0f30f850f1e3140b42419c280a5dd731e30 (patch)
tree041261cac9ee16603a0d6ab256f1f02552731a56 /contrib/vim/ftplugin/ledger.vim
parent019a60e6d15a271f590084fa3b5c86aae317667b (diff)
downloadfork-ledger-58fcb0f30f850f1e3140b42419c280a5dd731e30.tar.gz
fork-ledger-58fcb0f30f850f1e3140b42419c280a5dd731e30.tar.bz2
fork-ledger-58fcb0f30f850f1e3140b42419c280a5dd731e30.zip
vim. make sure cursor/line is on a transaction
Thanks to Chad Voegele for reporting and fixing this in the first place.
Diffstat (limited to 'contrib/vim/ftplugin/ledger.vim')
-rw-r--r--contrib/vim/ftplugin/ledger.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim
index 6719529f..1cced35c 100644
--- a/contrib/vim/ftplugin/ledger.vim
+++ b/contrib/vim/ftplugin/ledger.vim
@@ -471,6 +471,11 @@ function! s:get_transactions(...) "{{{2
endf "}}}
function! s:get_transaction_extents(lnum) "{{{2
+ if ! (indent(a:lnum) || getline(a:lnum) =~ '^[~[:digit:]]\S\+')
+ " only do something if lnum is in a transaction
+ return [0, 0]
+ endif
+
" safe view / position
let view = winsaveview()
let fe = &foldenable