here you have a “start” from there I hope you can get what you desire. Is very easy to read, just take a look to http://www.sublimetext.com/docs/3/api_reference.html in case of doubt, you can trigger following command like…
/User/Default.sublime-keymap
import functools, sublime, sublime_plugin
class open_file_with_custom_find_command(sublime_plugin.WindowCommand):
def run(self):
window = sublime.active_window()
window.run_command(‘hide_panel’);
window.show_input_panel(‘Search For 1:’, ‘’, functools.partial(self.on_done1), None, None)
def on_done1(self, search_for1):
search_for1 = search_for1.strip()
if search_for1:
window = sublime.active_window()
window.run_command('hide_panel');
window.show_input_panel('Search For 2:', '', functools.partial(self.on_done2, search_for1), None, None)
def on_done2(self, search_for1, search_for2):
window = sublime.active_window()
view = window.active_view()
search_for2 = search_for2.strip()
if search_for1 and search_for2:
regions1 = view.find_all(search_for1, sublime.IGNORECASE)
regions2 = view.find_all(search_for2, sublime.IGNORECASE)
if regions1 and regions2:
for item1 in reversed(regions1):
sel_start = view.line(item1).end()
for item2 in reversed(regions2):
if item2.end() < sel_start:
print(substr)
substr = view.substr(sublime.Region(sel_start, item2.begin()))
if substr:
_view = window.new_file()
_view.run_command('insert', {'characters': substr})
break
asf{ibsbi{pfs
phisbf
´hsbfaó
bfasi
sbfa
pibfasphi
bfasó
bfas
ójbfa
ójbfasójbfasój
bfas
I fucking hate markdown, this is crap, let me put this on an external file