Change 8 spaces identation by default in vim by 4 spaces

To follow PEP-8 standar, for identation (tabs) it's recommended 4 spaces, not 8 as vim uses by default.
To change this value, just add these lines to your vimrc file (usually located in /etc/vim/vimrc).

filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

if for some reason you need disable any command, just put an exclamation sign at the end of the command. For example:

To enable number lines, use: set number
To disable it, use: set number!

Comments

Popular posts from this blog

How to fix Android when developer options are not available for this user

How to install Matlab without GUI

Contiki 3.0 on XM1000