Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!umbc3!rostamia From: rostamia@umbc3.UMBC.EDU (Rouben Rostamian) Newsgroups: comp.unix.questions Subject: Spell-checking a buffer in vi. Need help. Keywords: vi, spell Message-ID: <1856@umbc3.UMBC.EDU> Date: 31 Mar 89 06:38:51 GMT Organization: Univ of Maryland Baltimore County Lines: 37 Here is a questions that probably has been asked a hundred times in this newsgroup. My apologies to all old-timers. To spell-check the current buffer in vi I do the following: 1. 1G [Go to the top of the current buffer] 2. "byG [Yank the current buffer and place it in the named buffer b] 3. !Gspell [Run (to the end of buffer) through spell] [The current buffer now is replaced by the output of spell (i.e., a list of misspelled words] 4. "bP [Insert the contents of the original buffer (from the named buffer b) into the present buffer] The net effect is that I obtain a list of my misspelled words appended to the original buffer. How do we automate this procedure? It seems reasonable to bind the 4-step sequence above to one key, say to ^A, by: map ^A 1G "byG !Gspell^M "bP where ^M represents a carriage return. But somehow this does not work. For mysterious reasons the buffer b ends up empty after the execution, so I only get a list of my misspelled words and a beep (a warning, I guess, that the buffer b is empty, so "bP cannot execute.) I can recover my original buffer by pressing u, but then I lose the list of misspelled words. I will be thankful for any any explanation of why this does not work and will welcome suggestions for fixes. An ugly solution to the problem is redirect to output of the spell to a temporary file then read in the temporary file into the buffer. Are there better solutions for spelling the buffer in vi? -- Rouben Rostamian Department of Mathematics e-mail: University of Maryland Baltimore Counnty Rostamian@umbc2.bitnet Baltimore, MD 21228 rostamia@umbc3.umbc.edu