Path: utzoo!censor!geac!sq!lee From: lee@sq.sq.com (Liam R. E. Quin) Newsgroups: comp.editors Subject: Re: tabbing (was .exrc example?) Keywords: tab map vi Message-ID: <1989Nov17.232318.7093@sq.sq.com> Date: 17 Nov 89 23:23:18 GMT References: <4468@solo10.cs.vu.nl> <2238IA80001@MAINE> <1989Oct31.015320.28332@NCoast.ORG> <6820@ficc.uu.net> <47797@bbn.COM> <4988@ethz-inf.UUCP> <225@xochitl.UUCP> <4530@ski.cs.vu.nl> Reply-To: lee@sq.com (Liam R. E. Quin) Organization: Unixsys (UK) Ltd Lines: 57 In article <4530@ski.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >In article <225@xochitl.UUCP> cheeks@edsr.eds.com writes: >\In article <4468@solo10.cs.vu.nl>, maart@cs.vu.nl (Maarten Litmaath) writes: >\> You could always map! tab to ^T: >\> >\> map! ^V^V^I ^V^T >\> >\On every machine I tried this on [...] I get "Missing rhs". > Well, if you are typing this from vi, instead of putting it in your .exrc or EXINIT, you need :map! ^V^V^V^I ^V^V^V^T which works just fine. In you .exrc, you might need instead map! ^V^I ^V^T where ^V means control-V typed as one character, not ^ followed by V. In ex, a ^V means that the next character is to be taken literally. It is like ^V in the BSD "new crt" tty driver, not like System V "\". Now, ex normally skips tabs, so you need to tell it that the tab is special. Thus, you need to precede it with a single ^V. So, in ex, map! ^V^I LHS will make a tab (assuming your tab key sends control-I) send LHS. In vi, however, ^V is also interpreted. When you do a : command from vi, the string you type is read by vi (which strips off ^V, of course), and passed to ex. Hence, you need to type ^V^V to make vi send a ^V. So now we get map! ^V^V^V^I LHS Why three? The third is needed to protect the coontrol-I (TAB) from vi. The same reasoning applies to the Left Hand Side (LHS), ^V^V^V^T. In general, you will always type an ODD number of ^V characters -- almost always one or three. Note that your .exrc is read by ex, not vi (hence the name). In other words, when you start vi, it reads your .exrc in "ex" mode, which is why you only need one ^V there. Finally, if your TAB key does not send control-I, you will need to replace ^I with whatever it *does* send. For example, if it sends escape control-I h your map! line would look like (in ex) :map! ^V^[^V^I ^V^T and in vi :map! ^V^V^V^[^V^V^V^I ^V^V^V^T Hope this clarifies things. Lee -- Liam R. Quin, Unixsys (UK) Ltd [note: not an employee of "sq" - a visitor!] lee@sq.com (Whilst visiting Canada from England) lee@anduk.co.uk (Upon my return to England at Christmas)