Skip to content

Instantly share code, notes, and snippets.

@zszugyi
Created May 3, 2012 18:02
Show Gist options
  • Select an option

  • Save zszugyi/2587656 to your computer and use it in GitHub Desktop.

Select an option

Save zszugyi/2587656 to your computer and use it in GitHub Desktop.
sublime_text2 plugin to add numbers to the selected locations in the current view
import sublime, sublime_plugin
class NumberSelections(sublime_plugin.TextCommand):
def run(self, edit):
selections = self.view.sel()
for i in reversed(range(len(selections))):
selection = self.view.sel()[i]
self.view.insert(edit, selection.begin(), "%d" % (i + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment