Neovim Debugging: A Dev's Edge in the AI Age


Neovim Debugging: A Dev's Edge in the AI Age

In a world where AI-generated code is slowly becoming the norm, mastering debugging isn't just a nice-to-have skill—it's survival.

As John Carmack, the legendary game engine developer, wisely pointed out:

"A debugger is how you get a view into a system that's too complicated to understand.
I mean, anybody that thinks 'just read the code and think about it'—
that's an insane statement."

- Lex Fridman Podcast


What's the problem?

Most developers encounter bugs and immediately resort to the primitive approach of adding print statements, recompiling, and rerunning their code.

They sprinkle print() statements throughout their codebase, hoping to catch a glimpse of what's happening. This approach is painfully inefficient and often leads nowhere.

The standard solution—littering your code with log statements—creates more problems than it solves.

It clutters your codebase, forces unnecessary recompilation cycles, and provides only limited visibility into what's actually happening. Even for those who aren't compiling, trying to gain visibility into malfunctioning code (or worse - a large module) can quickly become a game of a cat endlessly chasing a mouse (or a bug..?).

And with increasingly complex AI-generated code becoming commonplace, this approach simply won't cut it anymore.

Personally, just based on the last few days, all those "vibe" coders, who are actually making money from their new vibe coded games and SaaS products, will start paying big bucks to senior helping them understand behaviours and bugs.

Here's where Neovim's debugging capabilities shine

Using the Debug Adapter Protocol (DAP), (and specifically nvim-dap combined with nvim-dap-ui) you can transform your Neovim experience into a powerful debugging environment that rivals any modern IDE.

The setup is straightforward:

  1. Install the necessary plugins (nvim-dap, nvim-dap-ui) through your package manager (lazy.nvim makes this particularly easy with dap.core extras)
  2. Set up language-specific adapters (Go, Python, TypeScript, Java, etc.)
  3. Configure your key mappings for a seamless workflow (or let LazyVim decide for you)

Once configured, your debugging workflow becomes dramatically more efficient.

Setting breakpoints is as simple as , toggling the UI is , and continuing execution is . When execution stops at a breakpoint, you get immediate access to:

  • Local variables and scopes
  • Current breakpoints list
  • Threads and stack frames
  • Interactive watch expressions

But the real power comes with conditional breakpoints (), which allow you to set rules like "only stop when variable i equals 7," dramatically reducing debugging time.

You can step into functions with and step out with , giving you complete control over execution flow, and going deep intro resolutions beyond just your own code.

A game changer for multi threading

The thread visualization is particularly valuable when debugging concurrent code.

You can track multiple threads simultaneously, seeing exactly what each one is doing at any given moment—a capability that's absolutely essential when dealing with complex systems.

Printing your way through multi threaded code is nearly impossible and can get extremely frustrating.

Going deeper

For those looking to supercharge their debugging, consider pairing Neovim's DAP capabilities with an AI tool like Augment (there's a generous free tier if you're a solo dev).

Unlike general-purpose AI assistants, Augment is designed specifically to understand your entire codebase, making it an ideal debugging companion for complex systems. Its Vim-first approach means it integrates seamlessly with your Neovim workflow.

I was able to ask where certain bits are in a huge code base, as well as detecting potential bugs in a matter of milliseconds.

Another exiting (and open source!) option is Codetracer, which lets you execute your code, while recording it in the back, then allowing for a replay through code.

This is how you tackle those hard-to-reproduce persistent bugs.

The real power

Lastly, in my opinion, the most powerful feature of all in a debugger is the ability to modify code mid-debug session.

Change a variable's value, and continue execution to see if your fix works—all without restarting the debugging process.

"Sometimes you could fix things even before you did one compile cycle. You'd say, 'Well, I'm just going to change this right here,' and yep, that did the job."
- John Carmack

In a world increasingly dominated by AI-generated code, and the amount of garbage code only seems to pile up, the ability to debug efficiently isn't just about productivity—it's about maintaining control over systems that grow more complex, and fewer engineers know how to handle them, by the day.

With Neovim's debugging tools, you'll be well-equipped to face these challenges head-on!


Thank you for reading.
Feel free to reply directly with any question or feedback.
Have a great weekend!

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

You Need To Learn Docker Swarm! Ever felt like you're overcomplicating your container deployments? You might be. Today, we're diving into a Docker orchestrator that's likely already on your machine (run `docker service` for a second will ya?), but you're probably overlooking: Docker Swarm. The Underdog Orchestrator For years (for me, the past 11 years to be exact), the path has seemed to be either simple Docker Compose or the more, WAY MORE complex, Kubernetes. Compose is great for local...

LimaVM Is Probably The Best MacOS Virtual Machine I've Ever Used If you're tired of Docker Desktop bogging down your machine, or simply don't like fuff of mapping ports, mounting volumes when all you need is a small virtual environment, this one's for you. I recently discovered LimaVM, and it's a game-changer for local development. It lets you spin up Linux VMs with ease, offering a faster, lighter alternative to Docker and other VM managers for many tasks, but especially for development....

Coding Is Changing. Here's How I Stay AHEAD This issue is brought to you by: Ideas to apps in seconds with Lovable Lovable is your superhuman full stack engineer. Click here for double credits when signing up The AI revolution isn't replacing engineers (IMHO) - it's changing how they work and which skills matter most. I mean, look at the sponsor of this week, a "vibe coding" platform that creates your idea in no time. But, does it actually matter for developers / devops and other tech...