everybody has their own distinct style of using the editor of their choice. when i am using vim, i prefer to have the following defined in the .vimrc file in the root directory of my user on gnu linux/mac os.
use .virc to save your vi settings if you prefer using the plain old vi instead.
if you’re using a mac os, and would like to configure a .vimrc file which can be used globally for all users, then you would want to store it in this location – /usr/share/vim
these are the contents of my .vimrc file
set number syntax on filetype indent on set list set textwidth=79 " lines longer than 79 columns will be broken set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns set tabstop=4 " a hard TAB displays as 4 columns set expandtab " insert spaces when hitting TABs set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE set shiftround " round indent to multiple of 'shiftwidth' set autoindent " align the new line indent with the previous line set backspace=indent,eol,start " fixes the delete issue on Mac