<p>I've trouble setting up Vim (7.1.xxx) for editing Python files (*.py).
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/ 
Please help.</p>

[{'answer_id': 65122, 'author': 'Daren Thomas', 'author_id': 2260, 'author_profile': 'https://Stackoverflow.com/users/2260', 'pm_score': 6, 'selected': False, 'text': '<p>I use this on my macbook:</p>\n\n<pre><code>" configure expanding of tabs for various file types\nau BufRead,BufNewFile *.py set expandtab\nau BufRead,BufNewFile *.c set expandtab\nau BufRead,BufNewFile *.h set expandtab\nau BufRead,BufNewFile Makefile* set noexpandtab\n\n" --------------------------------------------------------------------------------\n" configure editor with tabs and nice stuff...\n" --------------------------------------------------------------------------------\nset expandtab           " enter spaces when tab is pressed\nset textwidth=120       " break lines when line length increases\nset tabstop=4           " use 4 spaces to represent tab\nset softtabstop=4\nset shiftwidth=4        " number of spaces to use for auto indent\nset autoindent          " copy indent from current line when starting a new line\n\n" make backspaces more powerfull\nset backspace=indent,eol,start\n\nset ruler                           " show line and column number\nsyntax on               " syntax highlighting\nset showcmd             " show (partial) command in status line\n</code></pre>\n\n<p>(edited to only show stuff related to indent / tabs)</p>\n'}, {'answer_id': 66818, 'author': 'Jamie', 'author_id': 3363, 'author_profile': 'https://Stackoverflow.com/users/3363', 'pm_score': 2, 'selected': False, 'text': '<p>Ensure you are editing the correct configuration file for VIM. Especially if you are using windows, where the file could be named _vimrc instead of .vimrc as on other platforms.</p>\n\n<p>In vim type</p>\n\n<p><code>:help vimrc</code></p>\n\n<p>and check your path to the _vimrc/.vimrc file with</p>\n\n<p><code>:echo $HOME</code></p>\n\n<p><code>:echo $VIM</code></p>\n\n<p>Make sure you are only using one file. If you want to split your configuration into smaller chunks you can source other files from inside your _vimrc file.</p>\n\n<p><code>:help source</code></p>\n'}, {'answer_id': 68002, 'author': 'Gabor', 'author_id': 10485, 'author_profile': 'https://Stackoverflow.com/users/10485', 'pm_score': 0, 'selected': False, 'text': '<p>for more advanced python editing consider installing the <a href="http://eigenclass.org/hiki/simplefold" rel="nofollow noreferrer">simplefold</a> vim plugin. it allows you do advanced code folding using regular expressions. i use it to fold my class and method definitions for faster editing.</p>\n'}, {'answer_id': 1868984, 'author': 'Skylar Saveland', 'author_id': 177293, 'author_profile': 'https://Stackoverflow.com/users/177293', 'pm_score': 3, 'selected': False, 'text': '<p>I use the vimrc in the python repo among other things:</p>\n\n<p><a href="http://svn.python.org/projects/python/trunk/Misc/Vim/vimrc" rel="nofollow noreferrer">http://svn.python.org/projects/python/trunk/Misc/Vim/vimrc</a></p>\n\n<p>I also add</p>\n\n<pre><code>set softtabstop=4\n</code></pre>\n\n<p><a href="http://github.com/skyl/vim-config-python-ide" rel="nofollow noreferrer">I have my old config here that I\'m updating</a></p>\n'}, {'answer_id': 11830841, 'author': 'thanos', 'author_id': 244849, 'author_profile': 'https://Stackoverflow.com/users/244849', 'pm_score': 4, 'selected': False, 'text': "<p>I use:</p>\n\n<pre><code>$ cat ~/.vimrc\nsyntax on\nset showmatch\nset ts=4\nset sts=4\nset sw=4\nset autoindent\nset smartindent\nset smarttab\nset expandtab\nset number\n</code></pre>\n\n<p>But but I'm going to try Daren's entries</p>\n"}, {'answer_id': 44339554, 'author': 'Teddy Belay', 'author_id': 4325298, 'author_profile': 'https://Stackoverflow.com/users/4325298', 'pm_score': 4, 'selected': False, 'text': '<p>A simpler option: just uncomment the following part of the configuration (which is originally commented out) in the /etc/vim/vimrc file:</p>\n\n<pre><code>    if has("autocmd")\n      filetype plugin indent on\n    endif\n</code></pre>\n'}, {'answer_id': 60205582, 'author': 'Flávio Brito', 'author_id': 6580920, 'author_profile': 'https://Stackoverflow.com/users/6580920', 'pm_score': 1, 'selected': False, 'text': '<p>Combining the solutions proposed by Daren and Thanos we have a good .vimrc file. </p>\n\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>-----\r\n" configure expanding of tabs for various file types\r\nau BufRead,BufNewFile *.py set expandtab\r\nau BufRead,BufNewFile *.c set noexpandtab\r\nau BufRead,BufNewFile *.h set noexpandtab\r\nau BufRead,BufNewFile Makefile* set noexpandtab\r\n\r\n" --------------------------------------------------------------------------------\r\n" configure editor with tabs and nice stuff...\r\n" --------------------------------------------------------------------------------\r\nset expandtab           " enter spaces when tab is pressed\r\nset textwidth=120       " break lines when line length increases\r\nset tabstop=4           " use 4 spaces to represent tab\r\nset softtabstop=4\r\nset shiftwidth=4        " number of spaces to use for auto indent\r\nset autoindent          " copy indent from current line when starting a new line\r\nset smartindent\r\nset smarttab\r\nset expandtab\r\nset number\r\n\r\n" make backspaces more powerfull\r\nset backspace=indent,eol,start\r\n\r\nset ruler                           " show line and column number\r\nsyntax on               " syntax highlighting\r\nset showcmd             " show (partial) command in status line</code></pre>\r\n</div>\r\n</div>\r\n</p>\n'}]
['https://Stackoverflow.com/questions/65076', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9099/']