Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Tuesday, May 12, 2015

Set auto Indentation , shiftwidth and tab stop in Vim forever !!!

If you are looking for enabling auto indentation and to set tabstop to x characters, you are in right  place.

Open your .vimrc under your "/home/<user>" directory and add below lines
 filetype plugin indent on  
 set tabstop=4  
 set shiftwidth=4  
 set expandtab  
In above settings we have set 4 as tabstop and shiftwidth.
Now open a file with vim and your indentation and tabstop will work as expected.

Saturday, April 11, 2015

How to configure vi/vim for coding C - Indentation and file detection

How do we make vi-Vim not to use tab and use 4 spaces instead ?
How to make it  automatically indent code after curly brace blocks like Emacs does?
How to save these settings so that we never have to input them again?

I've seen other questions very often from vi/vim users.
 
Its pretty simple, add below lines to your .vimrc file under your home directory.

 filetype plugin indent on  
 set tabstop=4  
 set shiftwidth=4  
 set expandtab  

More information under :  filetype