Last Updated: January 12, 2018
·
13.65K
· felclef

Sublime Text 2 - End and Begin of Line in Mac OS

So you like Sublime Text 2, eh?

And you would like to use Cmd + left/right for begin and end of line, respectively, wouldn't you?

Okay. Go to menu Sublime Text 2 > Preferences > Key Bindings - User:

Picture

And place this code below in your "Default (OSX).sublime-keymap" file:
{
"keys": ["super+right"],
"command": "moveto",
"args":
{
"to": "hardeol"
}
},
{
"keys": ["super+left"],
"command": "move
to",
"args":
{
"to": "hardbol"
}
}

Good stuff, eh? Give me your feed back and other Sublime hints!

Cya ;D

6 Responses
Add your response

thanks! just what i needed tonight :)

over 1 year ago ·

Now needs "move_to" instead of "moveto"

My shortcuts:
{
"keys": ["super+shift+h"],
"command": "moveto",
"args": {
"to": "bol"
}
},
{
"keys": ["super+shift+l"],
"command": "move
to",
"args": {
"to": "eol"
}
},

over 1 year ago ·

Here is the way to map the home and end keys when using a PC keyboard attached to a Mac using sublime:

{
    "keys":["home"],
    "command":"move_to",
    "args":{
        "to":"bol"
    }
},
{
    "keys":["end"],
    "command":"move_to",
    "args":{
        "to":"eol"
    }
}
over 1 year ago ·

Thank you! Why the hell is this not a default in ST2?!

over 1 year ago ·

With the equivalent of PC's "Ctrl-Home" / "Ctrl-End" too:

[
    // Beginning/End of the current line.
    { "keys": ["home"],
      "command": "move_to", 
      "args": {"to": "bol"} },
    { "keys": ["end"], 
      "command": "move_to",
      "args": {"to": "eol"} },
    { "keys": ["shift+end"], 
      "command": "move_to", 
      "args": {"to": "eol", "extend": true} },
    { "keys": ["shift+home"], 
      "command": "move_to", 
      "args": {"to": "bol", "extend": true } },
    // Beginning/End of the document (using CMD).
    { "keys": ["super+home"], 
      "command": "move_to",
      "args": {"to": "bof"} },
    { "keys": ["super+end"],
      "command": "move_to",
      "args": {"to": "eof"} },
    { "keys": ["super+shift+end"],
      "command": "move_to", 
      "args": {"to": "eof", "extend": true} },
    { "keys": ["super+shift+home"], 
      "command": "move_to", 
      "args": {"to": "bof", "extend": true } },
    // Beginning/End of the document (using CTRL, for when I have PC reflexes).
    { "keys": ["ctrl+home"],
      "command": "move_to",
      "args": {"to": "bof"} },
    { "keys": ["ctrl+end"], 
      "command": "move_to", 
      "args": {"to": "eof"} },
    { "keys": ["ctrl+shift+end"], 
      "command": "move_to", 
      "args": {"to": "eof", "extend": true} },
    { "keys": ["ctrl+shift+home"], 
      "command": "move_to",
      "args": {"to": "bof", "extend": true } }
]
over 1 year ago ·

Thanks Bruno good post!
Thanks danny8000 for your help.
And thanks a lot to adeynack, now it's perfect!

over 1 year ago ·