In AutoHotkey, a variable is invoked by putting the variable name in between percent signs, such as %var_name%
. I want to select just the variable name to change it. When I click on var_name
and click on the menu Selection -> Expand Selection to Word
, the full %var_name%
, including percent signs are selected. Is this a bug? Any advice? By the way, in settings I have the default “word_separators”: “./\\()\”’-:,.;<>~!@#$%^&*|+=[]{}`~?",
.
Expand Selection to Word within Percent Signs
The first advice would be, “does this happen in safe mode?”; my guess would be that the answer to that is no.
I’m going to guess that you have installed a package that provides language support for AutoHotkey scripts so as to provide syntax highlighting, etc. One such package is : https://packagecontrol.io/packages/AutoHotkey
That package include a syntax specific setting for it’s own syntax that overrides the word_separators
value (you can see it by using Preferences > Package Settings > AutoHotkey Settings - Default
:
"word_separators": "./\\()\"'-:,.;<>~!@#$^&*|+=[]{}`~?",
So, inside of files that are of this type (as seen by the syntax name in the bottom right of the window), the word separators are different and don’t include the %
character, which is why this is happening.
The solution in a case like that would be to choose Preferences > Settings - Syntax Specific
while you have an AHK script open and then override the word_separators
setting; say by copying the one from above that it’s using and adding %
back to it.
That would stop this from happening. It might have other knock on effects since the setting applies to the file as a whole for all features that want to know about words - that may or may not be an issue.