Permalink
Browse files

disable double-click by default, add setting for it

  • Loading branch information...
1 parent 3cfda0f commit 10540b05c59ae9987b7387f909137c327cc25842 @lunixbochs committed Oct 31, 2012
Showing with 29 additions and 2 deletions.
  1. +14 −0 Default.sublime-commands
  2. +15 −2 xiki.py
View
14 Default.sublime-commands
@@ -6,5 +6,19 @@
{
"caption": "Create Xiki Buffer",
"command": "new_xiki"
+ },
+ {
+ "caption": "Preferences: SublimeXiki Settings – Default",
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/SublimeXiki/SublimeXiki.sublime-settings"
+ }
+ },
+ {
+ "caption": "Preferences: SublimeXiki Settings – User",
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/User/SublimeXiki.sublime-settings"
+ }
}
]
View
17 xiki.py
@@ -8,6 +8,7 @@
from lib.util import communicate, popen, create_environment
from collections import defaultdict
+import json
import os
import platform
import Queue
@@ -21,6 +22,8 @@
INDENTATION = ' '
backspace_re = re.compile('.\b')
+xiki_settings = sublime.load_settings('SublimeXiki.sublime-settings')
+
class BoundaryError(Exception): pass
if not 'already' in globals():
@@ -458,7 +461,17 @@ def on_query_context(self, view, key, operator, operand, match_all):
return True
def on_load(self, view):
- if is_xiki_buffer(view):
+ # handle new user preferences file
+ if view.file_name() and os.path.split(view.file_name())[1] == 'SublimeXiki.sublime-settings':
+ if view.size() == 0:
+ edit = view.begin_edit()
+
+ template = {
+ "double_click": False
+ }
+ view.insert(edit, 0, json.dumps(template, indent=4))
+ view.end_edit(edit)
+ elif is_xiki_buffer(view):
apply_xiki_settings(view)
def on_close(self, view):
@@ -492,7 +505,7 @@ def run(self):
class XikiClick(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
- if is_xiki_buffer(view):
+ if is_xiki_buffer(view) and xiki_settings.get('double_click'):
sel = view.sel()
s = sel[0]

0 comments on commit 10540b0

Please sign in to comment.