moe icon indicating copy to clipboard operation
moe copied to clipboard

When opening a buffer for a file, put cursor at the same position it was at last time

Open tobimensch opened this issue 3 years ago • 0 comments

Example: You edit a file, then you close it, and then you remember that you weren't done, so you want to open it again. The likelihood is high that you'll want to continue editing at or near the position where you made the latest edit, or where the cursor was positioned last.

For this reason I think the following features would make a lot of sense.

openFileAtLastCursorPosition openFileAtLastEditPosition

Both of these options would only make sense, if the file was opened before, and openFileAtLastEditPosition, of course only makes sense, if there has been any edit.

To make this work, moe would need to keep track of cursor positions in a global store. Always save it when a buffer for a file gets closed, when it gets written on file, or in any kind of crash/shutdown/closing/exception handling operation.

Of course, along with this you could implement and save a whole list of last cursor positions (from earliest to latest) for each buffer. This will be needed anyway for jump lists and the like.

tobimensch avatar Jul 18 '20 16:07 tobimensch