feat(keybind): recall last history entry on empty prompt for ctrl-alt-u #162

Merged
rootiest merged 2 commits from feat/replace-command-token-empty-recall into main 2026-09-21 23:14:17 +00:00
Owner

Summary

Ctrl+Alt+U (_replace_command_token) strips the first token of the current
command line and places the cursor at the start, for quick retyping.

On an empty command line it previously did nothing. Now it first recalls the
most recent history entry (same as pressing Up), then applies the usual
token-strip behavior to that.

Example: after running cd /home/me, at a fresh empty prompt, Ctrl+Alt+U
now produces | /home/me (cursor at start) instead of leaving the prompt
empty.

Changes

  • functions/_replace_command_token.fish: empty commandline recalls
    history --max 1 before the existing sudo/non-sudo token-strip logic runs.
  • docs/manual/03-key-bindings.md: documented the new empty-prompt behavior
    (SSOT; generated docs/fish-config.md/.1/site are refreshed by CI).

Testing

  • fish -n functions/_replace_command_token.fish — syntax OK
  • Manual simulation with mocked commandline/history confirms empty prompt
    after cd /home/me yields /home/me with cursor at index 0.
  • python3 docs/verify-manual.py — 83/84 pass; the one failure is the
    expected drift in the CI-generated docs/fish-config.md concat, which the
    CI bot regenerates and auto-commits on merge (same as prior doc PRs).
## Summary `Ctrl+Alt+U` (`_replace_command_token`) strips the first token of the current command line and places the cursor at the start, for quick retyping. On an empty command line it previously did nothing. Now it first recalls the most recent history entry (same as pressing Up), then applies the usual token-strip behavior to that. Example: after running `cd /home/me`, at a fresh empty prompt, `Ctrl+Alt+U` now produces `| /home/me` (cursor at start) instead of leaving the prompt empty. ## Changes - `functions/_replace_command_token.fish`: empty commandline recalls `history --max 1` before the existing sudo/non-sudo token-strip logic runs. - `docs/manual/03-key-bindings.md`: documented the new empty-prompt behavior (SSOT; generated `docs/fish-config.md`/`.1`/site are refreshed by CI). ## Testing - `fish -n functions/_replace_command_token.fish` — syntax OK - Manual simulation with mocked `commandline`/`history` confirms empty prompt after `cd /home/me` yields ` /home/me` with cursor at index 0. - `python3 docs/verify-manual.py` — 83/84 pass; the one failure is the expected drift in the CI-generated `docs/fish-config.md` concat, which the CI bot regenerates and auto-commits on merge (same as prior doc PRs).
rootiest added the Kind/EnhancementArea/FunctionsArea/Docs labels 2026-09-21 23:07:33 +00:00
rootiest added 2 commits 2026-09-21 23:07:34 +00:00
rootiest merged commit e2c25fac64 into main 2026-09-21 23:14:17 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#162