Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 102010
 

How to expand tab into spaces in vi / vim

Answer:

It is always good to use spaces instead of tab when editing program's source code.

In you ~/.vimrc, add the following lines

: set expandtab
: set shiftwidth=4
: set softtabstop=4
: set tabstop=4

Only expandtab is needed in fact, but most opensource projects tend to maintain a consistency of 4-spaces-indent, follow it anyway.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>