tabs in vi

Istvan Mohos istvan at hhb.UUCP
Thu Aug 24 07:47:28 AEST 1989


landay at ardent.com (James A. Landay) writes:
>Is there a way to make it so that when ever I hit the TAB key
>in 'vi' that I get 4 spaces rather than an actual tab?  I would
>rather not have to run expand after running vi, as I would only
>want to do that if I actually changed the file.

Assuming that you are interested in this transform only while in
insert mode, you have two choices:

Interactive mapping:
   hit single character______________ :    (to get to the command line)
   type four characters______________ map!
   hit the following sequence of keys
control-V
control-V
tab
space
control-V
control-V
space
space
space
space
return

OR,
adding the mapping by editing EXINIT under vi
(in BSD .cshrc file; sysV syntax is slightly different):

setenv EXINIT 'set <other_options_here>|map\!<mapstring>'
   <mapstring> is entered as the following sequence of bytes:
control-V
control-V
tab
space
control-V
control-V
space
space
space
space

-- 
        Istvan Mohos
        {ihnp4,decvax,allegra}!philabs!hhb!istvan
        HHB Systems 1000 Wyckoff Ave. Mahwah NJ 07430 201-848-8000
====================================================================



More information about the Comp.unix.questions mailing list