Created
September 6, 2012 14:12
-
-
Save chitchcock/3656680 to your computer and use it in GitHub Desktop.
Sublime Text 2 Plugin to search for decimal values using a hex value
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, sublime_plugin | |
class SearchHexCommand(sublime_plugin.TextCommand): | |
def findHexInView(self, pcode): | |
intToFind = int(pcode, 16) | |
print('Looking for ' + str(intToFind)) | |
self.markers = [] | |
self.foundRegions = [] | |
self.foundRegions = self.view.find_all('(' + str(intToFind) + ')', 0, '$1', self.markers) | |
if self.foundRegions != None: | |
print (self.foundRegions) | |
self.view.window().show_quick_panel(self.markers, self.gotoMarker, sublime.MONOSPACE_FONT) | |
def gotoMarker(self, choice): | |
if choice == -1: | |
return | |
self.view.show(self.foundRegions[choice]) | |
def run(self, edit): | |
self.view.window().show_input_panel('Enter Hex Value To Find', '', self.findHexInView, None, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment