Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sublime Text 2 Plugin to search for decimal values using a hex value
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
You can’t perform that action at this time.