Tired of losing your cursor when switching tabs in VSCode? Meet Cursorghost πŸ‘»



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.

👉 Marketplace Link

Demo

🧠 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

  1. Open VSCode Extensions and search Cursorghost
  2. Click install
  3. 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