feat(functions,bindings): add smart-execute, fast-cli; refactor qalc and rm

- Add _smart_execute: context-aware Ctrl+Enter that routes to qalc when
  the buffer ends with '=', or falls through to standard execute otherwise
- Refactor qalc_eval → _qalc_eval (private helper, same behavior)
- Bind Ctrl+Enter to _smart_execute in all vi modes
- Add fast-cli wrapper (fast.com speed test) and fast placeholder with
  a friendly ANSI redirect message
- Add speedtest-fast abbreviation expanding to fast-cli
- Enhance _replace_command_token to handle sudo-prefixed commands: places
  cursor at index 5 (between sudo and the replacement slot)
- Improve rm error reporting: colored output, culprit-path listing, and
  cleaned technical detail for non-missing-file errors
- Add SPDX copyright headers to cat, ld, claude-docs, claude-pr functions
- Update README: Ctrl+Enter binding, fast-cli/fast functions, speedtest-fast abbr
This commit is contained in:
2026-05-10 01:36:14 -04:00
parent 4dff7632cd
commit b62c2476da
13 changed files with 181 additions and 12 deletions
+46 -4
View File
@@ -66,12 +66,54 @@ function rm --description 'Ultimate rm: trash, list, empty, and secure-erase'
set -a trash_paths $arg
end
end
if type -q trash; and set -q trash_paths[1]
trash put $trash_paths
# Refresh Dolphin view
set -l trash_output (trash put $trash_paths 2>&1)
set -l exit_status $status
if test $exit_status -ne 0
# 1. Extract the core message (e.g., "No such file or directory")
set -l raw_msg (string replace -r '.*Message: (.+?) \(os error.*' '$1' -- "$trash_output")
# 2. Find which paths are actually missing
set -l culprits
for p in $trash_paths
if not test -e "$p"
set -a culprits "$p"
end
end
# 3. Display Logic
set_color red --bold
echo -n "error: "
set_color normal
echo $raw_msg
if set -q culprits[1]
# If we found missing files, show the user's source paths
for c in $culprits
set_color blue
echo -n " ↳ Source: "
set_color normal
echo $c
end
else
# 1. Strip ANSI escape codes (color) so regex works correctly
# 2. Remove the 'error: ' prefix
# 3. Unescape quotes and trim whitespace
set -l clean_detail (string replace -ra '\e\[[^m]*m' '' -- "$trash_output" \
| string replace -r '^error: ' '' \
| string unescape \
| string trim)
set_color yellow
echo -n " ↳ Technical detail: "
set_color normal
echo $clean_detail
end
end
dbus-send --type=signal /OrgKdeKDirNotify org.kde.KDirNotify.FilesChanged stringArray:"trash:/" >/dev/null 2>&1 &
return
return $exit_status
end
end