From 685aeaaeb1b3fb6e3a9b4304799663f62bc8e1b3 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 20 May 2020 20:24:48 +0200 Subject: Add ledger support, closes #488 --- compiler/ledger.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 compiler/ledger.vim (limited to 'compiler/ledger.vim') diff --git a/compiler/ledger.vim b/compiler/ledger.vim new file mode 100644 index 00000000..7a9bc305 --- /dev/null +++ b/compiler/ledger.vim @@ -0,0 +1,32 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ledger') == -1 + +" 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 + +scriptencoding utf-8 + +if exists('current_compiler') || !exists('g:ledger_bin') + finish +endif + +let current_compiler = g:ledger_bin + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +if !g:ledger_is_hledger + " Capture Ledger errors (%-C ignores all lines between "While parsing..." and "Error:..."): + CompilerSet errorformat=%EWhile\ parsing\ file\ \"%f\"\\,\ line\ %l:,%ZError:\ %m,%-C%.%# + " Capture Ledger warnings: + CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m + " Skip all other lines: + CompilerSet errorformat+=%-G%.%# + exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ %\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ %' +else + exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ %\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ >\ /dev/null)' +endif + +endif -- cgit v1.2.3