syntax onTo define the number of stops for tab
set tabstop=4If you want the tabs to be replaces by spaces, which means when you press “Tab” on the keyboard, Vim will enter the number of spaces you defined in the tabstop setting above
set expandtabI personally prefer highlight search rather than incremental search. What highlight search does is highlight all words found, so you have a very clear view of the result. Incremental search will search as you type in the keyword, but no words are highlighted after you hit enter. To set highlight search, use
set hlsearchTo set incremental search, use
set incsearchIf you want the line number appear in the editor, use
set numberUse abbreviation you can define a tag for a long sequence of characters. When you type that tag, vim expands the tag to the text it represents, and therefore save your keystrokes. For example, when I’m writing a PHP class, I need to add comments on top of each function and member attribute, I need to type in
/*** * ***/Of course this long typing is boring. So I want to define an abbreviation such that whenever I type the _comment, it is replaced automatically by that long stuff with PHP comments. That’s what the ab command is for. So I have the following set in my .vimrc file
ab _comment /*** Ctrlv Enter * Ctrlv Enter***/The key point is, to enter special characters such as newline, first push Ctrlv. Be aware that in newer versions of Windows gvim, Ctrlv is mapped to do paste. In that case, to enter a special key, you need to use Ctrlq instead. Those are basic setting in Vim, I will add more advanced settings in the following articles.