How do you select a range of lines in Visual Studio Code?

Since version 1.46 it seems like you can set an anchor and select from anchor to cursor: https://code.visualstudio.com/updates/v1_46#_accessibility

  • First set a selection anchor (default binding Ctrl+K Ctrl+B)
  • Then go to the line that you want, either by mouse or by Go To Line command
  • Then Select From Anchor to Cursor (default binding Ctrl+K Ctrl+K)

To cancel selection hit esc.


I had to delete lines starting from line number 17158 through 1644546 which was nearly impossible to do if I used scrolling. So I followed 4 simple steps:

  1. Go the line where you want to start deleting (17158 in my case).
  2. Using keyboard, press Ctrl+G which opens a box to enter the line number to go to.
  3. Enter the line number in the box (1644546 in my case). VS Code will take you to the line you wanted to go to.
  4. Hold the shift key and click on the line. Hopefully, this should select all the lines that you wanted to delete.

Click at the first column of the first line. Then scroll down to the last line that you want to select, HOLD Shift key and click on the last line.