commit f44412f4dd4b0eabb463ca27425fea2dfcae2ab9
parent 64433d910a4bd70e75142009c82dbdf506bebff4
Author: Lukas Joswiak <lukas@lukasjoswiak.com>
Date: Wed, 8 Apr 2020 21:56:34 -0700
Add ledger mappings
Diffstat:
| M | .vimrc | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/.vimrc b/.vimrc
@@ -3,6 +3,8 @@ call plug#begin()
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
+Plug 'ledger/vim-ledger'
+
call plug#end()
let mapleader = ","
@@ -48,3 +50,27 @@ autocmd Filetype cpp setlocal shiftwidth=2 softtabstop=2 expandtab
" Indent with 2 spaces in C files
autocmd Filetype c setlocal shiftwidth=2 softtabstop=2 expandtab
+
+" Ledger shortcuts
+" Indent with 2 spaces in ledger files
+autocmd Filetype ledger setlocal shiftwidth=2 softtabstop=2 expandtab
+
+" Toggle between posting status
+au FileType ledger nnoremap <Leader>rd :call ledger#transaction_state_toggle(line('.'), ' *!')<CR>
+" Transaction date shortcuts
+au FileType ledger nnoremap <Leader>r1 :call ledger#transaction_date_set(line('.'), 'primary')<CR>
+au FileType ledger nnoremap <Leader>r2 :call ledger#transaction_date_set(line('.'), 'auxiliary')<CR>
+au FileType ledger nnoremap <Leader>r3 :call ledger#transaction_date_set(line('.'), 'unshift')<CR>
+
+au FileType ledger inoremap <silent> <Tab> <C-r>=ledger#autocomplete_and_align()<CR>
+au FileType ledger vnoremap <silent> <Tab> :LedgerAlign<CR>
+
+" Enable folding by default for ledger files.
+au FileType ledger setlocal foldmethod=syntax
+
+" Use $ as default commodity
+let g:ledger_default_commodity = '$'
+" No blank line between folded transactions
+let g:ledger_fold_blanks = 1
+" Autocomplete based on detail, not alphabetically
+let g:ledger_detailed_first = 1