Search code examples
sublimetextsublime-text-pluginsublimetext4

How to remove button in Sublime Text 4 from context menu?


I would like to remove button "Remove folder from Project" sometimes I accidentally click on this button and have to re-create the project. I think Sublime pretty flexible editor that allows to remove or add some features.

enter image description here

Thank you for help.


Solution

  • Yes, this is possible, but it takes a few steps. We'll be creating a file override.

    1. Select Preferences → Browse Packages… (macOS: :Sublime Text → Preferences → Browse Packages…) to open your Packages directory:

      • Linux: ~/.config/sublime-text-3/Packages or ~/.config/sublime-text/Packages
      • OS X: ~/Library/Application Support/Sublime Text 3/Packages or ~/Library/Application Support/Sublime Text/Packages
      • Windows Regular Install: C:\Users\YourUserName\AppData\Roaming\Sublime Text 3\Packages or C:\Users\YourUserName\AppData\Roaming\Sublime Text\Packages
      • Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages InstallationFolder\Sublime Text\Data\Packages

      The exact path depends on version and whether or not you upgraded from Sublime Text 3.

    2. In that directory, create a directory called Default. Make sure it's capitalized.

    3. Back in Sublime, open the Command Palette (Ctrl/ Shift P or Tools → Command Palette) and type v, then select View Package File.

    4. Type in def side mount (it's a fuzzy search) and select Default/Side Bar Mount Point.sublime-menu.

    5. Select View → Show Console to open the Sublime Python console. Type in

      view.set_read_only(False)
      

      and hit Enter. Now we can edit and save the file.

    6. On line 3 of the file, add 2 forward slashes (//) at the very beginning of the line to comment out that line. The file should now look like this:

      [
          { "caption": "-", "id": "folder_commands" },
      //  { "caption": "Remove Folder from Project", "command": "remove_folder", "args": { "dirs": []} }
      ]
      
    7. Select File → Save As…. Navigate to the Packages/Default directory you made in Step 2, and save the file there. Make sure you don't change its name.

    8. Although the change should go into effect immediately, restart Sublime Text just to make sure. The Remove Folder from Project option should no longer show up when you right-click on a folder in the Side Bar.