public
Last active

  • Download Gist
add_number_to_multiselects.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.