Allan Wind wrote:
> On 2009-02-08T19:29:59, StarWing wrote:
>> just as subject: i need to find a to-do list plugin to manage my
>> work... has any good advice?
>
> I just use a text file formatted as follows:
>
> item 1
> sub-item
> sub-sub-item
> item 2
>
> then configure folding:
>
> .vim/filetype.vim
> autocmd BufNewFile,BufRead todo.txt set filetype=todo
>
> .vim/ftplugin/todo.vim
> setlocal foldmethod=indent
I didn't like the foldmethod=indent behaviour so wrote my own folding
for this situation (my to do list!), which I now find I use for many,
many types of lists with an outline kind of structure. I paste my script
below. Feel free to try it, modify it, mutilate it. It's the sort of
thing that suits people who prefer DIY rather than the whole
calendar-integrated computer-managed life approach.
Ben.
setlocal foldexpr=TodoFoldExpr()
setlocal foldmethod=expr
setlocal foldtext=TodoFoldText()
setlocal ts=3 shiftwidth=3
function! TodoFoldExpr()
let ths=matchend(getline(v:lnum),'\t*')
if (v:lnum<line("$"))
let nxt=matchend(getline(v:lnum+1),'\t*')
if (ths<nxt)
return '>' . (ths + 1)
elseif (ths==nxt)
return '='
else
return '<' . (nxt + 1)
endif
else
if (ths==0)
return 0
else
return '<1'
endif
endif
endfunction
function! TodoFoldText()
return substitute(getline(v:foldstart),'\t',' ','g') . " +"
endfunction
highlight Folded ctermfg=White ctermbg=Black cterm=bold
finish
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---