This content originally appeared on DEV Community and was authored by Koichi Kimura
Have you ever switched tabs in VSCode and forgotten where your cursor was?
This happens to me all the time, especially when jumping between multiple files in large codebases.
So… I built a tiny VSCode extension to solve it.
👻 What is Cursorghost?
Cursorghost is a lightweight VSCode extension that remembers your cursor position in each file tab — and restores it automatically when you switch back.
No setup needed. Just install it, and it works.
🧠 Why I built this
I got tired of constantly losing my cursor position and manually scrolling back to where I was editing. VSCode doesn’t remember the position across tabs by default, so I decided to write my own solution.
I wanted it to:
- Be automatic and seamless
- Work across all file types
- Require no config
- Be easy to install and forget
🛠️ How it works (under the hood)
In short:
- It listens for
onDidChangeActiveTextEditor
- It stores the current cursor line whenever you switch away
- When you come back, it restores the last known position
All written in TypeScript. The source is open on GitHub:
👉 GitHub - kupuma-ru21/cursorghost
🚀 How to use it
- Open VSCode Extensions and search
Cursorghost
- Click install
- Switch tabs and feel the magic! ✨
No configuration required.
🧩 Ideas for future features
- Diff view support
- Multi-cursor support
- Exclude certain files/types
I’m open to feedback and PRs!
🙏 Final thoughts
Sometimes it’s the little things that make your workflow feel smoother.
I hope Cursorghost saves you some frustration like it did for me.
If you try it and find it helpful, please ⭐️ the GitHub repo and share it with others!
Let me know what you think — and thanks for reading 👋
💻 Built by @kupuma-ru21
This content originally appeared on DEV Community and was authored by Koichi Kimura

Koichi Kimura | Sciencx (2025-03-23T22:40:51+00:00) Tired of losing your cursor when switching tabs in VSCode? Meet Cursorghost 👻. Retrieved from https://www.scien.cx/2025/03/23/tired-of-losing-your-cursor-when-switching-tabs-in-vscode-meet-cursorghost-%f0%9f%91%bb/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.