Sublime Text and Hypens vs Underscores

2019-05-06 16:21发布

问题:

I'm running into an issue with hyphens in sublime text 3 and I was looking for some help. I'd like them work the same way that underscores do.

With underscores, double clicking on word_one selects the whole thing while using the keyboard with ctrl-right hops to the underscore.

With hypens, double clicking on word-two selects the whole thing but using the keyboard with ctrl-right skips the entire word. If I add the hyphen to the "word separators" then the behavior is switched (double clicking now just selects the word you click but ctrl-right works properly).

Any help would be appreciated, thanks.

回答1:

Remove the hyphen from the list of characters that Sublime uses to define what a word is. This is stored in your preferences file. The default looks like this:

"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",

If you're feeling super-lazy, I've removed the hyphen for you here:

"word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?",

Of course, you should edit this in your User settings file. You can open that file by selecting the menu "Sublime Text->Preferences->Settings - User".