Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!yale!bunker!wtm From: wtm@bunker.UUCP (Bill McGarry) Newsgroups: comp.unix.wizards Subject: Re: help w/ a vi map Message-ID: <2207@bunker.UUCP> Date: Fri, 19-Jun-87 00:23:15 EDT Article-I.D.: bunker.2207 Posted: Fri Jun 19 00:23:15 1987 Date-Received: Mon, 22-Jun-87 01:21:43 EDT References: <7881@brl-adm.ARPA> Reply-To: wtm@bunker.UUCP (Bill McGarry) Organization: Bunker Ramo, an Olivetti Company, Shelton, CT Lines: 29 In article <7881@brl-adm.ARPA> groff@gateway.mitre.ORG writes (edited): > > > I have encountered a puzzling problem w/ setting up a map in vi. >It began w/ a file I had redirected from 'man printcap'. This file had >_^H's thru-out. I could have simply done :1,$s/_^H//g and gone merrily >on my way. (This worked fine.) I decided to create a map for this function >by doing :map ^R :1,$s/_^H//g^M - this worked SORT OF, but NOT as I would have >expected. I get the error: "No previous regular expression" > There are two problems here: First, the "$" should be escaped as "\$" to avoid any problem with shell variables. Secondly, control V's (or your "literal-next" character) must be included in the map itself. The final map should look like this: :map ^R :1,\$s/_^V^V^H//g^M Note that to get the "^V^V^H" sequence, you must actually type: ^V^V^V^V^V^H (That's right -- 5 ^V's and 1 ^H) Looks weird but it works (I tried it) and it does make sense. The first control V allows the next control V to "get through" to vi so that the control H will not act as a backspace. Otherwise, the map actually ends up being: ":1,///g" Bill McGarry PATH: {philabs, decvax, fortune, yale}!bunker!wtm