From d3aef2a9bee0962cff93f5a68588d558559f46a6 Mon Sep 17 00:00:00 2001 From: Jason Chu Date: Wed, 8 Jun 2016 05:27:48 +0000 Subject: Add a function to display the current line's beancount context in a scratch window --- autoload/beancount.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'autoload/beancount.vim') 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 -- cgit v1.2.3-2-gb3c3