Vim Tab To Space

How to change tabs to space with vim?

Temporarily

:set tabstop=3
:set expandtab

Note: This doesn't change the existing tab to space characters.
If you want to change all tabs to spaces in the whole file use :retab
after you set :set expandtab.

:retab

Note: Works perfect for python source

Permanently

Add the above definitions to the .vimrc file.

vi ~/.vimrc

More infos:
http://www.vim.org/tips/tip.php?tip_id=12

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License