diff options
Diffstat (limited to '')
-rw-r--r-- | autoload/beancount.vim | 9 | ||||
-rw-r--r-- | doc/beancount.txt | 10 | ||||
-rw-r--r-- | ftplugin/beancount.vim | 3 |
3 files changed, 22 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 diff --git a/doc/beancount.txt b/doc/beancount.txt index 03f4c17..2a2f37c 100644 --- a/doc/beancount.txt +++ b/doc/beancount.txt @@ -50,6 +50,16 @@ COMMANDS *beancount-commands* vnoremap <buffer> <leader>= :AlignCommodity<CR> < + *beancount-:GetContext* +:GetContext Uses bean-doctor context to display the context of the + current line. + + You can use the following normal mode remap to open the + context of the line you're currently on: > + + nnoremap <buffer> <LocalLeader>c :GetContext<CR> +< + COMPLETION *beancount-completion* diff --git a/ftplugin/beancount.vim b/ftplugin/beancount.vim index bcdc8c4..dc35999 100644 --- a/ftplugin/beancount.vim +++ b/ftplugin/beancount.vim @@ -28,5 +28,8 @@ endif command! -buffer -range AlignCommodity \ :call beancount#align_commodity(<line1>, <line2>) +command! -buffer -range GetContext + \ :call beancount#get_context() + " Omnifunc for account completion. setl omnifunc=beancount#complete_account |