how to setup vim autoindent to 4 spaces
On many Linux systems, like Ubuntu, the .vimrc file doesn't exist by default, so it is recommended that you create it first.
Don't use the .viminfo file that exist in the home directory. It is used for a different purpose.
Step 1: Go to your home directory:
Step 2: Create the file:
Step 3: Add the configuration stated below:
filetype plugin indent on
Step 4: Save file and quit.