Skip to content

shell/functions: migrate recprompt-on/off out of inline .zshrc#10

Merged
ns408 merged 1 commit into
mainfrom
feat/recprompt-function-migration
Jun 14, 2026
Merged

shell/functions: migrate recprompt-on/off out of inline .zshrc#10
ns408 merged 1 commit into
mainfrom
feat/recprompt-function-migration

Conversation

@ns408

@ns408 ns408 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add shell/functions/recprompt.sh (recording-prompt toggles, previously an inline working-tree block in ~/.zshrc), auto-sourced by loader.sh like the other function files. A zsh guard makes it no-op under bash (loader sources functions/*.sh in both shells).
  • Harden recording hygiene while moving it: also unbind ^P/^N (emacs-keymap history nav, previously left bound) and disable zsh-autosuggestions during recording (its one-shot precmd hook means clearing precmd_functions didn't stop history-based suggestions). Both restored by recprompt-off only if active beforehand.
  • CI: add zsh -n lint for the file and tests/recprompt.bats (shells out to zsh); exclude the zsh-only file from shellcheck (no zsh mode).

Why

The functions lived in an uncommitted inline block in the live ~/.zshrc symlink, tagged "migrate to shell/functions/ later". This is that migration, so they're version-controlled and managed like aws.sh/docker.sh (Ubuntu zsh users get them too).

Test plan

  • zsh -n shell/functions/recprompt.sh clean; bash -c 'source … && echo ok' no-ops via the guard.
  • tests/recprompt.bats: function defined under zsh; precmd_functions swapped on / restored off; re-entrance guard fires; bash no-op. All four validated via the equivalent zsh -c locally.
  • Manual (interactive, needs Starship/Atuin): recprompt-on clears prompt, ^R/arrows/^P/^N stop surfacing history, no autosuggestions; recprompt-off restores all.

Follow-up (separate repo)

  • impacteng-content/drafts/youtube/RECORDING-HYGIENE.md to point at this install path instead of inline definitions.

Move the recording-prompt functions from an inline sentinel block in
dotfiles/shell/.zshrc into shell/functions/recprompt.sh, where loader.sh sources
them like every other function file (Ubuntu zsh users now get them too). The
snapshot is taken lazily inside recprompt-on, so being defined before Starship/
Atuin init does not matter. A zsh guard makes the file no-op cleanly under bash,
since loader.sh sources functions/*.sh in both shells.

Harden recording hygiene while moving it: also unbind ^P/^N (emacs-keymap history
nav, previously left bound) and disable zsh-autosuggestions during recording (its
one-shot precmd hook means clearing precmd_functions did not stop history-based
suggestions); both restored by recprompt-off only if they were active before.

Add a zsh -n lint step and tests/recprompt.bats (shells out to zsh) for the
invariants that hold non-interactively; exclude the zsh-only file from shellcheck.
@ns408 ns408 merged commit a963dfb into main Jun 14, 2026
3 checks passed
@ns408 ns408 deleted the feat/recprompt-function-migration branch June 14, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant