Skip to content

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