vim is great :)

1. First subtitle all tabs to 4 spaces in a file by type `:%s/\t/    /g` inside vim.  (note right side is 4 spaces)

2. My configuration for the vim. 
```
set expandtab   " When you type a tab, insert the appropriate number of spaces instead.
set tabstop=2   " Number of spaces that a <Tab> in the file counts for. I like to use 2 spaces, you may change it to 4.
set shiftwidth=2  " Number of spaces to use for  when you type  >> and <<. like the above you may change it to 4.
set smarttab " When on, a <Tab> in front of a line inserts blanks according to  'shiftwidth'.
```

put them into

- `~/.vimrc`  affect globally
- or `~/.vim/ftplugin/javascript.vim`  only affect specific type. in our case, only .js files.