Last Updated: June 24, 2016
·
130
· ryrych

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 <kbd>: Tab</kbd> zsh will display list of commands that you can use to operate, for example on last (<kbd>!!</kbd>) command. To fix the typo, type and then press <kbd>Tab</kbd>.

!!:s/ap/app/

There’s also an equivalent.

^ap^app