Skip to content

Instantly share code, notes, and snippets.

@chriseidhof
Created January 31, 2014 11:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriseidhof/8730611 to your computer and use it in GitHub Desktop.
Save chriseidhof/8730611 to your computer and use it in GitHub Desktop.
Deckset Sublime Plugin
# Go to Tools > New Plugin, type deckset.py and press 'Save'
# Then paste in the code below.
#
# It currently only works when you have a single file open, but it could easily be improved (pull requests very welcome)
import sublime, sublime_plugin, subprocess, os
class GoToSlideCommand(sublime_plugin.TextCommand):
def run(self, edit):
pos = self.view.sel()[0].begin()
cmd = """tell application "Deckset" to tell document 1 to set position to %d""" % pos
subprocess.call(["osascript", "-e", cmd])
class CursorRulerListener(sublime_plugin.EventListener):
def on_selection_modified(self, view):
active_window = sublime.active_window()
if active_window is not None:
# The view parameter doesn't always match the active view
# the cursor is in. This happens when there are multiple
# views of the same file.
active_view = active_window.active_view()
syntaxPath = active_view.settings().get('syntax')
if(syntaxPath != None):
syntax = os.path.splitext(syntaxPath)[0].split('/')[-1].lower()
if("markdown" in syntax):
active_view.run_command('go_to_slide')
@philippkeller
Copy link

is this still supposed to work? I am on Sublime 3, added a plugin via "Tools > New Plugin" and saved the script above as deckset.py. But in Command Palette (Cmd-Shift-P) there's no Command "Deckset", right click also doesn't show Deckset, how is this supposed to be used?

@philippkeller
Copy link

also, when I install this script, then my sublime gets very slow (every keypress seems to trigger something, and the cursor movement is slowed down/delayed)

@philippkeller
Copy link

I found a workaround via a build system:

{
        "cmd": ["open","-a","/Applications/Deckset.app","$file"],
        "selector": "text.html.markdown"
}

add this build system via Tools -> Build System -> New build system...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment