Search code examples
sublimetext2

Move to end of line without [END] key in sublime Text2?


I have read the key bindings file of Sublime Text 2

{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },

I'm wondering if we can move to the end of line without END key in keyboard.

In vim, I just ESC and A, then the cursor would be in the end of line.


Solution

  • To change the key binding, open Key Bindings - User preferences and add a new line between the square brackets. For example, to set the key binding to Control-Alt-Command-A you'd use:

    { "keys": ["ctrl+alt+super+a"], "command": "move_to", "args": {"to": "eol", "extend": false} }
    

    If this line that you're adding is not the last line before the closing square bracket, then you'll need to include a comma at the end of the line. For example:

    [
    { "keys": ["ctrl+alt+super+a"], "command": "move_to", "args": {"to": "eol", "extend": false} },
    { "keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index" : 0} },
    { "keys": ["super+v"], "command": "paste_and_indent" },
    { "keys": ["super+shift+v"], "command": "paste" }
    ]
    

    You should check the Key Bindings - Default preferences to make sure that the key binding you're setting here doesn't conflict with anything else that you might use.

    You shouldn't edit the Key Bindings - Default preferences directly, because they will be overwritten in Sublime Text 2 upgrades.