Vscode: Improved column selection (Alt+select)

Created on 16 Apr 2016  ·  150Comments  ·  Source: microsoft/vscode

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).

editor-columnselect feature-request

Most helpful comment

This is our target behaviour, and hopefully possible when virtual space is supported.

vs

All 150 comments

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.

vs

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?
multi-cursor-select

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:

column-select

@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:

  1. hold the keyboard shortcut/toggle column mode.
  2. click somewhere. This is the selection 'start' anchor.
  3. 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
    shift-alt-vs

@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.

  1. 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 me is 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.
  2. Is there any specific reason why block-selection mode is made with SHIFT+ALT+LEFT-MOUSE-CLICK fingerbreaker instead of just MIDDLE-MOUSE-BUTTON? Just why? Give us the MIDDLE-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?
columnwrap

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.

@nholthaus Yes, Ubuntu has this problem with Alt+Drag movement of windows, and it was a big pain for me too. I haven't heard about the same type of interaction anywhere else, so it's likely an issue for Ubuntu.

@smuuf You make a very good point! Shift is supposed to select ranges, Ctrl is supposed to add items to selection. This is the most expected behaviour, and VSCode _must have_ implemented multiple cursors with Ctrl. That'd better be fixed soon, because otherwise POLA would be already broken by non-compliance to legacy behaviour, and VSCode would go in the nice list of Vim and Emacs. But that's, probably, another issue.

Also there's a good reason Ctrl+Shift+C is rarely bound in any of the editors: Shift and Ctrl+C are often pressed in short succession, and there's a good chance to press Ctrl+Shift+C. On VSCode under Windows it opens console window, that is even impossible to close with Alt+F4.

I would also appreciate a proper column select, as well as the current column select (along with other key+click type actions) be configurable via keybindings.json

Being able to do column selection via the middle mouse wheel is literally whats keeping me from making VS Code my main editor.

it is interesting to create a function for sum in column mode, just like in uestudio

Any news on this? Tried latest version of VS Code, and indeed box selection works... BUT there's the major drawback that we have to click before we press the shortcut to set the box selection start location. Super annoying! 😠

As others have mentioned, I would expect:

  1. hold the keyboard shortcut/toggle column mode.
  2. click somewhere. This is the selection 'start' anchor.
  3. drag somewhere. This is the selection 'end' anchor.

It has to be Alt+drag, where the start point is wherever the drag started and the end point is wherever the drag ended. It's so common and so irritating on a regular basis that VS Code is weird.

I know I'm late to the party here, but I would love to be able to use the middle mouse button.
click to set start position, drag to select.
I'm not a fan of this three-step process, it feels awkward and I'm having a tough time being productive with it. I keep switching to ST2 frequently whenever I need to do text wrangling.

@dasDaniel You're not late to the party. Issues on github need regular messages in them, otherwise they tend to be closed for "lack of support". This is a hot issue for 2 years, and it's a shame nobody's concerned. It doesn't even have a "bug" tag yet. We still need more people who are late to this party.

I really want to use visual studio code but this is the only thing stopping me. I use alt+select a lot in a number of text editors and IDEs and visual studio code's inconsistent implementation is much to cumbersome to get used to.

Though its not super ideal i found a bodge for this in Sublime text.
https://www.granneman.com/webdev/editors/sublime-text/packages/how-to-install-and-use-sublime-alignment/
this is how i'm using it to add mass comments to python code:
1)middle mouse to select the end of the lines that i want comments on.
2)with the delimiter set to "#" i use the alignment package.
3)if needed i use the middle mouse to select behind the "#"s and add more tabs

masscommentsublime

I too vote for middle button column selection. Coming from SubLime and doing a lot of text manipulation this is definitely essential.

Column selection was mentioned in the roadmap:
https://github.com/Microsoft/vscode/wiki/Roadmap#editor

I also throw my vote in there. Middle mouse button column selection in sublime is very productive. Would love to see it in vscode.

Sublime user here, trying out vscode for the first time. I’m finding a lot to like in vscode, but the wonky column select behavior is a real turn-off.

I migrated TextMate > Atom > Sublime > VSC

VSC is the only editor I've used that is missing this kind of block select using Alt+mousedrag.

