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:
@@ -299,3 +299,4 @@ AGENTS/
|
||||
docs/devlogs
|
||||
# ────────────────────────────────────────────────────────
|
||||
/.cache_ggshield
|
||||
user-dots
|
||||
|
||||
@@ -248,6 +248,8 @@ test -f "$__fish_user_dots_path/local.fish"
|
||||
and source "$__fish_user_dots_path/local.fish"
|
||||
```
|
||||
|
||||
For convenience, a git-ignored `user-dots` symlink in the fish config directory is pointed at `$__fish_user_dots_path` on startup, so the overlay can be browsed from `~/.config/fish/`. It is recreated if missing and repointed if the path variable changes. This is a C2 startup side-effect (`__fish_config_op_autoexec`); it only ever manages a symlink and never clobbers a real file or directory at that path.
|
||||
|
||||
`fish_variables` (which fish auto-manages and may contain universal variable state) is excluded from this repo via `.gitignore`.
|
||||
|
||||
---
|
||||
|
||||
+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.
|
||||
|
||||
+6
-2
@@ -1823,10 +1823,14 @@ __fish_config_op_autoexec prevents all of them.
|
||||
Python venv activation On every cd Sources .venv/bin/activate.fish
|
||||
WakaTime command hook On every command Reports to WakaTime API
|
||||
Auto-pull fast-forward On entering a repo Background ff-only git pull
|
||||
user-dots symlink Every startup Links $__fish_config_dir/user-dots
|
||||
to $__fish_user_dots_path
|
||||
|
||||
When C2 is disabled: no Fisher install, no theme application, no paru/yay
|
||||
wrapper generation, no automatic venv activation, no WakaTime reporting, and
|
||||
no auto-pull (the PWD handler is never registered).
|
||||
wrapper generation, no automatic venv activation, no WakaTime reporting,
|
||||
no auto-pull (the PWD handler is never registered), and the user-dots
|
||||
convenience symlink is not created. The symlink is git-ignored and only ever
|
||||
managed as a symlink — a real file or directory at that path is left untouched.
|
||||
The first-run completion marker (__fish_config_first_run_complete) is still
|
||||
set so the init does not re-run on subsequent shells.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user