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