Sublime Forum

How do I extend selection to a particular char

#1

I want to turn on a selection mode and then as I type a character sublime extends selection to that char. Say I have this

foobarblahblah banana

I start cursor at the f. hit a shortcut to enter special selection mode. hit b to select foo, hit b again to select foobar, hit left to select fooba, ctrl+right to select foobarblahblah.

sublimator (or any scripting wizard) ?

0 Likes

#2

Interesting, I can think of a lot of uses for this… :smile:

0 Likes

#3

it’s handy in 2 ways: a more precise way to extend selection when the usual ways (word, line, scope) don’t do; and to be able to anchor the start of the selection and extend it by moving around freely without having to hold down the shift key.

on a related note, is there an easy way to do multiple selections with the kbd. Too often, I ctrl+click in the wrong place.

0 Likes

#4

you can cancel selection with alt+click/select

0 Likes

#5

and ctrl+alt+up/down for kbd multiselect

0 Likes

#6

[quote=“barty”]it’s handy in 2 ways: a more precise way to extend selection when the usual ways (word, line, scope) don’t do; and to be able to anchor the start of the selection and extend it by moving around freely without having to hold down the shift key.

on a related note, is there an easy way to do multiple selections with the kbd. Too often, I ctrl+click in the wrong place.[/quote]

Look in my poweruser package, it has that. PowerUser package for power users

Basically u go to the spot you want, “store” selection, goto next, “store”, and so on… obviously this is only useful if multiple selection are not in the same column, if not use ctrl+alt+up/down OR in my package too courtesy of sublimator it has automatically select columns…

OR , use MultiSelect package from sublimator (dedicated to multiple selections), freaking awesome :smiley:, basically allows u to have sticky multiple selections and if u need to u can jump back and forth between selections and at same time u can even modify the buffer. bitbucket.org/sublimator/multiselect/wiki/Home

…Gosh I really need to screencast poweruser package features >.<

0 Likes

#7

[quote]@EJ12N
I see you learned my docs coming soon trick and used it on the MultipleSelect wiki. LOL[/quote]

I know LOL, I am thinking of what to do, to make documentation a lot easier…

0 Likes

#8

My 2c: VIM has a key binding “f,x”, which will move forward to the first x after the cursor (only on the current line). A similar thing could be done in Sublime Text via:

<binding key="ctrl+period,/(.)/" command="findCharacter $1"/>
<binding key="ctrl+shift+period,/(.)/" command="findCharacter --extend $1"/>

Implementation of findCharacter is an exercise left to the reader :slight_smile:

0 Likes