Also coming from an editor (Webstorm) where I used to abusively alt+click+drag to perform multiline edit.
It seems totally essential for me now.
I don't think there is a better choice between "ctrl" or "alt" for the key. But at least I think it should not be a combination as "shift+alt".
I would love to see this feature coming really soon !

It is absolutely a must that VS Code implements Alt+Drag for box selection. Any respectable editor has this feature, and this has been requested as far back as 2015.
Shift+Alt+Drag comes close, but it places the anchor at the current caret position instead of the initial click position like it should and is expected to. Plus, it's very cumbersome to require an additional key for such a simple feature.

It seems like the team may not realize how many times a day we use this feature in other editors and what impact the half-baked implementation is having.

Even the file editor on the GitHub website supports alt+drag block selection better than VS Code.

Come on Team VSCode!

screen shot 2018-03-13 at 09 59 53

I straight up deleted this program because of this. I really liked everything else, but it felt like trying to write code in word or something.

@TarAlacrin To be fair... Word has Alt+drag select. 😜

@TarAlacrin To be fair... Word has Alt+drag select. 😜

Shots fired!

+1. Real pain coming from Sublime Text. :-(

+1, hopefully we get to see this feature soon

I actually just switched to Sublime Text today for this issue.

It seems most of this discussion has been around mouse box selection, but what about keyboard box selection? I assumed VS Code would have functionality similar to VS. i.e. use alt+shift+arrow key. You can customize the VS Code keybindings as described in this SO post to get a clunky version of this functionality, but I expected the functionality to be native and work the same way it does in other apps (e.g. Visual Studio, Notepad++).

Even macOS Terminal does this properly.

@gingerbeardman Yep, looks like we're going to get it. Two years since this was requested 😃

Fingers crossed

I'll believe it when I use it @EduardJS

screen shot 2018-04-24 at 11 56 27

It's no longer on deck – it's in the backlog.

Looks like the latest release allows middle-click dragging. While this doesn't address the original request to use with Alt, I'm glad to see the middle button multi-column selection working

image

I think two easy changes to make this work more as expected are:

  1. move cursor to click location if column modifiers are held
  2. change column mode modifiers

Surely not much work at all? If I knew where to look i'd create the PR myself. Any hints?

While what was done is useful, imagine trying to select all the line endings. Check out sublime, and drag the middle mouse over the end of each row.
It simply selects all line endings, which is very useful in a lot of cases.

An workaround as of now is to do the same with only the first char on all lines, and then use the keyboard arrow to go back to the previous line end.

On 4 May 2018, at 11:14, Matt Sephton notifications@github.com wrote:

I think two easy changes to make this work more as expected are:

moveTo(cursor, x, y, false); // click location when column modifiers are held
change column mode modifiers
Surely not much work at all? If I knew where to look i'd create the PR myself. Any hints?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/5402#issuecomment-386533358, or mute the thread https://github.com/notifications/unsubscribe-auth/AHWwZeI-pUciEmRh9CMlGFcxhdrEF_USks5tvA4DgaJpZM4IJBQn.

@EduardJS you can achieve this by selecting the lines you need, then typing cmd+ (or cmd+ for beginning of line).

Yeah, kind of the same workaround, but, wouldn’t it be intuitive to just do the middle button drag they have just added at the end of the lines and work just as intended ?

Maybe I’m nitty gritty here, its just how I used it in all previous editors.

On 4 May 2018, at 11:49, Jan Baykara notifications@github.com wrote:

@EduardJS https://github.com/EduardJS you can achieve this by selecting the lines you need, then typing cmd-rightarrow (or cmd-leftarrow for beginning of line).


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/5402#issuecomment-386540521, or mute the thread https://github.com/notifications/unsubscribe-auth/AHWwZYBEF4ruf_Uo1iNWsa_8XoOb9mWEks5tvBYSgaJpZM4IJBQn.

This was very disappointing to come across.

Is there no way to implement or override to "standard" functionality of ALT + drag??

Notepad++:

npp-multi-select-3

VSC:

vsc-multi-select-3

I dragged the mouse in pretty much the same area on both - I expected the text to appear in the same area. Also, lines were just skipped entirely. The April update didn't address the issue at all. I'm not bothered about what the shortcut is - alt+LMB or MMB, but am bothered that it works.

This is selecting in again the same general area (starting in the include guards and moving down), but with alt+shift+LMB:

vsc-multi-select-0

I don't even know what that is meant to be!

+1... I love a lot of things about VS code, but I use ALT-drag column select a lot in many other editors and having it not present/not work the same way in VS code is currently a deal breaker :(

sorry if i am missing something, but after two years of people complaining about this issue, how is it possible that the key combination for column selection in vscode has not been made configurable?

all i want, and it seems like all many people in this issue are asking for, is to be able to trigger column selection with alt-drag instead of shift-alt-drag.

that can't be a thing, can it?

It's not just the key combination, what's there isn't really what other editors implement per se. It needs some actual work as discussed earlier in the issue.

It's not just the key combination, what's there isn't really what other editors implement per se. It needs some actual work as discussed earlier in the issue.

not saying it doesn't need other work, but being able to use a familiar key-drag combo to get what there is now would be an improvement and it should be cheap.

not saying it doesn't need other work, but being able to use a familiar key-drag combo to get what there is now would be an improvement and it should be cheap.

The issue is what is in there right now (shift+alt) is kind of related to a "different" feature, so ideally what this issue is asking for is not to convert that feature into the more common Alt+drag box select, but rather to implement the Alt+drag version in addition.

I agree with the general sentiment that I'd love to see any progress on this though :)

The issue is what is in there right now (shift+alt) is kind of related to a "different" feature, so ideally what this issue is asking for is _not_ to convert that feature into the more common Alt+drag box select, but rather to implement the Alt+drag version in addition.

ah so. Got it.

still wouldn't hurt for there to be a settings config for the modifier key for both current and whatever future additional behavior may be added.

+1 million. :) Just make it work like Sublime and others. I think that's what everyone really wants. Make it more standard instead.

Notepad++, Sublime, UltraEdit, even MS Word and Outlook all support ALT+Drag

Maybe I have something amiss in my settings but SHFT+ALT+Drag doesn't work for me (latest May update). I have to use CTRL+SHIFT. Even then, the select doesn't start where I click. It starts where the cursor was. So if the cursor is at the bottom of the screen and I want to select something at the top, I have to click where I want to start, release, then CTRL+SHFT+Drag. It bit nit picky but ... :)

