To fix this, open a new Terminal window and enter these commands to open vim's configuration file:
cd /usr/share/vim
sudo vim vimrc
Press the "i" key to switch vim to Insertion Mode, then enter these lines below the set backspace=2
line:
set ai " auto indenting