alwaysday1
alwaysday1

Reputation: 1783

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.

Upvotes: 25

Views: 39744

Answers (9)

Eugene
Eugene

Reputation: 148

Sometimes it might not be spelled out in the keyboard's command capabilities, e.g. Fn+right_arrow like on Microsoft's all-in-one keyboard.

Upvotes: 0

Bindiry
Bindiry

Reputation: 51

like Terminal, Just press CTRL + e

Upvotes: 3

Geo
Geo

Reputation: 12996

1) Hit Super+Shift+P to open Command Palette (Ctrl+Shift+P on Windows)

2) Type "kbu" to open Preferences: Key Bindings - User

3) Copy / paste the following code into it:

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

(Note: if the file is not empty then obviously you know what to do.)

4) Hit Super+S (Ctrl+S) to save and you are all set!

I chose Super+; shortcut for I often write in PHP and it's convenient to end lines with a semicolon. Other options could be Ctrl+; or Super+. or whatever else you find convenient.

Upvotes: 15

Flow Overstack
Flow Overstack

Reputation: 149

How about binding something that'll make you faster? This is what I use (from Key bindings - user):

[
{ "keys": ["alt+;"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["alt+shift+;"], "command": "move_to", "args": {"to": "eof", "extend": false} }
]

This way, to go to end of the line I use alt+;, and to go to eof I use alt+shift+;

Or use Vim...

Upvotes: 2

Ronan Moriarty
Ronan Moriarty

Reputation: 616

I use [ESC] and [A] in Sublime too :-) - I know it's a long time after you asked the question, but I've started using VIM recently, and configured Sublime to use vintage mode. As I'm fairly new to Sublime too, I'm not 100% sure, but I think you should edit the user preferences file rather than the default preferences file as suggested in the above link, as I gather the default file can get overwritten, and the user preference will override the default anyway. Hope this helps.

Upvotes: 0

Yiling
Yiling

Reputation: 2965

Command+RightArrowKey on Mac. Control+RightArrowKey on Windows

Upvotes: 24

tayopi
tayopi

Reputation: 313

If you're a fan of vim you can enable Vintage mode in Sublime Text 2

Preferences: Settings - User

Then remove Vintage from the ignored_packages.

Upvotes: 2

James Chevalier
James Chevalier

Reputation: 10874

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.

Upvotes: 34

Valjas
Valjas

Reputation: 5004

You can just replace the key with something other than "end". Don't edit the main key bindings file though. Add the change to th user version and it will override the defaults.

Upvotes: 0

Related Questions