How does vim automatically set the number of indented spaces according to the suffix of the file name?

  question, vim

Problem description

Just into the pit VIM, I hope in editing*.phpWhen the file is indented, the space is 4, but when editing*.blade.phpYou want to indent the file with 2 spaces.
At present, the number of spaces has been set according to Filetype, but this setting cannot meet my requirement. . .

seek help

It is hoped that the number of indented spaces can be set by matching the suffix of the file name.To find a configuration or a plug-in. TKS´Ż×

Autocmd has a BufEnter event that can be used to execute commands. You can search according to this idea.

In addition, the character width occupied by tab during indenting can be adjusted by tabstopsoft tabstopand other parameters.

I won’t give you the configuration, or I hope you can learn more about vim, otherwise you will feel lost everywhere during use, and you will abandon the pit immediately.

If you want to learn the use of vim quickly, I recommend you to have a look.Vim practical skillsThis book