从ST菜单覆盖或删除默认项目

时间:2019-06-22 01:34:40

标签: sublimetext3 sublimetext sublime-text-plugin

是否有一种方法可以覆盖或删除Sublime Text菜单中的某些 default 项目,而无需重复其全部代码?

例如,如果要从侧边栏菜单中删除“删除文件”和“删除文件夹”项目,则有必要创建“ Side bar.sublime-menu”文件的完整副本(对文件进行适当的更改)当然)。

位置

Packages\Default\Side Bar.sublime-menu

内容

[
    { "caption": "New File", "command": "new_file_at", "args": {"dirs": []} },
    { "caption": "Rename…", "command": "rename_path", "args": {"paths": []} },
    // { "caption": "Delete File", "command": "delete_file", "args": {"files": []} },
    { "caption": "Open Containing Folder…", "command": "open_containing_folder", "args": {"files": []} },
    { "caption": "Reveal Link Source", "command": "reveal_link_source", "args": {"dirs": []} },
    { "caption": "-", "id": "repo_commands" },
    { "caption": "Open Git Repository…", "command": "sublime_merge_open_repo", "args": {"paths": []}},
    { "caption": "File History…", "command": "sublime_merge_file_history", "args": {"files": []}},
    { "caption": "Folder History…", "command": "sublime_merge_folder_history", "args": {"paths": []}},
    { "caption": "Blame File…", "command": "sublime_merge_blame_file", "args": {"files": []}},
    { "caption": "-", "id": "folder_commands" },
    { "caption": "New Folder…", "command": "new_folder", "args": {"dirs": []} },
    // { "caption": "Delete Folder", "command": "delete_folder", "args": {"dirs": []} },
    { "caption": "Find in Folder…", "command": "find_in_folder", "args": {"dirs": []} },
    { "caption": "-", "id": "end" }
]

出于明显的原因,最好避免这种重复。有办法实现吗?

0 个答案:

没有答案