简体   繁体   English

VsCode:如何避免为每个编辑器组打开多个文件?

[英]VsCode: how to avoid to open more than one file for each editor group?

To be more productive on my work, I'd like to have the possibility to open only one file for each editor group.为了提高我的工作效率,我希望可以为每个编辑器组只打开一个文件。 My purpose is to avoid to have 20 or more tabs opened at the and of the day and lost time searching for the right opened file in that list.我的目的是避免在一天中打开 20 个或更多选项卡并浪费时间在该列表中搜索正确打开的文件。

I'd like to focus the desired editor group (CMD + 1, 2, 3, 4) and open a new file (CMD + p).我想关注所需的编辑器组 (CMD + 1, 2, 3, 4) 并打开一个新文件 (CMD + p)。 If a file is opened in the selected editor group, I'd like to have the possibility to save it and replace it with the new one.如果在选定的编辑器组中打开了一个文件,我希望能够保存它并用新的替换它。

I think that to have at most 4 file opened at the same time is perfect and this forces me to be more focused on the code, instead of search for a file in a very big list of opened tabs.我认为最多同时打开 4 个文件是完美的,这迫使我更加专注于代码,而不是在打开的选项卡的非常大的列表中搜索文件。

If you wish to restrict the number of opened tabs, or close tabs automatically depending upon the threshold of an opened tab in the workspace如果您希望限制打开的选项卡数量,或根据工作区中打开的选项卡的阈值自动关闭选项卡

No more plugin needed: the next VSCode 1.42 (Q1 2020) will have a new setting for limiting the number of open editors不再需要插件:下一个 VSCode 1.42(2020 年第一季度)将有一个新的设置来限制打开的编辑器的数量

There are new settings to limit the maximum number of editors that are open at the one time.有一些新设置可以限制一次打开的最大编辑器数量。

  • workbench.editor.limit.enabled : Enable this feature (off by default). workbench.editor.limit.enabled :启用此功能(默认关闭)。
  • workbench.editor.limit.perEditorGroup : Whether to apply the limit per editor group or across all groups. workbench.editor.limit.perEditorGroup :是在每个编辑器组还是跨所有组应用限制。
  • workbench.editor.limit.value : The maximum number of open editors (10 by default). workbench.editor.limit.value :打开的编辑器的最大数量(默认为 10)。

If enabled, VS Code will close the least recently used editor when you open a new editor.如果启用,VS Code 将在您打开新编辑器时关闭最近最少使用的编辑器。

Below you can see the behavior when the limit is set to 3:您可以在下面看到限制设置为 3 时的行为:

https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_42/editor-limit.gif


As noted in the comments by Timo : see " User Interface/ Editor Groups ".正如Timo评论中所指出:请参阅“ 用户界面/编辑器组”。

If you wish to restrict the number of opened tabs, or close tabs automatically depending upon the threshold of an opened tab in the workspace.如果您希望限制打开的选项卡数量,或根据工作区中打开的选项卡的阈值自动关闭选项卡。

Zen Tabs plugin might be the solution. Zen Tabs 插件可能是解决方案。

Your requirements :您的要求:

  • The tabs usually close silently without any notification选项卡通常会在没有任何通知的情况下静默关闭
  • The threshold, as you can see from the settings, is usually fixed, but I like the idea of changing it dynamically with the intent to prevent scrolling.正如您从设置中看到的那样,阈值通常是固定的,但我喜欢动态更改它以防止滚动的想法。

Zen Tabs is the extension you are looking for. Zen Tabs是您正在寻找的扩展程序。

限制标签

You can get additional info here .您可以在此处获取更多信息。

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

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