Permalink
Browse files

Some settings for ppreprocessors

  • Loading branch information...
1 parent ab22e76 commit f1fbb99338aa081c3124c3d90526a8e942ae0d90 @kizu kizu committed Jul 28, 2012
Showing with 39 additions and 12 deletions.
  1. +11 −0 Default (OSX).sublime-keymap
  2. +5 −4 Preferences.sublime-settings
  3. +1 −1 Stylus.sublime-settings
  4. +19 −6 add_code_block.py
  5. +1 −1 core
  6. +2 −0 hayaku.py
@@ -42,4 +42,15 @@
"command": "hayaku_add_code_block",
"context": [{"key": "hayaku_add_code_block"}]
}
+
+ // Command prototype for inserting right indent for code block by enter in braces
+ , {
+ "keys": ["enter"],
+ "command": "insert_snippet",
+ "args": {"contents": "\n\t$1\n\t"},
+ "context": [
+ {"key": "preceding_text", "operator": "regex_match", "operand": ".*\\{$" },
+ {"key": "following_text", "operator": "regex_match", "operand": "^\\}" }
+ ]
+ }
]
@@ -9,6 +9,11 @@
, "hayaku_CSS_whitespace_block_end_before": "\n\t"
, "hayaku_CSS_whitespace_block_end_after": ""
+ // Syntax quirks (for preprocessors)
+, "hayaku_CSS_syntax_no_curly_braces": false // Don't print braces for code blocks
+, "hayaku_CSS_syntax_no_semicolons": false // Don't print the semicolon at the end of rule
+, "hayaku_CSS_syntax_no_colons": false // Don't print colon between property and value
+
// Unused settings, work in progress
// Prefixes
@@ -26,8 +31,4 @@
, "hayaku_CSS_default_unit": "px" // `w10` -> `width: 10px`
, "hayaku_CSS_default_unit_decimal": "em" // `w.5` -> `width: 10em`
-, "hayaku_Stylus_no_curly_braces": false // Don't print braces for code blocks
-, "hayaku_Stylus_no_semicolons": false // Don't print the semicolon at the end of rule
-, "hayaku_Stylus_no_colons": false // Don't print colon between property and value
-
}
View
@@ -1,5 +1,5 @@
{
"auto_complete": false
, "hayaku_CSS_whitespace_block_end_before": "\n"
-, "hayaku_CSS_whitespace_block_end_after": "\n"
+, "hayaku_CSS_whitespace_block_end_after": "\n"
}
View
@@ -76,14 +76,27 @@ def run(self, edit):
self.view.sel().clear()
self.view.sel().add(sublime.Region(len(found_insert_position.group(1)) + line.begin(), len(found_insert_position.group(1)) + line.begin()))
+ start_before = self.view.settings().get("hayaku_CSS_whitespace_block_start_before")
+ start_after = self.view.settings().get("hayaku_CSS_whitespace_block_start_after")
+ end_before = self.view.settings().get("hayaku_CSS_whitespace_block_end_before")
+ end_after = self.view.settings().get("hayaku_CSS_whitespace_block_end_after")
+ opening_brace = "{"
+ closing_brace = "}"
+
+ if self.view.settings().get("hayaku_Stylus_no_curly_braces"):
+ opening_brace = ""
+ closing_brace = ""
+ start_before = ""
+ end_before = ""
+
result = ''.join([
- self.view.settings().get("hayaku_CSS_whitespace_block_start_before")
- , "{"
- , self.view.settings().get("hayaku_CSS_whitespace_block_start_after")
+ start_before
+ , opening_brace
+ , start_after
, "$0"
- , self.view.settings().get("hayaku_CSS_whitespace_block_end_before")
- , "}"
- , self.view.settings().get("hayaku_CSS_whitespace_block_end_after")
+ , end_before
+ , closing_brace
+ , end_after
])
else:
# Place a caret + create a new line otherwise
2 core
View
@@ -53,6 +53,8 @@ def run(self, edit):
property_, value, is_num, important = extracted
args = {
'whitespace': self.view.settings().get("hayaku_CSS_whitespace_after_colon"),
+ 'disable_semicolon': self.view.settings().get("hayaku_CSS_syntax_no_semicolons"),
+ 'disable_colon': self.view.settings().get("hayaku_CSS_syntax_no_colons"),
'property_': property_,
'value': value,
'is_num': is_num,

0 comments on commit f1fbb99

Please sign in to comment.