Sublime Forum

Hide default commands from sidebar

#1

Hi!
I’d like to hide some of the default commands from the sidebar right-click menu, e.g.:

  • Rename
  • Open Folder
  • Open Git Repository

I have my own version of Side Bar.sublime-menu, but it seems there’s no way to disable them.
I also tried to override the commands in the default package (Default/side_bar.py) by making is_visible() return False but that didn’t work.

Any suggestion?

0 Likes

#2

Answering my own question. This way I managed to disable all default commands except “Delete Folder” (not sure why).

import Default.side_bar
import sublime_plugin

class NewFileAtCommand(Default.side_bar.NewFileAtCommand):
    def is_visible(self):
        return False


class NewFolderCommand(Default.side_bar.NewFolderCommand):
    def is_visible(self):
        return False


class RenamePathCommand(Default.side_bar.RenamePathCommand):
    def is_visible(self):
        return False


class OpenFolderCommand(Default.side_bar.OpenFolderCommand):
    def is_visible(self):
        return False


class DeleteFileCommand(sublime_plugin.WindowCommand):
    def is_visible(self):
        return False


class DeleteFolderCommand(sublime_plugin.WindowCommand):  # DOES NOT WORK
    def is_visible(self):
        return False


class FindInFolderCommand(Default.side_bar.FindInFolderCommand):
    def is_visible(self):
        return False
0 Likes

#3

Some commands have been moved to core and therefore can’t be disabled by overriding plugins anymore. FileManager and various other plugins suffer from it, too.

The two options involve overriding ST’s default Side Bar.sublime-menu:

A

create a customized Packages/Default/Side Bar.sublime-menu which fits your needs

B

create an empty Packages/Default/Side Bar.sublime-menu to clear the default and place a customized one anywhere else.

0 Likes

#4

Thank you @deathaxe. That worked (I went with B).

0 Likes