Sublimetext3 如何增加升华文本3中最近的文件数?

Sublimetext3 如何增加升华文本3中最近的文件数?,sublimetext3,Sublimetext3,是否可以增加升华文本3(Ubuntu)中“文件->打开近期”菜单中显示的近期文件的数量 我已经读过了 我在我的电脑上找不到这个~/Library文件夹。我可以找到~/.config/sublime-text-3/Packages,但里面没有“默认”子文件夹。Linux上sublime-text-3中的默认包存储在(假设您使用了.deb安装程序)/opt/sublime\u text/Packages/Default.sublime-Packages Default.sublime-package

是否可以增加升华文本3(Ubuntu)中“文件->打开近期”菜单中显示的近期文件的数量

我已经读过了


我在我的电脑上找不到这个~/Library文件夹。我可以找到~/.config/sublime-text-3/Packages,但里面没有“默认”子文件夹。

Linux上sublime-text-3中的默认包存储在(假设您使用了.deb安装程序)
/opt/sublime\u text/Packages/Default.sublime-Packages

Default.sublime-package
是一个ZIP文件,如果打开它并将
Main.sublime-menu
文件从中提取到
~/.config/sublime-text-3/Packages/Default/Main.sublime-menu
,则可以按照链接答案所述的方式对其进行编辑

或者运行以下命令,创建默认目录并将
Main.sublime菜单
文件解压缩到其中:

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

至少在OSX上,Default.sublime-package在应用程序本身中:
/Applications/sublime Text.app/Contents/MacOS/Packages/Default.sublime-package

要轻松编辑配置而不在更新时覆盖更改,您需要在软件包目录中复制Main.sublime-menu
~/Library/Application Support/sublime Text 3/Packages/Default/Main.sublime-menu

实现这些更改的最简单方法是安装skuroda提供的优秀软件包(使用软件包控制),然后:

  • 命令+Shift+p
  • 键入“资源”并选择“PackageResourceViewer:打开资源”
  • 您将看到可用软件包的列表:选择“默认值”
  • 选择“Main.sublime菜单”
  • PackageResourceViewer现在将
    Main.sublime菜单
    复制到正确的位置,并打开新文件进行编辑(注意:在点击“保存”之前,文件似乎不会在文件系统中实际创建,并且更新似乎立即可见,无需更新)
  • 根据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... 
    
        { "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自动更新,甚至可能在将来引起冲突

    (编辑Packages/User/Default/Main.sublime菜单)确实是一种更新证明,但不幸的是,它会导致一个重复的子菜单(重复的条目显示在菜单的最底部)。用户设置文件与默认值合并,但合并方式会导致密钥重复

    我发现,如果我更新Packages/Default/Main.sublime-menus,那么该文件将完全替换默认文件(删除块,看到菜单实时消失!)——我的新文件和默认文件不会合并

    为了:a)避免重复条目,b)保持升华更新的最新状态,我找不到其他方法来跟踪使用git对文件的更改,当升华更新时,重复
    打开资源
    过程(覆盖编辑),然后仅还原相关更改。

    在Windows 7或8上:

  • 在ZIP/archive实用程序中打开以下文件:
    C:\Program Files\Sublime Text 3\Packages\Default.Sublime package

  • 仅将文件
    Main.sublime菜单
    提取到:
    %APPDATA%\Sublime Text 3\Packages\Default

    (如有必要,请创建文件夹)

    该文件夹也称为:
    C:\Users\YourUsername\AppData\Roaming\Sublime Text 3\Packages\Default

  • 打开刚才提取的
    Main.sublime菜单(JSON文件),并更改出现的
    Open\u recent\u文件夹
    Open\u recent\u 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... 
    
        { "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...
    
  • 点击save,菜单将立即更新。:-)


  • 您甚至可以将最近的文件/文件夹列表移动到根“文件”菜单中,以便于访问

    对于那些懒得复制粘贴然后更改数字的人,这里有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 } },
    

    将此
    Main.sublime菜单添加到
    %APPDATA%\sublime Text 3\Packages\User
    文件夹中。您将看到添加的文件菜单子项,名为打开最近的更多内容,为您提供下一个相同数量的最近文件/文件夹。(不过,如果我能把它放在我想要的菜单上就好了。)


    我发现您实际上不需要覆盖主菜单
    只需添加您自己的菜单,它将出现在最后

    创建这个新文件(linux中我的路径,升华文本3):
    ~/.config/sublime-text-3/Packages/User/Main.sublime菜单

    在该文件中放入类似于OdatNurd先前答案的内容

    (我将相同的内容复制粘贴到文件中:
    上下文。升华菜单

    侧栏。升华菜单

    使相同的子菜单显示在那里)


    我只是用自己的首字母“elm”创建了自己的子菜单,并将我个人使用的所有内容与各种“children”子树放在一起

    作为奖励,它将自动显示其后面同一命令的键盘快捷键
    所以我也用它来提醒我不常使用的动作,忘记了键盘的快捷键


    这适用于升华文本3
    但也许有人可以测试一下这是否也适用于Sublime Text 2


    我的文件看起来像这样:
    (除了大量最近的文件外,还增加了一些灵感)



    对于较新的文件,略谈一下主题,但我认为这种方法同时也可以提高其他可用性和可维护性:)

    我最近需要这些版本打开的文件/文件夹。
    然而,问题是,我不想让主菜单排得太满。
     {
            "caption": "File",
            "mnemonic": "F",
            "id": "file",
            "children":
            [
                { "command": "new_file", "caption": "New File", "mnemonic": "N" },
    
                { "command": "prompt_open_file", "caption": "Open File…", "mnemonic": "O", "platform": "!OSX" },
                { "command": "prompt_open_folder", "caption": "Open Folder…", "platform": "!OSX" },
                { "command": "prompt_open", "caption": "Open…", "platform": "OSX" },
                {
                    "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 } },
                        { "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": "-" },
                        { "caption": "More Recent Files",
                          "mnemonic": "F",
                          "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 } },
                            { "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 } },
                          ]
                        },
                        { "caption": "-" },
                        { "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 } },
                        { "command": "open_recent_folder", "args": {"index": 7 } },
                        { "caption": "-" },
                        { "caption": "More Recent Directories",
                          "mnemonic": "D",
                          "children":
                          [
                            { "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 } },
                            { "command": "open_recent_folder", "args": {"index": 17 } },
                            { "command": "open_recent_folder", "args": {"index": 18 } },
                            { "command": "open_recent_folder", "args": {"index": 19 } },
                            { "command": "open_recent_folder", "args": {"index": 20 } },
                          ]
                        },
                        { "caption": "-" },
                        { "command": "clear_recent_files", "caption": "Clear Items" }
                    ]
                },
    
    ... (continued)