Home > Article > Backend Development > Detailed explanation of how to set PHP automatic indentation to 4 spaces in VIM_PHP Tutorial
The code is naturally indispensable for the text editing tool vim. Automatic indentation uses tab characters. Even if you delete the tab characters and change it to 4 spaces, the tab characters will continue to be used in the next level of indentation, which results in spaces. Mixing
with tab characters can modify the etc/vimrc information:
The meaning of the relevant variables:
Variable name Abbreviation Meaning
(no)autoindent ai Automatic indentation, that is New lines automatically add the same indent as the current line.
(no)cindent ci Similar to the indentation of C language programs
(no)smartindent si Some improvements based on autoindent
Variable name Abbreviation Meaning
tabstop=X ts How many spaces does a TAB character occupy during editing.
shiftwidth=X sw Use the number of spaces per level of indentation.
(no)expandtab (no)et Whether to automatically expand the input TAB into spaces. To enter TAB after opening, you need Ctrl-V
softtabstop=X sts It is convenient to use backspace after opening et. key, each backspace will delete X spaces
(no)smarttab sw spaces, otherwise add ts spaces.