Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jugyo committed Aug 31, 2012
0 parents commit a2db13a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.pyc
3 changes: 3 additions & 0 deletions Default (OSX).sublime-keymap
@@ -0,0 +1,3 @@
[
{ "keys": ["ctrl+super+shift+r"], "command": "random_theme" }
]
3 changes: 3 additions & 0 deletions Default.sublime-commands
@@ -0,0 +1,3 @@
[
{ "caption": "RandomTheme", "command": "random_theme" }
]
20 changes: 20 additions & 0 deletions README.md
@@ -0,0 +1,20 @@
RandomTheme
====

Sublime Text 2 plugin that changes the theme randomly.
ランダムにテーマを変更する崇高なテキスト2プラグイン。(Google Translate)

Synopsis
----

Default.sublime-commands:

[
{ "caption": "RandomTheme", "command": "random_theme" }
]

Default (OSX).sublime-keymap:

[
{ "keys": ["ctrl+super+shift+r"], "command": "random_theme" }
]
15 changes: 15 additions & 0 deletions RandomTheme.py
@@ -0,0 +1,15 @@
import sublime, sublime_plugin
import os
import random

class RandomThemeCommand(sublime_plugin.TextCommand):
def run(self, edit):
settings = sublime.load_settings('Preferences.sublime-settings')
current_theme = settings.get('color_scheme')
files = os.listdir("%s/%s" % (sublime.packages_path(), 'Color Scheme - Default'))
themes = [t for t in files if not t.endswith('.cache') and not current_theme.endswith(t)]
new_theme = random.choice(themes)
theme_path = "Packages/Color Scheme - Default/%s" % new_theme
settings.set('color_scheme', theme_path)
sublime.save_settings('Preferences.sublime-settings')
sublime.status_message("Theme changed: '%s' => '%s'" % (current_theme, new_theme))

0 comments on commit a2db13a

Please sign in to comment.