dc97892a29
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.
26 lines
767 B
Fish
26 lines
767 B
Fish
# 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
|
|
|
|
set -l token $argv[1]
|
|
if test -z "$token"
|
|
set token (commandline -t)
|
|
end
|
|
|
|
# Extract query: looks for text after !? and before an optional ?
|
|
set -l query (string match -r '!\?([^?]+)' -- $token)[2]
|
|
|
|
if test -n "$query"
|
|
# Search history for a match anywhere in the command
|
|
set -l match (builtin history search --contains --max=1 -- $query)
|
|
|
|
if test -n "$match"
|
|
echo -- $match
|
|
return
|
|
end
|
|
end
|
|
|
|
echo -- $token
|
|
end
|