[quote=“planet”]I tried to find a workaround for this Problem (still present in ST3 and also documented here by somebody else http://sublimetext.userecho.com/topic/61252-find-whole-word-for-variables/). I came up with the following key-binding:
{ "keys": "super+d"], "command": "expand_selection", "args": {"to": "scope"}, "context":
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "source.php" }
]
}
It works quite well for me. The regex could be optimized by only check for $ at the beginning of the current word, but I don’t know if that is possible.
Greetings![/quote]
Thank you! This could be optimized at least by adding the “following_text” key, in this form it gave me multiple false selections:
{ "keys": "super+d"], "command": "expand_selection", "args": {"to": "scope"}, "context": { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "\\s", "match_all": true }, { "key": "selector", "operator": "equal", "operand": "source.php, source.scss" } ] },