Hey there, I've been spending a lot of time working with CSS recently, and I have to admit that constantly typing "px" after every width, height, margin, etc., is starting to get on my nerves.
I find myself refining pixel values in Firebug quite often, which means I end up having to go back and retype the values in the original document.
It would be amazing if entering something like "125px" could function similar to inputting "120%", where double-clicking only selects the number portion. Unfortunately, as far as I know, this isn't possible.
(Please, someone correct me if I'm wrong)!
So, I've been experimenting with creating a snippet that can be triggered within the CSS code scope. This snippet would allow me to simply type the value and then press "Tab" to automatically add the "px" part for me.
In the Bundle Editor, the "Activation" field should look something like:
[Tab trigger] \d or [0-9] (regex for "any number")
and the "Scope selector" should include all or some combination of the following:
source.css meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.css
As you may have guessed, my initial attempt didn't produce the desired results. (When hitting "Tab", it just inserts a tab (\t))
So, my question remains: Can a snippet be tab-triggered by a regex, or is there an alternative approach that I'm overlooking?
Thanks in advance!
Take care,
ale