feat(guards): add in-function opinionated guards and CachyOS cleanup

C1 shadows (rm, cat, ls, less, du, bash, top, ping, ssh, rg, mkdir,
help) fall back to the bare command when __fish_config_op_aliases is
falsy; rm falls back to exact 'command rm' with no wrapper. C2 gates
the auto-venv PWD hook. C3 gates smart_exit (composing with Task #4
logging), fish_right_prompt, and all six expand_bang_*/expand_typo_sub
functions atomically with the bang-bang system. C4 integration commands
(spwin, tab, split, hist, logs, upgrade) refuse with a colored stderr
error when disabled. config.fish now also strips the CachyOS distro
config's own bang-bang bindings, history override, and alias opinions
per category, restoring fish stock functions where they exist.
This commit is contained in:
2026-06-10 11:34:56 -04:00
parent ce84db593c
commit dc97892a29
28 changed files with 183 additions and 3 deletions
+25
View File
@@ -32,6 +32,31 @@ if test -f /usr/share/cachyos-fish-config/cachyos-config.fish
source "$__fish_config_dir/functions/$_fname.fish"
end
end
# The distro config ships opinionated pieces of its own (it is the origin
# of tricks.fish); strip them when the matching category is disabled so
# the guards hold on CachyOS systems too.
if not __fish_config_op_enabled __fish_config_op_aliases
for _fname in grep fgrep egrep dir vdir wget
functions -q $_fname; and functions --erase $_fname
end
# Restore fish's stock versions where they exist (erasing alone would
# also block autoloading the stock function).
for _fname in history ls
functions -q $_fname; and functions --erase $_fname
test -f $__fish_data_dir/functions/$_fname.fish
and source $__fish_data_dir/functions/$_fname.fish
end
end
if not __fish_config_op_enabled __fish_config_op_overrides
for _fname in __history_previous_command __history_previous_command_arguments
functions -q $_fname; and functions --erase $_fname
end
bind --erase ! 2>/dev/null
bind --erase '$' 2>/dev/null
bind -M insert --erase ! 2>/dev/null
bind -M insert --erase '$' 2>/dev/null
end
end
set --erase _fname