The last time we talked about how to configure tabs/spaces in vim. Recently, many web pages are written. You do not want to replace the tab when editing HTML, and one tab occupies two spaces. You still need to use four spaces when editing other files. Finally, we found this method:
In. vimrc:
Autocmd bufnewfile, bufread *. html, *. htm, *. CSS, *. js set noexpandtab tabstop = 2 shiftwidth = 2
Autocmd is an "Automatic Command" that is automatically executed in the event of certain events, similar to the hook function.
Bufnewfile indicates that when you edit a file that does not exist
When bufread reads an existing file
The following is the file name pattern (separated by,) and the command to be executed. To execute multiple commands, use | to separate them.
Links:
Vim reference: autocmd: http://man.chinaunix.net/newsoft/vi/doc/autocmd.html
Related logs:
Vim tab settings: http://blog.csdn.net/shell_picker/archive/2010/11/24/6033023.aspx