Created
October 19, 2013 11:41
-
-
Save Gaubee/7054877 to your computer and use it in GitHub Desktop.
选中的数字值累加1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| [ | |
| { "keys": ["shift+f1"], "command": "increment_selection" } | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment