Vi query

Steven List itkin at luke.UUCP
Thu Sep 12 06:23:31 AEST 1985


In article <183 at graffiti.UUCP> peter at graffiti.UUCP (Peter da Silva) writes:
>> This would be a nice command to have while doing spelling corrections
>> in a file. The following alias puts one into 'vi' with the list
>> of 'misspelled' words appended. The cursor is on the last word.
>
>Change it to:
>
>alias sp 'spell \!* | tee /tmp/new$$ >> \!* ;\
>		mv tags /tmp/old$$;\
>		sed 's/^\(.*\)/\1	?\1?/' > tags;\
>		rm /tmp/new$$;\
>		vi + \!*\
>		mv /tmp/old$$ tags'
>[...]
>Thank you very much for showing *me* a great new application!

One small detail - where's the input to sed?  Also, the tags file needs
to include the file name.  This should therefore probably be a shell
script, as follows:

:
# spell - generate a list of misspelled words and find them
#
#  This script loops through each file named in its argument list
#  `spell'ing that file and adding to a tags file.  The files must
#  be processed individually in order to include the file name in
#  the tags file.
#
rm spelltags		# clear out the old, if any
for file			# get errors in each file
do
	spell $file | sed "s/.*/& $file ?\<&\>?" >> spelltags
done
mv tags tags.old
mv spelltags tags
sort +0 -1 -o tags tags
vi + $*

Thanks to both of you for finally helping me to understand the use and
power of tags!  The light shines!
-- 
***
*  Steven List @ Benetics Corporation, Mt. View, CA
*  Just part of the stock at "Uncle Bene's Farm"
*  {cdp,greipa,idi,oliveb,sun,tolerant}!bene!luke!itkin
***



More information about the Comp.unix mailing list