feat(guards): add opinionated component guards to config.fish and conf.d

Adds __fish_config_op_enabled helper (master __fish_config_opinionated
evaluated first via __fish_variable_check, then the category variable)
and gates C1-C4 components: CachyOS surgical override, PAGER/MANPAGER,
CDPATH, Vi mode, exit override, bang-bang bindings, history/cp/mv/wget/
grep aliases, cd->z alias, Fisher bootstrap and theme apply, paru/yay
wrapper generation, WakaTime hook, custom key chords, puffer, autopair,
starship prompt, Catppuccin colors, FZF_DEFAULT_OPTS, done notifications,
and Kitty/WezTerm window-management abbreviations.
This commit is contained in:
2026-06-10 11:28:43 -04:00
parent cdf850f2e7
commit ce84db593c
15 changed files with 386 additions and 232 deletions
+50 -36
View File
@@ -29,7 +29,8 @@ if test -f $_src; and not test -L $_man1/fish-config.1
end
# Format man pages using bat (only if bat is installed)
if type -q bat
# Overriding $MANPAGER is opinionated (C3 overrides)
if type -q bat; and __fish_config_op_enabled __fish_config_op_overrides
set -gx MANROFFOPT -c
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
end
@@ -40,38 +41,46 @@ set -gx __done_notification_urgency_level low
## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]
commandline -f repaint
case "*"
commandline -i !
# The bang-bang system is opinionated (C3 overrides) and is gated atomically
# here, in conf.d/abbr.fish, conf.d/puffer.fish, and functions/expand_*.fish.
if __fish_config_op_enabled __fish_config_op_overrides
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]
commandline -f repaint
case "*"
commandline -i !
end
end
end
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
end
# Apply bang-bang key bindings based on current key binding mode
if [ "$fish_key_bindings" = fish_vi_key_bindings ]
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
# Apply bang-bang key bindings based on current key binding mode
if [ "$fish_key_bindings" = fish_vi_key_bindings ]
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end
end
# Fish command history override to show timestamps
function history
builtin history --show-time='%F %T '
# Shadowing the history command is opinionated (C1 aliasing); when disabled,
# the function is never defined and fish's stock history behavior applies.
if __fish_config_op_enabled __fish_config_op_aliases
function history
builtin history --show-time='%F %T '
end
end
# Quick file backup utility
@@ -97,21 +106,26 @@ alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
# Tools & Core command color overrides
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Silent flag injection into POSIX tools is opinionated (C1 aliasing)
if __fish_config_op_enabled __fish_config_op_aliases
# Tools & Core command color overrides
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Safety aliases (Confirmation before overwriting/deleting)
alias cp="cp -i"
alias mv="mv -i"
# Safety aliases (Confirmation before overwriting/deleting)
alias cp="cp -i"
alias mv="mv -i"
# Force wget to resume partial downloads
alias wget='wget -c '
end
# Archives and networking short-hands
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias tb='nc termbin.com 9999'
# System Logs