Restore last document position/scroll position/cursor position

I created a plugin and a post that attempts to describe the inteded behavior that’s specific to the view rather than the document/file. That’s the right approach since the same document can be opened in paralel views with different cursor and scrolling offsets. Hence, it’s the view / editor that needs to be persisted.

Documented here:

I also created a plugin that sort of works as I’d like it to work. I was not able to restore the exact scroll position. I tried in several ways, but the API is messy and not documented. So, currently, it restores the scroll to a centered / quasi-centered relative to the cursor position. It’s not ideal, but seems to do the job for me. I typically have 5-10 documents opened.

I haven’t published the plugin yet, as apparently I’m too stupid to release it properly. It’s called “Remember View State”, I’ll try to get it done soon. Stay tuned.

This said, I still believe this should be supported in vanilla Obsidian, not as a plugin as it’s a bit of a standard application best practice these days to get back to where things were left.

1 Like