Home Download Buy Blog Forum Support

how do I extend selection to a particular char

how do I extend selection to a particular char

Postby barty on Thu Oct 22, 2009 6:28 pm

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

Code: Select all
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) ?
barty
 
Posts: 47
Joined: Thu Sep 10, 2009 5:39 am

Re: how do I extend selection to a particular char

Postby EJ12N on Thu Oct 22, 2009 7:05 pm

Interesting, I can think of a lot of uses for this... :)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: how do I extend selection to a particular char

Postby barty on Fri Oct 23, 2009 6:14 pm

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.
barty
 
Posts: 47
Joined: Thu Sep 10, 2009 5:39 am

Re: how do I extend selection to a particular char

Postby vim on Fri Oct 23, 2009 6:51 pm

you can cancel selection with alt+click/select
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: how do I extend selection to a particular char

Postby gpfsmurf on Fri Oct 23, 2009 9:03 pm

and ctrl+alt+up/down for kbd multiselect
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: how do I extend selection to a particular char

Postby EJ12N on Fri Oct 23, 2009 10:04 pm

barty wrote: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.


Look in my poweruser package, it has that. viewtopic.php?f=5&t=548

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 :D, 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. http://bitbucket.org/sublimator/multiselect/wiki/Home

...Gosh I really need to screencast poweruser package features >.<
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: how do I extend selection to a particular char

Postby EJ12N on Sat Oct 24, 2009 2:56 pm

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

I know LOL, I am thinking of what to do, to make documentation a lot easier...
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: how do I extend selection to a particular char

Postby jps on Sat Oct 24, 2009 9:26 pm

sublimator wrote:How would you see it implemented, as a `panel` or completely in editor as a special mode?


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:

Code: Select all
<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 :)
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 23 guests