简体   繁体   English

如何从“转到文件”对话框中获取VSCode以“作为新文件打开”

[英]How to get VSCode to “open as new file” from Go To File dialog

I have recently switched to VSCode, and am loving it, except for one specific thing that drives me nuts. 我最近改用了VSCode,并且非常喜欢它,除了一件事让我发疯。

My "goto" command is {Command+P}, the easy search-and-open-file bar. 我的“转到”命令是{Command + P},即简单的搜索和打开文件栏。 If I type the name of a file into this bar and it does not exist, I want to be able to hit ENTER and have it open a tab editing that file as a new file. 如果我在此栏中键入文件名并且该文件名不存在,那么我希望能够按ENTER键并打开一个选项卡,将该文件编辑为新文件。 This is the behavior I would get in old-school Windows Notepad, or in mvim :e <filename> , but I can't figure out how to do it in VSCode. 这是我在老式Windows记事本或mvim :e <filename>中会遇到的问题,但是我不知道如何在VSCode中做到这一点。

Is there a toggle or a plugin I can use to get this behavior straight out of the Go To File dialog? 是否可以使用切换按钮或插件直接从“转到文件”对话框中获得此行为?

Answering my own question: 回答我自己的问题:

No, there's no way to do this using {Command+P}. 不,无法使用{Command + P}来执行此操作。 This is strictly a file finder and I've yet to see any plugin that changes the behavior. 严格来说,这是一个文件查找器,我还没有看到任何可以改变行为的插件。

If you're using the VsCodeVim plugin, an almost-as-good approach is just :e <file> - immediately open a new buffer editing the given file. 如果您使用的是VsCodeVim插件,则几乎是一种不错的方法:e <file> -立即打开一个编辑给定文件的新缓冲区。 There's no tab autocomplete this way, but you just have to live with that. 这种方式没有选项卡自动完成功能,但您必须忍受这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM