{"id":10884,"date":"2025-02-28T12:06:42","date_gmt":"2025-02-28T19:06:42","guid":{"rendered":"https:\/\/jasonsblog.ddns.net\/?p=10884"},"modified":"2025-02-28T12:07:49","modified_gmt":"2025-02-28T19:07:49","slug":"__trashed-2","status":"publish","type":"post","link":"https:\/\/jasonsblog.ddns.net\/index.php\/2025\/02\/28\/__trashed-2\/","title":{"rendered":"Fish Shell 4 Is Here Entirely Rewritten in Rust"},"content":{"rendered":"\n<p>Fish is my favorite shell, as I love the autocomplete history feature along with syntax highlighting which are built in by default (have to manually add it to other shells). So the first thing I do with new operating systems is change my shell to Fish (you can easily switch to BASH or other shells if needed as well as them being there for scripts to call&#8230;). And a good reason to read these articles is you learn new things, as I was unaware of the <code>ctrl-r<\/code> history feature which will come in handy. This hasn&#8217;t rolled out to any of my distros yet, but should hit my Arch system soon, and maybe Debian Unstable and then Debian Testing after.<\/p>\n\n\n\n<p><a href=\"https:\/\/linuxiac.com\/fish-shell-4-is-here-entirely-rewritten-in-rust\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/linuxiac.com\/fish-shell-4-is-here-entirely-rewritten-in-rust\/<\/a><\/p>\n\n\n<div class=\"wp-block-ub-divider ub_divider ub-divider-orientation-horizontal\" id=\"ub_divider_1706aed6-947c-4e0f-aa6a-aed5a84a4b3d\"><div class=\"ub_divider_wrapper\" style=\"position: relative; margin-bottom: 2px; width: 100%; height: 2px; \" data-divider-alignment=\"center\"><div class=\"ub_divider_line\" style=\"border-top: 2px solid #ccc; margin-top: 2px; \"><\/div><\/div><\/div>\n\n\n<h5 class=\"wp-block-heading\">Fish Shell 4 is here, completely rewritten in Rust with improved key bindings, self-installable builds, better history control, and more.<\/h5>\n\n\n\n<p>By Bobby Borisov<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn.shortpixel.ai\/spai\/q_lossy+ret_img+to_auto\/linuxiac.com\/wp-content\/uploads\/2025\/02\/fish-shell-4-1024x576.jpg\" alt=\"Fish Shell 4 Is Here Entirely Rewritten in Rust\"\/><\/figure>\n\n\n\n<p>The much-loved Fish Shell project has just unveiled&nbsp;Fish 4, a significant update introducing major behind-the-scenes improvements and new user-facing features.<\/p>\n\n\n\n<p>Without further ado, here\u2019s the star of the show \u2013 Rust! Yes, that\u2019s right: <a href=\"https:\/\/linuxiac.com\/fish-shell-4-0-rust-is-coming\/\">Fish 4 has been&nbsp;entirely rewritten in Rust<\/a>. However, from an everyday user\u2019s perspective, the transition should remain virtually invisible: the commands, settings, and typical interactions are intended to be unchanged.<\/p>\n\n\n\n<p>Moving on to what you will notice, Fish has introduced an updated bind notation system and deeper terminal compatibility. You can now replace opaque sequences with friendlier, intuitive commands such as <code>bind ctrl-right<\/code>. Thanks to \u201c<em>modifyOtherKey<\/em>\u201d and the Kitty keyboard protocol, Fish can distinguish control sequences that previously seemed identical.<\/p>\n\n\n\n<p>Another highlight in Fish 4 is tighter integration with terminal capabilities. For example, Fish now automatically employs OSC 133 sequences for prompts and command output, promoting smoother synchronization with various terminals that once relied on add-on \u201cshell integration\u201d scripts.<\/p>\n\n\n\n<p>In addition, Fish 4 standardizes cursor changes in vi-mode across most terminals, no longer relying on environment-specific detection, which often falls short.<\/p>\n\n\n\n<p>Notably, the shell now handles long command lines more gracefully, scrolling instead of misrendering them. Plus, any edits triggered by command-line bindings are immediately visible, offering a more intuitive scripting and interactive experience.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/linuxiac.b-cdn.net\/wp-content\/uploads\/2025\/02\/fish-shell-4-app.jpg\"><img decoding=\"async\" src=\"https:\/\/cdn.shortpixel.ai\/spai\/q_lossy+ret_img+to_auto\/linuxiac.com\/wp-content\/uploads\/2025\/02\/fish-shell-4-app-1024x455.jpg\" alt=\"Fish Shell 4\" class=\"wp-image-159589\"\/><\/a><figcaption class=\"wp-element-caption\">Fish Shell 4<\/figcaption><\/figure>\n\n\n\n<p>Speaking of enhancements to interactive use, the <code>ctrl-r<\/code> history pager\u2014first introduced in Fish 3.6\u2014has been refined. You can now rely on glob syntax to filter history entries more precisely. Even better, this search applies strictly to the current command, letting you build more complex, multi-line history reconstructions without rummaging through entire scripts.<\/p>\n\n\n\n<p>The default theme has also seen a small but meaningful tweak: commands now appear in the terminal\u2019s \u201cnormal\u201d color instead of the somewhat hard-to-read \u201cblue.\u201d Existing users will retain their current settings unless they manually reload the theme via <code>fish_config<\/code>.<\/p>\n\n\n\n<p>The new self-installable build feature might be a game-changer for users who frequently SSH into servers without administrative privileges. After compiling Fish, you can run a single, self-contained binary that directly extracts everything necessary\u2014functions, man pages, and even the web configuration tool\u2014to your home directory.<\/p>\n\n\n\n<p>In other words, this makes it easier than ever to run Fish on environments where a package manager is unavailable (or you don\u2019t have permission to use it). Pre-built versions are available for major platforms like x86_64 and aarch64 Linux on the project\u2019s <a href=\"https:\/\/github.com\/fish-shell\/fish-shell\/releases\/tag\/4.0.0\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub Releases page<\/a>. Other platforms are supported, too, though you may need to compile your own builds.<\/p>\n\n\n\n<p>Another long-requested feature, the ability to exclude certain commands from history, is finally here. By defining a custom function called <code>fish_should_add_to_history<\/code>, you can decide exactly which commands get retained. Any command flagged for exclusion remains in a temporary spot, so you can still press the up arrow to repeat it immediately, but once you run something else, it\u2019s erased.<\/p>\n\n\n\n<p>For scripting enthusiasts, Fish 4 delivers a lot of improvements, with the main ones being:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>string match<\/code> now supports a <code>--max-matches<\/code> option, allowing you to limit the number of matches processed.<\/li>\n\n\n\n<li><code>for<\/code> loops will no longer remember local variables from the previous iteration.<\/li>\n\n\n\n<li><code>set<\/code> gains a <code>--no-event<\/code> option to suppress variable change events (particularly useful in event handlers).<\/li>\n\n\n\n<li><code>time<\/code> begins measuring earlier, capturing the duration of any command substitutions that occur before executing a command.<\/li>\n\n\n\n<li><code>complete --erase<\/code> fully disables autoloading completions for specified commands, aligning with <code>functions --erase<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>For more information on all novelties in Fish Shell 4, see the <a href=\"https:\/\/fishshell.com\/blog\/new-in-40\/\" target=\"_blank\" rel=\"noreferrer noopener\">release announcement<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fish is my favorite shell, as I love the autocomplete history feature along with syntax highlighting which are built in by default (have to manually add it to other shells). So the first thing I do with new operating systems is change my shell to Fish (you can easily switch to BASH or other shells [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-10884","post","type-post","status-publish","format-standard","hentry","category-tech"],"blocksy_meta":[],"featured_image_src":null,"author_info":{"display_name":"Jason","author_link":"https:\/\/jasonsblog.ddns.net\/index.php\/author\/jturning\/"},"_links":{"self":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/10884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=10884"}],"version-history":[{"count":2,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/10884\/revisions"}],"predecessor-version":[{"id":10887,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/10884\/revisions\/10887"}],"wp:attachment":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=10884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/categories?post=10884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/tags?post=10884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}