ledger / vim-ledger

Vim plugin for Ledger
GNU General Public License v2.0
370 stars 56 forks source link

Account completion does not suggest account names specified with the `account` directive or periodic (budget) transactions #159

Open RyanGibb opened 1 month ago

RyanGibb commented 1 month ago

For example, in the following file:

account Expenses:Food
account Expenses:Rent
account Expenses:Hobbies                                account Assets

~ monthly
  Expenses:Food               £1
  Assets

2024-07-12 rent
  Expenses:Rent              £1
  Assets

2024-07-12 hobbies
   Expenses:Hobbies           £1
  Assets

I would expect the Expenses:Food account name to be autocompleted, but it's not included in the suggestions:

Screenshot_20240713-090636~2

RyanGibb commented 1 month ago

I haven't looked at the code yet but it seems like the --add-budget option on the accounts command might be relevant here:

$ ledger -f test.ledger accounts
Assets
Expenses:Hobbies
Expenses:Rent
$ ledger -f test.ledger accounts --add-budget
Assets
Expenses:Food
Expenses:Hobbies
Expenses:Rent

This doesn't include accounts specified with the accounts directive, but does include budgeted accounts.

RyanGibb commented 1 month ago

Ah-ha! Looks like ledger_accounts_cmd = 'ledger accounts --add-budget fixes this for accounts included in a budget at least`. Perhaps this should be the default?