shell/functions: migrate recprompt-on/off out of inline .zshrc#10
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shell/functions/recprompt.sh(recording-prompt toggles, previously an inline working-tree block in~/.zshrc), auto-sourced byloader.shlike the other function files. A zsh guard makes it no-op under bash (loader sourcesfunctions/*.shin both shells).^P/^N(emacs-keymap history nav, previously left bound) and disable zsh-autosuggestions during recording (its one-shot precmd hook means clearingprecmd_functionsdidn't stop history-based suggestions). Both restored byrecprompt-offonly if active beforehand.zsh -nlint for the file andtests/recprompt.bats(shells out tozsh); exclude the zsh-only file from shellcheck (no zsh mode).Why
The functions lived in an uncommitted inline block in the live
~/.zshrcsymlink, tagged "migrate to shell/functions/ later". This is that migration, so they're version-controlled and managed likeaws.sh/docker.sh(Ubuntu zsh users get them too).Test plan
zsh -n shell/functions/recprompt.shclean;bash -c 'source … && echo ok'no-ops via the guard.tests/recprompt.bats: function defined under zsh;precmd_functionsswapped on / restored off; re-entrance guard fires; bash no-op. All four validated via the equivalentzsh -clocally.recprompt-onclears prompt,^R/arrows/^P/^Nstop surfacing history, no autosuggestions;recprompt-offrestores all.Follow-up (separate repo)
impacteng-content/drafts/youtube/RECORDING-HYGIENE.mdto point at this install path instead of inline definitions.