Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

<%= %>

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

question from:https://stackoverflow.com/questions/6635417/how-do-i-add-sublime-text-2-keybindings

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
261 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

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

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...