Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
668 views
in Technique[技术] by (71.8m points)

visual studio code - How can I open a file in a new tab?

How do I open a new file using Ctrl+P, so it doesn't override the current file, but rather use a new tab?

Also, would it be possible to focus the searched file instead of opening it, if it was already opened on a tab, to avoid duplicates?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When a single click to a file is made in the sidebar, Visual Studio Code opens it in Preview Mode, which allows you to quickly view files.

Behavior of Preview Mode

  • The tabs in the Preview Mode are not kept open.
  • As soon as you open another file from the sidebar, it overrides the existing file if it's in preview mode.
  • The title of the tab will be in italic if it's in preview mode, just like the below screenshot.

To open a file for editing (i.e. don't open in Preview Mode), double-click on the file in the sidebar.

Important!

If you want to edit a file, don't open in Preview Mode, double-click on the file in the sidebar instead.

If the file is already open in Preview mode, then to convert it to edit mode:

  • double click on its italic file name in the title bar, or
  • press Ctrl-K Enter

Steps to Disable Preview Mode

Criteria:

If you want to disable Preview Mode all together, that is:

  • accessing file through side-menu.
  • opening quick open menu using Ctrl + P.

Solution:

  • Open the Command Palette using the shortcut Ctrl+Shift+P.
  • Type Preferences: Open User Settings. This will open the Settings editor. Search for workbench.editor.enablePreview, and uncheck the checkbox (changes are autosaved and indicated with a blue left border).

Additional:

  • If you only want to disable preview mode in the quick open menu, uncheck the box for workbench.editor.enablePreviewFromQuickOpen.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...