In the words of someone famous and wise, "Give me alt+select, or give me death."

@nholthaus I used kubuntu 18.04, it's best to change Drag Window from Alt + Drag to Meta + Drag.

Window Behaviour > Window Action > Inner Window

image

+1 on box selection (similar to notepad++), it can be a separate hotkey, whatever, but it's really sad that it isn't in because I am doing my best to like the editor :(

I suppose virtual whitespace needs to exist before this can be achieved?

Holy shit, open thread for more than 2 years with very experienced coders complaining they don't have a critical tool to perform efficiently, and the VS team don't even comment (basically ignore this thread) and go on doing other things. That's what happens when you got so much cash than you don't really care about your users.

Can't believe that's the same thing happening with virtual spaces that would make me switch to VS code in no time. Opened for 2 years... (https://github.com/Microsoft/vscode/issues/13960)

Can someone please smack whoever is responsible for product prioritization here?

@jchatel at least it got “acknowledgement” lol.

Thats one less step :)

I acknowledged your reply @EduardJS

lol

@jchatel Embrace, extend, and extinguish

Solutions :

  1. buy linked in
  2. buy github

Ah someone just told me it does not work as intented for Oracle with mysql .
Management from the 90s does not have finish sudying yet...

Is it possible to do this with a plugin or something?

Funny thing is with the latest releases the terminal window will do column select with ALT + Click.

Integrated Terminal

Column selection

Column selection is now supported within the Integrated Terminal via Alt+click.

This does actually already kinda work in VSCode text editing: cmd-shift click drag. I think the most annoying thing is that it's just not the conventional alt-click like in every other editor.

screen shot 2018-08-21 at 08 48 39

@janbaykara it doesn't work the same as in other editors (including, but not limited to, position of cursor and columns extending into virtual white space), which is the point of this issue "improved column selection"

@gingerbeardman yeah roger.

CTRL+SHIFT CLICK DRAG works on Windows as well. What I don't like is say the cursor is at the bottom of the screen and you CTRL+SHIFT and lick on something towards the top. Your selection starts from where the cursor is at the bottom not where you clicked. IMO, the cursor should relocate to where you start your click to start your selection.

I agree, if I'm dragging and having live response, I would like to see the selection start where I clicked, not where the cursor was before I started.

Other than that I'm pretty happy with the feature, and I found I was able to live without it for 2+ years.

Bump! Please fix this issue. This was by far my favorite feature of other text editors and this is a deal breaker for me.

IMO, the cursor should relocate to where you start your click to start your selection.

Amen, @boeningc! If I don't get this feature I will probably just curl up in a ball in the corner and starve to death. I can't handle not having it.

Having said that, I love VSCode, so thank you VSCode team! 👍

This absolutely has to happen. Please fix.

+1, this is such a useful feature to have and something Notepad++ does perfectly.

Also, can we not _lock_ tickets like #28757 ("Vertical Selection via Alt + {Mouse Select}") indiscriminately? The answer given was completely not was asked for, and there's no way to indicate where to find the duplicates (aka this ticket) since replies are locked to collaborators only.

@CheetahChrome if you are out there, you're not alone brother...

This situation is like nails on a chalkboard for me. The indiscriminate close felt like a slap in the face. Thx.

You can get box-select with Ctrl+Shift -> Drag. But what I can't figure out is how to get box-paste. It inserts new lines at the point of paste instead of pasting over existing lines. Does anyone know if this is possible?

It is not possible, because VS Code still ignores the integrity of an essential feature such as column selection.

This is the one of two issues that is preventing me from moving away from a dying product... PowerShell ISE.

Honest question: Is there a way I can see if the VS Code team even plans to address this? How do they decide what to work on? Is there a roadmap? I know the decision is greatly impacted by number of thumbs up, but that's it. Instead of pinging this issue over and over which is not helpful, I'd like a way to see when this will be addressed, to ease my impatience.

@rcdailey
https://github.com/Microsoft/vscode/wiki/Roadmap (out-of-date by a year)

Happy Coding: At its core VS Code is a lightweight, keyboard focused, multi-language code editor. VS Code is already pleasant to code with, and we want to make the experience even more pleasant, for both new and existing users.

Yet they ignore this one feature that makes the editor so unpleasant to code in, as well as internationalisation and character set support issues.

https://github.com/Microsoft/vscode/wiki/Iteration-Plans (current)

"Good luck with that"

has anyone found a way to column select by dragging (on Mac OS)?

It doesn't matter to me which keys are involved. Although I'm used to either shift + control + drag or control + drag or alt + drag

EDIT: ahh jk, shift + command + drag is working!

h/t: https://superuser.com/questions/1052795/selecting-columns-in-vs-code#comment2045631_1168023

I have a mouse with a wheel and when I hold it down and drag down and across it selects columns and gives multiple cursors. I can't find a setting for it so it looks like it is built-in? I am fairly new to vscode so might be missing the setting.

One more vote here to replicate the Visual Studio experience for "Alt-" click and "Alt-" drag including block, vertical selection and _also placing the cursor and / or the selection out to the right_ past end of line, cleanly and in a vertical line, not ragged with the existing text. To try this open a text file in Visual Studio and alt-click or alt-drag in the area to the right of the text. The new product should just keep that feature.

Baffled code doesnt have this fundamental thing thats going back to msdos.

Thanks @janbaykara. On my windows machine, this works with ALT + SHIFT + Click .

It still behaves differently from the terminal, as it starts the selection from the current cursor position.

3 YEAR anniversary of this issue on 2019-04-16 🤦‍♂️

@gingerbeardman - Take a look at pull request #66445.
And issue #66444 - Resolve the column selection conversation

Great! Now we just need virtual whitespace and maybe we can finally close this. :)

