change tab to 4 spaces vim code example
Example 1: vim replace tabs with spaces
" Vi:
" To replace tabs with spaces whilst typing
set tabstop=4 shiftwidth=4 expandtab
Example 2: linux vim set tab to 4 spaces
set ts=4 sw=4
Example 3: how to enable 4 space tab on vim
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4.
set softtabstop=4 " Sets the number of columns for a TAB.
set expandtab " Expand TABs to spaces.
filetype plugin indent on " Use filetype detection and file-based automatic indenting.
Source: Stackoverflow.com
Author: Shervin Emami.
Example 4: linux vim set tab to 4 spaces
syntax enable