Repair Neovim theme symlinks the earlier relink missed
1781158082.sh matched an explicit list of three legacy spellings for ~/.config/nvim/lua/plugins/theme.lua. At least one more exists in the wild -- "../../../../.config/omarchy/current/theme/neovim.lua" -- so those installs fell through the case, kept a dangling link, and Neovim loaded no colorscheme spec at all. The failure looks theme-specific because it only surfaces when you next switch themes. Editing that migration would not help anyone, since it is already marked applied. Add a new one that matches the shared suffix instead of an enumerated list, so every spelling of the pre-state-dir path is caught. It exits early when the link already points at the state directory and ignores targets outside omarchy/current, leaving custom links alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjeyQZsNBxqyYy9z8KaKm7
This commit is contained in:
co-authored by
Claude Opus 5
parent
fc4caf3c60
commit
195df4f5c7
@@ -0,0 +1,22 @@
|
|||||||
|
echo "Repair Neovim theme symlinks the earlier relink missed"
|
||||||
|
|
||||||
|
theme_link="$HOME/.config/nvim/lua/plugins/theme.lua"
|
||||||
|
current_absolute_target="$HOME/.local/state/omarchy/current/theme/neovim.lua"
|
||||||
|
current_relative_target="../../../../.local/state/omarchy/current/theme/neovim.lua"
|
||||||
|
|
||||||
|
[[ -L $theme_link ]] || exit 0
|
||||||
|
|
||||||
|
target=$(readlink "$theme_link") || exit 0
|
||||||
|
|
||||||
|
# Already pointing at the state directory.
|
||||||
|
[[ $target == "$current_relative_target" || $target == "$current_absolute_target" ]] && exit 0
|
||||||
|
|
||||||
|
# 1781158082.sh matched an explicit list of legacy spellings and missed at least
|
||||||
|
# one ("../../../../.config/omarchy/current/theme/neovim.lua"), leaving those
|
||||||
|
# links dangling. Match the shared suffix instead so every spelling is repaired.
|
||||||
|
case "$target" in
|
||||||
|
*/omarchy/current/theme/neovim.lua) ;;
|
||||||
|
*) exit 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ln -sfn "$current_relative_target" "$theme_link"
|
||||||
@@ -423,6 +423,28 @@ for nvim_legacy_target in \
|
|||||||
done
|
done
|
||||||
pass "nvim theme migration relinks current theme"
|
pass "nvim theme migration relinks current theme"
|
||||||
|
|
||||||
|
for nvim_legacy_target in \
|
||||||
|
"../../../omarchy/current/theme/neovim.lua" \
|
||||||
|
"../../../../.config/omarchy/current/theme/neovim.lua" \
|
||||||
|
"~/.config/omarchy/current/theme/neovim.lua" \
|
||||||
|
"$NVIM_MIGRATION_TMPDIR/.config/omarchy/current/theme/neovim.lua"; do
|
||||||
|
ln -sfn "$nvim_legacy_target" "$nvim_theme_link"
|
||||||
|
HOME="$NVIM_MIGRATION_TMPDIR" bash -euo pipefail "$ROOT/migrations/1785002349.sh" >/dev/null
|
||||||
|
nvim_actual_target=$(readlink "$nvim_theme_link")
|
||||||
|
nvim_resolved_target=$(readlink -f "$nvim_theme_link")
|
||||||
|
[[ $nvim_actual_target == $nvim_expected_target ]] || fail "nvim theme repair migration updates $nvim_legacy_target"
|
||||||
|
[[ $nvim_resolved_target == $nvim_expected_resolved_target ]] || fail "nvim theme repair migration points to current theme"
|
||||||
|
done
|
||||||
|
|
||||||
|
HOME="$NVIM_MIGRATION_TMPDIR" bash -euo pipefail "$ROOT/migrations/1785002349.sh" >/dev/null
|
||||||
|
[[ $(readlink "$nvim_theme_link") == $nvim_expected_target ]] || fail "nvim theme repair migration is idempotent"
|
||||||
|
|
||||||
|
touch "$NVIM_MIGRATION_TMPDIR/custom-theme.lua"
|
||||||
|
ln -sfn "../../../../custom-theme.lua" "$nvim_theme_link"
|
||||||
|
HOME="$NVIM_MIGRATION_TMPDIR" bash -euo pipefail "$ROOT/migrations/1785002349.sh" >/dev/null
|
||||||
|
[[ $(readlink "$nvim_theme_link") == "../../../../custom-theme.lua" ]] || fail "nvim theme repair migration leaves custom symlinks alone"
|
||||||
|
pass "nvim theme repair migration relinks every legacy spelling"
|
||||||
|
|
||||||
HYPR_MIGRATION_TMPDIR=$(mktemp -d)
|
HYPR_MIGRATION_TMPDIR=$(mktemp -d)
|
||||||
mkdir -p "$HYPR_MIGRATION_TMPDIR/.config/hypr"
|
mkdir -p "$HYPR_MIGRATION_TMPDIR/.config/hypr"
|
||||||
cat >"$HYPR_MIGRATION_TMPDIR/.config/hypr/hyprland.lua" <<'LUA'
|
cat >"$HYPR_MIGRATION_TMPDIR/.config/hypr/hyprland.lua" <<'LUA'
|
||||||
|
|||||||
Reference in New Issue
Block a user