Keyboard Shortcuts for 2015-01-21: Sublime Text Lines and Folding

January 21, 2015 by Gabe | [mmd] | ℳ↫

Let's try an experiment. Rather than post a huge number of keyboard shortcuts all at once, I'll let you follow along as I wear new patterns into my brain. Sounds gross, right? It is.

This week's set of keyboard shortcuts are for Sublime Text and code folding. First, if you are using Sublime Text, go get the Filter Lines package.

Here's the lesson plan for this week:

Habituate a few of the more generally useful Sublime Text keyboard shortcuts like selecting, moving and folding lines.

Basic Line Moving

Select Line: ⌘+L

Move Line: ⌘+ctrl+↑/↓

Super Awesome Selective Folding

Fold all: ctrl+k, ctrl+1

Unfold current: ctrl+shift+]

Unfold all: ⌘+k, ⌘+j

Fold with string: ⌘+k, ⌘+f

That last one needs to be set up. Add this line to your User Keybinding file:

{ "keys": ["super+k", "super+f"], "command": "prompt_fold_to_lines", "args": { "search_type": "string" } }

The Fold with String shortcut is pretty powerful and does as it says. Enter a string and it folds everything except lines that contain that string. You can keep editing right there in the document too.

These all work on Windows, if that's your affliction.