Skip to content

Instantly share code, notes, and snippets.

@blueplanet
Last active December 14, 2015 06:49
Show Gist options
  • Save blueplanet/5046177 to your computer and use it in GitHub Desktop.
Save blueplanet/5046177 to your computer and use it in GitHub Desktop.
import sublime, sublime_plugin
import os
class AutoSwitchViewTabSizeCommand(sublime_plugin.EventListener):
""" Auto switch tab_size with syntax"""
# def on_activated(self, view):
def on_load(self, view):
syntax = view.settings().get('syntax')
if syntax.find("Ruby") > 0 or syntax.find("JavaScript") > 0:
view.settings().set("tab_size", 2)
elif syntax.find("Python") > 0:
view.settings().set("tab_size", 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment