[net.general] Running spell from VI

gary@ixhte.UUCP (Gary Heermann) (01/16/84)

   

To steve and anyone else interested in running spell from VI.

I didn't find this in any VI documentation so I can't guarantee that
it will work for all VIs but it does with mine so here it is.

It is simply to write the vi temp buffer to spell rather than to a file.

therefore   :w !spell    will run the text in the buffer through spell.

One minor problem is that the command must be simple: ie. you cannot
use pipes to get page control.   :w !spell | more   will not work.


				Gary Heermann
				ixhte!gary ihuxm!gary

hogue@hsi.UUCP (01/17/84)

Place the following 5 lines in a file "vispell" and place the file in some
system bin area

#! /bin/sh
tee /tmp/vis$$
echo SpellingList
spell /tmp/vis$$
rm /tmp/vis$$

Then add the following two lines to you .exrc file.

map #1 Gi/\<A\>"add@a
map #2 1G!Gvispell

Where #1 #2 are your function keys.  (Note you can pick any suitable keys
for this.)   Then when in vi merely strike the #2 key and the current
contents of you buffer will be sent to spell.  The output of spell will
then be appended to the current vi buffer.  Now type #1.  This will delete
the last line in the buffer and then search for that line in the file.  Since
the last line is a word that spell felt was wrong you will be searching for
that misspelled word.  When you have used up the output from spell the 
search pattern fails.  This worked fine under 4.1 but I seem to have a
minor problem under 4.2 I get an extraneous error message at the top of
the file.  "ioctl: Operation not supported on socket"  You figure that 
one out (i'm lazy!).  It works just fine after a dd to remove the error
message.
			- jim hogue
			  {ihnp4, kpno}!hsi!hogue

rms@inuxa.UUCP (R Sachs) (01/20/84)

Many thanks to Jim Hogue for telling us how to implement "spell"
while in vi.  I followed his instructions on creating a shell program
and then setting up two function keys for vi.  I was able to get the 
second function key to work (the one that appends the list of 
misspelled words to your file).  But the other key doesn't work
for me and perhaps he or anyone else can explain what's happening.

This key should spit out the string:
	Gi/\<A\>"add@a
and should cause vi to jump to the last line of text (the last misspelled
word), save it in register a, delete it, then do a search on contents
of register a.  I think I got the logical order right, but all I get
when I press this key is a jump to the last line followed by a search
on the string:  
	\<A\>"add@a
and of course vi cannot find this string.  What did I do wrong?
How does this command string work in detail?  I understand what each
piece does alone, but not how it works together to do the job.
Thanks for your help.

Rich Sachs

ks@ecn-ee.UUCP (01/21/84)

#R:inuxa:-26100:ecn-ee:15800005:000:517
ecn-ee!ks    Jan 20 21:13:00 1984

In reply to Rich Sachs... you are close but not quite right.
You are missing a few escape characters in your definition of #1..
It should be changed from
	Gi/\<A\>"add@a
to
	Gi/\<^[A\>^["add@a

where the 2 ^['s represent escape characters.

This actually:
G	goes to the last line.
i/\<^[	puts a "/\<" in front of the word.
A\>^[	puts a "\>" after the word.
"add	deletes this line into the a "register"
@a	executes the a register which contains the
	search command you just constructed

					Kirk Smith
					Purdue EE

jeff@heurikon.UUCP (01/21/84)

You don't need that script "vispell".  I use this map command
in my EXINIT:
		map K :w^MGoSpellList^[:$r \!spell %^M
which simply updates the current file being edited, feeds it 
to the spell program and appends the results to the buffer.

Like map commands?  Here's another helpful one:
	map V :$r $HOME/.signature^MO^D----^D
(which executes faster if you actually put your home directory
in the command instead of "$HOME".)
-- 
/"""\	Jeffrey Mattox, Heurikon Corp, Madison, WI
|O.O|	{harpo, hao, philabs}!seismo!uwvax!heurikon!jeff  (news & mail)
\_=_/		    {ihnp4, allegra}!uwvax!heurikon!jeff  (mail)