Permalink
Browse files

Supports sublime text 3

  • Loading branch information...
1 parent a3788db commit 4f97a0f3cfceae3a5a2901a4f509252cbc3e2955 @titoBouzout committed Mar 27, 2013
Showing with 13 additions and 13 deletions.
  1. +12 −12 WordCount.py
  2. +1 −1 WordCount.sublime-settings
View
@@ -3,7 +3,18 @@
import threading
from os.path import basename
-s = sublime.load_settings('WordCount.sublime-settings')
+def plugin_loaded():
+ global s, Pref
+ s = sublime.load_settings('WordCount.sublime-settings')
+ Pref = Pref()
+ Pref.load();
+ s.add_on_change('reload', lambda:Pref.load())
+
+ if not 'running_word_count_loop' in globals():
+ global running_word_count_loop
+ running_word_count_loop = True
+ t = threading.Thread(target=word_count_loop)
+ t.start()
class Pref:
def load(self):
@@ -20,14 +31,8 @@ def load(self):
Pref.enable_count_lines = s.get('enable_count_lines', False)
Pref.enable_count_chars = s.get('enable_count_chars', False)
Pref.readtime_wpm = s.get('readtime_wpm', 200)
- # sometimes s.get() is returning None instead of the default?
Pref.whitelist = [x.lower() for x in s.get('whitelist_syntaxes', []) or []]
Pref.blacklist = [x.lower() for x in s.get('blacklist_syntaxes', []) or []]
- # Pref.whitelist = map(lambda x: x.lower(), s.get('whitelist_syntaxes', []))
-
-Pref = Pref()
-Pref.load();
-s.add_on_change('reload', lambda:Pref.load())
class WordCount(sublime_plugin.EventListener):
@@ -210,8 +215,3 @@ def word_count_loop():
sublime.set_timeout(lambda:word_count(), 0)
time.sleep((Pref.elapsed_time*3 if Pref.elapsed_time > 0.4 else 0.4))
-if not 'running_word_count_loop' in globals():
- running_word_count_loop = True
- t = threading.Thread(target=word_count_loop)
- t.start()
-
@@ -11,5 +11,5 @@
"enable_count_lines": false,
"whitelist_syntaxes": [],
- "blacklist_syntaxes": ["CSS","SQL"]
+ "blacklist_syntaxes": ["CSS","SQL","JavaScript","PHP"]
}

0 comments on commit 4f97a0f

Please sign in to comment.