On Oct 8, 10:30 am, yosi izaq <[email protected]> wrote:
> On Thu, Oct 8, 2009 at 4:30 PM, Brett Stahlman wrote:
>
> > On Oct 8, 8:31 am, yosi izaq <[email protected]> wrote:
> >> On Thu, Oct 8, 2009 at 2:27 PM, Paul  wrote:
>
> >> >> I would like to apply the most simple directive to fold all the file
> >> >> so that each item (->) would be closed.
>
> >> > set foldmethod=indent ?
>
> >> Doesn't get the job done. The bullets are indented but I'm too lazy to
> >> indent the text so the file looks like:
>
> > Does this do what you want?
> > syn region Lvl1 start=/^\s*-\{1}>/ end=/^\s*-\{1}>/me=s-1
> > contains=Lvl2,Lvl3,Lvl4 fold
> > syn region Lvl2 start=/^\s*-\{2}>/ end=/^\s*-\{1,2}>/me=s-1 contained
> > contains=Lvl3,Lvl4 fold
> > syn region Lvl3 start=/^\s*-\{3}>/ end=/^\s*-\{1,3}>/me=s-1 contained
> > contains=Lvl4 fold
> > syn region Lvl4 start=/^\s*-\{4}>/ end=/^\s*-\{1,4}>/me=s-1 contained
> > fold
> > set foldmethod=syntax
>
> Sorry but I'm having trouble applying this in VIM, can I copy paste
> this whole section to ex prompt?- Or should I add it to .vimrc?
> If I go for the syntax route it must be some kind of trigger on the
> fly syntax that is not associated with a file type, one that I can
> trigger for the simple text files that are my ToDo list.
>
> Oh and I just tried to copy paste each line to ex but got errors for
> the lines starting with contains.

Yosi,
None of the lines start with `contains'. The lines were broken
automatically. The simplest way to test would be to paste it into a
file (e.g., /tmp/todo_syntax.vim) and source the file from within the
file containing your TODO items. E.g.,

:so /tmp/todo_syntax.vim

Here's the same script with backslashes continuing the long lines to
prevent their being broken:

syn region Lvl1 start=/^\s*-\{1}>/ end=/^\s*-\{1}>/me=s-1
\ contains=Lvl2,Lvl3,Lvl4 fold
syn region Lvl2 start=/^\s*-\{2}>/ end=/^\s*-\{1,2}>/me=s-1 contained
\ contains=Lvl3,Lvl4 fold
syn region Lvl3 start=/^\s*-\{3}>/ end=/^\s*-\{1,3}>/me=s-1 contained
\ contains=Lvl4 fold
syn region Lvl4 start=/^\s*-\{4}>/ end=/^\s*-\{1,4}>/me=s-1 contained
\ fold
set foldmethod=syntax

Brett Stahlman

>
> Thanks,
> Yosi- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to