home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10711 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  1.9 KB

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!bcm!rice!nb.rockwell.com!wade
  2. From: wade@nb.rockwell.com (Wade Guthrie)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Dear vi guru,
  5. Message-ID: <1992Sep3.225858.3772@nb.rockwell.com>
  6. Date: 3 Sep 1992 22:58:58 GMT
  7. References: <1992Sep2.224136.24163@nsisrv.gsfc.nasa.gov> <1992Sep2.233330.18751@ncar.ucar.edu> <1992Sep3.163059.10935@uhura1.uucp>
  8. Sender: wade@nb.rockwell.com (Wade Guthrie)
  9. Distribution: na
  10. Organization: Rockwell International
  11. Lines: 38
  12.  
  13.  
  14. In article <1992Sep3.163059.10935@uhura1.uucp>, bryan@uhura1.uucp (Bryan Curnutt) writes:
  15. > In article <1992Sep2.233330.18751@ncar.ucar.edu> tparker@music.scd.ucar.edu (Tom Parker) writes:
  16. > >In article <1992Sep2.224136.24163@nsisrv.gsfc.nasa.gov> schieb@shark.gsfc.nasa.gov (Brian D. Schieber) writes:
  17. > >>Dear vi guru,
  18. > >> 
  19. > >> I like to use tabs alot in just about every session of vi I
  20. > >>work with, It would be great if I had a macro or whatever that
  21. > >>could replace the tabs with the appropriate number of spaces
  22. > >>in a file WHILE in vi. Do you have such a macro?
  23. > >
  24. > >Check if your system has the 'expand' command.  This command converts
  25. > >tabs to spaces, and vice versa.
  26. > ... but is not what Brian asked for.
  27.  
  28. Well, not true. . .
  29. The 'vi' user can use 'expand' from within 'vi'.  For example, to expand
  30. tabs to 4 spaces throughout the file, one should do the following.
  31.     1G
  32. This will move the pointer to the beginning of the file.  Then,
  33.     !Gexpand -4
  34. Where the '!' says "I wanna do some external command", the 'G' says
  35. "and I wanna do it from the current location (the top, 'cause of the
  36. '1G') to the end ('cause 'G' says go to the end)" and the command
  37. is "expand -4" which does the expansion (check out expand(1)).
  38.  
  39.  
  40. > If your system does have the 'expand' command, then something like
  41. >     :map g :%!expand -4^M
  42.  
  43. ya don't need 'map', but this DOES work. . .
  44.  
  45. Hope this helps.
  46.  
  47. Wade
  48.