Enhanced text selection keyboard command (stolen from Jetbrains)


#1

Jetbrains IDE’s (IntelliJ, WebStorm, PyCharm, etc) have a killer keyboard command for incrementally selecting greater ranges of text.

The first invocation selects the word at the caret, and then each subsequent invocation expands the selection according to the natural hierarchy of the particular programming language being edited. Generally it expands along the lines of word, statement, expression, block, function, class and so on.

It’s really handy when you are editing a doc that has some kind of natural hierarchy. This would work well in MD: for instance, expanding from word, to list item, to entire list, and then expanding incrementally up the header chain.


#2

Wow, and five minutes later I find that you’ve already done this. That was fast work!

Sorry for the forum churn. I love this feature and will use it constantly.


#3

Actually, I’ve noticed this feature doesn’t seem to work consistently:

  • If something at the top level of the hierarchy is selected, the selection pattern is: word, line, document
  • But if something not at the top hierarchy level of the doc is selected, the selection pattern is: word, line, branch, document

@jessegrosjean, is this intentional? Am I missing something? Thanks!


#4

I just tried and it seems to be working for me. I think the expansion pattern should be:

  • word
  • sentance
  • paragraph
  • branch
  • (then expanding up hierarchy repeat) siblings/parent of siblings until entire document is selected

If you see a case where it’s not working can you post an example document with instructions to reproduce the problem?


#5

Try with this.

Test.taskpaper (37 Bytes)

Put your cursor in the word “cat” and start hitting ⌘⌥↑

I get: word, sentence, line, paragraph without trailing whitespace, paragraph WITH trailing whitespace—

And then it just toggles the last two over and over again.