We start by reviewing what we know about tabs, in normal mode, we can press the greater than angle bracket twice to indent right, the less than angle bracket to out-dent (indent left) and that adding a number before pressing the angle bracket to tab indent will in that number of lines including that line you are on and lines below it.
You can also indent using visual mode where you will only need to press the angle bracket one time.
In insert mode, the tab key works like the angle bracket for tabbing right, the backspace key will remove the tab character and out-dent (tab left).
To see the tab characters and end of line characters type colon set list.
You can also insert a tab character (in insert mode) by pressing control+v and u0009 (or control+v control+i)
Then we go into the .vimrc file and add a line to update our tab character and end of line characters.
We make the tab character to be control+v u2192 (an arrow right)
And the end of line character to be control+v u21b2 (an arrow down, and then left)
We look at how to put in spaces instead of the tab character by setting expandtab. Then we look at how to change normal mode tab width by changing the shiftwidth setting. Doing that shows us that the tab character setting is different that the shiftwidth setting and the amount the tab character shifts is controlled by the tabstop setting. We also look at the softtabstop which is used when we press the tab key in insert mode.
expandtab / noexpandtab = insert spaces/insert the tab character
shiftwidth = the amount of space to shift in normal mode
tabstop = The amount of spaces the tab character will fill
Softtabstop = The amount of space to shift in insert mode with the tab key (defaults to same as tabstop)
The first thing we do is change the tab settings back to the default settings, then we check to see if the filetype is turned on and it is, but indent is no on.
We update the .vimrc file to turn on indent and set the tabs to 4 for Perl (.pl) documents.
We see something new here, how to take the line the cursor is on to the top of the screen by pressing "zt"
We see the auto-indent feature works just like the indent feature, only we press equals instead of the angle-bracket
We can see where the auto-indent gets it rules by typeing ":e $VIMRUNTIME/indent"
We can see the indent file used by typing ":scriptnames"
Lastly we auto-indent an entire .css file with the default tab settings after using tab settings of 4 for the Perl script.