是否可以增加文件中出现的最近文件的数量 - >在Sublime Text 3(Ubuntu)中打开最近的菜单?
我已阅读Increase number of recent projects in Sublime Text 2?
我在PC上找不到这个〜/ Library文件夹。我可以找到〜/ .config / sublime-text-3 / Packages,但里面没有“Default”子文件夹。
答案 0 :(得分:64)
至少在OSX上,Default.sublime-package在应用程序本身中:/Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package
。
要轻松编辑配置而不在更新时覆盖更改,您需要在Packages目录~/Library/Application Support/Sublime Text 3/Packages/Default/Main.sublime-menu
实现这些更改的最简单方法是通过skuroda(使用Package Control)安装优秀的PackageResourceViewer,然后:
Main.sublime-menu
复制到正确的位置并打开新文件进行编辑(注意:文件在文件系统中似乎没有实际创建,直到点击保存,并且更新似乎立即可见而不需要更新)。 根据Rufus_12的回答,更改出现的open_recent_folder
和open_recent_file
语句的数量,每次都会增加索引。
{ "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...
正如@drevicko指出的那样,这种方法不会自动更新Sublime,甚至可能在将来引起冲突。
@James' answer(编辑Packages / User / Default / Main.sublime-menus)确实是防更新的,但不幸的是,会导致重复的子菜单(重复的条目在我看来是菜单的最底部)。用户设置文件与默认值合并,但以导致重复键的方式合并。
我发现如果我更新Packages / Default / Main.sublime-menus,那么该文件将完全替换默认值(删除块并看到您的菜单实时消失!) - 我的新文件和默认值未合并。
为了:a)避免重复输入,b)保持最新的Sublime更新,我看不到使用git跟踪文件更改的替代方法,并且当Sublime更新时,重复{{1}进程(覆盖您的编辑),然后仅还原相关更改。
答案 1 :(得分:25)
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
,则可以按照链接的答案描述的方式进行编辑。< / p>
或者运行以下命令,这些命令将创建Default目录并将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
答案 2 :(得分:13)
将此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": "-" }
]
}
]
}
]
答案 3 :(得分:10)
对于那些懒得复制和粘贴的人,然后更改数字,这里有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 } },
答案 4 :(得分:6)
在Windows 7或8上:
在ZIP /存档实用程序中打开以下文件:
C:\Program Files\Sublime Text 3\Packages\Default.sublime-package
仅将文件Main.sublime-menu
解压缩为:
%APPDATA%\Sublime Text 3\Packages\Default
(如有必要,创建文件夹)
该文件夹也称为:
C:\Users\YourUsername\AppData\Roaming\Sublime Text 3\Packages\Default
打开刚刚提取的Main.sublime-menu
(一个JSON文件)并更改出现的open_recent_folder
和open_recent_file
语句的数量,每次都会增加索引。
{ "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...
点击保存,菜单应立即更新。 : - )
您甚至可以将最近的文件/文件夹列表移动到根目录&#34;文件&#34;菜单,方便访问。
答案 5 :(得分:3)
我发现你实际上并不需要覆盖主菜单;
只需添加自己的菜单,最后会出现。
创建这个新文件(在linux中的路径,在Sublime Text 3中):
~/.config/sublime-text-3/Packages/User/Main.sublime-menu
在该文件中添加类似于OdatNurd之前的答案;
(我将相同的内容复制粘贴到文件中:
Context.sublime-menu
Side Bar.sublime-menu
有相同的子菜单出现在那里)
我刚从我自己的首字母“elm”创建了我自己的子菜单,并将我个人使用的所有内容放在各种“子”子树上。
作为奖励,会自动显示其背后相同命令的键盘快捷键,
所以我也用它来提醒我不经常使用的动作而忘记键盘的快捷键。
适用于Sublime Text 3 ,
但也许有人可以测试这是否适用于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.
],
},
]
仅关注更新文件的主题,但我认为这种方法可能同时改善其他可用性和可维护性方面:)
答案 6 :(得分:1)
我最近来需要这些版本的打开文件/文件夹。
但是,要注意的是,我不想过度填充主菜单。我创建了一个子菜单项,其中显示了其他文件/文件夹。
除了上述来自@ptim和@MoonLite的出色答案之外,我还创建了一个子菜单,该子菜单可防止过多输入引起的拥挤。在Windows上,路径为(使用自定义 body:
application/json:
type: object
properties:
communicationWays:
type: array
items:
type: object
properties:
SMS:
type: boolean
required: false
EMAIL:
type: boolean
VOICE:
type: boolean
MAIL:
type: boolean
目录时的路径:scoop
)。
我发现您可以使菜单严重超载。只需复制C:\app_scoop\apps\sublime-text\current\Data\Packages\Default
;用下面的代码对其进行修改并将其放入Main.sublime-menu
中,您将获得带有子菜单的自定义菜单。
我正在共享一个子菜单方式来查看文件/文件夹(使用目录而不是文件夹来获得更快捷的快捷方式F ...文件,D ...目录)
C:\app_scoop\apps\sublime-text\current\Data\Packages\Default