I think this reply illustrates what virtual whitespace means in practice: https://github.com/Microsoft/vscode/issues/5402#issuecomment-210905314

ie. selection expands on to areas that have no text

Changing the Multi Cursor Modifier to ctrlCmd breaks the ability to Ctrl+Click on a symbol to view its definition.

Changing the Multi Cursor Modifier to ctrlCmd breaks the ability to Ctrl+Click on a symbol to view its definition.

@glen-84 is that a separate bug or not?

Is there a separate issue for virtual whitespace someone can link to? Or is
that being addressed here?

On Fri, Mar 8, 2019, 7:49 AM Matt Sephton notifications@github.com wrote:

Changing the Multi Cursor Modifier to ctrlCmd breaks the ability to
Ctrl+Click on a symbol to view its definition.

@glen-84 https://github.com/glen-84 is that a separate bug or not?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/5402#issuecomment-470934169,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr6dkQbNf7GRggYBlliUMSg2653rUxwks5vUmp_gaJpZM4IJBQn
.

@rcdailey there isn't one as far as I can see using issues search. Also, nothing is being addressed here by the official developers as they seem uninterested in this area. The only progress we've had IIRC has been from external developers pitching in.

@rcdailey #13960

Changing the Multi Cursor Modifier to ctrlCmd breaks the ability to Ctrl+Click on a symbol to view its definition.

