[Vimoutliner] patch: allow progress items with no children

Scott Scriven vimoutliner at toykeeper.net
Sun Jun 10 19:35:04 EDT 2007


Hi, here's a small patch to fix something which has been bugging
me.  It allows you to use checkbox items with a percent but no
children.  I often want to do this, and get annoyed when VO
resets all my childless percents back to 0%.

I've never done any vim scripting before, so I apologize if this
is longer than necessary.

As a side note, I was also rather tempted to fix all the
tab-vs-space issues in that file...  It appears that the author
used a tabstop of 3 spaces, but did not consistently use tabs...
or even a consistent indent width.  So, the indentation is all
messed up.

--- vo_checkbox.vim.orig	2007-06-10 16:43:23.271346000 -0600
+++ vo_checkbox.vim	2007-06-10 17:31:11.336096500 -0600
@@ -269,9 +269,15 @@
 		let l:i = l:i+1
 	endwhile
    let l:proportion=0
+	let mbegin=match(getline(a:line), " [0-9]*%")
+	if mbegin
+		let mend=matchend(getline(a:line), " [0-9]*%")
+		let l:proportion=getline(a:line)[mbegin+1 : mend-1]
+		let l:proportion=str2nr(l:proportion)
+	endif
    if l:count>0
      let l:proportion = ((l:done * 100)/l:count)/100
-   else
+	elseif ! l:proportion
       if match(getline(a:line),"\\[X\\]") != -1
 	      let l:proportion = 100
       else 



-- Scott


More information about the VimOutliner mailing list