Skip to content

Instantly share code, notes, and snippets.

@zrxq
Created June 30, 2011 08:11
Show Gist options
  • Save zrxq/1055851 to your computer and use it in GitHub Desktop.
Save zrxq/1055851 to your computer and use it in GitHub Desktop.
Sublime Text 2 plugin for inserting UUID 1 (host- and time-based)
import sublime, sublime_plugin
from uuid import uuid1
class generate_uuid1Command(sublime_plugin.TextCommand):
def insert_text(self, edit, what):
[self.view.replace(edit, reg, what) for reg in self.view.sel()]
def run(self, edit):
self.insert_text(edit, str(uuid1()))
# Bind to a shortcut by adding the following line to your
# user .sublime-keymap:
#
# { "keys": ["super+g", "super+1"], "command": "generate_uuid1" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment