See the rough code of what I have atm. It currently searches the current doc and sets the cursor to the correct position.
How can I modify this to:
- Ask for input for the search string.
- Set the position of the cursor on all currently open files.
import sublime, sublime_plugin class AllOpenFilesScrollToFoundText(sublime_plugin.TextCommand): def run(self, edit): # 1. I would like to loop over the open files which I cannot get to work. # for view in self.window.views(): view = self.view contents = view.substr(sublime.Region(0, view.size())) # https://stackoverflow.com/questions/20182008/sublime-text-3-api-get-all-text-from-a-file # 2. Here I would like a prompt to enter the text to find. # Using something like this which I cannot get to work. # searchStr = self.window.show_input_panel("Enter text to scroll to on all open windows:", '', None, None, None) searchStr = contents.find('TODO') cursors = view.sel() cursors.clear() location = sublime.Region(searchStr, searchStr) cursors.add(location) view.show_at_center(location)