Hi,
How can I change the default indent character from TAB to four white spaces
in VIM?
Thanks.
Arthur
|
|
0
|
|
|
|
Reply
|
Wei
|
1/9/2004 3:38:19 AM |
|
On Fri, 9 Jan 2004, Wei Geo wrote:
> How can I change the default indent character from TAB to four white spaces
> in VIM?
Rather than doing that, how about setting tabstops to 4 instead?
(I.e., set ts=4)
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
|
|
0
|
|
|
|
Reply
|
Rich
|
1/9/2004 5:49:50 AM
|
|
"Wei Geo" <weiguo@263.net> wrote in message
news:btl7ms$1d4i$1@mail.cn99.com...
> Hi,
>
> How can I change the default indent character from TAB to four white
spaces
> in VIM?
set sts=4
Should do the trick.
Cheers,
Shaun
|
|
0
|
|
|
|
Reply
|
Shaun
|
1/9/2004 6:14:14 AM
|
|
Rich Teer wrote:
> On Fri, 9 Jan 2004, Wei Geo wrote:
>
>
>>How can I change the default indent character from TAB to four white spaces
>>in VIM?
>
>
> Rather than doing that, how about setting tabstops to 4 instead?
> (I.e., set ts=4)
>
This is a terrible idea because if anyone who hasn't modified their
tabstops, or who has set them to anything other than *your* idea of
what's right, edits the file the formatting will be mangled. Preferences
are private but code is shared. The common (and correctly so) wisdom is
that tabstops are *never* modified. Instead, set shiftwidth=4 and learn
about Ctrl-T (virtual tab forward), Ctrl-D (virtual tab backward), and
>> and <<. This applies to regular vi and all variants, including vim.
The short answer to the OP is "Ctrl-T".
MB
|
|
0
|
|
|
|
Reply
|
Mohun
|
1/9/2004 1:54:10 PM
|
|
On Fri, 09 Jan 2004 13:54:10 GMT, Mohun Biswas <m.biswas@invalid.addr> wrote:
> Rich Teer wrote:
> > On Fri, 9 Jan 2004, Wei Geo wrote:
> >
> >>How can I change the default indent character from TAB to four white spaces
> >>in VIM?
> >
> > Rather than doing that, how about setting tabstops to 4 instead?
> > (I.e., set ts=4)
>
> This is a terrible idea because if anyone who hasn't modified their
> tabstops, or who has set them to anything other than *your* idea of
> what's right, edits the file the formatting will be mangled. Preferences
> are private but code is shared. The common (and correctly so) wisdom is
> that tabstops are *never* modified. Instead, set shiftwidth=4 and learn
> about Ctrl-T (virtual tab forward), Ctrl-D (virtual tab backward), and
> >> and <<. This applies to regular vi and all variants, including vim.
>
> The short answer to the OP is "Ctrl-T".
Another way (vim specific) to do it is to set ts=4, sw=4, and et.
Then text is shifted and aligned on four character boundaries. I
found this helpful when working on shared python scripts where the
others might have put in mixtures of tabs and spaces.
There are two drawbacks to doing it this way. One is diff showing
differences due to tab/space conversion unless given -E and/or -b
is given. The other is the required tab in makefiles, which can
be gotten around either with an autocmd to unset et or by remembering
to type "<ctrl-v>tab" as needed.
Mike
--
Michael Zawrotny
Institute of Molecular Biophysics
Florida State University | email: zawrotny@sb.fsu.edu
Tallahassee, FL 32306-4380 | phone: (850) 644-0069
|
|
0
|
|
|
|
Reply
|
Michael
|
1/9/2004 3:21:39 PM
|
|
>>> Mohun Biswas wrote:
>>>How can I change the default indent character from TAB to four white spaces
>>>in VIM?
MB> This is a terrible idea because if anyone who hasn't modified their
MB> tabstops, or who has set them to anything other than *your* idea of
MB> what's right, edits the file the formatting will be mangled. Preferences
MB> are private but code is shared. The common (and correctly so) wisdom is
MB> that tabstops are *never* modified.
Your sentense is true only for Unix world.
MS Developer Studio has default ts=4. To edit sources developed in it
correctly, one should set appropriate value in vim. (Also ff=dos and
(for our world) enc=cp1251.)
-netch-
|
|
0
|
|
|
|
Reply
|
Valentin
|
1/10/2004 9:15:53 AM
|
|
Valentin Nechayev wrote:
>>>>Mohun Biswas wrote:
>
>
>>>>How can I change the default indent character from TAB to four white spaces
>>>>in VIM?
>
> MB> This is a terrible idea because if anyone who hasn't modified their
> MB> tabstops, or who has set them to anything other than *your* idea of
> MB> what's right, edits the file the formatting will be mangled. Preferences
> MB> are private but code is shared. The common (and correctly so) wisdom is
> MB> that tabstops are *never* modified.
>
> Your sentense is true only for Unix world.
Right, and this is comp.unix.programmer.
|
|
0
|
|
|
|
Reply
|
Mohun
|
1/10/2004 2:23:43 PM
|
|
On Fri, 09 Jan 2004 08:54:10 -0500, Mohun Biswas wrote:
>> Rather than doing that, how about setting tabstops to 4 instead? (I.e.,
>> set ts=4)
>>
> This is a terrible idea because if anyone who hasn't modified their
> tabstops, or who has set them to anything other than *your* idea of
> what's right, edits the file the formatting will be mangled. Preferences
> are private but code is shared. The common (and correctly so) wisdom is
> that tabstops are *never* modified.
I don't understand. If set ts=4 is the same as set tabstop=4 how does
this mangle formatting? Just because a tab is displayed as 4 blank
character positions has no effect on the file. At tab is a tab.
Mike
|
|
0
|
|
|
|
Reply
|
Michael
|
1/11/2004 10:51:24 AM
|
|
|
7 Replies
325 Views
(page loaded in 0.089 seconds)
|