@glen-84 not sure which arch you are on, but on Macos, when I changed to crtlCmd to get the new column selection behavior, it also broke Cmd+Click on a symbol to go to its definition, but now if I Alt+Click on it, it does what Cmd+Click used to.

@gingerbeardman,

@glen-84 is that a separate bug or not?

No, it's not a bug. See below.

@pjv,

Ah, you're right. It's actually documented in the setting description:

The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier.

I'm quite used to using Ctrl + click for Go To Definition and Open Link though. TBH, I'd prefer:

  • Alt + click -> Column selection.
  • Ctrl + click -> Go To Definition and Open Link
  • (something else – maybe Alt + Shift + click?) -> Multi-cursor.

3130

Middle mouse button may be considered ergonomic, but was it really so difficult to think up to set the box/column selection to RMB dragging? As Atom's package have from the start.
Not so big % of mouses can handle extensive wheel's button usage. And key+[_]MB is needed only for click-select if the RMB are assigned to the command.
And to note, the selection still resets after try to open context menu on it..

maybe Alt + click could work on windows.On my MBP, I tried control, option and even command to get the new column selection behavior.But I failed and didn't know why.
I didn't know how to do it until I googled it.(still could not find it on updates)
just want to say, plz mention new features in more detail.

@JasonYan2015,

just want to say, plz mention new features in more detail.

Wasn't this enough detail?

I'm on Windows and I haven't been able to figure out how make Alt + click work. I think the release notes had good detail, but it's not obvious to make what to change to enable the new functionality.

@elijahgagne,

It literally says to set editor.multiCursorModifier to ctrlCmd – that's all there is to it.

Thanks. I suspected it was that simple, but hadn't found the right place to make that change. I found https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations, and now see that on Windows it's %APPDATA%\Code\User\settings.json

@elijahgagne You can open it clicking in the Settings icons at the bottom left of the window (or File -> Preferences -> Settings, you don't need to go to where the file is located in your machine). You can search for multiCursorModifier and change the setting. You can toggle between UI and text (JSON) clicking in the icon at the top right of the editor with curly braces ({}) if you prefer to edit it as text.

@glen-84 If I define it as ctrlCmd it works, but I prefer using Ctrl to go to definition (and it may break other stuff like people said above), but defining it as Alt doesn't work (I can place multiple cursors, but can't select like when defining as ctrlCmd, maybe some conflict with other shortcuts).

For now I'm letting it as Alt and selecting by pressing the mouse wheel, like on Sublime Text (fortunately, the mouse wheel works in both cases).

just want to say, plz mention new features in more detail.

Wasn't this enough detail?

Well, this does not tell me that I need another shift to make it happen.

@lucasbasquerotto,

... but I prefer using Ctrl to go to definition

I do too.

... and selecting by pressing the mouse wheel

Oh, that's quite useful. I'd still prefer Alt + click, but I'll probably also use this for now.


@JasonYan2015,

Well, this does not tell me that I need another shift to make it happen.

Oh, that's not good. 😐

Well, this does not tell me that I need another shift to make it happen.

Sounds like you're referring to the Shift + Alt command which starts from the text cursor (thanks for the clarification glen-84)

~It appears that when Multi Cursor is set to Alt, column selection is Shift + Alt.~
When Multi Cursor is set to ctrlCmd, column selection is Alt (and links are Alt+click?).

Ideally the docs would mention this.

More importantly: a good design does not make one shortcut silently depend on another, just to avoid collisions. Every other editor lets you configure each shortcut explicitly and tells you if there are collisions (or prevents you from setting the latter if a collision would result).

I'm glad progress is being made though!

@jhe-,

