Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions to remove all todo items that are done #906

Merged
merged 12 commits into from
Jun 8, 2020
Merged

Conversation

Nudin
Copy link
Member

@Nudin Nudin commented Jun 5, 2020

This adds functions that remove todo items that are marked as done.

  • VimwikiRemoveDone/vimwiki#lst#remove_done removes them within the selected area.
  • VimwikiRemoveDoneInList/vimwiki#lst#remove_done_in_list removes them in the list the cursor is in.
    • vimwiki#lst#remove_done_in_list has a parameter to define if it should work recursively. Default is not recursive.

Superseeding #391
Fixes #823 and others.

@Nudin
Copy link
Member Author

Nudin commented Jun 5, 2020

The documentation still has to be improved. I wasn't sure if we should define both commands and whether default should be recursive or not. Recursive has the somewhat surprising but correct side effect that the status of items can decrease. See the test for example.

@tinmarino @rane-brown any thoughts?

@Nudin Nudin added this to In progress in v2.6 Jun 5, 2020
@tinmarino
Copy link
Member

I would put recursive as default: to get most work done which is harder to do by hand.

Very readble tests, really awesome.
Reading the last one, with spaces suprised me it was considered as a single list but better. Can you add tests for the behavior of 2 lists with content in between ?

* [X] Done 1
* [ ] Todo 1

This should break the list

* [ ] Todo Post space
* [X] Done Post space

@ubitux
Copy link
Contributor

ubitux commented Jun 6, 2020

It probably doesn't belong in this PR, but what about multi-line TODO entries? I often use gq and ends up with multi-line entries, and I know they're not well supported in vimwiki (at least in markdown let g:vimwiki_hl_cb_checked = 1 will only gray-out the first line). So I'm curious how the removal of this PR behaves here in that situation.

Nudin added 4 commits June 7, 2020 18:31
From user perspective there is no reason why this should be two
commands. Since the "<range>" keyword is only available for newer versions
of vim for older versions there is no way to distinguish between no
range being used and an inline range. This edge case is however not
relevant since the function works line based anyway.
@Nudin
Copy link
Member Author

Nudin commented Jun 7, 2020

I would put recursive as default: to get most work done which is harder to do by hand.

Good argument, I changed it to recursive and updated the tests accordingly.

Reading the last one, with spaces suprised me it was considered as a single list but better. Can you add tests for the behavior of 2 lists with content in between ?

I actually found out about this behavior by your list_update.vader tests. ;) This PR doesn't change anything on the general behavior of list but reuses existing functions.

It probably doesn't belong in this PR, but what about multi-line TODO entries? I often use gq and ends up with multi-line entries, and I know they're not well supported in vimwiki (at least in markdown let g:vimwiki_hl_cb_checked = 1 will only gray-out the first line). So I'm curious how the removal of this PR behaves here in that situation.

Yes, better create a ticket for that (if it doesn't exist yet).

Copy link
Member

@tinmarino tinmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect for me but I let you merge as you got this power

@Nudin Nudin merged commit a9f21c6 into vimwiki:dev Jun 8, 2020
@Nudin Nudin moved this from In progress to Done in v2.6 Jun 8, 2020
deepredsky pushed a commit to deepredsky/vimwiki that referenced this pull request Jan 16, 2021
Add function VimwikiRemoveDone that will delete lines with todo list items marked as done. Works on ranges as well as without range on the current list.

Co-authored-by: Tinmarino <tinmarino@gmail.com>
jls83 pushed a commit to jls83/vimwiki that referenced this pull request Jan 17, 2023
Add function VimwikiRemoveDone that will delete lines with todo list items marked as done. Works on ranges as well as without range on the current list.

Co-authored-by: Tinmarino <tinmarino@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v2.6
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants