Skip to content

Instantly share code, notes, and snippets.

@andigamesandmusic
Last active August 1, 2024 19:01
Show Gist options
  • Save andigamesandmusic/9716a09d6cffc07d8d0447bdf7ec0cbd to your computer and use it in GitHub Desktop.
Save andigamesandmusic/9716a09d6cffc07d8d0447bdf7ec0cbd to your computer and use it in GitHub Desktop.
Multi-selection tutorial in common editors

Go fast in your editor!

Learning to move efficiently in your editor can drastically reduce time for edits and reduce errors.

Open this file in Sublime Text, IntelliJ, VSCode, Zed and run through the practice exercises!

Exercise 1: Move to end of line (Ctrl-E, IntelliJ: Command-RightArrow)

Practice

Start cursor here and move to end of line
             ^

Exercise 2: Move to start of line (Ctrl-A, IntelliJ: Command-LeftArrow)

Practice

Move cursor to beginning of line starting HERE
                                          ^

Exercise 3: Select to end of line (Ctrl-Shift-E, IntelliJ: Command-Shift-RightArrow)

Practice

Start cursor HERE and select to end of line
             ^

Exercise 4: Select to start of line (Ctrl-Shift-A, IntelliJ: Command-Shift-LeftArrow)

Practice

Select to beginning of line starting HERE
                                     ^

Exercise 5: Move forward by word (Option+RightArrow)

Practice

Start HERE and move to here by word
      ^                   ^

Exercise 6: Move backward by word (Option+LeftArrow)

Practice

Move to here starting from HERE by word
     ^                     ^

Exercise 7: Select forward by word (Option+Shift+RightArrow)

Practice

Start HERE and select to here by word
      ^                     ^

Exercise 8: Select backward by word (Option+Shift+LeftArrow)

Practice

Select to here starting from HERE by word
          ^                  ^

Exercise 9: Create a vertical column of cursors and add some text

Practice

  • Click cursor to before the w of the first line
  • Hold down Option (VSCode or Zed hold down Option+Shift)
  • Click-drag from before the w of first line to from before the w of last line
  • Type Hello
world!
world!
world!

End state

Hello world!
Hello world!
Hello world!

Exercise 10: Multi select individually

Practice

  • Click cursor to before the w of the first line
  • Hold down Command and click every before each w
    • IntelliJ: hold down Option-Shift
    • VSCode or Zed: hold down Option
  • Type Hello
world! world! world!
^      ^      ^

End state

Hello world! Hello world! Hello world!

Exercise 11: Multi-select occurrences

Practice

  • Select first worl (double-click)
  • Press Command-D (IntelliJ: Ctrl-G) twice to select others
  • Type world or right-arrow + d
Hello worl!
Hello worl!
Hello worl!

Exercise 12: Jsonify some lines

Practice

  • Click before a in apple
  • Vertical column select beginning of line
    • Option+ClickDrag
    • VSCode or Zed: Option+Shift+ClickDrag
  • Type "
  • Go to end of line (Ctrl-E)
  • Type ",
[
apple
orange
banana
]

End state

[
  "apple",
  "orange",
  "banana",
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment