VSCode multiline select - how to delete without removing blank lines?

1

1

VSCode has the ability to start a multiline selection via:

shift + alt + mouse drag

or

ctrl + shift + alt + arrow key

The problem is that when I'm working across lines of code with empty lines interspersed, if I backspace to remove code to the start of the line, the empty lines are removed with it:

enter image description here

becomes:

enter image description here

How do I get a 'column' selection (as I believe it's called) like with Notepad++'s alt + mouse drag / shift + alt + up/down arrow that operations purely horizontally across rows (which would preserve the new lines here)?

gb2d

Posted 2019-11-21T12:54:29.003

Reputation: 828

Answers

1

Answering my own question 'Q & A' style having done some more playing (I won't answer mine as the answer for now in case someone has a better solution or can explain this in better terminology):

I can achieve the desired behavior by starting a selection using:

shift + alt

... and then drag the mouse left or right to start a single line selection, AND THEN start dragging down ...

or by starting a selection using:

ctrl + shift + alt

... and using the left / right arrow key to start a single line selection, AND THEN use the up / down arrows ...

I then get a column / box selection that will not operate on the blank lines in my example above.

Note that (maybe only in my scenario above) I need to start the selection a few characters in to get the column / box selection - starting on the far left doesn't work so well.

This doesn't feel very intuitive at all, but VSCode seems worth it so far!

gb2d

Posted 2019-11-21T12:54:29.003

Reputation: 828