3.4.0
版本发布时间: 2022-03-12 23:21:51
fish-shell/fish-shell最新发布版本:3.7.1(2024-03-19 13:29:28)
Notable improvements and fixes
- fish’s command substitution syntax has been extended:
$(cmd)
now has the same meaning as(cmd)
but it can be used inside double quotes, to prevent line splitting of the results (#159):
foo (bar | string collect)
# can now be written as
foo "$(bar)"
# and
foo (bar)
# can now be written as
foo $(bar)
# this will still split on newlines only.
- Complementing the
prompt
command in 3.3.0,fish_config
gained atheme
subcommand to show and pick from the sample themes (meaning color schemes) directly in the terminal, instead of having to open a Web browser. For examplefish_config theme choose Nord
loads the Nord theme in the current session (#8132). The current theme can be saved withfish_config theme dump
, and custom themes can be added by saving them in~/.config/fish/themes/
. -
set
andread
learned a new option,--function
, to set a variable in the function’s top scope. This should be a more familiar way of scoping variables and avoids issues with--local
, which is actually block-scoped (#565, #8145):
function demonstration
if true
set --function foo bar
set --local baz banana
end
echo $foo # prints "bar" because $foo is still valid
echo $baz # prints nothing because $baz went out of scope
end
-
string pad
now excludes escape sequences like colors that fish knows about, and a new--visible
flag tostring length
makes it use that kind of visible width. This is useful to get the number of terminal cells an already colored string would occupy, like in a prompt. (#8182, #7784, #4012):
> string length --visible (set_color red)foo
3
- Performance improvements to globbing, especially on systems using glibc. In some cases (large directories with files with many numbers in the names) this almost halves the time taken to expand the glob.
- Autosuggestions can now be turned off by setting
$fish_autosuggestion_enabled
to 0, and (almost) all highlighting can be turned off by choosing the new “None” theme. The exception is necessary colors, like those which distinguish autosuggestions from the actual command line. (#8376) - The
fish_git_prompt
function, which is included in the default prompts, now overridesgit
to avoid running commands set by per-repository configuration. This avoids a potential security issue in some circumstances, and has been assigned CVE-2022-20001 (#8589).
Deprecations and removed features
- A new feature flag,
ampersand-nobg-in-token
makes&
only act as background operator if followed by a separator. In combination withqmark-noglob
, this allows entering most URLs at the command line without quoting or escaping (#7991). For example:
> echo foo&bar # will print "foo&bar", instead of running "echo foo" in the background and executing "bar"
> echo foo & bar # will still run "echo foo" in the background and then run "bar"
# with both ampersand-nobg-in-token and qmark-noglob, this argument has no special characters anymore
> open https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtu.be
As a reminder, feature flags can be set on startup with fish --features ampersand-nobg-in-token,qmark-noglob
or with a universal variable called fish_features
:
> set -Ua fish_features ampersand-nobg-in-token
-
$status
is now forbidden as a command, to prevent a surprisingly common error among new users: Runningif $status
(#8171). This applies only to$status
, other variables are still allowed. -
set --query
now returns an exit status of 255 if given no variable names. This meansif set -q $foo
will not enter the if-block if$foo
is empty or unset. To restore the previous behavior, useif not set -q foo; or set -q $foo
- but this is unlikely to be desireable (#8214). -
_
is now a reserved keyword (#8342). - The special input functions
delete-or-exit
,nextd-or-forward-word
andprevd-or-backward-word
replace fish functions of the same names (#8538). - Mac OS X 10.9 is no longer supported. The minimum Mac version is now 10.10 “Yosemite.”
Scripting improvements
-
string collect
supports a new--allow-empty
option, which will output one empty argument in a command substitution that has no output (#8054). This allows commands liketest -n (echo -n | string collect --allow-empty)
to work more reliably. Note this can also be written astest -n "$(echo -n)"
(see above). -
string match
gained a--groups-only
option, which makes it only output capturing groups, excluding the full match. This allowsstring match
to do simple transformations (#6056):
> string match -r --groups-only '(.*)fish' 'catfish' 'twofish' 'blue fish' | string escape
cat
two
'blue '
-
$fish_user_paths
is now automatically deduplicated to fix a common user error of appending to it in config.fish when it is universal (#8117). fish_add_path remains the recommended way to add to $PATH. -
return
can now be used outside functions. In scripts, it does the same thing asexit
. In interactive mode,it sets$status
without exiting (#8148). - An oversight prevented all syntax checks from running on commands given to
fish -c
(#8171). This includes checks such asexec
not being allowed in a pipeline, and$$
not being a valid variable. Generally, another error was generated anyway. -
fish_indent
now correctly reformats tokens that end with a backslash followed by a newline (#8197). -
commandline
gained an--is-valid
option to check if the command line is syntactically valid and complete. This allows basic implementation of transient prompts (#8142). -
commandline
gained a--paging-full-mode
option to check if the pager is showing all the possible lines (no “7 more rows” message) (#8485). - List expansion correctly reports an error when used with all zero indexes (#8213).
- Running
fish
with a directory instead of a script as argument (egfish .
) no longer leads to an infinite loop. Instead it errors out immediately (#8258) - Some error messages occuring after fork, like “text file busy” have been replaced by bespoke error messages for fish (like “File is currently open for writing”). This also restores error messages with current glibc versions that removed sys_errlist (#8234, #4183).
- The
realpath
builtin now also squashes leading slashes with the--no-symlinks
option (#8281). - When trying to
cd
to a dangling (broken) symbolic link, fish will print an error noting that the target is a broken link (#8264). - On MacOS terminals that are not granted permissions to access a folder,
cd
would print a spurious “rotten symlink” error, which has been corrected to “permission denied” (#8264). - Since fish 3.0,
for
loops would trigger a variable handler function before the loop was entered. As the variable had not actually changed or been set, this was a spurious event and has been removed (#8384). -
math
now correctly prints negative values and values larger than2\*\*31
when in hex or octal bases (#8417). -
dirs
always produces an exit status of 0, instead of sometimes returning 1 (#8211). -
cd ""
no longer crashes fish (#8147). -
set --query
can now query whether a variable is a path variable via--path
or--unpath
(#8494). - Tilde characters (
~
) produced by custom completions are no longer escaped when applied to the command line, making it easier to use the output of a recursivecomplete -C
in completion scripts (#4570). -
set --show
reports when a variable is read-only (#8179). - Erasing
$fish_emoji_width
will reset fish to the default guessed emoji width (#8274). - The
la
function no longer lists entries for “.” and “..”, matching other systems defaults (#8519). -
abbr -q
returns the correct exit status when given multiple abbreviation names as arguments (#8431). -
command -v
returns an exit status of 127 instead of 1 if no command was found (#8547). -
argparse
with--ignore-unknown
no longer breaks with multiple unknown options in a short option group (#8637). - Comments inside command substitutions or brackets now correctly ignore parentheses, quotes, and brackets (#7866, #8022, #8695).
-
complete -C
supports a new--escape
option, which turns on escaping in returned completion strings (#3469). - Invalid byte or unicode escapes like
\\Utest
or\\xNotHex
are now a tokenizer error instead of causing the token to be truncated (#8545).
Interactive improvements
- Vi mode cursors are now set properly after
Control-C
(#8125). -
funced
will try to edit the whole file containing a function definition, if there is one (#391). - Running a command line consisting of just spaces now deletes an ephemeral (starting with space) history item again (#8232).
- Command substitutions no longer respect job control, instead running inside fish’s own process group (#8172). This more closely matches other shells, and improves
Control-C
reliability inside a command substitution. -
history
and__fish_print_help
now properly supportless
before version 530, including the version that ships with macOS. (#8157). -
help
now knows which section is in which document again (#8245). - fish’s highlighter will now color options (starting with
-
or--
) with the color given in the new $fish_color_option, up to the first--
. It falls back on $fish_color_param, so nothing changes for existing setups (#8292). - When executing a command, abbreviations are no longer expanded when the cursor is separated from the command by spaces, making it easier to suppress abbreviation expansion of commands without arguments. (#8423).
-
fish_key_reader
’s output was simplified. By default, it now only prints a bind statement. The previous per-character timing information can be seen with a new--verbose
switch (#8467). - Custom completions are now also loaded for commands that contain tildes or variables like
~/bin/fish
or$PWD/fish
(#8442). - Command lines spanning multiple lines will not be overwritten by the completion pager when it fills the entire terminal (#8509, #8405).
- When redrawing a multiline prompt, the old prompt is now properly cleared (#8163).
- Interactive completion would occasionally ignore the last word on the command line due to a race condition. This has been fixed (#8175).
- Propagation of universal variables from a fish process that is closing is faster (#8209).
- The command line is drawn in the correct place if the prompt ends with a newline (#8298).
-
history
learned a new subcommandclear-session
to erase all history from the current session (#5791). - Pressing
Control-C
infish_key_reader
will no longer print the incorrect “Press [ctrl-C] again to exit” message (#8510). - The default command-not-found handler for Fedora/PackageKit now passes the whole command line, allowing for functionality such as running the suggested command directly (#8579).
- When looking for locale information, the Debian configuration is now used when available (#8557).
- Pasting text containing quotes from the clipboard trims spaces more appropriately (#8550).
- The clipboard bindings ignore X-based clipboard programs if the
DISPLAY
environment variable is not set, which helps prefer the Windows clipboard when it is available (such as on WSL). -
funcsave
will remove a saved copy of a function that has been erased withfunctions --erase
. - The Web-based configuration tool gained a number of improvements, including the ability to set pager colors.
- The default
fish_title
prints a shorter title with shortened $PWD and no more redundant “fish” (#8641). - Holding down an arrow key won’t freeze the terminal with long periods of flashing (#8610).
- Multi-char bindings are no longer interrupted if a signal handler enqueues an event. (#8628).
New or improved bindings
-
Escape
can now bound without breaking arrow key bindings (#8428). - The
Alt-H
binding (to open a command’s manual page) now also ignorescommand
(#8447).
Improved prompts
- The
fish_status_to_signal
helper function returns the correct signal names for the current platform, rather than Linux (#8530). - The
prompt_pwd
helper function learned a--full-length-dirs N
option to keep the last N directory components unshortened. In addition the number of characters to shorten each component should be shortened to can now be given as-d N
or--dir-length N
. (#8208):
> prompt_pwd --full-length-dirs 2 -d 1 ~/dev/fish-shell/share/tools/web_config
~/d/f/s/tools/web_config
Completions
- Added completions for:
- Apple’s
shortcuts
-
argparse
(#8434) -
asd
(#8759) -
az
(#8141) -
black
(#8123) -
clasp
(#8373) -
cpupower
(#8302) -
dart
(#8315) -
dscacheutil
-
elvish
(#8416) -
ethtool
(#8283) -
exif
(#8246) -
findstr
(#8481) -
git-sizer
(#8156) -
gnome-extensions
(#8732) -
gping
(#8181) -
isatty
(#8609) -
istioctl
(#8343) -
kmutil
-
kubectl
(#8734) -
matlab
(#8505) -
mono
(#8415) and related toolscsharp
,gacutil
,gendarme
,ikdasm
,ilasm
,mkbundle
,monodis
,monop
,sqlsharp
andxsp
(#8452) - Angular’s
ng
(#8111) -
nodeenv
(#8533) -
octave
(#8505) -
pabcnet_clear
(#8421) -
qmk
(#8180) -
rakudo
(#8113) -
rc-status
(#8757) -
roswell
(#8330) -
sbcl
(#8330) -
starship
(#8520) -
topgrade
(#8651) -
wine
,wineboot
andwinemaker
(#8411) - Windows Subsystem for Linux (WSL)’s
wslpath
(#8364) - Windows’
color
(#8483),attrib
,attributes
,choice
,clean
,cleanmgr
,cmd
,cmdkey
,comp
,forfiles
,powershell
,reg
,schtasks
,setx
(#8486) -
zef
(#8114)
- Apple’s
- Improvements to many completions, especially for
git
aliases (#8129), subcommands (#8134) and submodules (#8716). - Many adjustments to complete correct options for system utilities on BSD and macOS.
- When evaluating custom completions, the command line state no longer includes variable overrides (
var=val
). This unbreaks completions that readcommandline -op
.
Improved terminal support
- Dynamic terminal titles are enabled on WezTerm (#8121).
- Directory history navigation works out of the box with Apple Terminal’s default key settings (#2330).
- fish now assumes Unicode 9+ widths for emoji under iTerm 2 (#8200).
- Skin-tone emoji modifiers (U+1F3FB through U+1F3FF) are now measured as width 0 (#8275).
- fish’s escape sequence removal now also knows Tmux’s wrapped escapes.
- Vi mode cursors are enabled in Apple Terminal.app (#8167).
- Vi cursor shaping and $PWD reporting is now also enabled on foot (#8422).
-
ls
will use colors also on newer versions of Apple Terminal.app (#8309). - The
Delete
andShift-Tab
keys work more reliably underst
(#8352, #8354).
Other improvements
- Fish’s test suite now uses
ctest
, and has become much faster to run. It is now also possible to run only specific tests with targets namedtest_$filename
-make test_set.fish
only runs the set.fish test. (#7851) - The HTML version of the documentation now includes copy buttons for code examples (#8218).
- The HTML version of the documentation and the web-based configuration tool now pick more modern system fonts instead of falling back to Arial and something like Courier New most of the time (#8632).
- The Debian & Ubuntu package linked from fishshell.com is now a single package, rather than split into
fish
andfish-common
(#7845). - The macOS installer does not assert that Rosetta is required to install fish on machines with Apple Silicon (#8566).
- The macOS installer now cleans up previous .pkg installations when upgrading. (#2963).
For distributors
- The minimum version of CMake required to build fish is now 3.5.0.
- The CMake installation supports absolute paths for
CMAKE_INSTALL_DATADIR
(#8150). - Building using NetBSD curses works on any platform (#8087).
- The build system now uses the default linker instead of forcing use of the gold or lld linker (#8152).
Download links: To download the source code for fish, use the file named "fish-3.4.0.tar.xz". The file downloaded from "Source code (tar.gz)" has extra build requirements. The SHA-256 sum of this file is b5b48ab8486b19ef716a32f7f46b88b9ea5356155f0e967ee99f4093645413c5
. A GPG signature from David Adam (key ID 0x7A67D962D88A709A
) is available as "fish-3.4.0.tar.xz.asc".
1、 fish-3.4.0.app.zip 8.48MB
2、 fish-3.4.0.pkg 7.42MB
3、 fish-3.4.0.tar.xz 3.14MB
4、 fish-3.4.0.tar.xz.asc 833B