Skip to content

Instantly share code, notes, and snippets.

@alloy-d
Created July 15, 2012 21:53
Show Gist options
  • Save alloy-d/3118845 to your computer and use it in GitHub Desktop.
Save alloy-d/3118845 to your computer and use it in GitHub Desktop.
Simple Sublime Text 2 plugin to enable quick toggling of the 'draw_white_space' setting between 'selection' and 'all'.
[
{"caption": "Toggle Shown Spaces", "command": "toggle_shown_spaces"}
]
import sublime, sublime_plugin
class ToggleShownSpacesCommand(sublime_plugin.ApplicationCommand):
def run(self):
settings = sublime.load_settings("Preferences.sublime-settings")
draw_white_space = settings.get("draw_white_space")
if draw_white_space == "selection":
draw_white_space = "all"
else:
draw_white_space = "selection"
print "Attempting to set draw_white_space to", draw_white_space
settings.set("draw_white_space", draw_white_space)
sublime.save_settings("Preferences.sublime-settings")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment