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.
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.
Is it possible ?
Vim comes with several language indentation presets. To enable them, you need to add the following to Vim's user configuration file (
filetype indent plugin on
An easy way to do this from the terminal:
echo "filetype indent plugin on" >> ~/.vimrc
This appends the command to your
.vimrc, creating it if necessary.
then open up a
.py file and define a function.
Note: there are several other settings that can be very helpful to Python programmers and the link from @birryree looks pretty complete.
I also use
set expandtab " Use spaces instead of tabs
set shiftwidth=4 " Number of auto-indent spaces
set softtabstop=4 " Number of spaces per Tab
.vimrc to follow PEP8.