I was working on a Kubernetes project and noticed Neovim was taking 2-3 seconds to start. That’s long enough to break my flow. Here’s how I tracked down the culprit.
The problem Link to heading
Opening Neovim had become noticeably slow. I’d run nvim and wait… and wait. It turned out to be nvim-treesitter doing expensive parser installations on every startup.
Profile startup time Link to heading
First, generate a startup profile:
nvim --startuptime startup.log
Then check the log to see what’s slow:
cat startup.log | sort -k2 -n | tail -20
Look for lines with high numbers in the second column—that’s milliseconds. In my case, treesitter was taking 800ms.
Isolate the problem Link to heading
Start with a clean config (no plugins):
nvim --clean
If that’s fast, it’s definitely a plugin issue.
Test with a specific file type:
nvim --startuptime startup.log +q somefile.yaml
I tested with YAML because that’s what was slow for me—turned out treesitter’s YAML parser was the problem.
My init.lua structure Link to heading
I keep my Neovim config organised like this:
~/.config/nvim/
├── init.lua # Entry point
├── lua/
│ ├── config/
│ │ ├── lazy.lua # Plugin manager setup
│ │ ├── keymaps.lua # Key mappings
│ │ └── options.lua # Editor options
│ └── plugins/ # Plugin configs
The key is to lazy-load plugins. Using lazy.nvim allows configuring plugins to load on specific filetypes:
{
"nvim-treesitter/nvim-treesitter",
event = "BufReadPost", -- Don't load until after opening a file
}
Fix plugin issues Link to heading
If plugins are broken, try reinstalling:
# In Neovim
:Lazy sync
Or manually reset:
rm -rf ~/.local/share/nvim/lazy
nvim
Check the lazy.nvim lockfile if versions are causing issues:
vi ~/.config/nvim/lazy-lock.json
Remote plugins debugging Link to heading
If you’re using remote plugins (less common now), listen on a socket:
nvim --listen /tmp/nvim
Neovim vs VS Code Link to heading
I’ve used VS Code extensively, and honestly, both are excellent. Here’s my take:
Use Neovim if:
- You live in the terminal
- You value speed and minimal resource usage
- You enjoy tinkering with your editor config
- You’re comfortable with Lua
Use VS Code if:
- You want things to just work out of the box
- You prefer a GUI and mouse interactions
- You need rich language server features without configuration
- You pair programme frequently (Live Share is brilliant)
I switched to Neovim because I was tired of VS Code consuming 2GB+ RAM with multiple windows open. Neovim uses ~50MB. The trade-off is time spent configuring, but I enjoy that aspect.
For work (where I’m deep in Python and Kubernetes), Neovim is faster. For side projects with unfamiliar languages, I still reach for VS Code occasionally.