Skip to content

feat: zsh: Add Magic Space hack#12

Closed
bezhermoso wants to merge 1 commit intomasterfrom
claude/zsh-magic-space-hack-UDTka
Closed

feat: zsh: Add Magic Space hack#12
bezhermoso wants to merge 1 commit intomasterfrom
claude/zsh-magic-space-hack-UDTka

Conversation

@bezhermoso
Copy link
Copy Markdown
Owner

Summary

Expands historical commands or references to show their full content before execution, preventing accidental runs of unknown commands. When you type a history expansion (like !!, !$, !*) and press Space, the expansion will be replaced with the actual command.

What it achieves

  • Automatically expands history references when you press Space
  • Prevents accidental execution of unknown commands
  • Shows you exactly what will run before you hit Enter

Zsh Configuration

bindkey ' ' magic-space

Common history expansions: !! (previous command), !$ (last arg), !* (all args), ^foo^bar (substitution)

Reference

Additional Applications & Inspiration

Expands historical commands or references to show their full content before
execution, preventing accidental runs of unknown commands.

When you type a history expansion (like !!, !$, !*) and press Space, the
expansion will be replaced with the actual command, allowing you to review
it before executing.

Configuration:
- bindkey ' ' magic-space

Reference: https://www.youtube.com/watch?v=3fVAtaGhUyU (2:39-4:02)
@bezhermoso bezhermoso force-pushed the claude/zsh-magic-space-hack-UDTka branch from 04f3e4b to a095a85 Compare January 5, 2026 06:42
@bezhermoso
Copy link
Copy Markdown
Owner Author

Already works as-is.

@bezhermoso bezhermoso closed this Jan 5, 2026
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