Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active November 10, 2016 11:06
Show Gist options
  • Save anthonybudd/945e18406f6f65291a64fff115f63d98 to your computer and use it in GitHub Desktop.
Save anthonybudd/945e18406f6f65291a64fff115f63d98 to your computer and use it in GitHub Desktop.
THE BEST PLUGIN
# Sublime: Tools -> Developer -> New Plugin
# Preferences -> Key Bindings
# Default (OSX).sublime-keymap: { "keys": ["alt+1"], "command": "increment_selection" }
import sublime, sublime_plugin
class IncrementSelectionCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = 1
counter = 0
for selection in self.view.sel():
self.view.insert(edit, selection.begin(), str(start_value + counter))
counter = counter + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment