home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!bcm!rice!nb.rockwell.com!wade
- From: wade@nb.rockwell.com (Wade Guthrie)
- Newsgroups: comp.unix.questions
- Subject: Re: Dear vi guru,
- Message-ID: <1992Sep3.225858.3772@nb.rockwell.com>
- Date: 3 Sep 1992 22:58:58 GMT
- References: <1992Sep2.224136.24163@nsisrv.gsfc.nasa.gov> <1992Sep2.233330.18751@ncar.ucar.edu> <1992Sep3.163059.10935@uhura1.uucp>
- Sender: wade@nb.rockwell.com (Wade Guthrie)
- Distribution: na
- Organization: Rockwell International
- Lines: 38
-
-
- In article <1992Sep3.163059.10935@uhura1.uucp>, bryan@uhura1.uucp (Bryan Curnutt) writes:
- > In article <1992Sep2.233330.18751@ncar.ucar.edu> tparker@music.scd.ucar.edu (Tom Parker) writes:
- > >In article <1992Sep2.224136.24163@nsisrv.gsfc.nasa.gov> schieb@shark.gsfc.nasa.gov (Brian D. Schieber) writes:
- > >>Dear vi guru,
- > >>
- > >> I like to use tabs alot in just about every session of vi I
- > >>work with, It would be great if I had a macro or whatever that
- > >>could replace the tabs with the appropriate number of spaces
- > >>in a file WHILE in vi. Do you have such a macro?
- > >
- > >Check if your system has the 'expand' command. This command converts
- > >tabs to spaces, and vice versa.
- >
- > ... but is not what Brian asked for.
-
- Well, not true. . .
- The 'vi' user can use 'expand' from within 'vi'. For example, to expand
- tabs to 4 spaces throughout the file, one should do the following.
- 1G
- This will move the pointer to the beginning of the file. Then,
- !Gexpand -4
- Where the '!' says "I wanna do some external command", the 'G' says
- "and I wanna do it from the current location (the top, 'cause of the
- '1G') to the end ('cause 'G' says go to the end)" and the command
- is "expand -4" which does the expansion (check out expand(1)).
-
-
- > If your system does have the 'expand' command, then something like
- >
- > :map g :%!expand -4^M
- >
-
- ya don't need 'map', but this DOES work. . .
-
- Hope this helps.
-
- Wade
-