hledger icon indicating copy to clipboard operation
hledger copied to clipboard

Tags autocomplete in hledger add

Open matteocedroni opened this issue 3 years ago • 5 comments
trafficstars

Hi, thanks for this useful software.

It would be possible to implement tag auto-completion as it is for accounts and payee.

I know, if I declare all account with various tag combination, hledger will suggest which one to use by pressing TAB. However it feels more like a workaround than a solution.

matteocedroni avatar Aug 11 '22 09:08 matteocedroni

Hi, where are you thinking to do this ? In hledger-web add form ?

simonmichael avatar Aug 12 '22 16:08 simonmichael

Hi, I come from a full features web (php) application where inserting a transaction requires minutes :-( IMHO plain text data entry are unbeatable.

I haven't tried hledger-web or iadd yet, but honestly I prefer the CLI way:

2022-01-01 Description
   expenses:food    $10     ;  {TAB or Arrow here for tags suggestion}
   ...

matteocedroni avatar Aug 13 '22 11:08 matteocedroni

So... you're using hledger add ? Or pressing tab in an Emacs ledger-mode buffer ?

simonmichael avatar Aug 13 '22 12:08 simonmichael

I'm new to hledger, for now I'm using hledger add from bash. Autocompletion works well for payee and accounts, but for now tags must be typed entirely.

matteocedroni avatar Aug 13 '22 14:08 matteocedroni

Thanks! hledger has several user interfaces, but now it's clear. I agree tag completion would be nice.

Currently, tags are entered with hledger add as follows: after entering a transaction description or posting amount, add some spaces, a semicolon, and start typing a comment, which may contain one or more tags.

So hledger doesn't know exactly when you entering a tag, but I think it could work well enough if, once you have a begun a comment, to tab-complete any word as if it were a tag name. Optionally you could also tab-complete a single : (or, just a tab press while not in the middle of a word) as the start of a tag name. I would welcome a PR.

simonmichael avatar Aug 14 '22 16:08 simonmichael