summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Beniamine <david@beniamine.net>2018-04-19 23:45:09 +0200
committerDavid Beniamine <david@beniamine.net>2018-04-19 23:45:09 +0200
commit7b0262ae84ccf345d50babe6575c7e608365d855 (patch)
tree8633049ab1e6250ff3ce450fd9201d73c752c148
parent7d70e30aae178efe2a25e815bf0ff903377f5403 (diff)
downloadtodo.txt-vim-7b0262ae84ccf345d50babe6575c7e608365d855.zip
Do not override fold_char and use fold_char x for tests
-rw-r--r--ftplugin/todo.vim21
-rw-r--r--tests/include/setup.vader1
2 files changed, 11 insertions, 11 deletions
diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim
index 8eb68fb..79c6c39 100644
--- a/ftplugin/todo.vim
+++ b/ftplugin/todo.vim
@@ -108,18 +108,17 @@ setlocal foldtext=TodoFoldText()
" Go to first completed task
let oldpos=getcurpos()
-let g:Todo_fold_char='@'
-let base_pos=search('^x\s', 'ce')
-" Get next completed task
-let first_incomplete = search('^\s*[^<x\s>]')
-if (first_incomplete < base_pos)
- " Check if all tasks from
- let g:Todo_fold_char='x'
-else
- " TODO detect if sorted on prjects
+if(!exists("g:Todo_fold_char"))
let g:Todo_fold_char='@'
+ let base_pos=search('^x\s', 'ce')
+ " Get next completed task
+ let first_incomplete = search('^\s*[^<x\s>]')
+ if (first_incomplete < base_pos)
+ " Check if all tasks from
+ let g:Todo_fold_char='x'
+ endif
+ call setpos('.', oldpos)
endif
-call setpos('.', oldpos)
function! s:get_contextproject(line) abort "{{{2
return matchstr(getline(a:line), g:Todo_fold_char.'[^ ]\+')
@@ -156,7 +155,7 @@ function! TodoFoldText()
" where N is the number of lines folded.
return '+' . v:folddashes . ' '
\ . (v:foldend - v:foldstart + 1)
- \ .' '. this_context
+ \ .' '. this_context.' '
endfunction
" Restore context {{{1
diff --git a/tests/include/setup.vader b/tests/include/setup.vader
index 8524cb5..ca4a201 100644
--- a/tests/include/setup.vader
+++ b/tests/include/setup.vader
@@ -15,6 +15,7 @@ Execute (Clean up test environment):
execute "silent! %substitute/" . s:duedate . "/**TODAY+2" . b:unit . "**/"
endfor
endfunction
+ let g:Todo_fold_char='x'
Before:
After: