From d7252615a25a6b26d74a37584a3dae7b9bab9b7a Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 4 Jun 2012 18:18:12 -0700 Subject: [PATCH] Fixes #45 - Single-asterisk block comments are automatically closed. An asterisk at the start of one of these lines will be aligned nicely --- Default.sublime-keymap | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Default.sublime-keymap b/Default.sublime-keymap index 29a872b..e0ed8a8 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -33,7 +33,7 @@ { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*(\\*\\s*).*$/$1/}"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true }, - { "key": "selector", "operator" : "equal", "operand" : "comment.block", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.block", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\*\\s*\\S", "match_all": true } ] @@ -41,7 +41,7 @@ { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*(\\*\\s*).*$/$1/}"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true }, - { "key": "selector", "operator" : "equal", "operand" : "comment.block", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.block", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, { "key": "setting.trim_automatic_white_space", "operator": "equal", "operand": false }, { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\*", "match_all": true } @@ -50,7 +50,7 @@ { "keys": ["enter"], "command": "jsdocs_trim_auto_whitespace", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true }, - { "key": "selector", "operator" : "equal", "operand" : "comment.block", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.block", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, { "key": "setting.trim_automatic_white_space", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\*\\s*$", "match_all": true } @@ -60,9 +60,21 @@ [ { "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true }, { "key": "setting.jsdocs_extend_double_slash", "operator": "equal", "operand": true, "match_all": true}, - { "key": "selector", "operator" : "equal", "operand" : "comment.line.double-slash", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.line.double-slash", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, - { "key": "preceding_text", "operator" : "regex_contains", "operand": "^\\s*\\/\\/", "match_all": true} + { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\/\\/", "match_all": true} + ] + }, + { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n$0\n */"}, "context": + [ + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true}, + { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\/\\*$", "match_all": true} + ] + }, + { "keys": ["*"], "command": "insert_snippet", "args": {"contents": " *"}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "comment.block", "match_all": true}, + { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*$", "match_all": true} ] }, { "keys": ["enter"], "command": "jsdocs_deindent", "context": @@ -88,7 +100,7 @@ { "keys": ["keypad_enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*(\\*\\s*).*$/$1/}"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, - { "key": "selector", "operator" : "equal", "operand" : "comment.block", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.block", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\*", "match_all": true } ] @@ -97,16 +109,16 @@ [ { "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true }, { "key": "setting.jsdocs_extend_double_slash", "operator": "equal", "operand": true, "match_all": true}, - { "key": "selector", "operator" : "equal", "operand" : "comment.line.double-slash", "match_all": true}, + { "key": "selector", "operator": "equal", "operand" : "comment.line.double-slash", "match_all": true}, { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true }, - { "key": "preceding_text", "operator" : "regex_contains", "operand": "^\\s*\\/\\/", "match_all": true} + { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\/\\/", "match_all": true} ] }, { "keys": ["@"], "command": "run_macro_file", "args": {"file": "Packages/DocBlockr/jsdocs-auto-complete.sublime-macro"}, "context": [ { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(?:\\*|\\/\\*{2})\\s*$", "match_all": true }, - { "key": "selector", "operator" : "equal", "operand" : "comment.block", "match_all": true} + { "key": "selector", "operator": "equal", "operand" : "comment.block", "match_all": true} ] }, { "keys": ["tab"], "command": "jsdocs_indent", "context":