I usually work on js files and php files. My js files require 2 spaces tab, whereas my php requires 4. How can I make vim dynamically change that depending on the file type I'm working on?
Putting these in your
.vimrc should do the trick:
You should also use expandtab to convert tabs into spaces, I think. Also, you might wanna check out this blogpost.
Also, if you don't mind splitting up your vimrc in modular files, you can put the following commands in
setlocal tabstop = softtabstop = shiftwidth = 2