home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / editors / 2130 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.9 KB  |  48 lines

  1. Newsgroups: comp.editors
  2. Path: sparky!uunet!unipalm!ian
  3. From: ian@unipalm.co.uk (Ian Phillipps)
  4. Subject: Re: Command line editing in vi - a macro
  5. Message-ID: <1992Sep2.120742.21420@unipalm.co.uk>
  6. Organization: Unipalm Ltd., 216 Cambridge Science Park, Cambridge CB4 4WA, UK
  7. References: <1992Aug12.021145.5902@nuscc.nus.sg> <1992Aug27.052100.1716@ferret.uucp>
  8. Date: Wed, 2 Sep 1992 12:07:42 GMT
  9. Lines: 37
  10.  
  11. stv@ferret.uucp (Steve Manning) writes:
  12.  
  13. >In article <1992Aug12.021145.5902@nuscc.nus.sg> ccechk@nuscc.nus.sg (Heng Kek) writes:
  14. >>            How may I 'recall' the last cmd I entered in vi in such
  15. >>a way that I can edit that command and execute it?  Something like
  16. >>the history command editing in tcsh.
  17.  
  18. >Whenever I find that I'm going to be constructing a long pattern
  19. >such as the one you list, I will take advantage of vi's ability to
  20. >execute the contents of a named buffer as a macro.  Typing the
  21. >AT-symbol ('@') followed by a letter (in command mode, of course)
  22. >will do this.  Of course, this does require you to take steps before-
  23. >hand to do it and so is not "history command editing".
  24.  
  25. I find very useful the mapping:
  26. :map <some key> ms"syy@s`s
  27.  
  28. Which uses buffer "s" and text mark "s". It obeys the current line as a
  29. command, so that if I put a suitable command into the buffer, I can run
  30. it. It returns the cursor to the same place using mark "s" - this is a
  31. luxury item, but very useful if the command reads a file, for example.
  32.  
  33. I've had no troubles with the old or new SunOS vi (the "new" version
  34. announces itself as SVR3.1).
  35.  
  36. I even went through a phase of using "vi" as my normal shell.
  37.  
  38. Example - the ":r!date" was typed in, then the "Insert" key pressed:
  39.  
  40. :r!date
  41. Wed Sep  2 12:58:35 BST 1992
  42.  
  43. Ian
  44. -- 
  45. Ian Phillipps, Unipalm Ltd, 216 Science Park,        Phone +44 223 420002
  46. Milton Road, Cambridge, CB4 4WA, England.        Phax  +44 223 426868
  47.     The road to hell is paved with melting snowballs - Larry Wall
  48.