Substituting last command argument in zsh

You want to list the content of app/ directory, but you made a typo.

ls ap/


Fortunately you do not have to retype the whole path. When you type : Tab zsh will display list of commands that you can use to operate, for example on last (!!) command. To fix the typo, type and then press Tab.

!!:s/ap/app/


There’s also an equivalent.

^ap^app