# Improved column selection (Alt+select) #5402

Open
opened this issue Apr 16, 2016 · 133 comments
Open

# Improved column selection (Alt+select)#5402

opened this issue Apr 16, 2016 · 133 comments
Labels
Milestone

### glen-84 commented Apr 16, 2016 • edited

 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).
mentioned this issue Apr 16, 2016

### dvlsg commented Apr 16, 2016 • edited

 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.

### IntelOrca commented Apr 16, 2016

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

### dvlsg commented Apr 19, 2016

 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?

### alexdima commented Apr 28, 2016 • edited

 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
added the label Apr 28, 2016

### dvlsg commented Apr 28, 2016

 Oh awesome! My apologies for missing it in the release notes -- thanks for taking the time to add the link, I appreciate it.
mentioned this issue Aug 8, 2016
mentioned this issue Sep 10, 2016

### nholthaus commented Sep 11, 2016

 #11830 may provide a more clear description of the expected behavior.

### IntelOrca commented Sep 11, 2016 • edited

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

### alexdima commented Sep 12, 2016

 @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

### nholthaus commented Sep 12, 2016

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

### alexdima commented Sep 12, 2016

 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
added this to the Backlog milestone Sep 12, 2016

### nholthaus commented Sep 12, 2016

 Cool. I'm not concerned at all if the shortcuts don't match, as long as the functionality could be accessible somehow.

### nholthaus commented Sep 12, 2016

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

### alexdima commented Sep 12, 2016

 We have had the report multiple times. It boils down to supporting customization of mouse shortcuts (#3130)

### IntelOrca commented Sep 12, 2016

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

### smuuf commented Sep 29, 2016

 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. 😞 ... 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-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! ❤️

### jminer commented Sep 30, 2016

 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.
mentioned this issue Oct 18, 2016

### Fania commented Nov 10, 2016 • edited

 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?

### rjmunro commented Jan 9, 2017 • edited

 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.
mentioned this issue Feb 21, 2017
mentioned this issue Mar 2, 2017

### glen-84 commented Mar 18, 2019

 just want to say, plz mention new features in more detail. Wasn't this enough detail?

### elijahgagne commented Mar 18, 2019

 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.

### glen-84 commented Mar 18, 2019

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

### elijahgagne commented Mar 18, 2019

 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

### lucasbasquerotto commented Mar 18, 2019

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

### JasonYan2015 commented Mar 19, 2019 • edited

 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.

### glen-84 commented Mar 21, 2019

 ... but I prefer using Ctrl to go to definition ... 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. Well, this does not tell me that I need another shift to make it happen. Oh, that's not good. 😐

### hhe commented Mar 27, 2019 • edited

 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!

### glen-84 commented Mar 30, 2019

 @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.
This was referenced Jul 22, 2019

### robertmiles3 commented Jul 22, 2019

 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. 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. With at least one column selected, all works properly regardless of what I let up first.

### robertmiles3 commented Jul 22, 2019

 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: VS Code puts the cursor on each line at the furthest character of the line where the selection started:
mentioned this issue Jul 22, 2019
This was referenced Oct 17, 2019

### barkermn01 commented Nov 22, 2019

 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?

### othyn commented Dec 3, 2019

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

### robertmiles3 commented Dec 4, 2019

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

### othyn commented Dec 4, 2019

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

### mbentley00 commented Dec 16, 2019

 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: Place the cursor at the start of a line (let's call this Line 3) Press Alt + Shift + Up so that you've selected 3 lines (Lines 1 - 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:

### PeterJeff commented Jan 14, 2020

 That sounds like a different issue @mbentley00

### keremispirli commented Mar 5, 2020

 @mbentley00 It seems to be resolved in v1.42.1

### kanlukasz commented Mar 5, 2020 • edited

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

### keremispirli commented Mar 5, 2020

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

### kanlukasz commented Mar 5, 2020

 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

### tytannial commented Mar 10, 2020

 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

### Felice-Enellen commented Mar 13, 2020

 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?

### gingerbeardman commented Mar 13, 2020

 It's their way or the highway.

### BHare1985 commented Mar 15, 2020 • edited

 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.