I have some css code in this format:
a { color: #333; background-color: #fff; }
a:visited { color: #aaa; background-color: #555; }
I want to get it in this format:
a {
color: #333;
background-color: #fff;
}
a:visited {
color: #aaa;
background-color: #555;
}
Is there an easy way to do that? I know I can write a macro to do that, but I was hoping there was a better/easier solution. Ideally, I'd like to be able to select the lines and do something like gq
.
if the filetype has already been set as CSS
, you can try:
:%s/[{;}]/&\r/g|norm! =gg
at least it works for your example:
You can use cssbeautify:
:%! css-beautify --file -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With