Some people who move from Visual Studio Code (VSC) to Visual Studio (VS) want to get VS to use the same key bindings as VSC, and there seems to be a way to do so.
I want to do the reverse. My main editor is VS, and there are some files that I want to edit on VSC, so I want the key bindings on VSC to behave like VS.
In particular, I'm interested in the rectangular, or multiline editing capabilities. In VS, I can Alt-Shift-Arrow to create a rectangular selection, which I find very useful:
I want to do the same in VSC. The closest I've found is the "multi-cursor" functionality, which kinda-ish sorta-ish works in a similar way:
However, there are two key differences with how VS works, which make it a bit frustrating to use:
Is there a way to get VSC to do rectangular selection, just like VS?
You may be able to hold the middle moues button and drag a rectangular area.
Or, move the caret to the desired anchor point for the rectangular selection, then, while holding shift+alt (windows/linux) or shift+option (macos), click the other corner of the desired rectangular selection.
See also the dedicated VS Code user docs for "Column (box) selection" and this post on superuser.com: Selecting columns in Visual Studio Code. Matt Bierner (one of the VS Code maintainers) has also made a video about the feature here.
You can also change the modifier using the editor.multiCursorModifier setting.
For keyboard-only usage, just use whatever keyboard shortcut is bound to the editor.action.insertCursorAbove and editor.action.insertCursorBelow keyboard commands to add cursors vertically, and then select horizontally with shift + arrow keys (and optionally other modifiers). To find out what keyboard shortcut you have bound to that keyboard command, search for it in the keyboard shortcut editor UI. There are other related keyboard commands, such as addCursorsAtSearchResults, editor.action.addCursorsToBottom, editor.action.insertCursorAtEndOfEachLineSelected, editor.action.addCursorsToTop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With