tony@oha.UUCP (Tony Olekshy) (06/20/89)
The following macro binding, added to your .exrc, joins the current line with the next line, moves to column 78, backs up to the previous word break, and splits the line there, leaving the cursor on the next line. Repeat the keystroke until the paragraph is cleaned up. Note that ^X is used to indicate a real control-X, and you'll have to type some extra ^Vs to get the control characters into your .exrc, and pick the key you want to map (F1 is shown in this definition)... map #1 J78^V|EB^Hr^V^M -- Yours, etc., Tony Olekshy (...!alberta!oha!tony or tony@oha.UUCP).
maart@cs.vu.nl (Maarten Litmaath) (06/21/89)
tony@oha.UUCP (Tony Olekshy) writes:
\The following macro binding, added to your .exrc, joins the current line with
\the next line, moves to column 78, backs up to the previous word break, and
\splits the line there, leaving the cursor on the next line. Repeat the
\keystroke until the paragraph is cleaned up. [...]
I'd rather not reformat a long paragraph line by line, thank you.
--
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
they're small." (Stephen Savitzky) |maart@cs.vu.nl, mcvax!botter!maart
bph@buengc.BU.EDU (Blair P. Houghton) (06/21/89)
In article <317@oha.UUCP> tony@oha.UUCP writes: >The following macro binding, added to your .exrc, joins the current line with >the next line, moves to column 78, backs up to the previous word break, and >splits the line there, leaving the cursor on the next line. Repeat the >keystroke until the paragraph is cleaned up. Note that ^X is used to >indicate a real control-X, and you'll have to type some extra ^Vs to get the >control characters into your .exrc, and pick the key you want to map (F1 is >shown in this definition)... > > map #1 J78^V|EB^Hr^V^M It works in a limited manner. For instance, if the line is the last line of the file, the J will fail, and the command will abort. If the entire line is contiguous nonwhite characters the B will place the cursor in the first column, wherupon the ^H will fail, aborting the command. I like it, though, primarily because it uses the | in a map, which I used to think was impossible. --Blair "But then, I used to think that proving Fermat's Last Theorem was impossible..."
bink@aplcen.apl.jhu.edu (Ubben Greg) (06/25/89)
In article <2783@solo8.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: > > I'd rather not reformat a long paragraph line by line, thank you. But it's not too much harder to expand on Mr. Olekshy's macro to make it call itself recursively until the end of a paragraph is reached. Perhaps adding a "+f k" will work to abort the macro when the next line doesn't contain more than one word (but I haven't tried it...) On a related issue, does anyone know why vi has such a problem with tail recursion? It seems silly that simply adding an ineffective "l" command after the recursive call will solve this -- I would think tail recursion would be easier to implement if anything... -- Greg Ubben bink@aplcen.apl.jhu.edu