How do I create a new file in VS Code?
Jul 11, 2025 am 01:17 AMThere are three main ways to create a new file in VS Code. First, open the Explorer sidebar: click the folder icon in the toolbar on the left or press Ctrl Shift E (Cmd Shift E on macOS), right-click the target folder, select "New File", enter the file name and extension, and press Enter; secondly, use the command panel: press Ctrl Shift P (Cmd Shift P on macOS), open the command panel, enter "New File" and select "File: New File", and then save the file; finally, use the shortcut key: press Ctrl N (Cmd N on macOS), and then save it to the specified location through Ctrl S. This method is suitable for users who want to quickly edit without using the mouse.
Creating a new file in VS Code is straightforward, and there are a few different ways to do it depending on your workflow. Here's how you can quickly get started.
Use the File Explorer Sidebar
The most common way to create a new file is through the File Explorer sidebar:
- Click the folder icon on the left toolbar or press
Ctrl Shift E
(orCmd Shift E
on macOS) to open the File Explorer. - Right-click inside the folder where you want to create the file.
- Select New File from the context menu.
- Type the name of the file, including its extension (like
.js
,.txt
, or.html
), and press Enter.
This method works great when you're already browsing your project structure and want to add a file directly into a specific folder.
Create a New File with the Command Palette
If you prefer keyboard shortcuts or want a more universal approach:
- Press
Ctrl Shift P
(Cmd Shift P
on macOS) to open the Command Palette . - Type “New File” and select File: New File from the list.
- A new untitled file will open in the editor. You'll need to save it by pressing
Ctrl S
(Cmd S
on macOS), then choose a location and give it a name.
This method skips the folder navigation step and gets you straight to editing, but you'll need to remember to save it somewhere specific.
Keyboard Shortcut for Speed
For faster access, you can use a direct shortcut:
- Press
Ctrl N
(Cmd N
on macOS) to instantly create a new file. - Just like with the Command Palette method, this opens an untitled document. Don't forget to save it using
Ctrl S
and pick a location.
This is ideal if you're already deep into coding and just want to spin up a quick new file without touching the mouse.
Creating a new file in VS Code doesn't have to slow you down — whether you use the sidebar, the command palette, or a quick keyboard shortcut, it's all about what fits your flow best.
The above is the detailed content of How do I create a new file in VS Code?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Switching the UI interface to Chinese in Visual Studio Code (hereinafter referred to as VSCode) is not a complicated matter. Just follow the following steps to achieve it easily. VSCode is a powerful and popular code editor that supports a variety of programming languages ??and tools. It has a friendly and flexible interface to meet the diverse needs of developers. The following will introduce the techniques on how to quickly switch to the Chinese interface in VSCode, with specific code examples to facilitate everyone's operation. Step 1: Open

VSCode is a lightweight code editor suitable for multiple languages ??and extensions; VisualStudio is a powerful IDE mainly used for .NET development. 1.VSCode is based on Electron, supports cross-platform, and uses the Monaco editor. 2. VisualStudio uses Microsoft's independent technology stack to integrate debugging and compiler. 3.VSCode is suitable for simple tasks, and VisualStudio is suitable for large projects.

SublimeText and VSCode have their own advantages in plug-in ecology and scalability. SublimeText manages plug-ins through PackageControl, which have a small number of plug-ins but high quality, and mainly uses Python script extensions. VSCode has a huge Marketplace, with a large number of plug-ins and frequent updates. It uses TypeScript and JavaScript to expand, and its API is more comprehensive.

With the rapid development of information technology, programming has become an indispensable part of people's daily lives. In the programming process, a good integrated development environment (IDE) can greatly improve development efficiency. Visual Studio Code (VSCode for short), as a powerful open source code editor, has been welcomed by a wide range of developers. This article will show you step by step how to set the language of VSCode to Chinese to make your programming experience smoother. Step 1: Open VSCode

Title: How to set the interface language to Chinese in VSCode? Visual Studio Code (VSCode for short) is a very popular open source code editor that supports many different programming languages ??and interface languages, including Chinese. Setting the interface language of VSCode to Chinese can provide users with a more comfortable development environment. This article will introduce how to set the interface language to Chinese in VSCode and provide specific code examples.

VisualStudio is suitable for large projects, VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive IDE functions, supports multiple languages, integrated debugging and testing tools. 2.VSCode is a lightweight editor that supports multiple languages ??through extension, has a simple interface and fast startup.

SublimeText is faster and suitable for pursuing speed and lightweight experiences; VSCode performs better than handling large projects, suitable for needing scalability and community support. 1.SublimeText starts quickly, is written in C, and the interface is simple. 2. VSCode handles large-scale projects well, relies on the Electron framework, and expands the ecosystem strongly.

The differences in pricing, licensing and availability of VisualStudio and VSCode are as follows: 1. Pricing: VSCode is completely free, while VisualStudio offers free community and paid enterprise versions. 2. License: VSCode uses a flexible MIT license, and the license of VisualStudio varies according to the version. 3. Usability: VSCode is supported across platforms, while VisualStudio performs best on Windows.
