aboutsummaryrefslogtreecommitdiffstats
path: root/ftplugin/beancount.vim
blob: 046c7746aa74d28f2192940e21f4846c1584baf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
" These two variables customize the behavior of the AlignCommodity command.

if exists("b:did_ftplugin")
  finish
endif

let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal foldmethod< comments< commentstring<"

setl foldmethod=syntax
setl comments=b:;
setl commentstring=;%s

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! -buffer -range AlignCommodity
            \ :call beancount#align_commodity(<line1>, <line2>)

" Omnifunc for account completion.
setl omnifunc=beancount#complete_account

" Don't allow C-X or C-A, since these are dangerous to a finance file.
try
    nmap <unique> <buffer> <C-X> <Nop>
    nnoremap <buffer> <C-X><C-X> <C-X>
catch /E227/
endtry

try
    nmap <buffer> <C-A> <Nop>
    nnoremap <buffer> <C-A><C-A> <C-A>
catch /E227/
endtry