Permanently convert tabs to spaces in vi / vim

Create a file in your home directory called .vimrc, and put your commands in there:

set tabstop=4
set shiftwidth=4
set expandtab

Ubuntu's Vim Howto has a few pointers to basic customisation, if you want to dig deeper there's the Vim Book and the FAQ as well.

vi-improved.org also has a nice, big example of one person's .vimrc for you to rummage around in.


Store

set tabstop=4
set shiftwidth=4
set expandtab

or

set ts=4 sw=4 
set expandtab

In your ~/.vimrc file. E.G. /home/user/.vimrc or /home/$(whoami)/.vimrc. You can use your other settings in .vimrc as well, the ones you regularly use, for example syntax on if you use the full version of VIM.