macos 如何添加 Sublime Text 2 键绑定?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6635417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:09:27  来源:igfitidea点击:

How do I add Sublime Text 2 keybindings?

macossublimetext

提问by ChuckJHardy

I am looking to get the following assigned to Keybindings. I am able to make a snippet for this, yet would prefer to be able to CTRL+ >just like in Textmate.

我希望将以下内容分配给键绑定。我能够为此制作一个片段,但更希望能够像在 Textmate 中那样CTRL+ >

<%= %>

What do I need to add and where do I need to add it, or where could I find out.

我需要添加什么以及我需要在哪里添加它,或者我可以在哪里找到。

回答by lunixbochs

If you just want to literally insert those characters, you can set up your "User Key Bindings" like this:

如果您只想直接插入这些字符,您可以像这样设置“用户键绑定”:

[
    { "keys": ["ctrl+."], "command": "insert", "args": {"characters": "<%= %>"} }
]

You can use the Default Key Bindings file as an example for possible key binding commands. Both User and Default are located in Sublime Text 2 -> Preferences on OS X.

您可以使用默认键绑定文件作为可能的键绑定命令的示例。User 和 Default 都位于 Sublime Text 2 -> OS X 上的 Preferences 中。

Not sure if you really wanted "ctrl+shift+.", but it would work as well.

不确定你是否真的想要"ctrl+shift+.",但它也能工作。

To move the cursor to the middle during insert, you can use insert_snippet like this:

要在插入过程中将光标移动到中间,您可以像这样使用 insert_snippet:

[
    { "keys": ["ctrl+shift+."], "command": "insert_snippet", "args": {"contents": "<%=##代码## %>"} }
]

回答by turbo2oh

Just found this, thought it might be helpful: https://github.com/eddorre/SublimeERB

刚刚发现这个,认为它可能有帮助:https: //github.com/eddorre/SublimeERB