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:
And place this code below in your "Default (OSX).sublime-keymap" file:
{
"keys": ["super+right"],
"command": "moveto",
"args":
{
"to": "hardeol"
}
},
{
"keys": ["super+left"],
"command": "moveto",
"args":
{
"to": "hardbol"
}
}
Good stuff, eh? Give me your feed back and other Sublime hints!
Cya ;D
Written by Bruno "Clef"
Related protips
6 Responses
thanks! just what i needed tonight :)
Now needs "move_to" instead of "moveto"
My shortcuts:
{
"keys": ["super+shift+h"],
"command": "moveto",
"args": {
"to": "bol"
}
},
{
"keys": ["super+shift+l"],
"command": "moveto",
"args": {
"to": "eol"
}
},
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"
}
}
Thank you! Why the hell is this not a default in ST2?!
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 } }
]
Thanks Bruno good post!
Thanks danny8000 for your help.
And thanks a lot to adeynack, now it's perfect!