Commits

Nicholas Dudfield committed 056dd97

Disabled by default the auto insertion of id="" on pressing `#` and class="" on `.` A file type setting `auto_id_class` if true will restore the old behaviour.

Comments (0)

Files changed (5)

Default (Linux).sublime-keymap

       "operator": "equal",
       "match_all": true,
       "key": "selector"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operand":   "text.html meta.tag -string -punctuation.definition.tag.begin.html -meta.scope.between-tag-pair.html -source -meta.tag.template.value.twig",
       "operator": "equal",
       "match_all": true
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
-
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {

Default (OSX).sublime-keymap

       "operator": "equal",
       "match_all": true,
       "key": "selector"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operand":   "text.html meta.tag -string -punctuation.definition.tag.begin.html -meta.scope.between-tag-pair.html -source -meta.tag.template.value.twig",
       "operator": "equal",
       "match_all": true
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
-
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {

Default (Windows).sublime-keymap

       "operator": "equal",
       "match_all": true,
       "key": "selector"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operand":   "text.html meta.tag -string -punctuation.definition.tag.begin.html -meta.scope.between-tag-pair.html -source -meta.tag.template.value.twig",
       "operator": "equal",
       "match_all": true
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {
       "operator": "regex_contains",
       "match_all": true,
       "key": "preceding_text"
-    }
-
+    },
+    {"operand": true, "operator": "equal", "key": "setting.auto_id_class"}
   ]
 },
 {

sublimezenplugin.py

 #################################### IMPORTS ###################################
 
 # Std Libs
-# import operator
+import operator
 
 # Sublime Libs
 import sublime
 zen_settings = sublime.load_settings('zen-coding.sublime-settings')
 
 
-# OPMAP = {
-#     sublime.OP_EQUAL     : operator.eq,
-#     sublime.OP_NOT_EQUAL : operator.ne,
-# }
+OPMAP = {
+    sublime.OP_EQUAL     : operator.eq,
+    sublime.OP_NOT_EQUAL : operator.ne,
+}
 
-# def eval_op(op, operand, operand2):
-#     return OPMAP[op](operand, operand2)
+def eval_op(op, operand, operand2):
+    return OPMAP[op](operand, operand2)
 
-# class ZenSettings(sublime_plugin.EventListener):
-#     def on_query_context(self, view, key, op, operand, match_all):
-#         if key.startswith('zen_setting'):
-#             return eval_op(op, operand, zen_settings.get(key.split('.')[1]))
+class ZenSettings(sublime_plugin.EventListener):
+    def on_query_context(self, view, key, op, operand, match_all):
+        if key.startswith('zen_setting'):
+            return eval_op(op, operand, zen_settings.get(key.split('.')[1]))
 
 ##################################### TODO #####################################
 """

zen-coding.sublime-settings

 {
+    // Copy any modified settings to `User/zen-coding.sublime-settings`
+    // otherwise modifications will not survive updates.
+
     // Will sublime.log_commands(True) and output Zen Specific debug info
     "debug" : false,
 
-    // For those who just want `zen as you type`
-    "disable_completions": false,
-
-    // contextual completions that aren't part of `zen proper`
+    // Disable specific contextual completions that aren't part of `zen proper`
     "completions_blacklist": [
         // "css_selectors",
         // "css_property_values",
         // "css_properties"
     ],
 
+    // For those who just want `zen as you type`, disable completions entirely
+    "disable_completions": false,
+
+    // These are `file type` settings and must be copied to
+    //  `User/Base File.sublime-settings`
+    //      or a syntax specific 1
+    //  `User/HTML.sublime-settings`
+    "File Settings" : {
+        // If `true` will disable ctrl+alt+n binding
+        "alt_gr"        : false,
+        // If `true` will insert id="$1" snippet on pressing '#', similar on '.'
+        // Useful for `raw html`, but annoying for some templating langs.
+        "auto_id_class" : false
+    },
+
+    // my_zen_settings declared here will be reloaded without starting Sublime
     "my_zen_settings" : {
         "html": {
             "abbreviations": {