Useful vim commands

Even though we have many sophisticated GUI text editors, there is one that has passed all time tests: vi. vi is a text editor created originally for Unix in 1976. Are you kidding? 1976? Why should I even bother to know it exists? Because that is the only text editor you will find for sure in any Unix like command line environment, that includes any Unix flavor, Linux and Macs. Believe me, there are many times when you have no other way to edit files (like webpages, php’s, css’s) but from the command line.

A basic .vimrc configuration file for vim users

.vimrc is the configuration file for vim. Whenever executed, vi will read this file’s contents setting up a customized environment. In order to work, you have to save it in your home directory (~). It is important to notice that the commands should not include the initial colon (:). Here are some useful commands: syntax on syntax highlighing set number show line numbers set ruler show the cursor position all the time set ignorecase ignore case when searching set hlsearch highlight searches set tabstop=4 number of spaces of tab character set shiftwidth=4 number of spaces to (auto)indent set autoindent always set auto indenting on set smartindent smart indent set cindent cindent