[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Why is C so popular?



On Mon, 1 Sep 2003 11:02:09 +0200
Anders Arnholm <anders@arnholm.nu> wrote:
> Then why not learn the editor :^) Whan hitting tab MY vim with tabstop
> of eight jumps to the next indention level,

    I suggest you try that again VERRRY carefully.  I just tried it.  Entered
the editor in Python mode
:set shiftwidth=4
if foo:<CR><TAB>

    8 spaces, not 4.  8.

'shiftwidth' 'sw'       number  (default 8)
                        local to buffer
        Number of spaces to use for each step of (auto)indent.  Used for
        |'cindent'|, |>>|, |<<|, etc.

    Since we're not in cindent that doesn't count and since it is easier to
set TS to 4 and whack tab once at a new block I prefer to do that than to slap
space 4 times or hit >>.  Furthermore this is born out in vim's own
documentation of tabstop:

        There are four main ways to use tabs in Vim:
         [SNIP]
         2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
           'expandtab'.  This way you will always insert spaces.  The
           formatting will never be messed up when 'tabstop' is changed.
         [SNIP]

    To get the behavior you describe you have to set tabstop to 4 so that it
will go to the next multiple of 4.  Shiftwidth works on reindenting blocks.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

Attachment: pgpi9VDvhsbIe.pgp
Description: PGP signature


Reply to: