I always use tabstop=4 and shiftwidth=4 in vim, but for html file and some other template filetypes i prefer value 2. And I use vim buffers to work with mutiple files. If I switch between html files and other file, I also want the tabstop value to be correct. One way to achieve this goal is just write down tabstop=4 in html syntax file(under syntax folder). But I just wanna keep these changes in my .vimrc. Then I write down

au BufNewFile, BufRead, *.html set tabstop=2
au BufNewFile, BufRead, *.html set shiftwidth=2

Note this also change other files tabstop and shiftwidth value. So I just add two more lines to fix it.

au BufNewFile, BufRead, * set tabstop=4
au BufNewFile, BufRead, * set shiftwidth=4
au BufNewFile, BufRead, *.html set tabstop=2
au BufNewFile, BufRead, *.html set shiftwidth=2

Luckly I just use two kinds of tabstop values :)