If I had a list like this,
* Adam
likes coffee
* Beth
blon[the cursor is here]de
* Carl
I’d like to search the previous occurrence of the regex pattern “^*” and move the cursor before it like this
* Adam
likes coffee
[the cursor is now here]* Beth
blonde
* Carl
I wrote the snippet below but the method find_prev() doesn’t seem to exist.
How can I find the previous occurrence of a regex pattern?
import sublime, sublime_plugin
class JumpToLastAsteriskCommand(sublime_plugin.TextCommand):
def run(self, edit):
sels = self.view.sel()
self.view.sel().clear()
self.view.sel().add((self.view.find_prev('^\*', sel.end())))