vonshednob / pter

Manage your todo.txt in a commandline user interface (TUI)
https://vonshednob.cc/pter/
MIT License
102 stars 6 forks source link

autosuggestion #6

Closed uGeek closed 2 years ago

uGeek commented 2 years ago

It would be possible that when you write +, @, due: ... all the options to be selected appear, to register tasks faster and not make mistakes when writing them.

Very good application. I like very much

Thank you

vonshednob commented 2 years ago

Oh yeah, I absolutely agree! Currently there’s a bigger refactoring on-going which will make this easier. So, it’ll happen, but not very soon.

Not quite sure about the due: completion though; since it’s very dynamic what you could write there (2022-02-02, +4d, tue, +1y2w-2d) it would almost require a calendar selection, but even that wouldn’t quite cut it. Any ideas?

maxigaz commented 2 years ago

One is idea is to make an option to specify the date format, and use it as the basis of converting to/from.

In khal, for example, you can set the format for both the short date and the long date. I have the following in my ~/.config/khal/config:

[locale]
timeformat = %H:%M
dateformat = %m.%d.
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M

So, maybe pter could detect that if I started writing due:2021 and I have %Y-%m-%d configured as the format, so pressing tab could complete the date as due:2021-10-17.

vonshednob commented 2 years ago

Not quite sure how it would complete the date though, if I only type due:2021 and Tab… would it show a completion option for month and day?

Just curious: are you using absolute dates in due: and t: more often than relative dates? I keep finding myself rather settings tasks up to be at due:sat or due:+1w.

maxigaz commented 2 years ago

if I only type due:2021 and Tab… would it show a completion option for month and day?

Actually, I was only thinking of completing the current date, but I understand that not everyone would find it adequate.

So, another option would be to print out the current date in a specified format (such as %Y-%m-%d), and create highlighted tab stops for each number (so pressing tab highlights the month, pressing it again highlights the day etc.), which could be increased/decreased with the arrow keys or overwritten if a number was pressed.

Just curious: are you using absolute dates in due: and t: more often than relative dates? I keep finding myself rather settings tasks up to be at due:sat or due:+1w.

Yes, I prefer absolute dates. I think the main reason is that they are easier to be parsed by scripts. (I have a Polybar script that notifies me if I have tasks due today.)

vonshednob commented 2 years ago

Ah, that was maybe a misunderstanding. I gotta check the documentation whether it's not clear enough.

When editing tasks, you can enter a relative date, for example, due:0 (meaning: due in +0 days, i.e. today), but the todo.txt standard does not actually allow for relative dates. Instead pter will save the date as an absolute date!

So, if I add a task in pter today, like Add autocompletion to contexts in +pter due:+1w, pter will expand the due: tag to due:2021-10-25 -- i.e. 1 week (7 days) from now.

Have a look at the section on relative dates in the documentation!

Would this alleviate the need to have autocompletion for the t: and due: tags?

Obviously the + and @ fields need autocompletion though.

maxigaz commented 2 years ago

When editing tasks, you can enter a relative date, for example, due:0 (meaning: due in +0 days, i.e. today), but the todo.txt standard does not actually allow for relative dates. Instead pter will save the date as an absolute date!

So, if I add a task in pter today, like Add autocompletion to contexts in +pter due:+1w, pter will expand the due: tag to due:2021-10-25 -- i.e. 1 week (7 days) from now.

Have a look at the section on relative dates in the documentation!

Oh, I didn't know pter has this feature. Very useful! (And I'll keep reading the documentation. :))

Would this alleviate the need to have autocompletion for the t: and due: tags?

Yes, absolutely! (As far as I'm concerned.)

vonshednob commented 2 years ago

Autocompletion is implemented in 2.1.0.

I was a bit too eager to push it out of the door, so the documentation is not great (i.e. missing). It’ll come later.

For now: Tab, ^N, and arrow key down will select the next available option, ^P, and arrow key up will select the previous option. Enter is used to select the completion option, Esc and ^C will close the completion box.

Completion works for contexts (@) and projects (+).

maxigaz commented 2 years ago

Thank you very much!