Using Vim as a Browser Bookmark Manager - Auto Recursive Folding

369 views
Skip to first unread message

Philip Rhoades

unread,
Nov 15, 2018, 10:58:39 AM11/15/18
to vim...@googlegroups.com
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?

Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra NSW 2794
Australia
E-mail: ph...@pricom.com.au

Philip Rhoades

unread,
Nov 15, 2018, 11:24:58 AM11/15/18
to vim...@googlegroups.com
People,

Actually I think the Vim plugin Voom will do what I want nicely! - but
it would be nice if someone had a solution to the original question . .

P.
> --

Kit

unread,
Nov 15, 2018, 2:36:06 PM11/15/18
to vim...@googlegroups.com
2018-11-15 16:58 GMT+01:00, Philip Rhoades <ph...@pricom.com.au>:
> 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:

Try YAML structure or Markdown.
--
Kit

Lifepillar

unread,
Nov 16, 2018, 2:28:46 AM11/16/18
to vim...@googlegroups.com
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

Philip Rhoades

unread,
Nov 16, 2018, 11:04:27 AM11/16/18
to vim...@googlegroups.com, Lifepillar
Lifepillar,
Thanks for that! - I will have a look at it.

Regards,

Phil.


> Hope this helps!
> Life
>
> --

Marc Weber

unread,
Nov 16, 2018, 11:38:19 AM11/16/18
to vim_use
Why use folding?

use tags:
http:/// #bar #batch #s
http:/// #batch #s
http:/// #batch #batch

the folder thing never works..

and create shortcut for filter for filtering or :%!grep ..
https://github.com/MarcWeber/vim-addon-other/blob/master/plugin/vim-addon-other.vim#L39

Marc Weber

Philip Rhoades

unread,
Nov 16, 2018, 12:00:22 PM11/16/18
to vim...@googlegroups.com
People,


On 2018-11-16 03:24, Philip Rhoades wrote:
> People,
>
> Actually I think the Vim plugin Voom will do what I want nicely! - but
> it would be nice if someone had a solution to the original question .
> .


After quite a few hours of hacking and massaging a very large Chrome
Bookmark file, I now have something that is working well and with a
Chrome extension to copy the page Title and URL into the clipboard, I
can immediately paste it into the Vim edited Bookmarks.txt file. I can
also open a link from the file using "<leader>w" too.

See attached screencapture.
Screenshot_2018-11-17_03-53-22.png
Reply all
Reply to author
Forward
0 new messages