如何使用空白文本编辑器选项卡打开 VS Code?

问题描述 投票:0回答:4

我正在尝试设置 VS Code,以便在程序刚打开时(不是通过文件的上下文菜单或单击文件)打开一个新的空白文本文件并准备开始输入 - 类似于Notepad++ 已打开 - 或大多数其他文本编辑器,就此而言。

搜索“VS Code 打开新文件”和许多变体只会让我找到有关在新选项卡或窗口中打开新文件的文章/帖子。这不是我想做的。

visual-studio-code settings
4个回答
40
投票

文件 > 首选项 > 设置

搜索

startupEditor

改变

"workbench.startupEditor": "welcomePage"

"workbench.startupEditor": "newUntitledFile"

或从下拉列表中选择

newUntitledFile


2
投票

在“文件”>“首选项”>“设置”中,“窗口”部分下列出以下选项:

// 控制重新启动后如何重新打开窗口。选择“无”以始终从空工作区开始,选择“一个”以重新打开您上次处理的窗口,选择“文件夹”以重新打开所有已打开文件夹的窗口,或选择“全部”以重新打开上次会话的所有窗口。 "window.restoreWindows": "无",

使用右侧窗格中的编辑器,您可以添加: “window.restoreWindows”:“无”

这将打开一个空工作区,其中包含一个显示“新文件”的链接。这并不完全是您正在寻找的解决方案,但它是我所知道的最接近的解决方案。


0
投票

这对我来说也不起作用了。但我在任务栏上创建了一个快捷方式,如下所示,它满足了我的要求:

“C:\Users\我的名字\AppData\Local\Programs\Microsoft VS Code\Code.exe”C:\Users\我的名字\Downloads\Untitled


0
投票

将以下内容放入您的 settings.json 文件中

// Controls how windows are being reopened after starting for the first time. This setting has no effect when the application is already running.
// `none`: Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.
"window.restoreWindows": "none",

// Controls whether unsaved files are remembered between sessions, allowing the save prompt when exiting the editor to be skipped.
// `off`: Disable hot exit. A prompt will show when attempting to close a window with editors that have unsaved changes.
"files.hotExit": "off",

// Controls which editor is shown at startup, if none are restored from the previous session.
// `newUntitledFile`: Open a new untitled text file (only applies when opening an empty window).
"workbench.startupEditor": "newUntitledFile",
© www.soinside.com 2019 - 2024. All rights reserved.