vi provides an autoindent option by setting:
:set ai<ret> |
set autoindent on |
:set noai<ret> |
set autoindent off |
vi default option is noautoindent, a user configuration
file .exrc in user home
1
or working directory may contain the
set command (described in Section 33)
to force automatic indenting.
The current indent can be changed during insert mode, as follows.
spaces tabs |
increase indent to right on new line |
<ctrl>D |
decrease indent to left on new line by shiftwidth |
| or to column 1 whichever occurs first | |
^ followed by <ctrl>D |
type a single line at column 1 without changing |
| current indent value |
If, for some need, it is necessary to transform <tab>s to true
whitespaces, use the expand program to do the job (refer to
expand(1) for more information). exapand syntax at shell
level is:
expand old_file > new_file
expand may be called from vi on a paragraph or any valid vi text
fragment with the following syntax:
!}expand
N.B. expand is not a vi command.