Markdown 升华文本2--自动播放的字符加倍

Markdown 升华文本2--自动播放的字符加倍,markdown,sublimetext2,multimarkdown,Markdown,Sublimetext2,Multimarkdown,我是一个全新的Sublime Text 2用户,目前主要用于标记/多重标记。在我的写作工作流程中,我对所有斜体字使用\u下划线配对,对所有粗体字使用**双星号**配对。我已经获得了一些用于自动配对的基本代码,并在我键入一个星号后将其配对为双星号。这正是我想要的行为,但我一直无法让正常的配对退格函数工作 对于其他自动播放的字符,例如[],在键入开头字符后单击backspace将删除两个成对的字符。但当我将其中一个双星号对退格时,它只删除四个星号中的一个(留给我的是***) 有人知道这是否可能吗?为

我是一个全新的Sublime Text 2用户,目前主要用于标记/多重标记。在我的写作工作流程中,我对所有斜体字使用
\u下划线
配对,对所有粗体字使用
**双星号**
配对。我已经获得了一些用于自动配对的基本代码,并在我键入一个星号后将其配对为双星号。这正是我想要的行为,但我一直无法让正常的配对退格函数工作

对于其他自动播放的字符,例如[],在键入开头字符后单击backspace将删除两个成对的字符。但当我将其中一个双星号对退格时,它只删除四个星号中的一个(留给我的是
***

有人知道这是否可能吗?为了获得额外的积分,我希望第二个键绑定片段(它允许您点击tab并跳到autopair的末尾)允许我在
**TEXT**
的末尾添加tab键

// Auto-pair double asterisks (type a single asterisk to invoke)
{ "keys": ["*"], "command": "insert_snippet", "args": {"contents": "**$0**"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
        { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[*a-zA-Z0-9_]$", "match_all": true },
        { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }
    ]
},
{ "keys": ["*"], "command": "insert_snippet", "args": {"contents": "**${0:$SELECTION}**"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
    ]
},
{ "keys": ["*"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^**", "match_all": true }
    ]
},
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "**$", "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^**", "match_all": true }
    ]
},
//Tab skips to end of autopaired characters
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true},
  "context": [ { "key": "selection_empty", "operator": "equal", "operand": true },
            { "key": "preceding_text", "operator": "not_regex_match", "operand": "[[:space:]]*", "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^[\"'\\)\\}\\]\\_]", "match_all": true },
            { "key": "auto_complete_visible", "operator": "equal", "operand": false },
            { "key": "has_next_field", "operator": "equal", "operand": false } ] },

*
是正则表达式的特殊字符,因此需要对其进行转义。
backspace
键应该是这样的:

"keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
[
    { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true }
]
<snippet>
    <content><![CDATA[
**${1:TEXT}** ${2:}
]]></content>
    <tabTrigger>your_snippet</tabTrigger>
</snippet>
请注意
前面的\u text
键regexp操作数中的
\\\*$
,以及
后面的\u text
键regexp操作数中的
\\\*
。 无论如何,您必须按两次
backspace
,才能同时删除这两个
*
:我认为不可能同时删除这两个

您需要的代码段应该如下所示:

"keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
[
    { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true }
]
<snippet>
    <content><![CDATA[
**${1:TEXT}** ${2:}
]]></content>
    <tabTrigger>your_snippet</tabTrigger>
</snippet>

你的代码片段
你应该用你想要的任何文本作为触发器来更改你的代码片段