I thought I might re-post the following here, as it seems to be working quite well. If you assign **last_edit_line **to a key binding it moves/cycles between the last five edited positions of the current view.
It’s not bullet-proof - it’s quite easy to distort it by deleting a few lines, undo-ing, duplicating a line etc. - but still quite handy
[code]import sublime, sublime_plugin
POSNS = {}
class LastEditLineCommand(sublime_plugin.TextCommand):
posn = 0
def run(self, edit):
vid = self.view.id()
if not POSNS.has_key(vid): return
if len(POSNS[vid]) <= self.posn + 1:
self.posn = 0
self.view.sel().clear()
self.view.show(POSNS[vid]-(self.posn + 1)])
self.view.sel().add(self.view.line(POSNS[vid]-(self.posn + 1)]))
self.posn = (self.posn + 1) % 5
class CaptureEditing(sublime_plugin.EventListener):
def on_modified(self, view):
sel = view.sel()[0]
vid = view.id()
curr_line, _ = view.rowcol(sel.begin())
if not POSNS.has_key(vid):
POSNS[vid] = [curr_line, sel.begin()]
elif POSNS[vid][0] != curr_line:
POSNS[vid].append(sel.begin())
POSNS[vid][0] = curr_line
if len(POSNS[vid]) > 6: POSNS[vid].pop(1)[/code]