summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/vim/README2
-rw-r--r--contrib/vim/compiler/ledger.vim22
2 files changed, 23 insertions, 1 deletions
diff --git a/contrib/vim/README b/contrib/vim/README
index 4da73ea6..368c9c71 100644
--- a/contrib/vim/README
+++ b/contrib/vim/README
@@ -2,7 +2,7 @@
This is the ledger filetype for vim.
Copy each file to the corresponding directory in your ~/.vim directory.
Then include the following line in your .vimrc or in ~/.vim/filetype.vim
- au BufNewFile,BufRead *.ldg,*.ledger setf ledger
+ au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger
You can also use a modeline like this in every ledger file
vim:filetype=ledger
diff --git a/contrib/vim/compiler/ledger.vim b/contrib/vim/compiler/ledger.vim
new file mode 100644
index 00000000..e8ea5ed0
--- /dev/null
+++ b/contrib/vim/compiler/ledger.vim
@@ -0,0 +1,22 @@
+" Vim Compiler File
+" Compiler: ledger
+" by Johann Klähn; Use according to the terms of the GPL>=2.
+" vim:ts=2:sw=2:sts=2:foldmethod=marker
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "ledger"
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+" %-G throws away blank lines, everything else is assumed to be part of a
+" multi-line error message.
+CompilerSet errorformat=%-G,%EWhile\ parsing\ file\ \"%f\"\\,\ line\ %l:%.%#,%ZError:\ %m,%C%.%#
+
+" unfortunately there is no 'check file' command,
+" so we will just use a query that returns no results. ever.
+CompilerSet makeprg=ledger\ -f\ %\ reg\ not\ '.*'\ \>\ /dev/null
+