visual-studio

Selecting a "block" of text in Visual Studio


I'm wondering if there's a way to select a block of text in Visual Studio, similar to vim's visual block mode (pictured below, achieved with <C-v>5j20l). This can also be done in VSCode using a middle click and drag.

A 20x5 visual block selection in vim

I'm aware that a similar but distinct effect can be accomplished using Shift+Alt+Up/Down to create multiple cursors and then Shift+Left/Right to highlight from each of them, however the shape can become warped when encountering shorter or blank lines, becoming no longer a quadrilateral and highlighting the starts and ends of some lines.

I've looked around online, but only found suggestions on how to select around a syntactic block of code (i.e. around {}, like vim's va{ or VS's Ctrl+Shift+Left/Right when the cursor is over a brace). Much of what I've found isn't even for Visual Studio, but rather for VSCode.

Is it possible to create a visual block selection in this way in Visual Studio?


Solution

  • Press ALT and drag and select the block with the mouse.