Thursday, November 15, 2018

Re: Using Vim as a Browser Bookmark Manager - Auto Recursive Folding

On 2018-11-15, Philip Rhoades <phil@pricom.com.au> wrote:
> People,
>
> Since the Bookmark Managers in different browsera generally drive me
> crazy - because they can never do everything what I want, I am going to
> experiment with a Bookmarks plain text file that I can manage in Vim - I
> can start a browser with a new tab from Vim when the cursor is over an
> URL - so if I can get the auto folding working I should have everything
> I need. If I have a structure like:
>
> FOLDER aaa
> FOLDER aaa-1
> URL 1
> URL 2
> URL 3
> URL 4
> FOLDER aaa-2
> URL 5
> URL 6
> URL 7
> URL 8
> FOLDER aaa-2-1
> URL 9
> URL 10
> URL 11
> URL 12
> FOLDER aaa-3
> URL 13
> URL 14
> URL 15
> URL 16
> URL 17 # ie directly under folder "aaa"
> URL 18 # ie directly under folder "aaa"
> URL 19 # ie directly under folder "aaa"
> URL 20 # ie directly under folder "aaa"
> FOLDER bbb
> FOLDER bbb-1
> URL 21
> URL 22
> URL 23
> URL 24
>
> - the auto folding would have to allow for nesting so a fold would start
> on the word "FOLDER" and continue to the last line before the next word
> "FOLDER" with the same level of indentation or until a change of
> indentation occurs.
>
> Suggestions about how to do this?

You may try my Outlaw plugin:

https://github.com/lifepillar/vim-outlaw

with g:outlaw_topic_mark set to 'FOLDER'.

The plugin is ~250 LoC: you may browse the source code, in particular
how foldexpr is defined, to see how to define a folding function that
does what you ask.

Hope this helps!
Life

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: