Collapsing 100%

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Collapsing 100%

Sean E. Russell
Hiya,

I sent this out with the wrong identity, so the list server bounced it.  If
the moderater is watching, please ignore the other one, thanks.

I'm using this mapping to collapse all items that are 100% complete, but it
obviously has problems (try it twice in a row).  I'm not a vim hacker... can
someone more knowledgable than me provide a better way of doing this?

 au BufRead,BufNewFile *.otl map zz :g/100%/foldc<CR>

Thanks!

--- SER

Confidentiality Notice
This e-mail (including any attachments) is intended only for the recipients named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not a named recipient, please notify the sender of that fact and delete the e-mail from your system.


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Collapsing 100%

Steve Litt
On Wednesday 22 February 2006 03:42 pm, Sean Russell wrote:

> Hiya,
>
> I sent this out with the wrong identity, so the list server bounced it.  If
> the moderater is watching, please ignore the other one, thanks.
>
> I'm using this mapping to collapse all items that are 100% complete, but it
> obviously has problems (try it twice in a row).  I'm not a vim hacker...
> can someone more knowledgable than me provide a better way of doing this?
>
>  au BufRead,BufNewFile *.otl map zz :g/100%/foldc<CR>
>
> Thanks!
>

That's going to be a pretty handy functionality when you get it finished. Can
you post the final code?

Thanks

SteveT

Steve Litt
Author:
   * Universal Troubleshooting Process courseware
   * Troubleshooting Techniques of the Successful Technologist
   * Rapid Learning: Secret Weapon of the Successful Technologist
Webmaster
   * Troubleshooters.Com
   * http://www.troubleshooters.com
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Collapsing 100%

Peter Princz
In reply to this post by Sean E. Russell
On 22/02/06, Sean Russell <[hidden email]> wrote:

> Hiya,
>
> I sent this out with the wrong identity, so the list server bounced it.  If
> the moderater is watching, please ignore the other one, thanks.
>
> I'm using this mapping to collapse all items that are 100% complete, but it
> obviously has problems (try it twice in a row).  I'm not a vim hacker... can
> someone more knowledgable than me provide a better way of doing this?
>
>  au BufRead,BufNewFile *.otl map zz :g/100%/foldc<CR>
>
> Thanks!
>
> --- SER
>
>

Hi Sean,

I'm doing it the other way around. First collapse everything, and then
open those folds that *do* have percentages, but are *not* completed.
The reason for this flip approach is that I maintain a lot of
hierarchical lists without percentages, and I want them also to be
closed during these backlog-killing sessions... :)

Thus, my flip-solution is:
,,1
:g/[^0-9][0-9][0-9]%\|[^0-9][0-9]%/:foldopen

I admit this could still be improved further, but works for me.

Hope this helps,
  Peter

--
Keep cool. Develop in total darkness.
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Collapsing 100%

Sean E. Russell
In reply to this post by Sean E. Russell
Moderator, I sent this from the wrong account again.  Please ignore the other
one.

Thanks for the replies, Steve and Peter.

Ok, I've made some changes to my code, and it seems to be working for me.  It
isn't a one-liner, but it has the behavior that I want.

1) It doesn't affect any other folding you have going on.  For example, if you
have some folding going on, you can use this and it'll only change the
folding on the 100% complete items.

2) You can use it repeatedly.

3) Your cursor doesn't move (much).  It jumps to the beginning of the line,
but at least you end up on the same line you started on.  I'd rather it not
move your cursor at all, but I haven't figured this out yet.

It will fold ANY line containing the text "100%", which may be less than
desireable; I've been toying with the idea of changing the search pattern to
"] 100%", which would help, but then it would only work on % that were also
checkboxes.

I'll throw this up on the vimoutliner wiki sooner or later.  Probably later.

Stick it in your .vimrc file:

function! Close100()
        let l:line1 = line(".")
 normal 1G
        while search( "100%", "W" ) > 0
                foldopen
                foldclose
        endwhile
        execute ":normal " . l:line1 . "G"
endfunction
au BufRead,BufNewFile *.otl map zz :call Close100()<CR>

--- SER

Confidentiality Notice
This e-mail (including any attachments) is intended only for the recipients named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not a named recipient, please notify the sender of that fact and delete the e-mail from your system.


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner