fish 3.0 is a major release which brings with it both improvements in functionality and some breaking changes. All fish scripts should be reviewed
- The
IFS
variable is deprecated and will be removed in fish 4.0 (#4156). - The
function --on-process-exit
event will be removed in future (#4700). Use thefish_exit
event instead. $_
is deprecated and will removed in the future (#813). Usestatus current-command
in a subshell instead.^
as a redirection deprecated and will be removed in the future. (#4394). Use2>
to redirect stderr. This is controlled by thestderr-nocaret
feature flag.?
as a glob is deprecated and will be removed in the future. (#4520). This is controlled by theqmark-noglob
feature flag.
%
is no longer used for process and job expansion.$fish_pid
and$last_pid
have taken the place of%self
and%last
respectively. Some commands have been wrapped to still understand process expansion, includingbg
,fg
andkill
(#4230, #1202)- A literal
{}
now expands to itself, rather than nothing. This makes working withfind -exec
easier. (#1109, #4632) - Successive commas in brace expansions are handled in less surprising manner (
{,,,}
expands to four empty strings rather than an empty string, a comma and an empty string again). (#3002, #4632). for
loop control variables are no longer local to thefor
block (#1935).- Variables set in
if
andwhile
conditions are available outside the block (#4820). - Local exported (
set -lx
) vars are now visible to functions (#1091). set x[1] x[2] a b
is no longer valid syntax (#4236).- The new
math
builtin (see below) does not support logical expressions;test
should be used instead (#4777). - Range expansion (
$foo[1..5]
) will now always go forward if only the end is negative, and in reverse if just the start is. This is to enable clamping to the last valid index without changing direction if the list has fewer elements than expected. - Background jobs not first
disown
'd will be reaped uponexec
, bringing the behavior in line with that ofexit
. read
now uses-s
as short for--silent
(à labash
);--shell
's abbreviation (formerly-s
) is now-S
instead (#4490).
- fish now supports
&&
,||
, and!
(#4620). - Variables may be used as commands (#154).
- A new feature flags mechanism is added for staging deprecations and breaking changes. Feature flags may be specified at launch with
fish --features ...
or by setting the universalfish_features
variable. (#4940) wait
builtin is added for waiting on processes (#4498).math
is now a builtin rather than a wrapper aroundbc
(#3157). The default scale is now 6, so that floating point computations produce decimals (#4478).- Using a read-only variable in a for loop is now an error. Note that this never worked. It simply failed to set the for loop var and thus silently produced incorrect results (#4342).
- Arguments to
end
are now errors, instead of being silently ignored. - Setting
$PATH
no longer warns on non-existent directories, allowing for a single $PATH to be shared across machines (e.g. via dotfiles). - A pipe at the end of a line now allows the job to continue on the next line (#1285).
- The names
argparse
,read
,set
,status
,test
and[
are now reserved and not allowed as function names. This prevents users unintentionally breaking stuff (#3000). while
sets$status
to a more useful value (#4982)- Command substitution output is now limited to 10 MB by default (#3822).
read
has a new--delimiter
option as a better alternative to theIFS
variable (#4256).read
writes directly to stdout if called without arguments (#4407)read
can now read one or more individual lines from the input stream without consuming the input in its entirety viaread -L/--line
. Refer to theread
documentation for more info.set
has a new--append
and--prepend
option (#1326).set
has a new--show
option to show lots of information about variables (#4265).complete
now has a-k
and--keep-order
option to keep the order of theOPTION_ARGUMENTS
(#361).history search
supports globs for wildcard searching (#3136).bind
has a new--silent
option to ignore bind requests for named keys not available under the current$TERMINAL
(#4188, #4431).string split
supports-n/--no-empty
to exclude empty strings from the result (#4779).funced
now has a-s
and--save
option to automatically save the edited function after successfully editing (#4668).exec
now triggers the same safety features asexit
and prompts for confirmation if background jobs are running.- The machine hostname, where available, is now exposed as
$hostname
which is now a reserved variable. This drops the dependency on thehostname
executable (#4422). - The
jobs
builtin now has a-q
and--quiet
option to silence the output. functions --handlers
can be used to show event handlers (#4694).alias
now has a-s
and--save
option to save the function generated by the alias usingfuncsave
(#4878).- The
string
builtin has new commandssplit0
andjoin0
for working with NUL-delimited output. - The
-d
option tofunctions
to set the description of an existing function now works; before 3.0 it was documented but unimplemented. Note that the long form--description
continues to work. (#5105) test
and[
now support floating point values in numeric comparisons.
abbr
has been reimplemented to be faster. This means the oldfish_user_abbreviations
variable is ignored (#4048).- Setting variables is much faster (#4200, #4341).
- Globs are faster (#4579).
string
reads from stdin faster (#4610).- Slicing $history (in particular,
$history[1]
for the last executed command) is much faster.
cd
tab completions no longer descend into the deepest unambiguous path (#4649).sudo
completions now provide completions for the target of the sudo command.- Pager navigation has been improved. Most notably, moving down now wraps around, moving up from the commandline now jumps to the last element and moving right and left now reverse each other even when wrapping around (#4680).
- Typing normal characters while the completion pager is active no longer shows the search field. Instead it enters them into the command line, and ends paging (#2249).
- A new input binding
pager-toggle-search
toggles the search field in the completions pager on and off. By default this is bound to control-s. - The pager will now show the full command instead of just its last line if the number of completions is large (#4702).
- Tildes in file names are now properly escaped in completions (#2274).
- Wrapping completions (from
complete -w
orfunction -w
) can now inject arguments. For example,complete gco -w 'git checkout'
now works properly (#1976). Thealias
function has been updated to respect this behavior. - The universal variables file no longer contains the MAC address. It is now at the fixed location
.config/fish/fish_universal_variables
(#1912). - Path completions now support expansions, meaning expressions like
python ~/<TAB>
now provides file suggestions just like any other relative or absolute path. (This includes support for other expansions, too.) - Autosuggestions try to avoid arguments that are already present in the command line.
- Added completions for
bd
(#4472)bower
configure
(autoconf only)doas
hjson
j
(autojump #4344)jhipster
(#4472)kldload
kldunload
meson
ngrok
(#4642)optipng
port
serve
(#5026)ttx
unzip
xsv
- Lots of improvements to completions (especially
git
andhg
). - Completions for
yarn
andnpm
now require theall-the-package-names
NPM package for full functionality. - Completions for
bower
andyarn
now require thejq
utility for full functionality. - Improved French translations.