Skip to content

Instantly share code, notes, and snippets.

@khairulhasanmd
Last active April 2, 2016 05:18
Show Gist options
  • Save khairulhasanmd/a7e15852ff7fbc41cc457363c7dab36c to your computer and use it in GitHub Desktop.
Save khairulhasanmd/a7e15852ff7fbc41cc457363c7dab36c to your computer and use it in GitHub Desktop.
incremental selection sublime
in Tools/New Plugin...:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import sublime, sublime_plugin
class IncrementSelectionCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = int(self.view.substr(self.view.sel()[0]))
counter = 0
for selection in self.view.sel():
self.view.insert(edit, selection.begin(), str(start_value + counter))
counter = counter + 1
for selection in self.view.sel():
self.view.erase(edit, selection)
IN Key Bindings - User:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{ "keys": ["ctrl+alt+i"], "command": "increment_selection" },
from
http://stackoverflow.com/questions/14574941/add-a-number-to-each-selection-in-sublime-text-2-incremented-once-per-selection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment