ce84db593c
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.
44 lines
1.6 KiB
Fish
44 lines
1.6 KiB
Fish
status is-interactive || exit
|
|
|
|
# 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
|
|
|
|
set --global autopair_left "(" "[" "{" '"' "'"
|
|
set --global autopair_right ")" "]" "}" '"' "'"
|
|
set --global autopair_pairs "()" "[]" "{}" '""' "''"
|
|
|
|
function _autopair_fish_key_bindings --on-variable fish_key_bindings
|
|
set --query fish_key_bindings[1] || return
|
|
|
|
test $fish_key_bindings = fish_default_key_bindings &&
|
|
set --local mode default insert ||
|
|
set --local mode insert default
|
|
|
|
bind --mode $mode[-1] --erase \177 \b \t
|
|
|
|
bind --mode $mode[1] \177 _autopair_backspace # macOS ⌫
|
|
bind --mode $mode[1] \b _autopair_backspace
|
|
bind --mode $mode[1] \t _autopair_tab
|
|
|
|
printf "%s\n" $autopair_pairs | while read --local left right --delimiter ""
|
|
bind --mode $mode[-1] --erase $left $right
|
|
if test $left = $right
|
|
bind --mode $mode[1] $left "_autopair_insert_same \\$left"
|
|
else
|
|
bind --mode $mode[1] $left "_autopair_insert_left \\$left \\$right"
|
|
bind --mode $mode[1] $right "_autopair_insert_right \\$right"
|
|
end
|
|
end
|
|
end
|
|
|
|
_autopair_fish_key_bindings
|
|
|
|
function _autopair_uninstall --on-event autopair_uninstall
|
|
string collect (
|
|
bind --all | string replace --filter --regex -- "_autopair.*" --erase
|
|
set --names | string replace --filter --regex -- "^autopair" "set --erase autopair"
|
|
) | source
|
|
functions --erase (functions --all | string match "_autopair_*")
|
|
end
|