Home Download Buy Blog Forum Support

Line and multi-line selection

Line and multi-line selection

Postby atourino on Sat Sep 20, 2008 3:47 am

Hello everyone.

I am a trial user for Sublime Text and I was wondering if there was a way to select a whole line of code using (I guess your default is Ctrl+L) and then hitting the up arrow or down arrow to keep selecting lines either above or below?

I am a MultiEdit user and that's the one key thing that separates ME from the rest, in my eyes. Anywhere on a line of code, I can press shift+up or shift+down and it selects the current line and if I keep pressing the up or down arrows while pressing shift, I keep selecting lines either up or down. It's a wonderful thing and makes editing a breeze as in most languages lines are pretty much atomic statements.

If there is no way to do that out of the box, then I will see if I can learn some python to make this plugin happen. Just thought I'd ask before reinventing the wheel. :)
atourino
 
Posts: 15
Joined: Sat Sep 20, 2008 3:39 am

Re: Line and multi-line selection

Postby atourino on Sat Sep 20, 2008 12:33 pm

Ok, found the solution already exploring the options, and no python needed! :D

Just for the record:

Code: Select all
   <binding key="ctrl+shift+down" command="expandSelectionTo line"/>
   <binding key="shift+up" command="move lines -1 extend"/>
   <binding key="shift+down" command="move lines 1 extend"/>


Does what I want, a bit differently but gets the job done.
atourino
 
Posts: 15
Joined: Sat Sep 20, 2008 3:39 am

Re: Line and multi-line selection

Postby jps on Thu Sep 25, 2008 3:18 pm

This is a great idea, shift+up/down is a fairly crummy key binding. I've added support for what you describe in the latest beta, via the command "move wholelines" - it's bound to shift+up/down by default.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Line and multi-line selection

Postby atourino on Thu Sep 25, 2008 7:39 pm

Awesome. Will try it out! Thank you.
atourino
 
Posts: 15
Joined: Sat Sep 20, 2008 3:39 am

Re: Line and multi-line selection

Postby SteveCooperOrg on Sat Sep 27, 2008 11:33 am

jps wrote:This is a great idea, shift+up/down is a fairly crummy key binding. I've added support for what you describe in the latest beta, via the command "move wholelines" - it's bound to shift+up/down by default.


Any way to remove this or make it an option? It's now impossible (i think) to select a long sentence from a paragraph using the keyboard...
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Line and multi-line selection

Postby jps on Sat Sep 27, 2008 2:26 pm

Steve, you can change it back by adding key bindings for:

Code: Select all
<binding key="shift+up" command="move lines -1 extend"/>
<binding key="shift+down" command="move lines 1 extend"/>


Just to confirm, this is causing you issues for multi-line sentences, as your workflow is to, say, start at the beginning of the sentence, then shift+down to go down to the next line, then press ctrl+shift+right a few times to get to the end of the sentence?

If changing the behavior of shift+up/down is going to trip people up, It may make more sense to have the new behavior only kick in if the selection already contains a newline... hrm.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Line and multi-line selection

Postby SteveCooperOrg on Sun Sep 28, 2008 5:24 pm

jps wrote:Just to confirm, this is causing you issues for multi-line sentences, as your workflow is to, say, start at the beginning of the sentence, then shift+down to go down to the next line, then press ctrl+shift+right a few times to get to the end of the sentence?


Hi, Jon. Yeah, It's a problem when I'm writing prose, with wrapping on. With a paragraph of prose in one logical line (ie one terminating CR) but spread over several visual wrapped lines, selecting a sentence spread over several visible lines is now a problem.

The other thing is that I use selection as a preview for deletion, not just copy and cut. I select out what I want gone, get the selection right, and hit delete. If hitting down extends the selection, it threatens to delete code I didn't want deleted. Possibly especially bad when used with shift+pgdn, to select large chunks of code -- say, selecting a binary blob inside an RTF file.

I am generally in the camp of users who want very little extra help from their editor. I use ST as my 'do exactly what I say' editor. , where I can do -exactly- what I mean to my code. So I'd very much prefer it if ST didn't shift my selection start as I move the end, or insert brackets and quotes, or correct my indentation. I'm laying this out explicitly because I think there may be different camps of users, some who want automatic reformatting and helpful selections and such, and some who really won't like it. Me, I'm in the minimalist camp.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Line and multi-line selection

Postby atourino on Mon Sep 29, 2008 12:25 am

I have no problem if what I proposed is not the default as I know that not many people are used to that feature, but I find it invaluable. If you make it possible for me to make it happen somehow with rebindings it would be good enough for me. Cheers!
atourino
 
Posts: 15
Joined: Sat Sep 20, 2008 3:39 am


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], wmeldon and 36 guests