Home Download Buy Blog Forum Support

Want Redefine The "Shift + Enter"

Want Redefine The "Shift + Enter"

Postby test1smore on Sun Mar 24, 2013 2:29 pm

I want the "Shift + Enter" act as "end" + "enter" when coding...
but I don't know how to set it. T_T
-----------------------------------
{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} },
{ "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },
-----------------------------------
test1smore
 
Posts: 2
Joined: Sun Mar 24, 2013 2:22 pm

Re: Want Redefine The "Shift + Enter"

Postby skuroda on Sun Mar 24, 2013 6:31 pm

You want to create a macro. Hit "ctrl+q" to begin recording the macro. Then hit the key combination you want to record. In your case, "end" -> "enter". Then press "ctrl"q" again. Now go to "Tools -> Save Macro". Save this in your user directory (it should default there I believe). Finally create a user keybinding with the following entry.

Code: Select all
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/User/MyMacro.sublime-macro"} }


The above is kind of a general flow for defining/using a custom macro (series of commands). For your specific use case, I think the built in "Add Line" macro should do what you want. Just try adding the following as a user keybinding.

Code: Select all
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }
skuroda
 
Posts: 685
Joined: Fri Oct 05, 2012 8:11 am

Re: Want Redefine The "Shift + Enter"

Postby test1smore on Tue Mar 26, 2013 3:49 pm

[quote="skuroda"]Done it, thank you very much!
test1smore
 
Posts: 2
Joined: Sun Mar 24, 2013 2:22 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 23 guests