OSC 7 and zoxide: A great pairing

2026-05-02

Things in Neovim keep getting better and better with every release. The 0.12.0 release introduced many great new features, the best of which is probably the built-in plugin system vim.pack.

One thing that has been possible in Neovim since before this update that I slept on for way too long is having it respect OSC 7 in terminals. If you pop open the help for OSC 7 with :h osc7, you'll see a small guide for how to set up your shell and editor so that they work together to emit and handle OSC 7 correctly. Once you've done this, changing directory within a terminal in Neovim will have Neovim execute :lcdwith the directory you changed to.

In case you aren't aware, :lcdwill change the current directory only for the current window. This is excellent when you adopt a workflow with a tab-per-project mindset. Usually I find that I need a couple of buffers available when working on a project: one for text editing, and another for a terminal to run a dev server, tests, etc. So my workflow nowadays usually consists of opening a new tab with a terminal (:tabnew +term), changing directory to the project I want to work on, and then making changes to files in the project. I'll usually keep the terminal buffer hidden and switch back to it when I need to, either with a mark or something similar.

To make things even better, I also add zoxide into the mix. This is a tool that keeps track of what directories you've visited in the past, and then uses a fuzzy finding algorithm to make a guess at where you want to go, instead of you having to type out the entire path. So if I want to make a change to this site, I can just enter z webin a terminal, and it will take me to my website project. You can already see how this integrates superbly with OSC 7.

I'm also currently playing around with a custom script to help me create new project tabs quicker. Ideally I'd press a keybind and I'd be able to use fffto fuzzy-find projects (in a given set of directories). When I select one, it would open a new tab, possibly with a set window layout, and with :tcdalready called to set the tab working directory correctly. You can already pretty easily achieve something like this using the snacks.nvim project picker, but it's fun to build your own version of things.