Sublime Forum

Remembering cursor positions of open files

#1

Does Sublime Text remember the cursor position of closed files? On Mac after I close a file and reopen the cursor position always starts at the top of the file and I don’t know if this is a bug or expected behavior. Obviously I’d like my cursor position to not always be resetting.

0 Likes

#2

if you close and reopen ST, the caret positions will be remembered, but if you close and reopen a file and want it to remember your last position, you will need to use a plugin. BufferScroll, maybe?

0 Likes

#3

Thanks for responding Keith. I could swear that was a bug or I broke something so that’s good to know it’s working as expected. I’ll look into BufferScroll.

0 Likes

#4

Oi, don’t recommend that one. It has so many bugs. It tries to do what you want, but also tries to do 5000 other things and one of those “features” is bound to mess up your day at some point.

If you’re going to look into BufferScroll, you can perhaps try to extract what you need. Just know that Sublime has no API to do what you want so you have to resort to storing a bunch of information somewhere all by yourself, keep it up to date and deal with cache invalidation. So, no fun.

0 Likes

#5

Oi, don’t recommend that one. It has so many bugs . It tries to do what you want, but also tries to do 5000 other things and one of those “features” is bound to mess up your day at some point.

I also have the same issue with BufferScroll. Which is why today I got tired of it and wrote a ST plugin myself (my first actually). Hope this helps:
https://gmpy.dev/blog/2022/sublime-text-remember-cursor-position-plugin

2 Likes