Following the previous post on assigning a new keyboard shortcuts for column selection, this time we’re going to the same thing in Sublime Text.
As always, before you make any changes, make sure you backup everything.
macOS (OSX)
On the top menu, click on Sublime Text -> Preferences -> Key Bindings and a split screen will open.
Using the same key combination as in the example provided for Visual Studio Code (SHIFT-ALT-ARROW), you can paste the following javascript code on the right pane (User). If you’ve already had other custom keybindings, you want to add the two lines without the square brackets in the beginning and end of the code block.
Default (OSX).Sublime-keymap — User
[ { "keys": ["shift+alt+up"], "command": "select_lines", "args": {"forward": false} }, { "keys": ["shift+alt+down"], "command": "select_lines", "args": {"forward": true} }, ]
Windows
On Windows version of Sublime Text, you can click directly on Preferences -> Key Bindings from the top menu and apply the same treatment as above (copy and paste the JSON above to the right-pane of the split screen).
Closing Thought
Personally, custom key binding especially for column selection has helped me to use both Visual Studio Code and Sublime Text without requiring me to make too much mental switch on either Windows or Mac.
Another trick you may want to try is to use a similar key placement instead of the literal key combination instead. What I mean by this is that the position of ALT key in Windows and Mac is a bit different. The ALT key on Windows is on the same position as Command (⌘) key on Mac.
So I set my Mac column selection key binding a bit different than its Windows counterpart (alt is replaced with command instead).
[ { "keys": ["shift+command+up"], "command": "select_lines", "args": {"forward": false} }, { "keys": ["shift+command+down"], "command": "select_lines", "args": {"forward": true} }, ]
Related Article
How to Reassign Shortcut Key for Column Selection in Visual Studio Code
How to Add Comma to Each Line Using Visual Studio Code or Sublime Text