feat(guards): opinionated components guard (Task #3) #38
Reference in New Issue
Block a user
Delete Branch "opinionated-components-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Why: Every opinionated piece of this config (command shadows, startup side-effects, key/env overrides, terminal coupling) was previously mandatory. Task #3 makes the whole config usable as a "plain shell" by anyone — or selectively trimmed — without forking it.
What: All 56 cataloged components are now wrapped in guards routed through a new helper,
functions/__fish_config_op_enabled.fish, which evaluates the master switch__fish_config_opinionatedfirst, then the per-category opt-out variable — both via__fish_variable_check(falsy =0/false/no/off/ndisables; truthy, unset, or unrecognized keeps enabled).__fish_config_op_aliases__fish_config_op_autoexec__fish_config_op_overrides__fish_config_op_integrations__fish_config_opinionatedKey implementation points:
rmfallback: with C1 disabled,rmruns exactcommand rm $argv— no wrapper, no trash.expand_*functions gate together under C3.__fish_config_first_run_completewhen C2 is off, but skips the Fisher curl,fisher update, and theme apply; paru/yay wrappers return before any file writes.historyoverride, and grep/ls/wget aliases (it's the origin of tricks.fish); config.fish now strips those per category and restores fish's stockhistory/lsfunctions.smart_exitfalls back tobuiltin exitwhen C3 is off; comments mark where__fish_config_enable_loggingwill gate just the capture block.Docs: new "Opinionated Components (Minimal Mode)" section in
docs/fish-config.md(+ index keywordsopinionated,minimal,opt-out,toggles), README "Minimal Mode" section, and a cross-reference from Section 1.Manual Verification
set -U __fish_config_opinionated 0, open a new shell: prompt is stock fish (no starship), Emacs bindings,!/$insert literally,:w/:tabbreviations don't expand, andrmprintsrm: missing operandinstead of listing trash.cat somefileoutputs plain (no bat),lsis plain listing,cddoes not learn directories for zoxide (zstill works directly).set -Ue __fish_config_opinionated, open a new shell: starship prompt, Vi mode, bang-bang, theme colors, and all wrappers return;FZF_DEFAULT_OPTSis restored automatically.set -U __fish_config_op_integrations off, then runtab,split, orlogs: each refuses with a red error naming the variable; erase the variable and they work again immediately.set -U __fish_config_op_aliases offin a running shell (no restart):rm,cat,ls,pingimmediately fall back to bare commands while bang-bang and the prompt stay active.help config opinionatedjumps straight to the new docs section.