I can't find out how to use upper-case letters as word separators in Sublime Text 2.
What I want is the following behaviour: in some C++ IDE I like, using ctrl+left/right when cursor is in a word like thisIsAComposedWord will move cursor to next upper case in the word (or to the beginning/end of the word).
There's something in Sublime text called "word separators" that seems to do that, it appears his way in the default preferences file:
// Characters that are considered to separate words
"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",
So can I insert upper-case in that list? Thanks.
You can move by "Subword" with the following Keybinds:
{ "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} },
{ "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} },
This recognizes camelCase and under_score.
You can also move by Word with
{ "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} }
This recognizes "word separators" as specified in your settings file.
I'm using Sublime Text in Linux (Ubuntu) and this works for me:
In your Settings-User add the same content of the "word-separators" by default (which is that you put in the question). Then, to the string add the regular expression of a Upper-Case letter [A-Z]. The result is:
{
"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?[A-Z]"
}
In order to move to the next upper case in a Word, I use Alt + Left/Right arrow.
Edit:
Regular expression doesn't work. The answer is not valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With