this post was submitted on 10 Nov 2025
146 points (99.3% liked)

Linux

10098 readers
647 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

Fish shell, a popular user-friendly command-line shell, has announced version 4.2, a new release that builds on the 4.0 series. Among the most visible improvements is an upgrade to history-based autosuggestions, which now properly handle multi-line commands.

Fish 4.2 also improves how prompts are managed: transient prompts that contain more lines than the final one are now cleared properly, preventing visual clutter on screen. Similarly, the shell now hides parts of a multi-line prompt that have scrolled out of view, eliminating duplicated lines after repainting.

you are viewing a single comment's thread
view the rest of the comments
[–] Cris_Color@lemmy.world 2 points 1 day ago (1 children)

Any chance you could give a simple explainer on how to set up a !! abbreviation in fish?

I'm a fairly non-technical fish user and every time I've tried to figure out how to do it I've ended up giving up πŸ˜…

If you don't know off the top of your head thats fine, but it seemed worth an ask ☺️

[–] Oinks@lemmy.blahaj.zone 2 points 1 day ago* (last edited 1 day ago)

I have this in my config:

function lastcmd
    echo $history[1]
end

abbr --add "!!" --position anywhere --function lastcmd

I believe I originally got this implementation from the GitHub issues. The key is that abbreviations can also call functions, which can in turn index into the history list. We also need to specify that we want the expansion even if we're in an argument to another command, such as in sudo !!.