Using vi, how can I make CSS rules into one liners?

后端 未结 7 925
眼角桃花
眼角桃花 2020-12-05 05:55

Example bad:

#main {
      padding:0;
      margin: 10px auto;
}

Example good:

#main {padding:0;margin:10px auto;}
<         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 06:52

    If you are at the beginning or end of the rule, V%J will join it into a single line:

    • Go to the opening (or closing) brace
    • Hit V to enter visual mode
    • Hit % to match the other brace, selecting the whole rule
    • Hit J to join the lines

提交回复
热议问题