[comp.editors] mapping TAB to spaces in Vi

meyering@cs.utexas.edu (Jim Meyering) (06/28/89)

In Vi's input mode, is it possible to map the TAB
character to a string of space characters?

Jim Meyering      meyering@cs.utexas.edu
-- 
Jim Meyering      meyering@cs.utexas.edu

maart@cs.vu.nl (Maarten Litmaath) (06/29/89)

meyering@cs.utexas.edu (Jim Meyering) writes:
\In Vi's input mode, is it possible to map the TAB
\character to a string of space characters?

	:map! ^V^V^I ^V^V<spaces>

To unmap:

	:unmap! ^V^V^V^I

To remap:

	:map! ^V^V^V^I foobar
-- 
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
   they're small."  (Stephen Savitzky)    |maart@cs.vu.nl, mcvax!botter!maart

mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) (06/29/89)

In article <363@ai.cs.utexas.edu> meyering@cs.utexas.edu (Jim Meyering) writes:
:
:In Vi's input mode, is it possible to map the TAB
:character to a string of space characters?
:
:Jim Meyering      meyering@cs.utexas.edu
:-- 
:Jim Meyering      meyering@cs.utexas.edu

All depends on what system you're running vi.  Under UNIX SYSV,  use
newform command by piping data (using ! operator or :a,b !  ex command
line command) to newform with -i tabspec option.  For instance,  if you
have a file with tabs set at every 4 spaces,  the following character
sequence will retab the whole file:

1G!Gnewform -i-4<CR>

Note that the tabspec sepcifies -4 (minus 4).  If the tabspec said
4,  then only the first tab on the line would be changed,  and then to
move the data to column 5.  Irregular tabs are supported as well.
For example,  to set tabs for an IBM assembler listing<;

1G!Gnewform -i 1,10,16,36,72<CR>

-- 

Dan Mercer
Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)