修改auto_match报价,增加一个额外的引用字符崇高文字2 [英] Modify auto_match of quotes, adding an additional quoting character to Sublime Text 2

查看:138
本文介绍了修改auto_match报价,增加一个额外的引用字符崇高文字2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

崇高文本2非常有益关闭所有我的报价。结果
是否有可能修改它做到这一点的字符?

Sublime Text 2 very helpfully closes all of my quotes.
Is it possible to modify which characters it does this with?

例如,如果我想一段单列`添加到列表中。

For example, if I would like to add `backticks` to the list.

@ skuroda的回答的伟大工程。在Mac OSX,转到

@skuroda's answer works great. On Mac OSX, go to

崇高文字2 - ; preferences>按键绑定 - 用户

和粘贴文本那里。请确保它最终被包裹在 [...] (方括号)。

and paste in the text there. Make sure it is ultimately wrapped in [...] (square brackets).

推荐答案

自动配对仅仅是少数专业键绑定。这应该让你自动对反引号。这也应作为,如果你想创建其他的自动配对符号的指南。

The auto pairing is simply a few specialized keybindings. This should allow you to auto pair backticks. It should also serve as a guide for if you want to create other auto paired symbols.

{ "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 }
    ]
},
{ "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 }
    ]
}

只需插入code座到用户键绑定。

Simply insert that code block into your user key bindings.

我只使用默认的按键绑定为模板,所以你可能需要进一步修改一些上下文得到它完美地工作。

I just used the default keybinding as a template, so you may need to further modify some of the context to get it to work perfectly.

这篇关于修改auto_match报价,增加一个额外的引用字符崇高文字2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