Tuesday, July 6, 2021

Re: Pre-fold output of :r! command

Thanks very much. That works perfectly.

One tiny tweak is I would just like to be able to collapse and open a fold back and forth with ease. If I unfold that fold, I think the fold disappears. I then have to respecify the content to be folded. Or if not, I still have to put my cursor on the top line of the fold, to re-fold it.

I would prefer to just have a go to button to fold and unfold what was printed, no matter where in the document I am.

What would be the most convenient way to refold a large section of text after having unfolded it?

Thanks very much,
Julius

On Mon, Jul 5, 2021, 13:55 Christian Brabandt <cblists@256bit.org> wrote:

On So, 04 Jul 2021, Julius Hamilton wrote:

> I would like to print the output of a shell command - a webpage dump - into a
> Vim buffer, and have those lines immediately folded, rather than a second step
> of selecting and folding them.
>
> The command would look something like:
>
> :r! w3m -dump url.com FOLD
>
> How would this be possible?

Perhaps like this:

    :exe ":r! w3m -dump url" |'[,']fold

Unfortunately the `|` is seen as an argument to the :r! command, that's
why we have to wrap it in an `:exe "..." call and can separate the next
ex command using |, which in this case is the :fold command for the
region given by the markers '[,'], which describes the region of the
previously inserted text.

You can probably wrap this into a custom command like this:

:com -nargs=1 Dump :exe ":r! -dump <args>"|'[,']fold

(untested) and then use

    :Dump <url>


>
> I would like to navigate my folds in an easier way than navigating to the blue
> line that appears, and unfolding them.

The little blue line is hard-coded I believe. But you can disable it
using :set foldcolumn=0

> Is it possible to get some kind of table
> of contents sidebar where you can select a fold and open or close it? In my
> current configuration, I don't see an indicator that a fold is on a certain
> line, if that fold is currently unfolded.

Not sure I understand what you want here.

Best,
Christian
--
Ein Idealist ist ein Mann, der aus der Tatsache, daß die Rose besser
riecht als der Kohl, darauf schließt, eine Suppe aus Rosen müsse auch
besser schmecken.
                -- Ernest Hemingway

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210705115544.GC283422%40256bit.org.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGrXgp34TNiA71-xu3HS9KuVnEh%3DQc0bFh2%2BTDoMCkb4_KK-%2Bg%40mail.gmail.com.

No comments: