[comp.editors] alignment on the right hand side

chang@maui.cs.ucla.edu (Keh-Jeng Chang) (09/11/88)

When I post articles on newsgroups, I always hope that
there are some editors out there which can align the
right hand side of my articles (like wordstar in PC).

Do you know of any such editors?  Can 'vi' do it?

Keh-jeng Chang

irf@kuling.UUCP (Bo Thide) (09/12/88)

In article <15889@shemp.CS.UCLA.EDU> chang@cs.ucla.edu (Keh-Jeng Chang) writes:
>When I post articles on newsgroups, I always hope that
>there are some editors out there which can align the
>right hand side of my articles (like wordstar in PC).
>
>Do you know of any such editors?  Can 'vi' do it?

Yes, since 'vi' can filter an arbitrary portion of its buffer
through any filter you can use several methods to achieve
a justified right-hand margin.

E.g., for passing the text from the cursor to the end of the paragraph
through the command 'cmd', type
ESC!}cmd

Useful commands are 'fmt', 'adjust' and 'nroff'; see your UNIX manual.
I usually use 'adjust -jm60' to get justified margin at 60 coulmns.
On some (non-HP-UX) systems 'adjust' is missing and you have to use
the less powerful command 'fmt' instead.


-Bo
-- 
>>> Bo Thide', Swedish Institute of Space Physics, S-755 90 Uppsala, Sweden <<<  Phone (+46) 18-300020.  Telex: 76036 (IRFUPP S).  UUCP: ..enea!kuling!irfu!bt

jewett@hpl-opus.HP.COM (Bob Jewett) (09/14/88)

> When I post articles on newsgroups, I always hope that
> there are some editors out there which can align the
> right hand side of my articles (like wordstar in PC).

The general agreement is that right justification of fixed-width fonts (such
as you are likely reading right now) is ugly and difficult to read.

pdc@otter.hple.hp.com (Damian Cugley) (09/17/88)

In article <15889@shemp.CS.UCLA.EDU> chang@cs.ucla.edu (Keh-Jeng Chang) writes:

>When I post articles on newsgroups, I always hope that there are some
>editors out there which can align the right hand side of my articles
>[...]
>Do you know of any such editors?  Can 'vi' do it?

irf@kuling.UUCP (Bo Thide)  12 Sep 1988
> Yes, since 'vi' can filter an arbitrary portion of its buffer
> through any filter you can use several methods to achieve
> a justified right-hand margin.

Almost any UN*X editor should be able to do this - ed, ex, mailx, Mail,
Elm, even ved and spy.   One notable exception is the SunView textedit,
which allows you to bind filters to keys but doesn't allow you to pick
one completely arbitrarily.
  Is it possible to pick two arbitrary points in vi and invoke a filter
on that region of the buffer without all the counting of lines I ended
up doing?  Better still, can I select these two points using my mouse?

> E.g., for passing the text from the cursor to the end of the paragraph
> through the command 'cmd', type
> ESC!}cmd

S'funny, I seem to remember a text editor wot did paragraph re-formating
with one keystroke...  But of course typing `{ ! } adjust -jm60 RET'
every time you insert a word is much more efficient and mnemonic than
`Meta-Q'.

question> Is there a `fmt' or `adjust' clone capable
question> of doing something similar to the Emacs
question> fill-prefix?

(Actually don't use justified text with fixed-width-fonts, the irregular
spacing looks ugly.)

pdc

debra@alice.UUCP (Paul De Bra) (09/17/88)

In article <15889@shemp.CS.UCLA.EDU> chang@cs.ucla.edu (Keh-Jeng Chang) writes:
>When I post articles on newsgroups, I always hope that there are some
>editors out there which can align the right hand side of my articles
>[...]
>Do you know of any such editors?  Can 'vi' do it?
Here are some replies: (I keep forgetting who sent them)

> Yes, since 'vi' can filter an arbitrary portion of its buffer
> through any filter you can use several methods to achieve
> a justified right-hand margin.

>S'funny, I seem to remember a text editor wot did paragraph re-formating
>with one keystroke...  But of course typing `{ ! } adjust -jm60 RET'
>every time you insert a word is much more efficient and mnemonic than
>`Meta-Q'.

I have something similar to the "adjust" filter bound to the control-p
key in my EXINIT. That's just as easy as Meta-Q i suppose, but it is damn
slow.

Years ago I had an mlisp-function which right-aligned a paragraph without
moving from where i was. I then had this functio bound to the spacebar...
This worked great! Of course one needed 100% of a Vax 11/780 to do this
"on the fly" and even then the vax limped behind when the paragraph became
rather long.

I have abandoned this approach long ago, cause I agree that right-adjusting
fixed-width fonts looks ugly. You shouldn't be doing it at all.

Paul.

barnett@mozart.steinmetz.ge.com (Bruce Barnett) (09/23/88)

In article <2000002@otter.hple.hp.com>, pdc@otter (Damian Cugley) writes:
>Almost any UN*X editor should be able to do this.
>One notable exception is the SunView textedit,
>which allows you to bind filters to keys but doesn't allow you to pick
>one completely arbitrarily.

Well, you could select the command you want, and then execute the
binding to paste it into a known filename. Then you could execute the
other binding that will call up the new filter.

	example: Filter # 1

		cat >$HOME/tmp/my-tmp-filter

	Filter #$2:
	
		csh -c `$HOME/tmp/my-tmp-filter`

With 3.x, you have to bind both to function keys.  With 4.0, you have
the option of adding an entry to your pop-up menu inside of textedit.

Another method is to have a filter execute another filter specified in
the secondary selection. Then you could

	1. Type the filter you want to execute. If you had another
	   window with a list of filters, you could use any of them.
	2. Select the text you want filtered with pending delete.
	3. Select the filter you want with the secondary selection
	4. pop up a menu, or press a function key and execute the filter
	   that calls the secondary filter.


The filter might be something like
	
	csh -c `get_selection 2`

The third method is to type in the filter, delete it, and use a filter
like:
	csh -c `get_selection 3`

which executes the filter in the clip-board. I may have a few typo's
because I am typing this in from home, but it shouldn't be hard to get
it working. You should also be able to use more complex statements
with sed, awk, etc. besides the simple one word filters.
-- 
--
Bruce G. Barnett  <barnett@ge-crd.ARPA> <barnett@steinmetz.UUCP>
		uunet!steinmetz!barnett