home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!strath-cs!memex!stephen
- From: stephen@memex.co.uk (Stephen Marley)
- Newsgroups: comp.editors
- Subject: Re: VI macro question
- Message-ID: <1992Dec10.163025.2815@memex.co.uk>
- Date: 10 Dec 92 16:30:25 GMT
- References: <1992Dec6.173757.14614@newssun.med.miami.edu>
- Organization: Memex Information Systems Ltd., East Kilbride, Scotland
- Lines: 51
- X-Newsreader: Tin 1.1 PL4
-
- dnelson@newssun.med.miami.edu (Dru Nelson) writes:
-
- :
- : When I tried using the #i macro:
- :
- : map! #i #include <.h>hhha
- : map! /* /* */hhi
- :
- : I always get #include <a.h> if I am in append mode.
- : or #include <li.h> when I am doing an insert in a line.
- : Or an insert at the begining causes this. #include <i.h>
- : When I am in R or Overwrite I get this: #include <lR.h>
- :
- ...
-
- : When I do a :map! I get a :
- :
- : fi #i #include <.h>hhha
- :
- : What is this fi?
-
- The # notation, in this context, is primarily for use in mapping
- function keys where #1 represents function_key 1. If you map!
- something to #1, when you do a map! you will see something like,
-
- f1 ^[OP what_you_mapped_to
-
- where ^[OP is the termcap code for the F1 key for your terminal type
- ($TERM). (This isn't necessarily what your F1 key generates - but
- that's another problem). So when you see 'fi' this behaviour appears
- to be extended to 'function_key i'. I suspect this, and the spurious i's
- or R's are indications of some bug. :-(
-
- The good news though, is that behaviour you desire can be achieved with
- the following macro :-)
-
- map! #i #include <.h>^[hh
-
- This doesn't need an 'a' to append since map! leaves you in the editing mode
- you were in previously. However, the macro above only leaves the
- cursor in the right place when you start in insert (i), open (o), or
- replace (R) mode, but not append (a). This is really quite easy to
- live with, though, since a typical sequence of keystrokes would be:
-
- i#istdio<esc>o#istdlib<esc>o ...
-
- Hope this helps.
- --
- Stephen Marley
- Memex Information Systems Ltd., East Kilbride, G75 0YN, Scotland, UK.
- stephen@memex.co.uk Tel: (03552) 33804 Fax: (03552) 39676
-