0
votes

In Sublime Text 3, I'm using the WordCount plugin to know how long a file is, in terms of words.

However, this plugin slows down the editor when a huge text file is open. It's a file I use quite often, so this proves annoying. (The file is close to 6MB/1 million words and used on a recent MacBookPro.)

As such, I want to be able to disable and re-enable the WordCount plugin quickly and easily. I know how to do disable a plugin through Palette commands but I'm not happy with this solution.

Instead, I'd like to use a custom menu. I can create the custom menu itself (with a file named Main.sublime-menu located in /Users/*myusername*/Library/Application Support/Sublime Text 3/Packages/User/Main.sublime-menu) :

[
    {
    "caption": "Custom",
    "id": "custom",
    "children":
    [
        { "command": "*somecommandhere*", "args": {}, "caption": "Toggle WordCount plugin", "checkbox": true }
    ]
    }
]

However, I don't know which command to use to disable/re-enable a plugin. I assume this would be the same command from the console and inside of a menu file.

2

2 Answers

0
votes

The following Main.sublime-menu will work:

[
    {
        "caption": "Custom",
        "id": "custom",
        "children": [
            {
                "caption": "Disable Package",
                "id": "disable_package",
                "command": "disable_package"
            }
        ]
    }
]

When selected, it opens a dropdown menu with all of the currently-active packages listed, and you can use fuzzy matching to quickly select the package you want to disable. Unfortunately, there is no way to specify which package you want to disable, as DisablePackageCommand doesn't take any arguments.

0
votes

I am under exactly the same situation as you. Same big default file, same MBP, same WordCount plugin. And here is my solution.

To disable packages

  1. Press super + , to bring up Preferences.sublime-settings, which can also be allocated at:

OSX

~Library/Application Support/Sublime Text 3/Packages/User

Windows

C:\Users\USERNAME\AppData\Roaming\Sublime Text 3\Packages\User

Linux

~/.config/sublime-text-3/Packages/User
  1. Because the package Vintage is disabled by default, you should find these lines in your Preferences.sublime-settings.

"ignored_packages": [ "Vintage" ],

  1. Add "WordCount", (include the comma) before the last package(i.e. "Vintage") inside "ignored_packages".

"ignored_packages": [ "WordCount", "Vintage" ],

  1. Save the file. That is it! The WordCount plugin has been disabled.

To enable packages

  1. press super + , to bring up Preferences.sublime-settings, use supre + / to comment out the package. Like this:

"ignored_packages": [ // "WordCount", "Vintage" ],

  1. Save the file. That is it! The WordCount plugin has been disabled.

To toggle packages like a pro (conclusion)

  1. super + , to bring up preferences.
  2. super + / to enable or disable packages.
  3. super + s to profit.

No mouse, no plugin needed, no need to restart ST.

It is very simple and fast. I always use this method to quickly enable and disable packages in Sublime Text. Hope it help :)