Multi-line selection in VS Code

Asked

Viewed 27,125 times

12

Is there any way to make multi-line selection in VS Code, the way it is done in Sublime and other IDE’s?

I tried the ALTSHIFT + arrow that works in Visual Studio, but instead of selecting multi-line the VS Code or selects the line (right arrow) or copies the line (down arrow).

  • https://stackoverflow.com/questions/30037808/multiline-editing-in-vscode would that be? Ctrl+alt + arrow

  • @Gabrielheguedusch Ctrl + alt + arrow on Windows rotates the screen.

  • there is configuration... I am with the W7 and by chance my screen does not rotate, and the command works in the right way.

4 answers

13


This can be done using the combination Alt + Main mouse button.

This will create a cursor per line clicked, holding the mouse button and dragging to select, allows selecting multiple lines.

Or else, you can use the combination Ctrl + Shift + Alt + ( or or or ).

Where, the up and down arrows are used to go up/down lines and the left and right arrows to select part of the text for the respective side.

Seleção multilinhas no VS Code

  • +1, but has how to do without mouse?

  • @Renan was looking for this, I just edited.

  • Works even better than in Visual Studio, thanks!

7

In the VS Code select the tag and use the keys Crtl + D. That he will select the tags below each touch on D.

inserir a descrição da imagem aqui

  • Ctrl+D selects only a pro up occurrence of the same word, this is not Multi Line selection as prompted in question, this does not answer the question

4

I will contribute these 4 ways to select lines independently using mouse clicks and some keyboard shortcuts.

Option 1

The first is holding Alt and clicking 3x in some line character (the first click marks the cursor, the second click selects the word and the third click selects the phrase)

inserir a descrição da imagem aqui


Option 2

In this option pressing Alt you click on the lines you want to mark, then press Ctrl+L and will select the entire line

inserir a descrição da imagem aqui

Shortcut Ctrl+L inserir a descrição da imagem aqui


Option 3

In this option pressing Alt you click at the beginning of each row you want to select and then press Shift + End

inserir a descrição da imagem aqui


Option 4

Pressing and dragging the Wheel Button mouse (just press and drag the mouse scroll wheel)

inserir a descrição da imagem aqui

0

Dude, I believe what you’re looking for is to turn a block selection into a multi-line selection, right?

What you can do is:

Windows:


1. Select the text you want

inserir a descrição da imagem aqui

2. Pressing the keys Ctrl + Alt + Shift +

At this point, you will already have your block selection, transformed into multi-line selection.

To select all lines from start to finish, just press the button Home and then press the keys Shift + End

At this point, you will have the complete selection of the lines, individually, as in the image below:

inserir a descrição da imagem aqui




Macos:


1. Select the text you want

inserir a descrição da imagem aqui

2. Pressing the keys command + option/alt + shift +

At this point, you will already have your block selection, transformed into multi-line selection.

To select all lines from start to finish, just press the button command + and then press the keys command + shift +

At this point, you will have the complete selection of the lines, individually, as in the image below:

inserir a descrição da imagem aqui




I hope I’ve helped :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.