Vim: Spaces instead of tab characters.

Indentation is important in Python code. Period. (This is really a big, emphatic, bright period.)

Python programmers who move their code from machine to machine prefer to use “spaces as tab characters” over “normal tab characters” for indentation in their code. There is a good reason why they do that.

If you code in Vim, like I do, you might have noticed that the default behaviour of the tab character is to insert as many tab characters, when you press the tab key, as are defined in the .vimrc file. If you want to change Vim to insert spaces instead, add the following into your .vimrc file (I am assuming a tab width of 8 characters):


set tabstop=8
set shiftwidth=8
set expandtab

I picked this up from here.

2 Trackbacks

  1. By Space tabs are evil. « Libel on 24 February, 2007 at 6:42 am

    [...] Space tabs are evil. I take back what I said earlier. [...]

  2. [...] Vim: Spaces instead of tab characters. « Libel – Configuring VIM to use spaces instead of tabs. [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*