Newsgroups: comp.editors Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!ispd-newsserver!garden.ssd.kodak.com!weimer From: weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) Subject: Re: Is there a vi command to... Message-ID: <1991May10.165948.9707@ssd.kodak.com> Sender: news@ssd.kodak.com Reply-To: weimer@ssd.kodak.com Organization: Eastman Kodak Co.; Rochester, NY References: <4279@meaddata.meaddata.com> <1991May09.160949.12305@convex.com> Distribution: usa Date: Fri, 10 May 91 16:59:48 GMT In article <1991May09.160949.12305@convex.com>, tchrist@convex.COM (Tom Christiansen) writes: |> From the keyboard of richt@meaddata.com (Rich Thompson): |> :Is there any command in VI which will execute a "~" on every |> :character on the current line to the right of the current |> :character? |> |> map = y$mno^V^[P:s/./\~/g^V^M0"nDdd`n@n Neat! So now we can do (from my new .exrc file): " extensions for ~ command " macro called by all ~ macros map ~_ mno^[P:s/./\~/g^M0"nDdd`n@n map ~$ y$~_ map ~w yw~_ . . . But using these brought up some interesting "features" 1) When I used the original = macro (even when I renamed it ~$), I could make one change to a line (let's say Line1), but the next 2 attempts to change Line1 failed with a beep (apparently at the `n). Every third attempt worked properly. If I changed Line1, then X other lines with the macro, I could then change Line1 again (Too lazy to figure out X). The 'u' command before changing Line1 the second time would undo all of the changes (not just the last one). If I use the = macro first, the ~$ macro above exibits (I think there's an 'h' in there somewhere) the same behavior. If I use the ~$ macro, I can modify the same line multiple times. 2) With both the original macro and my modified version, The ~ for the last character does not get executed until after the cursor is moved or another command is given. So if I start with: abcdefg ^ cursor here and do ~$, I get abCDEFg ^ cursor here Moving the cursor changes the g first. BUT typing ~ gives: abCDEFG ^ cursor here and now after moving the cursor it changes to: abCDEFg Assuming these are not universal for all implementations of vi, I am running SunOS 4.1.1 on a Sparc I+ with Version SVR3.1 of vi. Happy Debugging... weimer@ssd.kodak.com ( Gary Weimer )