Skip to content

Instantly share code, notes, and snippets.

@iamntz-gists
Created November 29, 2012 12:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iamntz-gists/4168714 to your computer and use it in GitHub Desktop.
Save iamntz-gists/4168714 to your computer and use it in GitHub Desktop.
import sublime, sublime_plugin, string
class MultiSelectNumbersCommand(sublime_plugin.TextCommand):
def run(self, edit):
window = self.view.window()
def countThoseSelections(pattern):
pattern = string.split( pattern, ':' )
region_index = int( pattern[0] )
for region in self.view.sel():
replaceRegion = sublime.Region( region.begin() - 1, region.begin() )
prevChar = self.view.substr( replaceRegion )
if( prevChar == '#' ):
self.view.replace( edit, replaceRegion, str( region_index ) )
region_index = region_index + int( pattern[1] )
window.show_input_panel('Count Start:Step (optional; default is 1:1)', '1:1', countThoseSelections, None, None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment