Spell-checking a buffer in vi. Need help.

Mitchell Wyle wyle at inf.ethz.ch
Mon Apr 3 01:22:28 AEST 1989


>To spell-check the current buffer in vi I do the following:

>map ^A  1G "byG !Gspell^M "bP

>temporary file then read in the temporary file into the buffer.  Are
>there better solutions for spelling the buffer in vi?
>rostamia at umbc3.umbc.edu


In my .exrc, I have a macro:  map ;sp !}spellcheck

and spellcheck is simply:
#!/bin/sh
#       A sh script to allow spelling checks either in vi or stand alone
#       Usage: spell_check < file or within vi,
#               !}spell_check           or
#               :(addressed lines)!spell_check
#
# The wrongly spelt words will be surrounded by ###bad-word### 
#       Badri Lokanathan, 30 September 1988
###############################################################
doc=/tmp/splchk.$$
scr=/tmp/sedscr.$$

trap 'rm -f $doc $scr; exit 1' 1 2 15
cat > $doc
spell < $doc |
  sed -e 's/^/s;\\(\\.*\\)\\(/
          s/$/\\)\\(\\.*\\);\\1###\\2###\\3;g/' > $scr
#
#       sed -e 's/^/s;\\([      ][      ]*\\)\\(/
#               s/$/\\)\\([     ][      ]*\\);\\1###\\2###\\3;g/' > $scr
#
sed -f $scr $doc
rm -f $doc $scr

I admit it's only for PARAGRAPHS, and not a buffer, but it runs fast.

-- 
-Mitchell F. Wyle                         wyle at ethz.uucp
Institut fuer Informationssysteme         wyle at inf.ethz.ch
ETH Zentrum / 8092 Zurich, Switzerland    +41 1 256 5237



More information about the Comp.unix.questions mailing list