CodeAlchemy

Jotting one man's journey through software development, programming, and technology


Project maintained by pablogarciaprado Hosted on GitHub Pages — Theme by mattgraham

◀️ Home

VS Code

Cheat Sheet

A collection of useful VS Code shortcuts to boost your productivity.

Move lines up and down

Click (or select) a line (or lines), then type:

option () + arrow key ()

Duplicate lines up and down

Click (or select) a line (or lines), then type:

option () + shift () + arrow key (⬇️)

Select multiple lines at once

option () + mouse-click

Select the next repeated instance of a text

Select a specific text, then type:

command () + D

Select the all the repeated instances of a text

Select a specific text, then type:

command () + shift () + L

Search files by name

command () + P

Search and run a command

command () + shift () + P

Comment multiple lines at the same time

command () + shift () + /


Clean Terminal Setup

Clean Run Execution

Every time you run Python code, the terminal will clear first, so you always see fresh and clean output.

1. Set a default terminal

default terminal

2. Install ‘Code Runner’ extension

Code-runner

3. Edit the ‘Executor Map’ file

Code-runner: Executor Map

4. Find the "code-runner.executorMap": {}, and the languages you will be coding in.

This setting in VS Code is used by the Code Runner extension to define custom command-line instructions for running different programming languages. The executorMap is a JSON object where keys are programming languages (e.g., “python”, “javascript”) and values are the commands used to execute code for those languages.

5. Clear the terminal before running the Python script.

By changing:

"code-runner.executorMap": {
    
    "python": "python -u",

},

To:

"code-runner.executorMap": {
    
    "python": "clear && python -u",

},

6. Run Code-runner in Terminal

Scroll down and select ‘Code-runner: Run in Terminal’.

alt text