Vim: Converting tabs to spaces

On machines running linux you can create a file named .vimrc in your home directory.  This file will be parsed for configuration parameters when you open vim.

To edit this file, or create it if it doesn’t exist, open a terminal and type

  vim ~/.vimrc

And add the following lines to your .vimrc file.  Replace the size of the tabstop and shiftwidth as you see neccesary.  The number represents the number of spaces per tab character.

:set tabstop=4

:set shiftwidth=4

:set expandtabs

Advertisements