From bdc0374f49d32dd7a996113fc49d6abee2a50b24 Mon Sep 17 00:00:00 2001 From: Nathan Grigg Date: Tue, 7 Oct 2014 10:59:11 -0700 Subject: AlignCommodity and Incoming --- ftplugin/beancount.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ftplugin/beancount.vim (limited to 'ftplugin/beancount.vim') diff --git a/ftplugin/beancount.vim b/ftplugin/beancount.vim new file mode 100644 index 0000000..f073545 --- /dev/null +++ b/ftplugin/beancount.vim @@ -0,0 +1,28 @@ +" These two variables customize the behavior of the AlignCommodity command. + +if !exists("g:beancount_separator_col") + let g:beancount_separator_col = 50 +endif +if !exists("g:beancount_decimal_separator") + let g:beancount_decimal_separator = "." +endif + +command! -range AlignCommodity :call beancount#align_commodity(, ) + +" Align commodity to proper column +inoremap . .:AlignCommodity +nnoremap = :AlignCommodity +vnoremap = :AlignCommodity + +" Insert incoming transactions at the bottom +function! s:InsertIncoming() + let incoming = expand('%:h') . '/incoming.bean' + try + execute '$read' incoming + call system('mv ' . incoming . ' ' . incoming . '~') + catch /:E484/ + echom "Not found: incoming.bean" + endtry +endfunction + +command! -buffer Incoming call InsertIncoming() -- cgit v1.2.3-2-gb3c3