Main Page | Report this Page
Computers Forum Index  »  Computer - Editors  »  How can I fill text in vi?...
Page 1 of 1    

How can I fill text in vi?...

Author Message
Alan Mackenzie...
Posted: Fri Oct 30, 2009 7:29 am
Guest
Yes, that's vi as in vi, not the more forceful vim.

By filling I mean, of course, taking a ragged paragraph of text and
reformatting it so it fits neatly into a maximum width of (say) 73
columns - what one might do with "g q }" in vim.

Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

Thanks in advance!

--
Alan Mackenzie (Nuremberg, Germany).
 
SM...
Posted: Fri Oct 30, 2009 12:53 pm
Guest
2009-10-30, Alan Mackenzie skribis:
Quote:

By filling I mean, of course, taking a ragged paragraph of text and
reformatting it so it fits neatly into a maximum width of (say) 73
columns - what one might do with "g q }" in vim.

In vi, I'd probably do

:%!fmt

Quote:
Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

Probably. Sorry.

--
kasmra
:wq
 
Alan Mackenzie...
Posted: Fri Oct 30, 2009 5:25 pm
Guest
Hi, SM!

SM <kasmra at (no spam) ne-spamon.gmail.com> wrote:
Quote:
2009-10-30, Alan Mackenzie skribis:

By filling I mean, of course, taking a ragged paragraph of text and
reformatting it so it fits neatly into a maximum width of (say) 73
columns - what one might do with "g q }" in vim.

In vi, I'd probably do

:%!fmt

This doesn't do quite what I want. It fails to preserve prefices like
">> >" in newsgroups postings. But I forgot to say I wanted this. But
thanks muchly for the idea of using an external program (which hadn't
occurred to me). I've hacked an AWK script which DTRT, more or less, and
then mapped the key `q' to invoke it on the current paragraph.

Quote:
Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

Probably. Sorry.

Hey, you've nothing to apologise for. Wink I found out there's an option
`wraplen' (aka `wl') on my ISP's vi which does just what I want.

So, all in all, a totally successful hack. Thanks for the tip!

--
Alan Mackenzie (Nuremberg, Germany).
 
Peter Gordon...
Posted: Fri Oct 30, 2009 11:39 pm
Guest
SM <kasmra at (no spam) ne-spamon.gmail.com> wrote in
news:slrnhelabv.3vg.kasmra at (no spam) ananas.Sauna:

Quote:
2009-10-30, Alan Mackenzie skribis:

By filling I mean, of course, taking a ragged paragraph of text and
reformatting it so it fits neatly into a maximum width of (say) 73
columns - what one might do with "g q }" in vim.

In vi, I'd probably do

:%!fmt

Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

Probably. Sorry.


set wm=10 will cause the line to hard wrap at column 70.
It assumes the old ASCII screens of 80 characters width.
 
Florian Rehnisch...
Posted: Sat Oct 31, 2009 4:04 am
Guest
o Alan Mackenzie <acm at (no spam) muc.de>:
Quote:
SM <kasmra at (no spam) ne-spamon.gmail.com> wrote:
2009-10-30, Alan Mackenzie skribis:

By filling I mean, of course, taking a ragged paragraph of text and
reformatting it so it fits neatly into a maximum width of (say) 73
columns - what one might do with "g q }" in vim.

In vi, I'd probably do

:%!fmt

This doesn't do quite what I want. It fails to preserve prefices like
">> >" in newsgroups postings. But I forgot to say I wanted this. But
thanks muchly for the idea of using an external program (which hadn't
occurred to me). I've hacked an AWK script which DTRT, more or less, and
then mapped the key `q' to invoke it on the current paragraph.

“par” handels prefixes and suffixes, according to its manpage.
--
flori
Vim-Hilfe auf Deutsch http://www.florianrehnisch.de/vimhelp/
Mein Zigarettenkonsum der letzten sieben Tage:
Fr:27 Sa:29 So:30 Mo:25 Di:31 Mi:35 Do:30
 
Geoff Clare...
Posted: Tue Nov 03, 2009 6:21 pm
Guest
Peter Gordon wrote:

Quote:
Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

set wm=10 will cause the line to hard wrap at column 70.
It assumes the old ASCII screens of 80 characters width.

It should wrap at 10 columns from the right margin, regardless of
the terminal width. If you have a version of vi that wraps at
(80-wm) instead of (width-wm) when the width isn't 80, that's a bug.

--
Geoff Clare <netnews at (no spam) gclare.org.uk>
 
Alan Mackenzie...
Posted: Tue Nov 03, 2009 10:36 pm
Guest
Geoff Clare <geoff at (no spam) clare.see-my-signature.invalid> wrote:
Quote:
Peter Gordon wrote:

Also, having vi wrap at the said column whilst typing would be nice.
Is there a way of doing this?

set wm=10 will cause the line to hard wrap at column 70. It assumes
the old ASCII screens of 80 characters width.

It should wrap at 10 columns from the right margin, regardless of the
terminal width. If you have a version of vi that wraps at (80-wm)
instead of (width-wm) when the width isn't 80, that's a bug.

On "my" vi, there's an option "wraplen" (abbreviated "wl") which you set
to the amount of text you want to wrap, not the size of the hole you want
to leave after it. This is a vi on FreeBSD, but I don't know how to get
this vi to display its version number.

--
Alan Mackenzie (Nuremberg, Germany).
 
 
Page 1 of 1    
All times are GMT
The time now is Sat Nov 28, 2009 7:00 am