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

When sorting on priority, sort also on projects and contexts #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matjon
Copy link

@matjon matjon commented Feb 1, 2015

After pressing <leader>s, todo.vim used to sort all lines
alphabetically. This caused tasks related to different projects to be
placed apart from each other - the whole list was then difficult to
follow.

This patch fixes this by taking into account the fact that :sort in vim
is usually stable (see http://en.wikipedia.org/wiki/Sorting_algorithm#Stability),
so that when we sort first on contexts, then on projects and then on
priority, everything is placed in the order we want.

After pressing <leader>s, todo.vim used to sort all lines
alphabetically. This caused tasks related to different projects to be
placed apart from each other - the whole list was then difficult to
follow.

This patch fixes this by taking into account the fact that :sort in vim
is usually stable (see http://en.wikipedia.org/wiki/Sorting_algorithm#Stability),
so that when we sort first on contexts, then on projects and then on
priority, everything is placed in the order we want.
@matjon
Copy link
Author

matjon commented Feb 1, 2015

I haven't seen the pull request from @dbeniamine on #18 , my work was completely independent.

@dbeniamine
Copy link

Hello,
My hierarchichal sort is a bit different than the one proposed by @matjon : using his solution, all the entries will be sorted by priority, then for a priority they will be sorted by context, and for one context and priority, they will be sorted by projects. While my solution found groups of identical projects and context. Entries inside a group are sorted by priority, and the groups are sorted between them by context or by project (depending on the method used).
Your method is way simpler than mine, but It can gives the same order. Thus I pulled your work inside my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants