What's the canonical vi setting for Python indentation

Quinn Dunkan quinn at amatho.ugcs.caltech.edu
Tue Nov 30 20:29:41 EST 1999


On Wed, 1 Dec 1999 11:17:51 +1100, Malcolm Tredinnick <malcolmt at smart.net.au>
wrote:
>On Tue, Nov 30, 1999 at 11:46:10PM +0000, Sean Blakey wrote:
>> I don't know about canonical, but I have the following in my .vimrc
>> set expandtab	"Turn's tabs into spaces
>> set hardtabs=4	"Make tabs 4 spaces wide
>> set tabstop=4
>> set shiftwidth=4	"For use with << and >>
>
>I tend to avoid 'set expandtab' to save typing. If I want to back out from one
>indentation level to the previous one, it takes a single BackSpace to do so.
>If I am using the 'expandtab' setting, it takes four keystrokes (these things
>matter to me). Of course, I am also using the 'autoindent' setting (but, then
>again, doesn't everybody in vim?).

Note that in vim5, you can set softtabstop=4 to take out expanded tabs with
a single backspace.  Here's my config:

se et ts=8 sw=4 softtabstop=4 smarttab

I like keeping tabs at 8 chars since many other things expect that.
For indentation I use:

se ai
im :<cr>    :<cr><tab>

This mapping also works well for editing natural language, which is a good
example of how intuitive python's indentation rules are :)

>42.7 percent of all statistics are made up on the spot

82.8 percent of those are completely inaccurate.




More information about the Python-list mailing list