long line to paragraph all indented

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

long line to paragraph all indented

Tim Johnson
version 7.4 on ubuntu
non-gui

given a long line indented to some nominal number of spaces, how can
I format this line to preset paragraph width but with each line in
paragraph retaining the original indentation.
example:

    Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.

    becomes:

    Pour the remaining sauce over the enchiladas. Cover with leftover cheese
    and bake for about 20 minutes or until cheese is bubbling.

thanks
--
Tim Johnson
http://www.tj49.com

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190603214308.GA12747%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

George Dinwiddie
Tim

On 6/3/19 5:43 PM, Tim Johnson wrote:

> version 7.4 on ubuntu
> non-gui
>
> given a long line indented to some nominal number of spaces, how can
> I format this line to preset paragraph width but with each line in
> paragraph retaining the original indentation.
> example:
>
>      Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
>
>      becomes:
>
>      Pour the remaining sauce over the enchiladas. Cover with leftover cheese
>      and bake for about 20 minutes or until cheese is bubbling.

I use the external program 'fmt' to do it, like this:

:.,.!fmt

Does that give you the results you want?

  - George

--
  ----------------------------------------------------------------------
   * George Dinwiddie *                      http://blog.gdinwiddie.com
   Software Development                    http://www.idiacomputing.com
   Consultant and Coach
  ----------------------------------------------------------------------

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/01f9f352-f6ed-89de-b608-e02f561b4e8b%40iDIAcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

Gary Johnson-4
In reply to this post by Tim Johnson
On 2019-06-03, Tim Johnson wrote:

> version 7.4 on ubuntu
> non-gui
>
> given a long line indented to some nominal number of spaces, how can
> I format this line to preset paragraph width but with each line in
> paragraph retaining the original indentation.
> example:
>
>     Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
>
>     becomes:
>
>     Pour the remaining sauce over the enchiladas. Cover with leftover cheese
>     and bake for about 20 minutes or until cheese is bubbling.

    :set breakindent

Regards,
Gary

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190603215044.GC27734%40phoenix.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

Gary Johnson-4
In reply to this post by George Dinwiddie
On 2019-06-03, George Dinwiddie wrote:

> Tim
>
> On 6/3/19 5:43 PM, Tim Johnson wrote:
> >version 7.4 on ubuntu
> >non-gui
> >
> >given a long line indented to some nominal number of spaces, how can
> >I format this line to preset paragraph width but with each line in
> >paragraph retaining the original indentation.
> >example:
> >
> >     Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
> >
> >     becomes:
> >
> >     Pour the remaining sauce over the enchiladas. Cover with leftover cheese
> >     and bake for about 20 minutes or until cheese is bubbling.
>
> I use the external program 'fmt' to do it, like this:
>
> :.,.!fmt
>
> Does that give you the results you want?

Perhaps I misunderstood.  If you want to actually reformat the line,
not just change the way it's displayed, then the normal-mode command

    gqq

should do it.  You may have to set 'autoindent' as well.  See

    :help 10.7
    :help gq

Regards,
Gary

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190603220058.GD27734%40phoenix.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

Tim Johnson
In reply to this post by George Dinwiddie
* George Dinwiddie <[hidden email]> [190603 13:58]:

> Tim
>
> On 6/3/19 5:43 PM, Tim Johnson wrote:
> > version 7.4 on ubuntu
> > non-gui
> >
> > given a long line indented to some nominal number of spaces, how can
> > I format this line to preset paragraph width but with each line in
> > paragraph retaining the original indentation.
> > example:
> >
> >      Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
> >
> >      becomes:
> >
> >      Pour the remaining sauce over the enchiladas. Cover with leftover cheese
> >      and bake for about 20 minutes or until cheese is bubbling.
>
> I use the external program 'fmt' to do it, like this:
>
> :.,.!fmt

  :) That works like a charm! Thank you.

--
Tim Johnson
http://www.tj49.com

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190603224825.GB12747%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

Tim Johnson
In reply to this post by Gary Johnson-4
* Gary Johnson <[hidden email]> [190603 13:58]:

> On 2019-06-03, Tim Johnson wrote:
> > version 7.4 on ubuntu
> > non-gui
> >
> > given a long line indented to some nominal number of spaces, how can
> > I format this line to preset paragraph width but with each line in
> > paragraph retaining the original indentation.
> > example:
> >
> >     Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
> >
> >     becomes:
> >
> >     Pour the remaining sauce over the enchiladas. Cover with leftover cheese
> >     and bake for about 20 minutes or until cheese is bubbling.
>
>     :set breakindent

  Oh yeah...really simple and avoids using external app.
  thanks

--
Tim Johnson
http://www.tj49.com

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190604000029.GC12747%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: long line to paragraph all indented

Erik Christiansen
In reply to this post by Tim Johnson
On 03.06.19 13:43, Tim Johnson wrote:
>
>     Pour the remaining sauce over the enchiladas. Cover with leftover cheese and bake for about 20 minutes or until cheese is bubbling.
>
>     becomes:
>
>     Pour the remaining sauce over the enchiladas. Cover with leftover cheese
>     and bake for about 20 minutes or until cheese is bubbling.

Another data point: With autoindent on, I use gq}, i.e. wrap a
paragraph. Then there's only one thing to remember for wrapping stuff,
long line or wide paragraph.

To minimise keystrokes, I've mapped that to ^W, i.e. "Wrap". (That was
apparently a window command, whatever one of those is. Even after
decades, flicking between buffers with the original commands seems
eminently sufficient. One could use Alt-W, I guess.)

Particularly impressive is that the wrapping, whether gqq or gq},
respects and properly places/adds '> " quote delimiters when wrapping
text quoted as above, making Vim ideal for use within an MUA, in this
case, Mutt.

Erik

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190604014352.GA3502%40ratatosk.
For more options, visit https://groups.google.com/d/optout.