Let's say this code:
- Code: Select all
.test {
color:#000;
text-decoration:none;
background:red;
}
After I press a key combination will become
- Code: Select all
.test {color:#000; text-decoration:none; background:red; }
I know about ctrl+j command, but that will work only one way. Ok, so the code from E is this:
- Code: Select all
#!/usr/bin/env ruby
if ENV['TM_SOFT_TABS'] == 'NO'
tab = "\t"
else
tab = " " * ENV['TM_TAB_SIZE'].to_i
end
print case str = STDIN.read
# Expand
when /\A\{(.*)\}\z/
"{\n#{tab}" + $1.strip.gsub("; ", ";\n#{tab}") + "\n}"
# Collapse
when /\A\{(.*)\}\z/m
("{" + $1.gsub("\n", " ") + "}").gsub(/\s{2,}/, " ")
# Default case
else str
end
My ruby and py skills are zero, so I don't even know where to start. However, i did this:
- Code: Select all
import sublime, sublime_plugin, re
class ToggleSingleLineCommand(sublime_plugin.TextCommand):
def run(self, edit):
Which is... all I know how to do it
Can i get some hints/help/solution?
Thanks!
