如何增加Sublime Text 3中最近的文件数量?
是否有可能增加在Sublime Text 3(Ubuntu)的文件 – >打开最近菜单中出现的最近文件的数量?
我已经阅读增加崇高文本2中近期项目的数量?
而我无法在我的电脑上find这个〜/ Library文件夹。 我可以find〜/ .config / sublime-text-3 / Packages,但里面没有“Default”子文件夹。
Linux上的Sublime Text 3中的默认包存储在(假设您使用.deb安装程序) /opt/sublime_text/Packages/Default.sublime-package
。
Default.sublime-package
是一个ZIP文件,如果你打开它并从中提取Main.sublime-menu
文件到~/.config/sublime-text-3/Packages/Default/Main.sublime-menu
,那么它就可以与链接的答案描述相同的方式进行编辑。
或者运行以下命令,这些命令将创buildDefault目录并将Main.sublime-menu
文件提取到该目录中:
mkdir ~/.config/sublime-text-3/Packages/Default/ unzip -p /opt/sublime_text/Packages/Default.sublime-package Main.sublime-menu > ~/.config/sublime-text-3/Packages/Default/Main.sublime-menu
至less在OSX上,Default.sublime-package在应用程序本身中: /Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package
。
为了方便地编辑configuration而不必在更新时覆盖更改,需要在Packages目录中的Main.sublime-menu副本~/Library/Application Support/Sublime Text 3/Packages/Default/Main.sublime-menu
实现这些更改最简单的方法是通过skuroda(使用Package Control)安装优秀的PackageResourceViewer ,然后:
- 命令+ Shift + P
- 键入“资源”并select“ PackageResourceViewer:打开资源 ”
- 你会看到一个可用包列表: select'Default '
- select“ Main.sublime-menu ”
- PackageResourceViewer现在将
Main.sublime-menu
复制到正确的位置,并打开新文件进行编辑。 -
根据Rufus_12的回答,改变出现的
open_recent_folder
和open_recent_file
语句的数量,open_recent_folder
增加索引。{ "command": "open_recent_folder", "args": {"index": 0 } }, { "command": "open_recent_folder", "args": {"index": 1 } }, { "command": "open_recent_folder", "args": {"index": 2 } }, { "command": "open_recent_folder", "args": {"index": 3 } }, { "command": "open_recent_folder", "args": {"index": 4 } }, { "command": "open_recent_folder", "args": {"index": 5 } }, { "command": "open_recent_folder", "args": {"index": 6 } }, ...continue as many times as necessary...
将这个Main.sublime-menu
添加到你的%APPDATA%\Sublime Text 3\Packages\User
文件夹中。 您将看到一个名为“ 打开最近更多”的添加的“ 文件菜单”子项,为您提供下一个相同数量的最近文件/文件夹。 (只要我能把它放在我想要的菜单中)
[ { "caption": "File", "mnemonic": "F", "id": "file", "children": [ { "caption": "Open Recent More", "mnemonic": "R", "children": [ { "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 } }, { "caption": "-" }, { "command": "open_recent_folder", "args": {"index": 8 } }, { "command": "open_recent_folder", "args": {"index": 9 } }, { "command": "open_recent_folder", "args": {"index": 10 } }, { "command": "open_recent_folder", "args": {"index": 11 } }, { "command": "open_recent_folder", "args": {"index": 12 } }, { "command": "open_recent_folder", "args": {"index": 13 } }, { "command": "open_recent_folder", "args": {"index": 14 } }, { "command": "open_recent_folder", "args": {"index": 15 } }, { "command": "open_recent_folder", "args": {"index": 16 } }, { "caption": "-" } ] } ] } ]
在Windows 7或8上,您可以:
-
在ZIP /存档实用程序中打开以下文件:
C:\Program Files\Sublime Text 3\Packages\Default.sublime-package
-
只将文件
Main.sublime-menu
提取到:
%APPDATA%\Sublime Text 3\Packages\Default
(如有必要,创build文件夹)该文件夹被称为:
C:\Users\YourUsername\AppData\Roaming\Sublime Text 3\Packages\Default
-
打开刚刚提取的
Main.sublime-menu
(一个JSON文件),并更改出现的open_recent_folder
和open_recent_file
语句的数目,open_recent_folder
增加索引。{ "command": "open_recent_folder", "args": {"index": 0 } }, { "command": "open_recent_folder", "args": {"index": 1 } }, { "command": "open_recent_folder", "args": {"index": 2 } }, { "command": "open_recent_folder", "args": {"index": 3 } }, { "command": "open_recent_folder", "args": {"index": 4 } }, { "command": "open_recent_folder", "args": {"index": 5 } }, { "command": "open_recent_folder", "args": {"index": 6 } }, ...continue as many times as necessary...
-
点击保存,菜单应该立即更新。 🙂
您甚至可以将最近的文件/文件夹列表移动到根文件菜单中,以便于访问。
对于那些懒得复制和粘贴的人来说,改变数字,这里是50个。
{ "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 } }, { "command": "open_recent_file", "args": {"index": 20 } }, { "command": "open_recent_file", "args": {"index": 21 } }, { "command": "open_recent_file", "args": {"index": 22 } }, { "command": "open_recent_file", "args": {"index": 23 } }, { "command": "open_recent_file", "args": {"index": 24 } }, { "command": "open_recent_file", "args": {"index": 25 } }, { "command": "open_recent_file", "args": {"index": 26 } }, { "command": "open_recent_file", "args": {"index": 27 } }, { "command": "open_recent_file", "args": {"index": 28 } }, { "command": "open_recent_file", "args": {"index": 29 } }, { "command": "open_recent_file", "args": {"index": 30 } }, { "command": "open_recent_file", "args": {"index": 31 } }, { "command": "open_recent_file", "args": {"index": 32 } }, { "command": "open_recent_file", "args": {"index": 33 } }, { "command": "open_recent_file", "args": {"index": 34 } }, { "command": "open_recent_file", "args": {"index": 35 } }, { "command": "open_recent_file", "args": {"index": 36 } }, { "command": "open_recent_file", "args": {"index": 37 } }, { "command": "open_recent_file", "args": {"index": 38 } }, { "command": "open_recent_file", "args": {"index": 39 } }, { "command": "open_recent_file", "args": {"index": 40 } }, { "command": "open_recent_file", "args": {"index": 41 } }, { "command": "open_recent_file", "args": {"index": 42 } }, { "command": "open_recent_file", "args": {"index": 43 } }, { "command": "open_recent_file", "args": {"index": 44 } }, { "command": "open_recent_file", "args": {"index": 45 } }, { "command": "open_recent_file", "args": {"index": 46 } }, { "command": "open_recent_file", "args": {"index": 47 } }, { "command": "open_recent_file", "args": {"index": 48 } }, { "command": "open_recent_file", "args": {"index": 49 } },
我发现你并不需要重写主菜单 ;
只需添加自己的菜单,这将在最后出现。
创build这个新的文件 (我在Linux中,Sublime Text 3中的path):
~/.config/sublime-text-3/Packages/User/Main.sublime-menu
在那个文件中join了类似于OdatNurd以前的答案;
(和我复制粘贴相同的内容到文件中:
Context.sublime-menu
Side Bar.sublime-menu
在那里显示相同的子菜单)
我刚刚从我自己的首字母“榆树”中创build了自己的子菜单,并将所有我个人使用的东西放在各种“子”子树中。
作为奖励, 它会自动显示键盘快捷键到它后面的相同命令 ,
所以我也用它来提醒我不常使用的操作,忘记了键盘快捷键。
这适用于Sublime Text 3 ,
但也许有人可以testing这是否也适用于Sublime Text 2?
我的文件看起来像这样:
(也增加了一些更多的想法(旁边有很多最近的文件)的灵感)
[ { "caption" : "elm", "mnemonic": "M", "children": [ { "caption": "Open Recent", "mnemonic": "R", "children": [ { "command": "reopen_last_file", "caption": "Reopen Closed File" }, { "caption": "-" }, { "command": "open_recent_file", "args": {"index": 0 } }, { "command": "open_recent_file", "args": {"index": 1 } }, // ... etc. { "command": "open_recent_file", "args": {"index": 29 } }, ], }, { "caption": "Multi Line/Caret editing", "children": [ { "caption": "split_selection_into_lines", "command": "split_selection_into_lines", }, { "caption": "Add caret above (select_lines)", "command": "select_lines", "args": {"forward": false}, }, { "caption": "Add caret below (select_lines)", "command": "select_lines", "args": {"forward": true}, }, ] }, { "caption": "Bookmarks", "children": [ { "caption": "toggle_bookmark", "command": "toggle_bookmark", }, { "caption": "prev_bookmark", "command": "prev_bookmark", }, { "caption": "next_bookmark", "command": "next_bookmark", }, ] }, { "caption": "paste_from_history", "command": "paste_from_history", }, { "caption": "Jump to matching bracket", "command": "move_to", "args": {"to": "brackets"}, }, // ... etc. etc. ], }, ]
对于更近期的文件来说,这个主题不是什么新东西,但是我认为这种方法同时也可以改善其他的可用性和可维护性:)