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
IFSvariable is deprecated and will be removed in fish 4.0 (#4156). - The
function --on-process-exitevent will be removed in future (#4700). Use thefish_exitevent instead. $_is deprecated and will removed in the future (#813). Usestatus current-commandin a subshell instead.^as a redirection deprecated and will be removed in the future. (#4394). Use2>to redirect stderr. This is controlled by thestderr-nocaretfeature flag.?as a glob is deprecated and will be removed in the future. (#4520). This is controlled by theqmark-noglobfeature flag.
%is no longer used for process and job expansion.$fish_pidand$last_pidhave taken the place of%selfand%lastrespectively. Some commands have been wrapped to still understand process expansion, includingbg,fgandkill(#4230, #1202)- A literal
{}now expands to itself, rather than nothing. This makes working withfind -execeasier. (#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). forloop control variables are no longer local to theforblock (#1935).- Variables set in
ifandwhileconditions are available outside the block (#4820). - Local exported (
set -lx) vars are now visible to functions (#1091). set x[1] x[2] a bis no longer valid syntax (#4236).- The new
mathbuiltin (see below) does not support logical expressions;testshould 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. readnow uses-sas short for--silent(à labash);--shell's abbreviation (formerly-s) is now-Sinstead (#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_featuresvariable. (#4940) waitbuiltin is added for waiting on processes (#4498).mathis 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
endare now errors, instead of being silently ignored. - Setting
$PATHno 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,testand[are now reserved and not allowed as function names. This prevents users unintentionally breaking stuff (#3000). whilesets$statusto a more useful value (#4982)- Command substitution output is now limited to 10 MB by default (#3822).
readhas a new--delimiteroption as a better alternative to theIFSvariable (#4256).readwrites directly to stdout if called without arguments (#4407)readcan now read one or more individual lines from the input stream without consuming the input in its entirety viaread -L/--line. Refer to thereaddocumentation for more info.sethas a new--appendand--prependoption (#1326).sethas a new--showoption to show lots of information about variables (#4265).completenow has a-kand--keep-orderoption to keep the order of theOPTION_ARGUMENTS(#361).history searchsupports globs for wildcard searching (#3136).bindhas a new--silentoption to ignore bind requests for named keys not available under the current$TERMINAL(#4188, #4431).string splitsupports-n/--no-emptyto exclude empty strings from the result (#4779).funcednow has a-sand--saveoption to automatically save the edited function after successfully editing (#4668).execnow triggers the same safety features asexitand prompts for confirmation if background jobs are running.- The machine hostname, where available, is now exposed as
$hostnamewhich is now a reserved variable. This drops the dependency on thehostnameexecutable (#4422). - The
jobsbuiltin now has a-qand--quietoption to silence the output. functions --handlerscan be used to show event handlers (#4694).aliasnow has a-sand--saveoption to save the function generated by the alias usingfuncsave(#4878).- The
stringbuiltin has new commandssplit0andjoin0for working with NUL-delimited output. - The
-doption tofunctionsto set the description of an existing function now works; before 3.0 it was documented but unimplemented. Note that the long form--descriptioncontinues to work. (#5105) testand[now support floating point values in numeric comparisons.
abbrhas been reimplemented to be faster. This means the oldfish_user_abbreviationsvariable is ignored (#4048).- Setting variables is much faster (#4200, #4341).
- Globs are faster (#4579).
stringreads from stdin faster (#4610).- Slicing $history (in particular,
$history[1]for the last executed command) is much faster.
cdtab completions no longer descend into the deepest unambiguous path (#4649).sudocompletions 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-searchtoggles 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 -worfunction -w) can now inject arguments. For example,complete gco -w 'git checkout'now works properly (#1976). Thealiasfunction 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)bowerconfigure(autoconf only)doashjsonj(autojump #4344)jhipster(#4472)kldloadkldunloadmesonngrok(#4642)optipngportserve(#5026)ttxunzipxsv
- Lots of improvements to completions (especially
gitandhg). - Completions for
yarnandnpmnow require theall-the-package-namesNPM package for full functionality. - Completions for
bowerandyarnnow require thejqutility for full functionality. - Improved French translations.