Sublime Text 4 增加最近的打开的文件列表数量从8个到20个

在Sublime Text 3 中,可以通过解压修改 Packages/Default.sublime-package 中的 Main.sublime-menu 文件的方法。

但在windows中的 Sublime Text 4 上用这个方法似乎失效了。

下面找到另一个方法来修改 Sublime Text 4 中的 最近打开的文件 列表,即 recent files 数量:

第一步、通过包管理器(Package Control)安装插件 PackageResourceViewer

第二步、通过新安装的插件找到并修改文件,步骤如下:

2.1 按键:Ctrl+Shift+p

2.2 输入“Resource”并选择“PackageResourceViewer: Open resource

2.3 您会看到可用软件包的列表:选择“Default

2.4 选择 'Main.sublime-menu'

2.5 在文件中合适位置添加多行 open_recent_file 索引(就在第一屏),保存即可立即生效。

                    { "command": "reopen_last_file", "caption": "重新打开已关闭的文件" },
                    { "caption": "-" },
                    { "command": "open_recent_file", "args": {"index": 0 } },
                    { "command": "open_recent_file", "args": {"index": 1 } },
                    { "command": "open_recent_file", "args": {"index": 2 } },
                    { "command": "open_recent_file", "args": {"index": 3 } },
                    { "command": "open_recent_file", "args": {"index": 4 } },
                    { "command": "open_recent_file", "args": {"index": 5 } },
                    { "command": "open_recent_file", "args": {"index": 6 } },
                    { "command": "open_recent_file", "args": {"index": 7 } },
                    { "caption": "-" },
                    { "command": "open_recent_folder", "args": {"index": 0 } },
                    { "command": "open_recent_folder", "args": {"index": 1 } },
                    { "command": "open_recent_folder", "args": {"index": 2 } },

添加后如下:最近打开的文件 从8行增加到20行

                    { "command": "reopen_last_file", "caption": "重新打开已关闭的文件" },
                    { "caption": "-" },
                    { "command": "open_recent_file", "args": {"index": 0 } },
                    { "command": "open_recent_file", "args": {"index": 1 } },
                    { "command": "open_recent_file", "args": {"index": 2 } },
                    { "command": "open_recent_file", "args": {"index": 3 } },
                    { "command": "open_recent_file", "args": {"index": 4 } },
                    { "command": "open_recent_file", "args": {"index": 5 } },
                    { "command": "open_recent_file", "args": {"index": 6 } },
                    { "command": "open_recent_file", "args": {"index": 7 } },
                    { "command": "open_recent_file", "args": {"index": 8 } },
                    { "command": "open_recent_file", "args": {"index": 9 } },
                    { "command": "open_recent_file", "args": {"index": 10 } },
                    { "command": "open_recent_file", "args": {"index": 11 } },
                    { "command": "open_recent_file", "args": {"index": 12 } },
                    { "command": "open_recent_file", "args": {"index": 13 } },
                    { "command": "open_recent_file", "args": {"index": 14 } },
                    { "command": "open_recent_file", "args": {"index": 15 } },
                    { "command": "open_recent_file", "args": {"index": 16 } },
                    { "command": "open_recent_file", "args": {"index": 17 } },
                    { "command": "open_recent_file", "args": {"index": 18 } },
                    { "command": "open_recent_file", "args": {"index": 19 } },
                    { "caption": "-" },
                    { "command": "open_recent_folder", "args": {"index": 0 } },
                    { "command": "open_recent_folder", "args": {"index": 1 } },
                    { "command": "open_recent_folder", "args": {"index": 2 } },

此方法可能会在你升级到新版本的sublime text 4后,被原始文件覆盖掉,每次升级后,只需要重复以上步骤修改即可。

同理,

增加 最近打开的文件夹,默认8行,添加 open_recent_folder 的索引行数即可。

想增加 最近打开的项目,默认8行,添加 open_recent_project_or_workspace 的索引行数。


------------------

补充:还有另一个插件 File History 貌似也可以实现类似效果,具体未测试。