Home Download Buy Blog Forum Support

Generate UUID

Generate UUID

Postby ehamiter on Fri Nov 18, 2011 8:31 pm

This plugin will generate a UUID (uuid4, to be specific-- if you want to know more, or if you should edit this to use uuid1, read more here) or a series of UUIDs if you have selected multiple points.

Copy the below code and save it as generate_uuid.py and put it in ST2's Packages/User directory (Sublime Text 2 > Preferences > Browse Packages... > User).

Code: Select all
import sublime_plugin
import uuid

class GenerateUuidCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        u = str(uuid.uuid4())
        for r in self.view.sel():
            self.view.replace(edit, r, u)

I've added this to my User Key Bindings (Command-Shift-u on a Mac):

Code: Select all
{ "keys": ["super+shift+u"], "command": "generate_uuid" }
Posts: 67
Joined: Wed Apr 27, 2011 2:42 am

Re: Generate UUID

Postby facelessuser on Fri Nov 18, 2011 8:38 pm

Thanks, this is useful.
Posts: 1780
Joined: Tue Apr 05, 2011 7:38 pm

Re: Generate UUID

Postby SeanJM on Tue Sep 24, 2013 7:17 pm

Very useful, thank you!
Posts: 11
Joined: Sat Jul 14, 2012 3:03 pm

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 19 guests