A User's view of Hledger

Learning about hledger

More about “iadd”

I found another helpful way that “iadd” works.

Here is how it works: if you add a transaction with a first-time payee, “iadd” defaults to the accounts of the most recently entered transaction.

This was useful as I was entering several transactions whose expenses were all under the same account. Specifically, it was an account where I keep track of travel, such as expenses:travel. In addition, they were all charged to the same charge card, such as liabilities:ABC_credit.

We had traveled in an area we hadn’t visited this year, so none of the payees were in our current hledger data file. The were all new.

What this meant was that once I had entered the first transaction, something like:

2024-06-08 Mom & Pop Grocery
expenses:travel $8.97
liabilities:ABC_credit -$8.97

After entering the date and payee for the next transaction, such as

2024-06-08 Sandy's Sandwiches

“iadd” would default to the categories of:


The above defaults come about because Sandy’s Sandwiches was a new payee. Therefore, the default categories are taken from the just previously entered Mom & Pop Grocery transaction.

And if the default categories are what you want, you simply hit the return key to select them, speeding up the entry process.

The moral of the story is that if you know the default behaviors for “add” and “iadd,” you can use them to your advantage to make your data entry go a little faster.