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

Merged
rootiest merged 1 commits from feat/smart-execute-fast-cli into main 2026-05-10 05:40:07 +00:00
Owner

Summary

  • _smart_execute + Ctrl+Enter binding: Context-aware Enter key. If the buffer ends with =, evaluates it as a math expression via qalc. Otherwise executes normally (empty buffer = standard Enter).
  • _qalc_eval refactor: Renamed from qalc_eval to a private helper (_qalc_eval); behavior unchanged, now used by both Ctrl+Alt+= and _smart_execute.
  • fast-cli + fast: New fast-cli function wraps the fast CLI for fast.com speed tests. fast shows a friendly ANSI redirect message if someone types the wrong name. speedtest-fast abbreviation added.
  • _replace_command_token enhancement: Now handles sudo-prefixed commands separately — strips the middle token and places the cursor at position 5 (after sudo ) instead of index 0.
  • rm error handling: Trash failures now produce colored, structured output — red error label, culprit source paths listed with , and a cleaned technical detail fallback for non-missing-file errors.
  • Copyright headers: Added SPDX headers to cat.fish, ld.fish, claude-docs.fish, claude-pr.fish.
  • README: Updated with new Ctrl+Enter binding, fast-cli/fast functions, and speedtest-fast abbreviation.

Manual Verification

  • Open a new Fish shell and confirm no errors on startup.
  • Type 150 * 1.08 = and press Ctrl+Enter — should evaluate via qalc and print the result, clearing the buffer.
  • Type ls -la and press Ctrl+Enter — should execute the command normally.
  • Press Ctrl+Enter on an empty prompt — should behave like a standard Enter (new line / execute).
  • Type 150 * 1.08 and press Ctrl+Alt+= — should still work as before.
  • Run fast-cli — should launch a fast.com speed test.
  • Run fast (no -cli) — should print a friendly ANSI redirect message, not an error.
  • Type speedtest-fast and press Space — should expand to fast-cli.
  • Run sudo mkdir /tmp/test-dir then press Ctrl+Alt+U — cursor should land at position 5 (after sudo ), ready to replace mkdir.
  • Run rm nonexistent-file.txt — should show a colored error with the culprit path listed under ↳ Source:.
  • Confirm qalc_eval (old public function) no longer exists: type qalc_eval should return "not found".
## Summary - **`_smart_execute` + `Ctrl+Enter` binding**: Context-aware Enter key. If the buffer ends with `=`, evaluates it as a math expression via `qalc`. Otherwise executes normally (empty buffer = standard Enter). - **`_qalc_eval` refactor**: Renamed from `qalc_eval` to a private helper (`_qalc_eval`); behavior unchanged, now used by both `Ctrl+Alt+=` and `_smart_execute`. - **`fast-cli` + `fast`**: New `fast-cli` function wraps the `fast` CLI for fast.com speed tests. `fast` shows a friendly ANSI redirect message if someone types the wrong name. `speedtest-fast` abbreviation added. - **`_replace_command_token` enhancement**: Now handles `sudo`-prefixed commands separately — strips the middle token and places the cursor at position 5 (after `sudo `) instead of index 0. - **`rm` error handling**: Trash failures now produce colored, structured output — red error label, culprit source paths listed with `↳`, and a cleaned technical detail fallback for non-missing-file errors. - **Copyright headers**: Added SPDX headers to `cat.fish`, `ld.fish`, `claude-docs.fish`, `claude-pr.fish`. - **README**: Updated with new `Ctrl+Enter` binding, `fast-cli`/`fast` functions, and `speedtest-fast` abbreviation. ## Manual Verification - [x] Open a new Fish shell and confirm no errors on startup. - [x] Type `150 * 1.08 =` and press `Ctrl+Enter` — should evaluate via qalc and print the result, clearing the buffer. - [x] Type `ls -la` and press `Ctrl+Enter` — should execute the command normally. - [x] Press `Ctrl+Enter` on an empty prompt — should behave like a standard Enter (new line / execute). - [x] Type `150 * 1.08` and press `Ctrl+Alt+=` — should still work as before. - [x] Run `fast-cli` — should launch a fast.com speed test. - [x] Run `fast` (no `-cli`) — should print a friendly ANSI redirect message, not an error. - [x] Type `speedtest-fast` and press Space — should expand to `fast-cli`. - [x] Run `sudo mkdir /tmp/test-dir` then press `Ctrl+Alt+U` — cursor should land at position 5 (after `sudo `), ready to replace `mkdir`. - [x] Run `rm nonexistent-file.txt` — should show a colored error with the culprit path listed under `↳ Source:`. - [x] Confirm `qalc_eval` (old public function) no longer exists: `type qalc_eval` should return "not found".
rootiest added 1 commit 2026-05-10 05:37:06 +00:00
- 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
rootiest merged commit 9467d2c206 into main 2026-05-10 05:40:07 +00:00
rootiest deleted branch feat/smart-execute-fast-cli 2026-05-10 05:40:07 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#12