The sublime text word_separator
is:
"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",
I would also like case change in CamelCase to be considered change. Is there a setting/way to do this?
(Eg in FooBar ctrl+bck_space should delete only Bar).
In the event anyone is still looking at this...
In your default keybindings you'll find:
{ "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} },
{ "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
{ "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },
{ "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} },
{ "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} },
{ "keys": ["alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} },
{ "keys": ["alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} },
Using alt+direction will move by "subwords" as opposed to "words", which takes into account camelCase. I prefer that over the default so I've copied the alt+direction set into my user keybindings and replaced the instances of alt with ctrl. Voila, ctrl+direction moves by camelCase as well as the defined word separators.
Also, I'm not sure if using the subwords setting will take into account underscores, I've always added _ to the word separators just to make sure.
I think this can only be done via a plugin, not simply by changing Sublime Text's settings.
This plugin looks promising:
https://github.com/jdc0589/CaseConversion
Using alt works only for moving, not for delete, but I found something that works pretty well:
Delete forward (alt+delete):
delete_subword.sublime-macro:
[
{
"command": "move",
"args": {
"by": "subwords",
"extend": true,
"forward": false
}
},
{
"args": null,
"command": "left_delete"
}
]
Delete backward (alt+backspace)
delete_subword_forward.sublime-macro:
[
{
"command": "move",
"args": {
"by": "subwords",
"extend": true,
"forward": true
}
},
{
"args": null,
"command": "right_delete"
}
]
Save it into your User directory. Now, you bind keys like this:
{ "keys": ["alt+backspace"], "command": "run_macro_file", "args": {"file": "Packages/User/delete_subword.sublime-macro"} },
{ "keys": ["alt+delete"], "command": "run_macro_file", "args": {"file": "Packages/User/delete_subword_forward.sublime-macro"} },
Source
Alt + W
in vim mode works for me in sublime text 3 to traverse camelCase words