It appears that when Multi Cursor is set to Alt, column selection is Shift + Alt.

That column selection is different though – it starts from the text cursor instead of from the mouse cursor.

I think there might be a small bug with this. With my multi-cursor set to ctrlCmd, I can now alt-select just like Sublime, however it operates differently based on whether you have an actual column selected or not.

With no column selected (drag straight down), if I let up the Alt key first and then let up the mouse click, then the cursors stay properly.
code3

With no column selected (drag straight down), if I let up the mouse click first and then let up Alt (which seems to be my brain's default), then the selection disappears.
code1

With at least one column selected, all works properly regardless of what I let up first.
code2

Another annoyance that would be a nice fix is when block selecting past the end of lines. I often do this to put a cursor at the end of each line.

Sublime works great by putting a cursor at the end of each line as I block select past the end of the lines:
sublime

VS Code puts the cursor on each line at the furthest character of the line where the selection started:
code1

Ss part of this we need a method to control the key because as mac users are used to using Control Key, Windows users are used to using Alt, and VSCode used Alt+Shift.

So please give us a method to set this, even if it's just an option somewhere in the setting to choose between the three options?

@robertmiles3 any solution to this yet that you've discovered? Its a real behavioural annoyance for me!

@othyn I think the first thing I posted might be fixed. But the second one (end of line) is not. It's still a major annoyance to me.

@robertmiles3 Damn... well that's an annoying annoyance! I'm still having an issue with the first one too, both of which are an annoyance coming from sublime.

It's a little hard to tell from this very long thread, but is there a plan to make Alt + Shift + Arrow work more uniformly compared to Visual Studio? The specific case that VSCode handles differently is:

REPRO:

  1. Place the cursor at the start of a line (let's call this Line 3)
  2. Press Alt + Shift + Up so that you've selected 3 lines (Lines 1 - 3)
  3. Press Alt + Shift + Down

RESULT:

Lines 1-4 will be selected

EXPECTED:

Only Lines 2-3 should be selected. This behavior would match what Visual Studio, Notepad++, SQL Studio, etc. all do. It also more closely matches how text selection in general works.

Here's a video comparing the bad VS code behavior and the good Notepad++ behavior:
record_000009
record_000010

That sounds like a different issue @mbentley00

@mbentley00 It seems to be resolved in v1.42.1

If you select a column with the mouse and release the mouse button first, the selection will disappear. So it still not working properly

@kanlukasz I was referring to the latest message just above, it is not about mouse, only keyboard.

About the issue you mention:

  • I tried dragging with Shift+Alt+LeftClick then releasing the mouse button first, and in my system the selection stays.
  • I tried MidClick with and without Shift+Alt and the selection stays in both cases.
  • Dragging with Alt+LeftClick doesn't do box selection at all in my case.

What is the version of your VS Code?

Sorry, I thought you were writing in general

If we talk about my issue, I can do this with Alt+LeftClick beacuse i set "editor.multiCursorModifier": "ctrlCmd"

My env: Version: 1.42.1 @ Win10

Column selection and copy from visual studio to vscode is easy. But how to back.
Column selection copy from vscode to visual studio, VS can't handle that.😭

Version: 1.43.0

My mind boggles at the fact that a feature as important to people writing code as this is still on the backlog after multiple years and pages and pages of unhappy people wanting it done.

What needs to be done to get this prioritized? Is anyone involved in VSCode dev even watching this issue anymore?

It's their way or the highway.

I've been using Visual Studio for 5+ years. Finally decided to try out VScode for a php project and the fact alt+drag doesn't work the same drives me nuts. I still can't figure out how to use it properly and had to google (that's not good if you want high adoption!) but eventually I found it easier to just copy and paste the code to notepad++ and use it's alt+drag to do what I needed.

Agreed... incredible this isn't in a milestone yet!

still can't switch from notepad++ because this feature is not available.... what's taking so long!

The problem here is that they're trying to emulate column select with multiple cursors. They aren't the same thing. VSCode needs to handle column select the way it's supposed to work, completely separate from the multiple-cursors feature, which is useful in its own way, but absolutely sucks at emulating column select properly.

Just write a freaking column-select feature from scratch! Or adapt it from Visual Studio, where it works great! It'll be an effort, yeah, but it'll actually WORK, whereas trying to half-ass it with multiple cursors is just a cursed idea that needs to be discarded.

Proper column-select is VITAL to any experienced programmer—y'know, the kind of person who writes the stuff that VSCode is named for?

I've started using Notepad++ again. VSCode has a lot going for it, but this is like riding an amazing bike that has a thumbtack glued to the seat.

Regarding this topic, I've posted a feature suggestion on Visual Studio's Developer Community.
Feature suggestion: Multiline selection snapping on each individual line
If I missed an important detail, feel free to let me know.

@Rowan-Mulder see https://github.com/microsoft/vscode/issues/5402#issuecomment-210905314 for virtual whitespace behavior

@Rowan-Mulder I think it's ironic that you're trying to get a feature implemented in Visual Studio that VSCode already implements, whereas this feature request is about trying to get a feature implemented in VSCode that Visual Studio implements. However, I don't see the two features as related.

@Rowan-Mulder I think it's ironic that you're trying to get a feature implemented in Visual Studio that VSCode already implements

EDIT: I must have confused my many tabs yesterday looking for conversations regarding this topic. There was a conversation about Sublime Text/Jetbrains products ways to handle selections and looking for ways to implement such a feature to Visual Studio.

I understand the block-selection has already been implemented, but my intentions were to expand from this implemented feature. My apologies.

Hey guys,
I would really love your help!

I'm using VS code and by accident I pressed some keys and somehow the scroll wheel of the mouse is selecting text rather than scrolling the page up and down. I feel like the mouse wheel press is acting like pressing the "alt" key.

I've tried deleting VS code and deleting extensions and such and it didn't work. The problem persists only in VS code.

Is that problem familiar to you?

Do you know how to fix that?

@Orisil1809 this is not the place for support issues. Try StackOverflow or this Microsoft page (select Developer Tools > Visual Studio Code)

cf. https://code.visualstudio.com/docs/supporting/FAQ

I've tried both ways. Unfortunately no help from both.
I really tried reaching out to many places before I got here.

It seemed to be a similar discussion to my issue. Please if you can help!

@Orisil1809 I've replied to your StackOverflow question

(@othyn @robertmiles3 About the end-of-line positioning, can you not just press End after selecting? That would deselect the regions and put the cursors at the ends of the lines?)

@tmewett yeah, the way I get around it at the minute is to always highlight the beginning of the line and just use the word/line skip arrow key modifiers to alter the selection. That being ALT + [Arrow Key] for word and CMD + [Arrow Key] for line start/end.

However, what was really easy to do in Sublime and saved frustration was the ability to place the cursor anywhere on the right side of the document, drag down and have the end of each line selected. It made multiline line selection super quick and easy. With the above work around, I still have to be really careful with cursor placement.

You can see the example of what I mean as outlined in an earlier reply to this thread. See: https://github.com/microsoft/vscode/issues/5402#issuecomment-513819635

It's knit-picking I know, but when you get used to a behaviour which makes sense, its hard to not yearn for it again. Its probably my _only_ gripe with VSCode!

I've installed the extension Sublime Text Keymap and Settings Importer on Visual Studio Code and it came with this feature.
It's not the real solution, but it is an alternative

That comes as a pre-installed extension if you select the Sublime keymap when using VSCode for the first time. Sure, it applies the _keymap_, but it does not apply the expected selection behaviour as seen in Sublime, which is what this issue revolves around.

The issue is a little mixed to be fair. Half the people are talking about the selection behaviour, and thus virtual whitespace, which is what the original issue was about. However, a lot of the comments are about the key mappings for doing so. To me having to press slightly different keys to do it seems like a far less important issue than being able to block select in the first place, but maybe that's just me. Even the start point of the selection (click position vs current cursor position), which is another thing frequently mentioned, can be configured, extended, worked around, or learnt once the core problem is solved.

Its getting ridiculous that such an important editor-functionality is after 4 years of being an issue still not fixed/implemented/solved or misunderstood.
I just cant use vscode like it is.
Its weird that notepad++ still beats it for me, whereas vscode is a much proper solution for most needs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsccarl picture vsccarl  ·  3Comments

philipgiuliani picture philipgiuliani  ·  3Comments

sijad picture sijad  ·  3Comments

lukehoban picture lukehoban  ·  3Comments

DovydasNavickas picture DovydasNavickas  ·  3Comments