These are the draft release notes for fish 4.0.0. Like this release of fish itself, they are in beta and are not complete. Please report any issues you find.
fish’s core code has been ported from C++ to Rust (#9512).
This means a large change in dependencies and how to build fish.
Packagers should see the For Distributors section at the end.
Notable backwards-incompatible changes
-
As part of a larger binding rework,
bind
gained a new key notation.
In most cases the old notation should keep working, but in rare cases you may have to change abind
invocation to use the new notation.
See below for details. -
Terminals that fail to ignore unrecognized OSC or CSI sequences may display garbage. We know cool-retro-term and emacs’ ansi-term are affected,
most mainstream terminals are not. -
alt-left
andalt-right
will now move by one argument (which may contain quoted spaces), not just one word likectrl-left
andctrl-right
do. -
alt-backspace
will delete an entire argument, not just one word (which isctrl-backspace
now). -
random
will produce different values from previous versions of fish when used with the same seed, and will work more sensibly with small seed numbers.
The seed was never guaranteed to give the same result across systems,
so we do not expect this to have a large impact (#9593). -
Variables in command position that expand to a subcommand keyword are now forbidden to fix a likely user error.
For example,set editor command emacs; $editor
is no longer allowed (#10249). -
functions --handlers
will now list handlers in a different order.
Now it is definition order, first to last, where before it was last to first.
This was never specifically defined, and we recommend not relying on a specific order (#9944). -
The
qmark-noglob
feature, introduced in fish 3.0, is enabled by default. That means?
will no longer act as a single-character glob.
You can, for the time being, turn it back on by addingno-qmark-noglob
tofish_features
and restarting fish:set -Ua fish_features no-qmark-noglob
The flag will eventually be made read-only, making it impossible to turn off.
-
fish no longer searches directories from the Windows system/user
$PATH
environment variable for Linux executables. To execute Linux binaries by name (i.e. not with a relative or absolute path) from a Windows folder, make sure the/mnt/c/...
path is explicitly added to$fish_user_paths
and not just automatically appended to$PATH
bywsl.exe
(#10506). -
Under Microsoft Windows Subsystem for Linux 1 (not WSL 2) , backgrounded jobs that have not been disowned and do not terminate on their own after a
SIGHUP
+SIGCONT
sequence will be explicitly killed by fish on exit (after the usual prompt to close or disown them) to work around a WSL 1 deficiency that sees backgrounded processes that run intoSIGTTOU
remain in a suspended state indefinitely (#5263). The workaround is to explicitlydisown
processes you wish to outlive the shell session.
Notable improvements and fixes
-
fish now requests XTerm’s
modifyOtherKeys
keyboard encoding and kitty keyboard protocol’s progressive enhancements (#10359).
Depending on terminal support, this allows to binding more key combinations, including arbitrary combinations of modifiersctrl
,alt
andshift
, and distinguishing (for example)ctrl-i
fromtab
.Additionally,
bind
now supports a human-readable syntax in addition to byte sequences.
This includes modifier names, and names for keys likeenter
andbackspace
.
For examplebind up 'do something'
binds the up-arrow key instead of a two-key sequence (“u” and then “p”)bind ctrl-x,alt-c 'do something'
binds a sequence of two keys.
Any key argument that starts with an ASCII control character (like
e
orcX
) or is up to 3 characters long, not a named key, and does not contain,
or-
will be interpreted in the old syntax to keep compatibility for the majority of bindings. -
fish can now be built as a self-installing binary (#10367). That means it can be easily built on one system and copied to another, where it can extract supporting files.
To do this, run:cargo install --path . # in a clone of the fish repository # or `cargo build --release` and copy target/release/fish{,_indent,_key_reader} wherever you want
The first time it runs interactively, it will extract all the data files to
~/.local/share/fish/install/
. To uninstall, remove the fish binaries and that directory.This build system is experimental; the main build system, using
cmake
, remains the recommended approach for packaging and installation to a prefix. -
A new function
fish_should_add_to_history
can be overridden to decide whether a command should be added to the history (#10302). -
ctrl-c
during command input no longer prints^C
and a new prompt, but merely clears the command line. This restores the behavior from version 2.2. To revert to the old behavior, usebind ctrl-c __fish_cancel_commandline
(#10213). -
Bindings can now mix special input functions and shell commands, so
bind ctrl-g expand-abbr "commandline -i n"
works as expected (#8186). -
Special input functions run from bindings via
commandline -f
are now applied immediately, instead of after the currently executing binding (#3031).
For example,commandline -i foo; commandline | grep foo
succeeds now. -
Undo history is no longer truncated after every command, but kept for the lifetime of the shell process.
-
The
ctrl-r
history search now uses glob syntax (#10131). -
The
ctrl-r
history search now 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. For instance:
abbr --add --command git back 'reset --hard HEAD^'
will expand “back” to
reset --hard HEAD^
, but only when the command isgit
(#9411).
Deprecations and removed features
-
commandline --tokenize
(short option-o
) has been deprecated in favor ofcommandline --tokens-expanded
(short option-x
) which expands variables and other shell syntax, removing the need to use eval in completion scripts (#10212). -
Two new feature flags:
remove-percent-self
(seestatus features
) disables PID expansion of%self
, which has been supplanted by$fish_pid
(#10262).test-require-arg
disablestest
’s one-argument mode. That meanstest -n
without an additional argument will return false,test -z
will keep returning true. Any other option without an argument, anything that is not an option and no argument will be an error. This also goes for[
, test’s alternate name.
This is a frequent source of confusion and so we are breaking with POSIX explicitly in this regard.
In addition to the feature flag, there is a debug category “deprecated-test”. Running fish withfish -d deprecated-test
will show warnings whenever atest
invocation that would change is used. (#10365).
These can be enabled with:
set -Ua fish_features remove-percent-self test-require-arg
We intend to enable them by default in future, and after that eventually make them read-only.
-
Specifying key names as terminfo names (using the
bind -k
syntax) is deprecated and may be removed in a future version. -
When a terminal pastes text into fish using bracketed paste, fish used to switch to a special
paste
bind mode.
This bind mode has been removed. The behavior on paste is no longer configurable. -
When an interactive fish is stopped or terminated by a signal that cannot be caught (SIGSTOP or SIGKILL), it may leave the terminal in a state where keypresses with modifiers are sent as CSI u sequences, instead of traditional control characters or escape sequences that are recognized by Readline and compatible programs, such as bash and python.
If this happens, you can use thereset
command fromncurses
to restore the terminal state. -
fish_key_reader --verbose
no longer shows timing information. -
Terminal information is no longer read from hashed terminfo databases, or termcap databases (#10269). The vast majority of systems use a non-hashed terminfo database, which is still supported.
Scripting improvements
for
loops will no longer remember local variables from the previous iteration (#10525).- A new
history append
subcommand appends a command to the history, without executing it (#4506). - A new redirection:
/path/to/file
will try opening the file as input, and if it doesn’t succeed silently uses/dev/null
instead.
This can help with checks liketest -f /path/to/file; and string replace foo bar < /path/to/file
. (#10387) - A new option
commandline --tokens-raw
prints a list of tokens without any unescaping (#10212). - A new option
commandline --showing-suggestion
tests whether an autosuggestion is currently displayed (#10586). functions
andtype
now show that a function was copied and its source, rather than solelyDefined interactively
(#6575).- Stack trace now shows line numbers for copied functions (#6575).
foo & && bar
is now a syntax error, like in other shells (#9911).if -e foo; end
now prints a more accurate error (#10000).cd
into a directory that is not readable but accessible (permissions--x
) is now possible (#10432).- An integer overflow in
string repeat
leading to a near-infinite loop has been fixed (#9899). string shorten
behaves better in the presence of non-printable characters, including fixing an integer overflow that shortened strings more than intended (#9854).string pad
no longer allows non-printable characters as padding (#9854).string repeat
now allows omission of-n
when the first argument is an integer (#10282).string match
andreplace
have a new--max-matches
option to return as soon as the specified number of matches have been identified, which can improve performance in scripts (#10587).functions --handlers-type caller-exit
once again lists functions defined asfunction --on-job-exit caller
, rather than them being listed byfunctions --handlers-type process-exit
.- A new
set --no-event
option sets or erases variables without triggering a variable event. This can be useful to change a variable in an event handler (#10480). - Commas in command substitution output are no longer used as separators in brace expansion, preventing a surprising expansion in some cases (#5048).
- Universal variables can now store strings containing invalid UTF-8 (#10313).
- A new
path basename -E
option that causes it to return the basename (“filename” with the directory prefix removed) with the final extension (if any) also removed. This is a shorter version ofpath change-extension "" (path basename $foo)
(#10521). - A new
math --scale-mode
option to selecttruncate
,round
,floor
,ceiling
as you wish; the default value istruncate
. (#9117). random
is now less strict about its arguments, allowing a start larger or equal to the end. (#10879)
Interactive improvements
- Autosuggestions were sometimes not shown after recalling a line from history, which has been fixed (#10287).
- Up-arrow search matches -- which are highlighted in reverse colors -- are no longer syntax-highlighted, to fix bad contrast with the search match highlighting.
- Command abbreviations (those with
--position command
or without a--position
) now also expand after decorators likecommand
(#10396). - Abbreviations now expand after process separators like
;
and|
. This fixes a regression in version 3.6 (#9730). - When exporting interactively defined functions (using
type
,functions
orfuncsave
) the function body is now indented, to match the interactive command line editor (#8603). ctrl-x
(fish_clipboard_copy
) on multiline commands now includes indentation (#10437).ctrl-v
(fish_clipboard_paste
) now strips ASCII control characters from the pasted text.
This is consistent with normal keyboard input (#5274).- When a command like
fg %2
fails to find the given job, it no longer behaves as if no job spec was given (#9835). - Redirection in command position like
>echo
is now highlighted as error (#8877). fish_vi_cursor
now works properly inside the prompt created by builtinread
(#10088).- fish no longer fails to open a FIFO if interrupted by a terminal resize signal (#10250).
read --help
and friends no longer ignore redirections. This fixes a regression in version 3.1 (#10274).- Measuring a command with
time
now considers the time taken for command substitution (#9100). fish_add_path
now automatically enables verbose mode when used interactively (in the command line), in an effort to be clearer about what it does (#10532).- fish no longer adopts TTY modes of failed commands (#10603).
- complete -e cmd now prevents autoloading completions for cmd (#6716).
- fish’s default color scheme no longer uses the color “blue”, as it has bad contrast against the background in a few terminal’s default palettes (#10758, #10786)
The color scheme will not be upgraded for existing installs. If you want, you should select it again viafish_config
. - Command lines which are larger than the terminal are now displayed correctly, instead of multiple blank lines being displayed (#7296).
- Prompts that use external commands will no longer produce an infinite loop if the command crashes (#9796).
New or improved bindings
- When the cursor is on a command that resolves to an executable script,
alt-o
will now open that script in your editor (#10266). - During up-arrow history search,
shift-delete
will delete the current search item and move to the next older item. Previously this was only supported in the history pager. shift-delete
will also remove the currently-displayed autosuggestion from history, and remove it as a suggestion.ctrl-Z
(also known asctrl-shift-z
) is now bound to redo.alt-delete
now deletes the argument (which may contain quoted spaces) right of the cursor.- Some improvements to the
alt-e
binding which edits the command line in an external editor:- The editor’s cursor position is copied back to fish. This is currently supported for Vim and Kakoune.
- Cursor position synchronization is only supported for a set of known editors, which are now also detected in aliases which use
complete --wraps
. For example, usecomplete --wraps my-vim vim
to synchronize cursors whenEDITOR=my-vim
. - Multiline commands are indented before being sent to the editor, which matches how they are displayed in fish.
- The
...-path-component
bindings, likebackward-kill-path-component
, now treat#
as part of a path component (#10271). - Bindings like
alt-l
that print output in between prompts now work correctly with multiline commandlines. ctrl-c
no longer cancels builtinread
.alt-d
on an empty command line lists the directory history again. This restores the behavior of version 2.1.history-prefix-search-backward
and-forward
now maintain the cursor position, instead of moving the cursor to the end of the command line (#10430).- The following keys have refined behavior if the terminal supports the new keyboard encodings:
shift-enter
now inserts a newline instead of executing the command line.ctrl-backspace
now deletes the last word instead of only one character (#10741).ctrl-delete
deletes the next word (same asalt-d
).
- New special input functions:
forward-char-passive
andbackward-char-passive
are like their non-passive variants but do not accept autosuggestions or move focus in the completion pager (#10398).forward-token
,backward-token
,kill-token
, andbackward-kill-token
are similar to the*-bigword
variants but for the whole argument token which includes escaped spaces (#2014).
- The
accept-autosuggestion
special input function now returns false when there was nothing to accept (#10608). - Vi mode has seen some improvements but continues to suffer from the lack of people working on it.
- New default cursor shapes for insert and replace mode.
- Insert-mode
ctrl-n
accepts autosuggestions (#10339). - Outside insert mode, the cursor will no longer be placed beyond the last character on the commandline.
- When the cursor is at the end of the commandline, a single
l
will accept an autosuggestion (#10286). - The cursor position after pasting (
p
) has been corrected. - When the cursor is at the start of a line, escaping from insert mode no longer moves the cursor to the previous line.
- Added bindings for clipboard interaction, like
",+,p
and",+,y,y
. - Deleting in visual mode now moves the cursor back, matching vi (#10394).
- Support
%
motion (#10593). - Support ab and ib vi text objects. New input functions are introduced
jump-{to,till}-matching-bracket
(#1842). - The
E
binding now correctly handles the last character of the word, by jumping to the next word (#9700).
Completions
- Command-specific tab completions may now offer results whose first character is a period. For example, it is now possible to tab-complete
git add
for files with leading periods. The default file completions hide these files, unless the token itself has a leading period (#3707). - Option completion now uses fuzzy subsequence filtering, just like non-option completion (#830).
This means that--fb
may be completed to--foobar
if there is no better match. - Completions that insert an entire token now use quotes instead of backslashes to escape special characters (#5433).
- Historically, file name completions are provided after the last
:
or=
within a token.
This helps commands likersync --files-from=
.
If the=
or:
is actually part of the filename, it will be escaped as:
and=
,
and no longer get this special treatment.
This matches Bash’s behavior. - Various new completion scripts and numerous updates to existing ones.
- Generated completions are now stored in
$XDG_CACHE_HOME/fish
or~/.cache/fish
by default (#10369)
Improved terminal support
- fish now marks the prompt and command-output regions (via OSC 133) to enable terminal shell integration (#10352).
Shell integration shortcuts can scroll to the next/previous prompt or show the last command output in a pager. - fish now reports the working directory (via OSC 7) unconditionally instead of only for some terminals (#9955).
- fish now sets the terminal window title (via OSC 0) unconditionally instead of only for some terminals (#10037).
- Focus reporting in tmux is no longer disabled on the first prompt.
- Focus reporting is now disabled during commands run inside key bindings (#6942).
- Cursor changes are applied to all terminals that support them, and the list of specifically-supported terminals has been removed (#10693).
- If it cannot find the terminfo entry given by
TERM
environment variable, fish will now use an includedxterm-256color
definition to match the vast majority of current terminal emulators (#10905). If you need to have a specific terminfo profile for your terminal’sTERM
variable, install it into the terminfo database. - Further improvements to the correct display of prompts which fill the width of the terminal (#8164).
Other improvements
fish_indent
will now collapse multiple empty lines into one (#10325).fish_indent
now preserves the modification time of files if there were no changes (#10624).- Performance and interactivity under Windows Subsystem for Linux has been improved, with a workaround for Windows-specific locations being appended to
$PATH
by default (#10506). - Additional filesystems such as AFS are properly detected as remote, which avoids certain hangs due to expensive filesystem locks (#10818).
For distributors
fish has been ported to Rust. This means a significant change in dependencies, which are listed in the README. In short, Rust 1.70 or greater is required, and a C++ compiler is no longer needed (although a C compiler is still required, for some C glue code and the tests).
CMake remains the recommended build system, because of cargo’s limited support for installing support files. Version 3.5 remains the minimum supported version. The Xcode generator for CMake is not supported any longer (#9924)
fish no longer depends on the ncurses library, but still uses a terminfo database. When packaging fish, please add a dependency on the package containing your terminfo database instead of curses.
Download links: To download the source code for fish, we suggest the file named "fish-4.0b1.tar.xz". The file downloaded from "Source code (tar.gz)" will not build correctly. The SHA-256 sum of this file is 534334e10f85722214e9daff82a57cc3501235523f16f8f131c2344e4ec98da7
. A GPG signature from David Adam (key ID 0x7A67D962D88A709A
) is available as "fish-4.0b1.tar.xz.asc".
The files called fish-static-*
are experimental statically linked builds for any linux with the given architecture. Extract and run, and they will extract their data files as needed