Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve xiki save/load

  • Loading branch information...
commit 3cfda0f93bf68cd9295a2edb8f5bcb178ad89ede 1 parent 5183e32
@lunixbochs authored
Showing with 14 additions and 6 deletions.
  1. +3 −1 Xiki.tmLanguage
  2. +11 −5 xiki.py
View
4 Xiki.tmLanguage
@@ -3,7 +3,9 @@
<plist version="1.0">
<dict>
<key>fileTypes</key>
- <array>xiki</array>
+ <array>
+ <string>xiki</string>
+ </array>
<key>name</key>
<string>Xiki</string>
<key>patterns</key>
View
16 xiki.py
@@ -423,6 +423,12 @@ def wrapper():
return wrapper
+def apply_xiki_settings(view):
+ settings = view.settings()
+ settings.set('tab_size', 2)
+ settings.set('translate_tabs_to_spaces', True)
+ settings.set('syntax', 'Packages/SublimeXiki/Xiki.tmLanguage')
+
def is_xiki_buffer(view):
if view is None or not view.settings().has('syntax'):
return False
@@ -451,6 +457,10 @@ def on_query_context(self, view, key, operator, operand, match_all):
if key == 'xiki' and is_xiki_buffer(view):
return True
+ def on_load(self, view):
+ if is_xiki_buffer(view):
+ apply_xiki_settings(view)
+
def on_close(self, view):
vid = view.id()
for process in commands[vid].values():
@@ -477,11 +487,7 @@ def run(self):
class NewXiki(sublime_plugin.WindowCommand):
def run(self):
view = self.window.new_file()
- settings = view.settings()
-
- settings.set('tab_size', 2)
- settings.set('translate_tabs_to_spaces', True)
- settings.set('syntax', 'Packages/SublimeXiki/Xiki.tmLanguage')
+ apply_xiki_settings(view)
class XikiClick(sublime_plugin.WindowCommand):
def run(self):
Please sign in to comment.
Something went wrong with that request. Please try again.