[Vimoutliner] small vo_checkbox patch
Scott Scriven
vimoutliner at toykeeper.net
Sat Apr 19 16:35:05 EDT 2008
Hello. This is a small patch to vo_checkbox.vim. It makes VO's
checkbox functions ignore lines which don't contain [X] or [_].
I find this useful because I tend to use more markers than those
two and I don't want it to change those lines. Every time I
re-calculated task completion, these items were getting reset, so
I just made VO ignore them.
Some of the non-standard markers I have found useful are:
[F] failed
[S] skipped
[Z] snoozed (more on this later)
[?] unsure
Additionally, I append an arrow to signify that an item is
active. This either means it's important, or that I'm currently
working on it.
[_] active <--
In case the patch gets mis-formatted, it's also online here:
http://toykeeper.net/tmp/vim/vo_checkbox.only_X.diff
--- vo_checkbox.vim (revision 1071)
+++ vo_checkbox.vim (working copy)
@@ -258,6 +258,10 @@
let l:done = 0
let l:count = 0
let l:i = 1
+ " ignore lines without [_] or [X] in them
+ if match(getline(a:line),"\\[[_X]\\]") == -1
+ return -1
+ endif
while Ind(a:line) < Ind(a:line+l:i)
if (Ind(a:line)+1) == (Ind(a:line+l:i))
let l:childdoneness = NewHMD(a:line+l:i)
@@ -286,7 +290,7 @@
endif
call setline(a:line,substitute(getline(a:line)," [0-9]*%"," ".l:proportion."%",""))
if l:proportion == 100
- call setline(a:line,substitute(getline(a:line),"\\[.\\]","[X]",""))
+ call setline(a:line,substitute(getline(a:line),"\\[_\\]","[X]",""))
return 100
elseif l:proportion == 0 && l:count == 0
if match(getline(a:line),"\\[X\\]") != -1
@@ -297,7 +301,7 @@
return -1
endif
else
- call setline(a:line,substitute(getline(a:line),"\\[.\\]","[_]",""))
+ call setline(a:line,substitute(getline(a:line),"\\[X\\]","[_]",""))
return l:proportion
endif
endf
-- Scott
More information about the VimOutliner
mailing list