I found two ways to do almost what I wanted.
The first is to find the next instance of the search string myself and then select it via the API. Then it can be slurped to the find text string in the find panel.
text = "dummy01"
# Add word boundaries so that we only find complete words.
reg = self.view.find("\\b" + text + "\\b", self.view.sel()[0].a, sublime.IGNORECASE )
if reg:
self.view.sel().add(reg) # Add string to the selection (currently empty)
self.view.show(reg) # Make sure the result is visible
self.view.window().run_command("show_panel", {"panel": "find", "reverse": False})
self.view.window().run_command("slurp_find_string")
This does exactly what I want for the first instance of the search string. But now I would like to find the next occurence using F3 and for that to work correctly I need to: set the whole word option and clear the case-sensitive option. I found commands for toggling these options but none to set them to a known value (or to get the current value so that I could conditionally toggle it)
The second way is to call up the “goto” panel and search for it as a symbol in the current file. This text is shown correctly (maybe with a list of alternatives) but I need an extra keypress to go to it and then have the same problems as above when I try to continue the search.
view.window().run_command("show_overlay", {"overlay": "goto", "text": "#" + text }); #st3
Any ideas?