Sublime Forum

Change subword separators?

#1

Hi, I know you can change word separators with the “word_separators” setting in the preferences, but is it possible to change the subword separator? Currently it seems to use “_” and capital letters… I’d like to add “-” as a subword delimiter so I can use alt+left and alt+right to move by subwords separated by “-” as in “this-long-variable”

Is this possible?

0 Likes

#2

I don’t know how to register a new subword, but ST3 3059 already does this for “-” out of the box IF you use ctrl+left or ctrl+right instead. That’s because “-” is already registered in word_separators and ctrl+left/right moves by word instead of by subword.

0 Likes

#3

[quote=“Yojimb0”]Hi, I know you can change word separators with the “word_separators” setting in the preferences, but is it possible to change the subword separator? Currently it seems to use “_” and capital letters… I’d like to add “-” as a subword delimiter so I can use alt+left and alt+right to move by subwords separated by “-” as in “this-long-variable”

Is this possible?[/quote]

Works out of the box for me, same as word navigation except it stop before AND after “-”.
What’s your ST version ?

startup, version: 3061 windows x64 channel: dev

0 Likes

#4

I’m still on 2 I’m afraid, 2.02.

I guess I should have been more clear: I want to use alt to move by words delimited by “-” but I want to use ctrl to move across the whole word. So if I used ctrl I could move from the “t” to the “e” in “this-long-variable” with just one right arrow click, but if I used “alt” I would move from the “t” to the “-”

The behavior I want works out of the box with underscores and capital letters, just not with dashes, because underscores and capital letters are somehow recognized as subword delimiters (and alt+left and alt+right move by subwords.)

1 Like