In bash, I had a handy alias:

alias r="fc -s"

Which just repeated last command. Same as !!. I am now used to it (muscle memory), but I can't seem to figure out how to recreate the alias. fc doesn't have -s option in zsh. How can I bind !! behavior to r?

1 Answer 1


The command

fc -e -

should do what you want. This is a little bit tricky, because fc -e [edit-cmd] usually lets you edit tha last command with an editor. But if the [edit-cmd] equals -, no editor is invoked and the command is executed immediately.

But you won't need an alias for that, because the command r is already defined in the Z shell:

$ which r
r: shell built-in command

And what does it do? The zshbuiltins man page does know it:

r Same as fc -e -.

  • 1
    What's bizarre is that there's no documentation about what fc -e actually does!
    – Marco
    Feb 7, 2019 at 11:48
  • 1
    @Marco: Sorry, I don't understand what you mean. I've given a summery what fc -e - does in my own words. The documentation is in man zshbuiltins: fc [ -e ename ] [ -LI ] [ -m match ] [ old=new ... ] [ first [ last ] ] (...) Otherwise the editor program ename is invoked on a file containing these history events. (...)
    – mpy
    Feb 7, 2019 at 17:32
  • 1
    @mpy Sorry, that comment was not directed at you! The man documentation (zshall for example) does not explain what fc -e does, which was frustrating. It mentions fc -e, but doesn't say what it does.
    – Marco
    Feb 8, 2019 at 14:21
  • BTW, you have not given a summary of what fc -e does -- you've only said that it "should do what you want".
    – Marco
    Feb 8, 2019 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .