Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!sdcsvax!ucsdhub!hp-sdd!ncr-sd!ncrlnk!uunet!mcvax!cernvax!ethz!ethz-inf!wyle From: wyle@inf.ethz.ch (Mitchell Wyle) Newsgroups: comp.unix.questions Subject: Re: Spell-checking a buffer in vi. Need help. Keywords: vi, spell Message-ID: <138@inf.ethz.ch> Date: 2 Apr 89 15:22:28 GMT References: <1856@umbc3.UMBC.EDU> Reply-To: wyle@inf.ethz.ch Organization: Departement fuer Informatik, ETH Zuerich Lines: 42 >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@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@ethz.uucp Institut fuer Informationssysteme wyle@inf.ethz.ch ETH Zentrum / 8092 Zurich, Switzerland +41 1 256 5237