Skip to content

Commit d5985b7

Browse files
author
Lifepillar
committed
Use g:ledger_main when autocompleting commands.
The account name auto-completion does not work when editing a file that does not balance on its own (same situation with 2015.ldg and main.ldg). Use expand(g:ledger_main) instead of expand('%') to fix that. Apart from that, `s:autocomplete_account_or_payee` does work correctly when Ledger spits out warning messages or errors. This will be addressed in a future commit.
1 parent 109a4f8 commit d5985b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ftplugin/ledger.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ endf "}}}
406406

407407
function! s:autocomplete_account_or_payee(argLead, cmdLine, cursorPos) "{{{2
408408
return (a:argLead =~ '^@') ?
409-
\ map(filter(systemlist(g:ledger_bin . ' -f ' . shellescape(expand('%')) . ' payees'),
409+
\ map(filter(systemlist(g:ledger_bin . ' -f ' . shellescape(expand(g:ledger_main)) . ' payees'),
410410
\ "v:val =~? '" . strpart(a:argLead, 1) . "'"), '"@" . escape(v:val, " ")')
411411
\ :
412-
\ map(filter(systemlist(g:ledger_bin . ' -f ' . shellescape(expand('%')) . ' accounts'),
412+
\ map(filter(systemlist(g:ledger_bin . ' -f ' . shellescape(expand(g:ledger_main)) . ' accounts'),
413413
\ "v:val =~? '" . a:argLead . "'"), 'escape(v:val, " ")')
414414
endf "}}}
415415

0 commit comments

Comments
 (0)