-
Notifications
You must be signed in to change notification settings - Fork 24
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
Sort/remove entries based on whether they are checked or not #17
Comments
Looks promising! |
Okay, well. Almost there. It turned out to be a bit more complicated than I expected. I figured the best way will be to let the user select the block he wants to sort and then do operation on it. If the [ ] is at the beginning of each line and each task is on a separate line, this is trivial and only However, if a task spans across multiple lines, and/or if the checkbox is at the end of each line, this is a bit less trivial. I'll take another look into it! It's almost done, but it's still a bit silly. |
What do you mean? I don't see any reason to pull checkbox to the end. |
Well, as in: Shopping listRolls: [x] |
@thegoodhen thank you for clarification, I never use this format before. |
I just thought some may want to do that. Also, if it spans across multiple lines, it rules out the option to use :sort. |
Hello! Believe it or not, I am working on it. :D Please, just tell me one thing. I cannot find it anywhere. How do you match following string? [] ? I need this to be able to jump to the end of the line that is right before the line with a new task... /$_.* matches nothing. /[ and then k0 (as in, find it on this line, jump one line up and to the end of the line) causes problems. I can't seem to be able to find any answer online... |
Did you mean match |
Nonono... I mean to match a regEx that starts with the "end of line" symbol... |
Oh, sorry, I see it now. I have written a string here and it has been misinterpreted as xml tags, thus I am causing confusion. My original text was:
|
If you provide an example of text you are working on, then maybe I can help you. |
Hello. $ marks end of the line, but And well... So far I've got this:
This is a temp thingy. What I want from it: Once you select text which has completed and uncompleted tasks in it, it should delete all completed tasks (even if the task spans across multiple lines) and append it to the register a. How it should work:
|
Okay, seems like I am close to a solution now... It's kinda ugly but should work... |
I never like regexps (my favorite on xkcd https://xkcd.com/1171/). A long time ago when I created this plugin I used them to quickly toggle list markers, and nothing more. As you said, the built-in
This task require to rework core logic, e.g. detect each task item separately and then rearrange them while keeping internal state into script specific variables. @thegoodhen how often do you sort your tasks? Looks like I'm able to sort them manually with any of existing plugins (vim-unimpaired or vim-move can rearrange lines in visual and normal modes). |
Yea, I am starting to dislike them as well... Unfortunately, I am not yet too good with Vimscript... Maybe Java and embedded C, but not Vimscript... I am aware of the issue with the overwritten registers, but it looked extremely daunting to implement it any other way. I finally almost got it to work. Now I am in state where it sorts the list nicely, but only when you have the word "end" on the end of each task. (That was for debug purposes, but when I tried to change it to what it's supposed to be, it died on me. It just stopped working.) I have a script that can delete all tasks marked as done. It doesn't use user registers and it's a simple regex search/replace. I guess I'll stop trying tomorrow and give you a pull request with at least that and then I'll be done with it. :D Sorry! At least I tried, sigh. |
No problem, thank you anyway. I keep this issue opened as the reminder. |
As a reminder you can't always win against RegEx? :D This. Is scary. But at like... 80% of cases, it kinda works.
|
It might be useful to add an option to make the resolved issues fall to the bottom so they don't mix with the resolved ones as well as to delete the resolved ones.
I think the built-in :sort command of Vim with its range set by some clever regular expressions could do the trick. I'll look into it!
The text was updated successfully, but these errors were encountered: