From 5f0122aec39c5fee6719af857092235286a38de5 Mon Sep 17 00:00:00 2001 From: Konfekt Date: Sun, 5 Nov 2023 06:55:08 +0100 Subject: [PATCH] adapt compiler to hledger --- compiler/ledger.vim | 5 ++++- doc/ledger.txt | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/ledger.vim b/compiler/ledger.vim index 495fba2..e8d8acd 100644 --- a/compiler/ledger.vim +++ b/compiler/ledger.vim @@ -32,5 +32,8 @@ if !b:is_hledger CompilerSet errorformat+=%-G%.%# exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ ' . shellescape(expand(g:ledger_main)) else - exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ >\ /dev/null)' + exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ check\ '. substitute(g:ledger_extra_options, ' ', '\\ ', 'g') + CompilerSet errorformat=%Ehledger:\ %trror:\ %f:%l:%c%.%#:,%-C\ \ \|\\s%#,%-C\%l\ \|%.%#,%-C\ \ \|\\s%#,%-C\ \ \|%p^,%+C%m,%-Z\\s%# + " Skip all other lines: + CompilerSet errorformat+=%-G%.%# endif diff --git a/doc/ledger.txt b/doc/ledger.txt index d29eb9d..2a6f674 100644 --- a/doc/ledger.txt +++ b/doc/ledger.txt @@ -47,10 +47,14 @@ Tips and useful commands :silent make | redraw! | cwindow It is recommended to set the value of `g:ledger_extra_options` (see below) - as follows: + as follows for ledger: let g:ledger_extra_options = '--pedantic --explicit --check-payees' + and as follows for hledger: + + let g:ledger_extra_options = '--strict ordereddates payees uniqueleafnames' + to catch most potential problems in your source file. * Remap vim paragraph motion to move by transaction.