Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In some IDEs there is a nice feature (named "Expand selection to include enclosing element" in Eclipse). It expands current text selection to 1 level up syntax element. For example, Eclipse does this with Alt+Shift+UpArrow hotkey combo, and so do some other IDEs, and IntelliJ IDEA does this with Alt+UpArrow hotkey combo. I'm wondering if Sublime Text 3 can do this too. (out of the box or with a plugin - doesn't matter) I guess, it has enough information to do it if it already does syntax highlighting.

share|improve this question
I recently found Expand Selection to Quotes, which works specifically with strings. Expand Selection to Scope will select the contents of a string, but not the quotes themselves. With your cursor in a string, hit Ctrl-' once to select the string, and hit it again to select the quotes themselves. I work with strings a lot, and I've found it quite useful. The Package Control link claims it only works with ST2, but I just installed it in ST3 on OSX and it works fine... – MattDMo Nov 2 '13 at 17:46
up vote 1 down vote accepted

Depending on your syntax, one of the the Selection » Expand Selection To … can do it.

For XML, I've found that Expand Selection to Tag (repeatedly) works. In Java source code, Expand Selection to Scope works. And for any formatted source code, Expand Selection to Indentation should work.

share|improve this answer
Thanks. But can I set it up so a single hotkey will do it, regardless of current syntax used? Expand to scope works, but in XML it "jumps too high" at a step. – Sarge Borsch Nov 2 '13 at 17:26
@SargeBorsch For code, … to Scope works in my experience (don't have that much other source code around right now). Eclipse cannot even do the equivalent … to Tag, so you're not losing anything if you're only learning that one. – Daniel Beck Nov 2 '13 at 17:28
Yes, this is cool, the only downside is that this is 2 different commands – Sarge Borsch Nov 2 '13 at 17:30
@SargeBorsch That's what I meant. For the equivalent functionality to Eclipse, it's still only one command. – Daniel Beck Nov 2 '13 at 17:31
Maybe I can merge them in single command that will choose what to use depending on syntax type via some Python kung-fu? – Sarge Borsch Nov 2 '13 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.