Sublime Forum

Creating keybinding for "move" behavior by character type

#1

I have a keybinding that will jump to the word end and I want to change it so that for some designated characters it jumps forward only past that special character and before the word character that follows it. A special character would be punctuation like “[]” (open or closed bracket), “:” (colon), and a number of others. Is there a way to do that in Sublime?

e.g.:
This is text; it contains [brackets]

Desired behavior is to advance to word end except, in this case, when it encounters the first bracket and should advance past the "["and before the “b” of “brackets”.

The current configuration of the keybinding:
{ “keys”: [“alt+right”], “command”: “move”, “args”: {“by”: “word_ends”, “forward”: true} },

I want the similar behavior in reverse for the inverse keybinding that moves the cursor left to word start.

Probably not relevant but word separators in preferences:
“word_separators”: “_./\()”’-:,.;<>~!@#$%^&*|+=[]{}`~?",

0 Likes