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
This commit is contained in:
parent
bded1b359d
commit
afbc87be2b
2 changed files with 9 additions and 1 deletions
|
|
@ -16,8 +16,11 @@
|
||||||
local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme'
|
local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme'
|
||||||
local f = io.open(config_file, "r")
|
local f = io.open(config_file, "r")
|
||||||
if f ~= nil then
|
if f ~= nil then
|
||||||
local system_theme = f:read()
|
local system_theme = f:read("*l")
|
||||||
io.close(f)
|
io.close(f)
|
||||||
|
if system_theme then
|
||||||
|
system_theme = system_theme:gsub("^%s+", ""):gsub("%s+$", "")
|
||||||
|
end
|
||||||
if system_theme == 'dark' then
|
if system_theme == 'dark' then
|
||||||
vim.cmd("set bg=dark")
|
vim.cmd("set bg=dark")
|
||||||
elseif system_theme == 'light' then
|
elseif system_theme == 'light' then
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ fi
|
||||||
mkdir -p "$ALACRITTY_DIR"
|
mkdir -p "$ALACRITTY_DIR"
|
||||||
printf '%s' "$want" >"$MARKER"
|
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
|
if [[ "$want" == "light" ]]; then
|
||||||
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
|
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
|
||||||
cp "$LIGHT" "$tmp"
|
cp "$LIGHT" "$tmp"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue