When selecting variable f, the editor highlights other occurrences of the variable. So far so good, but when trying to add them to the selection list with
Rather than selecting the variable, just put the cursor left to it, and press Ctrl+D. This will also select it, but only other variables (or what the editor recognises as variables, based on word boundaries) on subsequent Ctrl+D presses.