3

I gather that bash has a "magic space" function, where if I do e.g. sudo !!<space> it will blow in sudo ./my_last_command. Does something similar exist in fish?

1 Answer 1

3

From the FAQ in the source (I can't find any documentation online):

Why doesn't history substitution ("!$" etc.) work?

Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".

2
  • 4
    That's hilarious. The only reason I use sudo !! is because it's faster and more convenient than the "interactive" way. Commented Jan 27, 2011 at 23:37
  • yep, not so easy to script an up cursor key press.
    – Digit
    Commented May 3, 2019 at 5:00

You must log in to answer this question.

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