+6

Vertical selection toggle with alt/option

Kilian Ciuffolo ⚡_ 12 years ago updated by Johan Kåhrström 12 years ago 4
Alt/Option key should switch toggle standard/vertical selection just like textmate/chocolat/etc do.
Yes, this is the one remaining feature I miss from Textmate!  I wonder if it's possible to do this with a plugin?

Having not used Textmate/Chocolat, I'm not sure what you mean. 

Does shift+rightdrag perform the effect you're after?

If so, you could copy your Packages/Default/Default (OSX).sublime-mousemap into a new Packages/User/Default (OSX).sublime-mousemap file, then change the bindings to the way you like them. 

Though AFAIK there is no way to persistently toggle between selection-modes, you just have to use the correct modifier key/mouse button to use column selection mode.

+1

I also miss this feature from TextMate. Joel, shift+rightdrag does perform the effect, but since it is mouse controlled it is much less efficient than keyboard toggle.


One example case: I have a very long list of ids of objects in a data base table, like so


00001

00131

00144

...

63492


I would like to run a query looking only at these specific objects, which can easily be done like so:


SELECT *

FROM table

WHERE id IN ('00001', '00131', '00144', ..., '63492');


To do this, I would like to convert the list to


'00001',

'00131',

'00144',

...

'63492'


and then copy/paste into the query. With TextMate, this is very simple. I simply put the caret at the beginning of the first line, select all (ctrl+a), which also moves the caret to the end of the last line. Now I toggle to vertical selection, and move the caret with shift+left to the beginning of the end line, then press '. Now I have added a single citation mark at the start of each line, and it takes a couple of seconds to do. Repeat (with suitable modification) to add the end citation and comma to each line. Very fast.


With ctrl+rightdrag, I can accomplish the same change, but if the file is big it takes a significant time (minutes) to drag through the whole file.

+1

Update: Just found a way to accomplish what I want. It's not quite a toggle between standard/vertical selection, but pressing ctrl+shift+l splits the selection into lines, then with ctrl+arrow and ctrl+shift+arrow you can adjust the selection, which is close enough to TextMates vertical selection for me.