From f9c6141148e102c6532af7fb4f394eedca3766db Mon Sep 17 00:00:00 2001 From: yahorni Date: Wed, 13 Nov 2024 18:51:02 +0300 Subject: [PATCH 1/2] fix 'E518: Unknown option', add escaping for filename --- compiler/ledger.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ledger.vim b/compiler/ledger.vim index e735d13..af28e55 100644 --- a/compiler/ledger.vim +++ b/compiler/ledger.vim @@ -30,7 +30,7 @@ if !b:is_hledger CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m " Skip all other lines: 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)) + exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') else 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=hledger:\ %trror:\ %f:%l:%c: From 7a3b0c3244d8f97c88de177ea856b7259e6ae5ec Mon Sep 17 00:00:00 2001 From: yahorni Date: Wed, 13 Nov 2024 18:52:05 +0300 Subject: [PATCH 2/2] format makeprg command for readability --- compiler/ledger.vim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/ledger.vim b/compiler/ledger.vim index af28e55..2ad06ff 100644 --- a/compiler/ledger.vim +++ b/compiler/ledger.vim @@ -30,9 +30,21 @@ if !b:is_hledger CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m " Skip all other lines: 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\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') + exe 'CompilerSet makeprg=' + \.substitute(g:ledger_bin, ' ', '\\ ', 'g') + \.'\ -f\ ' + \.substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') + \. '\ ' + \.substitute(g:ledger_extra_options, ' ', '\\ ', 'g') + \.'\ source\ ' + \.substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') else - exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ check\ '. substitute(g:ledger_extra_options, ' ', '\\ ', 'g') + 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=hledger:\ %trror:\ %f:%l:%c: CompilerSet errorformat+=hledger:\ %trror:\ %f:%l: CompilerSet errorformat+=hledger:\ %trror:\ %f:%l-%.%#: