Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features
Autoplay

    VS Code Command Line Tips and Tricks

    John LindquistJohn Lindquist
    bashBash

    VS Code allows you to install a code command into your PATH so you can launch code a few different ways. You can open projects, create files in memory, or even pipe the results of other commands into code.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    Instructor: 00:00 Go into your command palette. The default shortcut is Command+Shift+P, but I changed it to Command+T instead. Type out "Show command, install code command in path." Then, you should get a notification saying that that worked.

    00:17 Then in your terminal, you can type code, and then a path, so projects, proxy lessons, so a path to a project, hit enter, and then code'll pop up that project with that directory opened. That's very handy after you get clone or create any new project from a command line tool.

    00:37 You can also tell code to create some files somewhere. I'll try fu/bar/somefile.js. This will pop open code in whatever project is currently open. You see my proxy lessons project is open. I can type in some JavaScript here and all the highlighting will work.

    00:56 Back to my terminal, if I try to cd into fu, you can see that fu doesn't exist. As soon as I save this file in code and go back, I can cd into fu, cd into bar, and then check this directory. You'll see some file is there. You can also pipe content into code. If I go, "Hello," and then pipe code and add a dash, hit enter there. Code will open up with "Hello" as the output.

    01:28 For example, if I were to list and then pipe that into code, you can see it'll list some file that we created or if I were to curl the GitHub API, so GitHub.com, then pipe that into code, hit enter, you can see it'll download that file and pop it open inside of code.

    01:56 If you're not seeing the proper highlighting, if you open your command palette and type in "Language," you should see change language mode as an option. I'm going to type "JSON," for this file. Hit enter, and then you'll get the proper JSON highlighting and tools.

    Discuss

    Discuss