Select only white characters in Sublime Text 3

Currently, when you press Ctrl+ Shift+ Right Arrowor Ctrl+ Shift+ Left Arrow, Sublime Text 3 will select all spaces (all white characters) from the current position up to the next word including that word.

Is there a way (maybe yes) to modify the ST3 config file or keybind file to force it to select only spaces (only white characters), therefore excluding the next word? I really don't like the default behavior.

+3


source to share


2 answers


By default, these shortcuts are defined as follows:

{ "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },
{ "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} }

      

The important part is the argument by

. What the above basically means is that direct selection should select to the end of a word (space + next word), and selection back should select before the beginning of a word (space + start of previous words).

Now, to get the result you want, you can toggle the bytes for forward selection words

and for reverse selection word_ends

. Thus, if you make a forward selection, only the space before the beginning of the next word will be selected, and if you select in the opposite direction, the spaces until the end of the previous word will be selected.



To configure it this way, set the Preferences / Keybindings to the following: the user overrides the defaults.

{ "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "words", "forward": true, "extend": true} },
{ "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "word_ends", "forward": false, "extend": true} }

      

Give it a try and let me know in the comments if it works for you :)

+3


source


KeyboardNavigation can do it
https://github.com/robertcollier4/KeyboardNavigation
https://packagecontrol.io/packages/KeyboardNavigation



KeyboardNavigation - keyboard movement, selection and deletion in custom separators. Move quickly between adjacent borders. For SublimeText.

0


source







All Articles