🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #2693

Re: Question on tab stops in vi

#2693
From: Hans Mulder
Date: Thu, 23 May 1991 18:18
53 lines
2504 bytes
In <163509@felix.UUCP> asylvain@felix.UUCP (Alvin "the Chipmunk" Sylvain) writes:
>Written in article <1991May09.190644.13627@Kesa.COM>
>    by jerry@Kesa.COM (Jerry E. Dunmire):
>>    Is there a way to get a 4 space indent in vi without changing tab stops?
>> 
>>    I've tried re-mapping the tab key, but without any luck.

>This is going to kill you, until you get used to it, but this is at
>least one solution that will work.

>What you want is a shift-width of 4.  (:set sw=4)

Yes.

>Then, when entering your input, instead of hitting "tab", you hit
>Control-T (^T).

>No, I'm sorry, you can _not_ map the "tab" into ^T.  I've tried, and it 
>won't work.  Depending on your terminal, you may be able to map some 
>other key into it, eg., if it's located conveniently, map F3 or some 
>such.  But tab?  No way.  It may be possible, but I doubt it.  

Try quoting it with the correct number of control-V's:

" set tabstop to 4 spaces:
:set shiftwidth=4
:map! ^V	 ^T
" That's control-V tab space control-T
" It's entered as control-V control-V tab space control-V control-T

>*MY* problem is that vi automagically replaces every 8 spaces with a
>_real_ hardtab (^I), which, at least for posting to the net, I'd like 
>to be able to turn off.  So far, if I use indents for anything, I 
>double-check at the end with (:%s/^I/        /g).

Why don't you use G!1Gexpand^M  ?  That has the advantage of doing the
right thing when you have a tab in the middle of a line.

>Does anybody know how to turn _this_ "feature" off?

No.  The closest I have gotten is :set tabstop=99
This works if you don't ever want a tab in your file and your lines are
never indented that far.


Btw, I tend to use the long names of the variables (shiftwidth, tabstop)
in my .exrc file, so I can remember which is which when I look at it
again 3 months later.  I use the shortforms (sw, ts) interactively.

--
Have nice day,

Hans Mulder	hansm@cs.kun.nl
Technical Details
Message-ID: <3571@wn1.sci.kun.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm
References: <1991May09.190644.13627@Kesa.COM> <163509@felix.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm
From: hansm@cs.kun.nl (Hans Mulder)
Newsgroups: comp.editors
Subject: Re: Question on tab stops in vi
Keywords: vi tabs
Message-ID: <3571@wn1.sci.kun.nl>
Date: 23 May 91 18:18:52 GMT
References: <1991May09.190644.13627@Kesa.COM> <163509@felix.UUCP>
Sender: root@sci.kun.nl
Distribution: comp
Organization: University of Nijmegen, The Netherlands
Lines: 53