VIM to set php auto indent to 4 Spaces

  • 2020-06-12 08:46:54
  • OfStack

vim, a text editor, is a necessary part of the code. The automatic indentation is using tabs. Even if you delete the tabs and change them to four Spaces, you will continue to use tabs in the next level of indentation

Can modify, etc/vimrc information:

The meaning of relevant variables:
Abbreviation meaning of variable name
(no)autoindent ai automatically indents, that is, a new line is automatically added with the same indent as the current line.
cindent ci is similar to the indenting of C language programs
smartindent si is based on 1 improvement of autoindent

Abbreviation meaning of variable name
tabstop=X ts How much space does 1 TAB character occupy in editing?
shiftwidth=X sw USES the number of Spaces per layer indent.
Whether the input from TAB is automatically expanded into Spaces. To enter TAB after opening, Ctrl-ES41en is required < TAB >
softtabstop=X sts is convenient to use the backspace (backspace) key after et is turned on. Each backspace will delete X Spaces
When sta is turned on, press TAB at the beginning of the line to add sw Spaces, otherwise add ts Spaces.

Related articles: