In Sublime Text 2, consider hyphen as part of word

后端 未结 3 1698
不思量自难忘°
不思量自难忘° 2021-02-01 04:00

How can I have a double-click on a word which contains a hyphen (dash) in Sublime Text 2 select the entire word, not just one part of the word delimited by the hyphen?

相关标签:
3条回答
  • 2021-02-01 04:30

    Click settings -> default settings, locate the "word_separators" key and delete the hyphen from the character set, re-save.

    0 讨论(0)
  • 2021-02-01 04:42

    As @Nate Pinchot stated, it's better to add the "word_separators" key to the User Settings. In case of updating Sublime Text the changes in Default Settings will be reset.

    Go to Preferences > Settings ̶ Users and add between the outermost {} brackets:

    // Characters that are considered to separate words, here without hyphen
    "word_separators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?",
    

    Don't forget about the comma at the end if it's not the only or last key added.

    0 讨论(0)
  • 2021-02-01 04:50

    As @Intentss mentioned (i don't want it lost in the comments), if you only want to modify this behaviour for a specific file type:

    Preferences > Settings - More > Syntax Specific - User.

    or in my case

    Preferences > Settings - Syntax Specific

    and then edit the user version that shows up:

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

    0 讨论(0)
提交回复
热议问题