Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!cernvax!ethz!ethz-inf!wyle From: wyle@inf.ethz.ch (Mitchell Wyle) Newsgroups: comp.unix.questions Subject: Re: VI & spell Summary: spell checking again! Keywords: spell check, vi, script, sed Message-ID: <5365@ethz-inf.UUCP> Date: 13 Nov 89 07:45:12 GMT References: <740@uc.msc.umn.edu> Reply-To: wyle@ethz.UUCP (Mitchell Wyle) Organization: ETH Zurich Lines: 102 In article <740@uc.msc.umn.edu> glex@uf.UUCP (Jeffrey Gleixner) writes: >It takes the input from vi (:1,$!sp) and redirects it to a file, I run >[...] >There has to be a way to do what I want but I haven't been able to figure >it out, any ideas??????? >Please reply E-Mail to: >glex@msc.umn.edu Well, I hope Jeff reads this group... I think that this "spell check from within vi" topic should be posted to frequently asked questions and answers. What do you say, Bill? I also think that Brandon should scan these groups for clever scripts and post them to comp.sources.misc. What about it, Brandon? To answer the question, Among all the schemes that I've seen over the years, I've settled on this one. It checks the spelling of one paragraph at a time and highlights the mis-spelled words with ### chars. 1) Put this or a similar macro in your .exrc map ;sp !}spell_check^V^M 2) Put spell_check in an appropriate place (/usr/local/bin or ~/bin #!/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 spelled words will be surrounded by ###bad-word### # # WARNING: Do not try and sell this tiny shell script to some # # poor sucker! # # Badri Lokanathan, 30 September 1988 # # # # New flags added for tput support. If tput is present, then # # spell_check -H uses highlight mode for use with more. # # All other flags are passed to spell. # # Badri Lokanathan, 6 March 1989 # ############################################################################ PATH=/usr/local/bin:/usr/bin:/bin:/usr/ucb:$HOME/bin doc=/tmp/splchk.$$ scr=/tmp/sedscr.$$ trap 'rm -f $doc $scr; exit 1' 1 2 15 # # Modify the following line to your wordlist database # spellflags="-d $HOME/lib/wlist" # T1="###" T2="###" for flag in $* do case $flag in -H|-Highlight|-highlight) T1="`tput bold; tput smso`" # Comment out if tput T2="`tput sgr0; tput rmso`" # is not available ;; *) spellflags="$spellflags $flag" ;; esac done cat > $doc ############################################################################ # The following is for macho sed hackers only. # ############################################################################ cat > $scr <
> $scr cat >> $scr <