refactor(config): migrate C3 overrides call sites to self-identifying guard
This commit is contained in:
@@ -11,20 +11,27 @@ set -g __fish_config_op_registry_keys \
|
||||
__fish_user_dots_link: \
|
||||
agy: \
|
||||
auto-pull: \
|
||||
autopair: \
|
||||
bash: \
|
||||
bash_expands: \
|
||||
cat: \
|
||||
claude: \
|
||||
du: \
|
||||
edit: \
|
||||
fish_right_prompt: \
|
||||
help: \
|
||||
key_bindings: \
|
||||
less: \
|
||||
ls: \
|
||||
mkdir: \
|
||||
mv: \
|
||||
ping: \
|
||||
puffer: \
|
||||
rg: \
|
||||
rm: \
|
||||
ssh: \
|
||||
starship: \
|
||||
theme: \
|
||||
top: \
|
||||
yt-dlp: \
|
||||
zoxide:
|
||||
@@ -34,20 +41,27 @@ set -g __fish_config_op_registry_values \
|
||||
"autoexec/sync" \
|
||||
"aliases/dev-tools" \
|
||||
"autoexec/sync autoexec/sync" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/shell-tools" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/dev-tools" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/dev-tools" \
|
||||
"overrides/prompt" \
|
||||
"aliases/shell-tools" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/shell-tools" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/network" \
|
||||
"overrides/key-bindings" \
|
||||
"aliases/search" \
|
||||
"aliases/filesystem" \
|
||||
"aliases/network" \
|
||||
"overrides/prompt" \
|
||||
"overrides/prompt" \
|
||||
"aliases/monitor" \
|
||||
"aliases/network" \
|
||||
"aliases/filesystem"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
status is-interactive || exit
|
||||
|
||||
# COMPONENT
|
||||
# overrides/key-bindings
|
||||
|
||||
# Local modification: opinionated guard (AGENTS.md Task #3). Bracket
|
||||
# auto-pairing intercepts single-character input, classified as C3 overrides.
|
||||
__fish_config_op_enabled __fish_config_op_overrides || exit
|
||||
__fish_config_op_enabled (status basename) || exit
|
||||
|
||||
set --global autopair_left "(" "[" "{" '"' "'"
|
||||
set --global autopair_right ")" "]" "}" '"' "'"
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# COMPONENT
|
||||
# overrides/key-bindings
|
||||
|
||||
# Provides bash-style history expansion functions for abbreviations.
|
||||
# These functions are gated by the C3 overrides switch.
|
||||
|
||||
# Execute expand_bang_all
|
||||
function expand_bang_all --description 'Execute expand_bang_all'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
set -l token $argv[1]
|
||||
if test -z "$token"; set token (commandline -t); end
|
||||
@@ -23,7 +26,7 @@ end
|
||||
# Execute expand_bang_caret
|
||||
function expand_bang_caret --description 'Execute expand_bang_caret'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
# Split the last history item into a list
|
||||
set -l tokens (string split -n ' ' -- $history[1])
|
||||
@@ -36,7 +39,7 @@ end
|
||||
# Execute expand_bang_minus_n
|
||||
function expand_bang_minus_n --description 'Execute expand_bang_minus_n'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
set -l token $argv[1]
|
||||
if test -z "$token"; set token (commandline -t); end
|
||||
@@ -58,7 +61,7 @@ end
|
||||
# Execute expand_bang_search
|
||||
function expand_bang_search --description 'Execute expand_bang_search'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
set -l token $argv[1]
|
||||
if test -z "$token"
|
||||
@@ -84,7 +87,7 @@ end
|
||||
# Execute expand_bang_string
|
||||
function expand_bang_string --description 'Execute expand_bang_string'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
# Fish 4.x passes the matched token as argv[1]
|
||||
set -l token $argv[1]
|
||||
@@ -112,7 +115,7 @@ end
|
||||
# Execute expand_typo_sub
|
||||
function expand_typo_sub --description 'Execute expand_typo_sub'
|
||||
# Opinionated guard (C3): no expansion when overrides are disabled.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return 1
|
||||
__fish_config_op_enabled (status basename); or return 1
|
||||
|
||||
# In newer Fish, the matched token is often passed as $argv[1]
|
||||
# if the abbr is set up correctly. We'll fallback to commandline just in case.
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
# This file defines custom key bindings for the Fish shell.
|
||||
# It is sourced by Fish on startup.
|
||||
|
||||
# COMPONENT
|
||||
# overrides/key-bindings
|
||||
|
||||
# ────────────────── Bind Prewious Path Head to Ctrl+G ─────────────────
|
||||
# Bindings to insert the previous path head into the command line
|
||||
# Behaves like `!$:h` does in bash
|
||||
@@ -48,7 +51,11 @@ function fish_user_key_bindings
|
||||
|
||||
# Custom key chords are opinionated (C3 overrides); skip them entirely
|
||||
# when overrides are disabled so stock bindings remain untouched.
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return
|
||||
# NOTE: (status basename), not (status current-function) -- this guard
|
||||
# lives inside fish's own reserved fish_user_key_bindings function, whose
|
||||
# name is not this file's identity; the registry key is this file's
|
||||
# bare basename, key_bindings.
|
||||
__fish_config_op_enabled (status basename); or return
|
||||
|
||||
# ───────────────────────────── Set Bindings ─────────────────────────────
|
||||
#
|
||||
|
||||
+4
-1
@@ -1,9 +1,12 @@
|
||||
status is-interactive || exit
|
||||
|
||||
# COMPONENT
|
||||
# overrides/key-bindings
|
||||
|
||||
# Local modification: opinionated guard (AGENTS.md Task #3). Puffer's key
|
||||
# intercepts are part of the bang-bang system, gated atomically under C3
|
||||
# overrides with conf.d/tricks.fish, conf.d/abbr.fish, and expand_*.fish.
|
||||
__fish_config_op_enabled __fish_config_op_overrides || exit
|
||||
__fish_config_op_enabled (status basename) || exit
|
||||
|
||||
function _puffer_fish_key_bindings --on-variable fish_key_bindings
|
||||
set -l modes
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# COMPONENT
|
||||
# overrides/prompt
|
||||
|
||||
#
|
||||
# Defines fish_prompt only when starship is installed.
|
||||
# Without starship, fish's built-in prompt already emits OSC 133;A
|
||||
# on the prompt line itself, so no wrapper is needed.
|
||||
|
||||
# Replacing the prompt is opinionated (C3 overrides)
|
||||
__fish_config_op_enabled __fish_config_op_overrides; or return
|
||||
__fish_config_op_enabled (status basename); or return
|
||||
|
||||
type -q starship; or return
|
||||
|
||||
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# COMPONENT
|
||||
# overrides/prompt
|
||||
|
||||
#
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ Fish Theme │
|
||||
@@ -9,7 +13,7 @@
|
||||
# Forcing theme colors and $FZF_DEFAULT_OPTS is opinionated (C3 overrides).
|
||||
# The FZF variable is universal, so clean up our Catppuccin value if it
|
||||
# lingers from a session where overrides were still enabled.
|
||||
if not __fish_config_op_enabled __fish_config_op_overrides
|
||||
if not __fish_config_op_enabled (status basename)
|
||||
if set -q FZF_DEFAULT_OPTS; and string match -q '*#1E1E2E*' -- "$FZF_DEFAULT_OPTS"
|
||||
set --erase FZF_DEFAULT_OPTS
|
||||
end
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
# CATEGORY
|
||||
# 08-terminal-management
|
||||
#
|
||||
# COMPONENT
|
||||
# overrides/prompt
|
||||
#
|
||||
# SYNOPSIS
|
||||
# fish_right_prompt
|
||||
#
|
||||
@@ -31,7 +34,7 @@ function fish_right_prompt
|
||||
# Docker context — only relevant alongside the starship prompt, and only
|
||||
# when docker is actually installed (guarded like every other optional
|
||||
# integration in this config).
|
||||
if type -q docker; and type -q starship; and __fish_config_op_enabled __fish_config_op_overrides
|
||||
if type -q docker; and type -q starship; and __fish_config_op_enabled (status current-function)
|
||||
set -l docker_ctx (docker context show 2>/dev/null)
|
||||
if test -n "$docker_ctx"; and test "$docker_ctx" != default
|
||||
set_color blue
|
||||
|
||||
Reference in New Issue
Block a user