ATOM how to enable selecting "$" symbol along with the variable name?

Viewed 190

I am using ATOM as my IDE. Whenever I double click on a variable it selects only the variable name and leaves out $. For example, if I double click on variable $var it will only highlight var and $ will not get highlighted. I am using the default nonWordCharacters in settings /\()"':,.;<>~!@#$%^&*|+=[]{}?-…. How can I enable highlighting the whole variable including the $ sign?

enter image description here

1 Answers

That's very simple. I believe currently you are trying to mess with "Non Word Characters" under Settings > Editor > Non Word Characters. Which is wrong. Leave that as it is (default). Changing that will have no effect. You need to change the "Non Word Characters" value under your preferred programming language's language preferences. Assuming that you are using PHP (since PHP is the language that uses $ symbol to define a variable name), please follow the steps below:

  1. Navigate to Settings > Packages > Search for language-php
  2. Click on settings
  3. Scroll down to find "Non Word Characters"
  4. Remove $ symbol from the list of the characters

That's it. Done! Now double clicking will select whole variable including the $ symbol. If you are using any other language instead of PHP just make sure to search for language-yourlanguagename in the first step above.

Related