Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add space after a colon in CSS with Sublime Text 2?

When working in CSS (or SCSS/SASS files) with Sublime Text 2, I'd like to automatically add a space after the colon. How can I do that?

What it currently does:

body {
   color:red;
}

What I want:

body {
   color: red;
}
like image 959
Shpigford Avatar asked Jun 07 '12 12:06

Shpigford


People also ask

How do you put a space after a colon in HTML?

If you find yourself in html needing a space you can always insert   In your situation you can add a space, but only one. Additional spaces are ignored.

Can CSS be used in Sublime Text?

4.0. Sublime Text contains a custom HTML and CSS engine, named minihtml, for displaying stylized content in editor panes. HTML content can be displayed in both popup windows and phantoms. minihtml provides a limited subset of HTML and CSS features found in most web browsers.


1 Answers

Add this line:

{ "keys": [":"], "command": "insert", "args": {"characters": ": "}}

To your .config/sublime-text-2/Packages/User/Default (Linux).sublime-keymap (in menus: Preferences>Key bindings User) File. Now everytime you press :, :and a space will appear... :)

like image 95
fraxel Avatar answered Sep 16 '22 22:09

fraxel