How can I turn this off? Isn't there a quick way to toggle this on/off?
Please help, I'm losing my mind: screenshot


import sublime_plugin
class ToggleDrawWhiteSpaceCommand(sublime_plugin.TextCommand):
def run(self, edit):
settings = self.view.settings()
setting = settings.get("draw_white_space")
if setting == "all":
settings.set("draw_white_space", "none")
else:
settings.set("draw_white_space", "all")
{ "keys": ["f12"], "command": "toggle_draw_white_space" }skuroda wrote:As a side note, you can create Stylus.sublime-settings in your user directory so you don't have to edit the installed package. This holds true for any user specific settings. Now onto your original question.
This can be done easily with a plugin. First, create a new plugin (in the menu select Tools -> New Plugin). Paste the following code and save. This should be saved in your user directory. You may name the file whatever you want, just ensure it is saved as a python file.
- Code: Select all
import sublime_plugin
class ToggleDrawWhiteSpaceCommand(sublime_plugin.TextCommand):
def run(self, edit):
settings = self.view.settings()
setting = settings.get("draw_white_space")
if setting == "all":
settings.set("draw_white_space", "none")
else:
settings.set("draw_white_space", "all")
Next, add the following to your user keybinding (Accessible through Preferences -> Key Bindings - User) and add the following
- Code: Select all
{ "keys": ["f12"], "command": "toggle_draw_white_space" }
Of course, you can change the keybinding to whatever you want.
Users browsing this forum: No registered users and 4 guests