The popular Fish shell has just released a new beta version - 4.0! This is a big change because it's the first version after a major rewrite. The Fish shell was originally written in C++, but now it's written in Rust. This means that the shell's core code has been completely changed.
This first beta release of Fish shell 4.0 comes with a lot of changes, both big and small. Here are a few highlights:
- Improved keybindings: Fish now supports more key combinations, making it easier to use.
- Better auto-suggestions: Fish can now offer better suggestions for commands, making it faster to work.
- Enhanced scripting: There are a bunch of improvements that will make it easier to write scripts in Fish.
- Better terminal support: Fish now works better with a wider range of terminals, making it more flexible.
Table of Contents
Why Fish Shell Chose Rust?
The developers of the fish shell chose Rust as the target language for their rewrite for several key reasons.
Rust is a systems programming language with broad platform support, a large and active community, and a good chance of still being relevant in the future. This was a key consideration as the developers wanted to ensure the long-term sustainability of the project.
The developers also felt that Rust's safety and reliability features would help prevent errors and make the shell more stable. This was particularly important because a shell is used to control a computer and errors can have serious consequences.
More importantly, Rust's unique strength in thread safety features offers a solution to the challenge of enabling concurrent mode in fish shell. This has been a long-standing goal of the developers but was difficult to achieve safely in C++.
Finally, the developers considered other languages but ultimately decided that Rust was the best fit.
They ruled out languages like Java, Python, and other scripting languages due to concerns about startup latency and memory usage.
Go language was considered an awkward fit due to its handling of the fork
system call.
Other systems programming languages, such as D, Nim, and Zig, were deemed too niche, meaning that they had fewer contributors and a higher risk of becoming irrelevant in the future.
Major Improvements in Fish Shell 4.0 Beta
This beta release (4.0b1) of the Fish shell includes a significant rewrite of the core code from C++ to Rust. It offers a number of notable improvements and fixes:
First, Fish now requests XTerm’s modifyOtherKeys
keyboard encoding and kitty keyboard protocol's progressive enhancements, which may allow binding more key combinations, depending on terminal support.
Additionally, bind
now supports a human-readable syntax. Fish can now also be built as a self-installing binary.
Second, there are many improvements to scripting and interactive use. For example, ctrl-c
during command input will simply clear the command line rather than printing ^C
and a new prompt.
Bindings can also now mix special input functions and shell commands. The ctrl-r
history search now uses glob syntax and operates only on the line or command substitution at cursor, making it easier to combine commands from history. Abbreviations can now be restricted to specific commands.
Third, there are a number of interactive improvements, including that undo history is no longer truncated after every command and ctrl-v
now strips ASCII control characters from pasted text.
There are also some new or improved bindings, including alt-o
to open the current command in an editor and shift-delete
to delete the current search item and move to the next older item during up-arrow history search.
There are also a number of completion improvements, such as command-specific tab completions now being able to offer results whose first character is a period and option completion now using fuzzy subsequence filtering.
Finally, this release includes improved terminal support, including that Fish now marks the prompt and command-output regions (via OSC 133) to enable terminal shell integration and reports the working directory (via OSC 7) unconditionally.
This is just a brief overview of the many changes in this release. You can find more detailed information in the release notes on GitHub.
Download Fish 4.0b1 Beta
This beta release is a big step forward for Fish. It is exciting to see what the future holds for this popular shell! If you want to try it out, you can download it from the Fish releases page on GitHub.
Please note that this is a beta release, so there might be some bugs. It's a good idea to wait for the final release if you're using Fish for important work.
But if you like to try out new things and help with testing, go ahead and give it a spin! You can report any issues you find on the Fish GitHub page.