To configure VIM to use spaces instead of tabs, you can either execute VIM commands or modify the configuration file.

If you just want to modify a single file, you can execute the following commands inside VIM.

:set tabstop=2
:set shiftwidth=2
:set expandtab

In order to change the global VIM settings you can edit ~/.vimrc file

vim ~/.vimrc
set tabstop=2 shiftwidth=2 expandtab

Once tab settings are configured you can execute :retab at any time inside VIM to apply the new settings to the existing document.

More information is available on the VIM wiki site.