aboutsummaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorNathan Grigg2016-06-14 18:52:45 -0700
committerGitHub2016-06-14 18:52:45 -0700
commit7a955504671e72c8086fb8b592f7de6ba6083f9f (patch)
tree75f64733509c544ea12f0cec93503e647531f656 /autoload
parent8d13b147c6feb68af10112c3d2c6dccd1a4aead4 (diff)
parentd3aef2a9bee0962cff93f5a68588d558559f46a6 (diff)
downloadvim-beancount-7a955504671e72c8086fb8b592f7de6ba6083f9f.tar.gz
Merge pull request #19 from xentac/bean-doctor-context
Add a function to display the current line's beancount context in a scratch window
Diffstat (limited to 'autoload')
-rw-r--r--autoload/beancount.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/autoload/beancount.vim b/autoload/beancount.vim
index ba2a5cc..7ac7f3e 100644
--- a/autoload/beancount.vim
+++ b/autoload/beancount.vim
@@ -128,3 +128,12 @@ while files:
vim.command('return [{}]'.format(','.join(repr(x) for x in sorted(accounts))))
EOM
endfunction
+
+" Call bean-doctor on the current line and dump output into a scratch buffer
+function! beancount#get_context()
+ let context = system('bean-doctor context ' . expand('%') . ' ' . line('.'))
+ botright new
+ setlocal buftype=nofile bufhidden=hide noswapfile
+ call append(0, split(context, '\v\n'))
+ normal! gg
+endfunction