How to Add Space After a Colon in CSS with Sublime Text 2

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

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... :)

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

I did some more digging and would like to suggest an alternate solution.

  1. Open ~/Library/Application Support/Sublime Text 2/Packages/CSS/css_completions.py in Sublime.

  2. On line 190, remove the space after the colon:

    l.append((p, p + ": "))

The only caveat I can think of is that this might get overwritten when you update Sublime, but this seemed to work great without installing an extra package.

Fix a CSS file: space after colon on rules but not selectors (Sublime Text 2)

Why creating a regular expression would work very well. I think the easiest and quickest way would be to simple use your IDE's find and replace to add a space after each colon and then use find and replace again to remove the space from your pseudo classes. Since there are probably only around 8 different pseudo classes used it shouldn't take to long to prform a find a replace on each.

How to remove space after a colon in CSS with Sublime Text 3?

First off, let me say that I'm against this for readability reasons - if you want to minify your CSS, there are plenty of tools available to do that within Sublime. That being said, there is a way to do it, but it requires some effort. First, make sure you have Package Control installed. Next, we'll need to extract a file from a .sublime-package file, so install the PackageResourceViewer plugin. To do that, once you have Package Control installed and have restarted Sublime, open the Command Palette with CtrlShiftP (ShiftP on OS X) and type pci into the prompt to bring up the Package Control: Install Package option. Hit Enter, wait for the repositories to load, then type packresview to bring up the PackageResourceViewer option. Hit Enter again, and wait for it to install.

Next, open the Command Palette again, and type prv to bring up the PackageResourceViewer options, then select PackageResourceViewer: Open Resource. Scroll down to CSS, hit Enter, then scroll down to css_completions.py and hit Enter again to open it. You can ignore 99% of the file, just scroll down to line 190, which looks like this:

                l.append((p, p + ": "))

Just delete the space after the colon : like so:

                l.append((p, p + ":"))

save the file, and you should be all set. You may want to restart Sublime (and reopen all your CSS files) for the full changes to take effect.

Ensure exactly one space after each colon in CSS in Netbeans

Try this search

([a-zA-Z0-9]:)([a-zA-Z0-9#])

And replace it with

$1 $2

How can I modify CSS color sets in Sublime Text 2?

Not sure about the color attribute and value yet, but for the css spacing I may have an answer. Go to C:\Users\<username>\AppData\Roaming\Sublime Text 2\Packages\CSS\css_completions.py Line 190. Change l.append((p, p + ": ")) to l.append((p, p + ":"))



Related Topics



Leave a reply



Submit