--- Begin Message ---
Package: vim-vimoutliner
Version: 0.3.4-7
Severity: normal
Tags: patch
This package uses generic function names, such as 'MyFoldText', which could
possibly conflict with other packages or user-defined functions.
'MyFoldText', in particular, is the example name given in the Vim
documentation when it discusses the option 'foldtext'. I know I'm not the
only one who named my unique foldtext function 'MyFoldText' as a result
(although I have now changed its name).
While it was trivial to fix this problem in my own case, I still think that
using such general names is unwise.
I have included a patch that simply prefixes 'VO_' on to each function. I'm
not a Vim wizard; if someone knows of a namespace capability in Vim
scripts, I imagine that would be the preferred method.
-- System Information:
Debian Release: 4.0
APT prefers testing
APT policy: (650, 'testing'), (600, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12.3
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages vim-vimoutliner depends on:
ii libpalm-perl 1.3.0-6 Perl 5 modules for manipulating pd
ii libxml-writer-perl 0.602-1 Perl module for writing XML docume
ii perl 5.8.7-10 Larry Wall's Practical Extraction
ii python 2.3.5-11 An interactive high-level object-o
ii vim 1:7.0-122+1 Vi IMproved - enhanced vi editor
vim-vimoutliner recommends no packages.
-- no debconf information
diff -ur ftplugin/vo_base.vim ftplugin.new/vo_base.vim
--- ftplugin/vo_base.vim 2007-01-11 08:54:11.000000000 -0800
+++ ftplugin.new/vo_base.vim 2007-01-11 10:08:25.000000000 -0800
@@ -82,7 +82,7 @@
setlocal tabstop=4 " tabstop and shiftwidth must match
setlocal shiftwidth=4 " values from 2 to 8 work well
setlocal foldmethod=expr
-setlocal foldexpr=MyFoldLevel(v:lnum)
+setlocal foldexpr=VO_MyFoldLevel(v:lnum)
setlocal indentexpr=
setlocal nocindent
setlocal iskeyword=@,39,45,48-57,_,129-255
@@ -93,51 +93,51 @@
let loaded_vimoutliner_functions=1
" Sorting {{{2
-" IsParent(line) {{{3
+" VO_IsParent(line) {{{3
" Return 1 if this line is a parent
-function! IsParent(line)
- return (Ind(a:line)+1) == Ind(a:line+1)
+function! VO_IsParent(line)
+ return (VO_Ind(a:line)+1) == VO_Ind(a:line+1)
endfunction
"}}}3
-" FindParent(line) {{{3
+" VO_FindParent(line) {{{3
" Return line if parent, parent line if not
-function! FindParent(line)
- if IsParent(a:line)
+function! VO_FindParent(line)
+ if VO_IsParent(a:line)
return a:line
else
- let l:parentindent = Ind(a:line)-1
+ let l:parentindent = VO_Ind(a:line)-1
let l:searchline = a:line
- while (Ind(l:searchline) != l:parentindent) && (l:searchline >
0)
+ while (VO_Ind(l:searchline) != l:parentindent) && (l:searchline
> 0)
let l:searchline = l:searchline-1
endwhile
return l:searchline
endif
endfunction
"}}}3
-" FindLastChild(line) {{{3
+" VO_FindLastChild(line) {{{3
" Return the line number of the last decendent of parent line
-function! FindLastChild(line)
- let l:parentindent = Ind(a:line)
+function! VO_FindLastChild(line)
+ let l:parentindent = VO_Ind(a:line)
let l:searchline = a:line+1
- while Ind(l:searchline) > l:parentindent
+ while VO_Ind(l:searchline) > l:parentindent
let l:searchline = l:searchline+1
endwhile
return l:searchline-1
endfunction
"}}}3
-" MoveDown() {{{3
+" VO_MoveDown() {{{3
" Move a heading down by one
" Used for sorts and reordering of headings
-function! MoveDown()
+function! VO_MoveDown()
call cursor(line("."),0)
del x
put x
endfunction
"}}}3
-" DelHead() {{{3
+" VO_DelHead() {{{3
" Delete a heading
" Used for sorts and reordering of headings
-function! DelHead(line)
+function! VO_DelHead(line)
let l:fstart = foldclosed(a:line)
if l:fstart == -1
let l:execstr = a:line . "del x"
@@ -147,10 +147,10 @@
endif
exec l:execstr
endfunction
-" PutHead() {{{3
+" VO_PutHead() {{{3
" Put a heading
" Used for sorts and reordering of headings
-function! PutHead(line)
+function! VO_PutHead(line)
let l:fstart = foldclosed(a:line)
if l:fstart == -1
let l:execstr = a:line . "put x"
@@ -162,10 +162,10 @@
endif
endfunction
"}}}3
-" NextHead(line) {{{3
+" VO_NextHead(line) {{{3
" Return line of next heanding
" Used for sorts and reordering of headings
-function! NextHead(line)
+function! VO_NextHead(line)
let l:fend = foldclosedend(a:line)
if l:fend == -1
return a:line+1
@@ -174,12 +174,12 @@
endif
endfunction
"}}}3
-" CompHead(line) {{{3
+" VO_CompHead(line) {{{3
" Compare this heading and the next
" Return 1: next is greater, 0 next is same, -1 next is less
-function! CompHead(line)
+function! VO_CompHead(line)
let l:thisline=getline(a:line)
- let l:nextline=getline(NextHead(a:line))
+ let l:nextline=getline(VO_NextHead(a:line))
if l:thisline <# l:nextline
return 1
elseif l:thisline ># l:nextline
@@ -189,34 +189,34 @@
endif
endfunction
"}}}3
-" Sort1Line(line) {{{3
+" VO_Sort1Line(line) {{{3
" Compare this heading and the next and swap if out of order
" Dir is 0 for forward, 1 for reverse
" Return a 1 if a change was made
-function! Sort1Line(line,dir)
- if (CompHead(a:line) == -1) && (a:dir == 0)
- call DelHead(a:line)
- call PutHead(a:line)
+function! VO_Sort1Line(line,dir)
+ if (VO_CompHead(a:line) == -1) && (a:dir == 0)
+ call VO_DelHead(a:line)
+ call VO_PutHead(a:line)
return 1
- elseif (CompHead(a:line) == 1) && (a:dir == 1)
- call DelHead(a:line)
- call PutHead(a:line)
+ elseif (VO_CompHead(a:line) == 1) && (a:dir == 1)
+ call VO_DelHead(a:line)
+ call VO_PutHead(a:line)
return 1
else
return 0
endif
endfunction
"}}}3
-" Sort1Pass(start,end,dir) {{{3
+" VO_Sort1Pass(start,end,dir) {{{3
" Compare this heading and the next and swap if out of order
" Dir is 0 for forward, 1 for reverse
" Return a 0 if no change was made, other wise return the change count
-function! Sort1Pass(fstart,fend,dir)
+function! VO_Sort1Pass(fstart,fend,dir)
let l:i = a:fstart
let l:changed = 0
while l:i < a:fend
- let l:changed = l:changed + Sort1Line(l:i,a:dir)
- let l:i = NextHead(l:i)
+ let l:changed = l:changed + VO_Sort1Line(l:i,a:dir)
+ let l:i = VO_NextHead(l:i)
endwhile
return l:changed
endfunction
@@ -224,20 +224,20 @@
" Sort(start,end,dir) {{{3
" Sort this range of headings
" dir: 0 = ascending, 1 = decending
-function! SortRange(fstart,fend,dir)
+function! VO_SortRange(fstart,fend,dir)
let l:changed = 1
while l:changed != 0
- let l:changed = Sort1Pass(a:fstart,a:fend,a:dir)
+ let l:changed = VO_Sort1Pass(a:fstart,a:fend,a:dir)
endwhile
endfunction
"}}}3
-" SortChildren(dir) {{{3
+" VO_SortChildren(dir) {{{3
" Sort the children of a parent
" dir: 0 = ascending, 1 = decending
-function! SortChildren(dir)
+function! VO_SortChildren(dir)
let l:oldcursor = line(".")
- let l:fstart = FindParent(line("."))
- let l:fend = FindLastChild(l:fstart)
+ let l:fstart = VO_FindParent(line("."))
+ let l:fend = VO_FindLastChild(l:fstart)
let l:fstart = l:fstart
if l:fend <= l:fstart + 1
return
@@ -246,7 +246,7 @@
mkview
let l:execstr = "set foldlevel=" . foldlevel(l:fstart)
exec l:execstr
- call SortRange(l:fstart + 1,l:fend,a:dir)
+ call VO_SortRange(l:fstart + 1,l:fend,a:dir)
call cursor(line("$"),0)
del x
loadview
@@ -254,10 +254,10 @@
endfunction
"}}}3
"}}}2
-" MakeChars() {{{2
+" VO_MakeChars() {{{2
" Make a string of characters
" Used for strings of repeated characters
-function MakeChars(count,char)
+function VO_MakeChars(count,char)
let i = 0
let l:chars=""
while i < a:count
@@ -267,35 +267,35 @@
return l:chars
endfunction
"}}}2
-" MakeSpaces() {{{2
+" VO_MakeSpaces() {{{2
" Make a string of spaces
-function MakeSpaces(count)
- return MakeChars(a:count," ")
+function VO_MakeSpaces(count)
+ return VO_MakeChars(a:count," ")
endfunction
"}}}2
-" MakeDashes() {{{2
+" VO_MakeDashes() {{{2
" Make a string of dashes
-function MakeDashes(count)
- return MakeChars(a:count,"-")
+function VO_MakeDashes(count)
+ return VO_MakeChars(a:count,"-")
endfunction
"}}}2
-" MyFoldText() {{{2
+" VO_MyFoldText() {{{2
" Create string used for folded text blocks
-function MyFoldText()
- let l:MySpaces = MakeSpaces(&sw)
+function VO_MyFoldText()
+ let l:MySpaces = VO_MakeSpaces(&sw)
let l:line = getline(v:foldstart)
let l:bodyTextFlag=0
if l:line =~ "^\t* \\S" || l:line =~ "^\t*\:"
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[TEXT]"
elseif l:line =~ "^\t*\;"
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[TEXT BLOCK]"
elseif l:line =~ "^\t*\> "
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[USER]"
elseif l:line =~ "^\t*\>"
let l:ls = stridx(l:line,">")
@@ -306,11 +306,11 @@
let l:l = strpart(l:line, l:ls+1, l:le-l:ls-1)
endif
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[USER ".l:l."]"
elseif l:line =~ "^\t*\< "
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[USER BLOCK]"
elseif l:line =~ "^\t*\<"
let l:ls = stridx(l:line,"<")
@@ -321,16 +321,16 @@
let l:l = strpart(l:line, l:ls+1, l:le-l:ls-1)
endif
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[USER BLOCK ".l:l."]"
elseif l:line =~ "^\t*\|"
let l:bodyTextFlag=1
- let l:MySpaces = MakeSpaces(&sw * (v:foldlevel-1))
+ let l:MySpaces = VO_MakeSpaces(&sw * (v:foldlevel-1))
let l:line = l:MySpaces."[TABLE]"
endif
let l:sub = substitute(l:line,'\t',l:MySpaces,'g')
let l:len = strlen(l:sub)
- let l:sub = l:sub . " " . MakeDashes(58 - l:len)
+ let l:sub = l:sub . " " . VO_MakeDashes(58 - l:len)
let l:sub = l:sub . " (" . ((v:foldend + l:bodyTextFlag)- v:foldstart)
if ((v:foldend + l:bodyTextFlag)- v:foldstart) == 1
let l:sub = l:sub . " line)"
@@ -340,9 +340,9 @@
return l:sub
endfunction
"}}}2
-" InsertDate() {{{2
+" VO_InsertDate() {{{2
" Insert today's date.
-function InsertDate(ba)
+function VO_InsertDate(ba)
let @x = strftime("%Y-%m-%d")
if a:ba == "0"
normal! "xp
@@ -351,17 +351,17 @@
endif
endfunction
"}}}2
-" InsertSpaceDate() {{{2
+" VO_InsertSpaceDate() {{{2
" Insert a space, then today's date.
-function InsertSpaceDate()
+function VO_InsertSpaceDate()
let @x = " "
let @x = @x . strftime("%Y-%m-%d")
normal! "xp
endfunction
"}}}2
-" InsertTime() {{{2
+" VO_InsertTime() {{{2
" Insert the time.
-function InsertTime(ba)
+function VO_InsertTime(ba)
let @x = strftime("%T")
if a:ba == "0"
normal! "xp
@@ -370,134 +370,134 @@
endif
endfunction
"}}}2
-" InsertSpaceTime() {{{2
+" VO_InsertSpaceTime() {{{2
" Insert a space, then the time.
-function InsertSpaceTime()
+function VO_InsertSpaceTime()
let @x = " "
let @x = @x . strftime("%T")
normal! "xp
endfunction
"}}}2
-" Ind(line) {{{2
+" VO_Ind(line) {{{2
" Determine the indent level of a line.
" Courtesy of Gabriel Horner
-function! Ind(line)
+function! VO_Ind(line)
return indent(a:line)/&tabstop
endfunction
"}}}2
-" BodyText(line) {{{2
+" VO_BodyText(line) {{{2
" Determine the indent level of a line.
-function! BodyText(line)
+function! VO_BodyText(line)
return (match(getline(a:line),"^\t*:") == 0)
endfunction
"}}}2
-" PreformattedBodyText(line) {{{2
+" VO_PreformattedBodyText(line) {{{2
" Determine the indent level of a line.
-function! PreformattedBodyText(line)
+function! VO_PreformattedBodyText(line)
return (match(getline(a:line),"^\t*;") == 0)
endfunction
"}}}2
-" PreformattedUserText(line) {{{2
+" VO_PreformattedUserText(line) {{{2
" Determine the indent level of a line.
-function! PreformattedUserText(line)
+function! VO_PreformattedUserText(line)
return (match(getline(a:line),"^\t*<") == 0)
endfunction
"}}}2
-" PreformattedUserTextLabeled(line) {{{2
+" VO_PreformattedUserTextLabeled(line) {{{2
" Determine the indent level of a line.
-function! PreformattedUserTextLabeled(line)
+function! VO_PreformattedUserTextLabeled(line)
return (match(getline(a:line),"^\t*<\S") == 0)
endfunction
"}}}2
-" PreformattedUserTextSpace(line) {{{2
+" VO_PreformattedUserTextSpace(line) {{{2
" Determine the indent level of a line.
-function! PreformattedUserTextSpace(line)
+function! VO_PreformattedUserTextSpace(line)
return (match(getline(a:line),"^\t*< ") == 0)
endfunction
"}}}2
-" UserText(line) {{{2
+" VO_UserText(line) {{{2
" Determine the indent level of a line.
-function! UserText(line)
+function! VO_UserText(line)
return (match(getline(a:line),"^\t*>") == 0)
endfunction
"}}}2
-" UserTextSpace(line) {{{2
+" VO_UserTextSpace(line) {{{2
" Determine the indent level of a line.
-function! UserTextSpace(line)
+function! VO_UserTextSpace(line)
return (match(getline(a:line),"^\t*> ") == 0)
endfunction
"}}}2
-" UserTextLabeled(line) {{{2
+" VO_UserTextLabeled(line) {{{2
" Determine the indent level of a line.
-function! UserTextLabeled(line)
+function! VO_UserTextLabeled(line)
return (match(getline(a:line),"^\t*>\S") == 0)
endfunction
"}}}2
-" PreformattedTable(line) {{{2
+" VO_PreformattedTable(line) {{{2
" Determine the indent level of a line.
-function! PreformattedTable(line)
+function! VO_PreformattedTable(line)
return (match(getline(a:line),"^\t*|") == 0)
endfunction
"}}}2
-" MyFoldLevel(Line) {{{2
+" VO_MyFoldLevel(Line) {{{2
" Determine the fold level of a line.
-function MyFoldLevel(line)
- let l:myindent = Ind(a:line)
- let l:nextindent = Ind(a:line+1)
+function VO_MyFoldLevel(line)
+ let l:myindent = VO_Ind(a:line)
+ let l:nextindent = VO_Ind(a:line+1)
- if BodyText(a:line)
- if (BodyText(a:line-1) == 0)
+ if VO_BodyText(a:line)
+ if (VO_BodyText(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (BodyText(a:line+1) == 0)
+ if (VO_BodyText(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif PreformattedBodyText(a:line)
- if (PreformattedBodyText(a:line-1) == 0)
+ elseif VO_PreformattedBodyText(a:line)
+ if (VO_PreformattedBodyText(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (PreformattedBodyText(a:line+1) == 0)
+ if (VO_PreformattedBodyText(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif PreformattedTable(a:line)
- if (PreformattedTable(a:line-1) == 0)
+ elseif VO_PreformattedTable(a:line)
+ if (VO_PreformattedTable(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (PreformattedTable(a:line+1) == 0)
+ if (VO_PreformattedTable(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif PreformattedUserText(a:line)
- if (PreformattedUserText(a:line-1) == 0)
+ elseif VO_PreformattedUserText(a:line)
+ if (VO_PreformattedUserText(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (PreformattedUserTextSpace(a:line+1) == 0)
+ if (VO_PreformattedUserTextSpace(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif PreformattedUserTextLabeled(a:line)
- if (PreformattedUserTextLabeled(a:line-1) == 0)
+ elseif VO_PreformattedUserTextLabeled(a:line)
+ if (VO_PreformattedUserTextLabeled(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (PreformattedUserText(a:line+1) == 0)
+ if (VO_PreformattedUserText(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif UserText(a:line)
- if (UserText(a:line-1) == 0)
+ elseif VO_UserText(a:line)
+ if (VO_UserText(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (UserTextSpace(a:line+1) == 0)
+ if (VO_UserTextSpace(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
- elseif UserTextLabeled(a:line)
- if (UserTextLabeled(a:line-1) == 0)
+ elseif VO_UserTextLabeled(a:line)
+ if (VO_UserTextLabeled(a:line-1) == 0)
return '>'.(l:myindent+1)
endif
- if (UserText(a:line+1) == 0)
+ if (VO_UserText(a:line+1) == 0)
return '<'.(l:myindent+1)
endif
return (l:myindent+1)
@@ -514,12 +514,12 @@
endif
endfunction
"}}}2
-" Spawn(line) {{{2
+" VO_Spawn(line) {{{2
" Execute an executable line
" Courtesy of Steve Litt
if !exists("loaded_steveoutliner_functions")
let loaded_steveoutliner_functions=1
-function Spawn()
+function VO_Spawn()
let theline=getline(line("."))
let idx=matchend(theline, "_exe_\\s*")
if idx == -1
@@ -534,7 +534,7 @@
"}}}2
" This should be a setlocal but that doesn't work when switching to a new .otl
file
" within the same buffer. Using :e has demonstrates this.
-set foldtext=MyFoldText()
+set foldtext=VO_MyFoldText()
setlocal fillchars=|,
@@ -543,20 +543,20 @@
" Vim Outliner Key Mappings {{{1
" insert the date
-nmap <buffer> <localleader>d $:call InsertSpaceDate()<cr>
-imap <buffer> <localleader>d ~<esc>x:call InsertDate(0)<cr>a
-nmap <buffer> <localleader>D ^:call InsertDate(1)<cr>a <esc>
+nmap <buffer> <localleader>d $:call VO_InsertSpaceDate()<cr>
+imap <buffer> <localleader>d ~<esc>x:call VO_InsertDate(0)<cr>a
+nmap <buffer> <localleader>D ^:call VO_InsertDate(1)<cr>a <esc>
" insert the time
-nmap <buffer> <localleader>t $:call InsertSpaceTime()<cr>
-imap <buffer> <localleader>t ~<esc>x:call InsertTime(0)<cr>a
-nmap <buffer> <localleader>T ^:call InsertTime(1)<cr>a <esc>
+nmap <buffer> <localleader>t $:call VO_InsertSpaceTime()<cr>
+imap <buffer> <localleader>t ~<esc>x:call VO_InsertTime(0)<cr>a
+nmap <buffer> <localleader>T ^:call VO_InsertTime(1)<cr>a <esc>
" sort a list naturally
-map <buffer> <localleader>s :call SortChildren(0)<cr>
+map <buffer> <localleader>s :call VO_SortChildren(0)<cr>
" sort a list, but you supply the options
-map <buffer> <localleader>S :call SortChildren(1)<cr>
+map <buffer> <localleader>S :call VO_SortChildren(1)<cr>
" invoke the file explorer
map <buffer> <localleader>f :e .<cr>
@@ -595,7 +595,7 @@
map <buffer> <localleader>1 :set foldlevel=0<CR>
map <buffer> <localleader>,, :source
$HOME/.vimoutliner/outliner.vim<CR>
map! <buffer> <localleader>w <Esc>:w<CR>a
-nmap <buffer> <localleader>e :call Spawn()<cr>
+nmap <buffer> <localleader>e :call VO_Spawn()<cr>
" Steve's additional mappings end here
" Placeholders for already assigned but non-functional commands
@@ -623,16 +623,16 @@
amenu &VO.-Sep2- :
amenu &VO.&Color\ Scheme :popup Edit.Color\ Scheme<cr>
amenu &VO.-Sep3- :
-amenu &VO.&Help.&Index :he vo<cr>
+amenu &VO.&Help.&VO_Index :he vo<cr>
amenu &VO.&Help.&,,\ Commands :he vo-command<cr>
amenu &VO.&Help.&Checkboxes :he vo-checkbox<cr>
-amenu &VO.&Help.&Hoisting :he vo-hoisting<cr>
+amenu &VO.&Help.&VO_Hoisting :he vo-hoisting<cr>
amenu &Help.-Sep1- :
" Help menu additions
-amenu &Help.&Vim\ Outliner.&Index :he vo<cr>
+amenu &Help.&Vim\ Outliner.&VO_Index :he vo<cr>
amenu &Help.&Vim\ Outliner.&,,\ Commands :he vo-command<cr>
amenu &Help.&Vim\ Outliner.&Checkboxes :he vo-checkbox<cr>
-amenu &Help.&Vim\ Outliner.&Hoisting :he vo-hoisting<cr>
+amenu &Help.&Vim\ Outliner.&VO_Hoisting :he vo-hoisting<cr>
"}}}1
" Auto-commands {{{1
if !exists("autocommand_vo_loaded")
diff -ur ftplugin/vo_checkbox.vim ftplugin.new/vo_checkbox.vim
--- ftplugin/vo_checkbox.vim 2007-01-11 08:54:11.000000000 -0800
+++ ftplugin.new/vo_checkbox.vim 2007-01-11 10:08:25.000000000 -0800
@@ -43,7 +43,7 @@
"
"Revision 1.16 2004/05/27 22:22:48 noel
"Made ,,cd smart so it would try to delete non-existent checkboxes.
-"Fixed a recursion bug in NewHMD to branches with a single child would
+"Fixed a recursion bug in VO_NewHMD to branches with a single child would
"be computed properly.
"
"Revision 1.15 2004/05/27 18:11:53 noel
@@ -53,7 +53,7 @@
",,c%.
"
"Revision 1.14 2004/05/17 15:53:38 noel
-"Modified SwitchBox() to be more selective.
+"Modified VO_SwitchBox() to be more selective.
"
"Revision 1.13 2004/05/17 15:43:23 noel
"Fixed a broken key mapping: ,,c%.
@@ -63,7 +63,7 @@
"Fixed 'Safely script names'.
"
"Revision 1.11 2003/09/05 16:37:55 cepl
-"Added ,cp binding for the new function InsertCheckBoxPerCent,
+"Added ,cp binding for the new function VO_InsertCheckBoxPerCent,
"which adds not only the checkbox but also percentage sign.
"
"Revision 1.10 2003/08/23 16:42:15 noel
@@ -152,18 +152,18 @@
"Added appropriate headers.
"}}}1
-" InsertCheckBox() {{{1
+" VO_InsertCheckBox() {{{1
" Insert a checkbox at the beginning of a header without disturbing the
" current folding.
-function! InsertCheckBox()
+function! VO_InsertCheckBox()
let @x = "[_] "
normal! ^"xP
endfunction
"}}}1
-" Safely InsertCheckBox() {{{1
+" Safely VO_InsertCheckBox() {{{1
" Insert a checkbox at the beginning of a header without disturbing the
" current folding only if there is no checkbox already.
-function! SafelyInsertCheckBox()
+function! VO_SafelyInsertCheckBox()
if match(getline("."),"^\t\t*\[<>:;|\]") != -1
return
endif
@@ -173,15 +173,15 @@
endif
endfunction
"}}}1
-" Safely InsertCheckBoxPercent() {{{1
+" Safely VO_InsertCheckBoxPercent() {{{1
" Insert a checkbox and % sign at the beginning of a header without disturbing
" the current folding only if there is no checkbox already.
-function! SafelyInsertCheckBoxPercent()
+function! VO_SafelyInsertCheckBoxPercent()
if match(getline("."),"^\t\t*\[<>:;|\]") != -1
return
endif
if match(getline("."), "[\[X_\]]") == -1
- if Ind(line(".")+1) > Ind(line("."))
+ if VO_Ind(line(".")+1) > VO_Ind(line("."))
let @x = "[_] % "
else
let @x = "[_] "
@@ -190,11 +190,11 @@
endif
endfunction
"}}}1
-" Safely InsertCheckBoxPercentAlways() {{{1
+" Safely VO_InsertCheckBoxPercentAlways() {{{1
" Insert a checkbox and % sign at the beginning of a header without disturbing
" the current folding only if there is no checkbox already. Include the
" checkbox even on childless headings.
-function! SafelyInsertCheckBoxPercentAlways()
+function! VO_SafelyInsertCheckBoxPercentAlways()
if match(getline("."),"^\t\t*\[<>:;|\]") != -1
return
endif
@@ -204,9 +204,9 @@
endif
endfunction
"}}}1
-" SwitchBox() {{{1
+" VO_SwitchBox() {{{1
" Switch the state of the checkbox on the current line.
-function! SwitchBox()
+function! VO_SwitchBox()
let questa = strridx(getline("."),"[_]")
let questb = strridx(getline("."),"[X]")
if (questa != -1) || (questb != -1)
@@ -218,9 +218,9 @@
endif
endfunction
"}}}1
-" DeleteCheckbox() {{{1
+" VO_DeleteCheckbox() {{{1
" Delete a checkbox if one exists
-function! DeleteCheckbox()
+function! VO_DeleteCheckbox()
let questa = strridx(getline("."),"[_]")
let questb = strridx(getline("."),"[X]")
if (questa != -1) || (questb != -1)
@@ -232,35 +232,35 @@
endif
endfunction
"}}}1
-" Ind(line) {{{1
+" VO_Ind(line) {{{1
" Return the index of the line.
" Remove it when using the new version of VO
-function! Ind(line)
+function! VO_Ind(line)
return indent(a:line) / &tabstop
endf
-" FindRootParent(line) {{{1
+" VO_FindRootParent(line) {{{1
" returns the line number of the root parent for any child
-function! FindRootParent(line)
- if Ind(a:line) == 0
+function! VO_FindRootParent(line)
+ if VO_Ind(a:line) == 0
return (a:line)
endif
let l:i = a:line
- while l:i > 1 && Ind(l:i) > 0
+ while l:i > 1 && VO_Ind(l:i) > 0
let l:i = l:i - 1
endwhile
return l:i
endf
-" NewHMD(line) {{{1
+" VO_NewHMD(line) {{{1
" (How Many Done)
" Calculates proportion of already done work in the subtree
-function! NewHMD(line)
+function! VO_NewHMD(line)
let l:done = 0
let l:count = 0
let l:i = 1
- 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)
+ while VO_Ind(a:line) < VO_Ind(a:line+l:i)
+ if (VO_Ind(a:line)+1) == (VO_Ind(a:line+l:i))
+ let l:childdoneness = VO_NewHMD(a:line+l:i)
if l:childdoneness >= 0
let l:done = l:done + l:childdoneness
let l:count = l:count+1
@@ -298,19 +298,19 @@
" mappings {{{1
" insert a chechbox
-map <buffer> <localleader>cb :call SafelyInsertCheckBox()<cr>
-map <buffer> <localleader>c% :call SafelyInsertCheckBoxPercent()<cr>
-map <buffer> <localleader>cp :call SafelyInsertCheckBoxPercentAlways()<cr>
-map <buffer> <localleader>cB :call InsertCheckBox()<cr>
+map <buffer> <localleader>cb :call VO_SafelyInsertCheckBox()<cr>
+map <buffer> <localleader>c% :call VO_SafelyInsertCheckBoxPercent()<cr>
+map <buffer> <localleader>cp :call VO_SafelyInsertCheckBoxPercentAlways()<cr>
+map <buffer> <localleader>cB :call VO_InsertCheckBox()<cr>
" delete a chechbox
-map <buffer> <localleader>cd :call DeleteCheckbox()<cr>
+map <buffer> <localleader>cd :call VO_DeleteCheckbox()<cr>
" switch the status of the box
-map <buffer> <localleader>cx :call SwitchBox()<cr>:call
NewHMD(FindRootParent(line(".")))<cr>
+map <buffer> <localleader>cx :call VO_SwitchBox()<cr>:call
VO_NewHMD(VO_FindRootParent(line(".")))<cr>
" calculate the proportion of work done on the subtree
-map <buffer> <localleader>cz :call NewHMD(FindRootParent(line(".")))<cr>
+map <buffer> <localleader>cz :call VO_NewHMD(VO_FindRootParent(line(".")))<cr>
"}}}1
diff -ur ftplugin/vo_hoist.vim ftplugin.new/vo_hoist.vim
--- ftplugin/vo_hoist.vim 2007-01-11 08:54:11.000000000 -0800
+++ ftplugin.new/vo_hoist.vim 2007-01-11 10:08:25.000000000 -0800
@@ -1,5 +1,5 @@
"######################################################################
-"# VimOutliner Hoisting
+"# VimOutliner VO_Hoisting
"# Copyright (C) 2003 by Noel Henson [email protected]
"# The file is currently an experimental part of Vim Outliner.
"#
@@ -31,7 +31,7 @@
"Fixed a bug that occurs on a level 1 heading with no children.
"
"Revision 1.7 2003/10/23 22:14:14 noel
-"Minor changes to DeHoist() to compensate for current foldlevel settings.
+"Minor changes to VO_DeHoist() to compensate for current foldlevel settings.
"
"Revision 1.6 2003/08/17 15:35:24 noel
"Put the new mappings in the correct place this time.
@@ -58,8 +58,8 @@
" Load the plugin {{{1
" mappings {{{1
-map <silent> <buffer> <localleader>h :call Hoist(line("."))<cr>
-map <silent> <buffer> <localleader>H :call DeHoistThis(line("."))<cr>
+map <silent> <buffer> <localleader>h :call VO_Hoist(line("."))<cr>
+map <silent> <buffer> <localleader>H :call VO_DeHoistThis(line("."))<cr>
"}}}1
if exists("g:did_vo_hoist")
finish
@@ -69,96 +69,96 @@
endif
let g:did_vo_hoist = 1
" Functions {{{1
-" RemoveTabsLine(line,tabs) {{{2
+" VO_RemoveTabsLine(line,tabs) {{{2
" remove specified number of tabs from the begining of line
-function! RemoveTabsLine(line,tabs)
+function! VO_RemoveTabsLine(line,tabs)
return substitute(getline(a:line),"^\\(\\t\\)\\{".a:tabs."}", "", "")
endfunction
"}}}2
-" MakeTempFilename(line) {{{2
+" VO_MakeTempFilename(line) {{{2
" return a string to use as the temporary filename for the hoisted area
-function! MakeTempFilename(line)
+function! VO_MakeTempFilename(line)
return "vo_hoist.".a:line.strftime(".%Y%m%d%H%M%S").".otl"
endfunction
"}}}2
-" AddHoistFilename(line) {{{2
+" VO_AddHoistFilename(line) {{{2
" Add a temporary filename to a parent line to indicate hoisting
-function! AddHoistFilename(line)
- let l:newparent = getline(a:line)." __hoist:".MakeTempFilename(a:line)
+function! VO_AddHoistFilename(line)
+ let l:newparent = getline(a:line)."
__hoist:".VO_MakeTempFilename(a:line)
call setline(a:line,l:newparent)
endfunction
"}}}2
"}}}2
-" DeleteHoistFilename(line) {{{2
+" VO_DeleteHoistFilename(line) {{{2
" Delete a temporary filename from a parent line
-function! DeleteHoistFilename(line)
+function! VO_DeleteHoistFilename(line)
call setline(a:line,substitute(getline(a:line)," __hoist:.*","",""))
endfunction
"}}}2
-" ExtractHoistFilename(line) {{{2
+" VO_ExtractHoistFilename(line) {{{2
" Extract a filename from a hoisted parent
-function! ExtractHoistFilename(line)
+function! VO_ExtractHoistFilename(line)
return substitute(getline(a:line),".* __hoist:","","")
endfunction
"}}}2
-" IsParent(line) {{{2
+" VO_IsParent(line) {{{2
" Return 1 if this line is a parent
-function! IsParent(line)
- return (Ind(a:line)+1) == Ind(a:line+1)
+function! VO_IsParent(line)
+ return (VO_Ind(a:line)+1) == VO_Ind(a:line+1)
endfunction
"}}}2
-" IsHoistedParent(line) {{{2
+" VO_IsHoistedParent(line) {{{2
" Return 1 if this line is a parent with hoisted children
-function! IsHoistParent(line)
+function! VO_VO_IsHoistParent(line)
return match(getline(a:line)," __hoist:","") != -1
endfunction
"}}}2
-" FindParent(line) {{{2
+" VO_FindParent(line) {{{2
" Return line if parent, parent line if not
-function! FindParent(line)
- if IsParent(a:line)
+function! VO_FindParent(line)
+ if VO_IsParent(a:line)
return a:line
else
- let l:parentindent = Ind(a:line)-1
+ let l:parentindent = VO_Ind(a:line)-1
let l:searchline = a:line
- while (Ind(l:searchline) != l:parentindent) && (l:searchline >
0)
+ while (VO_Ind(l:searchline) != l:parentindent) && (l:searchline
> 0)
let l:searchline = l:searchline-1
endwhile
return l:searchline
endif
endfunction
"}}}2
-" FindLastChild(line) {{{2
+" VO_FindLastChild(line) {{{2
" Return the line number of the last decendent of parent line
-function! FindLastChild(line)
- let l:parentindent = Ind(a:line)
+function! VO_FindLastChild(line)
+ let l:parentindent = VO_Ind(a:line)
let l:searchline = a:line+1
- while Ind(l:searchline) > l:parentindent
+ while VO_Ind(l:searchline) > l:parentindent
let l:searchline = l:searchline+1
endwhile
return l:searchline-1
endfunction
"}}}2
"}}}2
-" Hoist(line) {{{2
+" VO_Hoist(line) {{{2
" Write the offspring of a parent to a new file, open it and remove the
" leading tabs.
-function! Hoist(line)
- let l:parent = FindParent(a:line)
+function! VO_Hoist(line)
+ let l:parent = VO_FindParent(a:line)
if l:parent == 0
return
endif
call cursor(l:parent,1)
let l:firstline = l:parent+1
- let l:childindent = Ind(l:firstline)
- let l:lastline = FindLastChild(l:parent)
- let l:filename = MakeTempFilename(l:parent)
+ let l:childindent = VO_Ind(l:firstline)
+ let l:lastline = VO_FindLastChild(l:parent)
+ let l:filename = VO_MakeTempFilename(l:parent)
echo l:firstline.",".l:lastline."w! ".l:filename
let l:folded = foldclosed(l:parent)
call cursor(l:parent,1)
normal zo
exe l:firstline.",".l:lastline."w! ".l:filename
- call AddHoistFilename(l:parent)
+ call VO_AddHoistFilename(l:parent)
silent write
" log what we did incase we need to recover manually
let l:doit = l:parent."write! >> .vo_hoist.".bufname(bufnr("%")).".log"
@@ -175,18 +175,18 @@
silent write
endfunction
"}}}2
-" DeleteChildren(line) {{{2
+" VO_DeleteChildren(line) {{{2
" Delete the existing offspring of a parent
-function! DeleteChildren(line)
- let l:parent = FindParent(a:line)
+function! VO_DeleteChildren(line)
+ let l:parent = VO_FindParent(a:line)
let l:firstline = l:parent+1
- let l:lastline = FindLastChild(l:parent)
+ let l:lastline = VO_FindLastChild(l:parent)
exe l:firstline.",".l:lastline."d"
endfunction
"}}}2
-" MakeTabString(n) {{{2
+" VO_MakeTabString(n) {{{2
" Return a string of n tabs
-function! MakeTabString(n)
+function! VO_MakeTabString(n)
let l:string = ""
let l:i = 0
while l:i < a:n
@@ -196,64 +196,64 @@
return l:string
endfunction
"}}}2
-" AddChildren(line) {{{2
+" VO_AddChildren(line) {{{2
" Add left-justified children to parent. The filename is extracted from the
" end of the parent line. The parent is assumed to have no children at this
" point.
-function! AddChildren(line)
- let l:filename = ExtractHoistFilename(a:line)
+function! VO_AddChildren(line)
+ let l:filename = VO_ExtractHoistFilename(a:line)
if filereadable(l:filename) == 1
if a:line == line("$")
exe "read ".l:filename
if a:line != line("$")
- exe a:line+1.",$"."
s/^/".MakeTabString(Ind(a:line)+1)."/"
+ exe a:line+1.",$"."
s/^/".VO_MakeTabString(VO_Ind(a:line)+1)."/"
endif
else
exe a:line+1."ma v"
call cursor(a:line,1)
exe "read ".l:filename
if a:line+1 != line("'v")
- exe a:line+1.",'v-1"."
s/^/".MakeTabString(Ind(a:line)+1)."/"
+ exe a:line+1.",'v-1"."
s/^/".VO_MakeTabString(VO_Ind(a:line)+1)."/"
endif
endif
endif
endfunction
"}}}2
-" DeleteHoistFile(line) {{{2
+" VO_DeleteHoistFile(line) {{{2
" Delete a temporary filename from a parent line
-function! DeleteHoistFile(line)
+function! VO_DeleteHoistFile(line)
if g:hoistParanoia
return
endif
- let l:filename = ExtractHoistFilename(a:line)
+ let l:filename = VO_ExtractHoistFilename(a:line)
call delete(l:filename)
let l:filename = l:filename."~"
call delete(l:filename)
endfunction
"}}}2
-" DeHoistThis(line) {{{2
+" VO_DeHoistThis(line) {{{2
" Remove the old children, add the new children and remove the __hoist data
" leading tabs from this file.
-function! DeHoistThis(line)
- let l:parent = FindParent(a:line)
+function! VO_DeHoistThis(line)
+ let l:parent = VO_FindParent(a:line)
let l:folded = foldclosed(l:parent)
call cursor(l:parent,1)
if l:folded == l:parent
normal zo
endif
- call DeleteChildren(l:parent)
- call AddChildren(l:parent)
- call DeleteHoistFile(l:parent)
- call DeleteHoistFilename(l:parent)
+ call VO_DeleteChildren(l:parent)
+ call VO_AddChildren(l:parent)
+ call VO_DeleteHoistFile(l:parent)
+ call VO_DeleteHoistFilename(l:parent)
if l:folded == l:parent
normal zc
endif
endfunction
"}}}2
-" DeHoist() {{{2
+" VO_DeHoist() {{{2
" Remove the old children, add the new children and remove the __hoist data
" leading tabs from the calling file.
-function! DeHoist()
+function! VO_DeHoist()
silent write
if bufexists(b:myParentBuffer) == 0
return
@@ -264,17 +264,17 @@
" Warning switching files
exe "buffer ".l:myParentBuffer
call cursor(l:myParentLine,1)
- let l:parent = FindParent(l:myParentLine)
+ let l:parent = VO_FindParent(l:myParentLine)
let l:folded = foldclosed(l:parent)
call cursor(l:parent,1)
" if l:folded == l:parent
" normal zo
" endif
normal zv
- silent call DeleteChildren(l:parent)
- silent call AddChildren(l:parent)
- silent call DeleteHoistFile(l:parent)
- silent call DeleteHoistFilename(l:parent)
+ silent call VO_DeleteChildren(l:parent)
+ silent call VO_AddChildren(l:parent)
+ silent call VO_DeleteHoistFile(l:parent)
+ silent call VO_DeleteHoistFilename(l:parent)
if l:folded == l:parent
call cursor(l:parent,1)
normal zc
@@ -284,10 +284,10 @@
"}}}2
"}}}1
" Autocommands {{{1
- au BufReadPost vo_hoist.*.otl cmap <buffer> wq call DeHoist()
- au BufReadPost vo_hoist.*.otl cmap <buffer> qa call DeHoist()
- au BufReadPost vo_hoist.*.otl cmap <buffer> q call DeHoist()
- au BufReadPost vo_hoist.*.otl cmap <buffer> x call DeHoist()
- au BufReadPost vo_hoist.*.otl nmap <buffer> ZZ :call DeHoist()<cr>
+ au BufReadPost vo_hoist.*.otl cmap <buffer> wq call VO_DeHoist()
+ au BufReadPost vo_hoist.*.otl cmap <buffer> qa call VO_DeHoist()
+ au BufReadPost vo_hoist.*.otl cmap <buffer> q call VO_DeHoist()
+ au BufReadPost vo_hoist.*.otl cmap <buffer> x call VO_DeHoist()
+ au BufReadPost vo_hoist.*.otl nmap <buffer> ZZ :call VO_DeHoist()<cr>
"}}}1
" vim600: set foldlevel=0 foldmethod=marker:
--- End Message ---