Home:ALL Converter>Sublime Text - How to get OSX keyboard shortcut on linux or windows

Sublime Text - How to get OSX keyboard shortcut on linux or windows

Ask Time:2015-05-28T02:32:51         Author:Derek

Json Formatter

In Sublime Text 3 on OSX, I am able to use the keyboard shortcut "command+left/right arrow" to jump to the beginning/end of a line, as well as "command+shift+left/right arrow" to select from the point I am at to the beginning/end of the line.

Is there a way to get the same shortcut on linux or windows in the form of "ctrl+left/right arrow" and "ctrl+shift+left/right arrow" respectively?

Author:Derek,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30490459/sublime-text-how-to-get-osx-keyboard-shortcut-on-linux-or-windows
MattDMo :

⌘← and ⌘→ are built-in OS X shortcuts, and are not part of Sublime. However, you can mimic this behavior on Windows or Linux by overriding the default behaviors of Ctrl←/→ and CtrlShift←/→ using a custom keymap.\n\nBy default, using Ctrl←/→ moves the cursor backwards and forwards, respectively, by words, while holding down Shift allows for selection. If you want to change this, open Preferences -> Key Bindings-User and add the following content:\n\n{\n \"keys\": [\"ctrl+right\"],\n \"command\": \"move_to\", \"args\": {\"to\": \"eol\", \"extend\": false}\n},\n{\n \"keys\": [\"ctrl+left\"],\n \"command\": \"move_to\", \"args\": {\"to\": \"bol\", \"extend\": false}\n},\n{\n \"keys\": [\"ctrl+shift+right\"],\n \"command\": \"move_to\", \"args\": {\"to\": \"eol\", \"extend\": true}\n},\n{\n \"keys\": [\"ctrl+shift+left\"],\n \"command\": \"move_to\", \"args\": {\"to\": \"bol\", \"extend\": true}\n}\n\n\nIf the file is empty when you open it, make sure you surround everything with opening and closing square brackets [ ]. Save the file (it will automatically save in the correct place, which is the User directory under Packages, the directory opened when selecting Preferences -> Browse Packages...), and your new shortcuts should work as expected. Please not that when you are working with indented text, moving to the beginning of the line with Ctrl← will move you to the beginning of the text on that line, not to the very first position on the line. If you want to do that, either hit Ctrl← again, or change bol to hardbol in the key definitions above.",
2015-05-27T19:14:24
yy