Skip to content

History Expansion

Bash-style history expansions trigger on Space or Enter. Some are implemented as abbreviations (e.g. !*), while others (!!, !$, !.) are implemented as keybindings, but they all serve the same purpose.

Abbreviation Description
!^ Expand to the first argument of the previous command
!* Expand to all arguments of the previous command
^old^new^ Interactive typo substitution (replace ‘old’ with ‘new’ in previous command)
!string Expand to the most recent command starting with ‘string’
!?string? Expand to the most recent command containing ‘string’
!-n Expand to the nth-previous command
!! Expand to the previous command
!$ Expand to the last argument of the previous command
!. Expand .. to ../.. and so on