If I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them:
It's mentioned by @watsonic that in Sublime Text 3 on Mac OS, starting with an empty selection, simply ⌃⌘G (AltF3 on Windows) does the trick, instead of ⌘D + ⌃⌘G in Sublime Text 2.
Put the cursor in the variable.
Note: the key is to start with an empty selection. Don't highlight; just put your cursor there.
Didn't work? Try again, making sure to start with nothing selected.
More commands:
Find All: Ctrl⌘G selects all occurences at once. Not on a Mac? AltF3
Undo Selection: ⌘U steps backwards. Not on a Mac? CtrlU
Quick Skip Next: ⌘K⌘D skips the next occurence. Not on a Mac? CtrlKCtrlD
Sublime Docs
The Magic is, you have to start with an empty selection, so put your cursor in front of the word/character you want to multi-select and press Ctrl+D .
As user1767754 said, the key here is to not make any selection initially.
Just place the cursor inside the variable name, don't double click to select it. For single character variables, place the cursor at the front or end of the variable to not make any selection initially.
Now keep hitting Cmd+D for next variable selection or Ctrl+Cmd+G for selecting all variables at once. It will magically select only the variables.
At this moment, 2020-10-17, if you select a text element and hit CTRL+SHIFT+ALT+M it will highlight every instance within the code chunk.
I know the question is about Macs, but I got here searching the answer for Ubuntu, so I guess my answer could be useful to someone.
Easy way to do it: AltF3.