On UNIX, Linux & MacOS only Type the following to change the current directory to Home directory: cd $HOME Edit the file “.vimrc” by typing: vi .vimrc
Add the following lines at the end of the existing text.
syntax on
set number
If the file “.vimrc” does not exist, go to /usr/share/vim/ Copy the text of the file “vimrc” and paste it in a new file in $USER/.vimrc and add the above mentioned lines.
The final script would look similar to this:
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
let skip_defaults_vim=1
" Following lines are written by me
" The following line will switch ON Syntax Highlighting and Line Numbers.
syntax on
set number
Here is a screenshot:

Other Default Settings: set tabstop=2 Will set 2 spaces to a tab. set autoindent Automatically indents all the new lines.
Credit: Ilmo Euro
Comments