Sublime Text 2 edit multiple selections
13 february 2012 5 comments
A very useful feature in Sublime Text 2 that makes editing of multiple instances of the same word very fast. This will definitely save you some time and help you code faster.
Update - 16.07.2012
Thanks to Jeremy for his valuable input on the keyboard shortcut Alt + F3 (win) Ctrl + Cmd + G (mac), to select all instances at once. It's definitely much more efficient if you need to select all instances of a ward. The CTRL + D (win) or CTRL + OPT + G (mac) is needed when you want to select just a few consecutive instances, starting from the selection, downwards.
If you need to select a few instances that are scattered and are not consecutive, you can select the first occurrence and then holding down the Ctrl (win) or Cmd (mac) key and double clicking the the word you wand to select, part of the multiple selection.
Original
I would like to share with you a very neat feature from my editor of choice Sublime Text 2 that makes me smile every time I use it.
The keyboard shortcut Ctrl + D (win) or Ctrl + Opt + G (mac), allows you to select the word closest to your cursor position. That's very handy, but if you have multiple instances of that word, you can select them one by one by presing the same keyboard combination several times.
So for exmaple if you have a class set on multiple elements and you need to change it to something else, you just point the cursor on the class, press Ctrl + D (win) or Ctrl + Opt + G (mac) as many times as there are class instances and then you can type the new class name.
Every time you press the keyboard combination, a new instance is selected and a newe cursor is placed at the end of the selection. To find the next instance, the code is scanned downwards from the position of the first occurence and once it reaches the end the file, it jumps to the start and then continues back down to the initial selection.
U Wenona Rautio blogs 2012-09-21 10:43:57
U Daniel Mois 2012-07-18 03:40:46
U jeremy 2012-07-11 07:56:39
U Auth 2012-04-14 09:17:04
U Rita 2012-04-09 02:33:58