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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s