{{ video(url=“/assets/videos/neovim-follow-system-style.mp4”, alt=“nvim demo”, controls=true) }}
Recently, I’ve been using Arch Linux with the GNOME Desktop Environment. GNOME has a setting to toggle the system style between dark and light modes. This setting affects all apps that support it, for example, Console, Files, and Calendar, which is pretty cool, to be honest.
The problem is with my daily Terminal Emulator, Ghostty, and my daily text editor, Neovim. They don’t follow the system style automatically. Fortunately, the solution is easy.
For Ghostty, just add this configuration:
theme = dark:GruvboxDark,light:GruvboxLight
For Neovim, since I use LazyVim, it’s also straightforward. Just create ~/.config/nvim/lua/plugins/follow-system-theme.lua with this content:
return {
{
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- auto switch dark or light
"cosmicboots/system-theme.nvim",
},
}