How to copy lines up and down with shortcut in VS-Code Pro Preview

The only reason we use specific text editors over others is that they allow us to perform certain operations a lot faster. Visual Studio Code does not fall behind in this regard and it gives us a plethora of commands that we can execute using key combinations.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1558
  • 06 Mar 2020

Move the text cursor to the line you wish to copy, hold down the keys Shift and Alt, and press the up arrow key. This will copy a line and place it above the copied line. If you press the down arrow key instead of the up arrow, the line will be placed below it.

Copying multiple lines

This key combination can be used to copy more than a single line. You must simply mark all the lines you wish to copy before you use it. Be careful for up to where you mark your code. Marking a single character on a line is enough to copy the whole line.

Usage peculiarities and mistakes

Here's an example of a common mistake:

motor_speed = 500 
Motor(Port.B).run_time(motor_speed, 3000, Stop.COAST, False)
Motor(Port.C).run_time(motor_speed), 3000, Stop.COAST, False)

In this example, there is a marked space in front of the number 500 and this means that the line with the "motor_speed" variable will also be copied.

Where the command can be found in the menu

This command can be found in the "Selection" menu and the key combination for the command is right next to it:

content picture

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 1
  • 74
  • 28:18
  • 114