aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Grigg2015-04-15 09:53:02 -0700
committerNathan Grigg2015-04-15 09:53:02 -0700
commit7e143898c29b9c66fb5e1b12c2e4fe17cc782366 (patch)
treeb1bcd0d48b3232ad95bad8a8ca20ead065fc971c
parent844101f686ef241e6835c85d78301da4cfb3f6db (diff)
downloadvim-beancount-7e143898c29b9c66fb5e1b12c2e4fe17cc782366.tar.gz
Add a beancount compiler that calls bean-check.
- Set the make program to bean-check. - Set the errorformat to parse the output of bean-check.
-rw-r--r--compiler/beancount.vim19
-rw-r--r--ftplugin/beancount.vim1
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler/beancount.vim b/compiler/beancount.vim
new file mode 100644
index 0000000..5bcaa15
--- /dev/null
+++ b/compiler/beancount.vim
@@ -0,0 +1,19 @@
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "beancount"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=bean-check\ %
+CompilerSet errorformat=%-G " Skip blank lines
+CompilerSet errorformat+=%f:%l:\ %m " File:line: message
+CompilerSet errorformat+=%-G\ %.%# " Skip indented lines.
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/ftplugin/beancount.vim b/ftplugin/beancount.vim
index 20c2058..2d603f9 100644
--- a/ftplugin/beancount.vim
+++ b/ftplugin/beancount.vim
@@ -10,6 +10,7 @@ let b:undo_ftplugin = "setlocal foldmethod< comments< commentstring<"
setl foldmethod=syntax
setl comments=b:;
setl commentstring=;%s
+compiler beancount
if !exists("g:beancount_separator_col")
let g:beancount_separator_col = 50