feat(config): auto-manage user-dots convenience symlink
Point $__fish_config_dir/user-dots at $__fish_user_dots_path on interactive startup so the private overlay can be browsed from the fish config dir. The link is created if missing and repointed if the path variable changes, only ever managing a symlink (never clobbering a real file/dir). Gated as a C2 startup side-effect (__fish_config_op_autoexec) and git-ignored. Docs: README overlay section and fish-config.md C2 table updated.
This commit is contained in:
+16
@@ -226,6 +226,22 @@ if status is-interactive
|
||||
# Resolve user-dots path. Customize via: set -U __fish_user_dots_path /your/path
|
||||
set -q __fish_user_dots_path
|
||||
or set -l __fish_user_dots_path "$XDG_CONFIG_HOME/.user-dots/fish"
|
||||
# ────────────────────── user-dots convenience symlink ───────────────────
|
||||
# Keep $__fish_config_dir/user-dots pointing at the resolved path so it can
|
||||
# be browsed from the fish config dir. Git-ignored; a C2 startup side-effect.
|
||||
# Only ever manages a symlink — never clobbers a real file/dir placed there.
|
||||
if __fish_config_op_enabled __fish_config_op_autoexec
|
||||
set -l __udots_link "$__fish_config_dir/user-dots"
|
||||
if test -d "$__fish_user_dots_path"
|
||||
if test -L "$__udots_link"
|
||||
test (readlink "$__udots_link") != "$__fish_user_dots_path"
|
||||
and ln -sfn "$__fish_user_dots_path" "$__udots_link"
|
||||
else if not test -e "$__udots_link"
|
||||
ln -s "$__fish_user_dots_path" "$__udots_link"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# ─────────────────────── Source machine-local config ────────────────────
|
||||
# Sources local.fish if it exists. That file handles sourcing its own
|
||||
# secrets.fish companion when needed.
|
||||
|
||||
Reference in New Issue
Block a user