VI Tab spacing

I dont like the huge tabs in the C file (or any code file that matter). VI has a nice way to reduce (or show) the tabs with minimum spacing. I’ve configured the VI to show only 2 spaces for a TAB in my .c and .h files. Here is the thing that can be put into .vimrc file in the home directory.

autocmd BufNewFile,BufRead *.h setlocal shiftwidth=2 tabstop=2
autocmd BufNewFile,BufRead *.c setlocal shiftwidth=2 tabstop=2

Sweet!!

Advertisements

2 thoughts on “VI Tab spacing

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