Auto indentation in VIM, version 7.4.52, Operating Sysytem :Ubuntu 14.04
<p>I am new to this programming world, currently I am reading from "Introduction to Computation and programming using Python " by John V Guttag , MIT press.</p>

<p>How can I set the auto indentation on in VIM. What's happening now is that  when I press enter after : it starts from new line.</p>

<p>Is it possible ?</p>

<p>Vim comes with several language indentation presets. To enable them, you need to add the following to Vim's user configuration file (<code>~/.vimrc</code>):</p>

<pre><code>filetype indent plugin on
</code></pre>

<p>An easy way to do this from the terminal:</p>

<pre><code>echo "filetype indent plugin on" &gt;&gt; ~/.vimrc
</code></pre>

<p>This appends the command to your <code>.vimrc</code>, creating it if necessary.</p>

<p>then open up a <code>.py</code> file and define a function.</p>

<p>Note: there are several other settings that can be very helpful to Python programmers and the <a href="http://vim.wikia.com/wiki/Indenting_source_code" rel="nofollow">link</a> from @birryree looks pretty complete.</p>

<p>I also use</p>

<pre><code>set expandtab                     " Use spaces instead of tabs
set shiftwidth=4                  " Number of auto-indent spaces
set softtabstop=4                 " Number of spaces per Tab
</code></pre>

<p>in my <code>.vimrc</code> to follow PEP8.</p>

python vim