From afbc87be2b038ed27d0d29584e129aa5e1dda848 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Wed, 25 Mar 2026 14:51:31 +0100 Subject: [PATCH] fix(macos): sync Neovim Catppuccin with system appearance Write ~/.local/share/nvim_color_scheme from the same macOS Appearance probe as Alacritty; trim the nvim theme line read for robustness. Made-with: Cursor --- nixos/neovim.nix | 5 ++++- scripts/alacritty-sync-system-theme.sh | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/neovim.nix b/nixos/neovim.nix index 587aca0..ce8bb5c 100644 --- a/nixos/neovim.nix +++ b/nixos/neovim.nix @@ -16,8 +16,11 @@ local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' local f = io.open(config_file, "r") if f ~= nil then - local system_theme = f:read() + local system_theme = f:read("*l") io.close(f) + if system_theme then + system_theme = system_theme:gsub("^%s+", ""):gsub("%s+$", "") + end if system_theme == 'dark' then vim.cmd("set bg=dark") elseif system_theme == 'light' then diff --git a/scripts/alacritty-sync-system-theme.sh b/scripts/alacritty-sync-system-theme.sh index 2238ef5..c323973 100755 --- a/scripts/alacritty-sync-system-theme.sh +++ b/scripts/alacritty-sync-system-theme.sh @@ -29,6 +29,11 @@ fi mkdir -p "$ALACRITTY_DIR" printf '%s' "$want" >"$MARKER" +# Neovim (see nixos/neovim.nix): same file as `theme` on WSL; keep in sync with Appearance. +NVIM_THEME="${XDG_DATA_HOME:-$HOME/.local/share}/nvim_color_scheme" +mkdir -p "$(dirname "$NVIM_THEME")" +printf '%s\n' "$want" >"$NVIM_THEME" + if [[ "$want" == "light" ]]; then tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")" cp "$LIGHT" "$tmp"