diff options
-rw-r--r-- | README.markdown | 11 | ||||
-rw-r--r-- | autoload/todo.vim | 8 | ||||
-rw-r--r-- | doc/todo.txt | 37 | ||||
-rw-r--r-- | ftplugin/todo.vim | 5 |
4 files changed, 44 insertions, 17 deletions
diff --git a/README.markdown b/README.markdown index 564ce39..da08ccd 100644 --- a/README.markdown +++ b/README.markdown @@ -335,7 +335,14 @@ disable this behavior by setting the following global variable: ## Fold -Todo.txt files can be folded by projects or context (see `:help fold`), by -default they are foldable by context, to use project fold : +Todo.txt files can be folded by projects or context (see `:help fold`). By +default they are foldable by context. To use project fold add the following to +your vimrc: let g:Todo_fold_char='+' + +Note that the fold method by default changes to match the sort order regardless +of what Todo_fold_char is set to. If you prefer to keep the fold method +constant even after changing the sort method set the variable below as follows: + + let g:Todo_update_fold_on_sort=0 diff --git a/autoload/todo.vim b/autoload/todo.vim index 320440b..c6b49d4 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -173,7 +173,9 @@ endfunction function! todo#Sort(type) " vim :sort is usually stable " we sort first on contexts, then on projects and then on priority - let g:Todo_fold_char='x' + if g:Todo_update_fold_on_sort + let g:Todo_fold_char=a:type + endif let oldcursor=todo#GetCurpos() if(a:type != "") exec ':sort /.\{-}\ze'.a:type.'/' @@ -303,7 +305,9 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) "Empty buffer do nothing return endif - let g:Todo_fold_char=a:symbol + if g:Todo_update_fold_on_sort + let g:Todo_fold_char=a:symbol + endif "if the sort modes doesn't start by '!' it must start with a space let l:sortmode=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_first_level_sort_mode) let l:sortmodesub=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_second_level_sort_mode) diff --git a/doc/todo.txt b/doc/todo.txt index a6925da..163828c 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -76,12 +76,12 @@ by David Beniamine. > (A) Call Mom @Phone +Family (A) Schedule annual checkup +Health - (B) Outline chapter 5 +FamilyNovel @Computer - (C) Add cover sheets @ComputerOffice +FamilyTPSReports - Plan backyard herb garden @ComputerHome - Pick up milk @ComputerGroceryStore - Research self-publishing services +FamilyNovel @ComputerComputer - x Download Todo.txt mobile app @ComputerPhone + (B) Outline chapter 5 +Novel @Computer + (C) Add cover sheets @Office +TPSReports + Plan backyard herb garden @Home + Pick up milk @GroceryStore + Research self-publishing services +Novel @Computer + x Download Todo.txt mobile app @Phone < 2.2 Why this fork ? *TodoTxt-Fork* @@ -207,10 +207,13 @@ a completion, then add the following lines to your vimrc: This fork provides a hierarchical sorting function designed to do by project and/or by context sorts and a priority sort. -`<LocalLeader>sc` : Sort the file by context then by priority -`<LocalLeader>scp` : Sort the file by context, project then by priority -`<LocalLeader>sp` : Sort the file by project then by priority -`<LocalLeader>spc` : Sort the file by project, context then by priority + `<LocalLeader>sc` : Sort the file by context then by priority + + `<LocalLeader>scp` : Sort the file by context, project then by priority + + `<LocalLeader>sp` : Sort the file by project then by priority + + `<LocalLeader>spc` : Sort the file by project, context then by priority The user can give argument for the two calls to vim sort function by changing the following variables: @@ -369,8 +372,16 @@ disable this behavior by setting the following global variable: =============================================================================== 8. Fold *TodoTxt-fold* ~ -Todo.txt files can be folded by projects or context (see |fold|), by default -they are foldable by context, to use project fold : +Todo.txt files can be folded by projects or context (see |fold|). By default +they are foldable by context. To use project fold add the following to +your vimrc: > - let g:Todo_fold_char='+' +< + +Note that the fold method by default changes to match the sort order regardless +of what Todo_fold_char is set to. If you prefer to keep the fold method +constant even after changing the sort method set the variable below as follows: +> + let g:Todo_update_fold_on_sort=0 +< diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 4bc3cb9..12133ea 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -121,6 +121,11 @@ setlocal foldmethod=expr setlocal foldexpr=TodoFoldLevel(v:lnum) setlocal foldtext=TodoFoldText() +" Update fold method after sort by default +if ! exists("g:Todo_update_fold_on_sort") + let g:Todo_update_fold_on_sort=1 +endif + " Go to first completed task let oldpos=getcurpos() if(!exists("g:Todo_fold_char")) |