Restore last document position/scroll position/cursor position

MOD EDIT: The document position is currently restored when you navigate in the tab history (back/forward) but not when you open a new tab.

Hey there - I am currently using Obsidian 0.6.5 and realized that every time I reopen a page, the head / first line of the document is shown.

From several text editors I am used to starting at the same line I closed the page for the last time. Maybe there could be an option added that scroll locations are always saved?
This would speed up my experience with large documents quite a bit!

Thanks,
magisterludi

61 Likes

Same thing for me. I would really like to keep the scroll position in place when browsing several documents.

4 Likes

+1 for me. Wanted to add that the scrolling location also resets when toggling between preview and edit mode, which can be annoying when you preview often.

8 Likes

Same here, switching between documents is a very common behavior especially when writing down the ideas from scratch, when I return to the origin document by using command + O after creating a link, the scroll position is lost, I have to leave my hand from keyboard to scroll, this is annoying and reduces my productivity a lot, I really wish it could be improved.

1 Like

From a technical perspective, maybe you should keep the state of the document editor when opening another one, like vim’s buffer, the recently opened documents are kept in a queue so that they can be easily recovered when opened again.

I just saw @Silver said in 0.8.1 the scroll position will not be lost when switching between editing and preview mode, I got a feeling that this feature is very close to achieve, really need it to improve my life quality, thank you! :pray:

1 Like

Obsidian makes it very easy to navigate between notes, but it loses much of its usefulness if it does not maintain its reading position.

A configuration file could be created in the root folder that stores the center line of each open note, updating with the autosave.

It is also important to maintain the position in the transition between editing / reading.

Of course, you should not consider specific links to headers.

4 Likes

I agree. It takes time to scroll to the proper place when switching notes. I often want to go to where I ended last time.

1 Like

Yep. Working with multiple large documents can be a pain. At least a temporary cache would help.

Would love to see this too.

1 Like

So it turns out Typora has this. Based on my observations, it is stored in a temporary cache, as the location is lost upon restart.

Typora actually has pretty much all the features I want for Obsidian… Typora+Obsidian’s links=parfait.

2 Likes

Synchronization between editor\preview has been implemented.
I renamed this thread to reflect what needs to be done, i.e. Restoring last document position upon starting obsidian.

Has this been added in 0.8.10 or 0.8.11? Because this thread also includes restoring last document position while switching between different files, not just when closing and opening Obsidian.

Any news about that?
I think the most important feature is storing document positions while switching between different documents in the vault. For example, while I’m reading a long note, then I switch to another note to write my thoughts and when I turn to the previous note… the last position is lost, the top of note is visualized and I have to manually scroll to the point I was reading before.

Keeping document positions in the session should be standard behaviour. I don’t know if a specific thread should be created.

Restore last document position upon starting obsidian - I think - should be an option in settings.

1 Like

Technically if you navigate to a different note, then use the back button or ctrl+alt+arrow keys to return, then your position is temporarily saved. This is an improvement, but is not sufficient if you don’t want to scroll through a bunch of pages. I agree, the default behavior should be to maintain document position no matter the action.
This thread was initially about position retention in all situations, but once the partial functionality was implemented, @WhiteNoise renamed it.

2 Likes

At least now it saves the position while Obsidian is open, but restoring the position when reopen the app would be quite nice.

1 Like

Hi. I wrote a plugin that remembers the position of the cursor and scroll for each note. Look for “Remember cursor position” in the community plugins list.

Here is the repository: GitHub - derwish-pro/obsidian-remember-cursor-position: Obsidian plugin. Remember cursor position for each note

10 Likes

This feature is a really convenient one, especially when the md file is large. Upvote!

Thank you @derwish for the amazing plugin. I was wondering if it could be made to remember the horizontal scroll position in addition to the vertical scroll position. I’ve opened a new issue on github.

1 Like

Use case or problem

I process most of my stuff from obsidian mobile using one file, adding new lines to the bottom. Every time I reopen obsidian, it takes me to the top of that file, whilst I’d prefer to be taken to my original location within the file.

Proposed solution

Remember scroll location when closing the workspace

4 Likes