Using 4-Space tab in most files, a true 8-width tab is used in Makefile, and colleagues are automatically indented based on the type of file.
Edit
Vim ~/.VIMRC
If the file does not exist new, the file already exists, append to the tail
Add to
"This part of the code is executed only when Autocommands is supported."
If has ("Autocmd")
"Use file type checking and file-based automatic tightening
FileType plugin indent on
"tab use length 8 in the makefiles file."
Autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab
endif
"For other cases, use 4-space-width tab
The width of the Set tabstop=4 tab is set to 4 spaces.
"But still is \ t." Just vim interprets it as 4 spaces wide, with another editor or \ t symbol
"Vim would interpret it to being
"A width of 4."
Set shiftwidth=4 the width of 4 spaces.
Set Softtabstop=4 sets the number of columns that tab occupies, set to the width of 4 spaces when you enter tab.
Set Expandtab "Extended tab is a space.
Vim temporarily turns off indent and annotation auto indent settings
Vim automatically indents the code, makes the code a mess, and maybe even because a comment on a line causes all of the subsequent code to be commented out,
Method One
Set Pastetoggle
You can turn off automatic indentation
or set as a shortcut key, the most convenient way is to add a sentence in the. VIMRC:
Set pastetoggle=<f9>
Later in the Insert mode, you can toggle the automatic indentation by pressing the F9 key.
When you need your own handwriting code, enter insert mode, the default is automatically indented.
Method Two
Set paste
Then go into insert mode and paste, the code will not be automatically indented.
When you need to automatically indent the code, you need to change it back:
Set Nopaste