Every time I add a selector in CSS and I press Enter to define the properties it ends up like this:
#selector {
property: value;
}
(8-space tabs)
How can I configure Vim to make it like this:
#selector {
property: value;
}
(4-space tabs)
Expanding on zoul’s answer:
If you want to setup Vim to use specific settings when editing a particular filetype, you’ll want to use autocommands:
This will make it so that tabs are displayed as 4 spaces. Setting
expandtabwill cause Vim to actually insert spaces (the number of them being controlled bytabstop) when you press tab; you might want to usesofttabstopto make backspace work properly (that is, reduce indentation when that’s what would happen should tabs be used, rather than always delete one char at a time).To make a fully educated decision as to how to set things up, you’ll need to read Vim docs on
tabstop,shiftwidth,softtabstopandexpandtab. The most interesting bit is found underexpandtab(:help 'expandtab):