Enter the following text in the .vimrc (or /etc/vimrc) file:
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set no
set autoindent
set cindent
Among them: Tabstop: Indicates the length of how many spaces a tab is displayed, the default is 8.
softtabstop: Indicates the length of the indent when pressing the backspace key in edit mode, especially useful when using expandtab.
shiftwidth: Indicates the length of each level of indentation, generally set to the same as softtabstop. When set to expandtab, indentation is represented by spaces; noexpandtab is represented by tabs.
nu: indicates the display line