A PHP Error was encountered

Severity: Notice

Message: Only variable references should be returned by reference

Filename: core/Common.php

Line Number: 243

Sublime Text 2 edit multiple selections - Daniel Mois - Web Developer

Sublime Text 2 edit multiple selections

Sublime Text 2 edit multiple selections

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.

5 comments

U Wenona Rautio blogs 2012-09-21 10:43:57

If you dont mind, exactly where do you host your web page? I am looking for a very good host and your weblog appears to be extremely fast and up just about all the time Wenona Rautio blogs

U Daniel Mois 2012-07-18 03:40:46

Thank you, Jeremy for a valuable tip!

U jeremy 2012-07-11 07:56:39

Alt+F3 (win) or control + command + g (mac) will select ALL instances of the current selection. So you could press control + d to highlight the current word, and then press control + command + g and select all, instead of repeating the control d keystroke.

U Auth 2012-04-14 09:17:04

That insight's just what I've been lokonig for. Thanks!

U Rita 2012-04-09 02:33:58

A magazine theme would make ur blog look nicer :)