When sorting on priority, sort also on projects and contexts
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.
I haven't seen the pull request from @dbeniamine on #18 , my work was completely independent.
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.