Improved column selection (Alt+select)
The column selection implemented in #1515 is a start, but it's a bit awkward and unintuitive compared to other editors.
With the following editors or IDEs, you can create a column selection starting from where the mouse is clicked/dragged:
- Atom (with Sublime Style Column Selection)
- Eclipse
- Notepad++
- Programmer's Notepad
- Sublime
- Visual Studio 2015
At least Eclipse, Programmer's Notepad, and VS2015 support virtual whitespace as well, creating a complete square/rectangle.
Some of them also don't show multiple cursors, which I think looks better.
Other users were also expecting this behaviour (see here and here).
You can knock the assumed off sublime, I can confirm it works that way. The shortcut isn't alt-click for me on windows, but the selection does start where you click.
This is our target behaviour, and hopefully possible when virtual space is supported.

Looks good to me, I think.
Is there any hope of support for multi-cursors that aren't necessarily next to each other?
For a contrived example, say I have JSON with integer values, but they really should be doubles. With multi-cursors, I can accomplish that fairly easily. Will this be possible with the proposed block column selection?

Today, the column selection is piggy-backed onto the multi-cursor support (i.e. it is logically represented and consists of multiple cursors). This makes it indeed behave differently than Visual Studio, for example.
That being said, with the exception of empty lines (virtual whitespace) we are not that far:

@dvlsg We have multi-cursors since v0.1.0. Please see https://code.visualstudio.com/docs/editor/editingevolved#_selection-multicursor
Oh awesome! My apologies for missing it in the release notes -- thanks for taking the time to add the link, I appreciate it.
#11830 may provide a more clear description of the expected behavior.
@nholthaus unfortunately I don't think this can be implemented until virtual space is implemented - that should probably be a feature request of its own.
@nholthaus From #11830
Most programs with column mode (visual studio/notepad++/kdevelop/etc) have the following user experience:
- hold the keyboard shortcut/toggle column mode.
- click somewhere. This is the selection 'start' anchor.
- drag somewhere. This is the selection 'end' anchor.
This is not how Visual Studio 2015 behaves for me:
- I click somewhere
- I press and hold shift + alt
- I click and drag somewhere else
- the anchor is the location before pressing shift + alt

@alexandrudima yeah but visual studio also has an alt button column mode that does what I described, which is the only one I'd ever use. Visual studio code doesn't seem to have the equivalent, or if it does it doesn't work on linux.
Oh, ok, we only added the shift+alt+ behaviour. IMHO we first need to make the mouse gestures configurable as alt+ clicking is occupied by adding a new cursor (a feature VS does not have) and then we can allow customizations of the modifiers + clicking and add this other way of column selection
Cool. I'm not concerned at all if the shortcuts don't match, as long as the functionality could be accessible somehow.
@alexandrudima Also (on Kubuntu) alt+click moves the window, it doesn't add a cursor. Does that sound like I should file a bug report?
We have had the report multiple times. It boils down to supporting customization of mouse shortcuts (#3130)
@alexandrudima do you intend to implement virtual space in the furture... e.g. hold alt and click somewhere where there aren't any characters yet still have a caret there? Typing then inserts the spaces up the caret automatically.
- Is there any specific reason why multi-cursor placing is mapped to ALT button instead of Sublime-like CTRL? I have a history with Sublime (as opposed to, eg., Visual Studio) and CTRL is more natural to me (I know
meis not an argument, but ...). Is this something that could be configurable? I don't see it in keybindings config. :disappointed: ... If ALT is something only Code does, then I would definitely vote for the quickest possible change to CTRL-behaviour, so there are as few people as possible who would have to re-adapt. - Is there any specific reason why block-selection mode is made with
SHIFT+ALT+LEFT-MOUSE-CLICKfingerbreaker instead of justMIDDLE-MOUSE-BUTTON? Just why? Give us theMIDDLE-MOUSE-BUTTON:) Or give us a configurable keybindings for this. (I, sadly, don't see any for this.)
I don't mean to nag :) ... I just wonder these questions every time I work with multiple cursors and block selections in Code. Having these features behaving like in Sublime (from which migrated to Code, mainly because of the debugging tools) would be such a workflow-booster! :heart:
Editors that could be added to the list are jEdit (it uses ctrl instead of the much more standard alt, but otherwise works the same as the other listed editors), Qt Creator, and IAR Embedded Workbench.
I think column selection should definitely use alt+click because it is the standard shortcut, and placing multiple cursors should use something else.
I'm piggy-backing this issue as I think it fits here.
I'd like to add that it would be nice to have column select respect (i.e. ignore) the wrapping of long lines of text.
I encounter this all the time in Latex - writing out a list of sentences and wanting to add the "\item" command in front of all of them but it messes up lines that wrap across the page.
And no, I wouldn't want to disable line-wrapping every time I want to use column select.
Does that make sense?
It would be good if I could alt-drag without shift.
In general, a drag means select and alt drag means select rectangle. alt-drag works in many other places including away from coding editors, e.g. MS Word & the default Mac OS terminal.
Shift-click means create a selection from the current cursor location to the mouse position. Subsequently dragging it can be used to make adjustments.
The two are separate things that can be used together, or one at a time. Shift-alt-click should start the rectangular selection from the current cursor position, which it does. Alt-drag with no shift should start a new selection from the initial click of the drag.
Any updates on this feature request ?
Because a long time notepad++ users like me find hard to neglect this feature !
Yes! I've been wanting the same thing for months. I want to be able to Alt + left mouse drag a rectangle without being affected by the cursor position prior to starting the drag, just like in editors like Visual Studio or Notepad++ or even Word and Outlook.