'\" t
.\" Man page generated from reStructuredText
.\" by the Docutils 0.22.4 manpage writer.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "FISH-DOC" "1" "Mar 28, 2026" "4.6" "fish-shell"
.sp
This is the documentation for \fBfish\fP, the \fBf\fPriendly \fBi\fPnteractive \fBsh\fPell.
.sp
A shell is a program that helps you operate your computer by starting other programs. fish offers a command\-line interface focused on usability and interactive use.
.sp
Some of the special features of fish are:
.INDENT 0.0
.IP \(bu 2
\fBExtensive UI\fP: Syntax highlighting \%<#\:syntax-highlighting>, Autosuggestions \%<#\:autosuggestions>, tab completion \%<#\:tab-completion> and selection lists that can be navigated and filtered.
.IP \(bu 2
\fBNo configuration needed\fP: fish is designed to be ready to use immediately, without requiring extensive configuration.
.IP \(bu 2
\fBEasy scripting\fP: New functions \%<#\:syntax-function> can be added on the fly. The syntax is easy to learn and use.
.UNINDENT
.sp
This page explains how to install and set up fish and where to get more information.
.SH WHERE TO GO?
.sp
If this is your first time using fish, see the tutorial \%<>\&.
.sp
If you are already familiar with other shells like bash and want to see the scripting differences, see Fish For Bash Users \%<>\&.
.sp
For an overview of fish\(aqs scripting language, see The Fish Language \%<>\&. If it would be useful in a script file, it\(aqs here.
.sp
For information on using fish interactively, see Interactive use \%<>\&. If it\(aqs about key presses, syntax highlighting or anything else that needs an interactive terminal session, look here.
.sp
If you need to install fish first, read on, the rest of this document will tell you how to get, install and configure fish.
.SH SETUP
.sp
This section describes how to install, uninstall, start, and exit \fBfish\fP\&. It also explains how to make fish the default shell.
.SS Installation
.sp
Up\-to\-date instructions for installing the latest version of fish are on the fish homepage \%<https://\:fishshell\:.com/>\&.
.sp
To install the development version of fish, see the instructions on the project\(aqs GitHub page \%<https://\:github\:.com/\:fish-shell/\:fish-shell>\&.
.SS Starting and Exiting
.sp
Once fish has been installed, open a terminal. If fish is not the default shell:
.INDENT 0.0
.IP \(bu 2
Type \fBfish\fP to start a shell:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> fish
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
Type \fBexit\fP to end the session:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> exit
.EE
.UNINDENT
.UNINDENT
.UNINDENT
.SS Default Shell
.sp
There are multiple ways to switch to fish (or any other shell) as your default.
.sp
The simplest method is to set your terminal emulator (e.g. GNOME Terminal, Apple\(aqs Terminal.app, or Konsole) to start fish directly. See its configuration and set the program to start to \fB/usr/local/bin/fish\fP (the exact path depends on how you installed fish).
.sp
Alternatively, you can set fish as your login shell so that it will be started by all terminal logins, including SSH.
.sp
\fBWarning:\fP
.INDENT 0.0
.INDENT 3.5
Setting fish as your login shell may cause issues, such as an incorrect \fBPATH\fP \%<#\:envvar-PATH>\&. Some operating systems, including a number of Linux distributions, require the login shell to be Bourne\-compatible and to read configuration from \fB/etc/profile\fP\&. fish may not be suitable as a login shell on these systems.
.UNINDENT
.UNINDENT
.sp
To change your login shell to fish:
.INDENT 0.0
.IP 1. 3
Add the shell to \fB/etc/shells\fP with:
.INDENT 3.0
.INDENT 3.5
.sp
.EX
> command \-v fish | sudo tee \-a /etc/shells
.EE
.UNINDENT
.UNINDENT
.IP 2. 3
Change your default shell with:
.INDENT 3.0
.INDENT 3.5
.sp
.EX
> chsh \-s \(dq$(command \-v fish)\(dq
.EE
.UNINDENT
.UNINDENT
.UNINDENT
.sp
To change it back to another shell, substitute \fBfish\fP with \fBbash\fP, \fBtcsh\fP or \fBzsh\fP as appropriate in the above command.
.SS Uninstalling
.sp
For uninstalling fish: see FAQ: Uninstalling fish \%<#\:faq-uninstalling>\&.
.SS Shebang Line
.sp
Because shell scripts are written in many different languages, they need to carry information about which interpreter should be used to execute them. For this, they are expected to have a first line, the shebang line, which names the interpreter executable.
.sp
A script written in \fBbash\fP would need a first line like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
#!/bin/bash
.EE
.UNINDENT
.UNINDENT
.sp
When the shell tells the kernel to execute the file, it will use the interpreter \fB/bin/bash\fP\&.
.sp
For a script written in another language, just replace \fB/bin/bash\fP with the interpreter for that language. For example: \fB/usr/bin/python\fP for a python script, or \fB/usr/local/bin/fish\fP for a fish script, if that is where you have them installed.
.sp
If you want to share your script with others, you might want to use \fBenv\fP to allow for the interpreter to be installed in other locations. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
#!/usr/bin/env fish
echo Hello from fish $version
.EE
.UNINDENT
.UNINDENT
.sp
This will call \fBenv\fP, which then goes through \fBPATH\fP \%<#\:envvar-PATH> to find a program called \(dqfish\(dq. This makes it work, whether fish is installed in (for example) \fB/usr/local/bin/fish\fP, \fB/usr/bin/fish\fP, or \fB~/.local/bin/fish\fP, as long as that directory is in \fBPATH\fP \%<#\:envvar-PATH>\&.
.sp
The shebang line is only used when scripts are executed without specifying the interpreter. For functions inside fish or when executing a script with \fBfish /path/to/script\fP, a shebang is not required (but it doesn\(aqt hurt!).
.sp
When executing files without an interpreter, fish, like other shells, tries your system shell, typically \fB/bin/sh\fP\&. This is needed because some scripts are shipped without a shebang line.
.SH CONFIGURATION
.sp
To store configuration write it to a file called \fB~/.config/fish/config.fish\fP\&.
.sp
\fB\&.fish\fP scripts in \fB~/.config/fish/conf.d/\fP are also automatically executed before \fBconfig.fish\fP\&.
.sp
These files are read on the startup of every shell, whether interactive and/or if they\(aqre login shells. Use \fBstatus \-\-is\-interactive\fP and \fBstatus \-\-is\-login\fP to do things only in interactive/login shells, respectively.
.sp
This is the short version; for a full explanation, like for sysadmins or integration for developers of other software, see Configuration files \%<#\:configuration>\&.
.sp
If you want to see what you changed over fish\(aqs defaults, see fish_delta \%<>\&.
.SS Examples:
.sp
To add \fB~/linux/bin\fP to PATH variable when using a login shell, add this to \fB~/.config/fish/config.fish\fP file:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if status \-\-is\-login
    set \-gx PATH $PATH ~/linux/bin
end
.EE
.UNINDENT
.UNINDENT
.sp
This is just an example; using fish_add_path \%<> e.g. \fBfish_add_path ~/linux/bin\fP which only adds the path if it isn\(aqt included yet is easier.
.sp
To run commands on exit, use an event handler \%<#\:event> that is triggered by the exit of the shell:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function on_exit \-\-on\-event fish_exit
    echo fish is now exiting
end
.EE
.UNINDENT
.UNINDENT
.SH RESOURCES
.INDENT 0.0
.IP \(bu 2
The GitHub page \%<https://\:github\:.com/\:fish-shell/\:fish-shell/>
.IP \(bu 2
The official Matrix room \%<https://\:matrix\:.to/#/#\:fish-shell:matrix\:.org>
.IP \(bu 2
The official mailing list at fish\-users@lists.sourceforge.net \%<https://\:lists\:.sourceforge\:.net/\:lists/\:listinfo/\:fish-users>
.UNINDENT
.sp
If you have an improvement for fish, you can submit it via the GitHub page.
.SH OTHER HELP PAGES
.SS Frequently asked questions
.SS What is the equivalent to this thing from bash (or other shells)?
.sp
See Fish for bash users \%<>
.SS How do I set or clear an environment variable?
.sp
Use the set \%<> command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-x key value # typically set \-gx key value
set \-e key
.EE
.UNINDENT
.UNINDENT
.sp
Since fish 3.1 you can set an environment variable for one command using the \fBkey=value some command\fP syntax, like in other shells.  The two lines below behave identically \- unlike other shells, fish will output \fBvalue\fP both times:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
key=value echo $key
begin; set \-lx key value; echo $key; end
.EE
.UNINDENT
.UNINDENT
.sp
Note that \(dqexported\(dq is not a scope \%<#\:variables-scope>, but an additional bit of state. A variable can be global and exported or local and exported or even universal and exported. Typically it makes sense to make an exported variable global.
.SS How do I check whether a variable is defined?
.sp
Use \fBset \-q var\fP\&.  For example, \fBif set \-q var; echo variable defined; end\fP\&.  To check multiple variables you can combine with \fBand\fP and \fBor\fP like so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if set \-q var1; or set \-q var2
    echo either variable defined
end
.EE
.UNINDENT
.UNINDENT
.sp
Keep in mind that a defined variable could also be empty, either by having no elements (if set like \fBset var\fP) or only empty elements (if set like \fBset var \(dq\(dq\fP). Read on for how to deal with those.
.SS How do I check whether a variable is not empty?
.sp
Use \fBstring length \-q \-\- $var\fP\&.  For example, \fBif string length \-q \-\- $var; echo not empty; end\fP\&.  Note that \fBstring length\fP will interpret a list of multiple variables as a disjunction (meaning any/or):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if string length \-q \-\- $var1 $var2 $var3
    echo at least one of these variables is not empty
end
.EE
.UNINDENT
.UNINDENT
.sp
Alternatively, use \fBtest \-n \(dq$var\(dq\fP, but remember that \fBthe variable must be double\-quoted\fP\&.  For example, \fBif test \-n \(dq$var\(dq; echo not empty; end\fP\&. The \fBtest\fP command provides its own and (\-a) and or (\-o):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-n \(dq$var1\(dq \-o \-n \(dq$var2\(dq \-o \-n \(dq$var3\(dq
    echo at least one of these variables is not empty
end
.EE
.UNINDENT
.UNINDENT
.sp
If you want to know if a variable has \fIno elements\fP, use \fBset \-q var[1]\fP\&.
.SS Why doesn\(aqt \fBset \-Ux\fP (exported universal variables) seem to work?
.sp
A global variable of the same name already exists.
.sp
Environment variables such as \fBEDITOR\fP or \fBTZ\fP can be set universally using \fBset \-Ux\fP\&.  However, if
there is an environment variable already set before fish starts (such as by login scripts or system
administrators), it is imported into fish as a global variable. The variable scopes \%<#\:variables-scope> are searched from the \(dqinside out\(dq, which
means that local variables are checked first, followed by global variables, and finally universal
variables.
.sp
This means that the global value takes precedence over the universal value.
.sp
To avoid this problem, consider changing the setting which fish inherits. If this is not possible,
add a statement to your configuration file \%<#\:configuration> (usually
\fB~/.config/fish/config.fish\fP):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-gx EDITOR vim
.EE
.UNINDENT
.UNINDENT
.SS How do I run a command every login? What\(aqs fish\(aqs equivalent to .bashrc or .profile?
.sp
Edit the file \fB~/.config/fish/config.fish\fP [1], creating it if it does not exist (Note the leading period).
.sp
Unlike .bashrc and .profile, this file is always read, even in non\-interactive or login shells.
.sp
To do something only in interactive shells, check \fBstatus is\-interactive\fP like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if status is\-interactive
    # use the coolbeans theme
    fish_config theme choose coolbeans
end
.EE
.UNINDENT
.UNINDENT
.IP [1] 5
The \(dq~/.config\(dq part of this can be set via $XDG_CONFIG_HOME, that\(aqs just the default.
.SS How do I set my prompt?
.sp
The prompt is the output of the \fBfish_prompt\fP function. Put it in \fB~/.config/fish/functions/fish_prompt.fish\fP\&. For example, a simple prompt is:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    set_color $fish_color_cwd
    echo \-n (prompt_pwd)
    set_color \-\-reset
    echo \-n \(aq > \(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
You can also use the Web configuration tool, fish_config \%<>, to preview and choose from a gallery of sample prompts.
.sp
Or you can use fish_config from the commandline:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_config prompt show
# displays all the prompts fish ships with
> fish_config prompt choose disco
# loads the disco prompt in the current shell
> fish_config prompt save
# makes the change permanent
.EE
.UNINDENT
.UNINDENT
.sp
If you want to modify your existing prompt, you can use funced \%<> and funcsave \%<> like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ funced fish_prompt
# This opens up your editor (set in $EDITOR).
# Modify the function,
# save the file and repeat to your liking.
# Once you are happy with it:
>_ funcsave fish_prompt
.EE
.UNINDENT
.UNINDENT
.sp
This also applies to fish_right_prompt \%<> and fish_mode_prompt \%<>\&.
.SS Why does my prompt show a \fB[I]\fP?
.sp
That\(aqs the fish_mode_prompt \%<>\&. It is displayed by default when you\(aqve activated vi mode using \fBfish_vi_key_bindings\fP\&.
.sp
If you haven\(aqt activated vi mode on purpose, you might have installed a third\-party theme or plugin that does it.
.sp
If you want to change or disable this display, modify the \fBfish_mode_prompt\fP function, for instance via funced \%<>\&.
.SS How do I customize my syntax highlighting colors?
.sp
Use the web configuration tool started by fish_config \%<>,
or alter the fish_color family of environment variables \%<#\:variables-color>,
or use the fish_config theme \%<> subcommand, like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_config theme show
# to demonstrate all the colorschemes
> fish_config theme choose coolbeans
# to load the \(dqcoolbeans\(dq theme
.EE
.UNINDENT
.UNINDENT
.SS How do I change the greeting message?
.sp
Change the value of the variable \fBfish_greeting\fP or create a fish_greeting \%<> function. For example, to remove the greeting use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-U fish_greeting
.EE
.UNINDENT
.UNINDENT
.sp
Or if you prefer not to use a universal variable, use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_greeting
.EE
.UNINDENT
.UNINDENT
.sp
in config.fish \%<#\:configuration>\&.
.SS How do I run a command from history?
.sp
Type some part of the command, and then hit the \fBup\fP (\fB↑\fP) or \fBdown\fP (\fB↓\fP) arrow keys to navigate through history matches, or press \fBctrl\fP\-\fBr\fP to open the history in a searchable pager. In this pager you can press \fBctrl\fP\-\fBr\fP or \fBctrl\fP\-\fBs\fP to move to older or younger history respectively.
.sp
Additional default key bindings include \fBctrl\fP\-\fBp\fP (up) and \fBctrl\fP\-\fBn\fP (down). See Searchable command history \%<#\:history-search> for more information.
.SS Why doesn\(aqt history substitution (\(dq!$\(dq etc.) work?
.sp
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Instead of adding this pseudo\-syntax, fish opts for nice history searching and recall features.  Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit.
.sp
As a special case, most of the time history substitution is used as \fBsudo !!\fP\&. In that case press \fBalt\fP\-\fBs\fP, and it will recall your last commandline with \fBsudo\fP prefixed (or toggle a \fBsudo\fP prefix on the current commandline if there is anything).
.sp
In general, fish\(aqs history recall works like this:
.INDENT 0.0
.IP \(bu 2
Like other shells, the Up arrow, \fBup\fP recalls whole lines, starting from the last executed line. So instead of typing \fB!!\fP, you would hit the up\-arrow.
.IP \(bu 2
If the line you want is far back in the history, type any part of the line and then press Up one or more times.  This will filter the recalled lines to ones that include this text, and you will get to the line you want much faster.  This replaces \(dq!vi\(dq, \(dq!?bar.c\(dq and the like. If you want to see more context, you can press \fBctrl\-r\fP to open the history in the pager.
.IP \(bu 2
\fBalt\-up\fP recalls individual arguments, starting from the last argument in the last executed line. This can be used instead of \(dq!$\(dq.
.UNINDENT
.sp
See documentation \%<#\:editor> for more details about line editing in fish.
.sp
That being said, you can use Abbreviations \%<#\:abbreviations> to implement history substitution. Here\(aqs \fB!!\fP only:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function last_history_item; echo $history[1]; end
abbr \-a !! \-\-position anywhere \-\-function last_history_item
.EE
.UNINDENT
.UNINDENT
.sp
Run this and \fB!!\fP will be replaced with the last history entry, anywhere on the commandline. Put it into config.fish \%<#\:configuration> to keep it.
.SS How do I run a subcommand? The backtick doesn\(aqt work!
.sp
\fBfish\fP uses parentheses for subcommands. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (ls)
    echo $i
end
.EE
.UNINDENT
.UNINDENT
.sp
It also supports the familiar \fB$()\fP syntax, even in quotes. Backticks are not supported because they are discouraged even in POSIX shells. They nest poorly and are hard to tell from single quotes (\fB\(aq\(aq\fP).
.SS My command (pkg\-config) gives its output as a single long string?
.sp
Unlike other shells, fish splits command substitutions only on newlines, not spaces or tabs or the characters in $IFS.
.sp
That means if you run
.INDENT 0.0
.INDENT 3.5
.sp
.EX
count (printf \(aq%s \(aq a b c)
.EE
.UNINDENT
.UNINDENT
.sp
It will print \fB1\fP, because the \(dqa b c \(dq is used in one piece. But if you do
.INDENT 0.0
.INDENT 3.5
.sp
.EX
count (printf \(aq%s\en\(aq a b c)
.EE
.UNINDENT
.UNINDENT
.sp
it will print \fB3\fP, because it gave \fBcount\fP the arguments \(dqa\(dq, \(dqb\(dq and \(dqc\(dq separately.
.sp
In the overwhelming majority of cases, splitting on spaces is unwanted, so this is an improvement. This is why you hear about problems with filenames with spaces, after all.
.sp
However sometimes, especially with \fBpkg\-config\fP and related tools, splitting on spaces is needed.
.sp
In these cases use \fBstring split \-n \(dq \(dq\fP like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
g++ example_01.cpp (pkg\-config \-\-cflags \-\-libs gtk+\-2.0 | string split \-n \(dq \(dq)
.EE
.UNINDENT
.UNINDENT
.sp
The \fB\-n\fP is so empty elements are removed like POSIX shells would do.
.SS How do I get the exit status of a command?
.sp
Use the \fB$status\fP variable. This replaces the \fB$?\fP variable used in other shells.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
somecommand
if test $status \-eq 7
    echo \(dqThat\(aqs my lucky number!\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
If you are only interested in success or failure, you can run the command directly as the if\-condition:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if somecommand
    echo \(dqCommand succeeded\(dq
else
    echo \(dqCommand failed\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
Or if you just want to do one command in case the first succeeded or failed, use \fBand\fP or \fBor\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
somecommand
or someothercommand
.EE
.UNINDENT
.UNINDENT
.sp
See the Conditions \%<#\:syntax-conditional> and the documentation for test \%<> and if \%<> for more information.
.SS My command prints \(dqNo matches for wildcard\(dq but works in bash
.sp
In short: quote \%<#\:quotes> or escape \%<#\:escapes> the wildcard:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
scp user@ip:/dir/\(dqstring\-*\(dq
.EE
.UNINDENT
.UNINDENT
.sp
When fish sees an unquoted \fB*\fP, it performs wildcard expansion \%<#\:expand-wildcard>\&. That means it tries to match filenames to the given string.
.sp
If the wildcard doesn\(aqt match any files, fish prints an error instead of running the command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo *this*does*not*exist
fish: No matches for wildcard \(aq*this*does*not*exist\(aq. See \(gahelp expand\(ga.
echo *this*does*not*exist
     ^
.EE
.UNINDENT
.UNINDENT
.sp
Now, bash also tries to match files in this case, but when it doesn\(aqt find a match, it passes along the literal wildcard string instead.
.sp
That means that commands like the above
.INDENT 0.0
.INDENT 3.5
.sp
.EX
scp user@ip:/dir/string\-*
.EE
.UNINDENT
.UNINDENT
.sp
or
.INDENT 0.0
.INDENT 3.5
.sp
.EX
apt install postgres\-*
.EE
.UNINDENT
.UNINDENT
.sp
appear to work, because most of the time the string doesn\(aqt match and so it passes along the \fBstring\-*\fP, which is then interpreted by the receiving program.
.sp
But it also means that these commands can stop working at any moment once a matching file is encountered (because it has been created or the command is executed in a different working directory), and to deal with that bash needs workarounds like
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for f in ./*.mpg; do
      # We need to test if the file really exists because
      # the wildcard might have failed to match.
      test \-f \(dq$f\(dq || continue
      mympgviewer \(dq$f\(dq
done
.EE
.UNINDENT
.UNINDENT
.sp
(from \%<http://\:mywiki\:.wooledge\:.org/\:BashFAQ/\:004>)
.sp
For these reasons, fish does not do this, and instead expects asterisks to be quoted or escaped if they aren\(aqt supposed to be expanded.
.sp
This is similar to bash\(aqs \(dqfailglob\(dq option.
.SS Why won\(aqt SSH/SCP/rsync connect properly when fish is my login shell?
.sp
This problem may show up as messages like \(dq\fBReceived message too long\fP\(dq, \(dq\fBopen terminal
failed: not a terminal\fP\(dq, \(dq\fBBad packet length\fP\(dq, or \(dq\fBConnection refused\fP\(dq with strange output
in \fBssh_exchange_identification\fP messages in the debug log.
.sp
This usually happens because fish reads the user configuration file \%<#\:configuration> (\fB~/.config/fish/config.fish\fP) \fIalways\fP,
whether it\(aqs in an interactive or login or non\-interactive or non\-login shell.
.sp
This simplifies matters, but it also means when config.fish generates output, it will do that even in non\-interactive shells like the one ssh/scp/rsync start when they connect.
.sp
Anything in config.fish that produces output should be guarded with \fBstatus is\-interactive\fP (or \fBstatus is\-login\fP if you prefer):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if status is\-interactive
  ...
end
.EE
.UNINDENT
.UNINDENT
.sp
The same applies for example when you start \fBtmux\fP in config.fish without guards, which will cause a message like \fBsessions should be nested with care, unset $TMUX to force\fP\&.
.SS I\(aqm getting weird graphical glitches (a staircase effect, ghost characters, cursor in the wrong position,...)?
.sp
In a terminal, the application running inside it and the terminal itself need to agree on the width of characters in order to handle cursor movement.
.sp
This is more important to fish than other shells because features like syntax highlighting and autosuggestions are implemented by moving the cursor.
.sp
Sometimes, there is disagreement on the width. There are numerous causes and fixes for this:
.INDENT 0.0
.IP \(bu 2
It is possible the character is too new for your system to know \- in this case you need to refrain from using it.
.IP \(bu 2
Fish or your terminal might not know about the character or handle it wrong \- in this case fish or your terminal needs to be fixed, or you need to update to a fixed version.
.IP \(bu 2
The character has an \(dqambiguous\(dq width and fish thinks that means a width of X while your terminal thinks it\(aqs Y. In this case you either need to change your terminal\(aqs configuration or set $fish_ambiguous_width to the correct value.
.IP \(bu 2
The character is an emoji and your system only supports Unicode 8. In this case set $fish_emoji_width to 1.
.UNINDENT
.sp
This also means that a few things are unsupportable:
.INDENT 0.0
.IP \(bu 2
Non\-monospace fonts \- there is \fIno way\fP for fish to figure out what width a specific character has as it has no influence on the terminal\(aqs font rendering.
.IP \(bu 2
Different widths for multiple ambiguous width characters \- there is no way for fish to know which width you assign to each character.
.UNINDENT
.SS fish does not work in a specific terminal
.sp
The terminal might not meet all of fish\(aqs requirements \%<>\&.
Please report this to your terminal\(aqs and to fish\(aqs issue tracker.
.SS Uninstalling fish
.sp
If you want to uninstall fish, first make sure fish is not set as your shell. Run \fBchsh \-s /bin/bash\fP if you are not sure.
.sp
If you installed it with a package manager, use that package manager\(aqs uninstall function. If you built fish yourself, assuming you installed it to /usr/local, do this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
rm \-Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
rm /usr/local/share/man/man1/fish*.1
cd /usr/local/bin
rm \-f fish fish_indent
.EE
.UNINDENT
.UNINDENT
.SS Interactive use
.sp
Fish prides itself on being really nice to use interactively. That\(aqs down to a few features we\(aqll explain in the next few sections.
.sp
Fish is used by giving commands in the fish language, see The Fish Language \%<> for information on that.
.SS Help
.sp
Fish has an extensive help system. Use the help \%<> command to obtain help on a specific subject or command. For instance, writing \fBhelp syntax\fP displays the syntax section \%<#\:syntax> of this documentation.
.sp
Fish also has man pages for its commands, and translates the help pages to man pages. For example, \fBman set\fP will show the documentation for \fBset\fP as a man page.
.sp
Help on a specific builtin can also be obtained with the \fB\-h\fP parameter. For instance, to obtain help on the fg \%<> builtin, either type \fBfg \-h\fP or \fBhelp fg\fP\&.
.sp
The main page can be viewed via \fBhelp index\fP (or just \fBhelp\fP) or \fBman fish\-doc\fP\&. The tutorial can be viewed with \fBhelp tutorial\fP or \fBman fish\-tutorial\fP\&.
.SS Autosuggestions
.sp
fish suggests commands as you type, based on command history, completions, and valid file paths. As you type commands, you will see a suggestion offered after the cursor, in a muted gray color (which can be changed with the \fBfish_color_autosuggestion\fP variable).
.sp
To accept the autosuggestion (replacing the command line contents), press \fBright\fP (\fB→\fP) or \fBctrl\fP\-\fBf\fP\&. To accept the first suggested word, press \fBalt\fP\-\fBright\fP (\fB→\fP) or \fBalt\fP\-\fBf\fP\&. If the autosuggestion is not what you want, ignore it: it won\(aqt execute unless you accept it.
.sp
Autosuggestions are a powerful way to quickly summon frequently entered commands, by typing the first few characters. They are also an efficient technique for navigating through directory hierarchies.
.sp
If you don\(aqt like autosuggestions, you can disable them by setting \fB$fish_autosuggestion_enabled\fP to 0:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_autosuggestion_enabled 0
.EE
.UNINDENT
.UNINDENT
.SS Tab Completion
.sp
Tab completion is a time saving feature of any modern shell. When you type \fBtab\fP, fish tries to guess the rest of the word under the cursor. If it finds exactly one possibility, it inserts it. If it finds more, it inserts the longest unambiguous part and then opens a menu (the \(dqpager\(dq) that you can navigate to find what you\(aqre looking for.
.sp
The pager can be navigated with the arrow keys, \fBpageup\fP / \fBpagedown\fP, \fBtab\fP or \fBshift\fP\-\fBtab\fP\&. Pressing \fBctrl\fP\-\fBs\fP (the \fBpager\-toggle\-search\fP binding \- \fB/\fP in vi mode) opens up a search menu that you can use to filter the list.
.sp
Fish provides some general purpose completions, like for commands, variable names, usernames or files.
.sp
It also provides a large number of program specific scripted completions. Most of these completions are simple options like the \fB\-l\fP option for \fBls\fP, but a lot are more advanced. For example:
.INDENT 0.0
.IP \(bu 2
\fBman\fP and \fBwhatis\fP show the installed manual pages as completions.
.IP \(bu 2
\fBmake\fP uses targets in the Makefile in the current directory as completions.
.IP \(bu 2
\fBmount\fP uses mount points specified in fstab as completions.
.IP \(bu 2
\fBapt\fP, \fBrpm\fP and \fByum\fP show installed or installable packages
.UNINDENT
.sp
You can also write your own completions or install some you got from someone else. For that, see Writing your own completions \%<>\&.
.sp
Completion scripts are loaded on demand, like functions are \%<#\:syntax-function-autoloading>\&. The difference is the \fB$fish_complete_path\fP list \%<#\:variables-lists> is used instead of \fB$fish_function_path\fP\&. Typically you can drop new completions in ~/.config/fish/completions/name\-of\-command.fish and fish will find them automatically.
.SS Syntax highlighting
.sp
Fish interprets the command line as it is typed and uses syntax highlighting to provide feedback. The most important feedback is the detection of potential errors. By default, errors are marked red.
.sp
Detected errors include:
.INDENT 0.0
.IP \(bu 2
Non\-existing commands.
.IP \(bu 2
Reading from or appending to a non\-existing file.
.IP \(bu 2
Incorrect use of output redirects
.IP \(bu 2
Mismatched parenthesis
.UNINDENT
.sp
To customize the syntax highlighting, you can set the environment variables listed in the Variables for changing highlighting colors section.
.sp
Fish also provides pre\-made color themes you can pick with fish_config \%<>\&.
Running just \fBfish_config\fP opens a browser interface, or you can use \fBfish_config theme\fP from fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# disable nearly all coloring
fish_config theme choose none
# restore fish\(aqs default theme
fish_config theme choose default
.EE
.UNINDENT
.UNINDENT
.sp
Or, to see all themes, right in your terminal:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_config theme show
.EE
.UNINDENT
.UNINDENT
.sp
To update the theme of all shell sessions without restarting them,
first have those sessions define an event handler \%<#\:event> by adding the following to your config.fish \%<#\:configuration> and restarting them:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function apply\-my\-theme \-\-on\-variable=my_theme
    fish_config theme choose $my_theme
end
.EE
.UNINDENT
.UNINDENT
.sp
Then, set the corresponding universal variable \%<#\:variables-universal> from any session:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-U my_theme lava
> set \-U my_theme snow\-day
.EE
.UNINDENT
.UNINDENT
.SS Syntax highlighting variables
.sp
The colors used by fish for syntax highlighting can be configured by changing the values of various variables. The value of these variables can be one of the colors accepted by the set_color \%<> command.
Options accepted by \fBset_color\fP like
\fB\-\-foreground=\fP,
\fB\-\-background=\fP,
\fB\-\-bold\fP,
\fB\-\-dim\fP,
\fB\-\-italics\fP,
\fB\-\-reverse\fP,
\fB\-\-strikethrough\fP,
\fB\-\-underline\fP and
\fB\-\-underline\-color=\fP
are also accepted.
.sp
Example: to make errors highlighted and red, use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set fish_color_error red \-\-bold
.EE
.UNINDENT
.UNINDENT
.sp
The following variables are available to change the highlighting colors in fish:
.TS
box center;
l|l.
T{
Variable
T}	T{
Meaning
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_normal
.UNINDENT
T}	T{
default color
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_command
.UNINDENT
T}	T{
commands like echo
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_keyword
.UNINDENT
T}	T{
keywords like if \- this falls back on the command color if unset
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_quote
.UNINDENT
T}	T{
quoted text like \fB\(dqabc\(dq\fP
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_redirection
.UNINDENT
T}	T{
IO redirections like >/dev/null
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_end
.UNINDENT
T}	T{
process separators like \fB;\fP and \fB&\fP
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_error
.UNINDENT
T}	T{
syntax errors
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_param
.UNINDENT
T}	T{
ordinary command parameters
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_valid_path
.UNINDENT
T}	T{
parameters and redirection targets that are filenames (if the file exists)
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_option
.UNINDENT
T}	T{
options starting with \(dq\-\(dq, up to the first \(dq\-\-\(dq parameter
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_comment
.UNINDENT
T}	T{
comments like \(aq# important\(aq
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_selection
.UNINDENT
T}	T{
selected text in vi visual mode
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_operator
.UNINDENT
T}	T{
parameter expansion operators like \fB*\fP and \fB~\fP
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_escape
.UNINDENT
T}	T{
character escapes like \fB\en\fP and \fB\ex70\fP
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_autosuggestion
.UNINDENT
T}	T{
autosuggestions (the proposed rest of a command)
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_cwd
.UNINDENT
T}	T{
the current working directory in the default prompt
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_cwd_root
.UNINDENT
T}	T{
the current working directory in the default prompt for the root user
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_user
.UNINDENT
T}	T{
the username in the default prompt
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_host
.UNINDENT
T}	T{
the hostname in the default prompt
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_host_remote
.UNINDENT
T}	T{
the hostname in the default prompt for remote sessions (like ssh)
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_status
.UNINDENT
T}	T{
the last command\(aqs nonzero exit code in the default prompt
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_cancel
.UNINDENT
T}	T{
the \(aq^C\(aq indicator on a canceled command
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_search_match
.UNINDENT
T}	T{
history search matches and selected pager items (background only)
T}
_
T{
.INDENT 0.0
.TP
.B fish_color_history_current
.UNINDENT
T}	T{
the current position in the history for commands like \fBdirh\fP and \fBcdh\fP
T}
.TE
.sp
If a variable isn\(aqt set or is empty after subtracting any \fB\-\-theme=THEME\fP options,
fish usually tries \fB$fish_color_normal\fP, except for:
.INDENT 0.0
.IP \(bu 2
\fB$fish_color_keyword\fP, where it tries \fB$fish_color_command\fP first.
.IP \(bu 2
\fB$fish_color_option\fP, where it tries \fB$fish_color_param\fP first.
.IP \(bu 2
For \fB$fish_color_valid_path\fP, if that doesn\(aqt have a color, but only modifiers, it adds those to the color that would otherwise be used,
like \fB$fish_color_param\fP\&. But if valid paths have a color, it uses that and adds in modifiers from the other color.
.UNINDENT
.SS Pager color variables
.sp
fish will sometimes present a list of choices in a table, called the pager.
.sp
Example: to set the background of each pager row, use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set fish_pager_color_background \-\-background=white
.EE
.UNINDENT
.UNINDENT
.sp
To have black text on alternating white and gray backgrounds:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set fish_pager_color_prefix black
set fish_pager_color_completion black
set fish_pager_color_description black
set fish_pager_color_background \-\-background=white
set fish_pager_color_secondary_background \-\-background=brwhite
.EE
.UNINDENT
.UNINDENT
.sp
Variables affecting the pager colors:
.TS
box center;
l|l.
T{
Variable
T}	T{
Meaning
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_progress
.UNINDENT
T}	T{
the progress bar at the bottom left corner
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_background
.UNINDENT
T}	T{
the background color of a line
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_prefix
.UNINDENT
T}	T{
the prefix string, i.e. the string that is to be completed
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_completion
.UNINDENT
T}	T{
the completion itself, i.e. the proposed rest of the string
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_description
.UNINDENT
T}	T{
the completion description
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_selected_background
.UNINDENT
T}	T{
background of the selected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_selected_prefix
.UNINDENT
T}	T{
prefix of the selected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_selected_completion
.UNINDENT
T}	T{
suffix of the selected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_selected_description
.UNINDENT
T}	T{
description of the selected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_secondary_background
.UNINDENT
T}	T{
background of every second unselected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_secondary_prefix
.UNINDENT
T}	T{
prefix of every second unselected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_secondary_completion
.UNINDENT
T}	T{
suffix of every second unselected completion
T}
_
T{
.INDENT 0.0
.TP
.B fish_pager_color_secondary_description
.UNINDENT
T}	T{
description of every second unselected completion
T}
.TE
.sp
When the secondary or selected variables aren\(aqt set or are empty, the normal variables are used, except for \fB$fish_pager_color_selected_background\fP, where the background of \fB$fish_color_search_match\fP is tried first.
.SS Abbreviations
.sp
To avoid needless typing, a frequently\-run command like \fBgit checkout\fP can be abbreviated to \fBgco\fP using the abbr \%<> command.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-a gco git checkout
.EE
.UNINDENT
.UNINDENT
.sp
After entering \fBgco\fP and pressing \fBspace\fP or \fBenter\fP, a \fBgco\fP in command position will turn into \fBgit checkout\fP in the command line. If you want to use a literal \fBgco\fP sometimes, use \fBctrl\fP\-\fBspace\fP [1]\&.
.sp
Abbreviations are a lot more powerful than just replacing literal strings. For example you can make going up a number of directories easier with this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function multicd
    echo cd (string repeat \-n (math (string length \-\- $argv[1]) \- 1) ../)
end
abbr \-\-add dotdot \-\-regex \(aq^\e.\e.+$\(aq \-\-function multicd
.EE
.UNINDENT
.UNINDENT
.sp
Now, \fB\&..\fP transforms to \fBcd ../\fP, while \fB\&...\fP turns into \fBcd ../../\fP and \fB\&....\fP expands to \fBcd ../../../\fP\&.
.sp
The advantage over aliases is that you can see the actual command before using it, add to it or change it, and the actual command will be stored in history.
.IP [1] 5
Any binding that executes the \fBexpand\-abbr\fP or \fBexecute\fP bind function \%<> will expand abbreviations. By default \fBctrl\fP\-\fBspace\fP is bound to just inserting a space.
.SS Programmable prompt
.sp
When it is fish\(aqs turn to ask for input (like after it started or the command ended), it will show a prompt. Often this looks something like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
you@hostname ~>
.EE
.UNINDENT
.UNINDENT
.sp
This prompt is determined by running the fish_prompt \%<> and fish_right_prompt \%<> functions.
.sp
The output of the former is displayed on the left and the latter\(aqs output on the right side of the terminal.
For vi mode, the output of fish_mode_prompt \%<> will be prepended on the left.
.sp
If \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> is set to 1, fish will redraw the prompt with a \fB\-\-final\-rendering\fP argument before running a commandline, allowing you to change it before pushing it to the scrollback.
.sp
Fish ships with a few prompts which you can see with fish_config \%<>\&. If you run just \fBfish_config\fP it will open a web interface [2] where you\(aqll be shown the prompts and can pick which one you want. \fBfish_config prompt show\fP will show you the prompts right in your terminal.
.sp
For example \fBfish_config prompt choose disco\fP will temporarily select the \(dqdisco\(dq prompt. If you like it and decide to keep it, run \fBfish_config prompt save\fP\&.
.sp
You can also change these functions yourself by running \fBfunced fish_prompt\fP and \fBfuncsave fish_prompt\fP once you are happy with the result (or \fBfish_right_prompt\fP if you want to change that).
.IP [2] 5
The web interface runs purely locally on your computer and requires python to be installed.
.SS Configurable greeting
.sp
When it is started interactively, fish tries to run the fish_greeting \%<> function. The default fish_greeting prints a simple message. You can change its text by changing the \fB$fish_greeting\fP variable, for instance using a universal variable \%<#\:variables-universal>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-U fish_greeting
.EE
.UNINDENT
.UNINDENT
.sp
or you can set it globally \%<#\:variables-scope> in config.fish \%<#\:configuration>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_greeting \(aqHey, stranger!\(aq
.EE
.UNINDENT
.UNINDENT
.sp
or you can script it by changing the function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_greeting
    random choice \(dqHello!\(dq \(dqHi\(dq \(dqG\(aqday\(dq \(dqHowdy\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
save this in config.fish or a function file \%<#\:syntax-function-autoloading>\&. You can also use funced \%<> and funcsave \%<> to edit it easily.
.SS Programmable title
.sp
Most terminals allow setting the text displayed in the titlebar of the terminal window.
Fish does this by running the fish_title \%<> function.
It is executed before and after a command and the output is used as a titlebar message.
.sp
The status current\-command \%<> builtin will always return the name of the job to be put into the foreground (or \fBfish\fP if control is returning to the shell) when the fish_title \%<> function is called. The first argument will contain the most recently executed foreground command as a string.
.sp
The default title shows the hostname if connected via ssh, the currently running command (unless it is fish) and the current working directory. All of this is shortened to not make the tab too wide.
.sp
Examples:
.sp
To show the last command and working directory in the title:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
    # \(gaprompt_pwd\(ga shortens the title. This helps prevent tabs from becoming very wide.
    echo $argv[1] (prompt_pwd)
    pwd
end
.EE
.UNINDENT
.UNINDENT
.SS Command line editor
.sp
The fish editor features copy and paste, a searchable history and many editor functions that can be bound to special keyboard shortcuts.
.sp
Like bash and other shells, fish includes two sets of keyboard shortcuts (or key bindings): one inspired by the Emacs text editor, and one by the vi text editor. The default editing mode is Emacs. You can switch to vi mode by running fish_vi_key_bindings \%<> and switch back with fish_default_key_bindings \%<>\&. You can also make your own key bindings by creating a function and setting the \fBfish_key_bindings\fP variable to its name. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_hybrid_key_bindings \-\-description \e
\(dqVi\-style bindings that inherit emacs\-style bindings in all modes\(dq
    for mode in default insert visual
        fish_default_key_bindings \-M $mode
    end
    fish_vi_key_bindings \-\-no\-erase
end
set \-g fish_key_bindings fish_hybrid_key_bindings
.EE
.UNINDENT
.UNINDENT
.sp
While the key bindings included with fish include many of the shortcuts popular from the respective text editors, they are not a complete implementation. They include a shortcut to open the current command line in your preferred editor (\fBalt\fP\-\fBe\fP by default) if you need the full power of your editor.
.SS Shared bindings
.sp
Some bindings are common across Emacs and vi mode, because they aren\(aqt text editing bindings, or because what vi/Vim does for a particular key doesn\(aqt make sense for a shell.
.INDENT 0.0
.IP \(bu 2
\fBtab\fP completes the current token. \fBshift\fP\-\fBtab\fP completes the current token and starts the pager\(aqs search mode. \fBtab\fP is the same as \fBctrl\fP\-\fBi\fP\&.
.IP \(bu 2
\fBleft\fP (\fB←\fP) and \fBright\fP (\fB→\fP) move the cursor left or right by one character. If the cursor is already at the end of the line, and an autosuggestion is available, \fBright\fP (\fB→\fP) accepts the autosuggestion.
.IP \(bu 2
\fBenter\fP executes the current commandline or inserts a newline if it\(aqs not complete yet (e.g. a \fB)\fP or \fBend\fP is missing).
.IP \(bu 2
\fBalt\fP\-\fBenter\fP inserts a newline at the cursor position. This is useful to add a line to a commandline that\(aqs already complete.
.IP \(bu 2
\fBalt\fP\-\fBleft\fP (\fB←\fP) and \fBalt\fP\-\fBright\fP (\fB→\fP) move the cursor left or right by one argument (or one word on macOS).
If the command line is empty, they move forward/backward in the directory history.
If the cursor is already at the end of the line, and an autosuggestion is available, \fBalt\fP\-\fBright\fP (\fB→\fP) (or \fBalt\fP\-\fBf\fP) accepts the first argument (or word on macOS) in the suggestion.
.IP \(bu 2
\fBctrl\fP\-\fBleft\fP (\fB←\fP) and \fBctrl\fP\-\fBright\fP (\fB→\fP) move the cursor left or right by one word. These accept one word of the autosuggestion \- the part they\(aqd move over.
.IP \(bu 2
\fBshift\fP\-\fBleft\fP (\fB←\fP) and \fBshift\fP\-\fBright\fP (\fB→\fP) move the cursor one word left or right, without stopping on punctuation. These accept one big word of the autosuggestion.
.IP \(bu 2
\fBup\fP (\fB↑\fP) and \fBdown\fP (\fB↓\fP) (or \fBctrl\fP\-\fBp\fP and \fBctrl\fP\-\fBn\fP for emacs aficionados) search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the history section for more information on history searching.
.IP \(bu 2
\fBalt\fP\-\fBup\fP (\fB↑\fP) and \fBalt\fP\-\fBdown\fP (\fB↓\fP) search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the history section for more information on history searching.
.IP \(bu 2
\fBctrl\fP\-\fBc\fP interrupts/kills whatever is running (SIGINT).
.IP \(bu 2
\fBctrl\fP\-\fBd\fP deletes one character to the right of the cursor. If the command line is empty, \fBctrl\fP\-\fBd\fP will exit fish.
.IP \(bu 2
\fBctrl\fP\-\fBu\fP removes contents from the beginning of line to the cursor (moving it to the killring).
.IP \(bu 2
\fBctrl\fP\-\fBl\fP pushes any text above the prompt to the terminal\(aqs scrollback,
then clears and repaints the screen.
.IP \(bu 2
\fBctrl\fP\-\fBw\fP removes the previous path component (everything up to the previous \(dq/\(dq, \(dq:\(dq or \(dq@\(dq) (moving it to the Copy and paste (Kill Ring)).
.IP \(bu 2
\fBctrl\fP\-\fBx\fP copies the current buffer to the system\(aqs clipboard, \fBctrl\fP\-\fBv\fP inserts the clipboard contents. (see fish_clipboard_copy \%<> and fish_clipboard_paste \%<>)
.IP \(bu 2
\fBalt\fP\-\fBd\fP moves the next word to the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBctrl\fP\-\fBdelete\fP moves the next word (or next argument on macOS) to the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBalt\fP\-\fBd\fP lists the directory history if the command line is empty.
.IP \(bu 2
\fBalt\fP\-\fBdelete\fP moves the next argument (or word on macOS) to the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBshift\fP\-\fBdelete\fP removes the current history item or autosuggestion from the command history.
.IP \(bu 2
\fBalt\fP\-\fBh\fP (or \fBf1\fP) shows the manual page for the current command, if one exists.
.IP \(bu 2
\fBalt\fP\-\fBl\fP lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed.
.UNINDENT
.INDENT 0.0
.IP \(bu 2
\fBalt\fP\-\fBo\fP opens the file at the cursor in a pager. If the cursor is in command position and the command is a script, it will instead open that script in your editor. The editor is chosen from the first available of the \fB$VISUAL\fP or \fB$EDITOR\fP variables.
.IP \(bu 2
\fBalt\fP\-\fBp\fP adds the string \fB&| less;\fP to the end of the job under the cursor. The result is that the output of the command will be paged. If you set the \fBPAGER\fP variable, its value is used instead of \fBless\fP\&.
.IP \(bu 2
\fBalt\fP\-\fBw\fP prints a short description of the command under the cursor.
.IP \(bu 2
\fBalt\fP\-\fBe\fP edits the current command line in an external editor. The editor is chosen from the first available of the \fB$VISUAL\fP or \fB$EDITOR\fP variables.
.IP \(bu 2
\fBalt\fP\-\fBv\fP Same as \fBalt\fP\-\fBe\fP\&.
.IP \(bu 2
\fBalt\fP\-\fBs\fP Prepends \fBsudo\fP to the current commandline. If the commandline is empty, prepend \fBsudo\fP to the last commandline. If \fBsudo\fP is not installed, various similar commands are tried: \fBdoas\fP, \fBplease\fP, and \fBrun0\fP\&.
.IP \(bu 2
\fBctrl\fP\-\fBspace\fP Inserts a space without expanding an abbreviation\&. For vi mode, this only applies to insert\-mode.
.UNINDENT
.SS Emacs mode commands
.sp
To enable emacs mode, use fish_default_key_bindings \%<>\&. This is also the default.
.INDENT 0.0
.IP \(bu 2
\fBhome\fP or \fBctrl\fP\-\fBa\fP moves the cursor to the beginning of the line.
.IP \(bu 2
\fBend\fP or \fBctrl\fP\-\fBe\fP moves to the end of line. If the cursor is already at the end of the line, and an autosuggestion is available, \fBend\fP or \fBctrl\fP\-\fBe\fP accepts the autosuggestion.
.IP \(bu 2
\fBctrl\fP\-\fBb\fP, \fBctrl\fP\-\fBf\fP move the cursor one character left or right or accept the autosuggestion just like the \fBleft\fP (\fB←\fP) and \fBright\fP (\fB→\fP) shared bindings (which are available as well).
.IP \(bu 2
\fBalt\fP\-\fBb\fP, \fBalt\fP\-\fBf\fP move the cursor one word left or right, or accept one word of the autosuggestion. If the command line is empty, moves forward/backward in the directory history instead.
.IP \(bu 2
\fBctrl\fP\-\fBn\fP, \fBctrl\fP\-\fBp\fP move the cursor up/down or through history, like the up and down arrow shared bindings.
.IP \(bu 2
\fBdelete\fP or \fBbackspace\fP or \fBctrl\fP\-\fBh\fP removes one character forwards or backwards respectively.
.IP \(bu 2
\fBctrl\fP\-\fBbackspace\fP removes one word backwards and \fBalt\fP\-\fBbackspace\fP removes one argument backwards.
On macOS, it\(aqs the other way round.
.IP \(bu 2
\fBalt\fP\-\fB<\fP moves to the beginning of the commandline, \fBalt\fP\-\fB>\fP moves to the end.
.IP \(bu 2
\fBctrl\fP\-\fBk\fP deletes from the cursor to the end of line (moving it to the Copy and paste (Kill Ring)).
.IP \(bu 2
\fBescape\fP and \fBctrl\fP\-\fBg\fP cancel the current operation. Immediately after an unambiguous completion this undoes it.
.IP \(bu 2
\fBalt\fP\-\fBc\fP capitalizes the current word.
.IP \(bu 2
\fBalt\fP\-\fBu\fP makes the current word uppercase.
.IP \(bu 2
\fBctrl\fP\-\fBt\fP transposes the last two characters.
.IP \(bu 2
\fBalt\fP\-\fBt\fP transposes the last two words.
.IP \(bu 2
\fBctrl\fP\-\fBz\fP, \fBctrl\fP\-\fB_\fP (\fBctrl\fP\-\fB/\fP on some terminals) undo the most recent edit of the line.
.IP \(bu 2
\fBalt\fP\-\fB/\fP or \fBctrl\fP\-\fBshift\fP\-\fBz\fP reverts the most recent undo.
.IP \(bu 2
\fBctrl\fP\-\fBr\fP opens the history in a pager. This will show history entries matching the search, a few at a time. Pressing \fBctrl\fP\-\fBr\fP again will search older entries, pressing \fBctrl\fP\-\fBs\fP (that otherwise toggles pager search) will go to newer entries. The search bar will always be selected.
.UNINDENT
.sp
You can change these key bindings using the bind \%<> builtin.
.SS Vi mode commands
.sp
Vi mode allows for the use of vi\-like commands at the prompt. Initially, insert mode is active. \fBescape\fP enters command mode\&. The commands available in command, insert and visual mode are described below. Vi mode shares some bindings with Emacs mode\&.
.sp
To enable vi mode, use fish_vi_key_bindings \%<>\&.
It is also possible to add all Emacs mode bindings to vi mode by using something like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_user_key_bindings
    # Execute this once per mode that emacs bindings should be used in
    fish_default_key_bindings \-M insert

    # Then execute the vi\-bindings so they take precedence when there\(aqs a conflict.
    # Without \-\-no\-erase fish_vi_key_bindings will default to
    # resetting all bindings.
    # The argument specifies the initial mode (insert, \(dqdefault\(dq or visual).
    fish_vi_key_bindings \-\-no\-erase insert
end
.EE
.UNINDENT
.UNINDENT
.sp
When in vi mode, the fish_mode_prompt \%<> function will display a mode indicator to the left of the prompt. To disable this feature, override it with an empty function. To display the mode elsewhere (like in your right prompt), use the output of the \fBfish_default_mode_prompt\fP function.
.sp
When a binding switches the mode, it will repaint the mode\-prompt if it exists, and the rest of the prompt only if it doesn\(aqt. So if you want a mode\-indicator in your \fBfish_prompt\fP, you need to erase \fBfish_mode_prompt\fP e.g. by adding an empty file at \fB~/.config/fish/functions/fish_mode_prompt.fish\fP\&. (Bindings that change the mode are supposed to call the \fIrepaint\-mode\fP bind function, see bind \%<>)
.sp
The \fBfish_vi_cursor\fP function will be used to change the cursor\(aqs shape depending on the mode in supported terminals. The following snippet can be used to manually configure cursors after enabling vi mode:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Emulates vim\(aqs cursor shape behavior
# Set the normal and visual mode cursors to a block
set fish_cursor_default block
# Set the insert mode cursor to a line
set fish_cursor_insert line
# Set the replace mode cursors to an underscore
set fish_cursor_replace_one underscore
set fish_cursor_replace underscore
# Set the external cursor to a line. The external cursor appears when a command is started.
# The cursor shape takes the value of fish_cursor_default when fish_cursor_external is not specified.
set fish_cursor_external line
# The following variable can be used to configure cursor shape in
# visual mode, but due to fish_cursor_default, is redundant here
set fish_cursor_visual block
.EE
.UNINDENT
.UNINDENT
.sp
Additionally, \fBblink\fP can be added after each of the cursor shape parameters to set a blinking cursor in the specified shape.
.sp
Fish knows the shapes \(dqblock\(dq, \(dqline\(dq and \(dqunderscore\(dq, other values will be ignored.
.sp
If the cursor shape does not appear to be changing after setting the above variables, it\(aqs likely your terminal emulator does not support the capabilities necessary to do this.
.SS Command mode
.sp
Command mode is also known as normal mode.
.INDENT 0.0
.IP \(bu 2
\fBh\fP moves the cursor left.
.IP \(bu 2
\fBl\fP moves the cursor right.
.IP \(bu 2
\fBk\fP and \fBj\fP search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the history section for more information on history searching. In multi\-line commands, they move the cursor up and down respectively.
.IP \(bu 2
\fBi\fP enters insert mode at the current cursor position.
.IP \(bu 2
\fBI\fP enters insert mode at the beginning of the line.
.IP \(bu 2
\fBv\fP enters visual mode at the current cursor position.
.IP \(bu 2
\fBa\fP enters insert mode after the current cursor position.
.IP \(bu 2
\fBA\fP enters insert mode at the end of the line.
.IP \(bu 2
\fBo\fP inserts a new line under the current one and enters insert mode
.IP \(bu 2
\fBO\fP (capital\-\(dqo\(dq) inserts a new line above the current one and enters insert mode
.IP \(bu 2
\fB0\fP (zero) moves the cursor to beginning of line (remaining in command mode).
.IP \(bu 2
\fBd,d\fP deletes the current line and moves it to the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBD\fP deletes text after the current cursor position and moves it to the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBp\fP pastes text from the Copy and paste (Kill Ring)\&.
.IP \(bu 2
\fBu\fP undoes the most recent edit of the command line.
.IP \(bu 2
\fBctrl\fP\-\fBr\fP redoes the most recent edit.
.IP \(bu 2
\fB[\fP and \fB]\fP search the command history for the previous/next token containing the token under the cursor before the search was started. See the history section for more information on history searching.
.IP \(bu 2
\fB/\fP opens the history in a pager. This will show history entries matching the search, a few at a time. Pressing it again will search older entries, pressing \fBctrl\fP\-\fBs\fP (that otherwise toggles pager search) will go to newer entries. The search bar will always be selected.
.IP \(bu 2
\fBbackspace\fP moves the cursor left.
.IP \(bu 2
\fBg,g\fP / \fBG\fP moves the cursor to the beginning/end of the commandline, respectively.
.IP \(bu 2
\fB~\fP toggles the case (upper/lower) of the character and moves to the next character.
.IP \(bu 2
\fBg,u\fP lowercases to the end of the word.
.IP \(bu 2
\fBg,U\fP uppercases to the end of the word.
.IP \(bu 2
\fB:,q\fP exits fish.
.UNINDENT
.SS Insert mode
.INDENT 0.0
.IP \(bu 2
\fBescape\fP enters command mode\&.
.IP \(bu 2
\fBbackspace\fP removes one character to the left.
.IP \(bu 2
\fBctrl\fP\-\fBn\fP accepts the autosuggestion.
.UNINDENT
.SS Visual mode
.INDENT 0.0
.IP \(bu 2
\fBleft\fP \fB(\(ga\(ga←\(ga\fP) and \fBright\(ga(\(ga\(ga→\(ga\fP) extend the selection backward/forward by one character.
.IP \(bu 2
\fBh\fP moves the cursor left.
.IP \(bu 2
\fBl\fP moves the cursor right.
.IP \(bu 2
\fBk\fP moves the cursor up.
.IP \(bu 2
\fBj\fP moves the cursor down.
.IP \(bu 2
\fBb\fP and \fBw\fP extend the selection backward/forward by one word.
.IP \(bu 2
\fBd\fP and \fBx\fP move the selection to the Copy and paste (Kill Ring) and enter command mode\&.
.IP \(bu 2
\fBescape\fP and \fBctrl\fP\-\fBc\fP enter command mode\&.
.IP \(bu 2
\fBc\fP and \fBs\fP remove the selection and switch to insert mode.
.IP \(bu 2
\fBX\fP moves the entire line to the Copy and paste (Kill Ring), and enters command mode\&.
.IP \(bu 2
\fBy\fP copies the selection to the Copy and paste (Kill Ring), and enters command mode\&.
.IP \(bu 2
\fB~\fP toggles the case (upper/lower) on the selection, and enters command mode\&.
.IP \(bu 2
\fBg,u\fP lowercases the selection, and enters command mode\&.
.IP \(bu 2
\fBg,U\fP uppercases the selection, and enters command mode\&.
.IP \(bu 2
\fB\(dq,*,y\fP copies the selection to the clipboard, and enters command mode\&.
.UNINDENT
.SS Custom bindings
.sp
In addition to the standard bindings listed here, you can also define your own with bind \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Prints \(ga\(ga^C\(ga\(ga and a new prompt
bind ctrl\-c cancel\-commandline
.EE
.UNINDENT
.UNINDENT
.sp
Put \fBbind\fP statements into config.fish \%<#\:configuration> or a function called \fBfish_user_key_bindings\fP\&.
.sp
If you change your mind on a binding and want to go back to fish\(aqs default, you can erase it again:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind \-\-erase ctrl\-c
.EE
.UNINDENT
.UNINDENT
.sp
Fish remembers its preset bindings and so it will take effect again. This saves you from having to remember what it was before and add it again yourself.
.sp
If you use vi bindings, note that \fBbind\fP will by default bind keys in command mode\&. To bind something in insert mode:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind \-\-mode insert ctrl\-c \(aqcommandline \-r \(dq\(dq\(aq
.EE
.UNINDENT
.UNINDENT
.SS Key sequences
.sp
To find out the name of a key, you can use fish_key_reader \%<>\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_key_reader # Press Alt + right\-arrow
Press a key:
bind alt\-right \(aqdo something\(aq
.EE
.UNINDENT
.UNINDENT
.sp
Note that the historical way the terminal encodes keys and sends them to the application (fish, in this case) makes a lot of combinations indistinguishable or unbindable. In the usual encoding, \fBctrl\fP\-\fBi\fP \fIis the same\fP as the tab key, and shift cannot be detected when ctrl is also pressed.
.sp
There are more powerful encoding schemes, and fish tries to tell the terminal to turn them on, but there are still many terminals that do not support them. When \fBfish_key_reader\fP prints the same sequence for two different keys, then that is because your terminal sends the same sequence for them, and there isn\(aqt anything fish can do about it. It is our hope that these schemes will become more widespread, making input more flexible.
.sp
In the historical scheme, \fBescape\fP is the same thing as \fBalt\fP in a terminal. To distinguish between pressing \fBescape\fP and then another key, and pressing \fBalt\fP and that key (or an escape sequence the key sends), fish waits for a certain time after seeing an escape character. This is configurable via the \fBfish_escape_delay_ms\fP \%<#\:envvar-fish_escape_delay_ms> variable.
.sp
If you want to be able to press \fBescape\fP and then a character and have it count as \fBalt\fP+that character, set it to a higher value, e.g.:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_escape_delay_ms 100
.EE
.UNINDENT
.UNINDENT
.sp
Similarly, to disambiguate \fIother\fP keypresses where you\(aqve bound a subsequence and a longer sequence, fish has \fBfish_sequence_key_delay_ms\fP \%<#\:envvar-fish_sequence_key_delay_ms>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# This binds the sequence j,k to switch to normal mode in vi mode.
# If you kept it like that, every time you press \(dqj\(dq,
# fish would wait for a \(dqk\(dq or other key to disambiguate
bind \-M insert \-m default j,k cancel repaint\-mode

# After setting this, fish only waits 200ms for the \(dqk\(dq,
# or decides to treat the \(dqj\(dq as a separate sequence, inserting it.
set \-g fish_sequence_key_delay_ms 200
.EE
.UNINDENT
.UNINDENT
.SS Copy and paste (Kill Ring)
.sp
Fish uses an Emacs\-style kill ring for copy and paste functionality. For example, use \fBctrl\fP\-\fBk\fP (\fIkill\-line\fP) to cut from the current cursor position to the end of the line. The string that is cut (a.k.a. killed in emacs\-ese) is inserted into a list of kills, called the kill ring. To paste the latest value from the kill ring (emacs calls this \(dqyanking\(dq) use \fBctrl\fP\-\fBy\fP (the \fByank\fP input function). After pasting, use \fBalt\fP\-\fBy\fP (\fByank\-pop\fP) to rotate to the previous kill.
.sp
Copy and paste from outside are also supported, both via the \fBctrl\fP\-\fBx\fP / \fBctrl\fP\-\fBv\fP bindings (the \fBfish_clipboard_copy\fP and \fBfish_clipboard_paste\fP functions [3]) and via the terminal\(aqs paste function, for which fish enables \(dqBracketed Paste Mode\(dq, so it can tell a paste from manually entered text.
In addition, when pasting inside single quotes, pasted single quotes and backslashes are automatically escaped so that the result can be used as a single token by closing the quote after.
Kill ring entries are stored in \fBfish_killring\fP variable.
.sp
The commands \fBbegin\-selection\fP and \fBend\-selection\fP (unbound by default; used for selection in vi visual mode) control text selection together with cursor movement commands that extend the current selection.
The variable \fBfish_cursor_selection_mode\fP \%<#\:envvar-fish_cursor_selection_mode> can be used to configure if that selection should include the character under the cursor (\fBinclusive\fP) or not (\fBexclusive\fP). The default is \fBexclusive\fP, which works well with any cursor shape. For vi mode, and particularly for the \fBblock\fP or \fBunderscore\fP cursor shapes you may prefer \fBinclusive\fP\&.
.IP [3] 5
These rely on external tools. Currently xsel, xclip, wl\-copy/wl\-paste and pbcopy/pbpaste are supported.
.SS Multiline editing
.sp
The fish commandline editor can be used to work on commands that are several lines long. There are three ways to make a command span more than a single line:
.INDENT 0.0
.IP \(bu 2
Pressing the \fBenter\fP key while a block of commands is unclosed, such as when one or more block commands such as \fBfor\fP, \fBbegin\fP or \fBif\fP do not have a corresponding end \%<> command.
.IP \(bu 2
Pressing \fBalt\fP\-\fBenter\fP instead of pressing the \fBenter\fP key.
.IP \(bu 2
By inserting a backslash (\fB\e\fP) character before pressing the \fBenter\fP key, escaping the newline.
.UNINDENT
.sp
The fish commandline editor works exactly the same in single line mode and in multiline mode. To move between lines use the left and right arrow keys and other such keyboard shortcuts.
.SS Searchable command history
.sp
After a command has been executed, it is remembered in the history list. Any duplicate history items are automatically removed. By pressing the up and down keys, you can search forwards and backwards in the history. If the current command line is not empty when starting a history search, only the commands containing the string entered into the command line are shown.
.sp
By pressing \fBalt\fP\-\fBup\fP (\fB↑\fP) and \fBalt\fP\-\fBdown\fP (\fB↓\fP), a history search is also performed, but instead of searching for a complete commandline, each commandline is broken into separate elements like it would be before execution, and the history is searched for an element matching that under the cursor.
.sp
For more complicated searches, you can press \fBctrl\fP\-\fBr\fP to open a pager that allows you to search the history. It shows a limited number of entries in one page, press \fBctrl\fP\-\fBr\fP [4] again to move to the next page and \fBctrl\fP\-\fBs\fP [5] to move to the previous page. You can change the text to refine your search.
.sp
History searches are case\-insensitive unless the search string contains an uppercase character. You can stop a search to edit your search string by pressing \fBescape\fP or \fBpagedown\fP\&.
.sp
Prefixing the commandline with a space will prevent the entire line from being stored in the history. It will still be available for recall until the next command is executed, but will not be stored on disk. This is to allow you to fix misspellings and such.
.sp
The command history is stored in the file \fB~/.local/share/fish/fish_history\fP (or
\fB$XDG_DATA_HOME/fish/fish_history\fP if that variable is set) by default. However, you can set the
\fBfish_history\fP environment variable to change the name of the history session (resulting in a
\fB<session>_history\fP file); both before starting the shell and while the shell is running.
.sp
See the history \%<> command for other manipulations.
.sp
Examples:
.sp
To search for previous entries containing the word \(aqmake\(aq, type \fBmake\fP in the console and press the up key.
.sp
If the commandline reads \fBcd m\fP, place the cursor over the \fBm\fP character and press \fBalt\fP\-\fBup\fP (\fB↑\fP) to search for previously typed words containing \(aqm\(aq.
.IP [4] 5
Or another binding that triggers the \fBhistory\-pager\fP input function. See bind \%<> for a list.
.IP [5] 5
Or another binding that triggers the \fBpager\-toggle\-search\fP input function.
.SS Private mode
.sp
Fish has a private mode, in which command history will not be written to the history file on disk. To enable it, either set \fB$fish_private_mode\fP to a non\-empty value, or launch with \fBfish \-\-private\fP (or \fBfish \-P\fP for short).
.sp
If you launch fish with \fB\-P\fP, it both hides old history and prevents writing history to disk. This is useful to avoid leaking personal information (e.g. for screencasts) or when dealing with sensitive information.
.sp
You can query the variable \fBfish_private_mode\fP (\fBif test \-n \(dq$fish_private_mode\(dq ...\fP) if you would like to respect the user\(aqs wish for privacy and alter the behavior of your own fish scripts.
.SS Navigating directories
.sp
Navigating directories is usually done with the cd \%<> command, but fish offers some advanced features as well.
.sp
The current working directory can be displayed with the pwd \%<> command, or the \fB$PWD\fP special variable \%<#\:variables-special>\&. Usually your prompt already does this.
.SS Directory history
.sp
Fish automatically keeps a trail of the recent visited directories with cd \%<> by storing this history in the \fBdirprev\fP and \fBdirnext\fP variables.
.sp
Several commands are provided to interact with this directory history:
.INDENT 0.0
.IP \(bu 2
dirh \%<> prints the history
.IP \(bu 2
cdh \%<> displays a prompt to quickly navigate the history
.IP \(bu 2
prevd \%<> moves backward through the history. It is bound to \fBalt\fP\-\fBleft\fP (\fB←\fP)
.IP \(bu 2
nextd \%<> moves forward through the history. It is bound to \fBalt\fP\-\fBright\fP (\fB→\fP)
.UNINDENT
.SS Directory stack
.sp
Another set of commands, usually also available in other shells like bash, deal with the directory stack. Stack handling is not automatic and needs explicit calls of the following commands:
.INDENT 0.0
.IP \(bu 2
dirs \%<> prints the stack
.IP \(bu 2
pushd \%<> adds a directory on top of the stack and makes it the current working directory
.IP \(bu 2
popd \%<> removes the directory on top of the stack and changes the current working directory
.UNINDENT
.SS The fish language
.sp
This document is a comprehensive overview of fish\(aqs scripting language.
.sp
For interactive features see Interactive use \%<>\&.
.SS Syntax overview
.sp
Shells like fish are used by giving them commands. A command is executed by writing the name of the command followed by any arguments. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo hello world
.EE
.UNINDENT
.UNINDENT
.sp
echo \%<> command writes its arguments to the screen. In this example the output is \fBhello world\fP\&.
.sp
Everything in fish is done with commands. There are commands for repeating other commands, commands for assigning variables, commands for treating a group of commands as a single command, etc. All of these commands follow the same basic syntax.
.sp
Every program on your computer can be used as a command in fish. If the program file is located in one of the \fBPATH\fP directories, you can just type the name of the program to use it. Otherwise the whole filename, including the directory (like \fB/home/me/code/checkers/checkers\fP or \fB\&../checkers\fP) is required.
.sp
Here is a list of some useful commands:
.INDENT 0.0
.IP \(bu 2
cd \%<>: Change the current directory
.IP \(bu 2
\fBls\fP: List files and directories
.IP \(bu 2
\fBman\fP: Display a manual page \- try \fBman ls\fP to get help on your \(dqls\(dq command, or \fBman mv\fP to get information about \(dqmv\(dq.
.IP \(bu 2
\fBmv\fP: Move (rename) files
.IP \(bu 2
\fBcp\fP: Copy files
.IP \(bu 2
open \%<>: Open files with the default application associated with each filetype
.IP \(bu 2
\fBless\fP: Display the contents of files
.UNINDENT
.sp
Commands and arguments are separated by the space character \fB\(aq \(aq\fP\&. Every command ends with either a newline (by pressing the return key) or a semicolon \fB;\fP\&. Multiple commands can be written on the same line by separating them with semicolons.
.sp
A switch is a very common special type of argument. Switches almost always start with one or more hyphens \fB\-\fP and alter the way a command operates. For example, the \fBls\fP command usually lists the names of all files and directories in the current working directory. By using the \fB\-l\fP switch, the behavior of \fBls\fP is changed to not only display the filename, but also the size, permissions, owner, and modification time of each file.
.sp
Switches differ between commands and are usually documented on a command\(aqs manual page. There are some switches, however, that are common to most commands. For example, \fB\-\-help\fP will usually display a help text, \fB\-\-version\fP will usually display the command version, and \fB\-i\fP will often turn on interactive prompting before taking action. Try \fBman your\-command\-here\fP to get information on your command\(aqs switches.
.sp
So the basic idea of fish is the same as with other unix shells: It gets a commandline, runs expansions, and the result is then run as a command.
.SS Terminology
.sp
Here we define some of the terms used on this page and throughout the rest of the fish documentation:
.INDENT 0.0
.IP \(bu 2
\fBArgument\fP: A parameter given to a command. In \fBecho foo\fP, the \(dqfoo\(dq is an argument.
.IP \(bu 2
\fBBuiltin\fP: A command that is implemented by the shell. Builtins are so closely tied to the operation of the shell that it is impossible to implement them as external commands. In \fBecho foo\fP, the \(dqecho\(dq is a builtin.
.IP \(bu 2
\fBCommand\fP: A program that the shell can run, or more specifically an external program that the shell runs in another process. External commands are provided on your system, as executable files. In \fBecho foo\fP the \(dqecho\(dq is a builtin command, in \fBcommand echo foo\fP the \(dqecho\(dq is an external command, provided by a file like /bin/echo.
.IP \(bu 2
\fBFunction\fP: A block of commands that can be called as if they were a single command. By using functions, it is possible to string together multiple simple commands into one more advanced command.
.IP \(bu 2
\fBJob\fP: A running pipeline or command.
.IP \(bu 2
\fBPipeline\fP: A set of commands strung together so that the output of one command is the input of the next command. \fBecho foo | grep foo\fP is a pipeline.
.IP \(bu 2
\fBRedirection\fP: An operation that changes one of the input or output streams associated with a job.
.IP \(bu 2
\fBSwitch\fP or \fBOption\fP: A special kind of argument that alters the behavior of a command. A switch almost always begins with one or two hyphens. In \fBecho \-n foo\fP the \(dq\-n\(dq is an option.
.UNINDENT
.SS Quotes
.sp
Sometimes you want to give a command an argument that contains characters special to fish, like spaces or \fB$\fP or \fB*\fP\&. To do that, you can use quotes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
rm \(dqmy file.txt\(dq
.EE
.UNINDENT
.UNINDENT
.sp
to remove a file called \fBmy file.txt\fP instead of trying to remove two files, \fBmy\fP and \fBfile.txt\fP\&.
.sp
Fish understands two kinds of quotes: Single (\fB\(aq\fP) and double (\fB\(dq\fP), and both work slightly differently.
.sp
Between single quotes, fish performs no expansions. Between double quotes, fish only performs variable expansion and command substitution in the \fB$(command)\fP\&. No other kind of expansion (including brace expansion or parameter expansion) is performed, and escape sequences (for example, \fB\en\fP) are ignored. Within quotes, whitespace is not used to separate arguments, allowing quoted arguments to contain spaces.
.sp
The only meaningful escape sequences in single quotes are \fB\e\(aq\fP, which escapes a single quote and \fB\e\e\fP, which escapes the backslash symbol. The only meaningful escapes in double quotes are \fB\e\(dq\fP, which escapes a double quote, \fB\e$\fP, which escapes a dollar character, \fB\e\fP followed by a newline, which deletes the backslash and the newline, and \fB\e\e\fP, which escapes the backslash symbol.
.sp
Single quotes have no special meaning within double quotes and vice versa.
.sp
More examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
grep \(aqenabled)$\(aq foo.txt
.EE
.UNINDENT
.UNINDENT
.sp
searches for lines ending in \fBenabled)\fP in \fBfoo.txt\fP (the \fB$\fP is special to \fBgrep\fP: it matches the end of the line).
.INDENT 0.0
.INDENT 3.5
.sp
.EX
apt install \(dqpostgres\-*\(dq
.EE
.UNINDENT
.UNINDENT
.sp
installs all packages with a name starting with \(dqpostgres\-\(dq, instead of looking through the current directory for files named \(dqpostgres\-something\(dq.
.SS Escaping Characters
.sp
Some characters cannot be written directly on the command line. For these characters, so\-called escape sequences are provided. These are:
.INDENT 0.0
.IP \(bu 2
\fB\ea\fP represents the alert character.
.IP \(bu 2
\fB\ee\fP represents the escape character.
.IP \(bu 2
\fB\ef\fP represents the form feed character.
.IP \(bu 2
\fB\en\fP represents a newline character.
.IP \(bu 2
\fB\er\fP represents the carriage return character.
.IP \(bu 2
\fB\et\fP represents the tab character.
.IP \(bu 2
\fB\ev\fP represents the vertical tab character.
.IP \(bu 2
\fB\exHH\fP or \fB\eXHH\fP, where \fBHH\fP is a hexadecimal number, represents a byte of data with the specified value. For example, \fB\ex9\fP is the tab character. If you are using a multibyte encoding, this can be used to enter invalid strings. Typically fish is run with the ASCII or UTF\-8 encoding, so anything up to \fB\eX7f\fP is an ASCII character.
.IP \(bu 2
\fB\eooo\fP, where \fBooo\fP is an octal number, represents the ASCII character with the specified value. For example, \fB\e011\fP is the tab character. The highest allowed value is \fB\e177\fP\&.
.IP \(bu 2
\fB\euXXXX\fP, where \fBXXXX\fP is a hexadecimal number, represents the 16\-bit Unicode character with the specified value. For example, \fB\eu9\fP is the tab character.
.IP \(bu 2
\fB\eUXXXXXXXX\fP, where \fBXXXXXXXX\fP is a hexadecimal number, represents the 32\-bit Unicode character with the specified value. For example, \fB\eU9\fP is the tab character. The highest allowed value is U10FFFF.
.IP \(bu 2
\fB\ecX\fP, where \fBX\fP is a letter of the alphabet, represents the control sequence generated by pressing the control key and the specified letter. For example, \fB\eci\fP is the tab character
.UNINDENT
.sp
Some characters have special meaning to the shell. For example, an apostrophe \fB\(aq\fP disables expansion (see Quotes). To tell the shell to treat these characters literally, escape them with a backslash. For example, the command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \e\(aqhello world\e\(aq
.EE
.UNINDENT
.UNINDENT
.sp
outputs \fB\(aqhello world\(aq\fP (including the apostrophes), while the command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(aqhello world\(aq
.EE
.UNINDENT
.UNINDENT
.sp
outputs \fBhello world\fP (without the apostrophes). In the former case the shell treats the apostrophes as literal \fB\(aq\fP characters, while in the latter case it treats them as special expansion modifiers.
.sp
The special characters and their escape sequences are:
.INDENT 0.0
.IP \(bu 2
\fB\e\ \fP (backslash space) escapes the space character. This keeps the shell from splitting arguments on the escaped space.
.IP \(bu 2
\fB\e$\fP escapes the dollar character.
.IP \(bu 2
\fB\e\e\fP escapes the backslash character.
.IP \(bu 2
\fB\e*\fP escapes the star character.
.IP \(bu 2
\fB\e?\fP escapes the question mark character (this is not necessary if the \fBqmark\-noglob\fP feature flag is enabled).
.IP \(bu 2
\fB\e~\fP escapes the tilde character.
.IP \(bu 2
\fB\e#\fP escapes the hash character.
.IP \(bu 2
\fB\e(\fP escapes the left parenthesis character.
.IP \(bu 2
\fB\e)\fP escapes the right parenthesis character.
.IP \(bu 2
\fB\e{\fP escapes the left curly bracket character.
.IP \(bu 2
\fB\e}\fP escapes the right curly bracket character.
.IP \(bu 2
\fB\e[\fP escapes the left bracket character.
.IP \(bu 2
\fB\e]\fP escapes the right bracket character.
.IP \(bu 2
\fB\e<\fP escapes the less than character.
.IP \(bu 2
\fB\e>\fP escapes the more than character.
.IP \(bu 2
\fB\e&\fP escapes the ampersand character.
.IP \(bu 2
\fB\e|\fP escapes the vertical bar character.
.IP \(bu 2
\fB\e;\fP escapes the semicolon character.
.IP \(bu 2
\fB\e\(dq\fP escapes the quote character.
.IP \(bu 2
\fB\e\(aq\fP escapes the apostrophe character.
.UNINDENT
.sp
As a special case, \fB\e\fP immediately followed by a literal new line is a \(dqcontinuation\(dq and tells fish to ignore the line break and resume input at the start of the next line (without introducing any whitespace or terminating a token).
.SS Input/Output Redirection
.sp
Most programs use three input/output (I/O) streams:
.INDENT 0.0
.IP \(bu 2
Standard input (stdin) for reading. Defaults to reading from the keyboard.
.IP \(bu 2
Standard output (stdout) for writing output. Defaults to writing to the screen.
.IP \(bu 2
Standard error (stderr) for writing errors and warnings. Defaults to writing to the screen.
.UNINDENT
.sp
Each stream has a number called the file descriptor (FD): 0 for stdin, 1 for stdout, and 2 for stderr.
.sp
The destination of a stream can be changed using something called \fIredirection\fP\&. For example, \fBecho hello > output.txt\fP, redirects the standard output of the \fBecho\fP command to a text file.
.INDENT 0.0
.IP \(bu 2
To read standard input from a file, use \fB<SOURCE_FILE\fP\&.
.IP \(bu 2
To read standard input from a file or /dev/null if it can\(aqt be read, use \fB<?SOURCE_FILE\fP\&.
.IP \(bu 2
To write standard output to a file, use \fB>DESTINATION\fP\&.
.IP \(bu 2
To write standard error to a file, use \fB2>DESTINATION\fP\&. [1]
.IP \(bu 2
To append standard output to a file, use \fB>>DESTINATION_FILE\fP\&.
.IP \(bu 2
To append standard error to a file, use \fB2>>DESTINATION_FILE\fP\&.
.IP \(bu 2
To not overwrite (\(dqclobber\(dq) an existing file, use \fB>?DESTINATION\fP or \fB2>?DESTINATION\fP\&. This is known as the \(dqnoclobber\(dq redirection.
.UNINDENT
.sp
\fBDESTINATION\fP can be one of the following:
.INDENT 0.0
.IP \(bu 2
A filename to write the output to. Often \fB>/dev/null\fP to silence output by writing it to the special \(dqsinkhole\(dq file.
.IP \(bu 2
An ampersand (\fB&\fP) followed by the number of another file descriptor like \fB&2\fP for standard error. The output will be written to the destination descriptor.
.IP \(bu 2
An ampersand followed by a minus sign (\fB&\-\fP). The file descriptor will be closed. Note: This may cause the program to fail because its writes will be unsuccessful.
.UNINDENT
.sp
As a convenience, the redirection \fB&>\fP can be used to direct both stdout and stderr to the same destination. For example, \fBecho hello &> all_output.txt\fP redirects both stdout and stderr to the file \fBall_output.txt\fP\&. This is equivalent to \fBecho hello > all_output.txt 2>&1\fP\&.  You can also use \fB&>>\fP to append both stdout and stderr to the same destination.
.sp
Any arbitrary file descriptor can be used in a redirection by prefixing the redirection with the FD number.
.INDENT 0.0
.IP \(bu 2
To redirect the input of descriptor N, use \fBN<DESTINATION\fP\&.
.IP \(bu 2
To redirect the output of descriptor N, use \fBN>DESTINATION\fP\&.
.IP \(bu 2
To append the output of descriptor N to a file, use \fBN>>DESTINATION_FILE\fP\&.
.UNINDENT
.sp
File descriptors cannot be used with a \fB<?\fP input redirection, only a regular \fB<\fP one.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Write \(gafoo\(ga\(aqs standard error (file descriptor 2)
# to a file called \(dqoutput.stderr\(dq:
foo 2> output.stderr

# if $num doesn\(aqt contain a number,
# this test will be false and print an error,
# so by ignoring the error we can be sure that we\(aqre dealing
# with a number in the \(dqif\(dq block:
if test \(dq$num\(dq \-gt 2 2>/dev/null
    # do things with $num as a number greater than 2
else
    # do things if $num is <= 2 or not a number
end

# Save \(gamake\(gas output in a file:
make &>/log

# Redirections stack and can be used with blocks:
begin
    echo stdout
    echo stderr >&2 # <\- this goes to stderr!
end >/dev/null # ignore stdout, so this prints \(dqstderr\(dq

# print all lines that include \(dqfoo\(dq from myfile, or nothing if it doesn\(aqt exist.
string match \(aq*foo*\(aq <?myfile
.EE
.UNINDENT
.UNINDENT
.sp
It is an error to redirect a builtin, function, or block to a file descriptor above 2. However this is supported for external commands.
.IP [1] 5
Previous versions of fish also allowed specifying this as \fB^DESTINATION\fP, but that made another character special so it was deprecated and removed. See feature flags\&.
.SS Piping
.sp
Another way to redirect streams is a \fIpipe\fP\&. A pipe connects streams with each other. Usually the standard output of one command is connected with the standard input of another. This is done by separating commands with the pipe character \fB|\fP\&. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cat foo.txt | head
.EE
.UNINDENT
.UNINDENT
.sp
The command \fBcat foo.txt\fP sends the contents of \fBfoo.txt\fP to stdout. This output is provided as input for the \fBhead\fP program, which prints the first 10 lines of its input.
.sp
It is possible to pipe a different output file descriptor by prepending its FD number and the output redirect symbol to the pipe. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
make fish 2>| less
.EE
.UNINDENT
.UNINDENT
.sp
will attempt to build \fBfish\fP, and any errors will be shown using the \fBless\fP pager. [2]
.sp
As a convenience, the pipe \fB&|\fP (as well as the \fB|&\fP alias which is also supported by Bash) both redirect stdout and stderr to the same process.
.IP [2] 5
A \(dqpager\(dq here is a program that takes output and \(dqpaginates\(dq it. \fBless\fP doesn\(aqt just do pages, it allows arbitrary scrolling (even back!).
.SS Combining pipes and redirections
.sp
It is possible to use multiple redirections and a pipe at the same time. In that case, they are read in this order:
.INDENT 0.0
.IP 1. 3
First the pipe is set up.
.IP 2. 3
Then the redirections are evaluated from left\-to\-right.
.UNINDENT
.sp
This is important when any redirections reference other file descriptors with the \fB&N\fP syntax. When you say \fB>&2\fP, that will redirect stdout to where stderr is pointing to \fIat that time\fP\&.
.sp
Consider this helper function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Make a function that prints something to stdout and stderr
function print
    echo out
    echo err >&2
end
.EE
.UNINDENT
.UNINDENT
.sp
Now let\(aqs see a few cases:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Redirect both stderr and stdout to less
print 2>&1 | less
# or
print &| less

# Show the \(dqout\(dq on stderr, silence the \(dqerr\(dq
print >&2 2>/dev/null

# Silence both
print >/dev/null 2>&1
.EE
.UNINDENT
.UNINDENT
.SS Job control
.sp
When you start a job in fish, fish itself will pause, and give control of the terminal to the program it just started. Sometimes, you want to continue using the commandline, and have the job run in the background. To create a background job, append an \fB&\fP (ampersand) to your command. This will tell fish to run the job in the background. Background jobs are very useful when running programs that have a graphical user interface.
.sp
Example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
emacs &
.EE
.UNINDENT
.UNINDENT
.sp
will start the emacs text editor in the background. fg \%<> can be used to bring it into the foreground again when needed.
.sp
Most programs allow you to suspend the program\(aqs execution and return control to fish by pressing \fBctrl\fP\-\fBz\fP (also referred to as \fB^Z\fP). Once back at the fish commandline, you can start other programs and do anything you want. If you then want you can go back to the suspended command by using the fg \%<> (foreground) command.
.sp
If you instead want to put a suspended job into the background, use the bg \%<> command.
.sp
To get a listing of all currently started jobs, use the jobs \%<> command.
These listed jobs can be removed with the disown \%<> command.
.sp
At the moment, functions cannot be started in the background. Functions that are stopped and then restarted in the background using the bg \%<> command will not execute correctly.
.sp
If the \fB&\fP character is followed by a non\-separating character, it is not interpreted as background operator. Separating characters are whitespace and the characters \fB;<>&|\fP\&.
.SS Functions
.sp
Functions are programs written in the fish syntax. They group together various commands and their arguments using a single name.
.sp
For example, here\(aqs a simple function to list directories:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function ll
    ls \-l $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
The first line tells fish to define a function by the name of \fBll\fP, so it can be used by writing \fBll\fP on the commandline. The second line tells fish that the command \fBls \-l $argv\fP should be called when \fBll\fP is invoked. $argv is a list variable, which always contains all arguments sent to the function. In the example above, these are passed on to the \fBls\fP command. The \fBend\fP on the third line ends the definition.
.sp
Calling this as \fBll /tmp/\fP will end up running \fBls \-l /tmp/\fP, which will list the contents of /tmp.
.sp
This is a kind of function known as an alias\&.
.sp
Fish\(aqs prompt is also defined in a function, called fish_prompt \%<>\&. It is run when the prompt is about to be displayed and its output forms the prompt:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    # A simple prompt. Displays the current directory
    # (which fish stores in the $PWD variable)
    # and then a user symbol \- a \(aq►\(aq for a normal user and a \(aq#\(aq for root.
    set \-l user_char \(aq►\(aq
    if fish_is_root_user
        set user_char \(aq#\(aq
    end

    echo (set_color yellow)$PWD (set_color purple)$user_char
end
.EE
.UNINDENT
.UNINDENT
.sp
To edit a function, you can use funced \%<>, and to save a function funcsave \%<>\&. This will store it in a function file that fish will autoload when needed.
.sp
The functions \%<> builtin can show a function\(aqs current definition (and type \%<> will also do if given a function).
.sp
For more information on functions, see the documentation for the function \%<> builtin.
.SS Defining aliases
.sp
One of the most common uses for functions is to slightly alter the behavior of an already existing command. For example, one might want to redefine the \fBls\fP command to display colors. The switch for turning on colors on GNU systems is \fB\-\-color=auto\fP\&. An alias around \fBls\fP might look like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function ls
    command ls \-\-color=auto $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
There are a few important things that need to be noted about aliases:
.INDENT 0.0
.IP \(bu 2
Always take care to add the $argv variable to the list of parameters to the wrapped command. This makes sure that if the user specifies any additional parameters to the function, they are passed on to the underlying command.
.IP \(bu 2
If the alias has the same name as the aliased command, you need to prefix the call to the program with \fBcommand\fP to tell fish that the function should not call itself, but rather a command with the same name. If you forget to do so, the function would call itself until the end of time. Usually fish is smart enough to figure this out and will refrain from doing so (which is hopefully in your interest).
.UNINDENT
.sp
To easily create a function of this form, you can use the alias \%<> command. Unlike other shells, this just makes functions \- fish has no separate concept of an \(dqalias\(dq, we just use the word for a simple wrapping function like this. alias \%<> immediately creates a function. Consider using \fBalias \-\-save\fP or funcsave \%<> to save the created function into an autoload file instead of recreating the alias each time.
.sp
For an alternative, try abbreviations \%<#\:abbreviations>\&. These are words that are expanded while you type, instead of being actual functions inside the shell.
.SS Autoloading functions
.sp
Functions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. This has some advantages:
.INDENT 0.0
.IP \(bu 2
An autoloaded function becomes available automatically to all running shells.
.IP \(bu 2
If the function definition is changed, all running shells will automatically reload the altered version, after a while.
.IP \(bu 2
Startup time and memory usage is improved, etc.
.UNINDENT
.sp
When fish needs to load a function, it searches through any directories in the list variable \fB$fish_function_path\fP for a file with a name consisting of the name of the function plus the suffix \fB\&.fish\fP and loads the first it finds.
.sp
For example if you try to execute something called \fBbanana\fP, fish will go through all directories in $fish_function_path looking for a file called \fBbanana.fish\fP and load the first one it finds.
.sp
By default \fB$fish_function_path\fP contains the following:
.INDENT 0.0
.IP \(bu 2
A directory for users to keep their own functions, usually \fB~/.config/fish/functions\fP (controlled by the \fBXDG_CONFIG_HOME\fP environment variable).
.IP \(bu 2
A directory for functions for all users on the system, usually \fB/etc/fish/functions\fP (really \fB$__fish_sysconfdir/functions\fP).
.IP \(bu 2
Directories for other software to put their own functions. These are in the directories under \fB$__fish_user_data_dir\fP (usually \fB~/.local/share/fish\fP, controlled by the \fBXDG_DATA_HOME\fP environment variable) and in the \fBXDG_DATA_DIRS\fP environment variable, in a subdirectory called \fBfish/vendor_functions.d\fP\&. The default value for \fBXDG_DATA_DIRS\fP is usually \fB/usr/share/fish/vendor_functions.d\fP and \fB/usr/local/share/fish/vendor_functions.d\fP\&.
.UNINDENT
.sp
If you are unsure, your functions probably belong in \fB~/.config/fish/functions\fP\&.
.sp
As we\(aqve explained, autoload files are loaded \fIby name\fP, so, while you can put multiple functions into one file, the file will only be loaded automatically once you try to execute the one that shares the name.
.sp
Autoloading also won\(aqt work for event handlers, since fish cannot know that a function is supposed to be executed when an event occurs when it hasn\(aqt yet loaded the function. See the event handlers section for more information.
.sp
If a file of the right name doesn\(aqt define the function, fish will not read other autoload files, instead it will go on to try builtins and finally commands. This allows masking a function defined later in $fish_function_path, e.g. if your administrator has put something into /etc/fish/functions that you want to skip.
.sp
If you are developing another program and want to install fish functions for it, install them to the \(dqvendor\(dq functions directory. As this path varies from system to system, you can use \fBpkgconfig\fP to discover it with the output of \fBpkg\-config \-\-variable functionsdir fish\fP\&. Your installation system should support a custom path to override the pkgconfig path, as other distributors may need to alter it easily.
.SS Comments
.sp
Anything after a \fB#\fP until the end of the line is a comment. That means it\(aqs purely for the reader\(aqs benefit, fish ignores it.
.sp
This is useful to explain what and why you are doing something:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function ls
    # The function is called ls,
    # so we have to explicitly call \(gacommand ls\(ga to avoid calling ourselves.
    command ls \-\-color=auto $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
There are no multiline comments. If you want to make a comment span multiple lines, start each line with a \fB#\fP\&.
.sp
Comments can also appear after a line like so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-gx EDITOR emacs # I don\(aqt like vim.
.EE
.UNINDENT
.UNINDENT
.SS Conditions
.sp
Fish has some builtins that let you execute commands only if a specific criterion is met: if \%<>, switch \%<>, and \%<> and or \%<>, and also the familiar &&/|| syntax.
.SS The \fBif\fP statement
.sp
The if \%<> statement runs a block of commands if the condition was true.
.sp
Like other shells, but unlike typical programming languages you might know, the condition here is a \fIcommand\fP\&. Fish runs it, and if it returns a true exit status (that\(aqs 0), the if\-block is run. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-e /etc/os\-release
    cat /etc/os\-release
end
.EE
.UNINDENT
.UNINDENT
.sp
This uses the test \%<> command to see if the file /etc/os\-release exists. If it does, it runs \fBcat\fP, which prints it on the screen.
.sp
Unlike other shells, the condition command ends after the first job, there is no \fBthen\fP here. Combiners like \fBand\fP and \fBor\fP extend the condition.
.sp
A more complicated example with a command substitution:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \(dq$(uname)\(dq = Linux
    echo I like penguins
end
.EE
.UNINDENT
.UNINDENT
.sp
Because \fBtest\fP can be used for many different tests, it is important to quote variables and command substitutions. If the \fB$(uname)\fP was not quoted, and \fBuname\fP printed nothing it would run \fBtest = Linux\fP, which is an error.
.sp
\fBif\fP can also take \fBelse if\fP clauses with additional conditions and an  else \%<> clause that is executed when everything else was false:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \(dq$number\(dq \-gt 10
   echo Your number was greater than 10
else if test \(dq$number\(dq \-gt 5
   echo Your number was greater than 5
else if test \(dq$number\(dq \-gt 1
   echo Your number was greater than 1
else
   echo Your number was smaller or equal to 1
end
.EE
.UNINDENT
.UNINDENT
.sp
The not \%<> keyword can be used to invert the status:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Check if the file contains the string \(dqfish\(dq anywhere.
# This executes the \(gagrep\(ga command, which searches for a string,
# and if it finds it returns a status of 0.
# The \(ganot\(ga then turns 0 into 1 or anything else into 0.
# The \(ga\-q\(ga switch stops it from printing any matches.
if not grep \-q fish myanimals
    echo \(dqYou don\(aqt have fish!\(dq
else
    echo \(dqYou have fish!\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
Other things commonly used in if\-conditions:
.INDENT 0.0
.IP \(bu 2
contains \%<> \- to see if a list contains a specific element (\fBif contains \-\- /usr/bin $PATH\fP)
.IP \(bu 2
string \%<> \- to e.g. match strings (\fBif string match \-q \-\- \(aq*\-\(aq $arg\fP)
.IP \(bu 2
path \%<> \- to check if paths of some criteria exist (\fBif path is \-rf \-\- ~/.config/fish/config.fish\fP)
.IP \(bu 2
type \%<> \- to see if a command, function or builtin exists (\fBif type \-q git\fP)
.UNINDENT
.SS The \fBswitch\fP statement
.sp
The switch \%<> command is used to execute one of possibly many blocks of commands depending on the value of a string. It can take multiple case \%<> blocks that are executed when the string matches. They can take wildcards\&. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
switch (uname)
case Linux
    echo Hi Tux!
case Darwin
    echo Hi Hexley!
case DragonFly \(aq*BSD\(aq
    echo Hi Beastie! # this also works for FreeBSD and NetBSD
case \(aq*\(aq
    echo Hi, stranger!
end
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells or programming languages, there is no fallthrough \- the first matching \fBcase\fP block is executed and then control jumps out of the \fBswitch\fP\&.
.SS Combiners (\fBand\fP / \fBor\fP / \fB&&\fP / \fB||\fP)
.sp
For simple checks, you can use combiners. and \%<> or \fB&&\fP run the second command if the first succeeded, while or \%<> or \fB||\fP run it if the first failed. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# $XDG_CONFIG_HOME is a standard place to store configuration.
# If it\(aqs not set applications should use ~/.config.
set \-q XDG_CONFIG_HOME; and set \-l configdir $XDG_CONFIG_HOME
or set \-l configdir ~/.config
.EE
.UNINDENT
.UNINDENT
.sp
Note that combiners are \fIlazy\fP \- only the part that is necessary to determine the final status is run.
.sp
Compare:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if sleep 2; and false
    echo \(aqHow did I get here? This should be impossible\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
and:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if false; and sleep 2
    echo \(aqHow did I get here? This should be impossible\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
These do essentially the same thing, but the former takes 2 seconds longer because the \fBsleep\fP always needs to run.
.sp
Or you can have a case where it is necessary to stop early:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if command \-sq foo; and foo
.EE
.UNINDENT
.UNINDENT
.sp
If this went on after seeing that the command \(dqfoo\(dq doesn\(aqt exist, it would try to run \fBfoo\fP and error because it wasn\(aqt found!
.sp
Combiners execute step\-by\-step, so it isn\(aqt recommended to build longer chains of them because they might do something you don\(aqt want. Consider:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
test \-e /etc/my.config
or echo \(dqOH NO WE NEED A CONFIG FILE\(dq
and return 1
.EE
.UNINDENT
.UNINDENT
.sp
This will execute \fBreturn 1\fP also if the \fBtest\fP succeeded. This is because fish runs \fBtest \-e /etc/my.config\fP, sets $status to 0, then skips the \fBecho\fP, keeps $status at 0, and then executes the \fBreturn 1\fP because $status is still 0.
.sp
So if you have more complex conditions or want to run multiple things after something failed, consider using an if\&. Here that would be:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if not test \-e /etc/my.config
    echo \(dqOH NO WE NEED A CONFIG FILE\(dq
    return 1
end
.EE
.UNINDENT
.UNINDENT
.SS Loops and blocks
.sp
Like most programming language, fish also has the familiar while \%<> and for \%<> loops.
.sp
\fBwhile\fP works like a repeated if:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
while true
    echo Still running
    sleep 1
end
.EE
.UNINDENT
.UNINDENT
.sp
will print \(dqStill running\(dq once a second. You can abort it with ctrl\-c.
.sp
\fBfor\fP loops work like in other shells, which is more like python\(aqs for\-loops than e.g. C\(aqs:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for file in *
    echo file: $file
end
.EE
.UNINDENT
.UNINDENT
.sp
will print each file in the current directory. The part after the \fBin\fP is a list of arguments, so you can use any expansions there:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set moreanimals bird fox
for animal in {cat,}fish dog $moreanimals
   echo I like the $animal
end
.EE
.UNINDENT
.UNINDENT
.sp
If you need a list of numbers, you can use the \fBseq\fP command to create one:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (seq 1 5)
    echo $i
end
.EE
.UNINDENT
.UNINDENT
.sp
break \%<> is available to break out of a loop, and continue \%<> to jump to the next iteration.
.sp
Input and output redirections (including pipes) can also be applied to loops:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
while read \-l line
    echo line: $line
end < file
.EE
.UNINDENT
.UNINDENT
.sp
In addition there\(aqs a begin \%<> block that just groups commands together so you can redirect to a block or use a new variable scope without any repetition:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
begin
   set \-l foo bar # this variable will only be available in this block!
end
.EE
.UNINDENT
.UNINDENT
.SS Parameter expansion
.sp
When fish is given a commandline, it expands the parameters before sending them to the command. There are multiple different kinds of expansions:
.INDENT 0.0
.IP \(bu 2
Wildcards, to create filenames from patterns \- \fB*.jpg\fP
.IP \(bu 2
Variable expansion, to use the value of a variable \- \fB$HOME\fP
.IP \(bu 2
Command substitution, to use the output of another command \- \fB$(cat /path/to/file)\fP
.IP \(bu 2
Brace expansion, to write lists with common pre\- or suffixes in a shorter way \fB{/usr,}/bin\fP
.IP \(bu 2
Tilde expansion, to turn the \fB~\fP at the beginning of paths into the path to the home directory \fB~/bin\fP
.UNINDENT
.sp
Parameter expansion is limited to 524288 items. There is a limit to how many arguments the operating system allows for any command, and 524288 is far above it. This is a measure to stop the shell from hanging doing useless computation.
.SS Wildcards (\(dqGlobbing\(dq)
.sp
When a parameter includes an unquoted \fB*\fP star (or \(dqasterisk\(dq) or a \fB?\fP question mark, fish uses it as a wildcard to match files.
.INDENT 0.0
.IP \(bu 2
\fB*\fP matches any number of characters (including zero) in a file name, not including \fB/\fP\&.
.IP \(bu 2
\fB**\fP matches any number of characters (including zero), and also descends into subdirectories. If \fB**\fP is a segment by itself, that segment may match zero times, for compatibility with other shells.
.IP \(bu 2
\fB?\fP can match any single character except \fB/\fP\&. This is deprecated and can be disabled via the \fBqmark\-noglob\fP feature flag, so \fB?\fP will be an ordinary character.
.UNINDENT
.sp
Wildcard matches are sorted case insensitively. When sorting matches containing numbers, they are naturally sorted, so that the strings \(aq1\(aq \(aq5\(aq and \(aq12\(aq would be sorted like 1, 5, 12.
.sp
Hidden files (where the name begins with a dot) are not considered when wildcarding unless the wildcard string has a dot in that place.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
\fBa*\fP matches any files beginning with an \(aqa\(aq in the current directory.
.IP \(bu 2
\fB**\fP matches any files and directories in the current directory and all of its subdirectories.
.IP \(bu 2
\fB~/.*\fP matches all hidden files (also known as \(dqdotfiles\(dq) and directories in your home directory.
.UNINDENT
.sp
For most commands, if any wildcard fails to expand, the command is not executed, $status is set to nonzero, and a warning is printed. This behavior is like what bash does with \fBshopt \-s failglob\fP\&. There are exceptions, namely set \%<> and path \%<>, overriding variables in overrides, count \%<> and for \%<>\&. Their globs will instead expand to zero arguments (so the command won\(aqt see them at all), like with \fBshopt \-s nullglob\fP in bash.
.sp
Examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# List the .foo files, or warns if there aren\(aqt any.
ls *.foo

# List the .foo files, if any.
set foos *.foo
if count $foos >/dev/null
    ls $foos
end
.EE
.UNINDENT
.UNINDENT
.sp
Unlike bash (by default), fish will not pass on the literal glob character if no match was found, so for a command like \fBapt install\fP that does the matching itself, you need to add quotes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
apt install \(dqncurses\-*\(dq
.EE
.UNINDENT
.UNINDENT
.SS Variable expansion
.sp
One of the most important expansions in fish is the \(dqvariable expansion\(dq. This is the replacing of a dollar sign (\fB$\fP) followed by a variable name with the _value_ of that variable.
.sp
A simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo $HOME
.EE
.UNINDENT
.UNINDENT
.sp
which will replace \fB$HOME\fP with the home directory of the current user, and pass it to echo \%<>, which will then print it.
.sp
Some variables like \fB$HOME\fP are already set because fish sets them by default or because fish\(aqs parent process passed them to fish when it started it. You can define your own variables by setting them with set \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set my_directory /home/cooluser/mystuff
ls $my_directory
# shows the contents of /home/cooluser/mystuff
.EE
.UNINDENT
.UNINDENT
.sp
For more on how setting variables works, see Shell variables and the following sections.
.sp
Sometimes a variable has no value because it is undefined or empty, and it expands to nothing:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo $nonexistentvariable
# Prints no output.
.EE
.UNINDENT
.UNINDENT
.sp
To separate a variable name from text you can encase the variable within double\-quotes or braces:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set WORD cat
echo The plural of $WORD is \(dq$WORD\(dqs
# Prints \(dqThe plural of cat is cats\(dq because $WORD is set to \(dqcat\(dq.
echo The plural of $WORD is {$WORD}s
# ditto
.EE
.UNINDENT
.UNINDENT
.sp
Without the quotes or braces, fish will try to expand a variable called \fB$WORDs\fP, which may not exist.
.sp
The latter syntax \fB{$WORD}\fP is a special case of brace expansion\&.
.sp
If $WORD here is undefined or an empty list, the \(dqs\(dq is not printed. However, it is printed if $WORD is the empty string (like after \fBset WORD \(dq\(dq\fP).
.sp
For more on shell variables, read the Shell variables section.
.SS Quoting variables
.sp
Variable expansion also happens in double quoted strings. Inside double quotes (\fB\(dqthese\(dq\fP), variables will always expand to exactly one argument. If they are empty or undefined, it will result in an empty string. If they have one element, they\(aqll expand to that element. If they have more than that, the elements will be joined with spaces, unless the variable is a path variable \- in that case it will use a colon (\fB:\fP) instead [3]\&.
.sp
Fish variables are all lists, and they are split into elements when they are \fIset\fP \- that means it is important to decide whether to use quotes or not with set \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set foo 1 2 3 # a variable with three elements
rm $foo # runs the equivalent of \(garm 1 2 3\(ga \- trying to delete three files: 1, 2 and 3.
rm \(dq$foo\(dq # runs \(garm \(aq1 2 3\(aq\(ga \- trying to delete one file called \(aq1 2 3\(aq

set foo # an empty variable
rm $foo # runs \(garm\(ga without arguments
rm \(dq$foo\(dq # runs the equivalent of \(garm \(aq\(aq\(ga

set foo \(dq1 2 3\(dq
rm $foo # runs the equivalent of \(garm \(aq1 2 3\(aq\(ga \- trying to delete one file
rm \(dq$foo\(dq # same thing
.EE
.UNINDENT
.UNINDENT
.sp
This is unlike other shells, which do what is known as \(dqWord Splitting\(dq, where they split the variable when it is \fIused\fP in an expansion. E.g. in bash:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
foo=\(dq1 2 3\(dq
rm $foo # runs the equivalent of \(garm 1 2 3\(ga
rm \(dq$foo\(dq # runs the equivalent of \(garm \(aq1 2 3\(aq\(ga
.EE
.UNINDENT
.UNINDENT
.sp
This is the cause of very common problems with filenames with spaces in bash scripts.
.sp
In fish, unquoted variables will expand to as many arguments as they have elements. That means an empty list will expand to nothing, a variable with one element will expand to that element, and a variable with multiple elements will expand to each of those elements separately.
.sp
If a variable expands to nothing, it will cancel out any other strings attached to it. See the Combining Lists section for more information.
.sp
Most of the time, not quoting a variable is correct. The exception is when you need to ensure that the variable is passed as one element, even if it might be unset or have multiple elements. This happens often with test \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l foo one two three
test \-n $foo
# prints an error that it got too many arguments, because it was executed like
test \-n one two three

test \-n \(dq$foo\(dq
# works, because it was executed like
test \-n \(dqone two three\(dq
.EE
.UNINDENT
.UNINDENT
.IP [3] 5
Unlike bash or zsh, which will join with the first character of $IFS (which usually is space).
.SS Dereferencing variables
.sp
The \fB$\fP symbol can also be used multiple times, as a kind of \(dqdereference\(dq operator (the \fB*\fP in C or C++), like in the following code:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set foo a b c
set a 10; set b 20; set c 30
for i in (seq (count $$foo))
    echo $$foo[$i]
end

# Output is:
# 10
# 20
# 30
.EE
.UNINDENT
.UNINDENT
.sp
\fB$$foo[$i]\fP is \(dqthe value of the variable named by \fB$foo[$i]\fP\(dq.
.sp
This can also be used to give a variable name to a function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function print_var
    for arg in $argv
        echo Variable $arg is $$arg
    end
end

set \-g foo 1 2 3
set \-g bar a b c

print_var foo bar
# prints \(dqVariable foo is 1 2 3\(dq and \(dqVariable bar is a b c\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Of course the variable will have to be accessible from the function, so it needs to be global/universal or exported\&. It also can\(aqt clash with a variable name used inside the function. So if we had made $foo there a local variable, or if we had named it \(dqarg\(dq instead, it would not have worked.
.sp
When using this feature together with slices, the slices will be used from the inside out. \fB$$foo[5]\fP will use the fifth element of \fB$foo\fP as a variable name, instead of giving the fifth element of all the variables $foo refers to. That would instead be expressed as \fB$$foo[1..\-1][5]\fP (take all elements of \fB$foo\fP, use them as variable names, then give the fifth element of those).
.sp
Some more examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set listone 1 2 3
set listtwo 4 5 6
set var listone listtwo

echo $$var
# Output is 1 2 3 4 5 6

echo $$var[1]
# Output is 1 2 3

echo $$var[2][3]
# $var[2] is listtwo, third element of that is 6, output is 6

echo $$var[..][2]
# The second element of every variable, so output is 2 5
.EE
.UNINDENT
.UNINDENT
.SS Variables as command
.sp
Like other shells, you can run the value of a variable as a command.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-g EDITOR emacs
> $EDITOR foo # opens emacs, possibly the GUI version
.EE
.UNINDENT
.UNINDENT
.sp
If you want to give the command an argument inside the variable it needs to be a separate element:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set EDITOR emacs \-nw
> $EDITOR foo # opens emacs in the terminal even if the GUI is installed
> set EDITOR \(dqemacs \-nw\(dq
> $EDITOR foo # tries to find a command called \(dqemacs \-nw\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Also like other shells, this only works with commands, builtins and functions \- it will not work with keywords because they have syntactical importance.
.sp
For instance \fBset if $if\fP won\(aqt allow you to make an if\-block, and \fBset cmd command\fP won\(aqt allow you to use the command \%<> decorator, but only uses like \fB$cmd \-q foo\fP\&.
.SS Command substitution
.sp
A \fBcommand substitution\fP is an expansion that uses the \fIoutput\fP of a command as the arguments to another. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo $(pwd)
.EE
.UNINDENT
.UNINDENT
.sp
This executes the pwd \%<> command, takes its output (more specifically what it wrote to the standard output \(dqstdout\(dq stream) and uses it as arguments to echo \%<>\&. So the inner command (the \fBpwd\fP) is run first and has to complete before the outer command can even be started.
.sp
If the inner command prints multiple lines, fish will use each separate line as a separate argument to the outer command. Unlike other shells, the value of \fB$IFS\fP is not used [4], fish splits on newlines.
.sp
Command substitutions can also be double\-quoted:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(dq$(pwd)\(dq
.EE
.UNINDENT
.UNINDENT
.sp
When using double quotes, the command output is not split up by lines, but trailing empty lines are still removed.
.sp
If the output is piped to string split or string split0 \%<> as the last step, those splits are used as they appear instead of splitting lines.
.sp
Fish also allows spelling command substitutions without the dollar, like \fBecho (pwd)\fP\&. This variant will not be expanded in double\-quotes (\fBecho \(dq(pwd)\(dq\fP will print \fB(pwd)\fP).
.sp
The exit status of the last run command substitution is available in the status variable if the substitution happens in the context of a set \%<> command (so \fBif set \-l (something)\fP checks if \fBsomething\fP returned true).
.sp
To use only some lines of the output, refer to slices\&.
.sp
Examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Outputs \(aqimage.png\(aq.
echo (basename image.jpg .jpg).png

# Convert all JPEG files in the current directory to the
# PNG format using the \(aqconvert\(aq program.
for i in *.jpg; convert $i (basename $i .jpg).png; end

# Set the \(ga\(gadata\(ga\(ga variable to the contents of \(aqdata.txt\(aq
# without splitting it into a list.
set data \(dq$(cat data.txt)\(dq

# Set \(ga\(ga$data\(ga\(ga to the contents of data, splitting on NUL\-bytes.
set data (cat data | string split0)
.EE
.UNINDENT
.UNINDENT
.sp
Sometimes you want to pass the output of a command to another command that only accepts files. If it\(aqs just one file, you can usually pass it via a pipe, like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
grep fish myanimallist1 | wc \-l
.EE
.UNINDENT
.UNINDENT
.sp
but if you need multiple or the command doesn\(aqt read from standard input, \(dqprocess substitution\(dq is useful. Other shells allow this via \fBfoo <(bar) <(baz)\fP, and fish uses the psub \%<> command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Compare only the lines containing \(dqfish\(dq in two files:
diff \-u (grep fish myanimallist1 | psub) (grep fish myanimallist2 | psub)
.EE
.UNINDENT
.UNINDENT
.sp
This creates a temporary file, stores the output of the command in that file and prints the filename, so it is given to the outer command.
.sp
Fish has a default limit of 1 GiB on the data it will read in a command substitution. If that limit is reached the command (all of it, not just the command substitution \- the outer command won\(aqt be executed at all) fails and \fB$status\fP is set to 122. This is so command substitutions can\(aqt cause the system to go out of memory, because typically your operating system has a much lower limit, so reading more than that would be useless and harmful. This limit can be adjusted with the \fBfish_read_limit\fP variable (\fI0\fP meaning no limit). This limit also affects the read \%<> command.
.IP [4] 5
One exception: Setting \fB$IFS\fP to empty will disable line splitting. This is deprecated, use string split \%<> instead.
.SS Brace expansion
.sp
Curly braces can be used to write comma\-separated lists. They will be expanded with each element becoming a new parameter, with the surrounding string attached. This is useful to save on typing, and to separate a variable name from surrounding text.
.sp
Examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo input.{c,h,txt}
input.c input.h input.txt

# Move all files with the suffix \(aq.c\(aq or \(aq.h\(aq to the subdirectory src.
> mv *.{c,h} src/

# Make a copy of \(gafile\(ga at \(gafile.bak\(ga.
> cp file{,.bak}

> set \-l dogs hot cool cute \(dqgood \(dq
> echo {$dogs}dog
hotdog cooldog cutedog good dog
.EE
.UNINDENT
.UNINDENT
.sp
If there is no \(dq,\(dq or variable expansion between the curly braces, they will not be expanded:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# This {} isn\(aqt special
> echo foo\-{}
foo\-{}
# This passes \(dqHEAD@{2}\(dq to git
> git reset \-\-hard HEAD@{2}
> echo {{a,b}}
{a} {b} # because the inner brace pair is expanded, but the outer isn\(aqt.
.EE
.UNINDENT
.UNINDENT
.sp
If after expansion there is nothing between the braces, the argument will be removed (see the Combining Lists section):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo foo\-{$undefinedvar}
# Output is an empty line, like a bare \(gaecho\(ga.
.EE
.UNINDENT
.UNINDENT
.sp
If there is nothing between a brace and a comma or two commas, it\(aqs interpreted as an empty element:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo {,,/usr}/bin
/bin /bin /usr/bin
.EE
.UNINDENT
.UNINDENT
.sp
To use a \(dq,\(dq as an element, quote or escape it.
.sp
The very first character of a command token is never interpreted as expanding brace, because it\(aqs the beginning of a compound statement \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> {echo hello, && echo world}
hello,
world
.EE
.UNINDENT
.UNINDENT
.SS Combining lists
.sp
Fish expands lists like brace expansions:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ set \-l foo x y z
>_ echo 1$foo
# Any element of $foo is combined with the \(dq1\(dq:
1x 1y 1z

>_ echo {good,bad}\(dq apples\(dq
# Any element of the {} is combined with the \(dq apples\(dq:
good apples bad apples

# Or we can mix the two:
>_ echo {good,bad}\(dq \(dq$foo
good x bad x good y bad y good z bad z
.EE
.UNINDENT
.UNINDENT
.sp
Any string attached to a list will be concatenated to each element.
.sp
Two lists will be expanded in all combinations  \- every element of the first with every element of the second:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ set \-l a x y z; set \-l b 1 2 3
>_ echo $a$b # same as {x,y,z}{1,2,3}
x1 y1 z1 x2 y2 z2 x3 y3 z3
.EE
.UNINDENT
.UNINDENT
.sp
A result of this is that, if a list has no elements, this combines the string with no elements, which means the entire token is removed!
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ set \-l c # <\- this list is empty!
>_ echo {$c}word
# Output is an empty line \- the \(dqword\(dq part is gone
.EE
.UNINDENT
.UNINDENT
.sp
This can be quite useful. For example, if you want to go through all the files in all the directories in \fBPATH\fP, use
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for file in $PATH/*
.EE
.UNINDENT
.UNINDENT
.sp
Because \fBPATH\fP is a list, this expands to all the files in all the directories in it. And if there are no directories in \fBPATH\fP, the right answer here is to expand to no files.
.sp
Sometimes this may be unwanted, especially that tokens can disappear after expansion. In those cases, you should double\-quote variables \- \fBecho \(dq$c\(dqword\fP\&.
.sp
This also happens after command substitution\&. To avoid tokens disappearing there, make the inner command return a trailing newline, or double\-quote it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ set b 1 2 3
>_ echo (echo x)$b
x1 x2 x3
>_ echo (printf \(aq%s\(aq \(aq\(aq)banana
# the printf prints nothing, so this is nothing times \(dqbanana\(dq,
# which is nothing.
>_ echo (printf \(aq%s\en\(aq \(aq\(aq)banana
# the printf prints a newline,
# so the command substitution expands to an empty string,
# so this is \(ga\(aq\(aqbanana\(ga
banana
>_ echo \(dq$(printf \(aq%s\(aq \(aq\(aq)\(dqbanana
# quotes mean this is one argument, the banana stays
.EE
.UNINDENT
.UNINDENT
.SS Slices
.sp
Sometimes it\(aqs necessary to access only some of the elements of a list (all fish variables are lists), or some of the lines a command substitution outputs. Both are possible in fish by writing a set of indices in brackets, like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Make $var a list of four elements
set var one two three four
# Print the second:
echo $var[2]
# prints \(dqtwo\(dq
# or print the first three:
echo $var[1..3]
# prints \(dqone two three\(dq
.EE
.UNINDENT
.UNINDENT
.sp
In index brackets, fish understands ranges written like \fBa..b\fP (\(aqa\(aq and \(aqb\(aq being indices). They are expanded into a sequence of indices from a to b (so \fBa a+1 a+2 ... b\fP), going up if b is larger and going down if a is larger. Negative indices can also be used \- they are taken from the end of the list, so \fB\-1\fP is the last element, and \fB\-2\fP the one before it. If an index doesn\(aqt exist the range is clamped to the next possible index.
.sp
If a list has 5 elements the indices go from 1 to 5, so a range of \fB2..16\fP will only go from element 2 to element 5.
.sp
If the end is negative the range always goes up, so \fB2..\-2\fP will go from element 2 to 4, and \fB2..\-16\fP won\(aqt go anywhere because there is no way to go from the second element to one that doesn\(aqt exist, while going up.
If the start is negative the range always goes down, so \fB\-2..1\fP will go from element 4 to 1, and \fB\-16..2\fP won\(aqt go anywhere because there is no way to go from an element that doesn\(aqt exist to the second element, while going down.
.sp
A missing starting index in a range defaults to 1. This is allowed if the range is the first index expression of the sequence. Similarly, a missing ending index, defaulting to \-1 is allowed for the last index in the sequence.
.sp
Multiple ranges are also possible, separated with a space.
.sp
Some examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo (seq 10)[1 2 3]
# Prints: 1 2 3

# Limit the command substitution output
echo (seq 10)[2..5]
# Uses elements from 2 to 5
# Output is: 2 3 4 5

echo (seq 10)[7..]
# Prints: 7 8 9 10

# Use overlapping ranges:
echo (seq 10)[2..5 1..3]
# Takes elements from 2 to 5 and then elements from 1 to 3
# Output is: 2 3 4 5 1 2 3

# Reverse output
echo (seq 10)[\-1..1]
# Uses elements from the last output line to
# the first one in reverse direction
# Output is: 10 9 8 7 6 5 4 3 2 1

# The command substitution has only one line,
# so these will result in empty output:
echo (echo one)[2..\-1]
echo (echo one)[\-3..1]
.EE
.UNINDENT
.UNINDENT
.sp
The same works when setting or expanding variables:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Reverse path variable
set PATH $PATH[\-1..1]
# or
set PATH[\-1..1] $PATH

# Use only n last items of the PATH
set n \-3
echo $PATH[$n..\-1]
.EE
.UNINDENT
.UNINDENT
.sp
Variables can be used as indices for expansion of variables, like so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set index 2
set letters a b c d
echo $letters[$index] # returns \(aqb\(aq
.EE
.UNINDENT
.UNINDENT
.sp
However using variables as indices for command substitution is currently not supported, so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo (seq 5)[$index] # This won\(aqt work

set sequence (seq 5) # It needs to be written on two lines like this.
echo $sequence[$index] # returns \(aq2\(aq
.EE
.UNINDENT
.UNINDENT
.sp
When using indirect variable expansion with multiple \fB$\fP (\fB$$name\fP), you have to give all indices up to the variable you want to slice:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-l list 1 2 3 4 5
> set \-l name list
> echo $$name[1]
1 2 3 4 5
> echo $$name[1..\-1][1..3] # or $$name[1][1..3], since $name only has one element.
1 2 3
.EE
.UNINDENT
.UNINDENT
.SS Home directory expansion
.sp
The \fB~\fP (tilde) character at the beginning of a parameter, followed by a username, is expanded into the home directory of the specified user. A lone \fB~\fP, or a \fB~\fP followed by a slash, is expanded into the home directory of the process owner:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
ls ~/Music # lists my music directory

echo ~root # prints root\(aqs home directory, probably \(dq/root\(dq
.EE
.UNINDENT
.UNINDENT
.SS Combining different expansions
.sp
All of the above expansions can be combined. If several expansions result in more than one parameter, all possible combinations are created.
.sp
When combining multiple parameter expansions, expansions are performed in the following order:
.INDENT 0.0
.IP \(bu 2
Command substitutions
.IP \(bu 2
Variable expansions
.IP \(bu 2
Bracket expansion
.IP \(bu 2
Wildcard expansion
.UNINDENT
.sp
Expansions are performed from right to left, nested bracket expansions and command substitutions are performed from the inside and out.
.sp
Example:
.sp
If the current directory contains the files \(aqfoo\(aq and \(aqbar\(aq, the command \fBecho a(ls){1,2,3}\fP will output \fBabar1 abar2 abar3 afoo1 afoo2 afoo3\fP\&.
.SS Table Of Operators
.sp
Putting it together, here is a quick reference to fish\(aqs operators, all of the special symbols it uses:
.TS
box center;
l|l|l.
T{
Symbol
T}	T{
Meaning
T}	T{
Example
T}
_
T{
\fB$\fP
T}	T{
Variable expansion
T}	T{
\fBecho $foo\fP
T}
_
T{
\fB$()\fP and \fB()\fP
T}	T{
Command substitution
T}	T{
\fBcat (grep foo bar)\fP or \fBcat $(grep foo bar)\fP
T}
_
T{
\fB<\fP and \fB>\fP
T}	T{
Redirection, like \fBcommand > file\fP
T}	T{
\fBgit shortlog \-nse . > authors\fP
T}
_
T{
\fB|\fP
T}	T{
Pipe, connect two or more commands
T}	T{
\fBfoo | grep bar | grep baz\fP
T}
_
T{
\fB;\fP
T}	T{
End of the command, instead of a newline
T}	T{
\fBcommand1; command2\fP
T}
_
T{
\fB&\fP
T}	T{
Backgrounding
T}	T{
\fBsleep 5m &\fP
T}
_
T{
\fB{}\fP
T}	T{
Brace expansion
T}	T{
\fBls {/usr,}/bin\fP
T}
_
T{
\fB&&\fP and \fB||\fP
T}	T{
Combiners
T}	T{
\fBmkdir foo && cd foo\fP or \fBrm foo || exit\fP
T}
_
T{
\fB*\fP and \fB**\fP
T}	T{
Wildcards
T}	T{
\fBcat *.fish\fP or \fBcount **.jpg\fP
T}
_
T{
\fB\e\e\fP
T}	T{
Escaping
T}	T{
\fBecho foo\enbar\fP or \fBecho \e$foo\fP
T}
_
T{
\fB\(aq\(aq\fP and \fB\(dq\(dq\fP
T}	T{
Quoting
T}	T{
\fBrm \(dqfile with spaces\(dq\fP or \fBecho \(aq$foo\(aq\fP
T}
_
T{
\fB~\fP
T}	T{
Home directory expansion
T}	T{
\fBls ~/\fP or \fBls ~root/\fP
T}
_
T{
\fB#\fP
T}	T{
Comments
T}	T{
\fBecho Hello # this isn\(aqt printed\fP
T}
.TE
.SS Shell variables
.sp
Variables are a way to save data and pass it around. They can be used just by the shell, or they can be \(dqexported\(dq, so that a copy of the variable is available to any external command the shell starts. An exported variable is referred to as an \(dqenvironment variable\(dq.
.sp
To set a variable value, use the set \%<> command. A variable name can not be empty and can contain only letters, digits, and underscores. It may begin and end with any of those characters.
.sp
Example:
.sp
To set the variable \fBsmurf_color\fP to the value \fBblue\fP, use the command \fBset smurf_color blue\fP\&.
.sp
After a variable has been set, you can use the value of a variable in the shell through variable expansion\&.
.sp
Example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set smurf_color blue
echo Smurfs are usually $smurf_color
set pants_color red
echo Papa smurf, who is $smurf_color, wears $pants_color pants
.EE
.UNINDENT
.UNINDENT
.sp
So you set a variable with \fBset\fP, and use it with a \fB$\fP and the name.
.SS Variable Scope
.sp
All variables in fish have a scope. For example they can be global or local to a function or block:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# This variable is global, we can use it everywhere.
set \-\-global name Patrick
# This variable is local, it will not be visible in a function we call from here.
set \-\-local place \(dqat the Krusty Krab\(dq

function local
    # This can find $name, but not $place
    echo Hello this is $name $place

    # This variable is local, it will not be available
    # outside of this function
    set \-\-local instrument mayonnaise
    echo My favorite instrument is $instrument
    # This creates a local $name, and won\(aqt touch the global one
    set \-\-local name Spongebob
    echo My best friend is $name
end

local
# Will print:
# Hello this is Patrick
# My favorite instrument is mayonnaise
# My best friend is Spongebob

echo $name, I am $place and my instrument is $instrument
# Will print:
# Patrick, I am at the Krusty Krab and my instrument is
.EE
.UNINDENT
.UNINDENT
.sp
There are four kinds of variable scopes in fish: universal, global, function and local variables.
.INDENT 0.0
.IP \(bu 2
Universal variables are shared between all fish sessions a user is running on one computer. They are stored on disk and persist even after reboot.
.IP \(bu 2
Global variables are specific to the current fish session. They can be erased by explicitly requesting \fBset \-e\fP\&.
.IP \(bu 2
Function variables are specific to the currently executing function. They are erased (\(dqgo out of scope\(dq) when the current function ends. Outside of a function, they don\(aqt go out of scope.
.IP \(bu 2
Local variables are specific to the current block of commands, and automatically erased when a specific block goes out of scope. A block of commands is a series of commands that begins with one of the commands \fBfor\fP, \fBwhile\fP , \fBif\fP, \fBfunction\fP, \fBbegin\fP or \fBswitch\fP, and ends with the command \fBend\fP\&. Outside of a block, this is the same as the function scope.
.UNINDENT
.sp
Variables can be explicitly set to be universal with the \fB\-U\fP or \fB\-\-universal\fP switch, global with \fB\-g\fP or \fB\-\-global\fP, function\-scoped with \fB\-f\fP or \fB\-\-function\fP and local to the current block with \fB\-l\fP or \fB\-\-local\fP\&.  The scoping rules when creating or updating a variable are:
.INDENT 0.0
.IP \(bu 2
When a scope is explicitly given, it will be used. If a variable of the same name exists in a different scope, that variable will not be changed.
.IP \(bu 2
When no scope is given, but a variable of that name exists, the variable of the smallest scope will be modified. The scope will not be changed.
.IP \(bu 2
When no scope is given and no variable of that name exists, the variable is created in function scope if inside a function, or global scope if no function is executing.
.UNINDENT
.sp
There can be many variables with the same name, but different scopes. When you use a variable, the smallest scoped variable of that name will be used. If a local variable exists, it will be used instead of the global or universal variable of the same name.
.sp
Example:
.sp
There are a few possible uses for different scopes.
.sp
Typically inside functions you should use local scope:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function something
    set \-l file /path/to/my/file
    if not test \-e \(dq$file\(dq
        set file /path/to/my/otherfile
    end
end

# or

function something
    if test \-e /path/to/my/file
        set \-f file /path/to/my/file
    else
        set \-f file /path/to/my/otherfile
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
If you want to set something in config.fish, or set something in a function and have it available for the rest of the session, global scope is a good choice:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Don\(aqt shorten the working directory in the prompt
set \-g fish_prompt_pwd_dir_length 0

# Set my preferred cursor style:
function setcursors
   set \-g fish_cursor_default block
   set \-g fish_cursor_insert line
   set \-g fish_cursor_visual underscore
end

# Set my language
set \-gx LANG de_DE.UTF\-8
.EE
.UNINDENT
.UNINDENT
.sp
Here is an example of local vs function\-scoped variables:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function test\-scopes
    begin
        # This is a nice local scope where all variables will die
        set \-l pirate \(aqThere be treasure in them thar hills\(aq
        set \-f captain Space, the final frontier
        # If no variable of that name was defined, it is function\-local.
        set gnu \(dqIn the beginning there was nothing, which exploded\(dq
    end

    # This will not output anything, since the pirate was local
    echo $pirate
    # This will output the good Captain\(aqs speech
    # since $captain had function\-scope.
    echo $captain
    # This will output Sir Terry\(aqs wisdom.
    echo $gnu
end
.EE
.UNINDENT
.UNINDENT
.sp
When a function calls another, local variables aren\(aqt visible:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function shiver
    set phrase \(aqShiver me timbers\(aq
end

function avast
    set \-\-local phrase \(aqAvast, mateys\(aq
    # Calling the shiver function here can not
    # change any variables in the local scope
    # so phrase remains as we set it here.
    shiver
    echo $phrase
end
avast

# Outputs \(dqAvast, mateys\(dq
.EE
.UNINDENT
.UNINDENT
.sp
When in doubt, use function\-scoped variables. When you need to make a variable accessible everywhere, make it global. When you need to persistently store configuration, make it universal. When you want to use a variable only in a short block, make it local.
.SS Overriding variables for a single command
.sp
If you want to override a variable for a single command, you can use \(dqvar=val\(dq statements before the command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Call git status on another directory
# (can also be done via \(gagit \-C somerepo status\(ga)
GIT_DIR=somerepo git status
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, fish will first set the variable and then perform other expansions on the line, so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set foo banana
foo=gagaga echo $foo
# prints gagaga, while in other shells it might print \(dqbanana\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Multiple elements can be given in a brace expansion:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Call bash with a reasonable default path.
PATH={/usr,}/{s,}bin bash
.EE
.UNINDENT
.UNINDENT
.sp
Or with a glob:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Run vlc on all mp3 files in the current directory
# If no file exists it will still be run with no arguments
mp3s=*.mp3 vlc $mp3s
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, this does \fInot\fP inhibit any lookup (aliases or similar). Calling a command after setting a variable override will result in the exact same command being run.
.sp
This syntax is supported since fish 3.1.
.SS Universal Variables
.sp
Universal variables are variables that are shared between all the user\(aqs fish sessions on the computer.
All changes to universal variables are persistent and instantly propagated across fish sessions.
.sp
Universal variables are stored in the file \fB\&.config/fish/fish_variables\fP\&. Do not edit this file directly, as your edits may be overwritten. Edit the variables through fish scripts or by using fish interactively instead.
.sp
Do not append to universal variables in config.fish, because these variables will then get longer with each new shell instance. Instead, set them once at the command line.
.SS Exporting variables
.sp
Variables in fish can be exported, so they will be inherited by any commands started by fish. In particular, this is necessary for variables used to configure external commands like \fBPAGER\fP or \fBGOPATH\fP, but also for variables that contain general system settings like \fBPATH\fP or \fBLANGUAGE\fP\&. If an external command needs to know a variable, it needs to be exported. Exported variables are also often called \(dqenvironment variables\(dq.
.sp
This also applies to fish \- when it starts up, it receives environment variables from its parent (usually the terminal). These typically include system configuration like \fBPATH\fP and locale variables\&.
.sp
Variables can be explicitly set to be exported with the \fB\-x\fP or \fB\-\-export\fP switch, or not exported with the \fB\-u\fP or \fB\-\-unexport\fP switch.  The exporting rules when setting a variable are similar to the scoping rules for variables \- when an option is passed it is respected, otherwise the variable\(aqs existing state is used. If no option is passed and the variable didn\(aqt exist yet it is not exported.
.sp
As a naming convention, exported variables are in uppercase and unexported variables are in lowercase.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-gx ANDROID_HOME ~/.android # /opt/android\-sdk
set \-gx CDPATH . ~ (test \-e ~/Videos; and echo ~/Videos)
set \-gx EDITOR emacs \-nw
set \-gx GOPATH ~/dev/go
set \-gx GTK2_RC_FILES \(dq$XDG_CONFIG_HOME/gtk\-2.0/gtkrc\(dq
set \-gx LESSHISTFILE \(dq\-\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Note: Exporting is not a scope, but an additional state. It typically makes sense to make exported variables global as well, but local\-exported variables can be useful if you need something more specific than Overrides\&. They are \fIcopied\fP to functions so the function can\(aqt alter them outside, and still available to commands. Global variables are accessible to functions whether they are exported or not.
.SS Lists
.sp
Fish can store a list (or an \(dqarray\(dq if you wish) of multiple strings inside of a variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set mylist first second third
> printf \(aq%s\en\(aq $mylist # prints each element on its own line
first
second
third
.EE
.UNINDENT
.UNINDENT
.sp
To access one element of a list, use the index of the element inside of square brackets, like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo $PATH[3]
.EE
.UNINDENT
.UNINDENT
.sp
List indices start at 1 in fish, not 0 like in other languages. This is because it requires less subtracting of 1 and many common Unix tools like \fBseq\fP work better with it (\fBseq 5\fP prints 1 to 5, not 0 to 5). An invalid index is silently ignored resulting in no value (not even an empty string, no argument at all).
.sp
If you don\(aqt use any brackets, all the elements of the list will be passed to the command as separate items. This means you can iterate over a list with \fBfor\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in $PATH
    echo $i is in the path
end
.EE
.UNINDENT
.UNINDENT
.sp
This goes over every directory in \fBPATH\fP separately and prints a line saying it is in the path.
.sp
To create a variable \fBsmurf\fP, containing the items \fBblue\fP and \fBsmall\fP, write:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set smurf blue small
.EE
.UNINDENT
.UNINDENT
.sp
It is also possible to set or erase individual elements of a list:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Set smurf to be a list with the elements \(aqblue\(aq and \(aqsmall\(aq
set smurf blue small

# Change the second element of smurf to \(aqevil\(aq
set smurf[2] evil

# Erase the first element
set \-e smurf[1]

# Output \(aqevil\(aq
echo $smurf
.EE
.UNINDENT
.UNINDENT
.sp
If you specify a negative index when expanding or assigning to a list variable, the index will be taken from the \fIend\fP of the list. For example, the index \-1 is the last element of the list:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set fruit apple orange banana
> echo $fruit[\-1]
banana

> echo $fruit[\-2..\-1]
orange
banana

> echo $fruit[\-1..1] # reverses the list
banana
orange
apple
.EE
.UNINDENT
.UNINDENT
.sp
As you see, you can use a range of indices, see slices for details.
.sp
All lists are one\-dimensional and can\(aqt contain other lists, although it is possible to fake nested lists using dereferencing \- see variable expansion\&.
.sp
When a list is exported as an environment variable, it is either space or colon delimited, depending on whether it is a path variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-x smurf blue small
> set \-x smurf_PATH forest mushroom
> env | grep smurf
smurf=blue small
smurf_PATH=forest:mushroom
.EE
.UNINDENT
.UNINDENT
.sp
Fish automatically creates lists from all environment variables whose name ends in \fBPATH\fP (like \fBPATH\fP, \fBCDPATH\fP or \fBMANPATH\fP), by splitting them on colons. Other variables are not automatically split.
.sp
Lists can be inspected with the count \%<> or the contains \%<> commands:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> count $smurf
2

> contains blue $smurf
# blue was found, so it exits with status 0
# (without printing anything)

> echo $status
0

> contains \-i blue $smurf
1
.EE
.UNINDENT
.UNINDENT
.sp
A nice thing about lists is that they are passed to commands one element as one argument, so once you\(aqve set your list, you can pass it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l grep_args \-r \(dqmy string\(dq
grep $grep_args . # will run the same as \(gagrep \-r \(dqmy string\(dq\(ga .
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, fish does not do \(dqword splitting\(dq \- elements in a list stay as they are, even if they contain spaces or tabs.
.SS Argument Handling
.sp
An important list is \fB$argv\fP, which contains the arguments to a function or script. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function myfunction
    echo $argv[1]
    echo $argv[3]
end
.EE
.UNINDENT
.UNINDENT
.sp
This function takes whatever arguments it gets and prints the first and third:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> myfunction first second third
first
third

> myfunction apple cucumber banana
apple
banana
.EE
.UNINDENT
.UNINDENT
.sp
That covers the positional arguments, but commandline tools often get various options and flags, and $argv would contain them intermingled with the positional arguments. Typical unix argument handling allows short options (\fB\-h\fP, also grouped like in \fBls \-lah\fP), long options (\fB\-\-help\fP) and allows those options to take arguments (\fB\-\-color=auto\fP or \fB\-\-position anywhere\fP or \fBcomplete \-C\(dqgit \(dq\fP) as well as a \fB\-\-\fP separator to signal the end of options. Handling all of these manually is tricky and error\-prone.
.sp
A more robust approach to option handling is argparse \%<>, which checks the defined options and puts them into various variables, leaving only the positional arguments in $argv. Here\(aqs a simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function mybetterfunction
    # We tell argparse about \-h/\-\-help and \-s/\-\-second
    # \- these are short and long forms of the same option.
    # The \(dq\-\-\(dq here is mandatory,
    # it tells it from where to read the arguments.
    argparse h/help s/second \-\- $argv
    # exit if argparse failed because
    # it found an option it didn\(aqt recognize
    # \- it will print an error
    or return

    # If \-h or \-\-help is given, we print a little help text and return
    if set \-ql _flag_help
        echo \(dqmybetterfunction [\-h|\-\-help] [\-s|\-\-second] [ARGUMENT ...]\(dq
        return 0
    end

    # If \-s or \-\-second is given, we print the second argument,
    # not the first and third.
    # (this is also available as _flag_s because of the short version)
    if set \-ql _flag_second
        echo $argv[2]
    else
        echo $argv[1]
        echo $argv[3]
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
The options will be \fIremoved\fP from $argv, so $argv[2] is the second \fIpositional\fP argument now:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> mybetterfunction first \-s second third
second
.EE
.UNINDENT
.UNINDENT
.sp
For more information on argparse, like how to handle option arguments, see the argparse documentation \%<>\&.
.SS PATH variables
.sp
Path variables are a special kind of variable used to support colon\-delimited path lists including \fBPATH\fP, \fBCDPATH\fP, \fBMANPATH\fP, \fBPYTHONPATH\fP, \fBLANGUAGE\fP (for localization \%<>) etc. All variables that end in \(dqPATH\(dq (case\-sensitive) become PATH variables by default.
.sp
PATH variables act as normal lists, except they are implicitly joined and split on colons.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set MYPATH 1 2 3
echo \(dq$MYPATH\(dq
# 1:2:3
set MYPATH \(dq$MYPATH:4:5\(dq
echo $MYPATH
# 1 2 3 4 5
echo \(dq$MYPATH\(dq
# 1:2:3:4:5
.EE
.UNINDENT
.UNINDENT
.sp
Path variables will also be exported in the colon form, so \fBset \-x MYPATH 1 2 3\fP will have external commands see it as \fB1:2:3\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-gx MYPATH /bin /usr/bin /sbin
> env | grep MYPATH
MYPATH=/bin:/usr/bin:/sbin
.EE
.UNINDENT
.UNINDENT
.sp
This is for compatibility with other tools. Unix doesn\(aqt have variables with multiple elements, the closest thing it has are colon\-lists like \fBPATH\fP\&. For obvious reasons this means no element can contain a \fB:\fP\&.
.sp
Variables can be marked or unmarked as PATH variables via the \fB\-\-path\fP and \fB\-\-unpath\fP options to \fBset\fP\&.
.SS Special variables
.sp
You can change the settings of fish by changing the values of certain variables.
.INDENT 0.0
.TP
.B PATH
A list of directories in which to search for commands. This is a common unix variable also used by other tools.
.UNINDENT
.INDENT 0.0
.TP
.B CDPATH
A list of directories in which the cd \%<> builtin looks for a new directory.
.UNINDENT
.INDENT 0.0
.TP
.B Locale Variables
Locale variables such as \fBLANG\fP, \fBLC_ALL\fP, \fBLC_MESSAGES\fP, \fBLC_NUMERIC\fP and \fBLC_TIME\fP set the language option for the shell and subprograms.
See the section Locale variables and status language \%<#\:status-language> for more information.
.UNINDENT
.INDENT 0.0
.TP
.B Color variables
A number of variable starting with the prefixes \fBfish_color\fP and \fBfish_pager_color\fP\&. See Variables for changing highlighting colors \%<#\:variables-color> for more information.
.UNINDENT
.INDENT 0.0
.TP
.B fish_term24bit
If this is set to 0, fish will not output 24\-bit RGB true\-color sequences but the nearest color on the 256 color palette (or the 16 color palette, if \fBfish_term256\fP is 0).
See also set_color \%<>\&.
The default is 1 but for historical reasons, fish defaults to behaving as if it was 0 on some terminals that are known to not support true\-color sequences.
.UNINDENT
.INDENT 0.0
.TP
.B fish_term256
If this is set to 0 and \fBfish_term24bit\fP is 0, translate RGB colors down to the 16 color palette.
Also, if this is set to 0, set_color \%<> commands such as \fBset_color ff0000 red\fP will prefer the named color.
.UNINDENT
.INDENT 0.0
.TP
.B fish_ambiguous_width
controls the computed width of ambiguous\-width characters. This should be set to 1 if your terminal renders these characters as single\-width (typical), or 2 if double\-width.
.UNINDENT
.INDENT 0.0
.TP
.B fish_emoji_width
controls whether fish assumes emoji render as 2 cells or 1 cell wide. This is necessary because the correct value changed from 1 to 2 in Unicode 9, and some terminals may not be aware. Set this if you see graphical glitching related to emoji (or other \(dqspecial\(dq characters). It defaults to 2.
.UNINDENT
.INDENT 0.0
.TP
.B fish_autosuggestion_enabled
controls if Autosuggestions \%<#\:autosuggestions> are enabled. Set it to 0 to disable, anything else to enable. By default they are on.
.UNINDENT
.INDENT 0.0
.TP
.B fish_transient_prompt
If this is set to 1, fish will redraw prompts with a \fB\-\-final\-rendering\fP argument before running a commandline, allowing you to change it before pushing it to the scrollback. This enables transient prompts \%<#\:transient-prompt>\&.
.UNINDENT
.INDENT 0.0
.TP
.B fish_handle_reflow
determines whether fish should try to repaint the commandline when the terminal resizes. In terminals that reflow text this should be disabled. Set it to 1 to enable, anything else to disable.
.UNINDENT
.INDENT 0.0
.TP
.B fish_key_bindings
the name of the function that sets up the keyboard shortcuts for the command\-line editor \%<#\:editor>\&.
.UNINDENT
.INDENT 0.0
.TP
.B fish_escape_delay_ms
sets how long fish waits for another key after seeing an escape, to distinguish pressing the escape key from the start of an escape sequence. The default is 30ms. Increasing it increases the latency but allows pressing escape instead of alt for alt+character bindings. For more information, see the chapter in the bind documentation \%<#\:cmd-bind-escape>\&.
.UNINDENT
.INDENT 0.0
.TP
.B fish_sequence_key_delay_ms
sets how long fish waits for another key after seeing a key that is part of a longer sequence, to disambiguate. For instance if you had bound \fB\ecx\ece\fP to open an editor, fish would wait for this long in milliseconds to see a ctrl\-e after a ctrl\-x. If the time elapses, it will handle it as a ctrl\-x (by default this would copy the current commandline to the clipboard). See also Key sequences \%<#\:interactive-key-sequences>\&.
.UNINDENT
.INDENT 0.0
.TP
.B fish_complete_path
determines where fish looks for completion. When trying to complete for a command, fish looks for files in the directories in this variable.
.UNINDENT
.INDENT 0.0
.TP
.B fish_cursor_selection_mode
controls whether the selection is inclusive or exclusive of the character under the cursor (see Copy and Paste \%<#\:killring>).
.UNINDENT
.INDENT 0.0
.TP
.B fish_function_path
determines where fish looks for functions. When fish autoloads a function, it will look for files in these directories.
.UNINDENT
.INDENT 0.0
.TP
.B fish_greeting
the greeting message printed on startup. This is printed by a function of the same name that can be overridden for more complicated changes (see funced \%<>)
.UNINDENT
.INDENT 0.0
.TP
.B fish_history
the current history session name. If set, all subsequent commands within an
interactive fish session will be logged to a separate file identified by the value of the
variable. If unset, the default session name \(dqfish\(dq is used. If set to an
empty string, history is not saved to disk (but is still available within the interactive
session).
.UNINDENT
.INDENT 0.0
.TP
.B fish_trace
if set and not empty, will cause fish to print commands before they execute, similar to \fBset \-x\fP in bash.
The trace is printed to the path given by the \fI\-\-debug\-output\fP option to fish or the \fBFISH_DEBUG_OUTPUT\fP variable.
It goes to stderr by default.
Set it to \fBall\fP to also trace execution of key bindings, event handlers as well as prompt and title functions.
.UNINDENT
.INDENT 0.0
.TP
.B FISH_DEBUG
Controls which debug categories \fBfish\fP enables for output, analogous to the \fB\-\-debug\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B FISH_DEBUG_OUTPUT
Specifies a file to direct debug output to.
.UNINDENT
.INDENT 0.0
.TP
.B fish_user_paths
a list of directories that are prepended to \fBPATH\fP\&. This can be a universal variable.
.UNINDENT
.INDENT 0.0
.TP
.B umask
the current file creation mask. The preferred way to change the umask variable is through the umask \%<> function. An attempt to set umask to an invalid value will always fail.
.UNINDENT
.INDENT 0.0
.TP
.B SHELL_PROMPT_PREFIX
if set, this string is automatically prepended to the left prompt. This is a standard environment variable that may be set by tools like systemd\(aqs \fBrun0\fP to indicate special shell sessions.
.UNINDENT
.INDENT 0.0
.TP
.B SHELL_PROMPT_SUFFIX
if set, this string is automatically appended to the left prompt. This is a standard environment variable that may be set by tools like systemd\(aqs \fBrun0\fP to indicate special shell sessions.
.UNINDENT
.INDENT 0.0
.TP
.B SHELL_WELCOME
if set, this string is displayed when an interactive shell starts, after the greeting. This is a standard environment variable that may be set by tools like systemd\(aqs \fBrun0\fP to display session information.
.UNINDENT
.INDENT 0.0
.TP
.B BROWSER
your preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation.
.UNINDENT
.sp
Fish also provides additional information through the values of certain environment variables. Most of these variables are read\-only and their value can\(aqt be changed with \fBset\fP\&.
.INDENT 0.0
.TP
.B _
the name of the currently running command (though this is deprecated, and the use of \fBstatus current\-command\fP is preferred).
.UNINDENT
.INDENT 0.0
.TP
.B argv
a list of arguments to the shell or function. \fBargv\fP is only defined when inside a function call, or if fish was invoked with a list of arguments, like \fBfish myscript.fish foo bar\fP\&. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B argv_opts
argparse \%<> sets this to the list of successfully parsed options, including option\-arguments. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B CMD_DURATION
the runtime of the last command in milliseconds.
.UNINDENT
.INDENT 0.0
.TP
.B COLUMNS and LINES
the current size of the terminal in height and width. These values are only used by fish if the operating system does not report the size of the terminal. Both variables must be set in that case otherwise a default of 80x24 will be used. They are updated when the window size changes.
.UNINDENT
.INDENT 0.0
.TP
.B fish_kill_signal
the signal that terminated the last foreground job, or 0 if the job exited normally.
.UNINDENT
.INDENT 0.0
.TP
.B fish_killring
a list of entries in fish\(aqs kill ring \%<#\:killring> of cut text.
.UNINDENT
.INDENT 0.0
.TP
.B fish_read_limit
how many bytes fish will process with read \%<> or in a command substitution\&.
.UNINDENT
.INDENT 0.0
.TP
.B fish_pid
the process ID (PID) of the shell.
.UNINDENT
.INDENT 0.0
.TP
.B fish_terminal_color_theme
a read\-only variable;
set to \fBlight\fP or \fBdark\fP when the terminal uses a light or dark color theme respectively;
set to \fBunknown\fP if the terminal does not report its colors \%<#\:term-compat-query-background-color>\&.
Like status terminal \%<#\:status-terminal>, this is only populated once the first interactive prompt is shown.
This is used in an \-\-on\-variable event handler to update syntax highlighting \%<#\:syntax-highlighting> variables whenever the terminal\(aqs color theme changes.
See here \%<#\:fish-config-theme-files> for how to specify \fBlight\fP and \fBdark\fP variants in your theme.
.UNINDENT
.INDENT 0.0
.TP
.B history
a list containing the last commands that were entered.
.UNINDENT
.INDENT 0.0
.TP
.B HOME
the user\(aqs home directory. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B hostname
the machine\(aqs hostname.
.UNINDENT
.INDENT 0.0
.TP
.B IFS
the internal field separator that is used for word splitting with the read \%<> builtin. Setting this to the empty string will also disable line splitting in command substitution\&. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B last_pid
the process ID (PID) of the last background process.
.UNINDENT
.INDENT 0.0
.TP
.B PWD
the current working directory.
.UNINDENT
.INDENT 0.0
.TP
.B pipestatus
a list of exit statuses of all processes that made up the last executed pipe. See exit status\&.
.UNINDENT
.INDENT 0.0
.TP
.B SHLVL
the level of nesting of shells. Fish increments this in interactive shells, otherwise it only passes it along.
.UNINDENT
.INDENT 0.0
.TP
.B status
the exit status of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
.UNINDENT
.INDENT 0.0
.TP
.B status_generation
the \(dqgeneration\(dq count of \fB$status\fP\&. This will be incremented only when the previous command produced an explicit status. (For example, background jobs will not increment this).
.UNINDENT
.INDENT 0.0
.TP
.B USER
the current username. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B EUID
the current effective user id, set by fish at startup. This variable can be changed.
.UNINDENT
.INDENT 0.0
.TP
.B version
the version of the currently running fish (also available as \fBFISH_VERSION\fP for backward compatibility).
.UNINDENT
.sp
As a convention, an uppercase name is usually used for exported variables, while lowercase variables are not exported. (\fBCMD_DURATION\fP is an exception for historical reasons). This rule is not enforced by fish, but it is good coding practice to use casing to distinguish between exported and unexported variables.
.sp
Fish also uses some variables internally, their name usually starting with \fB__fish\fP\&. These are internal and should not typically be modified directly.
.SS The status variable
.sp
Whenever a process exits, an exit status is returned to the program that started it (usually the shell). This exit status is an integer number, which tells the calling application how the execution of the command went. In general, a zero exit status means that the command executed without problem, but a non\-zero exit status means there was some form of problem.
.sp
Fish stores the exit status of the last process in the last job to exit in the \fBstatus\fP variable.
.sp
If fish encounters a problem while executing a command, the status variable may also be set to a specific value:
.INDENT 0.0
.IP \(bu 2
0 is generally the exit status of commands if they successfully performed the requested operation.
.IP \(bu 2
1 is generally the exit status of commands if they failed to perform the requested operation.
.IP \(bu 2
121 is generally the exit status of commands if they were supplied with invalid arguments.
.IP \(bu 2
123 means that the command was not executed because the command name contained invalid characters.
.IP \(bu 2
124 means that the command was not executed because none of the wildcards in the command produced any matches.
.IP \(bu 2
125 means that while an executable with the specified name was located, the operating system could not actually execute the command.
.IP \(bu 2
126 means that while a file with the specified name was located, it was not executable.
.IP \(bu 2
127 means that no function, builtin or command with the given name could be located.
.UNINDENT
.sp
If a process exits through a signal, the exit status will be 128 plus the number of the signal.
.sp
The status can be negated with not \%<> (or \fB!\fP), which is useful in a condition\&. This turns a status of 0 into 1 and any non\-zero status into 0.
.sp
There is also \fB$pipestatus\fP, which is a list of all \fBstatus\fP values of processes in a pipe. One difference is that not \%<> applies to \fB$status\fP, but not \fB$pipestatus\fP, because it loses information.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
not cat file | grep \-q fish
echo status is: $status pipestatus is $pipestatus
.EE
.UNINDENT
.UNINDENT
.sp
Here \fB$status\fP reflects the status of \fBgrep\fP, which returns 0 if it found something, negated with \fBnot\fP (so 1 if it found something, 0 otherwise). \fB$pipestatus\fP reflects the status of \fBcat\fP (which returns non\-zero for example when it couldn\(aqt find the file) and \fBgrep\fP, without the negation.
.sp
So if both \fBcat\fP and \fBgrep\fP succeeded, \fB$status\fP would be 1 because of the \fBnot\fP, and \fB$pipestatus\fP would be 0 and 0.
.sp
It\(aqs possible for the first command to fail while the second succeeds. One common example is when the second program quits early.
.sp
For example, if you have a pipeline like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cat file1 file2 | head \-n 50
.EE
.UNINDENT
.UNINDENT
.sp
This will tell \fBcat\fP to print two files, \(dqfile1\(dq and \(dqfile2\(dq, one after the other, and the \fBhead\fP will then only print the first 50 lines. In this case you might often see this constellation:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cat file1 file2 | head \-n 50
# 50 lines of output
> echo $pipestatus
141 0
.EE
.UNINDENT
.UNINDENT
.sp
Here, the \(dq141\(dq signifies that \fBcat\fP was killed by signal number 13 (128 + 13 == 141) \- a \fBSIGPIPE\fP\&. You can also use \fBfish_kill_signal\fP to see the signal number. This happens because it was still working, and then \fBhead\fP closed the pipe, so \fBcat\fP received a signal that it didn\(aqt ignore and so it died.
.sp
Whether \fBcat\fP here will see a SIGPIPE depends on how long the file is and how much it writes at once, so you might see a pipestatus of \(dq0 0\(dq, depending on the implementation. This is a general unix issue and not specific to fish. Some shells feature a \(dqpipefail\(dq feature that will call a pipeline failed if one of the processes in it failed, and this is a big problem with it.
.SS Locale Variables
.sp
The \(dqlocale\(dq of a program is its set of language and regional settings.
In UNIX, these are made up of several categories. The categories used by fish are:
.INDENT 0.0
.TP
.B LANG
This is the typical environment variable for specifying a locale.
A user may set this variable to express the language they speak, their region, and a character encoding.
The encoding part is ignored, fish always assumes UTF\-8. The actual values are specific to their platform, except for special values like \fBC\fP or \fBPOSIX\fP\&.
.sp
The value of \fBLANG\fP is used for each category unless the variable for that category was set or \fBLC_ALL\fP is set. So typically you only need to set LANG.
.sp
Example values are \fBen_US.UTF\-8\fP for the American English or \fBde_AT.UTF\-8\fP for Austrian German.
Your operating system might have a \fBlocale\fP command that you can call as \fBlocale \-a\fP to see a list of defined locales.
.UNINDENT
.INDENT 0.0
.TP
.B LANGUAGE
This is treated like \fBLC_MESSAGES\fP except that it can hold multiple values,
which allows to specify a priority list of languages for translation.
It\(aqs a PATH variable, like in GNU gettext \%<https://\:www\:.gnu\:.org/\:software/\:gettext/\:manual/\:html_node/\:The-LANGUAGE-variable\:.html>\&.
.sp
Language identifiers without a region specified (e.g. \fBzh\fP) result in all available variants of this language being tried in arbitrary order.
In this example, we might first look for messages in the \fBzh_CN\fP catalog, followed by \fBzh_TW\fP, or the other way around.
This is different from GNU gettext, which uses a \(dqdefault\(dq variant of the language instead.
If you prefer a certain variant, specify it earlier in the list,
e.g. \fBzh_TW:zh\fP if your preferred language is \fBzh_TW\fP, and you prefer any other variants of \fBzh\fP over the English default.
If \fBzh_TW\fP is the only variant of \fBzh\fP you want,
specifying \fBzh_TW\fP in the \fBLANGUAGE\fP variable will result in messages which are not available in \fBzh_TW\fP being displayed in English.
.sp
See also builtin _ (underscore) \%<>\&.
.UNINDENT
.INDENT 0.0
.TP
.B LC_ALL
Overrides the \fBLANG\fP and all other \fBLC_*\fP variables.
Please use \fBLC_ALL\fP only as a temporary override.
.UNINDENT
.INDENT 0.0
.TP
.B LC_MESSAGES
Determines the language in which messages are displayed, see builtin _ (underscore) \%<>\&.
.UNINDENT
.INDENT 0.0
.TP
.B LC_NUMERIC
Sets the locale for formatting numbers \%<>\&.
.UNINDENT
.INDENT 0.0
.TP
.B LC_TIME
Determines how date and time are displayed.
Used in the history \%<#\:history-show-time> builtin.
.UNINDENT
.SS Builtin commands
.sp
Fish includes a number of commands in the shell directly. We call these \(dqbuiltins\(dq. These include:
.INDENT 0.0
.IP \(bu 2
Builtins that manipulate the shell state \- cd \%<> changes directory, set \%<> sets variables
.IP \(bu 2
Builtins for dealing with data, like string \%<> for strings and math \%<> for numbers, count \%<> for counting lines or arguments, path \%<> for dealing with path
.IP \(bu 2
status \%<> for asking about the shell\(aqs status
.IP \(bu 2
printf \%<> and echo \%<> for creating output
.IP \(bu 2
test \%<> for checking conditions
.IP \(bu 2
argparse \%<> for parsing function arguments
.IP \(bu 2
source \%<> to read a script in the current shell (so changes to variables stay) and eval \%<> to execute a string as script
.IP \(bu 2
random \%<> to get random numbers or pick a random element from a list
.IP \(bu 2
read \%<> for reading from a pipe or the terminal
.UNINDENT
.sp
For a list of all builtins, use \fBbuiltin \-n\fP\&.
.sp
For a list of all builtins, functions and commands shipped with fish, see the list of commands \%<>\&. The documentation is also available by using the \fB\-\-help\fP switch.
.SS Command lookup
.sp
When fish is told to run something, it goes through multiple steps to find it.
.sp
If it contains a \fB/\fP, fish tries to execute the given file, from the current directory on.
.sp
If it doesn\(aqt contain a \fB/\fP, it could be a function, builtin, or external command, and so fish goes through the full lookup.
.sp
In order:
.INDENT 0.0
.IP 1. 3
It tries to resolve it as a function\&.
.INDENT 3.0
.IP \(bu 2
If the function is already known, it uses that
.IP \(bu 2
If there is a file of the name with a \(dq.fish\(dq suffix in \fBfish_function_path\fP, it loads that\&. (If there is more than one file only the first is used)
.IP \(bu 2
If the function is now defined it uses that
.UNINDENT
.IP 2. 3
It tries to resolve it as a builtin\&.
.IP 3. 3
It tries to find an executable file in \fBPATH\fP\&.
.INDENT 3.0
.IP \(bu 2
If it finds a file, it tells the kernel to run it.
.IP \(bu 2
If the kernel knows how to run the file (e.g. via a \fB#!\fP line \- \fB#!/bin/sh\fP or \fB#!/usr/bin/python\fP), it does it.
.IP \(bu 2
If the kernel reports that it couldn\(aqt run it because of a missing interpreter, and the file passes a rudimentary check, fish tells \fB/bin/sh\fP to run it.
.UNINDENT
.UNINDENT
.sp
If none of these work, fish runs the function fish_command_not_found \%<> and sets \fBstatus\fP to 127.
.sp
You can use type \%<> to see how fish resolved something:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> type \-\-short \-\-all echo
echo is a builtin
echo is /usr/bin/echo
.EE
.UNINDENT
.UNINDENT
.SS Querying for user input
.sp
Sometimes, you want to ask the user for input, for instance to confirm something. This can be done with the read \%<> builtin.
.sp
Let\(aqs make up an example. This function will glob the files in all the directories it gets as arguments, and if there are more than five \%<> it will ask the user if it is supposed to show them, but only if it is connected to a terminal:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function show_files
    # This will glob on all arguments. Any non\-directories will be ignored.
    set \-l files $argv/*

    # If there are more than 5 files
    if test (count $files) \-gt 5
        # and both stdin (for reading input)
        # and stdout (for writing the prompt)
        # are terminals
        and isatty stdin
        and isatty stdout
        # Keep asking until we get a valid response
        while read \-\-nchars 1 \-l response \-\-prompt\-str=\(dqAre you sure? (y/n)\(dq
              or return 1 # if the read was aborted with ctrl\-c/ctrl\-d
            switch $response
                case y Y
                    echo Okay
                    # We break out of the while and go on with the function
                    break
                case n N
                    # We return from the function without printing
                    echo Not showing
                    return 1
                case \(aq*\(aq
                    # We go through the while loop and ask again
                    echo Not valid input
                    continue
            end
        end
    end

    # And now we print the files
    printf \(aq%s\en\(aq $files
end
.EE
.UNINDENT
.UNINDENT
.sp
If you run this as \fBshow_files /\fP, it will most likely ask you until you press Y/y or N/n. If you run this as \fBshow_files / | cat\fP, it will print the files without asking. If you run this as \fBshow_files .\fP, it might print something without asking because there are fewer than five files.
.SS Shell variable and function names
.sp
The names given to variables and functions (so\-called \(dqidentifiers\(dq) have to follow certain rules:
.INDENT 0.0
.IP \(bu 2
A variable name cannot be empty. It can contain only letters, digits, and underscores. It may begin and end with any of those characters.
.IP \(bu 2
A function name cannot be empty. It may not begin with a hyphen (\(dq\-\(dq) and may not contain a slash (\(dq/\(dq). All other characters, including a space, are valid. A function name also can\(aqt be the same as a reserved keyword or essential builtin like \fBif\fP or \fBset\fP\&.
.IP \(bu 2
A bind mode name (e.g., \fBbind \-m abc ...\fP) must be a valid variable name.
.UNINDENT
.sp
Other things have other restrictions. For instance what is allowed for file names depends on your system, but at the very least they cannot contain a \(dq/\(dq (because that is the path separator) or NULL byte (because that is how UNIX ends strings).
.SS Configuration files
.sp
When fish is started, it reads and runs its configuration files. Where these are depends on build configuration and environment variables.
.sp
The main file is \fB~/.config/fish/config.fish\fP (or more precisely \fB$XDG_CONFIG_HOME/fish/config.fish\fP).
.sp
Configuration files are run in the following order:
.INDENT 0.0
.IP \(bu 2
Configuration snippets (named \fB*.fish\fP) in the directories:
.INDENT 2.0
.IP \(bu 2
\fB$__fish_config_dir/conf.d\fP (by default, \fB~/.config/fish/conf.d/\fP)
.IP \(bu 2
\fB$__fish_sysconf_dir/conf.d\fP (by default, \fB/etc/fish/conf.d/\fP)
.IP \(bu 2
Directories for others to ship configuration snippets for their software:
.INDENT 2.0
.IP \(bu 2
the directories under \fB$__fish_user_data_dir\fP (usually \fB~/.local/share/fish\fP, controlled by the \fBXDG_DATA_HOME\fP environment variable)
.IP \(bu 2
a \fBfish/vendor_conf.d\fP directory in the directories listed in \fB$XDG_DATA_DIRS\fP (default \fB/usr/share/fish/vendor_conf.d\fP and \fB/usr/local/share/fish/vendor_conf.d\fP)
.UNINDENT
.sp
These directories are also accessible in \fB$__fish_vendor_confdirs\fP\&.
Note that changing that in a running fish won\(aqt do anything as by that point the directories have already been read.
.UNINDENT
.sp
If there are multiple files with the same name in these directories, only the first will be executed.
They are executed in order of their filename, sorted (like globs) in a natural order (i.e. \(dq01\(dq sorts before \(dq2\(dq).
.IP \(bu 2
System\-wide configuration files, where administrators can include initialization for all users on the system \- similar to \fB/etc/profile\fP for POSIX\-style shells \- in \fB$__fish_sysconf_dir\fP (usually \fB/etc/fish/config.fish\fP).
.IP \(bu 2
User configuration, usually in \fB~/.config/fish/config.fish\fP (controlled by the \fBXDG_CONFIG_HOME\fP environment variable, and accessible as \fB$__fish_config_dir\fP).
.UNINDENT
.sp
\fB~/.config/fish/config.fish\fP is sourced \fIafter\fP the snippets. This is so you can copy snippets and override some of their behavior.
.sp
These files are all executed on the startup of every shell. If you want to run a command only on starting an interactive shell, use the exit status of the command \fBstatus \-\-is\-interactive\fP to determine if the shell is interactive. If you want to run a command only when using a login shell, use \fBstatus \-\-is\-login\fP instead. This will speed up the starting of non\-interactive or non\-login shells.
.sp
If you are developing another program, you may want to add configuration for all users of fish on a system. This is discouraged; if not carefully written, they may have side\-effects or slow the startup of the shell. Additionally, users of other shells won\(aqt benefit from the fish\-specific configuration. However, if they are required, you can install them to the \(dqvendor\(dq configuration directory. As this path may vary from system to system, \fBpkg\-config\fP should be used to discover it: \fBpkg\-config \-\-variable confdir fish\fP\&.
.sp
For system integration, fish also ships a file called \fB__fish_build_paths.fish\fP\&. This can be customized during build, for instance because your system requires special paths to be used.
.SS Future feature flags
.sp
Feature flags are how fish stages changes that might break scripts. Breaking changes are introduced as opt\-in, in a few releases they become opt\-out, and eventually the old behavior is removed.
.sp
You can see the current list of features via \fBstatus features\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> status features
stderr\-nocaret          on  3.0 ^ no longer redirects stderr
qmark\-noglob            on  3.0 ? no longer globs
regex\-easyesc           on  3.1 string replace \-r needs fewer \e\e\(aqs
ampersand\-nobg\-in\-token on  3.4 & only backgrounds if followed by a separating character
remove\-percent\-self     off 4.0 %self is no longer expanded (use $fish_pid)
test\-require\-arg        off 4.0 builtin test requires an argument
mark\-prompt             on  4.0 write OSC 133 prompt markers to the terminal
ignore\-terminfo         on  4.1 do not look up $TERM in terminfo database
query\-term              on  4.1 query the TTY to enable extra functionality
omit\-term\-workarounds   off 4.3 skip workarounds for incompatible terminals
.EE
.UNINDENT
.UNINDENT
.sp
Here is what they mean:
.INDENT 0.0
.IP \(bu 2
\fBstderr\-nocaret\fP was introduced in fish 3.0 and cannot be turned off since fish 3.5. It can still be tested for compatibility, but a \fBno\-stderr\-nocaret\fP value will be ignored. The flag made \fB^\fP an ordinary character instead of denoting an stderr redirection. Use \fB2>\fP instead.
.IP \(bu 2
\fBqmark\-noglob\fP was also introduced in fish 3.0 (and made the default in 4.0). It makes \fB?\fP an ordinary character instead of a single\-character glob. Use a \fB*\fP instead (which will match multiple characters) or find other ways to match files like \fBfind\fP\&.
.IP \(bu 2
\fBregex\-easyesc\fP was introduced in 3.1 (and made the default in 3.5). It makes it so the replacement expression in \fBstring replace \-r\fP does one fewer round of escaping. Before, to escape a backslash you would have to use \fBstring replace \-ra \(aq([ab])\(aq \(aq\e\e\e\e\e\e\e\e$1\(aq\fP\&. After, just \fB\(aq\e\e\e\e$1\(aq\fP is enough. Check your \fBstring replace\fP calls if you use this anywhere.
.IP \(bu 2
\fBampersand\-nobg\-in\-token\fP was introduced in fish 3.4 (and made the default in 3.5). It makes it so a \fB&\fP is no longer interpreted as the backgrounding operator in the middle of a token, so dealing with URLs becomes easier. Either put spaces or a semicolon after the \fB&\fP\&. This is recommended formatting anyway, and \fBfish_indent\fP will have done it for you already.
.IP \(bu 2
\fBremove\-percent\-self\fP turns off the special \fB%self\fP expansion. It was introduced in 4.0. To get fish\(aqs pid, you can use the \fBfish_pid\fP variable.
.IP \(bu 2
\fBtest\-require\-arg\fP removes builtin test \%<>\(aqs one\-argument form (\fBtest \(dqstring\(dq\fP\&. It was introduced in 4.0. To test if a string is non\-empty, use \fBtest \-n \(dqstring\(dq\fP\&. If disabled, any call to \fBtest\fP that would change sends a debug message \%<#\:debugging-fish> of category \(dqdeprecated\-test\(dq, so starting fish with \fBfish \-\-debug=deprecated\-test\fP can be used to find offending calls.
.IP \(bu 2
\fBmark\-prompt\fP makes fish report to the terminal the beginning and end of both shell prompts and command output.
.IP \(bu 2
\fBignore\-terminfo\fP was introduced in fish 4.1 and cannot be turned off since fish 4.5. It can still be tested for compatibility, but a \fBno\-ignore\-terminfo\fP value will be ignored. The flag disabled lookup of $TERM in the terminfo database.
.IP \(bu 2
\fBquery\-term\fP allows fish to query the terminal by writing escape sequences and reading the terminal\(aqs response.
This enables features such as scrolling \%<#\:term-compat-cursor-position-report>\&.
If you use an incompatible terminal, you can \-\- for the time being \-\- work around it by running (once) \fBset \-Ua fish_features no\-query\-term\fP\&.
.IP \(bu 2
\fBomit\-term\-workarounds\fP prevents fish from trying to work around incompatible terminals.
.UNINDENT
.sp
These changes are introduced off by default. They can be enabled on a per session basis:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-\-features qmark\-noglob,regex\-easyesc
.EE
.UNINDENT
.UNINDENT
.sp
or opted into globally for a user:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-U fish_features regex\-easyesc qmark\-noglob
.EE
.UNINDENT
.UNINDENT
.sp
Features will only be set on startup, so this variable will only take effect if it is universal or exported.
.sp
You can also use the version as a group, so \fB3.0\fP is equivalent to \(dqstderr\-nocaret\(dq and \(dqqmark\-noglob\(dq. Instead of a version, the special group \fBall\fP enables all features.
.sp
Prefixing a feature with \fBno\-\fP turns it off instead. E.g. to reenable the \fB?\fP single\-character glob:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features no\-qmark\-noglob
.EE
.UNINDENT
.UNINDENT
.SS Event handlers
.sp
When defining a new function in fish, it is possible to make it into an event handler, i.e. a function that is automatically run when a specific event takes place. Events that can trigger a handler currently are:
.INDENT 0.0
.IP \(bu 2
When a signal is delivered
.IP \(bu 2
When a job exits
.IP \(bu 2
When the value of a variable is updated
.IP \(bu 2
When the prompt is about to be shown
.UNINDENT
.sp
Example:
.sp
To specify a signal handler for the WINCH signal, write:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function my_signal_handler \-\-on\-signal WINCH
    echo Got WINCH signal!
end
.EE
.UNINDENT
.UNINDENT
.sp
Fish already has the following named events for the \fB\-\-on\-event\fP switch:
.INDENT 0.0
.IP \(bu 2
\fBfish_prompt\fP is emitted whenever a new fish prompt is about to be displayed.
.IP \(bu 2
\fBfish_preexec\fP is emitted right before executing an interactive command. The commandline is passed as the first parameter. Not emitted if command is empty.
.IP \(bu 2
\fBfish_posterror\fP is emitted right after executing a command with syntax errors. The commandline is passed as the first parameter.
.IP \(bu 2
\fBfish_postexec\fP is emitted right after executing an interactive command. The commandline is passed as the first parameter. Not emitted if command is empty.
.IP \(bu 2
\fBfish_exit\fP is emitted right before fish exits.
.IP \(bu 2
\fBfish_cancel\fP is emitted when a commandline is cleared.
.IP \(bu 2
\fBfish_focus_in\fP is emitted when fish\(aqs terminal gains focus.
.IP \(bu 2
\fBfish_focus_out\fP is emitted when fish\(aqs terminal loses focus.
.UNINDENT
.sp
Events can be fired with the emit \%<> command, and do not have to be defined before. The names just need to match. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function handler \-\-on\-event imdone
    echo generator is done $argv
end

function generator
    sleep 1
    # The \(dqimdone\(dq is the name of the event
    # the rest is the arguments to pass to the handler
    emit imdone with $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
If there are multiple handlers for an event, they will all be run, but the order might change between fish releases, so you should not rely on it.
.sp
Please note that event handlers only become active when a function is loaded, which means you need to otherwise source \%<> or execute a function instead of relying on autoloading\&. One approach is to put it into your configuration file\&.
.sp
For more information on how to define new event handlers, see the documentation for the function \%<> command.
.SS Debugging fish scripts
.sp
Fish includes basic built\-in debugging facilities that allow you to stop execution of a script at an arbitrary point. When this happens you are presented with an interactive prompt where you can execute any fish command to inspect or change state (there are no debug commands as such). For example, you can check or change the value of any variables using printf \%<> and set \%<>\&. As another example, you can run status print\-stack\-trace \%<> to see how the current breakpoint was reached. To resume normal execution of the script, type exit \%<> or \fBctrl\fP\-\fBd\fP\&.
.sp
To start a debug session insert the builtin command \%<> \fBbreakpoint\fP at the point in a function or script where you wish to gain control, then run the function or script. Also, the default action of the \fBTRAP\fP signal is to call this builtin, meaning a running script can be actively debugged by sending it the \fBTRAP\fP signal (\fBkill \-s TRAP <PID>\fP). There is limited support for interactively setting or modifying breakpoints from this debug prompt: it is possible to insert new breakpoints in (or remove old ones from) other functions by using the \fBfunced\fP function to edit the definition of a function, but it is not possible to add or remove a breakpoint from the function/script currently loaded and being executed.
.sp
Another way to debug script issues is to set the \fBfish_trace\fP variable, e.g. \fBfish_trace=1 fish_prompt\fP to see which commands fish executes when running the fish_prompt \%<> function.
.SS Profiling fish scripts
.sp
If you specifically want to debug performance issues, \fBfish\fP can be run with the \fB\-\-profile /path/to/profile.log\fP option to save a profile to the specified path. This profile log includes a breakdown of how long each step in the execution took.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-\-profile /tmp/sleep.prof \-ic \(aqsleep 3s\(aq
> cat /tmp/sleep.prof
Time    Sum     Command
3003419 3003419 > sleep 3s
.EE
.UNINDENT
.UNINDENT
.sp
This will show the time for each command itself in the first column, the time for the command and every subcommand (like any commands inside of a function or command substitutions) in the second and the command itself in the third, separated with tabs.
.sp
The time is given in microseconds.
.sp
To see the slowest commands last, \fBsort \-nk2 /path/to/logfile\fP is useful.
.sp
For profiling fish\(aqs startup there is also \fB\-\-profile\-startup /path/to/logfile\fP\&.
.sp
See fish \%<> for more information.
.SS Commands
.sp
This is a list of all the commands fish ships with.
.sp
Broadly speaking, these fall into a few categories:
.SS Keywords
.sp
Core language keywords that make up the syntax, like
.INDENT 0.0
.IP \(bu 2
if \%<> and else \%<> for conditions.
.IP \(bu 2
for \%<> and while \%<> for loops.
.IP \(bu 2
break \%<> and continue \%<> to control loops.
.IP \(bu 2
function \%<> to define functions.
.IP \(bu 2
return \%<> to return a status from a function.
.IP \(bu 2
begin \%<> to begin a block and end \%<> to end any block (including ifs and loops).
.IP \(bu 2
and \%<>, or \%<> and not \%<> to combine commands logically.
.IP \(bu 2
switch \%<> and case \%<> to make multiple blocks depending on the value of a variable.
.IP \(bu 2
command \%<> or builtin \%<> to tell fish what sort of thing to execute
.IP \(bu 2
time \%<> to time execution
.IP \(bu 2
exec \%<> tells fish to replace itself with a command.
.IP \(bu 2
end \%<> to end a block
.UNINDENT
.SS Tools
.sp
Builtins to do a task, like
.INDENT 0.0
.IP \(bu 2
cd \%<> to change the current directory.
.IP \(bu 2
echo \%<> or printf \%<> to produce output.
.IP \(bu 2
set_color \%<> to colorize output.
.IP \(bu 2
set \%<> to set, query or erase variables.
.IP \(bu 2
read \%<> to read input.
.IP \(bu 2
string \%<> for string manipulation.
.IP \(bu 2
path \%<> for filtering paths and handling their components.
.IP \(bu 2
math \%<> does arithmetic.
.IP \(bu 2
argparse \%<> to make arguments easier to handle.
.IP \(bu 2
count \%<> to count arguments.
.IP \(bu 2
type \%<> to find out what sort of thing (command, builtin or function) fish would call, or if it exists at all.
.IP \(bu 2
test \%<> checks conditions like if a file exists or a string is empty.
.IP \(bu 2
contains \%<> to see if a list contains an entry.
.IP \(bu 2
eval \%<> and source \%<> to run fish code from a string or file.
.IP \(bu 2
status \%<> to get shell information, like whether it\(aqs interactive or a login shell, or which file it is currently running.
.IP \(bu 2
abbr \%<> manages Abbreviations \%<#\:abbreviations>\&.
.IP \(bu 2
bind \%<> to change bindings.
.IP \(bu 2
complete \%<> manages completions \%<#\:tab-completion>\&.
.IP \(bu 2
commandline \%<> to get or change the commandline contents.
.IP \(bu 2
fish_config \%<> to easily change fish\(aqs configuration, like the prompt or colorscheme.
.IP \(bu 2
random \%<> to generate random numbers or pick from a list.
.UNINDENT
.SS Known functions
.sp
Known functions are a customization point. You can change them to change how your fish behaves. This includes:
.INDENT 0.0
.IP \(bu 2
fish_prompt \%<> and fish_right_prompt \%<> and fish_mode_prompt \%<> to print your prompt.
.IP \(bu 2
fish_command_not_found \%<> to tell fish what to do when a command is not found.
.IP \(bu 2
fish_title \%<> to change the terminal\(aqs title.
.IP \(bu 2
fish_tab_title \%<> to change the terminal tab\(aqs title.
.IP \(bu 2
fish_greeting \%<> to show a greeting when fish starts.
.IP \(bu 2
fish_should_add_to_history \%<> to determine if a command should be added to history
.UNINDENT
.SS Helper functions
.sp
Some helper functions, often to give you information for use in your prompt:
.INDENT 0.0
.IP \(bu 2
fish_git_prompt \%<> and fish_hg_prompt \%<> to print information about the current git or mercurial repository.
.IP \(bu 2
fish_vcs_prompt \%<> to print information for either.
.IP \(bu 2
fish_svn_prompt \%<> to print information about the current svn repository.
.IP \(bu 2
fish_status_to_signal \%<> to give a signal name from a return status.
.IP \(bu 2
prompt_pwd \%<> to give the current directory in a nicely formatted and shortened way.
.IP \(bu 2
prompt_login \%<> to describe the current login, with user and hostname, and to explain if you are in a chroot or connected via ssh.
.IP \(bu 2
prompt_hostname \%<> to give the hostname, shortened for use in the prompt.
.IP \(bu 2
fish_is_root_user \%<> to check if the current user is an administrator user like root.
.IP \(bu 2
fish_add_path \%<> to easily add a path to $PATH.
.IP \(bu 2
alias \%<> to quickly define wrapper functions (\(dqaliases\(dq).
.IP \(bu 2
fish_delta \%<> to show what you have changed from the default configuration.
.IP \(bu 2
export \%<> as a compatibility function for other shells.
.UNINDENT
.SS Helper commands
.sp
fish also ships some things as external commands so they can be easily called from elsewhere.
.sp
This includes fish_indent \%<> to format fish code and fish_key_reader \%<> to show you what escape sequence a keypress produces.
.SS The full list
.sp
And here is the full list:
.SS _ \- call fish\(aqs translations
.SS Synopsis
.nf
\fB_\fP \fISTRING\fP
.fi
.sp
.SS Description
.sp
\fB_\fP translates its arguments into the current language, if possible.
.sp
This only works with messages which are translated as part of fish\(aqs own sources, so using it as part of your own fish scripts which are not upstreamed into the fish repo will not work unless the exact same message also exists upstream.
.sp
It requires fish to be built with gettext support. If that support is disabled or there is no translation it will echo the argument back.
.sp
The language depends on the current locale, set with \fBLANG\fP \%<#\:envvar-LANG>, \fBLC_MESSAGES\fP \%<#\:envvar-LC_MESSAGES>, \fBLC_ALL\fP \%<#\:envvar-LC_ALL>, and \fBLANGUAGE\fP \%<#\:envvar-LANGUAGE>\&.
These variables do not have to be exported for fish to use them, and fish\(aqs variable scopes are supported.
If other programs launched via fish should respect these locale variables they have to be exported to make them available outside of fish.
.sp
For \fBLANGUAGE\fP \%<#\:envvar-LANGUAGE> you can use a list, or use colons to separate multiple languages.
.sp
If the status language set \%<#\:status-language> command was used, its arguments specify the language precedence, and the environment variables are ignored.
.SS Options
.sp
\fB_\fP takes no options.
.SS Examples
.sp
Use German translations:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set LANG de_DE.UTF\-8
> _ file
Datei
.EE
.UNINDENT
.UNINDENT
.sp
Specify a precedence of languages (only works with \fBLANGUAGE\fP \%<#\:envvar-LANGUAGE>):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set LANGUAGE pt de
> _ file  # This message has a Portuguese translation.
arquivo
> _ \(dqInvalid arguments\(dq  # This message does not have a Portuguese translation, but a German one.
Ungültige Argumente
> _ untranslatable  # No translation in Portuguese, nor in German.
untranslatable
.EE
.UNINDENT
.UNINDENT
.sp
Note that the specific examples may change if translations are added/modified.
.SS abbr \- manage fish abbreviations
.SS Synopsis
.nf
\fBabbr\fP \fB\-\-add\fP \fINAME\fP [\fB\-\-position\fP \fBcommand\fP | \fBanywhere\fP] [\fB\-r\fP | \fB\-\-regex\fP \fIPATTERN\fP] [\fB\-c\fP | \fB\-\-command\fP \fICOMMAND\fP]
                [\fB\-\-set\-cursor\fP[\fB=\fP\fIMARKER\fP]] ([\fB\-f\fP | \fB\-\-function\fP \fIFUNCTION\fP] | \fIEXPANSION\fP)
\fBabbr\fP \fB\-\-erase\fP \fB[ \fP[\fB\-c\fP | \fB\-\-command\fP \fICOMMAND\fP]\&...\fB ]\fP \fINAME\fP \&...
\fBabbr\fP \fB\-\-rename\fP \fB[ \fP[\fB\-c\fP | \fB\-\-command\fP \fICOMMAND\fP]\&...\fB ]\fP \fIOLD_WORD\fP \fINEW_WORD\fP
\fBabbr\fP [\fB\-\-show\fP] [\fB\-\-color\fP \fIWHEN\fP]
\fBabbr\fP \fB\-\-list\fP
\fBabbr\fP \fB\-\-query\fP \fINAME\fP \&...
.fi
.sp
.SS Description
.sp
\fBabbr\fP manages abbreviations \- user\-defined words that are replaced with longer phrases when entered.
.sp
\fBNote:\fP
.INDENT 0.0
.INDENT 3.5
Only typed\-in commands use abbreviations. Abbreviations are not expanded in scripts.
.UNINDENT
.UNINDENT
.sp
For example, a frequently\-run command like \fBgit checkout\fP can be abbreviated to \fBgco\fP\&.
After entering \fBgco\fP and pressing \fBspace\fP or \fBenter\fP, the full text \fBgit checkout\fP will appear in the command line.
To avoid expanding something that looks like an abbreviation, the default \fBctrl\fP\-\fBspace\fP binding inserts a space without expanding.
.sp
An abbreviation may match a literal word, or it may match a pattern given by a regular expression. When an abbreviation matches a word, that word is replaced by new text, called its \fIexpansion\fP\&. This expansion may be a fixed new phrase, or it can be dynamically created via a fish function. This expansion occurs after pressing space or enter.
.sp
Combining these features, it is possible to create custom syntaxes, where a regular expression recognizes matching tokens, and the expansion function interprets them. See the Examples section.
.sp
Changed in version 3.6.0: Previous versions of this allowed saving abbreviations in universal variables.
That\(aqs no longer possible. Existing variables will still be imported and \fBabbr \-\-erase\fP will also erase the variables.
We recommend adding abbreviations to config.fish \%<#\:configuration> by just adding the \fBabbr \-\-add\fP command.
When you run \fBabbr\fP, you will see output like this
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> abbr
abbr \-a \-\- foo bar # imported from a universal variable, see \(gahelp abbr\(ga
.EE
.UNINDENT
.UNINDENT
.sp
In that case you should take the part before the \fB#\fP comment and save it in config.fish \%<#\:configuration>,
then you can run \fBabbr \-\-erase\fP to remove the universal variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> abbr >> ~/.config/fish/config.fish
> abbr \-\-erase (abbr \-\-list)
.EE
.UNINDENT
.UNINDENT
.sp
Alternatively you can keep them in a separate configuration file \%<#\:configuration> by doing something like the following:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> abbr > ~/.config/fish/conf.d/myabbrs.fish
.EE
.UNINDENT
.UNINDENT
.sp
This will save all your abbreviations in \(dqmyabbrs.fish\(dq, overwriting the whole file so it doesn\(aqt leave any duplicates,
or restore abbreviations you had erased.
Of course any functions will have to be saved separately, see funcsave \%<>\&.

.SS \(dqadd\(dq subcommand
.nf
\fBabbr\fP [\fB\-a\fP | \fB\-\-add\fP] \fINAME\fP [\fB\-\-position\fP \fBcommand\fP | \fBanywhere\fP] [\fB\-r\fP | \fB\-\-regex\fP \fIPATTERN\fP]
     [\fB\-c\fP | \fB\-\-command\fP \fICOMMAND\fP] [\fB\-\-set\-cursor\fP[\fB=\fP\fIMARKER\fP]] ([\fB\-f\fP | \fB\-\-function\fP \fIFUNCTION\fP] | \fIEXPANSION\fP)
.fi
.sp
.sp
\fBabbr \-\-add\fP creates a new abbreviation. With no other options, the string \fBNAME\fP is replaced by \fBEXPANSION\fP\&.
.sp
With \fB\-\-position command\fP, the abbreviation will only expand when it is positioned as a command, not as an argument to another command. With \fB\-\-position anywhere\fP the abbreviation may expand anywhere in the command line. The default is \fBcommand\fP\&.
.sp
With \fB\-\-command COMMAND\fP, the abbreviation will only expand when it is used as an argument to the given COMMAND. Multiple \fB\-\-command\fP can be used together, and the abbreviation will expand for each. An empty \fBCOMMAND\fP means it will expand only when there is no command. \fB\-\-command\fP implies \fB\-\-position anywhere\fP and disallows \fB\-\-position command\fP\&. Even with different \fBCOMMANDS\fP, the \fBNAME\fP of the abbreviation needs to be unique. Consider using \fB\-\-regex\fP if you want to expand the same word differently for multiple commands.
.sp
With \fB\-\-regex\fP, the abbreviation matches using the regular expression given by \fBPATTERN\fP, instead of the literal \fBNAME\fP\&. The pattern is interpreted using PCRE2 syntax and must match the entire token. If multiple abbreviations match the same token, the last abbreviation added is used.
.sp
With \fB\-\-set\-cursor=MARKER\fP, the cursor is moved to the first occurrence of \fBMARKER\fP in the expansion. The \fBMARKER\fP value is erased. The \fBMARKER\fP may be omitted (i.e. simply \fB\-\-set\-cursor\fP), in which case it defaults to \fB%\fP\&.
.sp
With \fB\-f FUNCTION\fP or \fB\-\-function FUNCTION\fP, \fBFUNCTION\fP is treated as the name of a fish function instead of a literal replacement. When the abbreviation matches, the function will be called with the matching token as an argument. If the function\(aqs exit status is 0 (success), the token will be replaced by the function\(aqs output; otherwise the token will be left unchanged. No \fBEXPANSION\fP may be given separately.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-\-add gco git checkout
.EE
.UNINDENT
.UNINDENT
.sp
Add a new abbreviation where \fBgco\fP will be replaced with \fBgit checkout\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-a \-\-position anywhere \-\- \-C \-\-color
.EE
.UNINDENT
.UNINDENT
.sp
Add a new abbreviation where \fB\-C\fP will be replaced with \fB\-\-color\fP\&. The \fB\-\-\fP allows \fB\-C\fP to be treated as the name of the abbreviation, instead of an option.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-a L \-\-position anywhere \-\-set\-cursor \(dq% | less\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Add a new abbreviation where \fBL\fP will be replaced with \fB| less\fP, placing the cursor before the pipe.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function last_history_item
    echo $history[1]
end
abbr \-a !! \-\-position anywhere \-\-function last_history_item
.EE
.UNINDENT
.UNINDENT
.sp
This first creates a function \fBlast_history_item\fP which outputs the last entered command. It then adds an abbreviation which replaces \fB!!\fP with the result of calling this function. Taken together, this is similar to the \fB!!\fP history expansion feature of bash.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function vim_edit
    echo vim $argv
end
abbr \-a vim_edit_texts \-\-position command \-\-regex \(dq.+\e.txt\(dq \-\-function vim_edit
.EE
.UNINDENT
.UNINDENT
.sp
This first creates a function \fBvim_edit\fP which prepends \fBvim\fP before its argument. It then adds an abbreviation which matches commands ending in \fB\&.txt\fP, and replaces the command with the result of calling this function. This allows text files to be \(dqexecuted\(dq as a command to open them in vim, similar to the \(dqsuffix alias\(dq feature in zsh.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr 4DIRS \-\-set\-cursor=! \(dq$(string join \en \-\- \(aqfor dir in */\(aq \(aqcd $dir\(aq \(aq!\(aq \(aqcd ..\(aq \(aqend\(aq)\(dq
.EE
.UNINDENT
.UNINDENT
.sp
This creates an abbreviation \(dq4DIRS\(dq which expands to a multi\-line loop \(dqtemplate.\(dq The template enters each directory and then leaves it. The cursor is positioned ready to enter the command to run in each directory, at the location of the \fB!\fP, which is itself erased.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-\-command git co checkout
.EE
.UNINDENT
.UNINDENT
.sp
Turns \(dqco\(dq as an argument to \(dqgit\(dq into \(dqcheckout\(dq. Multiple commands are possible, \fB\-\-command={git,hg}\fP would expand \(dqco\(dq to \(dqcheckout\(dq for both git and hg.
.SS Other subcommands
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-\-rename [ [\-c | \-\-command COMMAND]... ] OLD_NAME NEW_NAME
.EE
.UNINDENT
.UNINDENT
.sp
Renames an abbreviation, from \fIOLD_NAME\fP to \fINEW_NAME\fP\&.
For command\-specific abbreviations, the \fB\-\-command\fP options must be provided to disambiguate which abbreviation to rename.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr [\-s | \-\-show]
.EE
.UNINDENT
.UNINDENT
.sp
Show all abbreviations in a manner suitable for import and export
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr [\-l | \-\-list]
.EE
.UNINDENT
.UNINDENT
.sp
Prints the names of all abbreviation
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr [\-e | \-\-erase] [ [\-c | \-\-command COMMAND]... ] NAME ...
.EE
.UNINDENT
.UNINDENT
.sp
Erases the abbreviation with the given name.
For command\-specific abbreviations, the \fB\-\-command\fP options must be provided to disambiguate which abbreviation to rename.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-q or \-\-query [NAME...]
.EE
.UNINDENT
.UNINDENT
.sp
Return 0 (true) if one of the \fINAME\fP is an abbreviation.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
abbr \-h or \-\-help
.EE
.UNINDENT
.UNINDENT
.sp
Displays help for the \fIabbr\fP command.
.SS alias \- create a function
.SS Synopsis
.nf
\fBalias\fP
\fBalias\fP [\fB\-\-save\fP] \fINAME\fP \fIDEFINITION\fP
\fBalias\fP [\fB\-\-save\fP] \fINAME\fP\fB=\fP\fIDEFINITION\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBalias\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man alias\fP\&.
.sp
\fBalias\fP is a simple wrapper for the \fBfunction\fP builtin, which creates a function wrapping a command. It has similar syntax to POSIX shell \fBalias\fP\&. For other uses, it is recommended to define a function \%<>\&.
.sp
If you want to ease your interactive use, to save typing, consider using an abbreviation \%<> instead.
.sp
\fBfish\fP marks functions that have been created by \fBalias\fP by including the command used to create them in the function description. You can list \fBalias\fP\-created functions by running \fBalias\fP without arguments. They must be erased using \fBfunctions \-e\fP\&.
.INDENT 0.0
.IP \(bu 2
\fBNAME\fP is the name of the alias
.IP \(bu 2
\fBDEFINITION\fP is the actual command to execute. \fBalias\fP automatically appends \fB$argv\fP, so that all parameters used with the alias are passed to the actual command.
.UNINDENT
.sp
You cannot create an alias to a function with the same name. Note that spaces need to be escaped in the call to \fBalias\fP just like at the command line, \fIeven inside quoted parts\fP\&.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.TP
\fB\-s\fP or \fB\-\-save\fP
Saves the function created by the alias into your fish configuration directory using funcsave \%<>\&.
.UNINDENT
.SS Example
.sp
The following code will create \fBrmi\fP, which runs \fBrm\fP with additional arguments on every invocation.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
alias rmi=\(dqrm \-i\(dq

# This is equivalent to entering the following function:
function rmi \-\-wraps rm \-\-description \(aqalias rmi=rm \-i\(aq
    rm \-i $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
\fBalias\fP sometimes requires escaping, as you can see here:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# This needs to have the spaces escaped or \(dqChrome.app...\(dq
# will be seen as an argument to \(dq/Applications/Google\(dq:
alias chrome=\(aq/Applications/Google\e Chrome.app/Contents/MacOS/Google\e Chrome\(aq
.EE
.UNINDENT
.UNINDENT
.SS See more
.INDENT 0.0
.IP 1. 3
The function \%<> command this builds on.
.IP 2. 3
Functions \%<#\:syntax-function>\&.
.IP 3. 3
Defining aliases \%<#\:syntax-aliases>\&.
.UNINDENT
.SS and \- conditionally execute a command
.SS Synopsis
.nf
\fIPREVIOUS\fP\fB;\fP \fBand\fP \fICOMMAND\fP
.fi
.sp
.SS Description
.sp
\fBand\fP is used to execute a command if the previous command was successful (returned a status of 0).
.sp
\fBand\fP statements may be used as part of the condition in an while \%<> or if \%<> block.
.sp
\fBand\fP does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the $status \%<#\:variables-status> variable.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code runs the \fBmake\fP command to build a program. If the build succeeds, \fBmake\fP\(aqs exit status is 0, and the program is installed. If either step fails, the exit status is 1, and \fBmake clean\fP is run, which removes the files created by the build process.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
make; and make install; or make clean
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
or \%<> command
.IP \(bu 2
not \%<> command
.UNINDENT
.SS argparse \- parse options passed to a fish script or function
.SS Synopsis
.nf
\fBargparse\fP [\fIOPTIONS\fP] \fIOPTION_SPEC\fP \&... \fB\-\-\fP [\fIARG\fP \&...]
.fi
.sp
.SS Description
.sp
This command makes it easy for fish scripts and functions to handle arguments. You pass arguments that define the known options, followed by a literal \fB\-\-\fP, then the arguments to be parsed (which might also include a literal \fB\-\-\fP). \fBargparse\fP then sets variables to indicate the passed options with their values, sets \fB$argv_opts\fP to the options and their values, and sets \fB$argv\fP to the remaining arguments. See the usage section below.
.sp
Each option specification (\fBOPTION_SPEC\fP) is written in the domain specific language described below. All OPTION_SPECs must appear after any argparse flags and before the \fB\-\-\fP that separates them from the arguments to be parsed.
.sp
Each option that is seen in the ARG list will result in variables named \fB_flag_X\fP, where \fBX\fP is the short flag letter and the long flag name (if they are defined). For example a \fB\-\-help\fP option could cause argparse to define one variable called \fB_flag_h\fP and another called \fB_flag_help\fP\&.
.sp
The variables will be set with local scope (i.e., as if the script had done \fBset \-l _flag_X\fP). If the flag is a boolean (that is, it is passed or not, it doesn\(aqt have a value) the values are the short and long flags seen. If the option is not a boolean the values will be zero or more values corresponding to the values collected when the ARG list is processed. If the flag was not seen the flag variable will not be set.
.SS Options
.sp
The following \fBargparse\fP options are available. They must appear before all \fIOPTION_SPEC\fPs:
.INDENT 0.0
.TP
\fB\-n\fP or \fB\-\-name\fP \fINAME\fP
Use \fINAME\fP in error messages. By default the current function name will be used, or \fBargparse\fP if run outside of a function.
.TP
\fB\-x\fP or \fB\-\-exclusive\fP \fIOPTIONS\fP
A comma separated list of options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
You give either the short or long version of each option, and you still need to otherwise define the options.
.TP
\fB\-N\fP or \fB\-\-min\-args\fP \fINUMBER\fP
The minimum number of acceptable non\-option arguments. The default is zero.
.TP
\fB\-X\fP or \fB\-\-max\-args\fP \fINUMBER\fP
The maximum number of acceptable non\-option arguments. The default is infinity.
.TP
\fB\-u\fP or \fB\-\-move\-unknown\fP
Allow unknown options, and move them from \fB$argv\fP to \fB$argv_opts\fP\&. By default, Unknown options are treated as if they take optional arguments (i.e. have option spec \fB=?\fP).
.sp
The above means that if a group of short options contains an unknown short option \fIfollowed\fP by a known short option, the known short option is
treated as an argument to the unknown one (e.g. \fB\-\-move\-unknown h \-\- \-oh\fP will treat \fBh\fP as the argument to \fB\-o\fP, and so \fB_flag_h\fP will \fInot\fP be set).
In contrast, if the known option comes first (and does not take any arguments), the known option will be recognised (e.g. \fBargparse \-\-move\-unknown h \-\- \-ho\fP \fIwill\fP set \fB$_flag_h\fP to \fB\-h\fP)
.TP
\fB\-i\fP or \fB\-\-ignore\-unknown\fP
Deprecated. This is like \fB\-\-move\-unknown\fP, except that unknown options and their arguments are kept in \fB$argv\fP and not moved to \fB$argv_opts\fP\&. Unlike \fB\-\-move\-unknown\fP, this option makes it impossible to distinguish between an unknown option and non\-option argument that starts with a \fB\-\fP (since any \fB\-\-\fP separator in \fB$argv\fP will be removed).
.TP
\fB\-S\fP or \fB\-\-strict\-longopts\fP
This makes the parsing of long options more strict. In particular, \fIwithout\fP this flag, if \fBlong\fP is a known long option flag, \fB\-\-long\fP and \fB\-\-long=<value>\fP can be abbreviated as:
.INDENT 7.0
.IP \(bu 2
\fB\-long\fP and \fB\-long=<value>\fP, but \fIonly\fP if there is no short flag \fBl\fP\&.
.IP \(bu 2
\fB\-\-lo\fP and \fB\-\-lo=<value>\fP, but \fIonly\fP if there is no other long flag that starts with \fBlo\fP\&. Similarly with any other non\-empty prefix of \fBlong\fP\&.
.IP \(bu 2
\fB\-lo\fP and \fB\-lo=<value>\fP (i.e. combining the above two).
.UNINDENT
.sp
With the \fB\-\-strict\-longopts\fP flag, the above three are parse errors: one must use the syntax \fB\-\-long\fP or \fB\-\-long=<value>\fP to use a long option called \fBlong\fP\&.
.sp
This flag has no effect on the parsing of unknown options (which are parsed as if this flag is on).
.sp
This option may be on all the time in the future, so do not rely on the behaviour without it.
.TP
\fB\-\-unknown\-arguments\fP \fIKIND\fP
This option implies \fB\-\-move\-unknown\fP, unless \fB\-\-ignore\-unknown\fP is also given.
This will modify the parsing behaviour of unknown options depending on the value of \fIKIND\fP:
.INDENT 7.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fBoptional\fP (the default), allows each unknown option to take an optional argument (i.e. as if it had \fB=?\fP or \fB=*\fP in its option specification). For example, \fBargparse \-\-ignore\-unknown \-\-unknown\-arguments=optional ab \-\- \-u \-a \-ub\fP will set \fB_flag_a\fP but \fInot\fP \fB_flag_b\fP, as the \fBb\fP is treated as an argument to the second use of \fB\-u\fP\&.
.IP \(bu 2
\fBrequired\fP requires each unknown option to take an argument (i.e. as if it had \fB=\fP or \fB=+\fP in its option specification). If the above example was changed to use \fB\-\-unknown\-arguments=required\fP, \fIneither\fP \fB_flag_a\fP nor \fB_flag_b\fP would be set: the \fB\-a\fP will be treated as an argument to the first use of \fB\-u\fP, and the \fBb\fP as an argument to the second.
.IP \(bu 2
\fBnone\fP forbids each unknown option from taking an argument (i.e. as if it had no \fB=\fP in its option specification). If the above example was changed to use \fB\-\-unknown\-arguments=none\fP, \fIboth\fP \fB_flag_a\fP and \fB_flag_b\fP would be set, as neither use of \fB\-u\fP will be passed as taking an argument.
.UNINDENT
.sp
Note that the above assumes that unknown long flags use the \fB\-\-\fP \(dqGNU\-style\(dq (e.g. if \fIKIND\fP is \fBnone\fP, and there is no \fBbar\fP long option, \fB\-bar\fP is interpreted as three short flags, \fBb\fP, \fBa\fP, and \fBr\fP; but if \fBbar\fP is known, \fB\-bar\fP is treated the same as \fB\-\-bar\fP).
.sp
When using \fB\-\-unknown\-arguments=required\fP, you will get an error if the provided arguments end in an unknown option, since it has no argument. Similarly, with \fB\-\-unknown\-arguments=none\fP, you will get an error if you use the \fB\-\-flag=value\fP syntax and \fBflag\fP is an unknown option.
.UNINDENT
.UNINDENT
.TP
\fB\-s\fP or \fB\-\-stop\-nonopt\fP
Causes scanning the arguments to stop as soon as the first non\-option argument is seen. Among other things, this is useful to implement subcommands that have their own options.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Usage
.sp
To use this command, pass the option specifications (\fBOPTION_SPEC\fP), a mandatory \fB\-\-\fP, and then the arguments to be parsed.
.sp
A simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
argparse \(aqh/help\(aq \(aqn/name=\(aq \-\- $argv
or return
.EE
.UNINDENT
.UNINDENT
.sp
If \fB$argv\fP is empty then there is nothing to parse and \fBargparse\fP returns zero to indicate success. If \fB$argv\fP is not empty then it is checked for flags \fB\-h\fP, \fB\-\-help\fP, \fB\-n\fP and \fB\-\-name\fP\&. If they are found they are removed from the arguments and local variables called \fB_flag_OPTION\fP are set so the script can determine which options were seen. If \fB$argv\fP doesn\(aqt have any errors, like an unknown option or a missing mandatory value for an option, then \fBargparse\fP exits with a status of zero. Otherwise it writes appropriate error messages to stderr and exits with a status of one.
.sp
The \fBor return\fP means that the function returns \fBargparse\fP\(aqs status if it failed, so if it goes on \fBargparse\fP succeeded.
.sp
To use the flags argparse has extracted:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Checking for _flag_h and _flag_help is equivalent
# We check if it has been given at least once
if set \-ql _flag_h
    echo \(dqUsage: my_function [\-h | \-\-help] [\-n | \-\-name=NAME]\(dq >&2
    return 1
end

set \-l myname somedefault
set \-ql _flag_name[1]
and set myname $_flag_name[\-1] # here we use the *last* \-\-name=
.EE
.UNINDENT
.UNINDENT
.sp
Any characters in the flag name that are not valid in a variable name (like \fB\-\fP dashes) will be replaced with underscores.
.sp
The \fB\-\-\fP argument is required. You do not have to include any option specifications or arguments after the \fB\-\-\fP but you must include the \fB\-\-\fP\&. For example, this is acceptable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l argv foo
argparse \(aqh/help\(aq \(aqn/name\(aq \-\- $argv
argparse \-\-min\-args=1 \-\- $argv
.EE
.UNINDENT
.UNINDENT
.sp
But this is not:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l argv
argparse \(aqh/help\(aq \(aqn/name\(aq $argv
.EE
.UNINDENT
.UNINDENT
.sp
The first \fB\-\-\fP seen is what allows the \fBargparse\fP command to reliably separate the option specifications and options to \fBargparse\fP itself (like \fB\-\-move\-unknown\fP) from the command arguments, so it is required.
.SS Option Specifications
.sp
Each option specification consists of:
.INDENT 0.0
.IP \(bu 2
An optional alphanumeric short flag character.
.IP \(bu 2
An optional long flag name preceded by a \fB/\fP\&. If neither a short flag nor long flag are present, an error is reported.
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
If there is no short flag, and the long flag name is more than one character, the \fB/\fP can be omitted.
.IP \(bu 2
For backwards compatibility, if there is a short and a long flag, a \fB\-\fP can be used in place of the \fB/\fP, if the short flag is not to be usable by users (in which case it will also not be exposed as a flag variable).
.UNINDENT
.UNINDENT
.UNINDENT
.IP \(bu 2
Nothing if the flag is a boolean that takes no argument or is an integer flag, or
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fB=\fP if it requires a value and only the last instance of the flag is saved, or
.IP \(bu 2
\fB=?\fP if it takes an optional value and only the last instance of the flag is saved, or
.IP \(bu 2
\fB=+\fP if it requires a value and each instance of the flag is saved, or
.IP \(bu 2
\fB=*\fP if it takes an optional value \fIand\fP each instance of the flag is saved, storing the empty string when the flag was not given a value.
.UNINDENT
.UNINDENT
.UNINDENT
.IP \(bu 2
Optionally a \fB&\fP, indicating that the option and any attached values are not to be saved in \fB$argv\fP or \fB$argv_opts\fP\&. This does not affect the the \fB_flag_\fP variables.
.IP \(bu 2
Nothing if the flag is a boolean that takes no argument, or
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fB!\fP followed by fish script to validate the value. Typically this will be a function to run. If the exit status is zero the value for the flag is valid. If non\-zero the value is invalid. Any error messages should be written to stdout (not stderr). See the section on Flag Value Validation for more information.
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
See the fish_opt \%<> command for a friendlier but more verbose way to create option specifications.
.sp
If a flag is not seen when parsing the arguments then the corresponding _flag_X var(s) will not be set.
.SS Integer flag
.sp
Sometimes commands take numbers directly as options, like \fBfoo \-55\fP\&. To allow this one option spec can have the \fB#\fP modifier so that any integer will be understood as this flag, and the last number will be given as its value (as if \fB=\fP was used).
.sp
The \fB#\fP must follow the short flag letter (if any), and other modifiers like \fB=\fP are not allowed, except for \fB\-\fP (for backwards compatibility):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
m#maximum
.EE
.UNINDENT
.UNINDENT
.sp
This does not read numbers given as \fB+NNN\fP, only those that look like flags \- \fB\-NNN\fP\&.
.SS Note: Optional arguments
.sp
An option defined with \fB=?\fP or \fB=*\fP can take optional arguments. Optional arguments have to be \fIdirectly attached\fP to the option they belong to.
.sp
That means the argument will only be used for the option if you use it like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cmd \-\-flag=value
# or
cmd  \-fvalue
.EE
.UNINDENT
.UNINDENT
.sp
but not if used like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cmd \-\-flag value
# \(dqvalue\(dq here will be used as a positional argument
# and \(dq\-\-flag\(dq won\(aqt have an argument.
.EE
.UNINDENT
.UNINDENT
.sp
If this weren\(aqt the case, using an option without an optional argument would be difficult if you also wanted to use positional arguments.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
grep \-\-color auto
# Here \(dqauto\(dq will be used as the search string,
# \(dqcolor\(dq will not have an argument and will fall back to the default,
# which also *happens to be* auto.
grep \-\-color always
# Here grep will still only use color \(dqauto\(dqmatically
# and search for the string \(dqalways\(dq.
.EE
.UNINDENT
.UNINDENT
.sp
This isn\(aqt specific to argparse but common to all things using \fBgetopt(3)\fP (if they have optional arguments at all). That \fBgrep\fP example is how GNU grep actually behaves.
.SS Flag Value Validation
.sp
Sometimes you need to validate the option values. For example, that it is a valid integer within a specific range, or an ip address, or something entirely different. You can always do this after \fBargparse\fP returns but you can also request that \fBargparse\fP perform the validation by executing arbitrary fish script. To do so append an \fB!\fP (exclamation\-mark) then the fish script to be run. When that code is executed three vars will be defined:
.INDENT 0.0
.IP \(bu 2
\fB_argparse_cmd\fP will be set to the value of the value of the \fBargparse \-\-name\fP value.
.IP \(bu 2
\fB_flag_name\fP will be set to the short or long flag that being processed.
.IP \(bu 2
\fB_flag_value\fP will be set to the value associated with the flag being processed.
.UNINDENT
.sp
These variables are passed to the function as local exported variables.
.sp
The script should write any error messages to stdout, not stderr. It should return a status of zero if the flag value is valid otherwise a non\-zero status to indicate it is invalid.
.sp
Fish ships with a \fB_validate_int\fP function that accepts a \fB\-\-min\fP and \fB\-\-max\fP flag. Let\(aqs say your command accepts a \fB\-m\fP or \fB\-\-max\fP flag and the minimum allowable value is zero and the maximum is 5. You would define the option like this: \fBm/max=!_validate_int \-\-min 0 \-\-max 5\fP\&. The default if you call \fB_validate_int\fP without those flags is to check that the value is a valid integer with no limits on the min or max value allowed.
.sp
Here are some examples of flag validations:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# validate that a path is a directory
argparse \(aqp/path=!test \-d \(dq$_flag_value\(dq\(aq \-\- \-\-path $__fish_config_dir
# validate that a function does not exist
argparse \(aqf/func=!not functions \-q \(dq$_flag_value\(dq\(aq \-\- \-f alias
# validate that a string matches a regex
argparse \(aqc/color=!string match \-rq \e\(aq^#?[0\-9a\-fA\-F]{6}$\e\(aq \(dq$_flag_value\(dq\(aq \-\- \-c \(aqc0ffee\(aq
# validate with a validator function
argparse \(aqn/num=!_validate_int \-\-min 0 \-\-max 99\(aq \-\- \-\-num 42
.EE
.UNINDENT
.UNINDENT
.SS Example OPTION_SPECs
.sp
Some \fIOPTION_SPEC\fP examples:
.INDENT 0.0
.IP \(bu 2
\fBh/help\fP means that both \fB\-h\fP and \fB\-\-help\fP are valid. The flag is a boolean and can be used more than once. If either flag is used then \fB_flag_h\fP and \fB_flag_help\fP will be set to however either flag was seen, as many times as it was seen. So it could be set to \fB\-h\fP, \fB\-h\fP and \fB\-\-help\fP, and \fBcount $_flag_h\fP would yield \(dq3\(dq.
.IP \(bu 2
\fBhelp\fP means that only \fB\-\-help\fP is valid. The flag is a boolean and can be used more than once. If it is used then \fB_flag_help\fP will be set as above. Also \fBh\-help\fP (with an arbitrary short letter) for backwards compatibility.
.IP \(bu 2
\fBhelp&\fP is similar (it will \fIremove\fP \fB\-\-help\fP from \fB$argv\fP), the difference is that \fB\-\-help\(ga\fP will \fInot\fP placed in \fB$argv_opts\fP\&.
.IP \(bu 2
\fBlongonly=\fP is a flag \fB\-\-longonly\fP that requires an option, there is no short flag or even short flag variable.
.IP \(bu 2
\fBn/name=\fP means that both \fB\-n\fP and \fB\-\-name\fP are valid. It requires a value and can be used at most once. If the flag is seen then \fB_flag_n\fP and \fB_flag_name\fP will be set with the single mandatory value associated with the flag.
.IP \(bu 2
\fBn/name=?\fP means that both \fB\-n\fP and \fB\-\-name\fP are valid. It accepts an optional value and can be used at most once. If the flag is seen then \fB_flag_n\fP and \fB_flag_name\fP will be set with the value associated with the flag if one was provided else it will be set with no values.
.IP \(bu 2
\fBn/name=*\fP is similar, but the flag can be used more than once. If the flag is seen then \fB_flag_n\fP and \fB_flag_name\fP will be set with the values associated with each occurence. Each value will be the value given to the option, or the empty string if no value was given.
.IP \(bu 2
\fBname=+\fP means that only \fB\-\-name\fP is valid. It requires a value and can be used more than once. If the flag is seen then \fB_flag_name\fP will be set with the values associated with each occurrence.
.IP \(bu 2
\fBx\fP means that only \fB\-x\fP is valid. It is a boolean that can be used more than once. If it is seen then \fB_flag_x\fP will be set as above.
.IP \(bu 2
\fB/x\fP is similar, but only \fB\-\-x\fP is valid (instead of \fB\-x\fP).
.IP \(bu 2
\fBx=\fP, \fBx=?\fP, and \fBx=+\fP are similar to the n/name examples above but there is no long flag alternative to the short flag \fB\-x\fP\&.
.IP \(bu 2
\fB#max\fP (or \fB#\-max\fP) means that flags matching the regex \(dq^\-\-?\ed+$\(dq are valid. When seen they are assigned to the variable \fB_flag_max\fP\&. This allows any valid positive or negative integer to be specified by prefixing it with a single \(dq\-\(dq. Many commands support this idiom. For example \fBhead \-3 /a/file\fP to emit only the first three lines of /a/file.
.IP \(bu 2
\fBn#max\fP means that flags matching the regex \(dq^\-\-?\ed+$\(dq are valid. When seen they are assigned to the variables \fB_flag_n\fP and \fB_flag_max\fP\&. This allows any valid positive or negative integer to be specified by prefixing it with a single \(dq\-\(dq. Many commands support this idiom. For example \fBhead \-3 /a/file\fP to emit only the first three lines of /a/file. You can also specify the value using either flag: \fB\-n NNN\fP or \fB\-\-max NNN\fP in this example.
.IP \(bu 2
\fB#longonly\fP causes the last integer option to be stored in \fB_flag_longonly\fP\&.
.UNINDENT
.sp
After parsing the arguments the \fBargv\fP variable is set with local scope to any values not already consumed during flag processing. If there are no unbound values the variable is set but \fBcount $argv\fP will be zero. Similarly, the \fBargv_opts\fP variable is set with local scope to the arguments that \fIwere\fP consumed during flag processing. This allows forwarding \fB$argv_opts\fP to another command, together with additional arguments.
.sp
If an error occurs during argparse processing it will exit with a non\-zero status and print error messages to stderr.
.SS Examples
.sp
A simple use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
argparse h/help \-\- $argv
or return

if set \-q _flag_help
    # TODO: Print help here
    return 0
end
.EE
.UNINDENT
.UNINDENT
.sp
This supports one option \- \fB\-h\fP / \fB\-\-help\fP\&. Any other option is an error. If it is given it prints help and exits.
.sp
How fish_add_path \- add to the path \%<> parses its args:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
argparse \-x g,U \-x P,U \-x a,p g/global U/universal P/path p/prepend a/append h/help m/move v/verbose n/dry\-run \-\- $argv
.EE
.UNINDENT
.UNINDENT
.sp
There are a variety of boolean flags, all with long and short versions. A few of these cannot be used together, and that is what the \fB\-x\fP flag is used for.
\fB\-x g,U\fP means that \fB\-\-global\fP and \fB\-\-universal\fP or their short equivalents conflict, and if they are used together you get an error.
In this case you only need to give the short or long flag, not the full option specification.
.sp
After this it figures out which variable it should operate on according to the \fB\-\-path\fP flag:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l var fish_user_paths
set \-q _flag_path
and set var PATH

# ...

# Check for \-\-dry\-run.
# The \(dq\-\(dq has been replaced with a \(dq_\(dq because
# it is not valid in a variable name
not set \-ql _flag_dry_run
and set $var $result
.EE
.UNINDENT
.UNINDENT
.sp
An example of using \fB$argv_opts\fP to forward known options to another command, whilst adding new options:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function my\-head
    # The following option is the only existing one to head that takes arguments
    # (we will forward it verbatim).
    set \-l opt_spec n/lines=
    # \-\-qwords is a new option, but \-\-bytes is an existing one which we will modify below
    set \-a opt_spec \(dqqwords=&\(dq \(dqc/bytes=&\(dq
    argparse \-\-strict\-longopts \-\-move\-unknown \-\-unknown\-arguments=none $opt_spec \-\- $argv || return
    if set \-q _flag_qwords
        # \-\-qwords allows specifying the size in multiples of 8 bytes
        set \-a argv_opts \-\-bytes=(math \-\- $_flag_qwords \e* 8 || return)
    else if set \-q _flag_bytes
        # Allows using a \(aqq\(aq suffix, e.g. \-\-bytes=4q to mean 4*8 bytes.
        if string match \-qr \(aqq$\(aq \-\- $_flag_bytes
            set \-a argv_opts \-\-bytes=(math \-\- (string replace \-r \(aqq$\(aq \(aq*8\(aq \-\- $_flag_bytes) || return)
        else
            # Keep the users setting
            set \-a argv_opts \-\-bytes=$_flag_bytes
        end

    end

    if test (count $argv) \-eq 0
        # Default to heading /dev/kmsg (whereas head defaults to stdin)
        set \-l argv /dev/kmsg
    end

    # Call the real head with our modified options and arguments.
    head $argv_opts \-\- $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
The argparse call above saves all the options we do \fInot\fP want to process in \fB$argv_opts\fP\&. (The \fB\-\-qwords\fP and \fB\-\-bytes\fP options are \fInot\fP saved there as their option spec\(aqs end in a \fB~\fP). The code then processes the \fB\-\-qwords\fP and \fB\-\-bytess\fP options using the the \fB$_flag_OPTION\fP variables, and puts the transformed options in \fB$argv_opts\fP (which already contains all the original options, \fIother\fP than \fB\-\-qwords\fP and \fB\-\-bytes\fP).
.sp
Note that because the \fBargparse\fP call above uses \fB\-\-move\-unknown\fP and \fB\-\-unknown\-arguments=none\fP, we only need to tell it the arguments to \fBhead\fP that take a value. This allows the wrapper script to accurately work out the \fInon\fP\-option arguments (i.e. \fB$argv\fP, the filenames that \fBhead\fP is to operate on). Using \fB\-\-unknown\-arguments=optional\fP and explicitly listing all the known options to \fBhead\fP however would have the advantage that if \fBhead\fP were to add new options, they could still be used with the wrapper script using the \(dqstuck\(dq form for arguments (e.g. \fB\-o<arg>\fP, or \fB\-\-opt=<arg>\fP).
.sp
Note that the \fB\-\-strict\-longopts\fP is required to be able to correctly pass short options, e.g. without it \fBmy\-head \-q \-\-bytes 10q\fP, will actually parse the \fB\-q\fP as shorthand for \fB\-\-qwords\fP\&.
.SS begin \- start a new block of code
.SS Synopsis
.nf
\fBbegin\fP\fB;\fP [\fICOMMANDS\fP \&...]\fB;\fP \fBend\fP
\fB{ \fP[\fICOMMANDS\fP \&...]\fB }\fP
.fi
.sp
.SS Description
.sp
\fBbegin\fP is used to create a new block of code.
.sp
A block allows the introduction of a new variable scope \%<#\:variables-scope>, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like \fBand\fP\&.
.sp
The block is unconditionally executed. \fBbegin; ...; end\fP is equivalent to \fBif true; ...; end\fP\&.
.sp
\fBbegin\fP does not change the current exit status itself. After the block has completed, \fB$status\fP will be set to the status returned by the most recent command.
.sp
Some other shells only support the \fB{ [COMMANDS ...] ; }\fP notation.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code sets a number of variables inside of a block scope. Since the variables are set inside the block and have local scope, they will be automatically deleted when the block ends.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
begin
    set \-l PIRATE Yarrr

    ...
end

echo $PIRATE
# This will not output anything, since the PIRATE variable
# went out of scope at the end of the block
.EE
.UNINDENT
.UNINDENT
.sp
In the following code, all output is redirected to the file out.html.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
begin
    echo $xml_header
    echo $html_header
    if test \-e $file
        ...
    end
    ...
end > out.html
.EE
.UNINDENT
.UNINDENT
.SS bg \- send jobs to background
.SS Synopsis
.nf
\fBbg\fP [\fIPID\fP \&...]
.fi
.sp
.SS Description
.sp
\fBbg\fP sends jobs \%<#\:syntax-job-control> to the background, resuming them if they are stopped.
.sp
A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If \fBPID\fP is specified, the jobs containing the specified process IDs are put in the background.
.sp
A PID of the format \fB%n\fP, where n is an integer, will be interpreted as the PID of job number n. Job numbers can be seen in the output of jobs \%<>\&.
.sp
When at least one of the arguments isn\(aqt a valid job specifier, \fBbg\fP will print an error without backgrounding anything.
.sp
When all arguments are valid job specifiers, \fBbg\fP will background all matching jobs that exist.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The typical use is to run something, stop it with ctrl\-z, and then continue it in the background with bg:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> find / \-name \(dq*.js\(dq >/tmp/jsfiles 2>/dev/null # oh no, this takes too long, let\(aqs press Ctrl\-z!
fish: Job 1, \(aqfind / \-name \(dq*.js\(dq >/tmp/jsfil…\(aq has stopped
> bg
Send job 1 \(aqfind / \-name \(dq*.js\(dq >/tmp/jsfiles 2>/dev/null\(aq to background
> # I can continue using this shell!
> # Eventually:
fish: Job 1, \(aqfind / \-name \(dq*.js\(dq >/tmp/jsfil…\(aq has ended
.EE
.UNINDENT
.UNINDENT
.sp
\fBbg 123 456 789\fP will background the jobs that contain processes 123, 456 and 789.
.sp
If only 123 and 789 exist, it will still background them and print an error about 456.
.sp
\fBbg 123 banana\fP or \fBbg banana 123\fP will complain that \(dqbanana\(dq is not a valid process ID.
.sp
\fBbg %2\fP will background job 2.
.SS bind \- handle fish key bindings
.SS Synopsis
.nf
\fBbind\fP [(\fB\-M\fP | \fB\-\-mode\fP) \fIMODE\fP] [(\fB\-m\fP | \fB\-\-sets\-mode\fP) \fINEW_MODE\fP] [\fB\-\-preset\fP | \fB\-\-user\fP] [\fB\-s\fP | \fB\-\-silent\fP] \fIKEYS\fP \fICOMMAND\fP \&...
\fBbind\fP [(\fB\-M\fP | \fB\-\-mode\fP) \fIMODE\fP] [\fB\-\-preset\fP] [\fB\-\-user\fP] [\fB\-\-color\fP \fIWHEN\fP] [\fIKEYS\fP]
\fBbind\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-\-preset\fP] [\fB\-\-user\fP] [\fB\-\-color\fP \fIWHEN\fP]
\fBbind\fP (\fB\-f\fP | \fB\-\-function\-names\fP)
\fBbind\fP (\fB\-K\fP | \fB\-\-key\-names\fP)
\fBbind\fP (\fB\-L\fP | \fB\-\-list\-modes\fP)
\fBbind\fP (\fB\-e\fP | \fB\-\-erase\fP) [(\fB\-M\fP | \fB\-\-mode\fP) \fIMODE\fP] [\fB\-\-preset\fP] [\fB\-\-user\fP] [\fB\-a\fP | \fB\-\-all\fP] | \fIKEYS\fP \&...
.fi
.sp
.SS Description
.sp
\fBbind\fP manages key bindings.
.sp
If both \fBKEYS\fP and \fBCOMMAND\fP are given, \fBbind\fP adds (or replaces) a binding in \fBMODE\fP\&.
If only \fBKEYS\fP is given, \fBbind\fP lists any existing bindings for those keys in \fBMODE\fP or in all modes.
If no \fBKEYS\fP argument is provided, \fBbind\fP lists all bindings in \fBMODE\fP or in all modes.
.sp
\fBKEYS\fP is a comma\-separated list of key names.
Modifier keys can be specified by prefixing a key name with a combination of \fBctrl\-\fP, \fBalt\-\fP, \fBshift\-\fP and \fBsuper\-\fP (i.e. the \(dqwindows\(dq or \(dqcommand\(dq key).
For example, pressing \fBw\fP while holding the Alt modifier is written as \fBalt\-w\fP\&.
Key names are case\-sensitive; for example \fBalt\-W\fP is the same as \fBalt\-shift\-w\fP\&.
\fBctrl\-x,ctrl\-e\fP would mean pressing \fBctrl\fP\-\fBx\fP followed by \fBctrl\fP\-\fBe\fP\&.
.sp
Some keys have names, usually because they don\(aqt have an obvious printable character representation.
They are:
.INDENT 0.0
.IP \(bu 2
the arrow keys \fBup\fP, \fBdown\fP, \fBleft\fP and \fBright\fP,
.IP \(bu 2
\fBbackspace\fP,
.IP \(bu 2
\fBcomma\fP (\fB,\fP),
.IP \(bu 2
\fBdelete\fP,
.IP \(bu 2
\fBend\fP,
.IP \(bu 2
\fBenter\fP,
.IP \(bu 2
\fBescape\fP,
.IP \(bu 2
\fBf1\fP through \fBf12\fP\&.
.IP \(bu 2
\fBhome\fP,
.IP \(bu 2
\fBinsert\fP,
.IP \(bu 2
\fBmenu\fP,
.IP \(bu 2
\fBminus\fP (\fB\-\fP),
.IP \(bu 2
\fBpageup\fP,
.IP \(bu 2
\fBpagedown\fP,
.IP \(bu 2
\fBprintscreen\fP,
.IP \(bu 2
\fBspace\fP and
.IP \(bu 2
\fBtab\fP,
.UNINDENT
.sp
These names are case\-sensitive.
.sp
An empty value (\fB\(aq\(aq\fP) for \fBKEYS\fP designates the generic binding that will be used if nothing else matches. For most bind modes, it makes sense to bind this to the \fBself\-insert\fP function (i.e. \fBbind \(aq\(aq self\-insert\fP). This will insert any keystrokes that have no bindings otherwise. Non\-printable characters are ignored by the editor, so this will not result in control sequences being inserted.
.sp
To find the name of a key combination you can use fish_key_reader \%<>\&.
.sp
\fBCOMMAND\fP can be any fish command, but it can also be one of a set of special input functions. These include functions for moving the cursor, operating on the kill\-ring, performing tab completion, etc. Use \fBbind \-\-function\-names\fP or see below for a list of these input functions.
.sp
\fBNote:\fP
.INDENT 0.0
.INDENT 3.5
If a script changes the commandline, it should finish by calling the \fBrepaint\fP special input function.
.UNINDENT
.UNINDENT
.sp
Key bindings may use \(dqmodes\(dq, which mimics vi\(aqs modal input behavior. The default mode is \(dqdefault\(dq (in vi\-mode, that\(aqs vi\(aqs \(dqnormal\(dq mode). Every key binding applies to a single mode; you can specify which one with \fB\-M MODE\fP\&. If the key binding should change the mode, you can specify the new mode with \fB\-m NEW_MODE\fP\&. The mode can be viewed and changed via the \fB$fish_bind_mode\fP variable. If you want to change the mode from inside a fish function, use \fBset fish_bind_mode MODE\fP\&.
.sp
To save custom key bindings, put the \fBbind\fP statements into config.fish \%<#\:configuration>\&. Alternatively, fish also automatically executes a function called \fBfish_user_key_bindings\fP if it exists.
.SS Options
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-f\fP or \fB\-\-function\-names\fP
Display a list of available input functions
.TP
\fB\-K\fP or \fB\-\-key\-names\fP
Display a list of available named keys such as \fBbackspace\fP\&.
.TP
\fB\-L\fP or \fB\-\-list\-modes\fP
Display a list of defined bind modes
.TP
\fB\-M MODE\fP or \fB\-\-mode\fP \fIMODE\fP
Specify a bind mode that the bind is used in. Defaults to \(dqdefault\(dq.
If you use vi bindings \%<#\:vi-mode>, that\(aqs the \fIcommand\fP mode,
what vi calls \(dqnormal\(dq mode.
.TP
\fB\-m NEW_MODE\fP or \fB\-\-sets\-mode\fP \fINEW_MODE\fP
Change the current mode to \fINEW_MODE\fP after this binding is executed
.TP
\fB\-e\fP or \fB\-\-erase\fP
Erase the binding with the given sequence and mode instead of defining a new one.
Multiple sequences can be specified with this flag.
Specifying \fB\-a\fP or \fB\-\-all\fP with \fB\-M\fP or \fB\-\-mode\fP erases all binds in the given mode regardless of sequence.
Specifying \fB\-a\fP or \fB\-\-all\fP without \fB\-M\fP or \fB\-\-mode\fP erases all binds in all modes regardless of sequence.
.TP
\fB\-a\fP or \fB\-\-all\fP
See \fB\-\-erase\fP
.TP
\fB\-\-preset\fP and \fB\-\-user\fP
Specify if bind should operate on user or preset bindings.
User bindings take precedence over preset bindings when fish looks up mappings.
By default, all \fBbind\fP invocations work on the \(dquser\(dq level except for listing, which will show both levels.
All invocations except for inserting new bindings can operate on both levels at the same time (if both \fB\-\-preset\fP and \fB\-\-user\fP are given).
\fB\-\-preset\fP should only be used in full binding sets (like when working on \fBfish_vi_key_bindings\fP).
.TP
\fB\-s\fP or \fB\-\-silent\fP
Silences error message for unbound sequences.
.TP
\fB\-\-color\fP \fIWHEN\fP
Controls when to use syntax highlighting colors when listing bindings.
\fIWHEN\fP can be \fBauto\fP (the default, colorize if the output is a terminal \%<>), \fBalways\fP, or \fBnever\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Special input functions
.sp
The following special input functions are available:
.INDENT 0.0
.TP
.B \fBand\fP
only execute the next function if the previous succeeded (note: only some functions report success)
.TP
.B \fBaccept\-autosuggestion\fP
accept the current autosuggestion. Returns false when there was nothing to accept.
.TP
.B \fBbackward\-char\fP
move one character to the left.
If the completion pager is active, select the previous completion instead.
.TP
.B \fBbackward\-char\-passive\fP
move one character to the left, but do not trigger any non\-movement\-related operations. If the cursor is at the start of
the commandline, does nothing. Does not change the selected item in the completion pager UI when shown.
.TP
.B \fBbackward\-token\fP
move one argument to the left
.TP
.B \fBbackward\-delete\-char\fP
deletes one character of input to the left of the cursor
.TP
.B \fBbackward\-kill\-token\fP
move the argument to the left of the cursor to the killring
.TP
.B \fBbackward\-kill\-line\fP
move everything from the beginning of the line to the cursor to the killring
.UNINDENT
.INDENT 0.0
.TP
.B \fBbackward\-kill\-path\-component\fP
move one path component to the left of the cursor to the killring. A path component is everything likely to belong to a path component, i.e. not any of the following: \fI/={,}\(aq\(dq:@ |;<>&\fP, plus newlines and tabs.
.TP
.B \fBbackward\-kill\-word\fP
move the word to the left of the cursor to the killring, until the start of the current word (like vim\(aqs \fBdb\fP)
.TP
.B \fBbackward\-kill\-bigword\fP
move the whitespace\-delimited word to the left of the cursor to the killring, until the start of the current word (like vim\(aqs \fBdB\fP)
.TP
.B \fBbackward\-path\-component\fP
move one path component to the left
.TP
.B \fBbackward\-word\fP
move one word to the left, stopping at the start of the previous word (like vim\(aqs \fBb\fP, or Emacs\(aq \fBM\-b\fP but differs slightly in word division rules)
.TP
.B \fBbackward\-bigword\fP
move one whitespace\-delimited word to the left, stopping at the start of the previous word (like vim\(aqs \fBB\fP)
.TP
.B \fBbackward\-word\-end\fP
move to the end of the previous word (like vim\(aqs \fBge\fP)
.TP
.B \fBbackward\-bigword\-end\fP
move to the end of the previous whitespace\-delimited word (like vim\(aqs \fBgE\fP)
.TP
.B \fBbeginning\-of\-buffer\fP
moves to the beginning of the buffer, i.e. the start of the first line
.TP
.B \fBbeginning\-of\-history\fP
move to the beginning of the history
.TP
.B \fBbeginning\-of\-line\fP
move to the beginning of the line
.TP
.B \fBbegin\-selection\fP
start selecting text
.TP
.B \fBcancel\fP
close the pager if it is open, or undo the most recent completion if one was just inserted
.TP
.B \fBcancel\-commandline\fP
cancel the current commandline and replace it with a new empty one, leaving the old one in place with a marker to show that it was cancelled
.TP
.B \fBcapitalize\-word\fP
make the current word begin with a capital letter
.TP
.B \fBclear\-commandline\fP
empty the entire commandline
.TP
.B \fBclear\-screen\fP
clears the screen and redraws the prompt.
.UNINDENT
.INDENT 0.0
.TP
.B \fBscrollback\-push\fP
pushes earlier output to the terminal scrollback, positioning the prompt at the top.
This requires the terminal to implement the ECMA\-48 SCROLL UP \%<#\:term-compat-indn> command and cursor position reporting \%<#\:term-compat-cursor-position-report>\&.
.TP
.B \fBcomplete\fP
guess the remainder of the current token
.TP
.B \fBcomplete\-and\-search\fP
invoke the searchable pager on completion options (for convenience, this also moves backwards in the completion pager)
.TP
.B \fBdelete\-char\fP
delete one character to the right of the cursor
.TP
.B \fBdelete\-or\-exit\fP
delete one character to the right of the cursor, or exit the shell if the commandline is empty
.TP
.B \fBdown\-line\fP
move down one line
.TP
.B \fBdowncase\-word\fP
make the current word lowercase
.TP
.B \fBend\-of\-buffer\fP
moves to the end of the buffer, i.e. the end of the last line;
or if already at the end of the commandline, accept the current autosuggestion.
.TP
.B \fBend\-of\-history\fP
move to the end of the history
.TP
.B \fBend\-of\-line\fP
move to the end of the line
.TP
.B \fBend\-selection\fP
end selecting text
.TP
.B \fBexpand\-abbr\fP
expands any abbreviation currently under the cursor
.TP
.B \fBexecute\fP
run the current commandline
.TP
.B \fBexit\fP
exit the shell
.TP
.B \fBforward\-token\fP
move one argument to the right
.TP
.B \fBforward\-char\fP
move one character to the right; or if at the end of the commandline, accept the current autosuggestion.
If the completion pager is active, select the next completion instead.
.TP
.B \fBforward\-char\-passive\fP
move one character to the right, but do not trigger any non\-movement\-related operations. If the cursor is at the end of the
commandline, does not accept the current autosuggestion (if any). Does not change the selected item in the completion pager,
if shown.
.TP
.B \fBforward\-path\-component\fP
move one path component to the right; or if at the end of the commandline, accept a path component from the current autosuggestion.
.TP
.B \fBforward\-single\-char\fP
move one character to the right; or if at the end of the commandline, accept a single char from the current autosuggestion.
.UNINDENT
.INDENT 0.0
.TP
.B \fBforward\-word\fP
move one word to the right, stopping after the end of the current word; or if at the end of the commandline, accept one word
from the current autosuggestion.
.TP
.B \fBforward\-word\-vi\fP
like forward\-word, but stops at the start of the next word (like vim\(aqs \fBw\fP)
.TP
.B \fBforward\-word\-end\fP
like forward\-word, but stops at the end of the next word (like vim\(aqs \fBe\fP)
.UNINDENT
.INDENT 0.0
.TP
.B \fBforward\-bigword\fP
move one whitespace\-delimited word to the right, stopping after the end of the current word; or if at the end of the commandline, accept one word from the current autosuggestion.
.TP
.B \fBforward\-bigword\-vi\fP
like forward\-bigword, but stops at the start of the next word (like vim\(aqs \fBW\fP)
.TP
.B \fBforward\-bigword\-end\fP
like forward\-bigword, but stops at the end of the next word (like vim\(aqs \fBE\fP)
.TP
.B \fBhistory\-pager\fP
invoke the searchable pager on history (incremental search); or if the history pager is already active, search further backwards in time.
.TP
.B \fBhistory\-delete\fP
permanently delete the current history item, either from the history pager or from an active up\-arrow history search
.TP
.B \fBhistory\-search\-backward\fP
search the history for the previous match
.TP
.B \fBhistory\-search\-forward\fP
search the history for the next match
.TP
.B \fBhistory\-prefix\-search\-backward\fP
search the history for the previous prefix match
.TP
.B \fBhistory\-prefix\-search\-forward\fP
search the history for the next prefix match
.TP
.B \fBhistory\-token\-search\-backward\fP
search the history for the previous matching argument
.TP
.B \fBhistory\-token\-search\-forward\fP
search the history for the next matching argument
.TP
.B \fBhistory\-last\-token\-search\-backward\fP
search the history for the previous matching last argument
.TP
.B \fBhistory\-last\-token\-search\-forward\fP
search the history for the next matching last argument
.TP
.B \fBforward\-jump\fP and \fBbackward\-jump\fP
read another character and jump to its next occurrence after/before the cursor
.TP
.B \fBforward\-jump\-till\fP and \fBbackward\-jump\-till\fP
jump to right \fIbefore\fP the next occurrence
.TP
.B \fBrepeat\-jump\fP and \fBrepeat\-jump\-reverse\fP
redo the last jump in the same/opposite direction
.TP
.B \fBjump\-to\-matching\-bracket\fP
jump to matching bracket if the character under the cursor is bracket;
otherwise, jump to the next occurrence of \fIany right\fP bracket after the cursor.
The following brackets are considered: \fB([{}])\fP
.TP
.B \fBjump\-till\-matching\-bracket\fP
the same as \fBjump\-to\-matching\-bracket\fP but offset cursor to the right for left bracket, and offset cursor to the left for right bracket.
The offset is applied for both the position we jump from and position we jump to.
In other words, the cursor will continuously jump inside the brackets but won\(aqt reach them by 1 character.
The input function is useful to emulate \fBib\fP vi text object.
The following brackets are considered: \fB([{}])\fP
.TP
.B \fBkill\-token\fP
move the next argument to the killring
.TP
.B \fBkill\-line\fP
move everything from the cursor to the end of the line to the killring
.TP
.B \fBkill\-path\-component\fP
move one path component to the killring.
.TP
.B \fBkill\-selection\fP
move the selected text to the killring
.TP
.B \fBkill\-whole\-line\fP
move the line (including the following newline) to the killring. If the line is the last line, its preceding newline is also removed
.TP
.B \fBkill\-inner\-line\fP
move the line (without the following newline) to the killring
.TP
.B \fBkill\-word\fP
move the next word to the killring, stopping after the end of the killed word
.TP
.B \fBkill\-word\-vi\fP
move the next word to the killring, stopping at the start of the next word (like vim\(aqs \fBdw\fP)
.TP
.B \fBkill\-bigword\fP
move the next whitespace\-delimited word to the killring, stopping after the end of the current word
.TP
.B \fBkill\-bigword\-vi\fP
move the next whitespace\-delimited word to the killring, stopping at the start of the next word (like vim\(aqs \fBdW\fP)
.TP
.B \fBkill\-inner\-word\fP
delete the word under the cursor (like vim\(aqs \fBdiw\fP)
.TP
.B \fBkill\-inner\-bigword\fP
delete the whitespace\-delimited word under the cursor (like vim\(aqs \fBdiW\fP)
.TP
.B \fBkill\-a\-word\fP
delete the word under the cursor plus surrounding whitespace (like vim\(aqs \fBdaw\fP)
.TP
.B \fBkill\-a\-bigword\fP
delete the whitespace\-delimited word under the cursor plus surrounding whitespace (like vim\(aqs \fBdaW\fP)
.TP
.B \fBnextd\-or\-forward\-word\fP
if the commandline is empty, then move forward in the directory history, otherwise move one word to the right;
or if at the end of the commandline, accept one word from the current autosuggestion.
.TP
.B \fBor\fP
only execute the next function if the previous did not succeed (note: only some functions report failure)
.TP
.B \fBpager\-toggle\-search\fP
toggles the search field if the completions pager is visible; or if used after \fBhistory\-pager\fP, search forwards in time.
.TP
.B \fBprevd\-or\-backward\-word\fP
if the commandline is empty, then move backward in the directory history, otherwise move one word to the left
.TP
.B \fBrepaint\fP
reexecutes the prompt functions and redraws the prompt (also \fBforce\-repaint\fP for backwards\-compatibility)
.TP
.B \fBrepaint\-mode\fP
reexecutes the fish_mode_prompt \%<> and redraws the prompt. This is useful for vi mode. If no \fBfish_mode_prompt\fP exists or it prints nothing, it acts like a normal repaint.
.TP
.B \fBself\-insert\fP
inserts the matching sequence into the command line
.TP
.B \fBself\-insert\-notfirst\fP
inserts the matching sequence into the command line, unless the cursor is at the beginning
.TP
.B \fBget\-key\fP
sets \fBfish_key\fP to the key that was pressed to trigger this binding. Example use:
.INDENT 7.0
.INDENT 3.5
.sp
.EX
for i in (seq 0 9)
    bind $i get\-key \(aqcommandline \-i \(dq#$fish_key\(dq\(aq \(aqset \-eg fish_key\(aq
end
.EE
.UNINDENT
.UNINDENT
.TP
.B \fBsuppress\-autosuggestion\fP
remove the current autosuggestion. Returns true if there was a suggestion to remove.
.TP
.B \fBswap\-selection\-start\-stop\fP
go to the other end of the highlighted text without changing the selection
.TP
.B \fBtranspose\-chars\fP
transpose two characters to the left of the cursor
.TP
.B \fBtranspose\-words\fP
transpose two words to the left of the cursor
.TP
.B \fBtogglecase\-char\fP
toggle the capitalisation (case) of the character under the cursor
.TP
.B \fBtogglecase\-selection\fP
toggle the capitalisation (case) of the selection
.TP
.B \fBinsert\-line\-under\fP
add a new line under the current line
.TP
.B \fBinsert\-line\-over\fP
add a new line over the current line
.TP
.B \fBup\-line\fP
move up one line
.TP
.B \fBundo\fP and \fBredo\fP
revert or redo the most recent edits on the command line
.TP
.B \fBupcase\-word\fP
make the current word uppercase
.TP
.B \fByank\fP
insert the latest entry of the killring into the buffer
.TP
.B \fByank\-pop\fP
rotate to the previous entry of the killring
.UNINDENT
.SS Additional functions
.sp
The following functions are included as normal functions, but are particularly useful for input editing:
.INDENT 0.0
.TP
.B \fBup\-or\-search\fP and \fBdown\-or\-search\fP
move the cursor or search the history depending on the cursor position and current mode
.TP
.B \fBedit_command_buffer\fP
open the visual editor (controlled by the \fBVISUAL\fP or \fBEDITOR\fP environment variables) with the current command\-line contents
.TP
.B \fBfish_clipboard_copy\fP
copy the current selection to the system clipboard
.TP
.B \fBfish_clipboard_paste\fP
paste the current selection from the system clipboard before the cursor
.TP
.B \fBfish_commandline_append\fP
append the argument to the command\-line. If the command\-line already ends with the argument, this removes the suffix instead. Starts with the last command from history if the command\-line is empty.
.TP
.B \fBfish_commandline_prepend\fP
prepend the argument to the command\-line. If the command\-line already starts with the argument, this removes the prefix instead. Starts with the last command from history if the command\-line is empty.
.UNINDENT
.SS Examples
.sp
Exit the shell when \fBctrl\fP\-\fBd\fP is pressed:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind ctrl\-d \(aqexit\(aq
.EE
.UNINDENT
.UNINDENT
.sp
Perform a history search when \fBpageup\fP is pressed:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind pageup history\-search\-backward
.EE
.UNINDENT
.UNINDENT
.sp
Turn on vi key bindings \%<#\:vi-mode> and rebind \fBctrl\fP\-\fBc\fP to clear the input line:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_key_bindings fish_vi_key_bindings
bind \-M insert ctrl\-c kill\-whole\-line repaint
.EE
.UNINDENT
.UNINDENT
.sp
Launch \fBgit diff\fP and repaint the commandline afterwards when \fBctrl\fP\-\fBg\fP is pressed:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind ctrl\-g \(aqgit diff\(aq repaint
.EE
.UNINDENT
.UNINDENT
.sp
Swap \fBtab\fP and \fBshift\fP\-\fBtab\fP, making tab focus the search field.
But if the search field is already active, keep the behavior (\fBtab\fP cycles forward, \fBshift\fP\-\fBtab\fP backward).:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind tab \(aq
    if commandline \-\-search\-field >/dev/null
        commandline \-f complete
    else
        commandline \-f complete\-and\-search
    end
\(aq
bind shift\-tab \(aq
    if commandline \-\-search\-field >/dev/null
        commandline \-f complete\-and\-search
    else
        commandline \-f complete
    end
\(aq
.EE
.UNINDENT
.UNINDENT
.SS Terminal Limitations
.sp
Unix terminals, like the ones fish operates in, are at heart 70s technology. They have some limitations that applications running inside them can\(aqt workaround.
.sp
For instance, historically the control key modifies a character by setting the top three bits to 0. This means:
.INDENT 0.0
.IP \(bu 2
Many characters + control are indistinguishable from other keys: \fBctrl\fP\-\fBi\fP \fIis\fP \fBtab\fP, \fBctrl\fP\-\fBj\fP \fIis\fP newline (\fB\en\fP).
.IP \(bu 2
Control and shift don\(aqt work simultaneously \- \fBctrl\fP\-\fBX\fP is the same as \fBctrl\fP\-\fBx\fP\&.
.UNINDENT
.sp
Other keys don\(aqt have a direct encoding, and are sent as escape sequences. For example \fBright\fP (\fB→\fP) usually sends \fB\ee\e[C\fP\&.
.sp
Some modern terminals support newer encodings for keys, that allow distinguishing more characters and modifiers, and fish enables as many of these as it can, automatically.
.sp
When in doubt, run fish_key_reader \- explore what characters keyboard keys send \%<>\&. If that tells you that pressing \fBctrl\fP\-\fBi\fP sends tab, your terminal does not support these better encodings, and so fish is limited to what it sends.
.SS Key timeout
.sp
When you\(aqve bound a sequence of multiple characters, there is always the possibility that fish has only seen a part of it, and then it needs to disambiguate between the full sequence and part of it.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bind j,k \(aqcommandline \-i foo\(aq
# or \(gabind jk\(ga
.EE
.UNINDENT
.UNINDENT
.sp
will bind the sequence \fBjk\fP to insert \(dqfoo\(dq into the commandline. When you\(aqve only pressed \(dqj\(dq, fish doesn\(aqt know if it should insert the \(dqj\(dq (because of the default self\-insert), or wait for the \(dqk\(dq.
.sp
You can enable a timeout for this, by setting the \fBfish_sequence_key_delay_ms\fP \%<#\:envvar-fish_sequence_key_delay_ms> variable to the timeout in milliseconds. If the timeout elapses, fish will no longer wait for the sequence to be completed, and do what it can with the characters it already has.
.sp
The escape key is a special case, because it can be used standalone as a real key or as part of a longer escape sequence, like function or arrow keys. Holding alt and something else also typically sends escape, for example holding alt+a will send an escape character and then an \(dqa\(dq. So the escape character has its own timeout configured with \fBfish_escape_delay_ms\fP \%<#\:envvar-fish_escape_delay_ms>\&.
.sp
See also Key sequences \%<#\:interactive-key-sequences>\&.
.SS block \- temporarily block delivery of events
.SS Synopsis
.nf
\fBblock\fP [(\fB\-\-local\fP | \fB\-\-global\fP)]
\fBblock\fP \fB\-\-erase\fP
.fi
.sp
.SS Description
.sp
\fBblock\fP delays delivery of all events triggered by \fBfish\fP or the emit \%<>, thus delaying the execution of any function registered \fB\-\-on\-event\fP, \fB\-\-on\-process\-exit\fP, \fB\-\-on\-job\-exit\fP, \fB\-\-on\-variable\fP and \fB\-\-on\-signal\fP until after the block is removed.
.sp
Event blocks should not be confused with code blocks, which are created with \fBbegin\fP, \fBif\fP, \fBwhile\fP or \fBfor\fP
.sp
Without options, \fBblock\fP sets up a block that is released automatically at the end of the current function scope.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-l\fP or \fB\-\-local\fP
Release the block automatically at the end of the current innermost code block scope.
.TP
\fB\-g\fP or \fB\-\-global\fP
Never automatically release the lock.
.TP
\fB\-e\fP or \fB\-\-erase\fP
Release global block.
.TP
\fB\-h\fP or \fB\-\-help\fP
Display help about using this command.
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Create a function that listens for events
function \-\-on\-event foo foo; echo \(aqfoo fired\(aq; end

# Block the delivery of events
block \-g

emit foo
# No output will be produced

block \-e
# \(aqfoo fired\(aq will now be printed
.EE
.UNINDENT
.UNINDENT
.SS Notes
.sp
Events are only received from the current fish process as there is no way to send events from one fish process to another.
.SS break \- stop the current inner loop
.SS Synopsis
.nf
\fILOOP_CONSTRUCT\fP
   [\fICOMMANDS\fP \&...]
   \fBbreak\fP
   [\fICOMMANDS\fP \&...]
\fBend\fP
.fi
.sp
.SS Description
.sp
\fBbreak\fP halts a currently running loop (\fILOOP_CONSTRUCT\fP), such as a for \%<> or while \%<> loop. It is usually added inside of a conditional block such as an if \%<> block.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code searches all .c files for \(dqsmurf\(dq, and halts at the first occurrence.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in *.c
    if grep smurf $i
        echo Smurfs are present in $i
        break
    end
end
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the continue \%<> command, to skip the remainder of the current iteration of the current inner loop
.UNINDENT
.SS breakpoint \- launch debug mode
.SS Synopsis
.nf
\fBbreakpoint\fP
.fi
.sp
.SS Description
.sp
\fBbreakpoint\fP is used to halt a running script and launch an interactive debugging prompt.
.sp
For more details, see Debugging fish scripts \%<#\:debugging> in the \fBfish\fP manual.
.sp
There are no parameters for \fBbreakpoint\fP\&.
.SS builtin \- run a builtin command
.SS Synopsis
.nf
\fBbuiltin\fP [\fIOPTIONS\fP] \fIBUILTINNAME\fP
\fBbuiltin\fP \fB\-\-query\fP \fIBUILTINNAME\fP \&...
\fBbuiltin\fP \fB\-\-names\fP
.fi
.sp
.SS Description
.sp
\fBbuiltin\fP forces the shell to use a builtin command named \fIBUILTIN\fP, rather than a function or external program.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-n\fP or \fB\-\-names\fP
Lists the names of all defined builtins.
.TP
\fB\-q\fP or \fB\-\-query\fP \fIBUILTIN\fP
Tests if any of the specified builtins exist. If any exist, it returns 0, 1 otherwise.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
builtin jobs
# executes the jobs builtin, even if a function named jobs exists
.EE
.UNINDENT
.UNINDENT
.SS case \- conditionally execute a block of commands
.SS Synopsis
.nf
\fBswitch\fP \fIVALUE\fP
   [\fBcase\fP [\fIGLOB\fP \&...]
       [\fICOMMAND\fP \&...]]
\fBend\fP
.fi
.sp
.SS Description
.sp
\fBswitch\fP executes one of several blocks of commands, depending on whether a specified value matches one of several values. \fBcase\fP is used together with the \fBswitch\fP statement in order to determine which block should be executed.
.sp
Each \fBcase\fP command is given one or more parameters. The first \fBcase\fP command with a parameter that matches the string specified in the switch command will be evaluated. \fBcase\fP parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
.sp
Note that fish does not fall through on case statements. Only the first matching case is executed.
.sp
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
.SS Example
.sp
Say $animal contains the name of an animal. Then this code would classify it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
switch $animal
    case cat
        echo evil
    case wolf dog human moose dolphin whale
        echo mammal
    case duck goose albatross
        echo bird
    case shark trout stingray
        echo fish
    # Note that the next case has a wildcard which is quoted
    case \(aq*\(aq
        echo I have no idea what a $animal is
end
.EE
.UNINDENT
.UNINDENT
.sp
If the above code was run with \fB$animal\fP set to \fBwhale\fP, the output
would be \fBmammal\fP\&.
.sp
If \fB$animal\fP was set to \(dqbanana\(dq, it would print \(dqI have no idea what a banana is\(dq.
.SS cd \- change directory
.SS Synopsis
.nf
\fBcd\fP [\fIDIRECTORY\fP]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBcd\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man cd\fP\&.
.sp
\fBcd\fP changes the current working directory.
.sp
If \fIDIRECTORY\fP is given, it will become the new directory. If no parameter is given, the \fBHOME\fP \%<#\:envvar-HOME> environment variable will be used.
.sp
If \fIDIRECTORY\fP is a relative path, all the paths in the \fBCDPATH\fP \%<#\:envvar-CDPATH> will be tried as prefixes for it, in addition to \fBPWD\fP \%<#\:envvar-PWD>\&.
It is recommended to keep \fB\&.\fP as the first element of \fBCDPATH\fP \%<#\:envvar-CDPATH>, or \fBPWD\fP \%<#\:envvar-PWD> will be tried last.
.sp
Fish will also try to change directory if given a command that looks like a directory (starting with \fB\&.\fP, \fB/\fP or \fB~\fP, or ending with \fB/\fP), without explicitly requiring \fBcd\fP\&.
.sp
Fish also ships a wrapper function around the builtin \fBcd\fP that understands \fBcd \-\fP as changing to the previous directory.
See also prevd \%<>\&.
This wrapper function maintains a history of the 25 most recently visited directories in the \fB$dirprev\fP and \fB$dirnext\fP global variables.
If you make those universal variables your \fBcd\fP history is shared among all fish instances.
.sp
As a special case, \fBcd .\fP is equivalent to \fBcd $PWD\fP, which is useful in cases where a mountpoint has been recycled or a directory has been removed and recreated.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command, and does not change the directory.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cd
# changes the working directory to your home directory.

cd /usr/src/fish\-shell
# changes the working directory to /usr/src/fish\-shell
.EE
.UNINDENT
.UNINDENT
.SS See Also
.sp
Navigate directories using the directory history \%<#\:directory-history> or the directory stack \%<#\:directory-stack>
.SS cdh \- change to a recently visited directory
.SS Synopsis
.nf
\fBcdh\fP [\fIDIRECTORY\fP]
.fi
.sp
.SS Description
.sp
\fBcdh\fP with no arguments presents a list of recently visited directories \%<#\:directory-history>\&.
You can then select one of the entries by letter or number.
You can also press \fBtab\fP to use the completion pager to select an item from the list.
If you give it a single argument it is equivalent to \fBcd DIRECTORY\fP\&.
.sp
Note that the \fBcd\fP command limits directory history to the 25 most recently visited directories.
The history is stored in the \fBdirprev\fP and \fBdirnext\fP variables, which this command manipulates.
If you make those universal variables, your \fBcd\fP history is shared among all fish instances.
.SS See Also
.INDENT 0.0
.IP \(bu 2
the dirh \%<> command to print the directory history
.IP \(bu 2
the prevd \%<> command to move backward
.IP \(bu 2
the nextd \%<> command to move forward
.UNINDENT
.SS command \- run a program
.SS Synopsis
.nf
\fBcommand\fP [\fIOPTIONS\fP] [\fICOMMANDNAME\fP [\fIARG\fP \&...]]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBcommand\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man command\fP\&.
.sp
\fBcommand\fP forces the shell to execute the program \fICOMMANDNAME\fP and ignore any functions or builtins with the same name.
.sp
In \fBcommand foo\fP, \fBcommand\fP is a keyword.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-all\fP
Prints all \fICOMMAND\fP found in \fBPATH\fP \%<#\:envvar-PATH>, in the order found.
.TP
\fB\-q\fP or \fB\-\-query\fP
Return 0 if any of the given commands could be found, 127 otherwise.
Don\(aqt print anything.
For compatibility, this is also \fB\-\-quiet\fP (deprecated).
.TP
\fB\-s\fP or \fB\-\-search\fP (or \fB\-v\fP)
Prints the external command that would be executed, or prints nothing if no file with the specified name could be found in \fBPATH\fP \%<#\:envvar-PATH>\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Examples
.nf
\fBcommand ls\fP executes the \fBls\fP program, even if an \fBls\fP function also exists.
\fBcommand \-s ls\fP prints the path to the \fBls\fP program.
\fBcommand \-q git; and command git log\fP runs \fBgit log\fP only if \fBgit\fP exists.
\fBcommand \-sq git\fP and \fBcommand \-q git\fP and \fBcommand \-vq git\fP return true (0) if a git command could be found and don\(aqt print anything.
.fi
.sp
.SS commandline \- set or get the current command line buffer
.SS Synopsis
.nf
\fBcommandline\fP [\fIOPTIONS\fP] [\fICMD\fP]
.fi
.sp
.SS Description
.sp
\fBcommandline\fP can be used to set or get the current contents of the command line buffer.
.sp
With no parameters, \fBcommandline\fP returns the current value of the command line.
.sp
With \fBCMD\fP specified, the command line buffer is erased and replaced with the contents of \fBCMD\fP\&.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-C\fP or \fB\-\-cursor\fP
Set or get the current cursor position, not the contents of the buffer.
If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position.
If one of the options \fB\-j\fP, \fB\-p\fP or \fB\-t\fP is given, the position is relative to the respective substring instead of the entire command line buffer.
.TP
\fB\-B\fP or \fB\-\-selection\-start\fP
Get current position of the selection start in the buffer.
.TP
\fB\-E\fP or \fB\-\-selection\-end\fP
Get current position of the selection end in the buffer.
.TP
\fB\-f\fP or \fB\-\-function\fP
Causes any additional arguments to be interpreted as input functions, and puts them into the queue, so that they will be read before any additional actual key presses are.
This option cannot be combined with any other option.
See bind \%<> for a list of input functions.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
The following options change the way \fBcommandline\fP updates the command line buffer:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-append\fP
Do not remove the current commandline, append the specified string at the end of it.
.TP
\fB\-i\fP, \fB\-\-insert\fP or \fB\-\-insert\-smart\fP
Do not remove the current commandline, insert the specified string at the current cursor position.
The \fB\-\-insert\-smart\fP option turns on a Do\-What\-I\-Mean (DWIM) mode: it strips any \fB$\fP prefix from the first command on each line.
.TP
\fB\-r\fP or \fB\-\-replace\fP
Remove the current commandline and replace it with the specified string (default)
.UNINDENT
.sp
The following options change what part of the commandline is printed or updated:
.INDENT 0.0
.TP
\fB\-b\fP or \fB\-\-current\-buffer\fP
Select the entire commandline, not including any displayed autosuggestion (default).
.TP
\fB\-j\fP or \fB\-\-current\-job\fP
Select the current job \- a \fBjob\fP here is one pipeline.
Stops at logical operators or terminators (\fB;\fP, \fB&\fP, and newlines).
.TP
\fB\-p\fP or \fB\-\-current\-process\fP
Select the current process \- a \fBprocess\fP here is one command.
Stops at logical operators, terminators, and pipes.
.TP
\fB\-s\fP or \fB\-\-current\-selection\fP
Selects the current selection
.TP
\fB\-t\fP or \fB\-\-current\-token\fP
Selects the current token
.TP
\fB\-\-search\-field\fP
Use the pager search field instead of the command line. Returns false if the search field is not shown.
.TP
\fB\-\-input=INPUT\fP
Operate on this string instead of the commandline. Useful for using options like \fB\-\-tokens\-expanded\fP\&.
.UNINDENT
.sp
The following options change the way \fBcommandline\fP prints the current commandline buffer:
.INDENT 0.0
.TP
\fB\-c\fP or \fB\-\-cut\-at\-cursor\fP
Only print selection up until the current cursor position.
If combined with \fB\-\-tokens\-expanded\fP, this will print up until the last completed token \- excluding the token the cursor is in.
This is typically what you would want for instance in completions.
To get both, use both \fBcommandline \-\-cut\-at\-cursor \-\-tokens\-expanded; commandline \-\-cut\-at\-cursor \-\-current\-token\fP,
or \fBcommandline \-cx; commandline \-ct\fP for short.
.TP
\fB\-x\fP or \fB\-\-tokens\-expanded\fP
Perform argument expansion on the selection and print one argument per line.
Command substitutions are not expanded but forwarded as\-is.
.TP
\fB\-o\fP, \fBtokenize\fP, \fB\-\-tokens\-raw\fP
Deprecated; do not use.
.UNINDENT
.sp
If \fBcommandline\fP is called during a call to complete a given string using \fBcomplete \-C STRING\fP, \fBcommandline\fP will consider the specified string to be the current contents of the command line.
.sp
The following options output metadata about the commandline state:
.INDENT 0.0
.TP
\fB\-L\fP or \fB\-\-line\fP
If no argument is given, print the line that the cursor is on, with the topmost line starting at 1.
Otherwise, set the cursor to the given line.
.TP
\fB\-\-column\fP
If no argument is given, print the 1\-based offset from the start of the line to the cursor position in Unicode code points.
Otherwise, set the cursor to the given code point offset.
.TP
\fB\-S\fP or \fB\-\-search\-mode\fP
Evaluates to true if the commandline is performing a history search.
.TP
\fB\-P\fP or \fB\-\-paging\-mode\fP
Evaluates to true if the commandline is showing pager contents, such as tab completions.
.TP
\fB\-\-paging\-full\-mode\fP
Evaluates to true if the commandline is showing pager contents, such as tab completions and all lines are shown (no \(dq<n> more rows\(dq message).
.TP
\fB\-\-is\-valid\fP
Returns true when the commandline is syntactically valid and complete.
If it is, it would be executed when the \fBexecute\fP bind function is called.
If the commandline is incomplete, return 2, if erroneous, return 1.
.TP
\fB\-\-showing\-suggestion\fP
Evaluates to true (i.e. returns 0) when the shell is currently showing an automatic history completion/suggestion, available to be consumed via one of the \fIforward\-\fP bindings.
For example, can be used to determine if moving the cursor to the right when already at the end of the line would have no effect or if it would cause a completion to be accepted (note that \fIforward\-char\-passive\fP does this automatically).
.UNINDENT
.SS Example
.sp
\fBcommandline \-j $history[3]\fP replaces the job under the cursor with the third item from the command line history.
.sp
If the commandline contains
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo $flounder >&2 | less; and echo $catfish
.EE
.UNINDENT
.UNINDENT
.sp
(with the cursor on the \(dqo\(dq of \(dqflounder\(dq)
.sp
The \fBecho $flounder >&\fP is the first process, \fBless\fP the second and \fBand echo $catfish\fP the third.
.sp
\fBecho $flounder >&2 | less\fP is the first job, \fBand echo $catfish\fP the second.
.sp
\fB$flounder\fP is the current token.
.sp
The most common use for something like completions is
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l tokens (commandline \-xpc)
.EE
.UNINDENT
.UNINDENT
.sp
which gives the current \fIprocess\fP (what is being completed), tokenized into separate entries, up to but excluding the currently being completed token
.sp
If you are then also interested in the in\-progress token, add
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l current (commandline \-ct)
.EE
.UNINDENT
.UNINDENT
.sp
Note that this makes it easy to render fish\(aqs infix matching moot \- if possible it\(aqs best if the completions just print all possibilities and leave the matching to the current token up to fish\(aqs logic.
.sp
More examples:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ commandline \-t
$flounder
>_ commandline \-ct
$fl
>_ commandline \-b # or just commandline
echo $flounder >&2 | less; and echo $catfish
>_ commandline \-p
echo $flounder >&2
>_ commandline \-j
echo $flounder >&2 | less
.EE
.UNINDENT
.UNINDENT
.SS complete \- edit command\-specific tab\-completions
.SS Synopsis
.nf
\fBcomplete\fP ((\fB\-c\fP | \fB\-\-command\fP) | (\fB\-p\fP | \fB\-\-path\fP)) \fICOMMAND\fP [\fIOPTIONS\fP] [\fB\-\-color\fP \fIWHEN\fP]
\fBcomplete\fP (\fB\-C\fP | \fB\-\-do\-complete\fP) [\fB\-\-escape\fP] \fISTRING\fP
.fi
.sp
.SS Description
.sp
\fBcomplete\fP defines, removes or lists completions for a command.
.sp
For an introduction to writing your own completions, see Writing your own completions \%<> in
the fish manual.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-c\fP or \fB\-\-command\fP \fICOMMAND\fP
Specifies that \fICOMMAND\fP is the name of the command. If there is no \fB\-c\fP or \fB\-p\fP, one non\-option argument will be used as the command.
.TP
\fB\-p\fP or \fB\-\-path\fP \fICOMMAND\fP
Specifies that \fICOMMAND\fP is the absolute path of the command (optionally containing wildcards).
.TP
\fB\-e\fP or \fB\-\-erase\fP
Deletes the specified completion.
.TP
\fB\-s\fP or \fB\-\-short\-option\fP \fISHORT_OPTION\fP
Adds a short option to the completions list.
.TP
\fB\-l\fP or \fB\-\-long\-option\fP \fILONG_OPTION\fP
Adds a GNU\-style long option to the completions list.
.TP
\fB\-o\fP or \fB\-\-old\-option\fP \fIOPTION\fP
Adds an old\-style short or long option (see below for details).
.TP
\fB\-a\fP or \fB\-\-arguments\fP \fIARGUMENTS\fP
Adds the specified option arguments to the completions list.
.TP
\fB\-k\fP or \fB\-\-keep\-order\fP
Keeps the order of \fIARGUMENTS\fP instead of sorting alphabetically. Multiple \fBcomplete\fP calls with \fB\-k\fP result in arguments of the later ones displayed first.
.TP
\fB\-f\fP or \fB\-\-no\-files\fP
This completion may not be followed by a filename.
.TP
\fB\-F\fP or \fB\-\-force\-files\fP
This completion may be followed by a filename, even if another applicable \fBcomplete\fP specified \fB\-\-no\-files\fP\&.
.TP
\fB\-r\fP or \fB\-\-require\-parameter\fP
This completion must have an option argument, i.e. may not be followed by another option.
This means that the next argument is the argument to the option.
If this is \fInot\fP given, the option argument must be attached like \fB\-xFoo\fP or \fB\-\-color=auto\fP\&.
.TP
\fB\-x\fP or \fB\-\-exclusive\fP
Short for \fB\-r\fP and \fB\-f\fP\&.
.TP
\fB\-d\fP or \fB\-\-description\fP \fIDESCRIPTION\fP
Add a description for this completion, to be shown in the completion pager.
.TP
\fB\-w\fP or \fB\-\-wraps\fP \fIWRAPPED_COMMAND\fP
Causes the specified command to inherit completions from \fIWRAPPED_COMMAND\fP\&.
This is used for \(dqthis command completes like that other command\(dq kinds of relationships.
See below for details.
.TP
\fB\-n\fP or \fB\-\-condition\fP \fICONDITION\fP
This completion should only be used if the \fICONDITION\fP (a shell command) returns 0. This makes it possible to specify completions that should only be used in some cases. If multiple conditions are specified, fish will try them in the order they are specified until one fails or all succeeded.
.TP
\fB\-C\fP or \fB\-\-do\-complete\fP \fISTRING\fP
Makes \fBcomplete\fP try to find all possible completions for the specified string. If there is no \fISTRING\fP, the current commandline is used instead.
.TP
\fB\-\-escape\fP
When used with \fB\-C\fP, escape special characters in completions.
.TP
\fB\-\-color\fP \fIWHEN\fP
Controls when to use syntax highlighting colors when printing completions.
\fIWHEN\fP can be \fBauto\fP (the default, colorize if the output is a terminal \%<>), \fBalways\fP, or \fBnever\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
Command\-specific tab\-completions in \fBfish\fP are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as \fB\-h\fP, \fB\-help\fP or \fB\-\-help\fP\&. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU getopt library. These styles are:
.INDENT 0.0
.IP \(bu 2
Short options, like \fB\-a\fP\&. Short options are a single character long, are preceded by a single hyphen and can be grouped together (like \fB\-la\fP, which is equivalent to \fB\-l \-a\fP). Option arguments may be specified by appending the option with the value (\fB\-w32\fP), or, if \fB\-\-require\-parameter\fP is given, in the following parameter (\fB\-w 32\fP).
.IP \(bu 2
Old\-style options, long like \fB\-Wall\fP or \fB\-name\fP or even short like \fB\-a\fP\&. Old\-style options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified by default following a space (\fB\-foo null\fP) or after \fB=\fP (\fB\-foo=null\fP).
.IP \(bu 2
GNU\-style long options, like \fB\-\-colors\fP\&. GNU\-style long options can be more than one character long, are preceded by two hyphens, and can\(aqt be grouped together. Option arguments may be specified after a \fB=\fP (\fB\-\-quoting\-style=shell\fP), or, if \fB\-\-require\-parameter\fP is given, in the following parameter (\fB\-\-quoting\-style shell\fP).
.UNINDENT
.sp
Multiple commands and paths can be given in one call to define the same completions for multiple commands.
.sp
Multiple command switches and wrapped commands can also be given to define multiple completions in one call.
.sp
Invoking \fBcomplete\fP multiple times for the same command adds the new definitions on top of any existing completions defined for the command.
.sp
When \fB\-a\fP or \fB\-\-arguments\fP is specified in conjunction with long, short, or old\-style options, the specified arguments are only completed as arguments for any of the specified options. If \fB\-a\fP or \fB\-\-arguments\fP is specified without any long, short, or old\-style options, the specified arguments are used when completing non\-option arguments to the command (except when completing an option argument that was specified with \fB\-r\fP or \fB\-\-require\-parameter\fP).
.sp
Command substitutions found in \fBARGUMENTS\fP should return a newline\-separated list of arguments, and each argument may optionally have a tab character followed by the argument description. Description given this way override a description given with \fB\-d\fP or \fB\-\-description\fP\&.
.sp
Descriptions given with \fB\-\-description\fP are also used to group options given with \fB\-s\fP, \fB\-o\fP or \fB\-l\fP\&. Options with the same (non\-empty) description will be listed as one candidate, and one of them will be picked. If the description is empty or no description was given this is skipped.
.sp
The \fB\-w\fP or \fB\-\-wraps\fP options causes the specified command to inherit completions from another command, \(dqwrapping\(dq the other command. The wrapping command can also have additional completions. A command can wrap multiple commands, and wrapping is transitive: if A wraps B, and B wraps C, then A automatically inherits all of C\(aqs completions. Wrapping can be removed using the \fB\-e\fP or \fB\-\-erase\fP options. Wrapping only works for completions specified with \fB\-c\fP or \fB\-\-command\fP and are ignored when specifying completions with \fB\-p\fP or \fB\-\-path\fP\&.
.sp
When erasing completions, it is possible to either erase all completions for a specific command by specifying \fBcomplete \-c COMMAND \-e\fP, or by specifying a specific completion option to delete.
.sp
When \fBcomplete\fP is called without anything that would define or erase completions (options, arguments, wrapping, ...), it shows matching completions instead. So \fBcomplete\fP without any arguments shows all loaded completions, \fBcomplete \-c foo\fP shows all loaded completions for \fBfoo\fP\&. Since completions are autoloaded \%<#\:syntax-function-autoloading>, you will have to trigger them first.
.SS Cygwin / MSYS2 / Windows
.sp
On Windows, binary executables have a \fB\&.exe\fP extension, but this extension is not required when calling an application (and if the name is not ambiguous, i.e. there isn\(aqt also a script called \fBmyprog\fP in the same directory as \fBmyprog.exe\fP).
.sp
To unify completions between Windows and other OSes, on Cygwin/MSYS2/Windows, \fICOMMAND\fP does not require the \fB\&.exe\fP extension.
Completions for \fBmyprog\fP will also be used for \fBmyprog.exe\fP if there are no ambiguities, i.e. if there are no completions for \fBmyprog.exe\fP specifically.
However, completions for \fBmyprog.exe\fP will only be used when also using the \fB\&.exe\fP extension on the command line.
.sp
In other words:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog.exe ...  #1
.EE
.UNINDENT
.UNINDENT
.sp
will only work for \fBmyprog.exe\fP
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog ...  #2
.EE
.UNINDENT
.UNINDENT
.sp
can work for both \fBmyprog\fP and \fBmyprog.exe\fP\&. But if both completions exist, #2 will only be used for \fBmyprog\fP while \fBmyprog.exe\fP will use #1.
.SS Examples
.sp
The short\-style option \fB\-o\fP for the \fBgcc\fP command needs a file argument:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c gcc \-s o \-r
.EE
.UNINDENT
.UNINDENT
.sp
The short\-style option \fB\-d\fP for the \fBgrep\fP command requires one of \fBread\fP, \fBskip\fP or \fBrecurse\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c grep \-s d \-x \-a \(dqread skip recurse\(dq
.EE
.UNINDENT
.UNINDENT
.sp
The \fBsu\fP command takes any username as an argument. Usernames are given as the first colon\-separated field in the file /etc/passwd. This can be specified as:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-x \-c su \-d \(dqUsername\(dq \-a \(dq(cat /etc/passwd | cut \-d : \-f 1)\(dq
.EE
.UNINDENT
.UNINDENT
.sp
The \fBrpm\fP command has several different modes. If the \fB\-e\fP or \fB\-\-erase\fP flag has been specified, \fBrpm\fP should delete one or more packages, in which case several switches related to deleting packages are valid, like the \fBnodeps\fP switch.
.sp
This can be written as:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c rpm \-n \(dq__fish_contains_opt \-s e erase\(dq \-l nodeps \-d \(dqDon\(aqt check dependencies\(dq
.EE
.UNINDENT
.UNINDENT
.sp
where \fB__fish_contains_opt\fP is a function that checks the command line buffer for the presence of a specified set of options.
.sp
To implement an alias, use the \fB\-w\fP or \fB\-\-wraps\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c hub \-w git
.EE
.UNINDENT
.UNINDENT
.sp
Now hub inherits all of the completions from git. Note this can also be specified in a function declaration (\fBfunction thing \-w otherthing\fP).
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c git
.EE
.UNINDENT
.UNINDENT
.sp
Shows all completions for \fBgit\fP\&.
.sp
Any command \fBfoo\fP that doesn\(aqt support grouping multiple short options in one string (not supporting \fB\-xf\fP as short for \fB\-x \-f\fP) or a short option and its value in one string (not supporting \fB\-d9\fP instead of \fB\-d 9\fP) should be specified as a single\-character old\-style option instead of as a short\-style option; for example, \fBcomplete \-c foo \-o s; complete \-c foo \-o v\fP would never suggest \fBfoo \-ov\fP but rather \fBfoo \-o \-v\fP\&.
.SS contains \- test if a word is present in a list
.SS Synopsis
.nf
\fBcontains\fP [\fIOPTIONS\fP] \fIKEY\fP [\fIVALUES\fP \&...]
.fi
.sp
.SS Description
.sp
\fBcontains\fP tests whether the set \fIVALUES\fP contains the string \fIKEY\fP\&.
If so, \fBcontains\fP exits with code 0; if not, it exits with code 1.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-i\fP or \fB\-\-index\fP
Print the index (number of the element in the set) of the first matching element.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
Note that \fBcontains\fP interprets all arguments starting with a \fB\-\fP as an option to \fBcontains\fP, until an \fB\-\-\fP argument is reached.
.sp
See the examples below.
.SS Example
.sp
If \fIanimals\fP is a list of animals, the following will test if \fIanimals\fP contains \(dqcat\(dq:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if contains cat $animals
   echo Your animal list is evil!
end
.EE
.UNINDENT
.UNINDENT
.sp
This code will add some directories to \fBPATH\fP \%<#\:envvar-PATH> if they aren\(aqt yet included:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in ~/bin /usr/local/bin
    if not contains $i $PATH
        set PATH $PATH $i
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
While this will check if function \fBhasargs\fP is being ran with the \fB\-q\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function hasargs
    if contains \-\- \-q $argv
        echo \(aq$argv contains a \-q option\(aq
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
The \fB\-\-\fP here stops \fBcontains\fP from treating \fB\-q\fP to an option to itself.
Instead it treats it as a normal string to check.
.SS continue \- skip the remainder of the current iteration of the current inner loop
.SS Synopsis
.nf
\fILOOP_CONSTRUCT\fP\fB;\fP [\fICOMMANDS\fP \&...\fB;\fP] \fBcontinue\fP\fB;\fP [\fICOMMANDS\fP \&...\fB;\fP] \fBend\fP
.fi
.sp
.SS Description
.sp
\fBcontinue\fP skips the remainder of the current iteration of the current inner loop, such as a for \%<> loop or a while \%<> loop. It is usually added inside of a conditional block such as an if \%<> statement or a switch \%<> statement.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code removes all tmp files that do not contain the word smurf.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in *.tmp
    if grep smurf $i
        continue
    end
    # This \(dqrm\(dq is skipped over if \(dqcontinue\(dq is executed.
    rm $i
    # As is this \(dqecho\(dq
    echo $i
end
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the break \%<> command, to stop the current inner loop
.UNINDENT
.SS count \- count the number of elements of a list
.SS Synopsis
.nf
\fBcount\fP \fISTRING1\fP \fISTRING2\fP \&...
\fICOMMAND\fP | \fBcount\fP
\fBcount\fP [\&...] \fB<\fP \fIFILE\fP
.fi
.sp
.SS Description
.sp
\fBcount\fP prints the number of arguments that were passed to it, plus the number of newlines passed to it via stdin. This is usually used to find out how many elements an environment variable list contains, or how many lines there are in a text file.
.sp
\fBcount\fP does not accept any options, not even \fB\-h\fP or \fB\-\-help\fP\&.
.sp
\fBcount\fP exits with a non\-zero exit status if no arguments were passed to it, and with zero if at least one argument was passed.
.sp
Note that, like \fBwc \-l\fP, reading from stdin counts newlines, so \fBecho \-n foo | count\fP will print 0.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
count $PATH
# Returns the number of directories in the users PATH variable.

count *.txt
# Returns the number of files in the current working directory
# ending with the suffix \(aq.txt\(aq.

git ls\-files \-\-others \-\-exclude\-standard | count
# Returns the number of untracked files in a git repository

printf \(aq%s\en\(aq foo bar | count baz
# Returns 3 (2 lines from stdin plus 1 argument)

count < /etc/hosts
# Counts the number of entries in the hosts file
.EE
.UNINDENT
.UNINDENT
.SS dirh \- print directory history
.SS Synopsis
.nf
\fBdirh\fP
.fi
.sp
.SS Description
.sp
\fBdirh\fP prints the current directory history \%<#\:directory-history>\&. The current position in the history is highlighted using the color defined in the \fBfish_color_history_current\fP environment variable.
.sp
\fBdirh\fP does not accept any parameters.
.sp
Note that the cd \%<> command limits directory history to the 25 most recently visited directories. The history is stored in the \fB$dirprev\fP and \fB$dirnext\fP variables.
.SS See Also
.INDENT 0.0
.IP \(bu 2
the cdh \%<> command to display a prompt to quickly navigate the history
.IP \(bu 2
the prevd \%<> command to move backward
.IP \(bu 2
the nextd \%<> command to move forward
.UNINDENT
.SS dirs \- print directory stack
.SS Synopsis
.nf
\fBdirs\fP [\fB\-c\fP]
.fi
.sp
.SS Description
.sp
\fBdirs\fP prints the current directory stack \%<#\:directory-stack>, as created by pushd \%<> and modified by popd \%<>\&.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-c\fP:
Clear the directory stack instead of printing it.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
\fBdirs\fP does not accept any arguments.
.SS See Also
.INDENT 0.0
.IP \(bu 2
the cdh \%<> command, which provides a more intuitive way to navigate to recently visited directories.
.UNINDENT
.SS disown \- remove a process from the list of jobs
.SS Synopsis
.nf
\fBdisown\fP [\fIPID\fP \&...]
.fi
.sp
.SS Description
.sp
\fBdisown\fP removes the specified job \%<#\:syntax-job-control> from the list of jobs. The job itself continues to exist, but fish does not keep track of it any longer.
This will make fish lose all knowledge of the job, so functions defined with \fB\-\-on\-process\-exit\fP or \fB\-\-on\-job\-exit\fP will no longer fire.
.sp
Jobs in the list of jobs are sent a hang\-up signal when fish terminates, which usually causes the job to terminate; \fBdisown\fP allows these processes to continue regardless.
.sp
If no process is specified, the most recently\-used job is removed (like bg \%<> and fg \%<>).  If one or more PIDs are specified, jobs with the specified process IDs are removed from the job list. Invalid jobs are ignored and a warning is printed.
.sp
If a job is stopped, it is sent a signal to continue running, and a warning is printed. It is not possible to use the bg \%<> builtin to continue a job once it has been disowned.
.sp
\fBdisown\fP returns 0 if all specified jobs were disowned successfully, and 1 if any problems were encountered.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command.
.SS Example
.sp
\fBfirefox &; disown\fP will start the Firefox web browser in the background and remove it from the job list, meaning it will not be closed when the fish process is closed.
.sp
\fBdisown (jobs \-p)\fP removes all jobs \%<> from the job list without terminating them.
.SS echo \- display a line of text
.SS Synopsis
.nf
\fBecho\fP [\fIOPTIONS\fP] [\fISTRING\fP]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBecho\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man echo\fP\&.
.sp
\fBecho\fP displays \fISTRING\fP of text.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-n\fP
Do not output a newline.
.TP
\fB\-s\fP
Do not separate arguments with spaces.
.TP
\fB\-E\fP
Disable interpretation of backslash escapes (default).
.TP
\fB\-e\fP
Enable interpretation of backslash escapes.
.UNINDENT
.sp
Unlike other shells, this echo accepts \fB\-\-\fP to signal the end of the options.
.SS Escape Sequences
.sp
If \fB\-e\fP is used, the following sequences are recognized:
.INDENT 0.0
.IP \(bu 2
\fB\e\fP backslash
.IP \(bu 2
\fB\ea\fP alert (BEL)
.IP \(bu 2
\fB\eb\fP backspace
.IP \(bu 2
\fB\ec\fP produce no further output
.IP \(bu 2
\fB\ee\fP escape
.IP \(bu 2
\fB\ef\fP form feed
.IP \(bu 2
\fB\en\fP new line
.IP \(bu 2
\fB\er\fP carriage return
.IP \(bu 2
\fB\et\fP horizontal tab
.IP \(bu 2
\fB\ev\fP vertical tab
.IP \(bu 2
\fB\e0NNN\fP byte with octal value NNN (1 to 3 digits)
.IP \(bu 2
\fB\exHH\fP byte with hexadecimal value HH (1 to 2 digits)
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo \(aqHello World\(aq
Hello World

> echo \-e \(aqTop\enBottom\(aq
Top
Bottom

> echo \-\- \-n
\-n
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the printf \%<> command, for more control over output formatting
.UNINDENT
.SS else \- execute command if a condition is not met
.SS Synopsis
.nf
\fBif\fP \fICONDITION\fP\fB;\fP \fICOMMANDS_TRUE\fP \&...\fB;\fP [\fBelse\fP\fB;\fP \fICOMMANDS_FALSE\fP \&...\fB;\fP] \fBend\fP
.fi
.sp
.SS Description
.sp
if \%<> will execute the command \fICONDITION*\fP\&.
If the condition\(aqs exit status is 0, the commands \fICOMMANDS_TRUE\fP will execute.
If it is not 0 and \fBelse\fP is given, \fICOMMANDS_FALSE\fP will be executed.
.SS Example
.sp
The following code tests whether a file \fIfoo.txt\fP exists as a regular file.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-f foo.txt
    echo foo.txt exists
else
    echo foo.txt does not exist
end
.EE
.UNINDENT
.UNINDENT
.SS emit \- emit a generic event
.SS Synopsis
.nf
\fBemit\fP \fIEVENT_NAME\fP [\fIARGUMENTS\fP \&...]
.fi
.sp
.SS Description
.sp
\fBemit\fP emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers \%<#\:event>\&. The arguments are passed to the event handlers as function arguments.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command.
.SS Example
.sp
The following code first defines an event handler for the generic event named \(aqtest_event\(aq, and then emits an event of that type.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function event_test \-\-on\-event test_event
    echo event test: $argv
end

emit test_event something
.EE
.UNINDENT
.UNINDENT
.SS Notes
.sp
Note that events are only sent to the current fish process as there is no way to send events from one fish process to another.
.SS end \- end a block of commands
.SS Synopsis
.nf
\fBbegin\fP
    [\fICOMMANDS\fP \&...]
\fBend\fP
.fi
.sp
.nf
\fBfunction\fP \fINAME\fP [\fIOPTIONS\fP]\fB;\fP \fICOMMANDS\fP \&...\fB;\fP \fBend\fP
\fBif\fP \fICONDITION\fP\fB;\fP \fICOMMANDS_TRUE\fP \&...\fB;\fP [\fBelse\fP\fB;\fP \fICOMMANDS_FALSE\fP \&...\fB;\fP] \fBend\fP
\fBswitch\fP \fIVALUE\fP\fB;\fP [\fBcase\fP [\fIWILDCARD\fP \&...]\fB;\fP [\fICOMMANDS\fP \&...]\fB;\fP \&...] \fBend\fP
\fBwhile\fP \fICONDITION\fP\fB;\fP \fICOMMANDS\fP \&...\fB;\fP \fBend\fP
\fBfor\fP \fIVARNAME\fP \fBin\fP [\fIVALUES\fP \&...]\fB;\fP \fICOMMANDS\fP \&...\fB;\fP \fBend\fP
.fi
.sp
.SS Description
.sp
The \fBend\fP keyword ends a block of commands started by one of the following commands:
.INDENT 0.0
.IP \(bu 2
begin \%<> to start a block of commands
.IP \(bu 2
function \%<> to define a function
.IP \(bu 2
if \%<>, switch \%<> to conditionally execute commands
.IP \(bu 2
while \%<>, for \%<> to perform commands multiple times
.UNINDENT
.sp
The \fBend\fP keyword does not change the current exit status.
Instead, the status after it will be the status returned by the most recent command.
.SS eval \- evaluate the specified commands
.SS Synopsis
.nf
\fBeval\fP [\fICOMMANDS\fP \&...]
.fi
.sp
.SS Description
.sp
\fBeval\fP evaluates the specified parameters as a command.
If more than one parameter is specified, all parameters will be joined using a space character as a separator.
.sp
If the command does not need access to stdin, consider using source \%<> instead.
.sp
If no piping or other compound shell constructs are required, variable\-expansion\-as\-command, as in  \fBset cmd ls \-la; $cmd\fP, is also an option.
.SS Example
.sp
The following code will call the ls command and truncate each filename to the first 12 characters.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set cmd ls \e| cut \-c 1\-12
eval $cmd
.EE
.UNINDENT
.UNINDENT
.SS exec \- execute command in current process
.SS Synopsis
.nf
\fBexec\fP \fICOMMAND\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBexec\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man exec\fP\&.
.sp
\fBexec\fP replaces the currently running shell with a new command. On successful completion, \fBexec\fP never returns. \fBexec\fP cannot be used inside a pipeline.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command.
.SS Example
.sp
\fBexec emacs\fP starts up the emacs text editor, and exits \fBfish\fP\&. When emacs exits, the session will terminate.
.SS exit \- exit the shell
.SS Synopsis
.nf
\fBexit\fP [\fICODE\fP]
.fi
.sp
.SS Description
.sp
\fBexit\fP is a special builtin that causes the shell to exit. Either 255 or the \fICODE\fP supplied is used, whichever is lesser.
Otherwise, the exit status will be that of the last command executed.
.sp
If exit is called while sourcing a file (using the source \%<> builtin) the rest of the file will be skipped, but the shell itself will not exit.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command.
.SS export \- compatibility function for exporting variables
.SS Synopsis
.nf
\fBexport\fP
\fBexport\fP \fINAME\fP\fB=\fP\fIVALUE\fP
.fi
.sp
.SS Description
.sp
\fBexport\fP is a function included for compatibility with POSIX shells. In general, the set \%<>
builtin should be used instead.
.sp
When called without arguments, \fBexport\fP prints a list of currently\-exported variables, like \fBset
\-x\fP\&.
.sp
When called with a \fBNAME=VALUE\fP pair, the variable \fBNAME\fP is set to \fBVALUE\fP in the global
scope, and exported as an environment variable to other commands.
.sp
There are no options available.
.SS Example
.sp
The following commands have an identical effect.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-gx PAGER bat
export PAGER=bat
.EE
.UNINDENT
.UNINDENT
.sp
Note: If you want to add to e.g. \fB$PATH\fP, you need to be careful to combine the list \%<#\:cartesian-product>\&. Quote it, like so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
export PATH=\(dq$PATH:/opt/bin\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Or just use \fBset\fP, which avoids this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-gx PATH $PATH /opt/bin
.EE
.UNINDENT
.UNINDENT
.SS See more
.INDENT 0.0
.IP 1. 3
The set \%<> command.
.UNINDENT
.SS false \- return an unsuccessful result
.SS Synopsis
.nf
\fBfalse\fP
.fi
.sp
.SS Description
.sp
\fBfalse\fP sets the exit status to 1.
.SS See Also
.INDENT 0.0
.IP \(bu 2
true \%<> command
.IP \(bu 2
$status \%<#\:variables-status> variable
.UNINDENT
.SS fg \- bring job to foreground
.SS Synopsis
.nf
\fBfg\fP [\fIPID\fP]
.fi
.sp
.SS Description
.sp
The \fBfg\fP builtin brings the specified job \%<#\:syntax-job-control> to the foreground, resuming it if it is stopped.
While a foreground job is executed, fish is suspended.
If no job is specified, the last job to be used is put in the foreground.
If \fBPID\fP is specified, the job containing a process with the specified process ID is put in the foreground.
.sp
For compatibility with other shells, job expansion syntax is supported for \fBfg\fP\&. A \fIPID\fP of the format \fB%1\fP will foreground job 1.
Job numbers can be seen in the output of jobs \%<>\&.
.sp
The \fB\-\-help\fP or \fB\-h\fP option displays help about using this command.
.SS Example
.sp
\fBfg\fP will put the last job in the foreground.
.sp
\fBfg %3\fP will put job 3 into the foreground.
.SS fish \- the friendly interactive shell
.SS Synopsis
.nf
\fBfish\fP [\fIOPTIONS\fP] [\fIFILE\fP [\fIARG\fP \&...]]
\fBfish\fP [\fIOPTIONS\fP] [\fB\-c\fP \fICOMMAND\fP [\fIARG\fP \&...]]
.fi
.sp
.SS Description
.sp
\fBfish\fP is a command\-line shell written mainly with interactive use in mind.
This page briefly describes the options for invoking \fBfish\fP\&.
The full manual \%<#\:intro> is available in HTML by using the \fBhelp\fP command from inside fish, and in the \fIfish\-doc(1)\fP man page.
The tutorial \%<> is available as HTML via \fBhelp tutorial\fP or in \fIman fish\-tutorial\fP\&.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-c\fP or \fB\-\-command=COMMAND\fP
Evaluate the specified commands instead of reading from the commandline.
Any additional positional arguments are used as \fB$argv\fP\&.
.TP
\fB\-C\fP or \fB\-\-init\-command=COMMANDS\fP
Evaluate specified commands after reading the configuration but before executing command specified by \fB\-c\fP or reading interactive input.
.TP
\fB\-d\fP or \fB\-\-debug=DEBUG_CATEGORIES\fP
Enables debug output and specify a pattern for matching debug categories.
See Debugging below for details.
.TP
\fB\-o\fP or \fB\-\-debug\-output=DEBUG_FILE\fP
Specifies a file path to receive the debug output, including categories and \fBfish_trace\fP \%<#\:envvar-fish_trace>\&.
The default is standard error.
.TP
\fB\-i\fP or \fB\-\-interactive\fP
The shell is interactive.
.TP
\fB\-l\fP or \fB\-\-login\fP
Act as if invoked as a login shell.
.TP
\fB\-N\fP or \fB\-\-no\-config\fP
Do not read configuration files.
.TP
\fB\-n\fP or \fB\-\-no\-execute\fP
Do not execute any commands, only perform syntax checking.
.TP
\fB\-p\fP or \fB\-\-profile=PROFILE_FILE\fP
when \fBfish\fP exits, output timing information on all executed commands to the specified file.
This excludes time spent starting up and reading the configuration.
.TP
\fB\-\-profile\-startup=PROFILE_FILE\fP
Will write timing for \fBfish\fP startup to specified file.
.TP
\fB\-P\fP or \fB\-\-private\fP
Enables private mode \%<#\:private-mode>: \fBfish\fP will not access old or store new history.
.TP
\fB\-\-print\-rusage\-self\fP
When \fBfish\fP exits, output stats from getrusage.
.TP
\fB\-\-print\-debug\-categories\fP
Print all debug categories, and then exit.
.TP
\fB\-v\fP or \fB\-\-version\fP
Print version and exit.
.TP
\fB\-f\fP or \fB\-\-features=FEATURES\fP
Enables one or more comma\-separated feature flags \%<#\:featureflags>\&.
.UNINDENT
.sp
The \fBfish\fP exit status is generally the exit status of the last foreground command \%<#\:variables-status>\&.
.SS Debugging
.sp
While fish provides extensive support for debugging fish scripts \%<#\:debugging>, it is also possible to debug and instrument its internals.
Debugging can be enabled by passing the \fB\-\-debug\fP option.
For example, the following command turns on debugging for background IO thread events, in addition to the default categories, i.e. \fIdebug\fP, \fIerror\fP, \fIwarning\fP, and \fIwarning\-path\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-\-debug=iothread
.EE
.UNINDENT
.UNINDENT
.sp
Available categories are listed by \fBfish \-\-print\-debug\-categories\fP\&. The \fB\-\-debug\fP option accepts a comma\-separated list of categories, and supports glob syntax.
The following command turns on debugging for \fIcomplete\fP, \fIhistory\fP, \fIhistory\-file\fP, and \fIprofile\-history\fP, as well as the default categories:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-\-debug=\(aqcomplete,*history*\(aq
.EE
.UNINDENT
.UNINDENT
.sp
Debug messages output to stderr by default. Note that if \fBfish_trace\fP \%<#\:envvar-fish_trace> is set, execution tracing also outputs to stderr by default. You can output to a file using the \fB\-\-debug\-output\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-\-debug=\(aqcomplete,*history*\(aq \-\-debug\-output=/tmp/fish.log \-\-init\-command=\(aqset fish_trace on\(aq
.EE
.UNINDENT
.UNINDENT
.sp
These options can also be changed via the \fBFISH_DEBUG\fP \%<#\:envvar-FISH_DEBUG> and \fBFISH_DEBUG_OUTPUT\fP \%<#\:envvar-FISH_DEBUG_OUTPUT> variables.
The categories enabled via \fB\-\-debug\fP are \fIadded\fP to the ones enabled by $FISH_DEBUG, so they can be disabled by prefixing them with \fB\-\fP (\fBreader\-*,\-ast*\fP enables reader debugging and disables ast debugging).
.sp
The file given in \fB\-\-debug\-output\fP takes precedence over the file in \fBFISH_DEBUG_OUTPUT\fP \%<#\:envvar-FISH_DEBUG_OUTPUT>\&.
.SS Examples
.sp
To just start fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish
.EE
.UNINDENT
.UNINDENT
.sp
To run a file with fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish /path/to/script.fish
.EE
.UNINDENT
.UNINDENT
.sp
To run some commands with fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish \-c \(aqecho Hi there!\(aq
.EE
.UNINDENT
.UNINDENT
.sp
You can also pass arguments to those commands:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish \-c \(aqprintf %s\en $argv\(aq \(dqfirst line\(dq \(dqsecond line\(dq
first line
second line
.EE
.UNINDENT
.UNINDENT
.sp
To run a script, except read this other file first:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish \-\-init\-cmd \(dqsource otherfile\(dq script.fish
.EE
.UNINDENT
.UNINDENT
.sp
To profile \%<#\:profiling> fish\(aqs startup and find what takes the most time in your configuration:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish \-\-profile\-startup /tmp/start.prof \-ic exit
sort \-nk2 /tmp/start.prof
.EE
.UNINDENT
.UNINDENT
.SS fish_add_path \- add to the path
.SS Synopsis
.nf
\fBfish_add_path\fP \fBpath\fP \&...
\fBfish_add_path\fP [(\fB\-g\fP | \fB\-\-global\fP) | (\fB\-U\fP | \fB\-\-universal\fP) | (\fB\-P\fP | \fB\-\-path\fP)] [(\fB\-m\fP | \fB\-\-move\fP)] [(\fB\-a\fP | \fB\-\-append\fP) | (\fB\-p\fP | \fB\-\-prepend\fP)] [(\fB\-v\fP | \fB\-\-verbose\fP) | (\fB\-n\fP | \fB\-\-dry\-run\fP)] \fIPATHS\fP \&...
.fi
.sp
.SS Description
.sp
\fBfish_add_path\fP is a simple way to add more directories to fish\(aqs \fBPATH\fP \%<#\:envvar-PATH>\&. It does this by adding the directories either to \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> or directly to \fBPATH\fP \%<#\:envvar-PATH> (if the \fB\-\-path\fP switch is given).
.sp
It is (by default) safe to use \fBfish_add_path\fP in config.fish, or it can be used once, interactively, and the paths will stay in future because of universal variables \%<#\:variables-universal>\&. This is a \(dqdo what I mean\(dq style command \- it tries to do the right thing by default, and follow your lead on what you have already set up (e.g. by using a global \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> if you have that already). If you need more control, consider modifying the variable yourself.
.sp
Directories are normalized with realpath \%<>\&. Trailing slashes are ignored and relative paths are made absolute (but symlinks are not resolved). If a directory is already included, it is not added again and stays in the same place unless the \fB\-\-move\fP switch is given.
.sp
Directories are added in the order they are given, and they are prepended to the path unless \fB\-\-append\fP is given. If $fish_user_paths is used, that means they are last in $fish_user_paths, which is itself prepended to \fBPATH\fP \%<#\:envvar-PATH>, so they still stay ahead of the system paths. If the \fB\-\-path\fP option is used, the paths are appended/prepended to \fBPATH\fP \%<#\:envvar-PATH> directly, so this doesn\(aqt happen.
.sp
With \fB\-\-path\fP, because \fBPATH\fP \%<#\:envvar-PATH> must be a global variable instead of a universal one, the changes won\(aqt persist, so those calls need to be stored in config.fish \%<#\:configuration>\&. This also applies to \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> if you make it global (for instance by passing \fB\-\-global\fP).
.sp
If no directory is new, the variable (\fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> or \fBPATH\fP \%<#\:envvar-PATH>) is not set again or otherwise modified, so variable handlers are not triggered.
.sp
If an argument is not an existing directory, \fBfish_add_path\fP ignores it.
.SS Options
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-append\fP
Add directories to the \fIend\fP of the variable.
.TP
\fB\-p\fP or \fB\-\-prepend\fP
Add directories to the \fIfront\fP of the variable (this is the default).
.TP
\fB\-g\fP or \fB\-\-global\fP
Use a global \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths>\&.
.TP
\fB\-U\fP or \fB\-\-universal\fP
Use a universal \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> \- this is the default if it doesn\(aqt already exist.
.TP
\fB\-P\fP or \fB\-\-path\fP
Manipulate \fBPATH\fP \%<#\:envvar-PATH> directly.
.TP
\fB\-m\fP or \fB\-\-move\fP
Move already\-included directories to the place they would be added \- by default they would be left in place and not added again.
.TP
\fB\-v\fP or \fB\-\-verbose\fP
Print the set \%<> command used, and some more warnings, like when a path is skipped because it doesn\(aqt exist or is not a directory.
Verbose mode is automatically enabled when fish_add_path is used interactively and the output goes to the terminal.
.TP
\fB\-n\fP or \fB\-\-dry\-run\fP
Print the \fBset\fP command that would be used without executing it.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
If \fB\-\-move\fP is used, it may of course lead to the path swapping order, so you should be careful doing that in config.fish.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# I just installed mycoolthing and need to add it to the path to use it.
# It is at /opt/mycoolthing/bin/mycoolthing,
# so let\(aqs add the directory: /opt/mycoolthing/bin.
> fish_add_path /opt/mycoolthing/bin

# I want my ~/.local/bin to be checked first,
# even if it was already added.
> fish_add_path \-m ~/.local/bin

# I prefer using a global fish_user_paths
# This isn\(aqt saved automatically, I need to add this to config.fish
# if I want it to stay.
> fish_add_path \-g ~/.local/bin ~/.otherbin /usr/local/sbin

# I want to append to the entire $PATH because this directory contains fallbacks
# This needs \-\-path/\-P because otherwise it appends to $fish_user_paths,
# which is added to the front of $PATH.
> fish_add_path \-\-append \-\-path /opt/fallback/bin

# I want to add the bin/ directory of my current $PWD (say /home/nemo/)
# \-v/\-\-verbose shows what fish_add_path did.
> fish_add_path \-v bin/
set fish_user_paths /home/nemo/bin /usr/bin /home/nemo/.local/bin

# I have installed ruby via homebrew
> fish_add_path /usr/local/opt/ruby/bin
.EE
.UNINDENT
.UNINDENT
.SS fish_breakpoint_prompt \- define the prompt when stopped at a breakpoint
.SS Synopsis
.nf
\fBfish_breakpoint_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_breakpoint_prompt
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
\fBfish_breakpoint_prompt\fP is the prompt function when asking for input in response to a breakpoint \%<> command.
.sp
The exit status of commands within \fBfish_breakpoint_prompt\fP will not modify the value of $status \%<#\:variables-status> outside of the \fBfish_breakpoint_prompt\fP function.
.sp
\fBfish\fP ships with a default version of this function that displays the function name and line number of the current execution context.
.SS Example
.sp
A simple prompt that is a simplified version of the default debugging prompt:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_breakpoint_prompt \-d \(dqWrite out the debug prompt\(dq
    set \-l function (status current\-function)
    set \-l line (status current\-line\-number)
    set \-l prompt \(dq$function:$line >\(dq
    echo \-ns (set_color $fish_color_status) \(dqBP $prompt\(dq (set_color \-\-reset) \(aq \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS fish_clipboard_copy \- copy text to the system\(aqs clipboard
.SS Synopsis
.nf
\fBfish_clipboard_copy\fP

\fBfoo\fP | \fBfish_clipboard_copy\fP
.fi
.sp
.SS Description
.sp
The \fBfish_clipboard_copy\fP function copies text to the system clipboard.
.sp
If stdin is not a terminal (see isatty \%<>), it will read all input from there and copy it. If it is, it will use the current commandline, or the current selection if there is one.
.sp
It is bound to \fBctrl\fP\-\fBx\fP by default.
.sp
\fBfish_clipboard_copy\fP works by calling a system\-specific backend. If it doesn\(aqt appear to work you may need to install yours.
.sp
Currently supported are:
.INDENT 0.0
.IP \(bu 2
\fBpbcopy\fP
.IP \(bu 2
\fBwl\-copy\fP using wayland
.IP \(bu 2
\fBxsel\fP and \fBxclip\fP for X11
.IP \(bu 2
\fBclip.exe\fP on Windows.
.IP \(bu 2
The OSC 52 clipboard sequence \%<#\:term-compat-osc-52>, which your terminal might support
.UNINDENT
.SS See also
.INDENT 0.0
.IP \(bu 2
fish_clipboard_paste \- get text from the system\(aqs clipboard \%<> which does the inverse.
.UNINDENT
.SS fish_clipboard_paste \- get text from the system\(aqs clipboard
.SS Synopsis
.nf
\fBfish_clipboard_paste\fP

\fBfish_clipboard_paste\fP | \fBfoo\fP
.fi
.sp
.SS Description
.sp
The \fBfish_clipboard_paste\fP function copies text from the system clipboard.
.sp
If its stdout is not a terminal (see isatty \%<>), it will output everything there, as\-is, without any additional newlines. If it is, it will put the text in the commandline instead.
.sp
If it outputs to the commandline, it will automatically escape the output if the cursor is currently inside single\-quotes so it is suitable for single\-quotes (meaning it escapes \fB\(aq\fP and \fB\e\e\fP).
.sp
It is bound to \fBctrl\fP\-\fBv\fP by default.
.sp
\fBfish_clipboard_paste\fP works by calling a system\-specific backend. If it doesn\(aqt appear to work you may need to install yours.
.sp
Currently supported are:
.INDENT 0.0
.IP \(bu 2
\fBpbpaste\fP
.IP \(bu 2
\fBwl\-paste\fP using wayland
.IP \(bu 2
\fBxsel\fP and \fBxclip\fP for X11
.IP \(bu 2
\fBpowershell.exe\fP on Windows (this backend has encoding limitations and uses windows line endings that \fBfish_clipboard_paste\fP undoes)
.UNINDENT
.SS See also
.INDENT 0.0
.IP \(bu 2
fish_clipboard_copy \- copy text to the system\(aqs clipboard \%<> which does the inverse.
.UNINDENT
.SS fish_command_not_found \- what to do when a command wasn\(aqt found
.SS Synopsis
.nf
\fBfunction\fP \fBfish_command_not_found\fP
   \&...
\fBend\fP
.fi
.sp
.SS Description
.sp
When fish tries to execute a command and can\(aqt find it, it invokes this function.
.sp
It can print a message to tell you about it, and it often also checks for a missing package that would include the command.
.sp
Fish ships multiple handlers for various operating systems and chooses from them when this function is loaded,
or you can define your own.
.sp
It receives the full commandline as one argument per token, so $argv[1] contains the missing command.
.sp
When you leave \fBfish_command_not_found\fP undefined (e.g. by adding an empty function file) or explicitly call \fB__fish_default_command_not_found_handler\fP, fish will just print a simple error.
.SS Example
.sp
A simple handler:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_command_not_found
    echo Did not find command $argv[1]
end

> flounder
Did not find command flounder
.EE
.UNINDENT
.UNINDENT
.sp
Or the handler for OpenSUSE\(aqs command\-not\-found:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_command_not_found
    /usr/bin/command\-not\-found $argv[1]
end
.EE
.UNINDENT
.UNINDENT
.sp
Or the simple default handler:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_command_not_found
    __fish_default_command_not_found_handler $argv
end
.EE
.UNINDENT
.UNINDENT
.SS Backwards compatibility
.sp
This command was introduced in fish 3.2.0. Previous versions of fish used the \(dqfish_command_not_found\(dq event \%<#\:event> instead.
.sp
To define a handler that works in older versions of fish as well, define it the old way:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function __fish_command_not_found_handler \-\-on\-event fish_command_not_found
     echo COMMAND WAS NOT FOUND MY FRIEND $argv[1]
end
.EE
.UNINDENT
.UNINDENT
.sp
in which case fish will define a \fBfish_command_not_found\fP that calls it,
or define a wrapper:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_command_not_found
     echo \(dqG\(aqday mate, could not find your command: $argv\(dq
end

function __fish_command_not_found_handler \-\-on\-event fish_command_not_found
     fish_command_not_found $argv
end
.EE
.UNINDENT
.UNINDENT
.SS fish_config \- start the web\-based configuration interface
.SS Synopsis
.nf
\fBfish_config\fP [\fBbrowse\fP]
\fBfish_config\fP \fBprompt\fP (\fBchoose\fP | \fBlist\fP | \fBsave\fP | \fBshow\fP)
\fBfish_config\fP \fBtheme\fP
\fBfish_config\fP \fBtheme\fP \fBchoose\fP \fITHEME\fP \fB[ \fP\fB\-\-color\-theme\fP\fB=\fP(\fBdark\fP | \fBlight\fP)\fB ]\fP
\fBfish_config\fP \fBtheme\fP \fBdemo\fP
\fBfish_config\fP \fBtheme\fP \fBdump\fP
\fBfish_config\fP \fBtheme\fP \fBlist\fP
\fBfish_config\fP \fBtheme\fP \fBshow\fP [\fITHEME\fP\&...]
.fi
.sp
.SS Description
.sp
\fBfish_config\fP is used to configure fish.
.sp
Without arguments or with the \fBbrowse\fP command it starts the web\-based configuration interface. The web interface allows you to view your functions, variables and history, and to make changes to your prompt and color configuration. It starts a local web server and opens a browser window. When you are finished, close the browser window and press the Enter key to terminate the configuration session.
.sp
If the \fBBROWSER\fP environment variable is set, it will be used as the name of the web browser to open instead of the system default.
.sp
With the \fBprompt\fP command \fBfish_config\fP can be used to view and choose a prompt from fish\(aqs sample prompts inside the terminal directly.
.sp
Available subcommands for the \fBprompt\fP command:
.INDENT 0.0
.IP \(bu 2
\fBchoose\fP loads a sample prompt in the current session.
.IP \(bu 2
\fBlist\fP lists the names of the available sample prompts.
.IP \(bu 2
\fBsave\fP saves the current prompt to a file (via funcsave \%<>).
.IP \(bu 2
\fBshow\fP shows what the given sample prompts (or all) would look like.
.UNINDENT
.sp
With the \fBtheme\fP command \fBfish_config\fP can be used to view and choose a theme (meaning a color scheme) inside the terminal.
.sp
Available subcommands for the \fBtheme\fP command:
.INDENT 0.0
.IP \(bu 2
\fBchoose\fP loads a theme in the current session.
If the theme has light and dark variants (see below), the one matching \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme> will be applied (also whenever that variable changes).
To override \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme>, pass the \fB\-\-color\-theme\fP argument.
.IP \(bu 2
\fBdemo\fP displays some sample text in the current theme.
.IP \(bu 2
\fBdump\fP prints the current theme in a loadable format.
.IP \(bu 2
\fBlist\fP lists the names of the available themes.
.IP \(bu 2
\fBshow\fP shows what the given themes (or all) would look like.
.IP \(bu 2
\fI(not recommended)\fP \fBsave\fP saves the given theme to universal variables \%<#\:variables-universal>\&.
A theme set this way will not update as \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme> changes.
.UNINDENT
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Theme Files
.sp
\fBfish_config theme\fP and the theme selector in the web config tool load their themes from theme files. These are stored in the fish configuration directory, typically \fB~/.config/fish/themes\fP, with a .theme ending.
.sp
You can add your own theme by adding a file in that directory.
.sp
To get started quickly:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_config theme dump > ~/.config/fish/themes/my.theme
.EE
.UNINDENT
.UNINDENT
.sp
which will save your current theme in .theme format.
.sp
The format looks like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# name: \(aqMy Theme\(aq

[light]
# preferred_background: ffffff
fish_color_normal 000000
fish_color_autosuggestion 7f7f7f
fish_color_command 0000ee

[dark]
# preferred_background: 000000
fish_color_normal ffffff
fish_color_autosuggestion 7f7f7f
fish_color_command 5c5cff

[unknown]
fish_color_normal \-\-reset
fish_color_autosuggestion brblack
fish_color_cancel \-r
fish_color_command \-\-reset
.EE
.UNINDENT
.UNINDENT
.sp
The comments provide name and background color to the web config tool.
.sp
Themes can have three variants,
one for light mode,
one for dark mode,
and one for terminals that don\(aqt report colors \%<#\:term-compat-query-background-color> (where \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme> is set to \fBunknown\fP).
.sp
The other lines are just like \fBset variable value\fP, except that no expansions are allowed. Quotes are, but aren\(aqt necessary.
.sp
Other than that, .theme files can contain any variable with a name that matches the regular expression \fB\(aq^fish_(?:pager_)?color_.*$\(aq\fP \- starts with \fBfish_\fP, an optional \fBpager_\fP, then \fBcolor_\fP and then anything.
.SS Example
.sp
\fBfish_config\fP or \fBfish_config browse\fP opens a new web browser window and allows you to configure certain fish settings.
.sp
\fBfish_config prompt show\fP demos the available sample prompts.
.sp
\fBfish_config prompt choose disco\fP makes the disco prompt the prompt for the current session. This can also be used in config.fish \%<#\:configuration> to set the prompt.
.sp
\fBfish_config prompt save\fP saves the current prompt to an autoloaded \%<#\:syntax-function-autoloading> file.
.sp
\fBfish_config prompt save default\fP chooses the default prompt and saves it.
.SS fish_default_key_bindings \- set emacs key bindings for fish
.SS Synopsis
.nf
\fBfish_default_key_bindings\fP
.fi
.sp
.SS Description
.sp
\fBfish_default_key_bindings\fP sets the emacs key bindings for \fBfish\fP shell.
.sp
Some of the Emacs key bindings are defined here \%<#\:emacs-mode>\&.
.sp
There are no parameters for \fBfish_default_key_bindings\fP\&.
.SS Examples
.sp
To start using emacs key bindings:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_default_key_bindings
.EE
.UNINDENT
.UNINDENT
.SS fish_delta \- compare functions and completions to the default
.SS Synopsis
.nf
\fBfish_delta\fP \fBname\fP \&...
\fBfish_delta\fP [\fB\-f\fP | \fB\-\-no\-functions\fP] [\fB\-c\fP | \fB\-\-no\-completions\fP] [\fB\-C\fP | \fB\-\-no\-config\fP] [\fB\-d\fP | \fB\-\-no\-diff\fP] [\fB\-n\fP | \fB\-\-new\fP] [\fB\-V\fP | \fB\-\-vendor\fP\fB=\fP]
\fBfish_delta\fP [\fB\-h\fP | \fB\-\-help\fP]
.fi
.sp
.SS Description
.sp
The \fBfish_delta\fP function tells you, at a glance, which of your functions and completions differ from the set that fish ships.
.sp
It does this by going through the relevant variables (\fBfish_function_path\fP \%<#\:envvar-fish_function_path> for functions and \fBfish_complete_path\fP \%<#\:envvar-fish_complete_path> for completions) and comparing the files against fish\(aqs default directories.
.sp
If any names are given, it will only compare files by those names (plus a \(dq.fish\(dq extension).
.sp
By default, it will also use \fBdiff\fP to display the difference between the files. If \fBdiff\fP is unavailable, it will skip it, but in that case it also cannot figure out if the files really differ.
.sp
The exit status is 1 if there was a difference and 2 for other errors, otherwise 0.
.SS Options
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-f\fP or \fB\-\-no\-functions\fP
Stops checking functions
.TP
\fB\-c\fP or \fB\-\-no\-completions\fP
Stops checking completions
.TP
\fB\-C\fP or \fB\-\-no\-config\fP
Stops checking configuration files like config.fish or snippets in the conf.d directories.
.TP
\fB\-d\fP or \fB\-\-no\-diff\fP
Removes the diff display (this happens automatically if \fBdiff\fP can\(aqt be found)
.TP
\fB\-n\fP or \fB\-\-new\fP
Also prints new files (i.e. those that can\(aqt be found in fish\(aqs default directories).
.TP
\fB\-Vvalue\fP or \fB\-\-vendor=value\fP
Determines how the vendor directories are counted. Valid values are:
.INDENT 7.0
.IP \(bu 2
\(dqdefault\(dq \- counts vendor files as belonging to the defaults. Any changes in other directories will be counted as changes over them. This is the default.
.IP \(bu 2
\(dquser\(dq \- counts vendor files as belonging to the user files. Any changes in them will be counted as new or changed files.
.IP \(bu 2
\(dqignore\(dq \- ignores vendor directories. Files of the same name will be counted as \(dqnew\(dq if no file of the same name in fish\(aqs default directories exists.
.UNINDENT
.TP
\fB\-h\fP or \fB\-\-help\fP
Prints \fBfish_delta\fP\(aqs help (this).
.UNINDENT
.SS Example
.sp
Running just:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_delta
.EE
.UNINDENT
.UNINDENT
.sp
will give you a list of all your changed functions and completions, including diffs (if you have the \fBdiff\fP command).
.sp
It might look like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_delta
New: /home/alfa/.config/fish/functions/battery.fish
Changed: /home/alfa/.config/fish/test/completions/cargo.fish
\-\-\- /home/alfa/.config/fish/test/completions/cargo.fish 2022\-09\-02 12:57:55.579229959 +0200
+++ /usr/share/fish/completions/cargo.fish      2022\-09\-25 17:51:53.000000000 +0200
# the output of \(gadiff\(ga follows
.EE
.UNINDENT
.UNINDENT
.sp
The options are there to select which parts of the output you want. With \fB\-\-no\-completions\fP you can compare just functions, and with \fB\-\-no\-diff\fP you can turn off the \fBdiff\fP display.
.sp
To only compare your \fBfish_git_prompt\fP, you might use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_delta \-\-no\-completions fish_git_prompt
.EE
.UNINDENT
.UNINDENT
.sp
which will only compare files called \(dqfish_git_prompt.fish\(dq.
.SS fish_git_prompt \- output git information for use in a prompt
.SS Synopsis
.nf
\fBfish_git_prompt\fP [\fIFORMAT\fP]
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
     printf \(aq%s\(aq $PWD (fish_git_prompt) \(aq $ \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_git_prompt\fP function displays information about the current git repository, if any.
.sp
Git \%<https://\:git-scm\:.com> must be installed.
.sp
It is possible to modify the output format by passing an argument. The default value is \fB\(dq (%s)\(dq\fP\&.
.sp
There are numerous customization options, which can be controlled with git options or fish variables. git options, where available, take precedence over the fish variable with the same function. git options can be set on a per\-repository or global basis. git options can be set with the \fBgit config\fP command, while fish variables can be set as usual with the set \%<> command.
.sp
Boolean options (those which enable or disable something) understand \(dq1\(dq, \(dqyes\(dq or \(dqtrue\(dq to mean true and every other value to mean false.
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_show_informative_status\fP or the git option \fBbash.showInformativeStatus\fP can be set to 1, true or yes to enable the \(dqinformative\(dq display, which will show a large amount of information \- the number of dirty files, unpushed/unpulled commits, and more.
In large repositories, this can take a lot of time, so you may wish to disable it in these repositories with  \fBgit config \-\-local bash.showInformativeStatus false\fP\&. It also changes the characters the prompt uses to less plain ones (\fB✚\fP instead of \fB*\fP for the dirty state for example) , and if you are only interested in that, set \fB$__fish_git_prompt_use_informative_chars\fP instead.
.sp
Because counting untracked files requires a lot of time, the number of untracked files is only shown if enabled via \fB$__fish_git_prompt_showuntrackedfiles\fP or the git option \fBbash.showUntrackedFiles\fP\&.
.IP \(bu 2
\fB$__fish_git_prompt_showdirtystate\fP or the git option \fBbash.showDirtyState\fP can be set to 1, true or yes to show if the repository is \(dqdirty\(dq, i.e. has uncommitted changes.
.IP \(bu 2
\fB$__fish_git_prompt_showuntrackedfiles\fP or the git option \fBbash.showUntrackedFiles\fP can be set to 1, true or yes to show if the repository has untracked files (that aren\(aqt ignored).
.IP \(bu 2
\fB$__fish_git_prompt_showupstream\fP can be set to a list of values to determine how changes between HEAD and upstream are shown:
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fBauto\fP
summarize the difference between HEAD and its upstream
.TP
.B \fBverbose\fP
show number of commits ahead/behind (+/\-) upstream
.TP
.B \fBname\fP
if verbose, then also show the upstream abbrev name
.TP
.B \fBinformative\fP
similar to verbose, but shows nothing when equal \- this is the default if informative status is enabled.
.TP
.B \fBgit\fP
always compare HEAD to @{upstream}
.TP
.B \fBsvn\fP
always compare HEAD to your SVN upstream
.TP
.B \fBnone\fP
disables (useful with informative status)
.UNINDENT
.UNINDENT
.UNINDENT
.IP \(bu 2
\fB$__fish_git_prompt_showstashstate\fP can be set to 1, true or yes to display the state of the stash.
.IP \(bu 2
\fB$__fish_git_prompt_shorten_branch_len\fP can be set to the number of characters that the branch name will be shortened to.
.IP \(bu 2
\fB$__fish_git_prompt_describe_style\fP can be set to one of the following styles to describe the current HEAD:
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fBcontains\fP
relative to newer annotated tag, such as \fB(v1.6.3.2~35)\fP
.TP
.B \fBbranch\fP
relative to newer tag or branch, such as \fB(master~4)\fP
.TP
.B \fBdescribe\fP
relative to older annotated tag, such as \fB(v1.6.3.1\-13\-gdd42c2f)\fP
.TP
.B \fBdefault\fP
an exactly matching tag (\fB(develop)\fP)
.UNINDENT
.sp
If none of these apply, the commit SHA shortened to 8 characters is used.
.UNINDENT
.UNINDENT
.IP \(bu 2
\fB$__fish_git_prompt_showcolorhints\fP can be set to 1, true or yes to enable coloring for the branch name and status symbols.
.UNINDENT
.sp
A number of variables set characters and color used as indicators. Many of these have a different default if used with informative status enabled, or \fB$__fish_git_prompt_use_informative_chars\fP set. The usual default is given first, then the informative default (if it is different). If no default for the colors is given, they default to \fB$__fish_git_prompt_color\fP\&.
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_char_stateseparator\fP (\(aq \(aq, \fB|\fP) \- the character to be used between the state characters
.IP \(bu 2
\fB$__fish_git_prompt_color\fP (no default)
.IP \(bu 2
\fB$__fish_git_prompt_color_prefix\fP \- the color of the \fB(\fP prefix
.IP \(bu 2
\fB$__fish_git_prompt_color_suffix\fP \- the color of the \fB)\fP suffix
.IP \(bu 2
\fB$__fish_git_prompt_color_bare\fP \- the color to use for a bare repository \- one without a working tree
.IP \(bu 2
\fB$__fish_git_prompt_color_merging\fP \- the color when a merge/rebase/revert/bisect or cherry\-pick is in progress
.IP \(bu 2
\fB$__fish_git_prompt_char_cleanstate\fP (✔ in informative mode) \- the character to be used when nothing else applies
.IP \(bu 2
\fB$__fish_git_prompt_color_cleanstate\fP (no default)
.UNINDENT
.sp
Variables used with \fBshowdirtystate\fP:
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_char_dirtystate\fP (\fI*\fP, ✚) \- the number of \(dqdirty\(dq changes, i.e. unstaged files with changes
.IP \(bu 2
\fB$__fish_git_prompt_char_invalidstate\fP (#, ✖) \- the number of \(dqunmerged\(dq changes, e.g. additional changes to already added files
.IP \(bu 2
\fB$__fish_git_prompt_char_stagedstate\fP (+, ●) \- the number of staged files without additional changes
.IP \(bu 2
\fB$__fish_git_prompt_color_dirtystate\fP (red with showcolorhints, same as color_flags otherwise)
.IP \(bu 2
\fB$__fish_git_prompt_color_invalidstate\fP
.IP \(bu 2
\fB$__fish_git_prompt_color_stagedstate\fP (green with showcolorhints, color_flags otherwise)
.UNINDENT
.sp
Variables used with \fBshowstashstate\fP:
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_char_stashstate\fP (\fB$\fP, ⚑)
.IP \(bu 2
\fB$__fish_git_prompt_color_stashstate\fP (same as color_flags)
.UNINDENT
.sp
Variables used with \fBshowuntrackedfiles\fP:
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_char_untrackedfiles\fP (%, …) \- the symbol for untracked files
.IP \(bu 2
\fB$__fish_git_prompt_color_untrackedfiles\fP (same as color_flags)
.UNINDENT
.sp
Variables used with \fBshowupstream\fP (also implied by informative status):
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_char_upstream_ahead\fP (>, ↑) \- the character for the commits this repository is ahead of upstream
.IP \(bu 2
\fB$__fish_git_prompt_char_upstream_behind\fP (<, ↓) \- the character for the commits this repository is behind upstream
.IP \(bu 2
\fB$__fish_git_prompt_char_upstream_diverged\fP (<>, ↓↑) \- the symbol if this repository is both ahead and behind upstream
.IP \(bu 2
\fB$__fish_git_prompt_char_upstream_equal\fP (=) \- the symbol if this repo is equal to upstream
.IP \(bu 2
\fB$__fish_git_prompt_char_upstream_prefix\fP (\(aq\(aq)
.IP \(bu 2
\fB$__fish_git_prompt_color_upstream\fP
.UNINDENT
.sp
Colors used with \fBshowcolorhints\fP:
.INDENT 0.0
.IP \(bu 2
\fB$__fish_git_prompt_color_branch\fP (green) \- the color of the branch if nothing else applies
.IP \(bu 2
\fB$__fish_git_prompt_color_branch_detached\fP (red) the color of the branch if it\(aqs detached (e.g. a commit is checked out)
.IP \(bu 2
\fB$__fish_git_prompt_color_branch_dirty\fP (no default) the color of the branch if it\(aqs dirty and not detached
.IP \(bu 2
\fB$__fish_git_prompt_color_branch_staged\fP (no default) the color of the branch if it just has something staged and is otherwise clean
.IP \(bu 2
\fB$__fish_git_prompt_color_flags\fP (\-\-bold blue) \- the default color for dirty/staged/stashed/untracked state
.UNINDENT
.sp
Note that all colors can also have a corresponding \fB_done\fP color. For example, the contents of \fB$__fish_git_prompt_color_upstream_done\fP is printed right _after_ the upstream.
.sp
See also fish_vcs_prompt \%<>, which will call all supported version control prompt functions, including git, Mercurial and Subversion.
.SS Example
.sp
A simple prompt that displays git info:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    # ...
    set \-g __fish_git_prompt_showupstream auto
    printf \(aq%s %s$\(aq $PWD (fish_git_prompt)
end
.EE
.UNINDENT
.UNINDENT
.SS fish_greeting \- display a welcome message in interactive shells
.SS Synopsis
.nf
\fBfish_greeting\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_greeting
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
When an interactive fish starts, it executes fish_greeting and displays its output.
.sp
The default fish_greeting is a function that prints a variable of the same name (\fB$fish_greeting\fP), so you can also just change that if you just want to change the text.
.sp
If \fBSHELL_WELCOME\fP \%<#\:envvar-SHELL_WELCOME> is set, it is displayed after the greeting. This is a standard environment variable that may be set by tools like systemd\(aqs \fBrun0\fP to display session information.
.sp
While you could also just put \fBecho\fP calls into config.fish, fish_greeting takes care of only being used in interactive shells, so it won\(aqt be used e.g. with \fBscp\fP (which executes a shell), which prevents some errors.
.SS Example
.sp
To just empty the text, with the default greeting function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-U fish_greeting
.EE
.UNINDENT
.UNINDENT
.sp
or \fBset \-g fish_greeting\fP in config.fish \%<#\:configuration>\&.
.sp
A simple greeting:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_greeting
    echo Hello friend!
    echo The time is (set_color yellow)(date +%T)(set_color \-\-reset) and this machine is called $hostname
end
.EE
.UNINDENT
.UNINDENT
.SS fish_hg_prompt \- output Mercurial information for use in a prompt
.SS Synopsis
.nf
\fBfish_hg_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
     printf \(aq%s\(aq $PWD (fish_hg_prompt) \(aq $ \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The fish_hg_prompt function displays information about the current Mercurial repository, if any.
.sp
Mercurial \%<https://\:www\:.mercurial-scm\:.org/> (\fBhg\fP) must be installed.
.sp
By default, only the current branch is shown because \fBhg status\fP can be slow on a large repository. You can enable a more informative prompt by setting the variable \fB$fish_prompt_hg_show_informative_status\fP, for example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set fish_prompt_hg_show_informative_status
.EE
.UNINDENT
.UNINDENT
.sp
If you enabled the informative status, there are numerous customization options, which can be controlled with fish variables.
.INDENT 0.0
.IP \(bu 2
\fB$fish_color_hg_clean\fP, \fB$fish_color_hg_modified\fP and \fB$fish_color_hg_dirty\fP are colors used when the repository has the respective status.
.UNINDENT
.sp
Some colors for status symbols:
.INDENT 0.0
.IP \(bu 2
\fB$fish_color_hg_added\fP
.IP \(bu 2
\fB$fish_color_hg_renamed\fP
.IP \(bu 2
\fB$fish_color_hg_copied\fP
.IP \(bu 2
\fB$fish_color_hg_deleted\fP
.IP \(bu 2
\fB$fish_color_hg_untracked\fP
.IP \(bu 2
\fB$fish_color_hg_unmerged\fP
.UNINDENT
.sp
The status symbols themselves:
.INDENT 0.0
.IP \(bu 2
\fB$fish_prompt_hg_status_added\fP, default \(aq✚\(aq
.IP \(bu 2
\fB$fish_prompt_hg_status_modified\fP, default \(aq*\(aq
.IP \(bu 2
\fB$fish_prompt_hg_status_copied\fP, default \(aq⇒\(aq
.IP \(bu 2
\fB$fish_prompt_hg_status_deleted\fP, default \(aq✖\(aq
.IP \(bu 2
\fB$fish_prompt_hg_status_untracked\fP, default \(aq?\(aq
.IP \(bu 2
\fB$fish_prompt_hg_status_unmerged\fP, default \(aq!\(aq
.UNINDENT
.sp
Finally, \fB$fish_prompt_hg_status_order\fP, which can be used to change the order the status symbols appear in. It defaults to \fBadded modified copied deleted untracked unmerged\fP\&.
.sp
See also fish_vcs_prompt \%<>, which will call all supported version control prompt functions, including git, Mercurial and Subversion.
.SS Example
.sp
A simple prompt that displays hg info:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    ...
    set \-g fish_prompt_hg_show_informative_status
    printf \(aq%s %s$\(aq $PWD (fish_hg_prompt)
end
.EE
.UNINDENT
.UNINDENT
.SS fish_indent \- indenter and prettifier
.SS Synopsis
.nf
\fBfish_indent\fP [\fIOPTIONS\fP] [\fIFILE\fP \&...]
.fi
.sp
.SS Description
.sp
\fBfish_indent\fP is used to indent a piece of fish code. \fBfish_indent\fP reads commands from standard input or the given filenames and outputs them to standard output or a specified file (if \fB\-w\fP is given).
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-w\fP or \fB\-\-write\fP
Indents a specified file and immediately writes to that file.
.TP
\fB\-i\fP or \fB\-\-no\-indent\fP
Do not indent commands; only reformat to one job per line.
.TP
\fB\-\-only\-indent\fP
Do not reformat, only indent each line.
.TP
\fB\-\-only\-unindent\fP
Do not reformat, only unindent each line.
.TP
\fB\-c\fP or \fB\-\-check\fP
Do not indent, only return 0 if the code is already indented as fish_indent would, the number of failed files otherwise. Also print the failed filenames if not reading from standard input.
.TP
\fB\-v\fP or \fB\-\-version\fP
Displays the current \fBfish\fP version and then exits.
.TP
\fB\-\-ansi\fP
Colorizes the output using ANSI escape sequences using the colors defined in the environment (such as \fBfish_color_command\fP \%<#\:envvar-fish_color_command>).
.TP
\fB\-\-html\fP
Outputs HTML, which supports syntax highlighting if the appropriate CSS is defined. The CSS class names are the same as the variable names, such as \fBfish_color_command\fP\&.
.TP
\fB\-\-dump\-parse\-tree\fP
Dumps information about the parsed statements to standard error. This is likely to be of interest only to people working on the fish source code.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS fish_is_root_user \- check if the current user is root
.SS Synopsis
.nf
\fBfish_is_root_user\fP
.fi
.sp
.SS Description
.sp
\fBfish_is_root_user\fP will check if the current user is root. It can be useful
for the prompt to display something different if the user is root, for example.
.SS Example
.sp
A simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function example \-\-description \(aqJust an example\(aq
    if fish_is_root_user
        do_something_different
    end
end
.EE
.UNINDENT
.UNINDENT
.SS fish_key_reader \- explore what characters keyboard keys send
.SS Synopsis
.nf
\fBfish_key_reader\fP [\fIOPTIONS\fP]
.fi
.sp
.SS Description
.sp
\fBfish_key_reader\fP is used to explain how you would bind a certain key sequence. By default, it prints the bind \%<> command for one key sequence read interactively over standard input.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-c\fP or \fB\-\-continuous\fP
Begins a session where multiple key sequences can be inspected. By default the program exits after capturing a single key sequence.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.TP
\fB\-V\fP or \fB\-\-verbose\fP
Explain what sequence was received in addition to the decoded key.
.TP
\fB\-v\fP or \fB\-\-version\fP
Displays the current \fBfish\fP version and then exits.
.UNINDENT
.SS Usage Notes
.sp
\fBfish_key_reader\fP intentionally disables handling of many signals. To terminate \fBfish_key_reader\fP in \fB\-\-continuous\fP mode do:
.INDENT 0.0
.IP \(bu 2
press \fBctrl\fP\-\fBc\fP twice, or
.IP \(bu 2
press \fBctrl\fP\-\fBd\fP twice, or
.IP \(bu 2
type \fBexit\fP, or
.IP \(bu 2
type \fBquit\fP
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_key_reader
Press a key:
# press up\-arrow
bind up \(aqdo something\(aq
.EE
.UNINDENT
.UNINDENT
.SS fish_mode_prompt \- define the appearance of the mode indicator
.SS Synopsis
.nf
\fBfish_mode_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_mode_prompt
     echo \-n \(dq$fish_bind_mode \(dq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_mode_prompt\fP function outputs the mode indicator for use in vi mode.
.sp
The default \fBfish_mode_prompt\fP function will output indicators about the current vi editor mode displayed to the left of the regular prompt. Define your own function to customize the appearance of the mode indicator. The \fB$fish_bind_mode\fP variable can be used to determine the current mode. It will be one of \fBdefault\fP, \fBinsert\fP, \fBreplace_one\fP, \fBreplace\fP, \fBvisual\fP, or \fBoperator\fP\&.
.sp
You can also define an empty \fBfish_mode_prompt\fP function to remove the vi mode indicators:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_mode_prompt; end
funcsave fish_mode_prompt
.EE
.UNINDENT
.UNINDENT
.sp
\fBfish_mode_prompt\fP will be executed when the vi mode changes. If it produces any output, it is displayed and used. If it does not, the other prompt functions (fish_prompt \%<> and fish_right_prompt \%<>) will be executed as well in case they contain a mode display.
.sp
If \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> is set to 1, \fBfish_mode_prompt \-\-final\-rendering\fP is run before executing the commandline.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_mode_prompt
  switch $fish_bind_mode
    case default
      set_color \-\-bold red
      echo \(aqN\(aq
    case insert
      set_color \-\-bold green
      echo \(aqI\(aq
    case replace_one
      set_color \-\-bold green
      echo \(aqR\(aq
    case replace
      set_color \-\-bold bryellow
      echo \(aqR\(aq
    case visual
      set_color \-\-bold brmagenta
      echo \(aqV\(aq
    case operator f F t T
      set_color \-\-bold cyan
      echo \(aqN\(aq
    case \(aq*\(aq
      set_color \-\-bold red
      echo \(aq?\(aq
  end
  set_color \-\-reset
end
.EE
.UNINDENT
.UNINDENT
.sp
Outputting multiple lines is not supported in \fBfish_mode_prompt\fP\&.
.SS fish_opt \- create an option specification for the argparse command
.SS Synopsis
.nf
\fBfish_opt\fP [\fB\-s\fP \fIALPHANUM\fP] [\fB\-l\fP \fILONG\-NAME\fP] [\fB\-ormd\fP] [\fB\-\-long\-only\fP] [\fB\-v\fP \fICOMMAND\fP \fIOPTIONS\fP \&...\fB ]\fP
\fBfish_opt\fP \fB\-\-help\fP
.fi
.sp
.SS Description
.sp
This command provides a way to produce option specifications suitable for use with the argparse \%<> command. You can, of course, write the option specifications by hand without using this command. But you might prefer to use this for the clarity it provides.
.sp
The following \fBargparse\fP options are available:
.INDENT 0.0
.TP
\fB\-s\fP or \fB\-\-short\fP \fIALPHANUM\fP
Takes a single letter or number that is used as the short flag in the option being defined. Either this option or the \fB\-\-long\fP option must be provided.
.TP
\fB\-l\fP or \fB\-\-long\fP \fILONG\-NAME\fP
Takes a string that is used as the long flag in the option being defined. This option is optional and has no default. If no long flag is defined then only the short flag will be allowed when parsing arguments using the option specification.
.TP
\fB\-\-long\-only\fP
Deprecated. The option being defined will only allow the long flag name to be used, even if the short flag is defined (i.e., \fB\-\-short\fP is specified).
.TP
\fB\-o\fP or \fB\-\-optional\-val\fP
The option being defined can take a value, but it is optional rather than required. If the option is seen more than once when parsing arguments, only the last value seen is saved. This means the resulting flag variable created by \fBargparse\fP will zero elements if no value was given with the option else it will have exactly one element.
.TP
\fB\-r\fP or \fB\-\-required\-val\fP
The option being defined requires a value. If the option is seen more than once when parsing arguments, only the last value seen is saved. This means the resulting flag variable created by \fBargparse\fP will have exactly one element.
.TP
\fB\-m\fP or \fB\-\-multiple\-vals\fP
The value of each instance of the option is accumulated. If \fB\-\-optional\-val\fP is provided, the value is optional, and an empty string is stored if no value is provided. Otherwise, the \fB\-\-requiured\-val\fP option is implied and each instance of the option requires a value. This means the resulting flag variable created by \fBargparse\fP will have one element for each instance of this option in the arguments, even for instances that did not provide a value.
.TP
\fB\-d\fP or \fB\-\-delete\fP
The option and any values will be deleted from the \fB$argv_opts\fP variables set by \fBargparse\fP
(as with other options, it will also be deleted from \fB$argv\fP).
.TP
\fB\-v\fP or \fB\-\-validate\fP \fICOMMAND\fP \fIOPTION...\fP
This option must be the last one, and requires one of \fB\-o\fP, \fB\-r\fP, or \fB\-m\fP\&. All the remaining arguments are interpreted a fish script to run to validate the value of the argument, see \fBargparse\fP documentation for more details. Note that the interpretation of \fICOMMAND\fP \fIOPTION...\fP is similar to \fBeval\fP, so you may need to quote or escape special characters \fItwice\fP if you want them to be interpreted literally when the validate script is run.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Examples
.sp
Define a single option specification for the boolean help flag:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l options (fish_opt \-s h \-l help)
argparse $options \-\- $argv
.EE
.UNINDENT
.UNINDENT
.sp
Same as above but with a second flag that requires a value:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l options (fish_opt \-s h \-l help)
set options $options (fish_opt \-s m \-l max \-r)
argparse $options \-\- $argv
.EE
.UNINDENT
.UNINDENT
.sp
Same as above but the value of the second flag cannot be the empty string:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l options (fish_opt \-s h \-l help)
set options $options (fish_opt \-s m \-l max \-rv test \e$_flag_value != \(dq\(aq\(aq\(dq)
argparse $options \-\- $argv
.EE
.UNINDENT
.UNINDENT
.sp
Same as above but with a third flag that can be given multiple times saving the value of each instance seen and only a long flag name (\fB\-\-token\fP) is defined:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l options (fish_opt \-\-short=h \-\-long=help)
set options $options (fish_opt \-\-short=m \-\-long=max \-\-required\-val \-\-validate test \e$_flag_value != \(dq\(aq\(aq\(dq)
set options $options (fish_opt \-\-long=token \-\-multiple\-vals)
argparse $options \-\- $argv
.EE
.UNINDENT
.UNINDENT
.SS fish_prompt \- define the appearance of the command line prompt
.SS Synopsis
.nf
\fBfish_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_prompt\fP function is executed when the prompt is to be shown, and the output is used as a prompt.
.sp
The exit status of commands within \fBfish_prompt\fP will not modify the value of $status \%<#\:variables-status> outside of the \fBfish_prompt\fP function.
.sp
If \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> is set to 1, \fBfish_prompt \-\-final\-rendering\fP is run before executing the commandline.
.sp
If \fBSHELL_PROMPT_PREFIX\fP \%<#\:envvar-SHELL_PROMPT_PREFIX> or \fBSHELL_PROMPT_SUFFIX\fP \%<#\:envvar-SHELL_PROMPT_SUFFIX> are set, they are automatically prepended and appended to the left prompt. This applies to all prompts regardless of whether \fBfish_prompt\fP has been customized.
.sp
\fBfish\fP ships with a number of example prompts that can be chosen with the \fBfish_config\fP command.
.SS Example
.sp
A simple prompt:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt \-d \(dqWrite out the prompt\(dq
    # This shows up as USER@HOST /home/user/ >, with the directory colored
    # $USER and $hostname are set by fish, so you can just use them
    # instead of using \(gawhoami\(ga and \(gahostname\(ga
    printf \(aq%s@%s %s%s%s > \(aq $USER $hostname \e
        (set_color $fish_color_cwd) (prompt_pwd) (set_color \-\-reset)
end
.EE
.UNINDENT
.UNINDENT
.SS fish_right_prompt \- define the appearance of the right\-side command line prompt
.SS Synopsis
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_right_prompt
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
\fBfish_right_prompt\fP is similar to \fBfish_prompt\fP, except that it appears on the right side of the terminal window.
.sp
Multiple lines are not supported in \fBfish_right_prompt\fP\&.
.sp
If \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> is set to 1, \fBfish_right_prompt \-\-final\-rendering\fP is run before executing the commandline.
.SS Example
.sp
A simple right prompt:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_right_prompt \-d \(dqWrite out the right prompt\(dq
    date \(aq+%m/%d/%y\(aq
end
.EE
.UNINDENT
.UNINDENT
.SS fish_should_add_to_history \- decide whether a command should be added to the history
.SS Synopsis
.nf
\fBfish_should_add_to_history\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_should_add_to_history
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_should_add_to_history\fP function is executed before fish adds a command to history, and its return status decides whether that is done.
.sp
If it returns 0, the command is stored in history, when it returns anything else, it is not. In the latter case the command can still be recalled for one command.
.sp
The first argument to \fBfish_should_add_to_history\fP is the commandline. History is added \fIbefore\fP a command is run, so e.g. \fBstatus\fP \%<#\:envvar-status> can\(aqt be checked. This is so commands that don\(aqt finish like exec \- execute command in current process \%<> and long\-running commands are available in new sessions immediately.
.sp
If \fBfish_should_add_to_history\fP doesn\(aqt exist, fish will save a command to history unless it starts with a space. If it does exist, this function takes over all of the duties, so commands starting with space are saved unless \fBfish_should_add_to_history\fP says otherwise.
.SS Example
.sp
A simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_should_add_to_history
    for cmd in vault mysql ls
         string match \-qr \(dq^$cmd\(dq \-\- $argv; and return 1
    end
    return 0
end
.EE
.UNINDENT
.UNINDENT
.sp
This refuses to store any immediate \(dqvault\(dq, \(dqmysql\(dq or \(dqls\(dq calls. Commands starting with space would be stored.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_should_add_to_history
    # I don\(aqt want \(gagit pull\(gas in my history when I\(aqm in a specific repository
    if string match \-qr \(aq^git pull\(aq \-\- \(dq$argv\(dq
    and string match \-qr \(dq^/home/me/my\-secret\-project/\(dq \-\- (pwd \-P)
        return 1
    end

    return 0
end
.EE
.UNINDENT
.UNINDENT
.SS fish_status_to_signal \- convert exit codes to human\-friendly signals
.SS Synopsis
.nf
\fBfish_status_to_signal\fP \fINUM\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    echo \-n (fish_status_to_signal $pipestatus | string join \(aq|\(aq) (prompt_pwd) \(aq$ \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
\fBfish_status_to_signal\fP converts exit codes to their corresponding human\-friendly signals if one exists.
This is likely to be useful for prompts in conjunction with the \fB$status\fP and \fB$pipestatus\fP variables.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ sleep 5
^C⏎
>_ fish_status_to_signal $status
SIGINT
.EE
.UNINDENT
.UNINDENT
.SS fish_svn_prompt \- output Subversion information for use in a prompt
.SS Synopsis
.nf
\fBfish_svn_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
     printf \(aq%s\(aq $PWD (fish_svn_prompt) \(aq $ \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The fish_svn_prompt function displays information about the current Subversion repository, if any.
.sp
Subversion \%<https://\:subversion\:.apache\:.org/> (\fBsvn\fP) must be installed.
.sp
There are numerous customization options, which can be controlled with fish variables.
.INDENT 0.0
.IP \(bu 2
.INDENT 2.0
.TP
.B \fB__fish_svn_prompt_color_revision\fP
the colour of the revision number to display in the prompt
.UNINDENT
.IP \(bu 2
.INDENT 2.0
.TP
.B \fB__fish_svn_prompt_char_separator\fP
the separator between status characters
.UNINDENT
.UNINDENT
.sp
A number of variables control the symbol (\(dqdisplay\(dq) and color (\(dqcolor\(dq) for the different status indicators:
.INDENT 0.0
.IP \(bu 2
\fB__fish_svn_prompt_char_added_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_added_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_conflicted_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_conflicted_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_deleted_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_deleted_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_ignored_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_ignored_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_modified_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_modified_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_replaced_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_replaced_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_unversioned_external_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_unversioned_external_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_unversioned_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_unversioned_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_missing_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_missing_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_versioned_obstructed_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_versioned_obstructed_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_locked_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_locked_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_scheduled_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_scheduled_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_switched_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_switched_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_present_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_present_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_other_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_other_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_stolen_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_stolen_color\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_broken_display\fP
.IP \(bu 2
\fB__fish_svn_prompt_char_token_broken_color\fP
.UNINDENT
.sp
See also fish_vcs_prompt \%<>, which will call all supported version control prompt functions, including git, Mercurial and Subversion.
.SS Example
.sp
A simple prompt that displays svn info:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    ...
    printf \(aq%s %s$\(aq $PWD (fish_svn_prompt)
end
.EE
.UNINDENT
.UNINDENT
.SS fish_tab_title \- define the terminal tab\(aqs title
.SS Synopsis
.nf
\fBfish_title\fP
\fBfish_tab_title\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
    ...
end


function fish_tab_title
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_title\fP function is executed before and after a new command is executed or put into the foreground and the output is used as a titlebar message.
.sp
The first argument to \fBfish_title\fP contains the most recently executed foreground command as a string, if any.
.sp
This requires that your terminal supports programmable titles \%<#\:term-compat-osc-0> and the feature is turned on.
.sp
To disable setting the title, use an empty function (see below).
.sp
To set the terminal tab title to something other than the terminal window title,
define the \fBfish_tab_title\fP function, which works like \fBfish_title\fP but overrides that one.
.SS Example
.sp
A simple title:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
    set \-q argv[1]; or set argv fish
    # Looks like ~/d/fish: git log
    # or /e/apt: fish
    echo (fish_prompt_pwd_dir_length=1 prompt_pwd): $argv;
end
.EE
.UNINDENT
.UNINDENT
.sp
Do not change the title:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
end
.EE
.UNINDENT
.UNINDENT
.sp
Change the tab title only:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_tab_title
    echo fish $fish_pid
end
.EE
.UNINDENT
.UNINDENT
.SS fish_title \- define the terminal\(aqs title
.SS Synopsis
.nf
\fBfish_title\fP
\fBfish_tab_title\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
    ...
end


function fish_tab_title
    ...
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_title\fP function is executed before and after a new command is executed or put into the foreground and the output is used as a titlebar message.
.sp
The first argument to \fBfish_title\fP contains the most recently executed foreground command as a string, if any.
.sp
This requires that your terminal supports programmable titles \%<#\:term-compat-osc-0> and the feature is turned on.
.sp
To disable setting the title, use an empty function (see below).
.sp
To set the terminal tab title to something other than the terminal window title,
define the \fBfish_tab_title\fP function, which works like \fBfish_title\fP but overrides that one.
.SS Example
.sp
A simple title:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
    set \-q argv[1]; or set argv fish
    # Looks like ~/d/fish: git log
    # or /e/apt: fish
    echo (fish_prompt_pwd_dir_length=1 prompt_pwd): $argv;
end
.EE
.UNINDENT
.UNINDENT
.sp
Do not change the title:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_title
end
.EE
.UNINDENT
.UNINDENT
.sp
Change the tab title only:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_tab_title
    echo fish $fish_pid
end
.EE
.UNINDENT
.UNINDENT
.SS fish_update_completions \- update completions using manual pages
.SS Synopsis
.nf
\fBfish_update_completions\fP
.fi
.sp
.SS Description
.sp
\fBfish_update_completions\fP parses manual pages installed on the system, and attempts to create completion files in the \fBfish\fP configuration directory.
.sp
This does not overwrite custom completions.
.sp
There are no parameters for \fBfish_update_completions\fP\&.
.SS fish_vcs_prompt \- output version control system information for use in a prompt
.SS Synopsis
.nf
\fBfish_vcs_prompt\fP
.fi
.sp
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
     printf \(aq%s\(aq $PWD (fish_vcs_prompt) \(aq $ \(aq
end
.EE
.UNINDENT
.UNINDENT
.SS Description
.sp
The \fBfish_vcs_prompt\fP function displays information about the current version control system (VCS) repository, if any.
.sp
It calls out to VCS\-specific functions. The currently supported systems are:
.INDENT 0.0
.IP \(bu 2
fish_git_prompt \%<>
.IP \(bu 2
fish_hg_prompt \%<>
.IP \(bu 2
fish_svn_prompt \%<>
.UNINDENT
.sp
If a VCS isn\(aqt installed, the respective function does nothing.
.sp
The Subversion prompt is disabled by default, because it\(aqs slow on large repositories. To enable it, modify \fBfish_vcs_prompt\fP to uncomment it. See funced \%<>\&.
.sp
For more information, see the documentation for each of the functions above.
.SS Example
.sp
A simple prompt that displays all known VCS info:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    ...
    set \-g __fish_git_prompt_showupstream auto
    printf \(aq%s %s$\(aq $PWD (fish_vcs_prompt)
end
.EE
.UNINDENT
.UNINDENT
.SS fish_vi_key_bindings \- set vi key bindings for fish
.SS Synopsis
.nf
\fBfish_vi_key_bindings\fP
\fBfish_vi_key_bindings\fP [\fB\-\-no\-erase\fP] [\fIINIT_MODE\fP]
.fi
.sp
.SS Description
.sp
\fBfish_vi_key_bindings\fP sets the vi key bindings for \fBfish\fP shell.
.sp
If a valid \fIINIT_MODE\fP is provided (insert, default, visual), then that mode will become the default
\&. If no \fIINIT_MODE\fP is given, the mode defaults to insert mode.
.sp
The following parameters are available:
.INDENT 0.0
.TP
\fB\-\-no\-erase\fP
Does not clear previous set bindings
.UNINDENT
.sp
Further information on how to use vi mode \%<#\:vi-mode>\&.
.SS Differences from Vim
.sp
Fish\(aqs vi mode aims to be familiar to vim users, but there are some differences:
.INDENT 0.0
.TP
\fBWord character handling\fP
In vim, underscore (\fB_\fP) is treated as a keyword character by default, so word motions like \fBw\fP, \fBb\fP, and \fBe\fP treat \fBfoo_bar\fP as a single word. In fish, underscore is treated as punctuation, so word motions stop at underscores. For example, pressing \fBw\fP on \fBfoo_bar\fP in fish stops at the \fB_\fP, while in vim it would jump past the entire identifier.
.TP
\fBThe\fP \fBcw\fP \fBcommand\fP
In vim, \fBcw\fP has special behavior: when the cursor is on a non\-space character, it behaves like \fBce\fP (change to end of word), but when the cursor is on a space, it behaves like \fBdwi\fP (delete word then insert).
.sp
In fish, \fBcw\fP always behaves like \fBdwi\fP \- it deletes to the start of the next word (including trailing whitespace), then enters insert mode. To get vim\(aqs \fBcw\fP behavior in fish, use \fBce\fP instead.
.UNINDENT
.SS Examples
.sp
To start using vi key bindings:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_vi_key_bindings
.EE
.UNINDENT
.UNINDENT
.sp
or \fBset \-g fish_key_bindings fish_vi_key_bindings\fP in config.fish \%<#\:configuration>\&.
.SS for \- perform a set of commands multiple times
.SS Synopsis
.nf
\fBfor\fP \fIVARNAME\fP \fBin\fP [\fIVALUES\fP \&...]\fB;\fP \fICOMMANDS\fP \&...\fB;\fP \fBend\fP
.fi
.sp
.SS Description
.sp
\fBfor\fP is a loop construct. It will perform the commands specified by \fICOMMANDS\fP multiple times. On each iteration, the local variable specified by \fIVARNAME\fP is assigned a new value from \fIVALUES\fP\&. If \fIVALUES\fP is empty, \fICOMMANDS\fP will not be executed at all. The \fIVARNAME\fP is visible when the loop terminates and will contain the last value assigned to it. If \fIVARNAME\fP does not already exist it will be set in the local scope. For our purposes if the \fBfor\fP block is inside a function there must be a local variable with the same name. If the \fBfor\fP block is not nested inside a function then global and universal variables of the same name will be used if they exist.
.sp
Much like set \%<>, \fBfor\fP does not modify $status, but the evaluation of its subordinate commands can.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in foo bar baz; echo $i; end

# would output:
foo
bar
baz
.EE
.UNINDENT
.UNINDENT
.SS Notes
.sp
The \fBVARNAME\fP was local to the for block in releases prior to 3.0.0. This means that if you did something like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for var in a b c
    if break_from_loop
        break
    end
end
echo $var
.EE
.UNINDENT
.UNINDENT
.sp
The last value assigned to \fBvar\fP when the loop terminated would not be available outside the loop. What \fBecho $var\fP would write depended on what it was set to before the loop was run. Likely nothing.
.SS funced \- edit a function interactively
.SS Synopsis
.nf
\fBfunced\fP [\fIOPTIONS\fP] \fINAME\fP
.fi
.sp
.SS Description
.sp
\fBfunced\fP provides an interface to edit the definition of the function \fINAME\fP\&.
.sp
If the \fB$VISUAL\fP environment variable is set, it will be used as the program to edit the function. If \fB$VISUAL\fP is unset but \fB$EDITOR\fP is set, that will be used. Otherwise, a built\-in editor will be used. Note that to enter a literal newline using the built\-in editor you should press \fBalt\fP\-\fBenter\fP\&. Pressing \fBenter\fP signals that you are done editing the function. This does not apply to an external editor like emacs or vim.
.sp
\fBfunced\fP will try to edit the original file that a function is defined in, which might include variable definitions or helper functions as well. If changes cannot be saved to the original file, a copy will be created in the user\(aqs function directory.
.sp
If there is no function called \fINAME\fP, a new function will be created with the specified name.
.INDENT 0.0
.TP
\fB\-e command\fP or \fB\-\-editor command\fP
Open the function body inside the text editor given by the command (for example, \fB\-e vi\fP). The special command \fBfish\fP will use the built\-in editor (same as specifying \fB\-i\fP).
.TP
\fB\-i\fP or \fB\-\-interactive\fP
Force opening the function body in the built\-in editor even if \fB$VISUAL\fP or \fB$EDITOR\fP is defined.
.TP
\fB\-s\fP or \fB\-\-save\fP
Automatically save the function after successfully editing it.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Example
.sp
Say you want to modify your prompt.
.sp
Run:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ funced fish_prompt
.EE
.UNINDENT
.UNINDENT
.sp
This will open up your editor, allowing you to modify the function. When you\(aqre done, save and quit. Fish will reload the function, so you should see the changes right away.
.sp
When you\(aqre done, use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ funcsave fish_prompt
.EE
.UNINDENT
.UNINDENT
.sp
For more, see funcsave \%<>\&. To view a function\(aqs current definition, use functions \%<> or type \%<>\&.
.SS funcsave \- save the definition of a function to the user\(aqs autoload directory
.SS Synopsis
.nf
\fBfuncsave\fP \fIFUNCTION_NAME\fP
\fBfuncsave\fP [\fB\-q\fP | \fB\-\-quiet\fP] [(\fB\-d\fP | \fB\-\-directory\fP) \fIDIR\fP] \fIFUNCTION_NAME\fP
.fi
.sp
.SS Description
.sp
\fBfuncsave\fP saves a function to a file in the fish configuration directory. This function will be automatically loaded \%<#\:syntax-function-autoloading> by current and future fish sessions. This can be useful to commit functions created interactively for permanent use.
.sp
If you have erased a function using functions \%<>\(aqs \fB\-\-erase\fP option, \fBfuncsave\fP will remove the saved function definition.
.sp
Because fish loads functions on\-demand, saved functions cannot serve as event handlers \%<#\:event> until they are run or otherwise sourced. To activate an event handler for every new shell, add the function to the configuration file \%<#\:configuration> instead of using \fBfuncsave\fP\&.
.sp
This is often used after funced \%<>, which opens the function in \fB$EDITOR\fP or \fB$VISUAL\fP and loads it into the current session afterwards.
.sp
To view a function\(aqs current definition, use functions \%<> or type \%<>\&.
.SS function \- create a function
.SS Synopsis
.nf
\fBfunction\fP \fINAME\fP [\fIOPTIONS\fP]\fB;\fP \fIBODY\fP\fB;\fP \fBend\fP
.fi
.sp
.SS Description
.sp
\fBfunction\fP creates a new function \fINAME\fP with the body \fIBODY\fP\&.
.sp
A function is a list of commands that will be executed when the name of the function is given as a command.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-a\fP \fINAMES\fP or \fB\-\-argument\-names\fP \fINAMES\fP
Assigns the value of successive command\-line arguments to the names given in \fINAMES\fP (separated by spaces). These are the same arguments given in \fBargv\fP \%<#\:envvar-argv>, and are still available there (unless \fB\-\-inherit\-variable argv\fP was used or one of the given \fINAMES\fP is \fBargv\fP). See also Argument Handling \%<#\:variables-argv>\&.
.TP
\fB\-d\fP \fIDESCRIPTION\fP or \fB\-\-description\fP \fIDESCRIPTION\fP
A description of what the function does, suitable as a completion description.
.TP
\fB\-w\fP \fIWRAPPED_COMMAND\fP or \fB\-\-wraps\fP \fIWRAPPED_COMMAND\fP
Inherit completions from the given \fIWRAPPED_COMMAND\fP\&.
This is used to say that this function completes like that command,
for example if you\(aqre creating an alias.
See the documentation for complete \%<> for more information.
If the wrapped command is the same as the function name, this will be ignored.
.TP
\fB\-e\fP \fIEVENT_NAME\fP or \fB\-\-on\-event\fP \fIEVENT_NAME\fP
Run this function when the specified named event is emitted. Fish internally generates named events, for example, when showing the prompt. Custom events can be emitted using the emit \%<> command.
.TP
\fB\-v\fP \fIVARIABLE_NAME\fP or \fB\-\-on\-variable\fP \fIVARIABLE_NAME\fP
Run this function when the variable \fIVARIABLE_NAME\fP changes value. Note that \fBfish\fP makes no guarantees on any particular timing or even that the function will be run for every single \fBset\fP\&. Rather it will be run when the variable has been set at least once, possibly skipping some values or being run when the variable has been set to the same value (except for universal variables set in other shells \- only changes in the value will be picked up for those).
.TP
\fB\-j\fP \fIPID\fP or \fB\-\-on\-job\-exit\fP \fIPID\fP
Run this function when the job containing a child process with the given process ID \fIPID\fP exits. Instead of a PID, the string \(aqcaller\(aq can be specified. This is only allowed when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
This will not trigger for disowned \%<> jobs.
.TP
\fB\-p\fP \fIPID\fP or \fB\-\-on\-process\-exit\fP \fIPID\fP
Run this function when the fish child process with process ID PID exits. Instead of a PID, for backward compatibility, \(dq\fB%self\fP\(dq can be specified as an alias for \fB$fish_pid\fP, and the function will be run when the current fish instance exits.
This will not trigger for disowned \%<> jobs.
.TP
\fB\-s\fP \fISIGSPEC\fP or \fB\-\-on\-signal\fP \fISIGSPEC\fP
Run this function when the signal \fBSIGSPEC\fP is delivered. \fBSIGSPEC\fP can be a signal number, or the signal name, such as \fBSIGHUP\fP (or just \fBHUP\fP). Note that the signal must have been delivered to \fBfish\fP; for example, \fBctrl\fP\-\fBc\fP sends \fBSIGINT\fP to the foreground process group, which will not be \fBfish\fP if you are running another command at the time. Observing a signal will prevent fish from exiting in response to that signal.
.TP
\fB\-S\fP or \fB\-\-no\-scope\-shadowing\fP
Allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are \(dqshadowed\(dq, and their contents are independent of the calling function.
.sp
It\(aqs important to note that this does not capture referenced variables or the scope at the time of function declaration! At this time, fish does not have any concept of closures, and variable lifetimes are never extended. In other words, by using \fB\-\-no\-scope\-shadowing\fP the scope of the function each time it is run is shared with the scope it was \fIcalled\fP from rather than the scope it was \fIdefined\fP in.
.TP
\fB\-V\fP or \fB\-\-inherit\-variable NAME\fP
Snapshots the value of the variable \fBNAME\fP and defines a local variable with that same name and value when the function is defined. This is similar to a closure in other languages like Python but a bit different. Note the word \(dqsnapshot\(dq in the first sentence. If you change the value of the variable after defining the function, even if you do so in the same scope (typically another function) the new value will not be used by the function you just created using this option. See the \fBfunction notify\fP example below for how this might be used.
.UNINDENT
.sp
The event handler switches (\fBon\-event\fP, \fBon\-variable\fP, \fBon\-job\-exit\fP, \fBon\-process\-exit\fP and \fBon\-signal\fP) cause a function to run automatically at specific events. New named events for \fB\-\-on\-event\fP can be fired using the emit \%<> builtin. Fish already generates a few events, see Event handlers \%<#\:event> for more.
.sp
Functions names cannot be reserved words. These are elements of fish syntax or builtin commands which are essential for the operations of the shell. Current reserved words are \fB[\fP, \fB_\fP, \fBand\fP, \fBargparse\fP, \fBbegin\fP, \fBbreak\fP, \fBbuiltin\fP, \fBcase\fP, \fBcommand\fP, \fBcontinue\fP, \fBelse\fP, \fBend\fP, \fBeval\fP, \fBexec\fP, \fBfor\fP, \fBfunction\fP, \fBif\fP, \fBnot\fP, \fBor\fP, \fBread\fP, \fBreturn\fP, \fBset\fP, \fBstatus\fP, \fBstring\fP, \fBswitch\fP, \fBtest\fP, \fBtime\fP, and \fBwhile\fP\&.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function ll
    ls \-l $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
will run the \fBls\fP command, using the \fB\-l\fP option, while passing on any additional files and switches to \fBls\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function debug \-a name val
    echo [DEBUG] $name: $val >&2
end

set foo bar
debug foo bar
# prints: [DEBUG] foo: bar

# OR

function debug2 \-a var
    echo [DEBUG] $var: $$var >&2
end

set foo bar
debug2 foo
# prints: [DEBUG] foo: bar
.EE
.UNINDENT
.UNINDENT
.sp
will create a \fBdebug\fP command to print chosen variables to \fIstderr\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function mkdir \-d \(dqCreate a directory and set CWD\(dq
    command mkdir $argv
    if test $status = 0
        switch $argv[(count $argv)]
            case \(aq\-*\(aq

            case \(aq*\(aq
                cd $argv[(count $argv)]
                return
        end
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
This will run the \fBmkdir\fP command, and if it is successful, change the current working directory to the one just created.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function notify
    set \-l job (jobs \-l \-g)
    or begin; echo \(dqThere are no jobs\(dq >&2; return 1; end

    function _notify_job_$job \-\-on\-job\-exit $job \-\-inherit\-variable job
        echo \-n \ea # beep
        functions \-e _notify_job_$job
    end
end
.EE
.UNINDENT
.UNINDENT
.sp
This will beep when the most recent job completes.
.SS Notes
.sp
Events are only received from the current fish process as there is no way to send events from one fish process to another.
.SS See more
.sp
For more explanation of how functions fit into fish, see Functions \%<#\:syntax-function>\&.
.SS functions \- print or erase functions
.SS Synopsis
.nf
\fBfunctions\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-n\fP | \fB\-\-names\fP] [\fB\-\-color\fP \fIWHEN\fP]
\fBfunctions\fP [\fB\-D\fP | \fB\-\-details\fP] [\fB\-v\fP] [\fB\-\-color\fP \fIWHEN\fP] \fIFUNCTION\fP
\fBfunctions\fP \fB\-c\fP \fIOLDNAME\fP \fINEWNAME\fP
\fBfunctions\fP \fB\-d\fP \fIDESCRIPTION\fP \fIFUNCTION\fP
\fBfunctions\fP [\fB\-e\fP | \fB\-q\fP] \fIFUNCTION\fP \&...
.fi
.sp
.SS Description
.sp
\fBfunctions\fP prints or erases functions.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-all\fP
Lists all functions, even those whose name starts with an underscore.
.TP
\fB\-c\fP or \fB\-\-copy\fP \fIOLDNAME\fP \fINEWNAME\fP
Creates a new function named \fINEWNAME\fP, using the definition of the \fIOLDNAME\fP function.
.TP
\fB\-d\fP or \fB\-\-description\fP \fIDESCRIPTION\fP
Changes the description of this function.
.TP
\fB\-e\fP or \fB\-\-erase\fP
Causes the specified functions to be erased. This also means that it is prevented from autoloading in the current session. Use funcsave \%<> to remove the saved copy.
.TP
\fB\-D\fP or \fB\-\-details\fP
Reports the path name where the specified function is defined or could be autoloaded, \fBstdin\fP if the function was defined interactively or on the command line or by reading standard input, \fB\-\fP if the function was created via source \%<>, and \fBn/a\fP if the function isn\(aqt available. (Functions created via alias \%<> will return \fB\-\fP, because \fBalias\fP uses \fBsource\fP internally. Copied functions will return where the function was copied.) If the \fB\-\-verbose\fP option is also specified then five lines are written:
.INDENT 7.0
.IP \(bu 2
the path name as already described,
.IP \(bu 2
if the function was copied, the path name to where the function was originally defined, otherwise \fBautoloaded\fP, \fBnot\-autoloaded\fP or \fBn/a\fP,
.IP \(bu 2
the line number within the file or zero if not applicable,
.IP \(bu 2
\fBscope\-shadowing\fP if the function shadows the vars in the calling function (the normal case if it wasn\(aqt defined with \fB\-\-no\-scope\-shadowing\fP), else \fBno\-scope\-shadowing\fP, or \fBn/a\fP if the function isn\(aqt defined,
.IP \(bu 2
the function description minimally escaped so it is a single line, or \fBn/a\fP if the function isn\(aqt defined or has no description.
.UNINDENT
.sp
You should not assume that only five lines will be written since we may add additional information to the output in the future.
.TP
\fB\-\-no\-details\fP
Turns off function path reporting, so just the definition will be printed.
.TP
\fB\-n\fP or \fB\-\-names\fP
Lists the names of all defined functions.
.TP
\fB\-q\fP or \fB\-\-query\fP
Tests if the specified functions exist.
.TP
\fB\-v\fP or \fB\-\-verbose\fP
Make some output more verbose.
.TP
\fB\-H\fP or \fB\-\-handlers\fP
Show all event handlers.
.TP
\fB\-t\fP or \fB\-\-handlers\-type\fP \fITYPE\fP
Show all event handlers matching the given \fITYPE\fP\&.
.TP
\fB\-\-color\fP \fIWHEN\fP
Controls when to use syntax highlighting colors when printing function definitions.
\fIWHEN\fP can be \fBauto\fP (the default, colorize if the output is a terminal \%<>), \fBalways\fP, or \fBnever\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
The default behavior of \fBfunctions\fP, when called with no arguments, is to print the names of all defined functions. Unless the \fB\-a\fP option is given, no functions starting with underscores are included in the output.
.sp
If any non\-option parameters are given, the definition of the specified functions are printed.
.sp
Copying a function using \fB\-c\fP copies only the body of the function, and does not attach any event notifications from the original function.
.sp
Only one function\(aqs description can be changed in a single invocation of \fBfunctions \-d\fP\&.
.sp
The exit status of \fBfunctions\fP is the number of functions specified in the argument list that do not exist, which can be used in concert with the \fB\-q\fP option.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
functions \-n
# Displays a list of currently\-defined functions

functions \-c foo bar
# Copies the \(aqfoo\(aq function to a new function called \(aqbar\(aq

functions \-e bar
# Erases the function \(ga\(gabar\(ga\(ga
.EE
.UNINDENT
.UNINDENT
.SS See more
.sp
For more explanation of how functions fit into fish, see Functions \%<#\:syntax-function>\&.
.SS help \- display fish documentation
.SS Synopsis
.nf
\fBhelp\fP [\fISECTION\fP]
.fi
.sp
.SS Description
.sp
\fBhelp\fP displays the fish help documentation.
.sp
If a \fISECTION\fP is specified, the help for that command is shown.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.sp
If the \fBBROWSER\fP \%<#\:envvar-BROWSER> environment variable is set, it will be used to display the documentation.
Otherwise, fish will search for a suitable browser.
To use a different browser than as described above, you can set \fB$fish_help_browser\fP
This variable may be set as a list, where the first element is the browser command and the rest are browser options.
.SS Example
.sp
\fBhelp fg\fP shows the documentation for the fg \%<> builtin.
.SS Notes
.sp
Most builtin commands, including this one, display their help in the terminal when given the \fB\-\-help\fP option.
.SS history \- show and manipulate command history
.SS Synopsis
.nf
\fBhistory\fP [\fBsearch\fP] [\fB\-\-show\-time\fP] [\fB\-\-case\-sensitive\fP]
                 [\fB\-\-exact\fP | \fB\-\-prefix\fP | \fB\-\-contains\fP] [\fB\-\-max\fP \fIN\fP] [\fB\-\-null\fP] [\fB\-\-reverse\fP]
                 [\fISEARCH_STRING\fP \&...]
\fBhistory\fP \fBdelete\fP [\fB\-\-case\-sensitive\fP]
               [\fB\-\-exact\fP | \fB\-\-prefix\fP | \fB\-\-contains\fP] \fISEARCH_STRING\fP \&...
\fBhistory\fP \fBmerge\fP
\fBhistory\fP \fBsave\fP
\fBhistory\fP \fBclear\fP
\fBhistory\fP \fBclear\-session\fP
\fBhistory\fP \fBappend\fP \fICOMMAND\fP \&...
.fi
.sp
.SS Description
.sp
\fBhistory\fP is used to search, delete, and otherwise manipulate the history of interactive commands \%<#\:history-search>\&.
.sp
The following operations (sub\-commands) are available:
.INDENT 0.0
.TP
\fBsearch\fP
Returns history items matching the search string. If no search string is provided it returns all history items. This is the default operation if no other operation is specified. You only have to explicitly say \fBhistory search\fP if you wish to search for one of the subcommands. The \fB\-\-contains\fP search option will be used if you don\(aqt specify a different search option. Entries are ordered newest to oldest unless you use the \fB\-\-reverse\fP flag. If stdout is attached to a tty the output will be piped through your pager by the history function. The history builtin writes the results to stdout.
.TP
\fBdelete\fP
Deletes history items. The \fB\-\-contains\fP search option will be used if you don\(aqt specify a different search option. If you don\(aqt specify \fB\-\-exact\fP a prompt will be displayed before any items are deleted asking you which entries are to be deleted. You can enter the word \(dqall\(dq to delete all matching entries. You can enter a single ID (the number in square brackets) to delete just that single entry. You can enter more than one ID, or an ID range separated by a space to delete multiple entries. Press [enter] to not delete anything. Note that the interactive delete behavior is a feature of the history function. The history builtin only supports \fB\-\-exact \-\-case\-sensitive\fP deletion.
.TP
\fBmerge\fP
Immediately incorporates history changes from other sessions. Ordinarily \fBfish\fP ignores history changes from sessions started after the current one. This command applies those changes immediately.
.TP
\fBsave\fP
Immediately writes all changes to the history file. The shell automatically saves the history file; this option is provided for internal use and should not normally need to be used by the user.
.TP
\fBclear\fP
Clears the history file. A prompt is displayed before the history is erased asking you to confirm you really want to clear all history unless \fBbuiltin history\fP is used.
.TP
\fBclear\-session\fP
Clears the history file from all activity of the current session. Note: If \fBhistory merge\fP or \fBbuiltin history merge\fP is run in a session, only the history after this will be erased.
.TP
\fBappend\fP
Appends commands to the history without needing to execute them.
.UNINDENT
.sp
The following options are available:
.sp
These flags can appear before or immediately after one of the sub\-commands listed above.
.INDENT 0.0
.TP
\fB\-C\fP or \fB\-\-case\-sensitive\fP
Does a case\-sensitive search. The default is case\-insensitive.
.TP
\fB\-c\fP or \fB\-\-contains\fP
Searches items in the history that contain the specified text string. This is the default for the \fB\-\-search\fP flag. This is not currently supported by the \fBdelete\fP subcommand.
.TP
\fB\-e\fP or \fB\-\-exact\fP
Searches or deletes items in the history that exactly match the specified text string. This is the default for the \fBdelete\fP subcommand. Note that the match is case\-insensitive by default. If you really want an exact match, including letter case, you must use the \fB\-C\fP or \fB\-\-case\-sensitive\fP flag.
.TP
\fB\-p\fP or \fB\-\-prefix\fP
Searches items in the history that begin with the specified text string. This is not currently supported by the \fBdelete\fP subcommand.
.UNINDENT
.INDENT 0.0
.TP
\fB\-t\fP or \fB\-\-show\-time\fP
Prepends each history entry with the date and time the entry was recorded. By default it uses the strftime format \fB# %c%n\fP\&. You can specify another format; e.g., \fB\-\-show\-time=\(dq%Y\-%m\-%d %H:%M:%S \(dq\fP or \fB\-\-show\-time=\(dq%a%I%p\(dq\fP\&. The short option, \fB\-t\fP, doesn\(aqt accept a strftime format string; it only uses the default format. Any strftime format is allowed, including \fB%s\fP to get the raw UNIX seconds since the epoch.
.TP
\fB\-z\fP or \fB\-\-null\fP
Causes history entries written by the search operations to be terminated by a NUL character rather than a newline. This allows the output to be processed by \fBread \-z\fP to correctly handle multiline history entries.
.TP
\fB\-\fP*NUMBER* \fB\-n\fP \fINUMBER\fP or \fB\-\-max\fP \fINUMBER\fP
Limits the matched history items to the first \fINUMBER\fP matching entries. This is only valid for \fBhistory search\fP\&.
.TP
\fB\-R\fP or \fB\-\-reverse\fP
Causes the history search results to be ordered oldest to newest. Which is the order used by most shells. The default is newest to oldest.
.TP
\fB\-\-color\fP \fIWHEN\fP
Controls when to use syntax highlighting colors for the history entries.
\fIWHEN\fP can be \fBauto\fP (the default, colorize if the output is a terminal \%<>), \fBalways\fP, or \fBnever\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help for this command.
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
history clear
# Deletes all history items

history search \-\-contains \(dqfoo\(dq
# Outputs a list of all previous commands containing the string \(dqfoo\(dq.

history delete \-\-prefix \(dqfoo\(dq
# Interactively deletes commands which start with \(dqfoo\(dq from the history.
# You can select more than one entry by entering their IDs separated by a space.
.EE
.UNINDENT
.UNINDENT
.SS Customizing the name of the history file
.sp
By default interactive commands are logged to \fB$XDG_DATA_HOME/fish/fish_history\fP (typically \fB~/.local/share/fish/fish_history\fP).
.sp
You can set the \fBfish_history\fP variable to another name for the current shell session. The default value (when the variable is unset) is \fBfish\fP which corresponds to \fB$XDG_DATA_HOME/fish/fish_history\fP\&. If you set it to e.g. \fBfun\fP, the history would be written to \fB$XDG_DATA_HOME/fish/fun_history\fP\&. An empty string means history will not be stored at all. This is similar to the private session features in web browsers.
.sp
You can change \fBfish_history\fP at any time (by using \fBset \-x fish_history \(dqsession_name\(dq\fP) and it will take effect right away. If you set it to \fB\(dqdefault\(dq\fP, it will use the default session name (which is \fB\(dqfish\(dq\fP).
.sp
Other shells such as bash and zsh use a variable named \fBHISTFILE\fP for a similar purpose. Fish uses a different name to avoid conflicts and signal that the behavior is different (session name instead of a file path). Also, if you set the var to anything other than \fBfish\fP or \fBdefault\fP it will inhibit importing the bash history. That\(aqs because the most common use case for this feature is to avoid leaking private or sensitive history when giving a presentation.
.SS Notes
.sp
If you specify both \fB\-\-prefix\fP and \fB\-\-contains\fP the last flag seen is used.
.sp
Note that for backwards compatibility each subcommand can also be specified as a long option. For example, rather than \fBhistory search\fP you can type \fBhistory \-\-search\fP\&. Those long options are deprecated and will be removed in a future release.
.SS if \- conditionally execute a command
.SS Synopsis
.nf
\fBif\fP \fICONDITION\fP\fB;\fP \fICOMMANDS_TRUE\fP \&...\fB;\fP
[\fBelse\fP \fBif\fP \fICONDITION2\fP\fB;\fP \fICOMMANDS_TRUE2\fP \&...\fB;\fP]
[\fBelse\fP\fB;\fP \fICOMMANDS_FALSE\fP \&...\fB;\fP]
\fBend\fP
.fi
.sp
.SS Description
.sp
\fBif\fP will execute the command \fBCONDITION\fP\&. If the condition\(aqs exit status is 0, the commands \fBCOMMANDS_TRUE\fP will execute.  If the exit status is not 0 and else \%<> is given, \fBCOMMANDS_FALSE\fP will be executed.
.sp
You can use not \%<>, and \%<> or or \%<> in the condition. See the second example below.
.sp
The exit status of the last foreground command to exit can always be accessed using the $status \%<#\:variables-status> variable.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code will print \fBfoo.txt exists\fP if the file foo.txt exists and is a regular file, otherwise it will print \fBbar.txt exists\fP if the file bar.txt exists and is a regular file, otherwise it will print \fBfoo.txt and bar.txt do not exist\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-f foo.txt
    echo foo.txt exists
else if test \-f bar.txt
    echo bar.txt exists
else
    echo foo.txt and bar.txt do not exist
end
.EE
.UNINDENT
.UNINDENT
.sp
The following code will print \(dqfoo.txt exists and is readable\(dq if foo.txt is a regular file and readable
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-f foo.txt
   and test \-r foo.txt
   echo \(dqfoo.txt exists and is readable\(dq
end
.EE
.UNINDENT
.UNINDENT
.SS See also
.sp
\fBif\fP is only as useful as the command used as the condition.
.sp
Fish ships a few:
.INDENT 0.0
.IP \(bu 2
test \- perform tests on files and text \%<> can compare numbers, strings and check paths
.IP \(bu 2
string \- manipulate strings \%<> can perform string operations including wildcard and regular expression matches
.IP \(bu 2
path \- manipulate and check paths \%<> can check paths for permissions, existence or type
.IP \(bu 2
contains \- test if a word is present in a list \%<> can check if an element is in a list
.UNINDENT
.SS isatty \- test if a file descriptor is a terminal
.SS Synopsis
.nf
\fBisatty\fP [\fIFILE_DESCRIPTOR\fP]
.fi
.sp
.SS Description
.sp
\fBisatty\fP tests if a file descriptor is a terminal (as opposed to a file). The name is derived from the system call of the same name, which for historical reasons refers to a teletypewriter (TTY).
.sp
\fBFILE DESCRIPTOR\fP may be either the number of a file descriptor, or one of the strings \fBstdin\fP, \fBstdout\fP, or \fBstderr\fP\&. If not specified, zero is assumed.
.sp
If the specified file descriptor is a terminal device, the exit status of the command is zero. Otherwise, the exit status is non\-zero. No messages are printed to standard error.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Examples
.sp
From an interactive shell, the commands below exit with a return value of zero:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
isatty
isatty stdout
isatty 2
echo | isatty 1
.EE
.UNINDENT
.UNINDENT
.sp
And these will exit non\-zero:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo | isatty
isatty 9
isatty stdout > file
isatty 2 2> file
.EE
.UNINDENT
.UNINDENT
.SS jobs \- print currently running jobs
.SS Synopsis
.nf
\fBjobs\fP [\fIOPTIONS\fP] [\fIPID\fP | \fB%\fP\fIJOBID\fP]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBjobs\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man jobs\fP\&.
.sp
\fBjobs\fP prints a list of the currently running jobs \%<#\:syntax-job-control> and their status.
.sp
\fBjobs\fP accepts the following options:
.INDENT 0.0
.TP
\fB\-c\fP or \fB\-\-command\fP
Prints the command name for each process in jobs.
.TP
\fB\-g\fP or \fB\-\-group\fP
Only prints the group ID of each job.
.TP
\fB\-l\fP or \fB\-\-last\fP
Prints only the last job to be started.
.TP
\fB\-p\fP or \fB\-\-pid\fP
Prints the process ID for each process in all jobs.
.TP
\fB\-q\fP or \fB\-\-query\fP
Prints no output for evaluation of jobs by exit status only. For compatibility with old fish versions this is also \fB\-\-quiet\fP (but this is deprecated).
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
On systems that support this feature, jobs will print the CPU usage of each job since the last command was executed. The CPU usage is expressed as a percentage of full CPU activity. Note that on multiprocessor systems, the total activity may be more than 100%.
.sp
Arguments of the form \fIPID\fP or \fI%JOBID\fP restrict the output to jobs with the selected process identifiers or job numbers respectively.
.sp
If the output of \fBjobs\fP is redirected or if it is part of a command substitution, the column header that is usually printed is omitted, making it easier to parse.
.sp
The exit status of \fBjobs\fP is \fB0\fP if there are running background jobs and \fB1\fP otherwise.
.SS Example
.sp
\fBjobs\fP outputs a summary of the current jobs, such as two long\-running tasks in this example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
Job Group   State   Command
2   26012   running nc \-l 55232 < /dev/random &
1   26011   running python tests/test_11.py &
.EE
.UNINDENT
.UNINDENT
.SS math \- perform mathematics calculations
.SS Synopsis
.nf
\fBmath\fP [(\fB\-s\fP | \fB\-\-scale\fP) \fIN\fP] [(\fB\-b\fP | \fB\-\-base\fP) \fIBASE\fP] [(\fB\-m\fP | \fB\-\-scale\-mode\fP) \fIMODE\fP] \fIEXPRESSION\fP \&...
.fi
.sp
.SS Description
.sp
\fBmath\fP performs mathematical calculations.
It supports simple operations such as addition, subtraction, and so on, as well as functions like \fBabs()\fP, \fBsqrt()\fP and \fBln()\fP\&.
.sp
By default, the output shows up to 6 decimal places.
To change the number of decimal places, use the \fB\-\-scale\fP option, including \fB\-\-scale=0\fP for integer output.
.sp
Keep in mind that parameter expansion happens before expressions are evaluated.
This can be very useful in order to perform calculations involving shell variables or the output of command substitutions, but it also means that parenthesis (\fB()\fP) and the asterisk (\fB*\fP) glob character have to be escaped or quoted.
\fBx\fP can also be used to denote multiplication, but it needs to be followed by whitespace to distinguish it from hexadecimal numbers.
.sp
Parentheses for functions are optional \- \fBmath sin pi\fP prints \fB0\fP\&.
However, a comma will bind to the inner function, so \fBmath pow sin 3, 5\fP is an error because it tries to give \fBsin\fP the arguments \fB3\fP and \fB5\fP\&.
When in doubt, use parentheses.
.sp
\fBmath\fP ignores whitespace between arguments and takes its input as multiple arguments (internally joined with a space), so \fBmath 2 +2\fP and \fBmath \(dq2 +    2\(dq\fP work the same.
\fBmath 2 2\fP is an error.
.sp
\fBNote:\fP
.INDENT 0.0
.INDENT 3.5
math is a simple tool for simple uses, provided for convenience. It internally works with floats for simplicity of implementation and can\(aqt do a number of things real calculators can.
If you find yourself limited by that, use a more full\-featured tool.
.UNINDENT
.UNINDENT
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-s\fP \fIN\fP or \fB\-\-scale\fP \fIN\fP
Sets the scale of the result.
\fBN\fP must be an integer or the word \(dqmax\(dq for the maximum scale.
A scale of zero causes results to be truncated by default. Any non\-integer component is thrown away.
So \fB3/2\fP returns \fB1\fP by default, rather than \fB2\fP which \fB1.5\fP would normally round to.
This is for compatibility with \fBbc\fP which was the basis for this command prior to fish 3.0.0.
Scale values greater than zero causes the result to be rounded using the usual rules to the specified number of decimal places.
.TP
\fB\-b\fP \fIBASE\fP or \fB\-\-base\fP \fIBASE\fP
Sets the numeric base used for output (\fBmath\fP always understands hexadecimal numbers as input).
It currently understands \(dqhex\(dq or \(dq16\(dq for hexadecimal and \(dqoctal\(dq or \(dq8\(dq for octal and implies a scale of 0 (other scales cause an error), so it will truncate the result down to an integer.
This might change in the future.
Hex numbers will be printed with a \fB0x\fP prefix.
Octal numbers will have a prefix of \fB0\fP but aren\(aqt understood by \fBmath\fP as input.
.TP
\fB\-m\fP \fIMODE\fP or \fB\-\-scale\-mode\fP \fIMODE\fP
Sets scale behavior.
The \fBMODE\fP can be \fBtruncate\fP, \fBround\fP, \fBfloor\fP, \fBceiling\fP\&.
The default value of scale mode is \fBround\fP with non zero scale and \fBtruncate\fP with zero scale.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Return Values
.sp
If the expression is successfully evaluated and doesn\(aqt over/underflow or return NaN the return \fBstatus\fP is zero (success) else one.
.SS Syntax
.sp
\fBmath\fP knows some operators, constants, functions and can (obviously) read numbers.
.sp
For numbers, \fB\&.\fP is always the radix character regardless of locale \- \fB2.5\fP, not \fB2,5\fP\&.
Scientific notation (\fB10e5\fP) and hexadecimal (\fB0xFF\fP) are also available.
.sp
\fBmath\fP allows you to use underscores as visual separators for digit grouping. For example, you can write \fB1_000_000\fP, \fB0x_89_AB_CD_EF\fP, and \fB1.234_567_e89\fP\&.
.SS Operators
.sp
\fBmath\fP knows the following operators:
.INDENT 0.0
.TP
.B \fB+\fP
for addition
.TP
.B \fB\-\fP
for subtraction
.TP
.B \fB*\fP or \fBx\fP
for multiplication. \fB*\fP is the glob character and needs to be quoted or escaped, \fBx\fP needs to be followed by whitespace or it looks like \fB0x\fP hexadecimal notation.
.TP
.B \fB/\fP
for division
.TP
.B \fB^\fP
for exponentiation
.TP
.B \fB%\fP
for modulo
.TP
.B \fB(\fP or \fB)\fP
for grouping. These need to be quoted or escaped because \fB()\fP denotes a command substitution.
.UNINDENT
.sp
They are all used in an infix manner \- \fB5 + 2\fP, not \fB+ 5 2\fP\&.
.SS Constants
.sp
\fBmath\fP knows the following constants:
.INDENT 0.0
.TP
.B \fBe\fP
Euler\(aqs number
.TP
.B \fBpi\fP
π, you know this one.
Half of Tau
.TP
.B \fBtau\fP
Equivalent to 2π, or the number of radians in a circle
.UNINDENT
.sp
Use them without a leading \fB$\fP \- \fBpi \- 3\fP should be about 0.
.SS Functions
.sp
\fBmath\fP supports the following functions:
.INDENT 0.0
.TP
.B \fBabs\fP
the absolute value, with positive sign
.TP
.B \fBacos\fP
arc cosine
.TP
.B \fBasin\fP
arc sine
.TP
.B \fBatan\fP
arc tangent
.TP
.B \fBatan2\fP
arc tangent of two variables
.TP
.B \fBbitand\fP, \fBbitor\fP and \fBbitxor\fP
perform bitwise operations.
These will throw away any non\-integer parts and interpret the rest as an int.
.sp
Note: \fBbitnot\fP and \fBbitnand\fP don\(aqt exist. This is because numbers in math don\(aqt really have a \fIwidth\fP in terms of bits,
and these operations necessarily care about leading zeroes.
.sp
If you need to negate a specific number you can do it with an xor with a mask, e.g.:
.INDENT 7.0
.INDENT 3.5
.sp
.EX
> math \-\-base=hex bitxor 0x0F, 0xFF
0xF0

> math \-\-base=hex bitxor 0x2, 0x3
# Here we mask with 0x3 == 0b111, so our number is 3 bits wide
# Only the 1 bit isn\(aqt set.
0x1
.EE
.UNINDENT
.UNINDENT
.TP
.B \fBceil\fP
round number up to the nearest integer
.TP
.B \fBcos\fP
the cosine
.TP
.B \fBcosh\fP
hyperbolic cosine
.TP
.B \fBexp\fP
the base\-e exponential function
.TP
.B \fBfac\fP
factorial \- also known as \fBx!\fP (\fBx * (x \- 1) * (x \- 2) * ... * 1\fP)
.TP
.B \fBfloor\fP
round number down to the nearest integer
.TP
.B \fBln\fP
the base\-e logarithm
.TP
.B \fBlog\fP or \fBlog10\fP
the base\-10 logarithm. To compute the logarithm for an arbitrary base \fBb\fP, use \fBlog(x) / log(b)\fP\&.
.TP
.B \fBlog2\fP
the base\-2 logarithm
.TP
.B \fBmax\fP
returns the largest of the given numbers \- this takes an arbitrary number of arguments (but at least one)
.TP
.B \fBmin\fP
returns the smallest of the given numbers \- this takes an arbitrary number of arguments (but at least one)
.TP
.B \fBncr\fP
\(dqfrom n choose r\(dq combination function \- how many subsets of size r can be taken from n (order doesn\(aqt matter)
.TP
.B \fBnpr\fP
the number of subsets of size r that can be taken from a set of n elements (including different order)
.TP
.B \fBpow(x,y)\fP
returns x to the y (and can be written as \fBx ^ y\fP)
.TP
.B \fBround\fP
rounds to the nearest integer, away from 0
.TP
.B \fBsin\fP
the sine function
.TP
.B \fBsinh\fP
the hyperbolic sine
.TP
.B \fBsqrt\fP
the square root \- (can also be written as \fBx ^ 0.5\fP)
.TP
.B \fBtan\fP
the tangent
.TP
.B \fBtanh\fP
the hyperbolic tangent
.UNINDENT
.sp
All of the trigonometric functions use radians (the pi\-based scale, not 360°).
.SS Examples
.sp
\fBmath 1+1\fP outputs 2.
.sp
\fBmath $status \- 128\fP outputs the numerical exit status of the last command minus 128.
.sp
\fBmath 10 / 6\fP outputs \fB1.666667\fP\&.
.sp
\fBmath \-s0 10.0 / 6.0\fP outputs \fB1\fP\&.
.sp
\fBmath \-s3 10 / 6\fP outputs \fB1.667\fP\&.
.sp
\fBmath \(dqsin(pi)\(dq\fP outputs \fB0\fP\&.
.sp
\fBmath 5 \e* 2\fP or \fBmath \(dq5 * 2\(dq\fP or \fBmath 5 \(dq*\(dq 2\fP all output \fB10\fP\&.
.sp
\fBmath 0xFF\fP outputs 255, \fBmath 0 x 3\fP outputs 0 (because it computes 0 multiplied by 3).
.sp
\fBmath bitand 0xFE, 0x2e\fP outputs 46.
.sp
\fBmath \(dqbitor(9,2)\(dq\fP outputs 11.
.sp
\fBmath \-\-base=hex 192\fP prints \fB0xc0\fP\&.
.sp
\fBmath \(aqncr(49,6)\(aq\fP prints 13983816 \- that\(aqs the number of possible picks in 6\-from\-49 lotto.
.sp
\fBmath max 5,2,3,1\fP prints 5.
.SS Compatibility notes
.sp
Fish 1.x and 2.x releases relied on the \fBbc\fP command for handling \fBmath\fP expressions. Starting with fish 3.0.0 fish uses the tinyexpr library and evaluates the expression without the involvement of any external commands.
.sp
You don\(aqt need to use \fB\-\-\fP before the expression, even if it begins with a minus sign which might otherwise be interpreted as an invalid option. If you do insert \fB\-\-\fP before the expression, it will cause option scanning to stop just like for every other command and it won\(aqt be part of the expression.
.SS nextd \- move forward through directory history
.SS Synopsis
.nf
\fBnextd\fP [\fB\-l\fP | \fB\-\-list\fP] [\fIPOS\fP]
.fi
.sp
.SS Description
.sp
\fBnextd\fP moves forwards \fIPOS\fP positions in the history of visited directories \%<#\:directory-history>; if the end of the history has been hit, a warning is printed.
.sp
If the \fB\-l\fP or \fB\-\-list\fP option is specified, the current directory history is also displayed.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.sp
Note that the \fBcd\fP command limits directory history to the 25 most recently visited directories. The history is stored in the \fBdirprev\fP and \fBdirnext\fP variables which this command manipulates.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cd /usr/src
# Working directory is now /usr/src

cd /usr/src/fish\-shell
# Working directory is now /usr/src/fish\-shell

prevd
# Working directory is now /usr/src

nextd
# Working directory is now /usr/src/fish\-shell
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the cdh \%<> command to display a prompt to quickly navigate the history
.IP \(bu 2
the dirh \%<> command to print the directory history
.IP \(bu 2
the prevd \%<> command to move backward
.UNINDENT
.SS not \- negate the exit status of a job
.SS Synopsis
.nf
\fBnot\fP \fICOMMAND\fP [\fIOPTIONS\fP \&...]
\fB! \fP\fICOMMAND\fP [\fIOPTIONS\fP \&...]
.fi
.sp
.SS Description
.sp
\fBnot\fP negates the exit status of another command. If the exit status is zero, \fBnot\fP returns 1. Otherwise, \fBnot\fP returns 0.
.sp
Some other shells only support the \fB!\fP alias.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code reports an error and exits if no file named spoon can be found.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if not test \-f spoon
    echo There is no spoon
    exit 1
end
.EE
.UNINDENT
.UNINDENT
.SS open \- open file in its default application
.SS Synopsis
.nf
\fBopen\fP \fIFILES\fP \&...
.fi
.sp
.SS Description
.sp
\fBopen\fP opens a file in its default application, using the appropriate tool for the operating system. On GNU/Linux, this requires the common but optional \fBxdg\-open\fP utility, from the \fBxdg\-utils\fP package.
.sp
Note that this function will not be used if a command by this name exists (which is the case on macOS or Haiku).
.SS Example
.sp
\fBopen *.txt\fP opens all the text files in the current directory using your system\(aqs default text editor.
.SS or \- conditionally execute a command
.SS Synopsis
.nf
\fICOMMAND1\fP\fB;\fP \fBor\fP \fICOMMAND2\fP
.fi
.sp
.SS Description
.sp
\fBor\fP is used to execute a command if the previous command was not successful (returned a status of something other than 0).
.sp
\fBor\fP statements may be used as part of the condition in an if \%<> or while \%<> block.
.sp
\fBor\fP does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the $status \%<#\:variables-status> variable.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
The following code runs the \fBmake\fP command to build a program. If the build succeeds, the program is installed. If either step fails, \fBmake clean\fP is run, which removes the files created by the build process.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
make; and make install; or make clean
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
and \%<> command
.UNINDENT
.SS path \- manipulate and check paths
.SS Synopsis
.nf
\fBpath\fP \fBbasename\fP \fIGENERAL_OPTIONS\fP [(\fB\-E\fP | \fB\-\-no\-extension\fP)] [\fIPATH\fP \&...]
\fBpath\fP \fBdirname\fP \fIGENERAL_OPTIONS\fP  [\fIPATH\fP \&...]
\fBpath\fP \fBextension\fP \fIGENERAL_OPTIONS\fP [\fIPATH\fP \&...]
\fBpath\fP \fBfilter\fP \fIGENERAL_OPTIONS\fP [\fB\-v\fP | \fB\-\-invert\fP]
    [\fB\-d\fP] [\fB\-f\fP] [\fB\-l\fP] [\fB\-r\fP] [\fB\-w\fP] [\fB\-x\fP]
    [(\fB\-t\fP | \fB\-\-type\fP) \fITYPE\fP] [(\fB\-p\fP | \fB\-\-perm\fP) \fIPERMISSION\fP] [\fB\-\-all\fP] [\fIPATH\fP \&...]
\fBpath\fP \fBis\fP \fIGENERAL_OPTIONS\fP [(\fB\-v\fP | \fB\-\-invert\fP)] [(\fB\-t\fP | \fB\-\-type\fP) \fITYPE\fP]
    [\fB\-d\fP] [\fB\-f\fP] [\fB\-l\fP] [\fB\-r\fP] [\fB\-w\fP] [\fB\-x\fP]
    [(\fB\-p\fP | \fB\-\-perm\fP) \fIPERMISSION\fP] [\fIPATH\fP \&...]
\fBpath\fP \fBmtime\fP \fIGENERAL_OPTIONS\fP [(\fB\-R\fP | \fB\-\-relative\fP)] [\fIPATH\fP \&...]
\fBpath\fP \fBnormalize\fP \fIGENERAL_OPTIONS\fP [\fIPATH\fP \&...]
\fBpath\fP \fBresolve\fP \fIGENERAL_OPTIONS\fP [\fIPATH\fP \&...]
\fBpath\fP \fBchange\-extension\fP \fIGENERAL_OPTIONS\fP \fIEXTENSION\fP [\fIPATH\fP \&...]
\fBpath\fP \fBsort\fP \fIGENERAL_OPTIONS\fP [\fB\-r\fP | \fB\-\-reverse\fP]
    [\fB\-u\fP | \fB\-\-unique\fP] [\fB\-\-key\fP\fB=\fP(\fBbasename\fP | \fBdirname\fP | \fBpath\fP)] [\fIPATH\fP \&...]

\fIGENERAL_OPTIONS\fP
    [\fB\-z\fP | \fB\-\-null\-in\fP] [\fB\-Z\fP | \fB\-\-null\-out\fP] [\fB\-q\fP | \fB\-\-quiet\fP]
.fi
.sp
.SS Description
.sp
\fBpath\fP performs operations on paths.
.sp
PATH arguments are taken from the command line unless standard input is connected to a pipe or a file, in which case they are read from standard input, one PATH per line. It is an error to supply PATH arguments on both the command line and on standard input.
.sp
Arguments starting with \fB\-\fP are normally interpreted as switches; \fB\-\-\fP causes the following arguments not to be treated as switches even if they begin with \fB\-\fP\&. Switches and required arguments are recognized only on the command line.
.sp
When a path starts with \fB\-\fP, \fBpath filter\fP and \fBpath normalize\fP will prepend \fB\&./\fP on output to avoid it being interpreted as an option otherwise, so it\(aqs safe to pass path\(aqs output to other commands that can handle relative paths.
.sp
All subcommands accept a \fB\-q\fP or \fB\-\-quiet\fP switch, which suppresses the usual output but exits with the documented status. In this case these commands will quit early, without reading all of the available input.
.sp
All subcommands also accept a \fB\-Z\fP or \fB\-\-null\-out\fP switch, which makes them print output separated with NUL instead of newlines. This is for further processing, e.g. passing to another \fBpath\fP, or \fBxargs \-0\fP\&. This is not recommended when the output goes to the terminal or a command substitution.
.sp
All subcommands also accept a \fB\-z\fP or \fB\-\-null\-in\fP switch, which makes them accept arguments from stdin separated with NULL\-bytes. Since Unix paths can\(aqt contain NULL, that makes it possible to handle all possible paths and read input from e.g. \fBfind \-print0\fP\&. If arguments are given on the commandline this has no effect. This should mostly be unnecessary since \fBpath\fP automatically starts splitting on NULL if one appears in the first PATH_MAX bytes, PATH_MAX being the operating system\(aqs maximum length for a path plus a NULL byte.
.sp
Some subcommands operate on the paths as strings and so work on nonexistent paths, while others need to access the paths themselves and so filter out nonexistent paths.
.sp
The following subcommands are available.
.SS \(dqbasename\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path basename [\-E | \-\-no\-extension] [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath basename\fP returns the last path component of the given path, by removing the directory prefix and removing trailing slashes. In other words, it is the part that is not the dirname. For files you might call it the \(dqfilename\(dq.
.sp
If the \fB\-E\fP or \fB\-\-\-no\-extension\fP option is used and the base name contained a period, the path is returned with the extension (or the last extension) removed, i.e. the \(dqfilename\(dq without an extension (akin to calling \fBpath change\-extension \(dq\(dq (path basename $path)\fP).
.sp
It returns 0 if there was a basename, i.e. if the path wasn\(aqt empty or just slashes.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path basename ./foo.mp4
foo.mp4

>_ path basename ../banana
banana

>_ path basename /usr/bin/
bin

>_ path basename /usr/bin/*
# This prints all files in /usr/bin/
# A selection:
cp
fish
grep
rm
.EE
.UNINDENT
.UNINDENT
.SS \(dqdirname\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path dirname [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath dirname\fP returns the dirname for the given path. This is the part before the last \(dq/\(dq, discounting trailing slashes. In other words, it is the part that is not the basename (discounting superfluous slashes).
.sp
It returns 0 if there was a dirname, i.e. if the path wasn\(aqt empty or just slashes.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path dirname ./foo.mp4
\&.

>_ path dirname ../banana
\&..

>_ path dirname /usr/bin/
/usr
.EE
.UNINDENT
.UNINDENT
.SS \(dqextension\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path extension [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath extension\fP returns the extension of the given path. This is the part after (and including) the last \(dq.\(dq, unless that \(dq.\(dq followed a \(dq/\(dq or the basename is \(dq.\(dq or \(dq..\(dq, in which case there is no extension and an empty line is printed.
.sp
If the filename ends in a \(dq.\(dq, only a \(dq.\(dq is printed.
.sp
It returns 0 if there was an extension.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path extension ./foo.mp4
\&.mp4

>_ path extension ../banana
# an empty line, status 1

>_ path extension ~/.config
# an empty line, status 1

>_ path extension ~/.config.d
\&.d

>_ path extension ~/.config.
\&.

>_ set \-l path (path change\-extension \(aq\(aq ./foo.mp4)
>_ set \-l extension (path extension ./foo.mp4)
> echo $path$extension
# reconstructs the original path again.
\&./foo.mp4
.EE
.UNINDENT
.UNINDENT
.SS \(dqfilter\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path filter [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] \e
    [\-d] [\-f] [\-l] [\-r] [\-w] [\-x] \e
    [\-v | \-\-invert] [(\-t | \-\-type) TYPE] [(\-p | \-\-perm) PERMISSION] [\-\-all] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath filter\fP returns all of the given paths that match the given checks. In all cases, the paths need to exist, nonexistent paths are always filtered.
.sp
The available filters are:
.INDENT 0.0
.IP \(bu 2
\fB\-t\fP or \fB\-\-type\fP with the options: \(dqdir\(dq, \(dqfile\(dq, \(dqlink\(dq, \(dqblock\(dq, \(dqchar\(dq, \(dqfifo\(dq and \(dqsocket\(dq, in which case the path needs to be a directory, file, link, block device, character device, named pipe or socket, respectively.
.IP \(bu 2
\fB\-d\fP, \fB\-f\fP and \fB\-l\fP are short for \fB\-\-type=dir\fP, \fB\-\-type=file\fP and \fB\-\-type=link\fP, respectively. There are no shortcuts for the other types.
.IP \(bu 2
\fB\-p\fP or \fB\-\-perm\fP with the options: \(dqread\(dq, \(dqwrite\(dq, and \(dqexec\(dq, as well as \(dqsuid\(dq, \(dqsgid\(dq, \(dquser\(dq (referring to the path owner) and \(dqgroup\(dq (referring to the path\(aqs group), in which case the path needs to have all of the given permissions for the current user.
.IP \(bu 2
\fB\-r\fP, \fB\-w\fP and \fB\-x\fP are short for \fB\-\-perm=read\fP, \fB\-\-perm=write\fP and \fB\-\-perm=exec\fP, respectively. There are no shortcuts for the other permissions.
.UNINDENT
.sp
Note that the path needs to be \fIany\fP of the given types, but have \fIall\fP of the given permissions. This is because having a path that is both writable and executable makes sense, but having a path that is both a directory and a file doesn\(aqt. Links will count as the type of the linked\-to file, so links to files count as files, links to directories count as directories.
.sp
The filter options can either be given as multiple options, or comma\-separated \- \fBpath filter \-t dir,file\fP or \fBpath filter \-\-type dir \-\-type file\fP are equivalent.
.sp
With \fB\-\-invert\fP, the meaning of the filtering is inverted \- any path that wouldn\(aqt pass (including by not existing) passes, and any path that would pass fails.
.sp
When a path starts with \fB\-\fP, \fBpath filter\fP will prepend \fB\&./\fP to avoid it being interpreted as an option otherwise.
.sp
It returns 0 if at least one path passed the filter.
.sp
With \fB\-\-all\fP, return status 0 (true) if all paths pass the filter, and status 1 (false) if any path fails. This is equivalent to \fBnot path filter \-v\fP\&. It produces no output, only a status.
.sp
When \fB\-\-all\fP combined with \fB\-\-invert\fP, it returns status 0 (true) if all paths fail the filter and status 1 (false) if any path passes.
.sp
\fBpath is\fP is shorthand for \fBpath filter \-q\fP, i.e. just checking without producing output, see The is subcommand\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path filter /usr/bin /usr/argagagji
# The (hopefully) nonexistent argagagji is filtered implicitly:
/usr/bin

>_ path filter \-\-type file /usr/bin /usr/bin/fish
# Only fish is a file
/usr/bin/fish

>_ path filter \-\-type file,dir \-\-perm exec,write /usr/bin/fish /home/me
# fish is a file, which passes, and executable, which passes,
# but probably not writable, which fails.
#
# $HOME is a directory and both writable and executable, typically.
# So it passes.
/home/me

>_ path filter \-fdxw /usr/bin/fish /home/me
# This is the same as above: \(dq\-f\(dq is \(dq\-\-type=file\(dq, \(dq\-d\(dq is \(dq\-\-type=dir\(dq,
# \(dq\-x\(dq is short for \(dq\-\-perm=exec\(dq and \(dq\-w\(dq short for \(dq\-\-perm=write\(dq!
/home/me

>_ path filter \-fx $PATH/*
# Prints all possible commands \- the first entry of each name is what fish would execute!

>_ path filter \-\-all /usr/bin /usr/argagagji
# This returns 1 (false) because not all paths pass the filter.
.EE
.UNINDENT
.UNINDENT
.SS \(dqis\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path is [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] \e
    [\-d] [\-f] [\-l] [\-r] [\-w] [\-x] \e
    [\-v | \-\-invert] [(\-t | \-\-type) TYPE] [(\-p | \-\-perm) PERMISSION] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath is\fP is short for \fBpath filter \-q\fP\&. It returns true if any of the given files passes the filter, but does not produce any output.
.sp
\fB\-\-quiet\fP can still be passed for compatibility but is redundant. The options are the same as for \fBpath filter\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path is /usr/bin /usr/argagagji
# /usr/bin exists, so this returns a status of 0 (true). It prints nothing.
>_ path is /usr/argagagji
# /usr/argagagji does not, so this returns a status of 1 (false). It also prints nothing.
>_ path is \-fx /bin/sh
# /bin/sh is usually an executable file, so this returns true.
.EE
.UNINDENT
.UNINDENT
.SS \(dqmtime\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path mtime [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [\-R | \-\-relative] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath mtime\fP returns the last modification time (\(dqmtime\(dq in unix jargon) of the given paths, in seconds since the unix epoch (the beginning of the 1st of January 1970).
.sp
With \fB\-\-relative\fP (or \fB\-R\fP), it prints the number of seconds since the modification time. It only reads the current time once at start, so in case multiple paths are given the times are all relative to the \fIstart\fP of \fBpath mtime \-R\fP running.
.sp
If you want to know if a file is newer or older than another file, consider using \fBtest \-nt\fP instead. See the test documentation \%<>\&.
.sp
It returns 0 if reading mtime for any path succeeded.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ date +%s
# This prints the current time as seconds since the epoch
1657217847

>_ path mtime /etc/
1657213796

>_ path mtime \-R /etc/
4078
# So /etc/ on this system was last modified a little over an hour ago

# This is the same as
>_ math (date +%s) \- (path mtime /etc/)
.EE
.UNINDENT
.UNINDENT
.SS \(dqnormalize\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path normalize [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath normalize\fP returns the normalized versions of all paths. That means it squashes duplicate \(dq/\(dq, collapses \(dq../\(dq with earlier components and removes \(dq.\(dq components.
.sp
Unlike \fBrealpath\fP or \fBpath resolve\fP, it does not make the paths absolute. It also does not resolve any symlinks. As such it can operate on non\-existent paths.
.sp
Because it operates on paths as strings and doesn\(aqt resolve symlinks, it works sort of like \fBpwd \-L\fP and \fBcd\fP\&. E.g. \fBpath normalize link/..\fP will return \fB\&.\fP, just like \fBcd link; cd ..\fP would return to the current directory. For a physical view of the filesystem, see \fBpath resolve\fP\&.
.sp
Leading \(dq./\(dq components are usually removed. But when a path starts with \fB\-\fP, \fBpath normalize\fP will add it instead to avoid confusion with options.
.sp
It returns 0 if any normalization was done, i.e. any given path wasn\(aqt in canonical form.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path normalize /usr/bin//../../etc/fish
# The \(dq//\(dq is squashed and the \(dq..\(dq components neutralize the components before
/etc/fish

>_ path normalize /bin//bash
# The \(dq//\(dq is squashed, but /bin isn\(aqt resolved even if your system links it to /usr/bin.
/bin/bash

>_ path normalize ./my/subdirs/../sub2
my/sub2

>_ path normalize \-\- \-/foo
\&./\-/foo
.EE
.UNINDENT
.UNINDENT
.SS \(dqresolve\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path resolve [\-z | \-\-null\-in] [\-Z | \-\-null\-out] [\-q | \-\-quiet] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath resolve\fP returns the normalized, physical and absolute versions of all paths. That means it resolves symlinks and does what \fBpath normalize\fP does: it squashes duplicate \(dq/\(dq, collapses \(dq../\(dq with earlier components and removes \(dq.\(dq components. Then it turns that path into the absolute path starting from the filesystem root \(dq/\(dq.
.sp
It is similar to \fBrealpath\fP, as it creates the \(dqreal\(dq, canonical version of the path. However, for paths that can\(aqt be resolved, e.g. if they don\(aqt exist or form a symlink loop, it will resolve as far as it can and normalize the rest.
.sp
Because it resolves symlinks, it works sort of like \fBpwd \-P\fP\&. E.g. \fBpath resolve link/..\fP will return the parent directory of what the link points to, just like \fBcd link; cd (pwd \-P)/..\fP would go to it. For a logical view of the filesystem, see \fBpath normalize\fP\&.
.sp
It returns 0 if any normalization or resolution was done, i.e. any given path wasn\(aqt in canonical form.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path resolve /bin//sh
# The \(dq//\(dq is squashed, and /bin is resolved if your system links it to /usr/bin.
# sh here is bash (this is common on linux systems)
/usr/bin/bash

>_ path resolve /bin/foo///bar/../baz
# Assuming /bin exists and is a symlink to /usr/bin, but /bin/foo doesn\(aqt.
# This resolves the /bin/ and normalizes the nonexistent rest:
/usr/bin/foo/baz
.EE
.UNINDENT
.UNINDENT
.SS \(dqchange\-extension\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path change\-extension [\-z | \-\-null\-in] [\-Z | \-\-null\-out] \e
    [\-q | \-\-quiet] EXTENSION [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath change\-extension\fP returns the given paths, with their extension changed to the given new extension. The extension is the part after (and including) the last \(dq.\(dq, unless that \(dq.\(dq followed a \(dq/\(dq or the basename is \(dq.\(dq or \(dq..\(dq, in which case there is no previous extension and the new one is added.
.sp
If the extension is empty, any previous extension is stripped, along with the \(dq.\(dq. This is, of course, the inverse of \fBpath extension\fP\&.
.sp
One leading dot on the extension is ignored, so \(dq.mp3\(dq and \(dqmp3\(dq are treated the same.
.sp
It returns 0 if it was given any paths.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path change\-extension mp4 ./foo.wmv
\&./foo.mp4

>_ path change\-extension .mp4 ./foo.wmv
\&./foo.mp4

>_ path change\-extension \(aq\(aq ../banana
\&../banana

>_ path change\-extension \(aq\(aq ~/.config
/home/alfa/.config

>_ path change\-extension \(aq\(aq ~/.config.d
/home/alfa/.config

>_ path change\-extension \(aq\(aq ~/.config.
/home/alfa/.config
.EE
.UNINDENT
.UNINDENT
.SS \(dqsort\(dq subcommand
.INDENT 0.0
.INDENT 3.5
.sp
.EX
path sort [\-z | \-\-null\-in] [\-Z | \-\-null\-out] \e
    [\-q | \-\-quiet] [\-r | \-\-reverse] \e
    [\-\-key=basename|dirname|path] [PATH ...]
.EE
.UNINDENT
.UNINDENT
.sp
\fBpath sort\fP returns the given paths in sorted order. They are sorted in the same order as globs \- alphabetically, but with runs of numerical digits compared numerically.
.sp
With \fB\-\-reverse\fP or \fB\-r\fP the sort is reversed.
.sp
With \fB\-\-key=\fP only the given part of the path is compared, e.g. \fB\-\-key=dirname\fP causes only the dirname to be compared, \fB\-\-key=basename\fP only the basename and \fB\-\-key=path\fP causes the entire path to be compared (this is the default).
.sp
With \fB\-\-unique\fP or \fB\-u\fP the sort is deduplicated, meaning only the first of a run that have the same key is kept. So if you are sorting by basename, then only the first of each basename is used.
.sp
The sort used is stable, so sorting first by basename and then by dirname works and causes the files to be grouped according to directory.
.sp
It currently returns 0 if it was given any paths.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ path sort 10\-foo 2\-bar
2\-bar
10\-foo

>_ path sort \-\-reverse 10\-foo 2\-bar
10\-foo
2\-bar

>_ path sort \-\-unique \-\-key=basename $fish_function_path/*.fish
# prints a list of all function files fish would use, sorted by name.
.EE
.UNINDENT
.UNINDENT
.SS Combining \fBpath\fP
.sp
\fBpath\fP is meant to be easy to combine with itself, other tools and fish.
.sp
This is why
.INDENT 0.0
.IP \(bu 2
\fBpath\fP\(aqs output is automatically split by fish if it goes into a command substitution, so just doing \fB(path ...)\fP handles all paths, even those containing newlines, correctly
.IP \(bu 2
\fBpath\fP has \fB\-\-null\-in\fP to handle null\-delimited input (typically automatically detected!), and \fB\-\-null\-out\fP to pass on null\-delimited output
.UNINDENT
.sp
Some examples of combining \fBpath\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Expand all paths in the current directory, leave only executable files, and print their resolved path
path filter \-zZ \-xf \-\- * | path resolve \-z

# The same thing, but using find (note \-maxdepth needs to come first or find will scream)
# (this also depends on your particular version of find)
# Note the \(ga\-z\(ga is unnecessary for any sensible version of find \- if \(gapath\(ga sees a NULL,
# it will split on NULL automatically.
find . \-maxdepth 1 \-type f \-executable \-print0 | path resolve \-z

set \-l paths (path filter \-p exec $PATH/fish \-Z | path resolve)
.EE
.UNINDENT
.UNINDENT
.SS popd \- move through directory stack
.SS Synopsis
.nf
\fBpopd\fP
.fi
.sp
.SS Description
.sp
\fBpopd\fP removes the top directory from the directory stack \%<#\:directory-stack> and changes the working directory to the new top directory. Use pushd \%<> to add directories to the stack.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
pushd /usr/src
# Working directory is now /usr/src
# Directory stack contains /usr/src

pushd /usr/src/fish\-shell
# Working directory is now /usr/src/fish\-shell
# Directory stack contains /usr/src /usr/src/fish\-shell

popd
# Working directory is now /usr/src
# Directory stack contains /usr/src
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the dirs \%<> command to print the directory stack
.IP \(bu 2
the cdh \%<> command which provides a more intuitive way to navigate to recently visited directories.
.UNINDENT
.SS prevd \- move backward through directory history
.SS Synopsis
.nf
\fBprevd\fP [\fB\-l\fP | \fB\-\-list\fP] [\fIPOS\fP]
.fi
.sp
.SS Description
.sp
\fBprevd\fP moves backwards \fIPOS\fP positions in the history of visited directories \%<#\:directory-history>; if the beginning of the history has been hit, a warning is printed.
.sp
If the \fB\-l\fP or \fB\-\-list\fP flag is specified, the current history is also displayed.
.sp
Note that the \fBcd\fP command limits directory history to the 25 most recently visited directories. The history is stored in the \fBdirprev\fP and \fBdirnext\fP variables which this command manipulates.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cd /usr/src
# Working directory is now /usr/src

cd /usr/src/fish\-shell
# Working directory is now /usr/src/fish\-shell

prevd
# Working directory is now /usr/src

nextd
# Working directory is now /usr/src/fish\-shell
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the cdh \%<> command to display a prompt to quickly navigate the history
.IP \(bu 2
the dirh \%<> command to print the directory history
.IP \(bu 2
the nextd \%<> command to move forward
.UNINDENT
.SS printf \- display text according to a format string
.SS Synopsis
.nf
\fBprintf\fP \fIFORMAT\fP [\fIARGUMENT\fP \&...]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBprintf\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man printf\fP\&.
.sp
\fBprintf\fP uses the format string \fIFORMAT\fP to print the \fIARGUMENT\fP arguments. This means that it takes format specifiers in the format string and replaces each with an argument.
.sp
The \fIFORMAT\fP argument is re\-used as many times as necessary to convert all of the given arguments. So \fBprintf %s\en flounder catfish clownfish shark\fP will print four lines.
.sp
Unlike echo \%<>, \fBprintf\fP does not append a new line unless it is specified as part of the string.
.sp
It doesn\(aqt support any options, so there is no need for a \fB\-\-\fP separator, which makes it easier to use for arbitrary input than \fBecho\fP\&. [1]
.SS Format Specifiers
.sp
Valid format specifiers are taken from the C library function \fBprintf(3)\fP:
.INDENT 0.0
.IP \(bu 2
\fB%d\fP or \fB%i\fP: Argument will be used as decimal integer (signed or unsigned)
.IP \(bu 2
\fB%o\fP: An octal unsigned integer
.IP \(bu 2
\fB%u\fP: An unsigned decimal integer \- this means negative numbers will wrap around
.IP \(bu 2
\fB%x\fP or \fB%X\fP: An unsigned hexadecimal integer
.IP \(bu 2
\fB%f\fP, \fB%g\fP or \fB%G\fP: A floating\-point number. \fB%f\fP defaults to 6 places after the decimal point (which is locale\-dependent \- e.g. in de_DE it will be a \fB,\fP). \fB%g\fP and \fB%G\fP will trim trailing zeroes and switch to scientific notation (like \fB%e\fP) if the numbers get small or large enough.
.IP \(bu 2
\fB%e\fP or \fB%E\fP: A floating\-point number in scientific (XXXeYY) notation
.IP \(bu 2
\fB%s\fP: A string
.IP \(bu 2
\fB%b\fP: As a string, interpreting backslash escapes, except that octal escapes are of the form 0 or 0ooo.
.UNINDENT
.sp
\fB%%\fP signifies a literal \(dq%\(dq.
.sp
Conversion can fail, e.g. \(dq102.234\(dq can\(aqt losslessly convert to an integer, causing printf to print an error. If you are okay with losing information, silence errors with \fB2>/dev/null\fP\&.
.sp
A number between the \fB%\fP and the format letter specifies the width. The result will be left\-padded with spaces.
.SS Backslash Escapes
.sp
printf also knows a number of backslash escapes:
.INDENT 0.0
.IP \(bu 2
\fB\e\(dq\fP double quote
.IP \(bu 2
\fB\e\e\fP backslash
.IP \(bu 2
\fB\ea\fP alert (bell)
.IP \(bu 2
\fB\eb\fP backspace
.IP \(bu 2
\fB\ec\fP produce no further output
.IP \(bu 2
\fB\ee\fP escape
.IP \(bu 2
\fB\ef\fP form feed
.IP \(bu 2
\fB\en\fP new line
.IP \(bu 2
\fB\er\fP carriage return
.IP \(bu 2
\fB\et\fP horizontal tab
.IP \(bu 2
\fB\ev\fP vertical tab
.IP \(bu 2
\fB\eooo\fP octal number (ooo is 1 to 3 digits)
.IP \(bu 2
\fB\exhh\fP hexadecimal number (hhh is 1 to 2 digits)
.IP \(bu 2
\fB\euhhhh\fP 16\-bit Unicode character (hhhh is 4 digits)
.IP \(bu 2
\fB\eUhhhhhhhh\fP 32\-bit Unicode character (hhhhhhhh is 8 digits)
.UNINDENT
.SS Errors and Return Status
.sp
If the given argument doesn\(aqt work for the given format (like when you try to convert a number like 3.141592 to an integer), printf prints an error, to stderr. printf will then also return non\-zero, but will still try to print as much as it can.
.sp
It will also return non\-zero if no argument at all was given, in which case it will print nothing.
.sp
This printf has been imported from the printf in GNU Coreutils version 6.9. If you would like to use a newer version of printf, for example the one shipped with your OS, try \fBcommand printf\fP\&.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
printf \(aq%s\et%s\en\(aq flounder fish
.EE
.UNINDENT
.UNINDENT
.sp
Will print \(dqflounder    fish\(dq (separated with a tab character), followed by a newline character. This is useful for writing completions, as fish expects completion scripts to output the option followed by the description, separated with a tab character.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
printf \(aq%s: %d\(aq \(dqNumber of bananas in my pocket\(dq 42
.EE
.UNINDENT
.UNINDENT
.sp
Will print \(dqNumber of bananas in my pocket: 42\(dq, \fIwithout\fP a newline.
.SS See Also
.INDENT 0.0
.IP \(bu 2
the echo \%<> command, for simpler output
.UNINDENT
.SS Footnotes
.IP [1] 5
In fact, while fish\(aqs \fBecho\fP supports \fB\-\-\fP, POSIX forbids it, so other implementations can\(aqt be used if the input contains anything starting with \fB\-\fP\&.
.SS prompt_hostname \- print the hostname, shortened for use in the prompt
.SS Synopsis
.nf
\fBprompt_hostname\fP
.fi
.sp
.SS Description
.sp
\fBprompt_hostname\fP prints a shortened version the current hostname for use in the prompt. It will print just the first component of the hostname, everything up to the first dot.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    echo \-n (whoami)@(prompt_hostname) (prompt_pwd) \(aq$ \(aq
end
.EE
.UNINDENT
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# The machine\(aqs full hostname is foo.bar.com
>_ prompt_hostname
foo
.EE
.UNINDENT
.UNINDENT
.SS prompt_login \- describe the login suitable for prompt
.SS Synopsis
.nf
\fBprompt_login\fP
.fi
.sp
.SS Description
.sp
\fBprompt_login\fP is a function to describe the current login. It will show the user, the host and also whether the shell is running in a chroot (currently Debian\(aqs \fBdebian_chroot\fP file is supported).
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    echo \-n (prompt_login) (prompt_pwd) \(aq$ \(aq
end
.EE
.UNINDENT
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ prompt_login
root@bananablaster
.EE
.UNINDENT
.UNINDENT
.SS prompt_pwd \- print pwd suitable for prompt
.SS Synopsis
.nf
\fBprompt_pwd\fP
.fi
.sp
.SS Description
.sp
\fBprompt_pwd\fP is a function to print the current working directory in a way suitable for prompts. It will replace the home directory with \(dq~\(dq and shorten every path component but the last to a default of one character.
.sp
To change the number of characters per path component, pass \fB\-\-dir\-length=\fP or set \fBfish_prompt_pwd_dir_length\fP to the number of characters. Setting it to 0 or an invalid value will disable shortening entirely. This defaults to 1.
.sp
To keep some components unshortened, pass \fB\-\-full\-length\-dirs=\fP or set \fBfish_prompt_pwd_full_dirs\fP to the number of components. This defaults to 1, keeping the last component.
.sp
If any positional arguments are given, \fBprompt_pwd\fP shortens them instead of \fBPWD\fP \%<#\:envvar-PWD>\&.
.SS Options
.INDENT 0.0
.TP
\fB\-d\fP or \fB\-\-dir\-length\fP \fIMAX\fP
Causes the components to be shortened to \fIMAX\fP characters each. This overrides \fBfish_prompt_pwd_dir_length\fP\&.
.TP
\fB\-D\fP or \fB\-\-full\-length\-dirs\fP \fINUM\fP
Keeps \fINUM\fP components (counted from the right) as full length without shortening. This overrides \fBfish_prompt_pwd_full_dirs\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ cd ~/
>_ echo $PWD
/home/alfa

>_ prompt_pwd
~

>_ cd /tmp/banana/sausage/with/mustard
>_ prompt_pwd
/t/b/s/w/mustard

>_ set \-g fish_prompt_pwd_dir_length 3
>_ prompt_pwd
/tmp/ban/sau/wit/mustard

>_ prompt_pwd \-\-full\-length\-dirs=2 \-\-dir\-length=1
/t/b/s/with/mustard

>_ echo (prompt_pwd | string split /)[\-1]
mustard

>_ echo (string join / (prompt_pwd | string split /)[\-3..\-1])
s/with/mustard
.EE
.UNINDENT
.UNINDENT
.SS psub \- perform process substitution
.SS Synopsis
.nf
\fICOMMAND1\fP ( \fICOMMAND2\fP | \fBpsub\fP [\fB\-F\fP | \fB\-\-fifo\fP] [\fB\-f\fP | \fB\-\-file\fP] [(\fB\-s\fP | \fB\-\-suffix\fP) \fISUFFIX\fP] )
.fi
.sp
.SS Description
.sp
Some shells (e.g., ksh, bash) feature a syntax that is a mix between command substitution and piping, called process substitution. It is used to send the output of a command into the calling command, much like command substitution, but with the difference that the output is not sent through commandline arguments but through a named pipe, with the filename of the named pipe sent as an argument to the calling program. \fBpsub\fP combined with a regular command substitution provides the same functionality.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-f\fP or \fB\-\-file\fP
Use a regular file instead of a named pipe to communicate with the calling process. This will cause \fBpsub\fP to be significantly slower when large amounts of data are involved, but has the advantage that the reading process can seek in the stream. This is the default.
.TP
\fB\-F\fP or \fB\-\-fifo\fP
Use a named pipe rather than a file. You should only use this if the command produces no more than 8 KiB of output. The limit on the amount of data a FIFO can buffer varies with the OS but is typically 8 KiB, 16 KiB or 64 KiB. If you use this option and the command on the left of the psub pipeline produces more output a deadlock is likely to occur.
.TP
\fB\-s\fP or \fB\-\-suffix\fP \fISUFFIX\fP
Append SUFFIX to the filename.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
diff (sort a.txt | psub) (sort b.txt | psub)
# shows the difference between the sorted versions of files \(ga\(gaa.txt\(ga\(ga and \(ga\(gab.txt\(ga\(ga.

source\-highlight \-f esc (cpp main.c | psub \-f \-s .c)
# highlights \(ga\(gamain.c\(ga\(ga after preprocessing as a C source.
.EE
.UNINDENT
.UNINDENT
.SS pushd \- push directory to directory stack
.SS Synopsis
.nf
\fBpushd\fP \fIDIRECTORY\fP
.fi
.sp
.SS Description
.sp
The \fBpushd\fP function adds \fIDIRECTORY\fP to the top of the directory stack \%<#\:directory-stack> and makes it the current working directory. popd \%<> will pop it off and return to the original directory.
.sp
Without arguments, it exchanges the top two directories in the stack.
.sp
\fBpushd +NUMBER\fP rotates the stack counter\-clockwise i.e. from bottom to top
.sp
\fBpushd \-NUMBER\fP rotates clockwise i.e. top to bottom.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cd ~/dir1
pushd ~/dir2
pushd ~/dir3
# Working directory is now ~/dir3
# Directory stack contains ~/dir2 ~/dir1

pushd /tmp
# Working directory is now /tmp
# Directory stack contains ~/dir3 ~/dir2 ~/dir1

pushd +1
# Working directory is now ~/dir3
# Directory stack contains ~/dir2 ~/dir1 /tmp

popd
# Working directory is now ~/dir2
# Directory stack contains ~/dir1 /tmp
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
the dirs \%<> command to print the directory stack
.IP \(bu 2
the cdh \%<> command which provides a more intuitive way to navigate to recently visited directories.
.UNINDENT
.SS pwd \- output the current working directory
.SS Synopsis
.nf
\fBpwd\fP [\fB\-P\fP | \fB\-\-physical\fP]
\fBpwd\fP [\fB\-L\fP | \fB\-\-logical\fP]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBpwd\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man pwd\fP\&.
.sp
\fBpwd\fP outputs (prints) the current working directory.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-L\fP or \fB\-\-logical\fP
Output the logical working directory, without resolving symlinks (default behavior).
.TP
\fB\-P\fP or \fB\-\-physical\fP
Output the physical working directory, with symlinks resolved.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS See Also
.sp
Navigate directories using the directory history \%<#\:directory-history> or the directory stack \%<#\:directory-stack>
.SS random \- generate random number
.SS Synopsis
.nf
\fBrandom\fP
\fBrandom\fP \fISEED\fP
\fBrandom\fP \fISTART\fP \fIEND\fP
\fBrandom\fP \fISTART\fP \fISTEP\fP \fIEND\fP
\fBrandom\fP \fBchoice\fP [\fIITEMS\fP \&...]
.fi
.sp
.SS Description
.sp
\fBrandom\fP generates a pseudo\-random integer from a uniform distribution. The
range (inclusive) depends on the arguments.
.sp
No arguments indicate a range of 0 to 32767 (inclusive).
.sp
If one argument is specified, the internal engine will be seeded with the
argument for future invocations of \fBrandom\fP and no output will be produced.
.sp
Two arguments indicate a range from \fISTART\fP to \fIEND\fP (both \fISTART\fP and \fIEND\fP included).
.sp
Three arguments indicate a range from \fISTART\fP to \fIEND\fP with a spacing of \fISTEP\fP
between possible outputs.
.sp
\fBrandom choice\fP will select one random item from the succeeding arguments.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.sp
Note that seeding the engine will NOT give the same result across different
systems.
.sp
You should not consider \fBrandom\fP cryptographically secure, or even
statistically accurate.
.SS Example
.sp
The following code will count down from a random even number between 10 and 20 to 1:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (seq (random 10 2 20) \-1 1)
    echo $i
end
.EE
.UNINDENT
.UNINDENT
.sp
And this will open a random picture from any of the subdirectories:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
open (random choice **.jpg)
.EE
.UNINDENT
.UNINDENT
.sp
Or, to only get even numbers from 2 to 20:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
random 2 2 20
.EE
.UNINDENT
.UNINDENT
.sp
Or odd numbers from 1 to 3:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
random 1 2 3 # or 1 2 4
.EE
.UNINDENT
.UNINDENT
.SS read \- read line of input into variables
.SS Synopsis
.nf
\fBread\fP [\fIOPTIONS\fP] [\fIVARIABLE\fP \&...]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBread\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man read\fP\&.
.sp
\fBread\fP reads from standard input and stores the result in shell variables. In an alternative mode, it can also print to its own standard output, for example for use in command substitutions.
.sp
By default, \fBread\fP reads a single line and splits it into variables on spaces or tabs. Alternatively, a null character or a maximum number of characters can be used to terminate the input, and other delimiters can be given.
.sp
Unlike other shells, there is no default variable (such as \fBREPLY\fP) for storing the result \- instead, it is printed on standard output.
.sp
When \fBread\fP reaches the end\-of\-file (EOF) instead of the terminator, the exit status is set to 1.
Otherwise, it is set to 0.
.sp
If \fBread\fP sets a variable and you don\(aqt specify a scope, it will use the same rules that set \- display and change shell variables \%<> does \- if the variable exists, it will use it (in the lowest scope). If it doesn\(aqt, it will use an unexported function\-scoped variable.
.sp
The following options, like the corresponding ones in set \- display and change shell variables \%<>, control variable scope or attributes:
.INDENT 0.0
.TP
\fB\-U\fP or \fB\-\-universal\fP
Sets a universal variable.
The variable will be immediately available to all the user\(aqs \fBfish\fP instances on the machine, and will be persisted across restarts of the shell.
.TP
\fB\-f\fP or \fB\-\-function\fP
Sets a variable scoped to the executing function.
It is erased when the function ends.
.TP
\fB\-l\fP or \fB\-\-local\fP
Sets a locally\-scoped variable in this block.
It is erased when the block ends.
Outside of a block, this is the same as \fB\-\-function\fP\&.
.TP
\fB\-g\fP or \fB\-\-global\fP
Sets a globally\-scoped variable.
Global variables are available to all functions running in the same shell.
They can be modified or erased.
.TP
\fB\-u\fP or \fB\-\-unexport\fP
Prevents the variables from being exported to child processes (default behaviour).
.TP
\fB\-x\fP or \fB\-\-export\fP
Exports the variables to child processes.
.UNINDENT
.sp
The following options control the interactive mode:
.INDENT 0.0
.TP
\fB\-c\fP \fICMD\fP or \fB\-\-command\fP \fICMD\fP
Sets the initial string in the interactive mode command buffer to \fICMD\fP\&.
.TP
\fB\-s\fP or \fB\-\-silent\fP
Masks characters written to the terminal, replacing them with asterisks. This is useful for reading things like passwords or other sensitive information.
.TP
\fB\-p\fP or \fB\-\-prompt\fP \fIPROMPT_CMD\fP
Uses the output of the shell command \fIPROMPT_CMD\fP as the prompt for the interactive mode. The default prompt command is \fBset_color green; echo \-n read; set_color \-\-reset; echo \-n \(dq> \(dq\fP
.TP
\fB\-P\fP or \fB\-\-prompt\-str\fP \fIPROMPT_STR\fP
Uses the literal \fIPROMPT_STR\fP as the prompt for the interactive mode.
.TP
\fB\-R\fP or \fB\-\-right\-prompt\fP \fIRIGHT_PROMPT_CMD\fP
Uses the output of the shell command \fIRIGHT_PROMPT_CMD\fP as the right prompt for the interactive mode. There is no default right prompt command.
.TP
\fB\-S\fP or \fB\-\-shell\fP
Enables syntax highlighting, tab completions and command termination suitable for entering shellscript code in the interactive mode. NOTE: Prior to fish 3.0, the short opt for \fB\-\-shell\fP was \fB\-s\fP, but it has been changed for compatibility with bash\(aqs \fB\-s\fP short opt for \fB\-\-silent\fP\&.
.UNINDENT
.sp
The following options control how much is read and how it is stored:
.INDENT 0.0
.TP
\fB\-d\fP or \fB\-\-delimiter\fP \fIDELIMITER\fP
Splits on \fIDELIMITER\fP\&. \fIDELIMITER\fP will be used as an entire string to split on, not a set of characters.
.TP
\fB\-n\fP or \fB\-\-nchars\fP \fINCHARS\fP
Makes \fBread\fP return after reading \fINCHARS\fP characters or the end of the line, whichever comes first.
.TP
\fB\-t\fP, \fB\-\-tokenize\fP or \fB\-\-tokenize\-raw\fP
Causes read to split the input into variables by the shell\(aqs tokenization rules.
This means it will honor quotes and escaping.
This option is of course incompatible with other options to control splitting like \fB\-\-delimiter\fP and does not honor \fBIFS\fP \%<#\:envvar-IFS> (like fish\(aqs tokenizer).
The \fB\-t\fP \-or \fB\-\-tokenize\fP variants perform quote removal, so e.g. \fBa\e b\fP is stored as \fBa b\fP\&.
However variables and command substitutions are not expanded.
.TP
\fB\-a\fP or \fB\-\-list\fP
Stores the result as a list in a single variable. This option is also available as \fB\-\-array\fP for backwards compatibility.
.TP
\fB\-z\fP or \fB\-\-null\fP
Marks the end of the line with the NUL character, instead of newline. This also disables interactive mode.
.TP
\fB\-L\fP or \fB\-\-line\fP
Reads each line into successive variables, and stops after each variable has been filled. This cannot be combined with the \fB\-\-delimiter\fP option.
.UNINDENT
.sp
Without the \fB\-\-line\fP option, \fBread\fP reads a single line of input from standard input, breaks it into tokens, and then assigns one token to each variable specified in \fIVARIABLES\fP\&. If there are more tokens than variables, the complete remainder is assigned to the last variable.
.sp
If no option to determine how to split like \fB\-\-delimiter\fP, \fB\-\-line\fP or \fB\-\-tokenize\fP is given, the variable \fBIFS\fP is used as a list of characters to split on. Relying on the use of \fBIFS\fP is deprecated and this behaviour will be removed in future versions. The default value of \fBIFS\fP contains space, tab and newline characters. As a special case, if \fBIFS\fP is set to the empty string, each character of the input is considered a separate token.
.sp
With the \fB\-\-line\fP option, \fBread\fP reads a line of input from standard input into each provided variable, stopping when each variable has been filled. The line is not tokenized.
.sp
If no variable names are provided, \fBread\fP enters a special case that provides redirection from standard input to standard output, useful for command substitution. For instance, the fish shell command below can be used to read a password from the console instead of hardcoding it in the command itself, which prevents it from showing up in fish\(aqs history:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
mysql \-uuser \-p(read)
.EE
.UNINDENT
.UNINDENT
.sp
When running in this mode, \fBread\fP does not split the input in any way and text is redirected to standard output without any further processing or manipulation.
.sp
If \fB\-l\fP or \fB\-\-list\fP is provided, only one variable name is allowed and the tokens are stored as a list in this variable.
.sp
In order to protect the shell from consuming too many system resources, \fBread\fP will only consume a
maximum of 100 MiB (104857600 bytes); if the terminator is not reached before this limit then \fIVARIABLE\fP
is set to empty and the exit status is set to 122. This limit can be altered with the
\fBfish_read_limit\fP \%<#\:envvar-fish_read_limit> variable. If set to 0 (zero), the limit is removed.
.SS Example
.sp
\fBread\fP has a few separate uses.
.sp
The following code stores the value \(aqhello\(aq in the shell variable \fBfoo\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo hello | read foo
.EE
.UNINDENT
.UNINDENT
.sp
The while \%<> command is a neat way to handle command output line\-by\-line:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
printf \(aq%s\en\(aq line1 line2 line3 line4 | while read \-l foo
                  echo \(dqThis is another line: $foo\(dq
              end
.EE
.UNINDENT
.UNINDENT
.sp
Delimiters given via \(dq\-d\(dq are taken as one string:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo a==b==c | read \-d == \-l a b c
echo $a # a
echo $b # b
echo $c # c
.EE
.UNINDENT
.UNINDENT
.sp
\fB\-\-tokenize\fP honors quotes and escaping like the shell\(aqs argument passing:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(aqa\e b\(aq | read \-t first second
echo $first # outputs \(dqa b\(dq, $second is empty

echo \(aqa\(dqfoo bar\(dqb (command echo wurst)*\(dq \(dq{a,b}\(aq | read \-lt \-l a b c
echo $a # outputs \(aqafoo barb\(aq (without the quotes)
echo $b # outputs \(aq(command echo wurst)* {a,b}\(aq (without the quotes)
echo $c # nothing
.EE
.UNINDENT
.UNINDENT
.sp
For an example on interactive use, see Querying for user input \%<#\:user-input>\&.
.SS realpath \- convert a path to an absolute path without symlinks
.SS Synopsis
.nf
\fBrealpath\fP [\fIOPTIONS\fP] \fIPATH\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBrealpath\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man realpath\fP\&.
.sp
\fBrealpath\fP follows all symbolic links encountered for the provided \fBPATH\fP \%<#\:envvar-PATH>, printing the absolute path resolved. fish \%<> provides a \fBrealpath\fP\-alike builtin intended to enrich systems where no such command is installed by default.
.sp
If a \fBrealpath\fP command exists, that will be preferred.
\fBbuiltin realpath\fP will explicitly use the fish implementation of \fBrealpath\fP\&.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-s\fP or \fB\-\-no\-symlinks\fP
Don\(aqt resolve symlinks, only make paths absolute, squash multiple slashes and remove trailing slashes.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS return \- stop the current inner function
.SS Synopsis
.nf
\fBreturn\fP [\fIN\fP]
.fi
.sp
.SS Description
.sp
\fBreturn\fP halts a currently running function.
The exit status is set to \fIN\fP if it is given.
If \fBreturn\fP is invoked outside of a function or dot script it is equivalent to exit.
.sp
It is often added inside of a conditional block such as an if \%<> statement or a switch \%<> statement to conditionally stop the executing function and return to the caller; it can also be used to specify the exit status of a function.
.sp
If at the top level of a script, it exits with the given status, like exit \%<>\&.
If at the top level in an interactive session, it will set \fBstatus\fP \%<#\:envvar-status>, but not exit the shell.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
An implementation of the false command as a fish function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function false
    return 1
end
.EE
.UNINDENT
.UNINDENT
.SS set \- display and change shell variables
.SS Synopsis
.nf
\fBset\fP
\fBset\fP (\fB\-f\fP | \fB\-\-function\fP) (\fB\-l\fP | \fB\-\-local\fP) (\fB\-g\fP | \fB\-\-global\fP) (\fB\-U\fP | \fB\-\-universal\fP) [\fB\-\-no\-event\fP]
\fBset\fP [\fB\-Uflg\fP] \fINAME\fP [\fIVALUE\fP \&...]
\fBset\fP [\fB\-Uflg\fP] \fINAME\fP[[\fIINDEX\fP \&...]] [\fIVALUE\fP \&...]
\fBset\fP (\fB\-x\fP | \fB\-\-export\fP) (\fB\-u\fP | \fB\-\-unexport\fP) [\fB\-Uflg\fP] \fINAME\fP [\fIVALUE\fP \&...]
\fBset\fP (\fB\-a\fP | \fB\-\-append\fP) (\fB\-p\fP | \fB\-\-prepend\fP) [\fB\-Uflg\fP] \fINAME\fP \fIVALUE\fP \&...
\fBset\fP (\fB\-e\fP | \fB\-\-erase\fP) [\fB\-Uflg\fP] [\fB\-xu\fP] [\fINAME\fP][[\fIINDEX\fP]] \&...]
\fBset\fP (\fB\-q\fP | \fB\-\-query\fP) [\fB\-Uflg\fP] [\fB\-xu\fP] [\fINAME\fP][[\fIINDEX\fP]] \&...]
\fBset\fP (\fB\-S\fP | \fB\-\-show\fP) (\fB\-L\fP | \fB\-\-long\fP) [\fINAME\fP \&...]
.fi
.sp
.SS Description
.sp
\fBset\fP manipulates shell variables \%<#\:variables>\&.
.sp
If both \fINAME\fP and \fIVALUE\fP are provided, \fBset\fP assigns any values to variable \fINAME\fP\&.
Variables in fish are lists \%<#\:variables-lists>, multiple values are allowed.
One or more variable \fIINDEX\fP can be specified including ranges (not for all options.)
.sp
If no \fIVALUE\fP is given, the variable will be set to the empty list.
.sp
If \fBset\fP is ran without arguments, it prints the names and values of all shell variables in sorted order.
Passing scope \%<#\:variables-scope> or export \%<#\:variables-export> flags allows filtering this to only matching variables, so \fBset \-\-local\fP would only show local variables.
.sp
With \fB\-\-erase\fP and optionally a scope flag \fBset\fP will erase the matching variable (or the variable of that name in the smallest possible scope).
.sp
With \fB\-\-show\fP, \fBset\fP will describe the given variable names, explaining how they have been defined \- in which scope with which values and options.
.sp
The following options control variable scope:
.INDENT 0.0
.TP
\fB\-U\fP or \fB\-\-universal\fP
Sets a universal variable.
The variable will be immediately available to all the user\(aqs \fBfish\fP instances on the machine, and will be persisted across restarts of the shell.
.TP
\fB\-f\fP or \fB\-\-function\fP
Sets a variable scoped to the executing function.
It is erased when the function ends.
.TP
\fB\-l\fP or \fB\-\-local\fP
Sets a locally\-scoped variable in this block.
It is erased when the block ends.
Outside of a block, this is the same as \fB\-\-function\fP\&.
.TP
\fB\-g\fP or \fB\-\-global\fP
Sets a globally\-scoped variable.
Global variables are available to all functions running in the same shell.
They can be modified or erased.
.UNINDENT
.sp
These options modify how variables operate:
.INDENT 0.0
.TP
\fB\-\-export\fP or \fB\-x\fP
Causes the specified shell variable to be exported to child processes (making it an \(dqenvironment variable\(dq).
.TP
\fB\-\-unexport\fP or \fB\-u\fP
Causes the specified shell variable to NOT be exported to child processes.
.TP
\fB\-\-path\fP
Treat specified variable as a path variable \%<#\:variables-path>; variable will be split on colons (\fB:\fP) and will be displayed joined by colons when quoted (\fBecho \(dq$PATH\(dq\fP) or exported.
.TP
\fB\-\-unpath\fP
Causes variable to no longer be treated as a path variable \%<#\:variables-path>\&.
Note: variables ending in \(dqPATH\(dq are automatically path variables.
.UNINDENT
.sp
Further options:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-append\fP \fINAME\fP \fIVALUE\fP ...
Appends \fIVALUES\fP to the current set of values for variable \fBNAME\fP\&.
Can be used with \fB\-\-prepend\fP to both append and prepend at the same time.
This cannot be used when assigning to a variable slice.
.TP
\fB\-p\fP or \fB\-\-prepend\fP \fINAME\fP \fIVALUE\fP ...
Prepends \fIVALUES\fP to the current set of values for variable \fBNAME\fP\&.
This can be used with \fB\-\-append\fP to both append and prepend at the same time.
This cannot be used when assigning to a variable slice.
.TP
\fB\-e\fP or \fB\-\-erase\fP \fINAME\fP[\fIINDEX\fP]
Causes the specified shell variables to be erased.
Supports erasing from multiple scopes at once.
Individual items in a variable at \fIINDEX\fP in brackets can be specified.
.TP
\fB\-q\fP or \fB\-\-query\fP \fINAME\fP[\fIINDEX\fP]
Test if the specified variable names are defined.
If an \fIINDEX\fP is provided, check for items at that slot.
With a given scope (like \fB\-\-global\fP) or attribute (like \fB\-\-export\fP or \fB\-\-path\fP) check only variables that match.
Does not output anything, but the shell status is set to the number of variables specified that were not defined, up to a maximum of 255.
If no variable was given, it also returns 255.
.TP
\fB\-n\fP or \fB\-\-names\fP
List only the names of all defined variables, not their value.
The names are guaranteed to be sorted.
.TP
\fB\-S\fP or \fB\-\-show\fP
Shows information about the given variables.
If no variable names are given then all variables are shown in sorted order.
It shows the scopes the given variables are set in, along with the values in each and whether or not it is exported.
No other flags can be used with this option.
.TP
\fB\-\-no\-event\fP
Don\(aqt generate a variable change event when setting or erasing a variable.
We recommend using this carefully because the event handlers are usually set up for a reason.
Possible uses include modifying the variable inside a variable handler.
.TP
\fB\-L\fP or \fB\-\-long\fP
Do not abbreviate long values when printing set variables.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
If a variable is set to more than one value, the variable will be a list with the specified elements.
If a variable is set to zero elements, it will become a list with zero elements.
.sp
If the variable name is one or more list elements, such as \fBPATH[1 3 7]\fP, only those list elements specified will be changed.
If you specify a negative index when expanding or assigning to a list variable, the index will be calculated from the end of the list.
For example, the index \-1 means the last index of a list.
.sp
The scoping rules when creating or updating a variable are:
.INDENT 0.0
.IP \(bu 2
Variables may be explicitly set as universal, global, function, or local.
Variables with the same name but in a different scope will not be changed.
.IP \(bu 2
If the scope of a variable is not explicitly set \fIbut a variable by that name has been previously defined\fP, the scope of the existing variable is used.
If the variable is already defined in multiple scopes, the variable with the narrowest scope will be updated.
.IP \(bu 2
If a variable\(aqs scope is not explicitly set and there is no existing variable by that name, the variable will be local to the currently executing function.
Note that this is different from using the \fB\-l\fP or \fB\-\-local\fP flag, in which case the variable will be local to the most\-inner currently executing block, while without them the variable will be local to the function as a whole.
If no function is executing, the variable will be set in the global scope.
.UNINDENT
.sp
The exporting rules when creating or updating a variable are identical to the scoping rules for variables:
.INDENT 0.0
.IP \(bu 2
Variables may be explicitly set to either exported or not exported.
When an exported variable goes out of scope, it is unexported.
.IP \(bu 2
If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept.
.IP \(bu 2
If a variable is not explicitly set to be either exported or unexported and has never before been defined, the variable will not be exported.
.UNINDENT
.sp
In query mode, the scope to be examined can be specified.
Whether the variable has to be a path variable or exported can also be specified.
.sp
In erase mode, if variable indices are specified, only the specified slices of the list variable will be erased.
.sp
\fBset\fP requires all options to come before any other arguments.
For example, \fBset flags \-l\fP will have the effect of setting the value of the variable \fBflags\fP to \(aq\-l\(aq, not making the variable local.
.SS Exit status
.sp
In assignment mode, \fBset\fP does not modify the exit status, but passes along whatever \fBstatus\fP \%<#\:envvar-status> was set, including by command substitutions.
This allows capturing the output and exit status of a subcommand, like in \fBif set output (command)\fP\&.
.sp
In query mode, the exit status is the number of variables that were not found.
.sp
In erase mode, \fBset\fP exits with a zero exit status in case of success, with a non\-zero exit status if the commandline was invalid, if any of the variables did not exist or was a special read\-only variable \%<#\:variables-special>\&.
.SS Examples
.sp
Print all global, exported variables:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-gx
.EE
.UNINDENT
.UNINDENT
.sp
Set the value of the variable _$foo_ to be \(aqhi\(aq.:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set foo hi
.EE
.UNINDENT
.UNINDENT
.sp
Append the value \(dqthere\(dq to the variable $foo:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-a foo there
.EE
.UNINDENT
.UNINDENT
.sp
Remove _$smurf_ from the scope:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-e smurf
.EE
.UNINDENT
.UNINDENT
.sp
Remove _$smurf_ from the global and universal scopes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-e \-Ug smurf
.EE
.UNINDENT
.UNINDENT
.sp
Change the fourth element of the $PATH list to ~/bin:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set PATH[4] ~/bin
.EE
.UNINDENT
.UNINDENT
.sp
Outputs the path to Python if \fBtype \-p\fP returns true:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if set python_path (type \-p python)
    echo \(dqPython is at $python_path\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
Setting a variable doesn\(aqt modify $status; a command substitution still will, though:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo $status
0
> false
> set foo bar
> echo $status
1
> true
> set foo banana (false)
> echo $status
1
.EE
.UNINDENT
.UNINDENT
.sp
\fBVAR=VALUE command\fP sets a variable for just one command, like other shells.
This runs fish with a temporary home directory:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> HOME=(mktemp \-d) fish
.EE
.UNINDENT
.UNINDENT
.sp
(which is essentially the same as):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> begin; set \-lx HOME (mktemp \-d); fish; end
.EE
.UNINDENT
.UNINDENT
.SS Notes
.INDENT 0.0
.IP \(bu 2
Fish versions prior to 3.0 supported the syntax \fBset PATH[1] PATH[4] /bin /sbin\fP, which worked like \fBset PATH[1 4] /bin /sbin\fP\&.
.UNINDENT
.SS set_color \- set the terminal color
.SS Synopsis
.nf
\fBset_color\fP [\fIOPTIONS\fP] [\fIVALUE\fP]
.fi
.sp
.SS Description
.sp
\fBset_color\fP is used to control the color and styling of text in the terminal.
\fIVALUE\fP describes that styling.
\fIVALUE\fP can be a reserved color name like \fBred\fP or an RGB color value given as 3 or 6 hexadecimal digits (\(dqF27\(dq or \(dqFF2277\(dq).
A special keyword \fBnormal\fP resets text formatting to terminal defaults, however it is not recommended and the \fB\-\-reset\fP option is preferred as it is less confusing and more future\-proof.
.sp
Valid colors include:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fBblack\fP, \fBred\fP, \fBgreen\fP, \fByellow\fP, \fBblue\fP, \fBmagenta\fP, \fBcyan\fP, \fBwhite\fP
.IP \(bu 2
\fBbrblack\fP, \fBbrred\fP, \fBbrgreen\fP, \fBbryellow\fP, \fBbrblue\fP, \fBbrmagenta\fP, \fBbrcyan\fP, \fBbrwhite\fP
.UNINDENT
.UNINDENT
.UNINDENT
.sp
The \fIbr\fP\- (as in \(aqbright\(aq) forms are full\-brightness variants of the 8 standard\-brightness colors on many terminals. \fBbrblack\fP has higher brightness than \fBblack\fP \- towards gray.
.sp
An RGB value with three or six hex digits, such as A0FF33 or f2f can be used.
A three digit value is equivalent to specifying each digit twice; e.g., \fBset_color 2BC\fP is the same as \fBset_color 22BBCC\fP\&.
Hexadecimal RGB values can be in lower or uppercase.
.sp
If \fBfish_term24bit\fP \%<#\:envvar-fish_term24bit> is set to 0, fish will translate RGB values to the nearest color on the 256\-color palette.
If \fBfish_term256\fP \%<#\:envvar-fish_term256> is also set to 0, fish will translate them to the 16\-color palette instead.
Fish launched as \fBfish \-d term_support\fP will include diagnostic messages that indicate the color support mode in use.
.sp
If multiple colors are specified, fish prefers the first RGB one.
However if \fBfish_term256\fP \%<#\:envvar-fish_term256> is set to 0, fish prefers the first named color specified.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-f\fP or \fB\-\-foreground\fP \fICOLOR\fP
Sets the foreground color.
This is equivalent to calling \fBset_color COLOR\fP with the exception that the keyword \fBnormal\fP will only reset the foreground color to its default, instead of all colors and modes.
It cannot be used with \fIVALUE\fP or \fB\-\-print\-colors\fP\&.
.TP
\fB\-b\fP or \fB\-\-background\fP \fICOLOR\fP
Sets the background color.
.TP
\fB\-\-underline\-color\fP \fICOLOR\fP
Set the underline color.
.TP
\fB\-c\fP or \fB\-\-print\-colors\fP
Prints the given colors or a colored list of the 16 named colors.
It cannot be used with \fB\-\-foreground\fP\&.
.TP
\fB\-o\fP or \fB\-\-bold\fP
Sets bold mode.
.TP
\fB\-d\fP or \fB\-\-dim\fP
Sets dim mode.
.TP
\fB\-i\fP or \fB\-\-italics\fP, or \fB\-iSTATE\fP or \fB\-\-italics=STATE\fP
Sets italics mode. The state can be \fBon\fP (default), or \fBoff\fP\&.
.TP
\fB\-r\fP or \fB\-\-reverse\fP, or \fB\-iSTATE\fP or \fB\-\-reverse=STATE\fP
Sets reverse mode. The state can be \fBon\fP (default), or \fBoff\fP\&.
.TP
\fB\-s\fP or \fB\-\-strikethrough\fP, or \fB\-sSTATE\fP or \fB\-\-strikethrough=STATE\fP
Sets strikethrough mode. The state can be \fBon\fP (default), or \fBoff\fP\&.
.TP
\fB\-u\fP or \fB\-\-underline\fP, or \fB\-uSTYLE\fP or \fB\-\-underline=STYLE\fP
Set the underline mode; supported styles are \fBsingle\fP (default), \fBdouble\fP, \fBcurly\fP, \fBdotted\fP, \fBdashed\fP and \fBoff\fP\&.
.TP
\fB\-\-reset\fP
Reset the text formatting to the terminal defaults before applying the new colors and modes.
This is equivalent to calling \fBset_color normal\fP except that it is possible to set the foreground color in the same call (e.g. \fBset_color \-\-reset green\fP)
.TP
\fB\-\-theme=THEME\fP
Ignored.
Color variables \%<#\:variables-color> that contain only this option are treated like missing / empty color variables,
i.e. fish will use the fallback color instead.
fish_config theme choose \%<> erases all color variable \%<#\:fish-config-color-variables>
whose value includes this option, and adds this option to all color variables it sets.
This allows identifying variables set by a theme,
and it allows fish to update color variables whenever \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme> changes.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.SS Notes
.INDENT 0.0
.IP 1. 3
Using \fBset_color normal\fP will reset all colors and modes to the terminal\(aqs default.
.IP 2. 3
In contrast, \fBset_color \-\-foreground normal\fP will only reset the foreground color and leave all the other colors and modes unchanged.
.IP 3. 3
Because of the risk of confusion, \fBset_color \-\-reset\fP is recommended over \fBset_color normal\fP\&.
.IP 4. 3
Setting the background color only affects subsequently written characters. Fish provides no way to set the background color for the entire terminal window. Configuring the window background color (and other attributes such as its opacity) has to be done using whatever mechanisms the terminal provides. Look for a config option.
.IP 5. 3
Some terminals use the \fB\-\-bold\fP escape sequence to switch to a brighter color set rather than increasing the weight of text.
.IP 6. 3
\fBset_color\fP works by printing sequences of characters to standard output. If used in command substitution or a pipe, these characters will also be captured. This may or may not be desirable. Checking the exit status of \fBisatty stdout\fP before using \fBset_color\fP can be useful to decide not to colorize output in a script.
.UNINDENT
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set_color red; echo \(dqRoses are red\(dq
set_color blue; echo \(dqViolets are blue\(dq
set_color 62A; echo \(dqEggplants are dark purple\(dq
set_color normal; echo \(dqNormal is nice\(dq # Resets the background too
.EE
.UNINDENT
.UNINDENT
.SS source \- evaluate contents of file
.SS Synopsis
.nf
\fBsource\fP \fIFILE\fP [\fIARGUMENTS\fP \&...]
\fISOMECOMMAND\fP | \fBsource\fP
\fB\&. \fP\fIFILE\fP [\fIARGUMENTS\fP \&...]
.fi
.sp
.SS Description
.sp
\fBsource\fP evaluates the commands of the specified \fIFILE\fP in the current shell as a new block of code. This is different from starting a new process to perform the commands (i.e. \fBfish < FILE\fP) since the commands will be evaluated by the current shell, which means that changes in shell variables will affect the current shell. If additional arguments are specified after the file name, they will be inserted into the \fBargv\fP \%<#\:envvar-argv> variable. The \fBargv\fP \%<#\:envvar-argv> variable will not include the name of the sourced file.
.sp
fish will search the working directory to resolve relative paths but will not search \fBPATH\fP \%<#\:envvar-PATH> .
.sp
If no file is specified and a file or pipeline is connected to standard input, or if the file name \fB\-\fP is used, \fBsource\fP will read from standard input. If no file is specified and there is no redirected file or pipeline on standard input, an error will be printed.
.sp
The exit status of \fBsource\fP is the exit status of the last job to execute. If something goes wrong while opening or reading the file, \fBsource\fP exits with a non\-zero status.
.sp
Some other shells only support the \fB\&.\fP alias (a single period).
The use of \fB\&.\fP is deprecated in favour of \fBsource\fP, and \fB\&.\fP will be removed in a future version of fish.
.sp
\fBsource\fP creates a new local scope \%<#\:variables-scope>; \fBset \-\-local\fP within a sourced block will not affect variables in the enclosing scope.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
source ~/.config/fish/config.fish
# Causes fish to re\-read its initialization file.
.EE
.UNINDENT
.UNINDENT
.SS status \- query fish runtime information
.SS Synopsis
.nf
\fBstatus\fP
\fBstatus\fP \fBis\-login\fP
\fBstatus\fP \fBis\-interactive\fP
\fBstatus\fP \fBis\-interactive\-read\fP
\fBstatus\fP \fBis\-block\fP
\fBstatus\fP \fBis\-breakpoint\fP
\fBstatus\fP \fBis\-command\-substitution\fP
\fBstatus\fP \fBis\-no\-job\-control\fP
\fBstatus\fP \fBis\-full\-job\-control\fP
\fBstatus\fP \fBis\-interactive\-job\-control\fP
\fBstatus\fP \fBcurrent\-command\fP
\fBstatus\fP \fBcurrent\-commandline\fP
\fBstatus\fP \fBfilename\fP
\fBstatus\fP \fBbasename\fP
\fBstatus\fP \fBdirname\fP
\fBstatus\fP \fBfish\-path\fP
\fBstatus\fP \fBfunction\fP
\fBstatus\fP \fBline\-number\fP
\fBstatus\fP \fBstack\-trace\fP
\fBstatus\fP \fBjob\-control\fP \fICONTROL_TYPE\fP
\fBstatus\fP \fBfeatures\fP
\fBstatus\fP \fBtest\-feature\fP \fIFEATURE\fP
\fBstatus\fP \fBbuild\-info\fP
\fBstatus\fP \fBget\-file\fP \fIFILE\fP
\fBstatus\fP \fBlist\-files\fP [\fIPATH\fP \&...]
\fBstatus\fP \fBterminal\fP
\fBstatus\fP \fBtest\-terminal\-feature\fP \fIFEATURE\fP
\fBstatus\fP \fBlanguage\fP [\fBlist\-available\fP|\fBset\fP [\fILANGUAGE\fP \&...]|\fBunset\fP]
.fi
.sp
.SS Description
.sp
With no arguments, \fBstatus\fP displays a summary of the current login and job control status of the shell.
.sp
The following operations (subcommands) are available:
.INDENT 0.0
.TP
\fBis\-command\-substitution\fP, \fB\-c\fP or \fB\-\-is\-command\-substitution\fP
Returns 0 if fish is currently executing a command substitution.
.TP
\fBis\-block\fP, \fB\-b\fP or \fB\-\-is\-block\fP
Returns 0 if fish is currently executing a block of code.
.TP
\fBis\-breakpoint\fP
Returns 0 if fish is currently showing a prompt in the context of a breakpoint \%<> command. See also the fish_breakpoint_prompt \%<> function.
.TP
\fBis\-interactive\fP, \fB\-i\fP or \fB\-\-is\-interactive\fP
Returns 0 if fish is interactive \- that is, connected to a keyboard.
.TP
\fBis\-interactive\-read\fP or \fB\-\-is\-interactive\-read\fP
Returns 0 if fish is running an interactive read \%<> builtin which is connected to a keyboard.
.TP
\fBis\-login\fP, \fB\-l\fP or \fB\-\-is\-login\fP
Returns 0 if fish is a login shell \- that is, if fish should perform login tasks such as setting up \fBPATH\fP \%<#\:envvar-PATH>\&.
.TP
\fBis\-full\-job\-control\fP or \fB\-\-is\-full\-job\-control\fP
Returns 0 if full job control is enabled.
.TP
\fBis\-interactive\-job\-control\fP or \fB\-\-is\-interactive\-job\-control\fP
Returns 0 if interactive job control is enabled.
.TP
\fBis\-no\-job\-control\fP or \fB\-\-is\-no\-job\-control\fP
Returns 0 if no job control is enabled.
.TP
\fBcurrent\-command\fP
Prints the name of the currently\-running function or command, like the deprecated \fB_\fP \%<#\:envvar-_> variable.
.TP
\fBcurrent\-commandline\fP
Prints the entirety of the currently\-running commandline, inclusive of all jobs and operators.
.TP
\fBfilename\fP, \fBcurrent\-filename\fP, \fB\-f\fP or \fB\-\-current\-filename\fP
Prints the filename of the currently\-running script. If the current script was called via a symlink, this will return the symlink. If the current script was received by piping into source \%<>, then this will return \fB\-\fP\&.
.TP
\fBbasename\fP
Prints just the filename of the running script, without any path components before.
.TP
\fBdirname\fP
Prints just the path to the running script, without the actual filename itself. This can be relative to \fBPWD\fP \%<#\:envvar-PWD> (including just \(dq.\(dq), depending on how the script was called. This is the same as passing the filename to \fBdirname(3)\fP\&. It\(aqs useful if you want to use other files in the current script\(aqs directory or similar.
.TP
\fBfish\-path\fP
Prints the absolute path to the currently executing instance of fish. This is a best\-effort attempt and the exact output is down to what the platform gives fish. In some cases you might only get \(dqfish\(dq.
.TP
\fBfunction\fP or \fBcurrent\-function\fP
Prints the name of the currently called function if able, when missing displays \(dqNot a function\(dq (or equivalent translated string).
.TP
\fBline\-number\fP, \fBcurrent\-line\-number\fP, \fB\-n\fP or \fB\-\-current\-line\-number\fP
Prints the line number of the currently running script.
.TP
\fBstack\-trace\fP, \fBprint\-stack\-trace\fP, \fB\-t\fP or \fB\-\-print\-stack\-trace\fP
Prints a stack trace of all function calls on the call stack.
.TP
\fBjob\-control\fP, \fB\-j\fP or \fB\-\-job\-control\fP \fICONTROL_TYPE\fP
Sets the job control type to \fICONTROL_TYPE\fP, which can be \fBnone\fP, \fBfull\fP, or \fBinteractive\fP\&.
.TP
\fBfeatures\fP
Lists all available feature flags \%<#\:featureflags>\&.
.TP
\fBtest\-feature\fP \fIFEATURE\fP
Returns 0 when FEATURE is enabled, 1 if it is disabled, and 2 if it is not recognized.
.TP
\fBbuild\-info\fP
This prints information on how fish was build \- which architecture, which build system or profile was used, etc.
This is mainly useful for debugging.
.UNINDENT
.INDENT 0.0
.TP
\fBget\-file\fP \fIFILE\fP
NOTE: this subcommand is mainly intended for fish\(aqs internal use; let us know if you want to use it elsewhere.
.sp
This prints a file embedded in the fish binary at compile time. This includes the default set of functions and completions,
as well as the man pages and themes. Which files are included depends on build settings.
Returns 0 if the file was included, 1 otherwise.
.TP
\fBlist\-files\fP \fIFILE...\fP
NOTE: this subcommand is mainly intended for fish\(aqs internal use; let us know if you want to use it elsewhere.
.sp
This lists the files embedded in the fish binary at compile time. Only files where the path starts with the optional \fIFILE\fP argument are shown.
Returns 0 if something was printed, 1 otherwise.
.UNINDENT
.INDENT 0.0
.TP
\fBterminal\fP
Prints the name and version of the terminal fish is running inside (for example as reported via XTVERSION \%<#\:term-compat-xtversion>).
This is not available during early startup but only starting from when the first interactive prompt is shown, possibly via builtin read \%<>,
so before the first \fBfish_prompt\fP or \fBfish_read\fP event \%<#\:event>\&.
.UNINDENT
.INDENT 0.0
.TP
\fBterminal\-os\fP
Prints the name of the operating system (OS) the terminal is running on, as reported via XTGETTCAP query\-os\-name \%<#\:term-compat-xtgettcap>\&.
Like status terminal, this only works once the first interactive prompt is shown.
Returns 1 if the OS name is not available.
.UNINDENT
.INDENT 0.0
.TP
\fBtest\-terminal\-feature\fP \fIFEATURE\fP
Returns 0 when the terminal was detected \%<#\:term-compat-xtgettcap> to support the given feature.
Like status terminal, this only works once the first interactive prompt is shown.
.sp
Currently the only available \fIFEATURE\fP is scroll\-content\-up \%<#\:term-compat-indn>\&.
An error will be printed when passed an unrecognized feature.
.UNINDENT
.INDENT 0.0
.TP
\fBlanguage\fP
Show or modify message localization settings.
When invoked without arguments, the current language settings are shown.
.sp
Available subcommands:
.sp
\fBlist\-available\fP
prints the language names for which fish has translations.
These names can be used with the \fBset\fP subcommand.
.sp
\fBset\fP
sets the language precedence for fish\(aqs messages.
Overrides language settings configured via environment variables \%<#\:variables-locale>, but only applies to fish itself, not to any child processes.
Takes a list of language names from the set shown by the \fBlist\-available\fP subcommand.
For some languages, fish\(aqs translation catalogs are incomplete, meaning not all messages can be shown in these languages.
Therefore, we allow specifying a list here, with translations taken from the first specified language which has a translation available for a message.
For example, after running \fBstatus language set pt_BR fr\fP, all messages which have a translation into Brazilian Portuguese will be shown in that language.
The remaining messages will be shown in French, if a French translation is available.
If none of the specified languages have a translation available for a message, the message will be shown in English.
.sp
\fBunset\fP
undoes the effects of the \fBset\fP subcommand.
Language settings will be taken from environment variables again.
.UNINDENT
.SS Notes
.sp
For backwards compatibility most subcommands can also be specified as a long or short option. For example, rather than \fBstatus is\-login\fP you can type \fBstatus \-\-is\-login\fP\&. The flag forms are deprecated and may be removed in a future release.
.sp
You can only specify one subcommand per invocation even if you use the flag form of the subcommand.
.SS string \- manipulate strings
.SS Synopsis
.nf
\fBstring\fP \fBcollect\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP] [\fB\-N\fP | \fB\-\-no\-trim\-newlines\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBescape\fP [\fB\-n\fP | \fB\-\-no\-quoted\fP] [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBjoin\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBlength\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBlower\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBmatch\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-e\fP | \fB\-\-entire\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
             [\fB\-g\fP | \fB\-\-groups\-only\fP] [\fB\-r\fP | \fB\-\-regex\fP] [\fB\-n\fP | \fB\-\-index\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-v\fP | \fB\-\-invert\fP]
             \fIPATTERN\fP [\fISTRING\fP \&...]
\fBstring\fP \fBpad\fP [\fB\-r\fP | \fB\-\-right\fP] [\fB\-C\fP | \fB\-\-center\fP] [(\fB\-c\fP | \fB\-\-char\fP) \fICHAR\fP] [(\fB\-w\fP | \fB\-\-width\fP) \fIINTEGER\fP]
           [\fISTRING\fP \&...]
\fBstring\fP \fBrepeat\fP [(\fB\-n\fP | \fB\-\-count\fP) \fICOUNT\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-N\fP | \fB\-\-no\-newline\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBrepeat\fP [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-q\fP | \fB\-\-quiet\fP] \fICOUNT\fP [\fISTRING\fP \&...]
\fBstring\fP \fBreplace\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-f\fP | \fB\-\-filter\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
               [\fB\-r\fP | \fB\-\-regex\fP] [\fB\-q\fP | \fB\-\-quiet\fP] \fIPATTERN\fP \fIREPLACE\fP [\fISTRING\fP \&...]
\fBstring\fP \fBshorten\fP [(\fB\-c\fP | \fB\-\-char\fP) \fICHARS\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIINTEGER\fP]
               [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-l\fP | \fB\-\-left\fP] [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBsplit\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBsplit0\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBsub\fP [(\fB\-s\fP | \fB\-\-start\fP) \fISTART\fP] [(\fB\-e\fP | \fB\-\-end\fP) \fIEND\fP] [(\fB\-l\fP | \fB\-\-length\fP) \fILENGTH\fP]
           [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBtrim\fP [\fB\-l\fP | \fB\-\-left\fP] [\fB\-r\fP | \fB\-\-right\fP] [(\fB\-c\fP | \fB\-\-chars\fP) \fICHARS\fP]
            [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBunescape\fP [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBupper\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring\fP performs operations on strings.
.sp
\fISTRING\fP arguments are taken from the command line unless standard input is connected to a pipe or a file, in which case they are read from standard input, one \fISTRING\fP per line. It is an error to supply \fISTRING\fP arguments on the command line and on standard input.
.sp
Arguments beginning with \fB\-\fP are normally interpreted as switches; \fB\-\-\fP causes the following arguments not to be treated as switches even if they begin with \fB\-\fP\&. Switches and required arguments are recognized only on the command line.
.sp
Most subcommands accept a \fB\-q\fP or \fB\-\-quiet\fP switch, which suppresses the usual output but exits with the documented status. In this case these commands will quit early, without reading all of the available input.
.sp
The following subcommands are available.
.SS \(dqcollect\(dq subcommand
.nf
\fBstring\fP \fBcollect\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP] [\fB\-N\fP | \fB\-\-no\-trim\-newlines\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring collect\fP collects its input into a single output argument, without splitting the output when used in a command substitution. This is useful when trying to collect multiline output from another command into a variable. Exit status: 0 if any output argument is non\-empty, or 1 otherwise.
.sp
A command like \fBecho (cmd | string collect)\fP is mostly equivalent to a quoted command substitution (\fBecho \(dq$(cmd)\(dq\fP). The main difference is that the former evaluates to zero or one elements whereas the quoted command substitution always evaluates to one element due to string interpolation.
.sp
If invoked with multiple arguments instead of input, \fBstring collect\fP preserves each argument separately, where the number of output arguments is equal to the number of arguments given to \fBstring collect\fP\&.
.sp
Any trailing newlines on the input are trimmed, just as with \fB\(dq$(cmd)\(dq\fP substitution. Use \fB\-\-no\-trim\-newlines\fP to disable this behavior, which may be useful when running a command such as \fBset contents (cat filename | string collect \-N)\fP\&.
.sp
With \fB\-\-allow\-empty\fP, \fBstring collect\fP always prints one (empty) argument. This can be used to prevent an argument from disappearing.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo \(dqzero $(echo one\entwo\enthree) four\(dq
zero one
two
three four

>_ echo \e\(dq(echo one\entwo\enthree | string collect)\e\(dq
\(dqone
two
three\(dq

>_ echo \e\(dq(echo one\entwo\enthree | string collect \-N)\e\(dq
\(dqone
two
three
\(dq

>_ echo foo(true | string collect \-\-allow\-empty)bar
foobar
.EE
.UNINDENT
.UNINDENT
.SS \(dqescape\(dq and \(dqunescape\(dq subcommands
.nf
\fBstring\fP \fBescape\fP [\fB\-n\fP | \fB\-\-no\-quoted\fP] [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBunescape\fP [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring escape\fP escapes each \fISTRING\fP in one of several ways.
.sp
\fB\-\-style=script\fP (default) alters the string such that it can be passed back to \fBeval\fP to produce the original argument again. By default, all special characters are escaped, and quotes are used to simplify the output when possible. If \fB\-n\fP or \fB\-\-no\-quoted\fP is given, the simplifying quoted format is not used. Exit status: 0 if at least one string was escaped, or 1 otherwise.
.sp
\fB\-\-style=var\fP ensures the string can be used as a variable name by hex encoding any non\-alphanumeric characters. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=url\fP ensures the string can be used as a URL by hex encoding any character which is not legal in a URL. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=regex\fP escapes an input string for literal matching within a regex expression. The string is first converted to UTF\-8 before being encoded.
.sp
\fBstring unescape\fP performs the inverse of the \fBstring escape\fP command. If the string to be unescaped is not properly formatted it is ignored. For example, doing \fBstring unescape \-\-style=var (string escape \-\-style=var $str)\fP will return the original string. There is no support for unescaping \fB\-\-style=regex\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo \ex07 | string escape
\ecg

>_ string escape \-\-style=var \(aqa1 b2\(aq\eu6161
a1_20_b2_E6_85_A1_
.EE
.UNINDENT
.UNINDENT
.SS \(dqjoin\(dq and \(dqjoin0\(dq subcommands
.nf
\fBstring\fP \fBjoin\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
Joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP (for \fBstring join\fP) or by the
zero byte (NUL) (for \fBstring join0\fP).
Exit status: 0 if at least one join was performed, or 1 otherwise.
.INDENT 0.0
.TP
\fB\-n\fP, \fB\-\-no\-empty\fP
Exclude empty strings from consideration (e.g. \fBstring join \-n + a b \(dq\(dq c\fP would expand to \fBa+b+c\fP not \fBa+b++c\fP).
.TP
\fB\-q\fP, \fB\-\-quiet\fP
Do not print the strings, only set the exit status as described above.
.UNINDENT
.sp
\fBWARNING\fP:
Insert a  \fB\-\-\fP before positional arguments to prevent them from being interpreted as flags.
Otherwise, any strings starting with \fB\-\fP will be treated as flag arguments, meaning they will most likely result in the command failing.
This is also true if you specify a variable which expands to such a string instead of a literal string.
If you don\(aqt need to append flag arguments at the end of the command,
just always use \fB\-\-\fP to avoid unwelcome surprises.
.sp
\fBstring join0\fP adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&.
.sp
Because Unix uses NUL as the string terminator, passing the output of \fBstring join0\fP as an \fIargument\fP to a command (via a command substitution \%<#\:expand-command-substitution>) won\(aqt actually work.
Fish will pass the correct bytes along, but the command won\(aqt be able to tell where the argument ends.
This is a limitation of Unix\(aq argument passing.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ seq 3 | string join ...
1...2...3

# Give a list of NUL\-separated filenames to du (this is a GNU extension)
>_ string join0 file1 file2 file\enwith\enmultiple\enlines | du \-\-files0\-from=\-

# Just put the strings together without a separator
>_ string join \(aq\(aq a b c
abc

>_ set \-l markdown_list \(aq\- first\(aq \(aq\- second\(aq \(aq\- third\(aq
# Strings with leading hyphens (also in variable expansions) are interpreted as flag arguments by default.
>_ string join \en $markdown_list
string join: \- first: unknown option
# Use \(aq\-\-\(aq to prevent this.
>_ string join \-\- \en $markdown_list
\- first
\- second
\- third
.EE
.UNINDENT
.UNINDENT
.SS \(dqlength\(dq subcommand
.nf
\fBstring\fP \fBlength\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-V\fP | \fB\-\-visible\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring length\fP reports the length of each string argument in characters. Exit status: 0 if at least one non\-empty \fISTRING\fP was given, or 1 otherwise.
.sp
With \fB\-V\fP or \fB\-\-visible\fP, it uses the visible width of the arguments. That means it will discount escape sequences fish knows about, account for $fish_emoji_width and $fish_ambiguous_width. It will also count each line (separated by \fB\en\fP) on its own, and with a carriage return (\fB\er\fP) count only the widest stretch on a line. The intent is to measure the number of columns the \fISTRING\fP would occupy in the current terminal.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string length \(aqhello, world\(aq
12

>_ set str foo
>_ string length \-q $str; echo $status
0
# Equivalent to test \-n \(dq$str\(dq

>_ string length \-\-visible (set_color red)foobar
# the set_color is discounted, so this is the width of \(dqfoobar\(dq
6

>_ string length \-\-visible 🐟🐟🐟🐟
# depending on $fish_emoji_width, this is either 4 or 8
# in new terminals it should be
8

>_ string length \-\-visible abcdef\er123
# this displays as \(dq123def\(dq, so the width is 6
6

>_ string length \-\-visible a\enbc
# counts \(dqa\(dq and \(dqbc\(dq as separate lines, so it prints width for each
1
2
.EE
.UNINDENT
.UNINDENT
.SS \(dqlower\(dq subcommand
.nf
\fBstring\fP \fBlower\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring lower\fP converts each string argument to lowercase. Exit status: 0 if at least one string was converted to lowercase, else 1. This means that in conjunction with the \fB\-q\fP flag you can readily test whether a string is already lowercase.
.SS \(dqmatch\(dq subcommand
.nf
\fBstring\fP \fBmatch\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-e\fP | \fB\-\-entire\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
             [\fB\-g\fP | \fB\-\-groups\-only\fP] [\fB\-r\fP | \fB\-\-regex\fP] [\fB\-n\fP | \fB\-\-index\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-v\fP | \fB\-\-invert\fP] [(\fB\-m\fP | \fB\-\-max\-matches\fP) \fIMAX\fP]
             \fIPATTERN\fP [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring match\fP tests each \fISTRING\fP against \fIPATTERN\fP and prints matching substrings. Only the first match for each \fISTRING\fP is reported unless \fB\-a\fP or \fB\-\-all\fP is given, in which case all matches are reported.
.sp
If you specify the \fB\-e\fP or \fB\-\-entire\fP then each matching string is printed including any prefix or suffix not matched by the pattern (equivalent to \fBgrep\fP without the \fB\-o\fP flag). You can, obviously, achieve the same result by prepending and appending \fB*\fP or \fB\&.*\fP depending on whether or not you have specified the \fB\-\-regex\fP flag. The \fB\-\-entire\fP flag is a way to avoid having to complicate the pattern in that fashion and make the intent of the \fBstring match\fP clearer. Without \fB\-\-entire\fP and \fB\-\-regex\fP, a \fIPATTERN\fP will need to match the entire \fISTRING\fP before it will be reported.
.sp
Matching can be made case\-insensitive with \fB\-\-ignore\-case\fP or \fB\-i\fP\&.
.sp
If \fB\-\-groups\-only\fP or \fB\-g\fP is given, only the capturing groups will be reported \- meaning the full match will be skipped. This is incompatible with \fB\-\-entire\fP and \fB\-\-invert\fP, and requires \fB\-\-regex\fP\&. It is useful as a simple cutting tool instead of \fBstring replace\fP, so you can choose \(dqthis part\(dq of a string.
.sp
If \fB\-\-index\fP or \fB\-n\fP is given, each match is reported as a 1\-based start position and a length. By default, PATTERN is interpreted as a glob pattern matched against each entire \fISTRING\fP argument. A glob pattern is only considered a valid match if it matches the entire \fISTRING\fP\&.
.sp
If \fB\-\-regex\fP or \fB\-r\fP is given, \fIPATTERN\fP is interpreted as a Perl\-compatible regular expression, which does not have to match the entire \fISTRING\fP\&. For a regular expression containing capturing groups, multiple items will be reported for each match, one for the entire match and one for each capturing group. With this, only the matching part of the \fISTRING\fP will be reported, unless \fB\-\-entire\fP is given.
.sp
When matching via regular expressions, \fBstring match\fP automatically sets variables for all named capturing groups (\fB(?<name>expression)\fP). It will create a variable with the name of the group, in the default scope, for each named capturing group, and set it to the value of the capturing group in the first matched argument. If a named capture group matched an empty string, the variable will be set to the empty string (like \fBset var \(dq\(dq\fP). If it did not match, the variable will be set to nothing (like \fBset var\fP).  When \fB\-\-regex\fP is used with \fB\-\-all\fP, this behavior changes. Each named variable will contain a list of matches, with the first match contained in the first element, the second match in the second, and so on. If the group was empty or did not match, the corresponding element will be an empty string.
.sp
If \fB\-\-invert\fP or \fB\-v\fP is used the selected lines will be only those which do not match the given glob pattern or regular expression.
.sp
If \fB\-\-max\-matches MAX\fP or \fB\-m MAX\fP is used, \fBstring\fP will stop checking for matches after MAX lines of input have matched. This can be used as an \(dqearly exit\(dq optimization when processing long inputs but expecting a limited and fixed number of outputs that might be found considerably before the input stream has been exhausted. If combined with \fB\-\-invert\fP or \fB\-v\fP, considers only inverted matches.
.sp
Exit status: 0 if at least one match was found, or 1 otherwise.
.SS Match Glob Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string match \(aqa\(aq a
a

>_ string match \(aqa*b\(aq axxb
axxb

>_ string match \-i \(aqa*B\(aq Axxb
Axxb

>_ string match \-\- \(aq\-*\(aq \-h foo \-\-version bar
# To match things that look like options, we need a \(ga\-\-\(ga
# to tell string its options end there.
\-h
\-\-version

>_ echo \(aqok?\(aq | string match \(aq*?\(aq
ok?

# Note that only the second STRING will match here.
>_ string match \(aqfoo\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo

>_ string match \-e \(aqfoo\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo1
foo
foo2

>_ string match \(aqfoo*\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo1
foo2
.EE
.UNINDENT
.UNINDENT
.SS Match Regex Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string match \-r \(aqcat|dog|fish\(aq \(aqnice dog\(aq
dog

>_ string match \-r \-v \(dqc.*[12]\(dq {cat,dog}(seq 1 4)
dog1
dog2
cat3
dog3
cat4
dog4

>_ string match \-r \-\- \(aq\-.*\(aq \-h foo \-\-version bar
# To match things that look like options, we need a \(ga\-\-\(ga
# to tell string its options end there.
\-h
\-\-version

>_ string match \-r \(aq(\ed\ed?):(\ed\ed):(\ed\ed)\(aq 2:34:56
2:34:56
2
34
56

>_ string match \-r \(aq^(\ew{2,4})\e1$\(aq papa mud murmur
papa
pa
murmur
mur

>_ string match \-r \-a \-n at ratatat
2 2
4 2
6 2

>_ string match \-r \-i \(aq0x[0\-9a\-f]{1,8}\(aq \(aqint magic = 0xBadC0de;\(aq
0xBadC0de

>_ echo $version
3.1.2\-1575\-ga2ff32d90
>_ string match \-rq \(aq(?<major>\ed+).(?<minor>\ed+).(?<revision>\ed+)\(aq \-\- $version
>_ echo \(dqYou are using fish $major!\(dq
You are using fish 3!

>_ string match \-raq \(aq *(?<sentence>[^.!?]+)(?<punctuation>[.!?])?\(aq \(dqhello, friend. goodbye\(dq
>_ printf \(dq%s\en\(dq \-\- $sentence
hello, friend
goodbye
>_ printf \(dq%s\en\(dq \-\- $punctuation
\&.

>_ string match \-rq \(aq(?<word>hello)\(aq \(aqhi\(aq
>_ count $word
0
.EE
.UNINDENT
.UNINDENT
.SS \(dqpad\(dq subcommand
.nf
\fBstring\fP \fBpad\fP [\fB\-r\fP | \fB\-\-right\fP] [\fB\-C\fP | \fB\-\-center\fP] [(\fB\-c\fP | \fB\-\-char\fP) \fICHAR\fP] [(\fB\-w\fP | \fB\-\-width\fP) \fIINTEGER\fP]
           [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring pad\fP extends each \fISTRING\fP to the given visible width by adding \fICHAR\fP to the left. That means the width of all visible characters added together, excluding escape sequences and accounting for \fBfish_emoji_width\fP \%<#\:envvar-fish_emoji_width> and \fBfish_ambiguous_width\fP \%<#\:envvar-fish_ambiguous_width>\&. It is the amount of columns in a terminal the \fISTRING\fP occupies.
.sp
The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.
.sp
If \fB\-C\fP or \fB\-\-center\fP is given, add the padding to before and after the string. If it is impossible to perfectly center the result (because the required amount of padding is an odd number), extra padding will be added to the left, unless \fB\-\-right\fP is also given.
.sp
If \fB\-r\fP or \fB\-\-right\fP is given, add the padding after a string.
.sp
If \fB\-c\fP or \fB\-\-char\fP is given, pad with \fICHAR\fP instead of whitespace.
.sp
The output is padded to the maximum width of all input strings. If \fB\-w\fP or \fB\-\-width\fP is given, use at least that.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string pad \-w 10 abc abcdef
       abc
    abcdef

>_ string pad \-\-right \-\-char=🐟 \(dqfish are pretty\(dq \(dqrich. \(dq
fish are pretty
rich.  🐟🐟🐟🐟

>_ string pad \-w$COLUMNS (date)
# Prints the current time on the right edge of the screen.
.EE
.UNINDENT
.UNINDENT
.SS See also
.INDENT 0.0
.IP \(bu 2
The printf \%<> command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&.
.IP \(bu 2
string length \%<> with the \fB\-\-visible\fP option can be used to show what fish thinks the width is.
.UNINDENT
.SS \(dqshorten\(dq subcommand
.nf
\fBstring\fP \fBshorten\fP [(\fB\-c\fP | \fB\-\-char\fP) \fICHARS\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIINTEGER\fP]
               [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-l\fP | \fB\-\-left\fP] [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring shorten\fP truncates each \fISTRING\fP to the given visible width and adds an ellipsis to indicate it. \(dqVisible width\(dq means the width of all visible characters added together, excluding escape sequences and accounting for \fBfish_emoji_width\fP \%<#\:envvar-fish_emoji_width> and \fBfish_ambiguous_width\fP \%<#\:envvar-fish_ambiguous_width>\&. It is the amount of columns in a terminal the \fISTRING\fP occupies.
.sp
The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.
.sp
If \fB\-m\fP or \fB\-\-max\fP is given, truncate at the given width. Otherwise, the lowest non\-zero width of all input strings is used. A max of 0 means no shortening takes place, all STRINGs are printed as\-is.
.sp
If \fB\-N\fP or \fB\-\-no\-newline\fP is given, only the first line (or last line with \fB\-\-left\fP) of each STRING is used, and an ellipsis is added if it was multiline. This only works for STRINGs being given as arguments, multiple lines given on stdin will be interpreted as separate STRINGs instead.
.sp
If \fB\-c\fP or \fB\-\-char\fP is given, add \fICHAR\fP instead of an ellipsis. This can also be empty or more than one character.
.sp
If \fB\-l\fP or \fB\-\-left\fP is given, remove text from the left on instead, so this prints the longest \fIsuffix\fP of the string that fits. With \fB\-\-no\-newline\fP, this will take from the last line instead of the first.
.sp
If \fB\-q\fP or \fB\-\-quiet\fP is given, \fBstring shorten\fP only runs for the return value \- if anything would be shortened, it returns 0, else 1.
.sp
The default ellipsis is \fB…\fP\&. If fish thinks your system is incapable because of your locale, it will use \fB\&...\fP instead.
.sp
The return value is 0 if any shortening occurred, 1 otherwise.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string shorten foo foobar
# No width was given, we infer, and \(dqfoo\(dq is the shortest.
foo
fo…

>_ string shorten \-\-char=\(dq...\(dq foo foobar
# The target width is 3 because of \(dqfoo\(dq,
# and our ellipsis is 3 too, so we can\(aqt really show anything.
# This is the default ellipsis if your locale doesn\(aqt allow \(dq…\(dq.
foo
\&...

>_ string shorten \-\-char=\(dq\(dq \-\-max 4 abcdef 123456
# Leaving the char empty makes us not add an ellipsis
# So this truncates at 4 columns:
abcd
1234

>_ touch \(dqa multiline\(dq\en\(dqfile\(dq
>_ for file in *; string shorten \-N \-\- $file; end
# Shorten the multiline file so we only show one line per file:
a multiline…

>_ ss \-p | string shorten \-m$COLUMNS \-c \(dq\(dq
# \(gass\(ga from Linux\(aq iproute2 shows socket information, but prints extremely long lines.
# This shortens input so it fits on the screen without overflowing lines.

>_ git branch | string match \-rg \(aq^\e* (.*)\(aq | string shorten \-m20
# Take the current git branch and shorten it at 20 columns.
# Here the branch is \(dqbuiltin\-path\-with\-expand\(dq
builtin\-path\-with\-e…

>_ git branch | string match \-rg \(aq^\e* (.*)\(aq | string shorten \-m20 \-\-left
# Taking 20 columns from the right instead:
…in\-path\-with\-expand
.EE
.UNINDENT
.UNINDENT
.SS See also
.INDENT 0.0
.IP \(bu 2
string pad \%<> does the inverse of this command, adding padding to a specific width instead.
.IP \(bu 2
The printf \%<> command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&.
.IP \(bu 2
string length \%<> with the \fB\-\-visible\fP option can be used to show what fish thinks the width is.
.UNINDENT
.SS \(dqrepeat\(dq subcommand
.nf
\fBstring\fP \fBrepeat\fP [(\fB\-n\fP | \fB\-\-count\fP) \fICOUNT\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-N\fP | \fB\-\-no\-newline\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBrepeat\fP [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-q\fP | \fB\-\-quiet\fP] \fICOUNT\fP [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring repeat\fP repeats the \fISTRING\fP \fB\-n\fP or \fB\-\-count\fP times. The \fB\-m\fP or \fB\-\-max\fP option will limit the number of outputted characters (excluding the newline). This option can be used by itself or in conjunction with \fB\-\-count\fP\&. If both \fB\-\-count\fP and \fB\-\-max\fP are present, max char will be outputted unless the final repeated string size is less than max, in that case, the string will repeat until count has been reached. Both \fB\-\-count\fP and \fB\-\-max\fP will accept a number greater than or equal to zero, in the case of zero, nothing will be outputted. The first argument is interpreted as \fICOUNT\fP if \fB\-\-count\fP or \fB\-\-max\fP are not explicitly specified. If \fB\-N\fP or \fB\-\-no\-newline\fP is given, the output won\(aqt contain a newline character at the end. Exit status: 0 if yielded string is not empty, 1 otherwise.
.SS Examples
.SS Repeat Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string repeat \-n 2 \(aqfoo \(aq
foo foo

>_ echo foo | string repeat \-n 2
foofoo

>_ string repeat \-n 2 \-m 5 \(aqfoo\(aq
foofo

>_ string repeat \-m 5 \(aqfoo\(aq
foofo

>_ string repeat 2 \(aqfoo\(aq
foofoo

>_ string repeat 2 \-n 3
222
.EE
.UNINDENT
.UNINDENT
.SS \(dqreplace\(dq subcommand
.nf
\fBstring\fP \fBreplace\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-f\fP | \fB\-\-filter\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
               [\fB\-r\fP | \fB\-\-regex\fP] [(\fB\-m\fP | \fB\-\-max\-matches\fP) \fIMAX\fP] [\fB\-q\fP | \fB\-\-quiet\fP]
               \fIPATTERN\fP \fIREPLACEMENT\fP [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring replace\fP is similar to \fBstring match\fP but replaces non\-overlapping matching substrings with a replacement string and prints the result. By default, \fIPATTERN\fP is treated as a literal substring to be matched.
.sp
If \fB\-r\fP or \fB\-\-regex\fP is given, \fIPATTERN\fP is interpreted as a Perl\-compatible regular expression, and \fIREPLACEMENT\fP can contain C\-style escape sequences like \fBt\fP as well as references to capturing groups by number or name as \fI$n\fP or \fI${n}\fP\&.
.sp
If you specify the \fB\-f\fP or \fB\-\-filter\fP flag then each input string is printed only if a replacement was done. This is useful where you would otherwise use this idiom: \fBa_cmd | string match pattern | string replace pattern new_pattern\fP\&. You can instead just write \fBa_cmd | string replace \-\-filter pattern new_pattern\fP\&.
.sp
If \fB\-\-max\-matches MAX\fP or \fB\-m MAX\fP is used, \fBstring replace\fP will stop all processing after MAX lines of input have matched the specified pattern. In the event of \fB\-\-filter\fP or \fB\-f\fP, this means the output will be MAX lines in length. This can be used as an \(dqearly exit\(dq optimization when processing long inputs but expecting a limited and fixed number of outputs that might be found considerably before the input stream has been exhausted.
.sp
Exit status: 0 if at least one replacement was performed, or 1 otherwise.
.SS Replace Literal Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string replace is was \(aqblue is my favorite\(aq
blue was my favorite

>_ string replace 3rd last 1st 2nd 3rd
1st
2nd
last

>_ string replace \-a \(aq \(aq _ \(aqspaces to underscores\(aq
spaces_to_underscores
.EE
.UNINDENT
.UNINDENT
.SS Replace Regex Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string replace \-r \-a \(aq[^\ed.]+\(aq \(aq \(aq \(aq0 one two 3.14 four 5x\(aq
0 3.14 5

>_ string replace \-r \(aq(\ew+)\es+(\ew+)\(aq \(aq$2 $1 $$\(aq \(aqleft right\(aq
right left $

>_ string replace \-r \(aq\es*newline\es*\(aq \(aq\en\(aq \(aqput a newline here\(aq
put a
here
.EE
.UNINDENT
.UNINDENT
.SS \(dqsplit\(dq and \(dqsplit0\(dq subcommands
.nf
\fBstring\fP \fBsplit\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBsplit0\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring split\fP splits each \fISTRING\fP on the separator \fISEP\fP, which can be an empty string. If \fB\-m\fP or \fB\-\-max\fP is specified, at most MAX splits are done on each \fISTRING\fP\&. If \fB\-r\fP or \fB\-\-right\fP is given, splitting is performed right\-to\-left. This is only useful in combination with \fB\-m\fP or \fB\-\-max\fP\&. With \fB\-n\fP or \fB\-\-no\-empty\fP, empty results are excluded from consideration (e.g. \fBhello\en\enworld\fP would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
.sp
Use \fB\-f\fP or \fB\-\-fields\fP to print out specific fields. FIELDS is a comma\-separated string of field numbers and/or spans. Each field is one\-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless \fB\-\-allow\-empty\fP is used.
.sp
See also the \fB\-\-delimiter\fP option of the read \%<> command.
.sp
\fBstring split0\fP splits each \fISTRING\fP on the zero byte (NUL). Options are the same as \fBstring split\fP except that no separator is given.
.sp
\fBsplit0\fP has the important property that its output is not further split when used in a command substitution, allowing for the command substitution to produce elements containing newlines. This is most useful when used with Unix tools that produce zero bytes, such as \fBfind \-print0\fP or \fBsort \-z\fP\&. See split0 examples below.
.sp
Be aware that commandline arguments cannot include NULs, so you likely want to pass to \fBstring split0\fP via a pipe, not a command substitution.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string split . example.com
example
com

>_ string split \-r \-m1 / /usr/local/bin/fish
/usr/local/bin
fish

>_ string split \(aq\(aq abc
a
b
c

>_ string split \-\-allow\-empty \-f1,3\-4,5 \(aq\(aq abcd
a
c
d
.EE
.UNINDENT
.UNINDENT
.SS NUL Delimited Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ # Count files in a directory, without being confused by newlines.
>_ # Note: Don\(aqt use \(gastring split0 (find . \-print0)\(ga, because arguments cannot include NUL.
>_ count (find . \-print0 | string split0)
42

>_ # Sort a list of elements which may contain newlines
>_ set foo beta alpha\engamma
>_ set foo (string join0 $foo | sort \-z | string split0)
>_ string escape $foo[1]
alpha\engamma
.EE
.UNINDENT
.UNINDENT
.SS \(dqsub\(dq subcommand
.nf
\fBstring\fP \fBsub\fP [(\fB\-s\fP | \fB\-\-start\fP) \fISTART\fP] [(\fB\-e\fP | \fB\-\-end\fP) \fIEND\fP] [(\fB\-l\fP | \fB\-\-length\fP) \fILENGTH\fP]
           [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring sub\fP prints a substring of each string argument. The start/end of the substring can be specified with \fB\-s\fP/\fB\-e\fP or \fB\-\-start\fP/\fB\-\-end\fP followed by a 1\-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with \fB\-l\fP or \fB\-\-length\fP\&. If the length or end is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise. \fB\-\-length\fP is mutually exclusive with \fB\-\-end\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string sub \-\-length 2 abcde
ab

>_ string sub \-s 2 \-l 2 abcde
bc

>_ string sub \-\-start=\-2 abcde
de

>_ string sub \-\-end=3 abcde
abc

>_ string sub \-e \-1 abcde
abcd

>_ string sub \-s 2 \-e \-1 abcde
bcd

>_ string sub \-s \-3 \-e \-2 abcde
c
.EE
.UNINDENT
.UNINDENT
.SS \(dqtrim\(dq subcommand
.nf
\fBstring\fP \fBtrim\fP [\fB\-l\fP | \fB\-\-left\fP] [\fB\-r\fP | \fB\-\-right\fP] [(\fB\-c\fP | \fB\-\-chars\fP) \fICHARS\fP]
            [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring trim\fP removes leading and trailing whitespace from each \fISTRING\fP\&. If \fB\-l\fP or \fB\-\-left\fP is given, only leading whitespace is removed. If \fB\-r\fP or \fB\-\-right\fP is given, only trailing whitespace is trimmed.
.sp
The \fB\-c\fP or \fB\-\-chars\fP switch causes the set of characters in \fICHARS\fP to be removed instead of whitespace. This is a set of characters, not a string \- if you pass \fB\-c foo\fP, it will remove any \(dqf\(dq or \(dqo\(dq, not just \(dqfoo\(dq as a whole.
.sp
Exit status: 0 if at least one character was trimmed, or 1 otherwise.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string trim \(aq abc  \(aq
abc

>_ string trim \-\-right \-\-chars=yz xyzzy zany
x
zan
.EE
.UNINDENT
.UNINDENT
.SS \(dqupper\(dq subcommand
.nf
\fBstring\fP \fBupper\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.sp
\fBstring upper\fP converts each string argument to uppercase. Exit status: 0 if at least one string was converted to uppercase, else 1. This means that in conjunction with the \fB\-q\fP flag you can readily test whether a string is already uppercase.
.SS Regular Expressions
.sp
Both the \fBmatch\fP and \fBreplace\fP subcommand support regular expressions when used with the \fB\-r\fP or \fB\-\-regex\fP option. The dialect is that of PCRE2.
.sp
In general, special characters are special by default, so \fBa+\fP matches one or more \(dqa\(dqs, while \fBa\e+\fP matches an \(dqa\(dq and then a \(dq+\(dq. \fB(a+)\fP matches one or more \(dqa\(dqs in a capturing group (\fB(?:XXXX)\fP denotes a non\-capturing group). For the replacement parameter of \fBreplace\fP, \fB$n\fP refers to the n\-th group of the match. In the match parameter, \fB\en\fP (e.g. \fB\e1\fP) refers back to groups.
.sp
Some features include repetitions:
.INDENT 0.0
.IP \(bu 2
\fB*\fP refers to 0 or more repetitions of the previous expression
.IP \(bu 2
\fB+\fP 1 or more
.IP \(bu 2
\fB?\fP 0 or 1.
.IP \(bu 2
\fB{n}\fP to exactly n (where n is a number)
.IP \(bu 2
\fB{n,m}\fP at least n, no more than m.
.IP \(bu 2
\fB{n,}\fP n or more
.UNINDENT
.sp
Character classes, some of the more important:
.INDENT 0.0
.IP \(bu 2
\fB\&.\fP any character except newline
.IP \(bu 2
\fB\ed\fP a decimal digit and \fB\eD\fP, not a decimal digit
.IP \(bu 2
\fB\es\fP whitespace and \fB\eS\fP, not whitespace
.IP \(bu 2
\fB\ew\fP a \(dqword\(dq character and \fB\eW\fP, a \(dqnon\-word\(dq character
.IP \(bu 2
\fB[...]\fP (where \(dq...\(dq is some characters) is a character set
.IP \(bu 2
\fB[^...]\fP is the inverse of the given character set
.IP \(bu 2
\fB[x\-y]\fP is the range of characters from x\-y
.IP \(bu 2
\fB[[:xxx:]]\fP is a named character set
.IP \(bu 2
\fB[[:^xxx:]]\fP is the inverse of a named character set
.IP \(bu 2
\fB[[:alnum:]]\fP  : \(dqalphanumeric\(dq
.IP \(bu 2
\fB[[:alpha:]]\fP  : \(dqalphabetic\(dq
.IP \(bu 2
\fB[[:ascii:]]\fP  : \(dq0\-127\(dq
.IP \(bu 2
\fB[[:blank:]]\fP  : \(dqspace or tab\(dq
.IP \(bu 2
\fB[[:cntrl:]]\fP  : \(dqcontrol character\(dq
.IP \(bu 2
\fB[[:digit:]]\fP  : \(dqdecimal digit\(dq
.IP \(bu 2
\fB[[:graph:]]\fP  : \(dqprinting, excluding space\(dq
.IP \(bu 2
\fB[[:lower:]]\fP  : \(dqlower case letter\(dq
.IP \(bu 2
\fB[[:print:]]\fP  : \(dqprinting, including space\(dq
.IP \(bu 2
\fB[[:punct:]]\fP  : \(dqprinting, excluding alphanumeric\(dq
.IP \(bu 2
\fB[[:space:]]\fP  : \(dqwhite space\(dq
.IP \(bu 2
\fB[[:upper:]]\fP  : \(dqupper case letter\(dq
.IP \(bu 2
\fB[[:word:]]\fP   : \(dqsame as w\(dq
.IP \(bu 2
\fB[[:xdigit:]]\fP : \(dqhexadecimal digit\(dq
.UNINDENT
.sp
Groups:
.INDENT 0.0
.IP \(bu 2
\fB(...)\fP is a capturing group
.IP \(bu 2
\fB(?:...)\fP is a non\-capturing group
.IP \(bu 2
\fB\en\fP is a backreference (where n is the number of the group, starting with 1)
.IP \(bu 2
\fB$n\fP is a reference from the replacement expression to a group in the match expression.
.UNINDENT
.sp
And some other things:
.INDENT 0.0
.IP \(bu 2
\fB\eb\fP denotes a word boundary, \fB\eB\fP is not a word boundary.
.IP \(bu 2
\fB^\fP is the start of the string or line, \fB$\fP the end.
.IP \(bu 2
\fB|\fP is \(dqalternation\(dq, i.e. the \(dqor\(dq.
.UNINDENT
.SS Comparison to other tools
.sp
Most operations \fBstring\fP supports can also be done by external tools. Some of these include \fBgrep\fP, \fBsed\fP and \fBcut\fP\&.
.sp
If you are familiar with these, it is useful to know how \fBstring\fP differs from them.
.sp
In contrast to these classics, \fBstring\fP reads input either from stdin or as arguments. \fBstring\fP also does not deal with files, so it requires redirections to be used with them.
.sp
In contrast to \fBgrep\fP, \fBstring\fP\(aqs \fBmatch\fP defaults to glob\-mode, while \fBreplace\fP defaults to literal matching. If set to regex\-mode, they use PCRE regular expressions, which is comparable to \fBgrep\fP\(aqs \fB\-P\fP option. \fBmatch\fP defaults to printing just the match, which is like \fBgrep\fP with \fB\-o\fP (use \fB\-\-entire\fP to enable grep\-like behavior).
.sp
Like \fBsed\fP\(aqs \fBs/old/new/\fP command, \fBstring replace\fP still prints strings that don\(aqt match. \fBsed\fP\(aqs \fB\-n\fP in combination with a \fB/p\fP modifier or command is like \fBstring replace \-f\fP\&.
.sp
\fBstring split somedelimiter\fP is a replacement for \fBtr somedelimiter \en\fP\&.
.SS string\-collect \- join strings into one
.SS Synopsis
.nf
\fBstring\fP \fBcollect\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP] [\fB\-N\fP | \fB\-\-no\-trim\-newlines\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring collect\fP collects its input into a single output argument, without splitting the output when used in a command substitution. This is useful when trying to collect multiline output from another command into a variable. Exit status: 0 if any output argument is non\-empty, or 1 otherwise.
.sp
A command like \fBecho (cmd | string collect)\fP is mostly equivalent to a quoted command substitution (\fBecho \(dq$(cmd)\(dq\fP). The main difference is that the former evaluates to zero or one elements whereas the quoted command substitution always evaluates to one element due to string interpolation.
.sp
If invoked with multiple arguments instead of input, \fBstring collect\fP preserves each argument separately, where the number of output arguments is equal to the number of arguments given to \fBstring collect\fP\&.
.sp
Any trailing newlines on the input are trimmed, just as with \fB\(dq$(cmd)\(dq\fP substitution. Use \fB\-\-no\-trim\-newlines\fP to disable this behavior, which may be useful when running a command such as \fBset contents (cat filename | string collect \-N)\fP\&.
.sp
With \fB\-\-allow\-empty\fP, \fBstring collect\fP always prints one (empty) argument. This can be used to prevent an argument from disappearing.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo \(dqzero $(echo one\entwo\enthree) four\(dq
zero one
two
three four

>_ echo \e\(dq(echo one\entwo\enthree | string collect)\e\(dq
\(dqone
two
three\(dq

>_ echo \e\(dq(echo one\entwo\enthree | string collect \-N)\e\(dq
\(dqone
two
three
\(dq

>_ echo foo(true | string collect \-\-allow\-empty)bar
foobar
.EE
.UNINDENT
.UNINDENT
.SS string\-escape \- escape special characters
.SS Synopsis
.nf
\fBstring\fP \fBescape\fP [\fB\-n\fP | \fB\-\-no\-quoted\fP] [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBunescape\fP [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring escape\fP escapes each \fISTRING\fP in one of several ways.
.sp
\fB\-\-style=script\fP (default) alters the string such that it can be passed back to \fBeval\fP to produce the original argument again. By default, all special characters are escaped, and quotes are used to simplify the output when possible. If \fB\-n\fP or \fB\-\-no\-quoted\fP is given, the simplifying quoted format is not used. Exit status: 0 if at least one string was escaped, or 1 otherwise.
.sp
\fB\-\-style=var\fP ensures the string can be used as a variable name by hex encoding any non\-alphanumeric characters. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=url\fP ensures the string can be used as a URL by hex encoding any character which is not legal in a URL. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=regex\fP escapes an input string for literal matching within a regex expression. The string is first converted to UTF\-8 before being encoded.
.sp
\fBstring unescape\fP performs the inverse of the \fBstring escape\fP command. If the string to be unescaped is not properly formatted it is ignored. For example, doing \fBstring unescape \-\-style=var (string escape \-\-style=var $str)\fP will return the original string. There is no support for unescaping \fB\-\-style=regex\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo \ex07 | string escape
\ecg

>_ string escape \-\-style=var \(aqa1 b2\(aq\eu6161
a1_20_b2_E6_85_A1_
.EE
.UNINDENT
.UNINDENT
.SS string\-join \- join strings with delimiter
.SS Synopsis
.nf
\fBstring\fP \fBjoin\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
Joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP (for \fBstring join\fP) or by the
zero byte (NUL) (for \fBstring join0\fP).
Exit status: 0 if at least one join was performed, or 1 otherwise.
.INDENT 0.0
.TP
\fB\-n\fP, \fB\-\-no\-empty\fP
Exclude empty strings from consideration (e.g. \fBstring join \-n + a b \(dq\(dq c\fP would expand to \fBa+b+c\fP not \fBa+b++c\fP).
.TP
\fB\-q\fP, \fB\-\-quiet\fP
Do not print the strings, only set the exit status as described above.
.UNINDENT
.sp
\fBWARNING\fP:
Insert a  \fB\-\-\fP before positional arguments to prevent them from being interpreted as flags.
Otherwise, any strings starting with \fB\-\fP will be treated as flag arguments, meaning they will most likely result in the command failing.
This is also true if you specify a variable which expands to such a string instead of a literal string.
If you don\(aqt need to append flag arguments at the end of the command,
just always use \fB\-\-\fP to avoid unwelcome surprises.
.sp
\fBstring join0\fP adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&.
.sp
Because Unix uses NUL as the string terminator, passing the output of \fBstring join0\fP as an \fIargument\fP to a command (via a command substitution \%<#\:expand-command-substitution>) won\(aqt actually work.
Fish will pass the correct bytes along, but the command won\(aqt be able to tell where the argument ends.
This is a limitation of Unix\(aq argument passing.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ seq 3 | string join ...
1...2...3

# Give a list of NUL\-separated filenames to du (this is a GNU extension)
>_ string join0 file1 file2 file\enwith\enmultiple\enlines | du \-\-files0\-from=\-

# Just put the strings together without a separator
>_ string join \(aq\(aq a b c
abc

>_ set \-l markdown_list \(aq\- first\(aq \(aq\- second\(aq \(aq\- third\(aq
# Strings with leading hyphens (also in variable expansions) are interpreted as flag arguments by default.
>_ string join \en $markdown_list
string join: \- first: unknown option
# Use \(aq\-\-\(aq to prevent this.
>_ string join \-\- \en $markdown_list
\- first
\- second
\- third
.EE
.UNINDENT
.UNINDENT
.SS string\-join0 \- join strings with zero bytes
.SS Synopsis
.nf
\fBstring\fP \fBjoin\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP] [\fB\-\-\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
Joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP (for \fBstring join\fP) or by the
zero byte (NUL) (for \fBstring join0\fP).
Exit status: 0 if at least one join was performed, or 1 otherwise.
.INDENT 0.0
.TP
\fB\-n\fP, \fB\-\-no\-empty\fP
Exclude empty strings from consideration (e.g. \fBstring join \-n + a b \(dq\(dq c\fP would expand to \fBa+b+c\fP not \fBa+b++c\fP).
.TP
\fB\-q\fP, \fB\-\-quiet\fP
Do not print the strings, only set the exit status as described above.
.UNINDENT
.sp
\fBWARNING\fP:
Insert a  \fB\-\-\fP before positional arguments to prevent them from being interpreted as flags.
Otherwise, any strings starting with \fB\-\fP will be treated as flag arguments, meaning they will most likely result in the command failing.
This is also true if you specify a variable which expands to such a string instead of a literal string.
If you don\(aqt need to append flag arguments at the end of the command,
just always use \fB\-\-\fP to avoid unwelcome surprises.
.sp
\fBstring join0\fP adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&.
.sp
Because Unix uses NUL as the string terminator, passing the output of \fBstring join0\fP as an \fIargument\fP to a command (via a command substitution \%<#\:expand-command-substitution>) won\(aqt actually work.
Fish will pass the correct bytes along, but the command won\(aqt be able to tell where the argument ends.
This is a limitation of Unix\(aq argument passing.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ seq 3 | string join ...
1...2...3

# Give a list of NUL\-separated filenames to du (this is a GNU extension)
>_ string join0 file1 file2 file\enwith\enmultiple\enlines | du \-\-files0\-from=\-

# Just put the strings together without a separator
>_ string join \(aq\(aq a b c
abc

>_ set \-l markdown_list \(aq\- first\(aq \(aq\- second\(aq \(aq\- third\(aq
# Strings with leading hyphens (also in variable expansions) are interpreted as flag arguments by default.
>_ string join \en $markdown_list
string join: \- first: unknown option
# Use \(aq\-\-\(aq to prevent this.
>_ string join \-\- \en $markdown_list
\- first
\- second
\- third
.EE
.UNINDENT
.UNINDENT
.SS string\-length \- print string lengths
.SS Synopsis
.nf
\fBstring\fP \fBlength\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-V\fP | \fB\-\-visible\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring length\fP reports the length of each string argument in characters. Exit status: 0 if at least one non\-empty \fISTRING\fP was given, or 1 otherwise.
.sp
With \fB\-V\fP or \fB\-\-visible\fP, it uses the visible width of the arguments. That means it will discount escape sequences fish knows about, account for $fish_emoji_width and $fish_ambiguous_width. It will also count each line (separated by \fB\en\fP) on its own, and with a carriage return (\fB\er\fP) count only the widest stretch on a line. The intent is to measure the number of columns the \fISTRING\fP would occupy in the current terminal.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string length \(aqhello, world\(aq
12

>_ set str foo
>_ string length \-q $str; echo $status
0
# Equivalent to test \-n \(dq$str\(dq

>_ string length \-\-visible (set_color red)foobar
# the set_color is discounted, so this is the width of \(dqfoobar\(dq
6

>_ string length \-\-visible 🐟🐟🐟🐟
# depending on $fish_emoji_width, this is either 4 or 8
# in new terminals it should be
8

>_ string length \-\-visible abcdef\er123
# this displays as \(dq123def\(dq, so the width is 6
6

>_ string length \-\-visible a\enbc
# counts \(dqa\(dq and \(dqbc\(dq as separate lines, so it prints width for each
1
2
.EE
.UNINDENT
.UNINDENT
.SS string\-lower \- convert strings to lowercase
.SS Synopsis
.nf
\fBstring\fP \fBlower\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring lower\fP converts each string argument to lowercase. Exit status: 0 if at least one string was converted to lowercase, else 1. This means that in conjunction with the \fB\-q\fP flag you can readily test whether a string is already lowercase.
.SS string\-match \- match substrings
.SS Synopsis
.nf
\fBstring\fP \fBmatch\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-e\fP | \fB\-\-entire\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
             [\fB\-g\fP | \fB\-\-groups\-only\fP] [\fB\-r\fP | \fB\-\-regex\fP] [\fB\-n\fP | \fB\-\-index\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-v\fP | \fB\-\-invert\fP] [(\fB\-m\fP | \fB\-\-max\-matches\fP) \fIMAX\fP]
             \fIPATTERN\fP [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring match\fP tests each \fISTRING\fP against \fIPATTERN\fP and prints matching substrings. Only the first match for each \fISTRING\fP is reported unless \fB\-a\fP or \fB\-\-all\fP is given, in which case all matches are reported.
.sp
If you specify the \fB\-e\fP or \fB\-\-entire\fP then each matching string is printed including any prefix or suffix not matched by the pattern (equivalent to \fBgrep\fP without the \fB\-o\fP flag). You can, obviously, achieve the same result by prepending and appending \fB*\fP or \fB\&.*\fP depending on whether or not you have specified the \fB\-\-regex\fP flag. The \fB\-\-entire\fP flag is a way to avoid having to complicate the pattern in that fashion and make the intent of the \fBstring match\fP clearer. Without \fB\-\-entire\fP and \fB\-\-regex\fP, a \fIPATTERN\fP will need to match the entire \fISTRING\fP before it will be reported.
.sp
Matching can be made case\-insensitive with \fB\-\-ignore\-case\fP or \fB\-i\fP\&.
.sp
If \fB\-\-groups\-only\fP or \fB\-g\fP is given, only the capturing groups will be reported \- meaning the full match will be skipped. This is incompatible with \fB\-\-entire\fP and \fB\-\-invert\fP, and requires \fB\-\-regex\fP\&. It is useful as a simple cutting tool instead of \fBstring replace\fP, so you can choose \(dqthis part\(dq of a string.
.sp
If \fB\-\-index\fP or \fB\-n\fP is given, each match is reported as a 1\-based start position and a length. By default, PATTERN is interpreted as a glob pattern matched against each entire \fISTRING\fP argument. A glob pattern is only considered a valid match if it matches the entire \fISTRING\fP\&.
.sp
If \fB\-\-regex\fP or \fB\-r\fP is given, \fIPATTERN\fP is interpreted as a Perl\-compatible regular expression, which does not have to match the entire \fISTRING\fP\&. For a regular expression containing capturing groups, multiple items will be reported for each match, one for the entire match and one for each capturing group. With this, only the matching part of the \fISTRING\fP will be reported, unless \fB\-\-entire\fP is given.
.sp
When matching via regular expressions, \fBstring match\fP automatically sets variables for all named capturing groups (\fB(?<name>expression)\fP). It will create a variable with the name of the group, in the default scope, for each named capturing group, and set it to the value of the capturing group in the first matched argument. If a named capture group matched an empty string, the variable will be set to the empty string (like \fBset var \(dq\(dq\fP). If it did not match, the variable will be set to nothing (like \fBset var\fP).  When \fB\-\-regex\fP is used with \fB\-\-all\fP, this behavior changes. Each named variable will contain a list of matches, with the first match contained in the first element, the second match in the second, and so on. If the group was empty or did not match, the corresponding element will be an empty string.
.sp
If \fB\-\-invert\fP or \fB\-v\fP is used the selected lines will be only those which do not match the given glob pattern or regular expression.
.sp
If \fB\-\-max\-matches MAX\fP or \fB\-m MAX\fP is used, \fBstring\fP will stop checking for matches after MAX lines of input have matched. This can be used as an \(dqearly exit\(dq optimization when processing long inputs but expecting a limited and fixed number of outputs that might be found considerably before the input stream has been exhausted. If combined with \fB\-\-invert\fP or \fB\-v\fP, considers only inverted matches.
.sp
Exit status: 0 if at least one match was found, or 1 otherwise.
.SS Examples
.SS Match Glob Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string match \(aqa\(aq a
a

>_ string match \(aqa*b\(aq axxb
axxb

>_ string match \-i \(aqa*B\(aq Axxb
Axxb

>_ string match \-\- \(aq\-*\(aq \-h foo \-\-version bar
# To match things that look like options, we need a \(ga\-\-\(ga
# to tell string its options end there.
\-h
\-\-version

>_ echo \(aqok?\(aq | string match \(aq*?\(aq
ok?

# Note that only the second STRING will match here.
>_ string match \(aqfoo\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo

>_ string match \-e \(aqfoo\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo1
foo
foo2

>_ string match \(aqfoo*\(aq \(aqfoo1\(aq \(aqfoo\(aq \(aqfoo2\(aq
foo1
foo2
.EE
.UNINDENT
.UNINDENT
.SS Match Regex Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string match \-r \(aqcat|dog|fish\(aq \(aqnice dog\(aq
dog

>_ string match \-r \-v \(dqc.*[12]\(dq {cat,dog}(seq 1 4)
dog1
dog2
cat3
dog3
cat4
dog4

>_ string match \-r \-\- \(aq\-.*\(aq \-h foo \-\-version bar
# To match things that look like options, we need a \(ga\-\-\(ga
# to tell string its options end there.
\-h
\-\-version

>_ string match \-r \(aq(\ed\ed?):(\ed\ed):(\ed\ed)\(aq 2:34:56
2:34:56
2
34
56

>_ string match \-r \(aq^(\ew{2,4})\e1$\(aq papa mud murmur
papa
pa
murmur
mur

>_ string match \-r \-a \-n at ratatat
2 2
4 2
6 2

>_ string match \-r \-i \(aq0x[0\-9a\-f]{1,8}\(aq \(aqint magic = 0xBadC0de;\(aq
0xBadC0de

>_ echo $version
3.1.2\-1575\-ga2ff32d90
>_ string match \-rq \(aq(?<major>\ed+).(?<minor>\ed+).(?<revision>\ed+)\(aq \-\- $version
>_ echo \(dqYou are using fish $major!\(dq
You are using fish 3!

>_ string match \-raq \(aq *(?<sentence>[^.!?]+)(?<punctuation>[.!?])?\(aq \(dqhello, friend. goodbye\(dq
>_ printf \(dq%s\en\(dq \-\- $sentence
hello, friend
goodbye
>_ printf \(dq%s\en\(dq \-\- $punctuation
\&.

>_ string match \-rq \(aq(?<word>hello)\(aq \(aqhi\(aq
>_ count $word
0
.EE
.UNINDENT
.UNINDENT
.SS string\-pad \- pad strings to a fixed width
.SS Synopsis
.nf
\fBstring\fP \fBpad\fP [\fB\-r\fP | \fB\-\-right\fP] [\fB\-C\fP | \fB\-\-center\fP] [(\fB\-c\fP | \fB\-\-char\fP) \fICHAR\fP] [(\fB\-w\fP | \fB\-\-width\fP) \fIINTEGER\fP]
           [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring pad\fP extends each \fISTRING\fP to the given visible width by adding \fICHAR\fP to the left. That means the width of all visible characters added together, excluding escape sequences and accounting for \fBfish_emoji_width\fP \%<#\:envvar-fish_emoji_width> and \fBfish_ambiguous_width\fP \%<#\:envvar-fish_ambiguous_width>\&. It is the amount of columns in a terminal the \fISTRING\fP occupies.
.sp
The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.
.sp
If \fB\-C\fP or \fB\-\-center\fP is given, add the padding to before and after the string. If it is impossible to perfectly center the result (because the required amount of padding is an odd number), extra padding will be added to the left, unless \fB\-\-right\fP is also given.
.sp
If \fB\-r\fP or \fB\-\-right\fP is given, add the padding after a string.
.sp
If \fB\-c\fP or \fB\-\-char\fP is given, pad with \fICHAR\fP instead of whitespace.
.sp
The output is padded to the maximum width of all input strings. If \fB\-w\fP or \fB\-\-width\fP is given, use at least that.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string pad \-w 10 abc abcdef
       abc
    abcdef

>_ string pad \-\-right \-\-char=🐟 \(dqfish are pretty\(dq \(dqrich. \(dq
fish are pretty
rich.  🐟🐟🐟🐟

>_ string pad \-w$COLUMNS (date)
# Prints the current time on the right edge of the screen.
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
The printf \%<> command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&.
.IP \(bu 2
string length \%<> with the \fB\-\-visible\fP option can be used to show what fish thinks the width is.
.UNINDENT
.SS string\-repeat \- multiply a string
.SS Synopsis
.nf
\fBstring\fP \fBrepeat\fP [(\fB\-n\fP | \fB\-\-count\fP) \fICOUNT\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-N\fP | \fB\-\-no\-newline\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBrepeat\fP [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-q\fP | \fB\-\-quiet\fP] \fICOUNT\fP [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring repeat\fP repeats the \fISTRING\fP \fB\-n\fP or \fB\-\-count\fP times. The \fB\-m\fP or \fB\-\-max\fP option will limit the number of outputted characters (excluding the newline). This option can be used by itself or in conjunction with \fB\-\-count\fP\&. If both \fB\-\-count\fP and \fB\-\-max\fP are present, max char will be outputted unless the final repeated string size is less than max, in that case, the string will repeat until count has been reached. Both \fB\-\-count\fP and \fB\-\-max\fP will accept a number greater than or equal to zero, in the case of zero, nothing will be outputted. The first argument is interpreted as \fICOUNT\fP if \fB\-\-count\fP or \fB\-\-max\fP are not explicitly specified. If \fB\-N\fP or \fB\-\-no\-newline\fP is given, the output won\(aqt contain a newline character at the end. Exit status: 0 if yielded string is not empty, 1 otherwise.
.SS Examples
.SS Repeat Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string repeat \-n 2 \(aqfoo \(aq
foo foo

>_ echo foo | string repeat \-n 2
foofoo

>_ string repeat \-n 2 \-m 5 \(aqfoo\(aq
foofo

>_ string repeat \-m 5 \(aqfoo\(aq
foofo

>_ string repeat 2 \(aqfoo\(aq
foofoo

>_ string repeat 2 \-n 3
222
.EE
.UNINDENT
.UNINDENT
.SS string\-replace \- replace substrings
.SS Synopsis
.nf
\fBstring\fP \fBreplace\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-f\fP | \fB\-\-filter\fP] [\fB\-i\fP | \fB\-\-ignore\-case\fP]
               [\fB\-r\fP | \fB\-\-regex\fP] [(\fB\-m\fP | \fB\-\-max\-matches\fP) \fIMAX\fP] [\fB\-q\fP | \fB\-\-quiet\fP]
               \fIPATTERN\fP \fIREPLACEMENT\fP [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring replace\fP is similar to \fBstring match\fP but replaces non\-overlapping matching substrings with a replacement string and prints the result. By default, \fIPATTERN\fP is treated as a literal substring to be matched.
.sp
If \fB\-r\fP or \fB\-\-regex\fP is given, \fIPATTERN\fP is interpreted as a Perl\-compatible regular expression, and \fIREPLACEMENT\fP can contain C\-style escape sequences like \fBt\fP as well as references to capturing groups by number or name as \fI$n\fP or \fI${n}\fP\&.
.sp
If you specify the \fB\-f\fP or \fB\-\-filter\fP flag then each input string is printed only if a replacement was done. This is useful where you would otherwise use this idiom: \fBa_cmd | string match pattern | string replace pattern new_pattern\fP\&. You can instead just write \fBa_cmd | string replace \-\-filter pattern new_pattern\fP\&.
.sp
If \fB\-\-max\-matches MAX\fP or \fB\-m MAX\fP is used, \fBstring replace\fP will stop all processing after MAX lines of input have matched the specified pattern. In the event of \fB\-\-filter\fP or \fB\-f\fP, this means the output will be MAX lines in length. This can be used as an \(dqearly exit\(dq optimization when processing long inputs but expecting a limited and fixed number of outputs that might be found considerably before the input stream has been exhausted.
.sp
Exit status: 0 if at least one replacement was performed, or 1 otherwise.
.SS Examples
.SS Replace Literal Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string replace is was \(aqblue is my favorite\(aq
blue was my favorite

>_ string replace 3rd last 1st 2nd 3rd
1st
2nd
last

>_ string replace \-a \(aq \(aq _ \(aqspaces to underscores\(aq
spaces_to_underscores
.EE
.UNINDENT
.UNINDENT
.SS Replace Regex Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string replace \-r \-a \(aq[^\ed.]+\(aq \(aq \(aq \(aq0 one two 3.14 four 5x\(aq
0 3.14 5

>_ string replace \-r \(aq(\ew+)\es+(\ew+)\(aq \(aq$2 $1 $$\(aq \(aqleft right\(aq
right left $

>_ string replace \-r \(aq\es*newline\es*\(aq \(aq\en\(aq \(aqput a newline here\(aq
put a
here
.EE
.UNINDENT
.UNINDENT
.SS string\-shorten \- shorten strings to a width, with an ellipsis
.SS Synopsis
.nf
\fBstring\fP \fBshorten\fP [(\fB\-c\fP | \fB\-\-char\fP) \fICHARS\fP] [(\fB\-m\fP | \fB\-\-max\fP) \fIINTEGER\fP]
               [\fB\-N\fP | \fB\-\-no\-newline\fP] [\fB\-l\fP | \fB\-\-left\fP] [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring shorten\fP truncates each \fISTRING\fP to the given visible width and adds an ellipsis to indicate it. \(dqVisible width\(dq means the width of all visible characters added together, excluding escape sequences and accounting for \fBfish_emoji_width\fP \%<#\:envvar-fish_emoji_width> and \fBfish_ambiguous_width\fP \%<#\:envvar-fish_ambiguous_width>\&. It is the amount of columns in a terminal the \fISTRING\fP occupies.
.sp
The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.
.sp
If \fB\-m\fP or \fB\-\-max\fP is given, truncate at the given width. Otherwise, the lowest non\-zero width of all input strings is used. A max of 0 means no shortening takes place, all STRINGs are printed as\-is.
.sp
If \fB\-N\fP or \fB\-\-no\-newline\fP is given, only the first line (or last line with \fB\-\-left\fP) of each STRING is used, and an ellipsis is added if it was multiline. This only works for STRINGs being given as arguments, multiple lines given on stdin will be interpreted as separate STRINGs instead.
.sp
If \fB\-c\fP or \fB\-\-char\fP is given, add \fICHAR\fP instead of an ellipsis. This can also be empty or more than one character.
.sp
If \fB\-l\fP or \fB\-\-left\fP is given, remove text from the left on instead, so this prints the longest \fIsuffix\fP of the string that fits. With \fB\-\-no\-newline\fP, this will take from the last line instead of the first.
.sp
If \fB\-q\fP or \fB\-\-quiet\fP is given, \fBstring shorten\fP only runs for the return value \- if anything would be shortened, it returns 0, else 1.
.sp
The default ellipsis is \fB…\fP\&. If fish thinks your system is incapable because of your locale, it will use \fB\&...\fP instead.
.sp
The return value is 0 if any shortening occurred, 1 otherwise.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string shorten foo foobar
# No width was given, we infer, and \(dqfoo\(dq is the shortest.
foo
fo…

>_ string shorten \-\-char=\(dq...\(dq foo foobar
# The target width is 3 because of \(dqfoo\(dq,
# and our ellipsis is 3 too, so we can\(aqt really show anything.
# This is the default ellipsis if your locale doesn\(aqt allow \(dq…\(dq.
foo
\&...

>_ string shorten \-\-char=\(dq\(dq \-\-max 4 abcdef 123456
# Leaving the char empty makes us not add an ellipsis
# So this truncates at 4 columns:
abcd
1234

>_ touch \(dqa multiline\(dq\en\(dqfile\(dq
>_ for file in *; string shorten \-N \-\- $file; end
# Shorten the multiline file so we only show one line per file:
a multiline…

>_ ss \-p | string shorten \-m$COLUMNS \-c \(dq\(dq
# \(gass\(ga from Linux\(aq iproute2 shows socket information, but prints extremely long lines.
# This shortens input so it fits on the screen without overflowing lines.

>_ git branch | string match \-rg \(aq^\e* (.*)\(aq | string shorten \-m20
# Take the current git branch and shorten it at 20 columns.
# Here the branch is \(dqbuiltin\-path\-with\-expand\(dq
builtin\-path\-with\-e…

>_ git branch | string match \-rg \(aq^\e* (.*)\(aq | string shorten \-m20 \-\-left
# Taking 20 columns from the right instead:
…in\-path\-with\-expand
.EE
.UNINDENT
.UNINDENT
.SS See Also
.INDENT 0.0
.IP \(bu 2
string pad \%<> does the inverse of this command, adding padding to a specific width instead.
.IP \(bu 2
The printf \%<> command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&.
.IP \(bu 2
string length \%<> with the \fB\-\-visible\fP option can be used to show what fish thinks the width is.
.UNINDENT
.SS string\-split \- split strings by delimiter
.SS Synopsis
.nf
\fBstring\fP \fBsplit\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBsplit0\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring split\fP splits each \fISTRING\fP on the separator \fISEP\fP, which can be an empty string. If \fB\-m\fP or \fB\-\-max\fP is specified, at most MAX splits are done on each \fISTRING\fP\&. If \fB\-r\fP or \fB\-\-right\fP is given, splitting is performed right\-to\-left. This is only useful in combination with \fB\-m\fP or \fB\-\-max\fP\&. With \fB\-n\fP or \fB\-\-no\-empty\fP, empty results are excluded from consideration (e.g. \fBhello\en\enworld\fP would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
.sp
Use \fB\-f\fP or \fB\-\-fields\fP to print out specific fields. FIELDS is a comma\-separated string of field numbers and/or spans. Each field is one\-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless \fB\-\-allow\-empty\fP is used.
.sp
See also the \fB\-\-delimiter\fP option of the read \%<> command.
.sp
\fBstring split0\fP splits each \fISTRING\fP on the zero byte (NUL). Options are the same as \fBstring split\fP except that no separator is given.
.sp
\fBsplit0\fP has the important property that its output is not further split when used in a command substitution, allowing for the command substitution to produce elements containing newlines. This is most useful when used with Unix tools that produce zero bytes, such as \fBfind \-print0\fP or \fBsort \-z\fP\&. See split0 examples below.
.sp
Be aware that commandline arguments cannot include NULs, so you likely want to pass to \fBstring split0\fP via a pipe, not a command substitution.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string split . example.com
example
com

>_ string split \-r \-m1 / /usr/local/bin/fish
/usr/local/bin
fish

>_ string split \(aq\(aq abc
a
b
c

>_ string split \-\-allow\-empty \-f1,3\-4,5 \(aq\(aq abcd
a
c
d
.EE
.UNINDENT
.UNINDENT
.SS NUL Delimited Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ # Count files in a directory, without being confused by newlines.
>_ # Note: Don\(aqt use \(gastring split0 (find . \-print0)\(ga, because arguments cannot include NUL.
>_ count (find . \-print0 | string split0)
42

>_ # Sort a list of elements which may contain newlines
>_ set foo beta alpha\engamma
>_ set foo (string join0 $foo | sort \-z | string split0)
>_ string escape $foo[1]
alpha\engamma
.EE
.UNINDENT
.UNINDENT
.SS string\-split0 \- split on zero bytes
.SS Synopsis
.nf
\fBstring\fP \fBsplit\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
             [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] \fISEP\fP [\fISTRING\fP \&...]
\fBstring\fP \fBsplit0\fP [(\fB\-f\fP | \fB\-\-fields\fP) \fIFIELDS\fP [\fB\-a\fP | \fB\-\-allow\-empty\fP]] [(\fB\-m\fP | \fB\-\-max\fP) \fIMAX\fP] [\fB\-n\fP | \fB\-\-no\-empty\fP]
              [\fB\-q\fP | \fB\-\-quiet\fP] [\fB\-r\fP | \fB\-\-right\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring split\fP splits each \fISTRING\fP on the separator \fISEP\fP, which can be an empty string. If \fB\-m\fP or \fB\-\-max\fP is specified, at most MAX splits are done on each \fISTRING\fP\&. If \fB\-r\fP or \fB\-\-right\fP is given, splitting is performed right\-to\-left. This is only useful in combination with \fB\-m\fP or \fB\-\-max\fP\&. With \fB\-n\fP or \fB\-\-no\-empty\fP, empty results are excluded from consideration (e.g. \fBhello\en\enworld\fP would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
.sp
Use \fB\-f\fP or \fB\-\-fields\fP to print out specific fields. FIELDS is a comma\-separated string of field numbers and/or spans. Each field is one\-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless \fB\-\-allow\-empty\fP is used.
.sp
See also the \fB\-\-delimiter\fP option of the read \%<> command.
.sp
\fBstring split0\fP splits each \fISTRING\fP on the zero byte (NUL). Options are the same as \fBstring split\fP except that no separator is given.
.sp
\fBsplit0\fP has the important property that its output is not further split when used in a command substitution, allowing for the command substitution to produce elements containing newlines. This is most useful when used with Unix tools that produce zero bytes, such as \fBfind \-print0\fP or \fBsort \-z\fP\&. See split0 examples below.
.sp
Be aware that commandline arguments cannot include NULs, so you likely want to pass to \fBstring split0\fP via a pipe, not a command substitution.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string split . example.com
example
com

>_ string split \-r \-m1 / /usr/local/bin/fish
/usr/local/bin
fish

>_ string split \(aq\(aq abc
a
b
c

>_ string split \-\-allow\-empty \-f1,3\-4,5 \(aq\(aq abcd
a
c
d
.EE
.UNINDENT
.UNINDENT
.SS NUL Delimited Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ # Count files in a directory, without being confused by newlines.
>_ # Note: Don\(aqt use \(gastring split0 (find . \-print0)\(ga, because arguments cannot include NUL.
>_ count (find . \-print0 | string split0)
42

>_ # Sort a list of elements which may contain newlines
>_ set foo beta alpha\engamma
>_ set foo (string join0 $foo | sort \-z | string split0)
>_ string escape $foo[1]
alpha\engamma
.EE
.UNINDENT
.UNINDENT
.SS string\-sub \- extract substrings
.SS Synopsis
.nf
\fBstring\fP \fBsub\fP [(\fB\-s\fP | \fB\-\-start\fP) \fISTART\fP] [(\fB\-e\fP | \fB\-\-end\fP) \fIEND\fP] [(\fB\-l\fP | \fB\-\-length\fP) \fILENGTH\fP]
           [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring sub\fP prints a substring of each string argument. The start/end of the substring can be specified with \fB\-s\fP/\fB\-e\fP or \fB\-\-start\fP/\fB\-\-end\fP followed by a 1\-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with \fB\-l\fP or \fB\-\-length\fP\&. If the length or end is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise. \fB\-\-length\fP is mutually exclusive with \fB\-\-end\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string sub \-\-length 2 abcde
ab

>_ string sub \-s 2 \-l 2 abcde
bc

>_ string sub \-\-start=\-2 abcde
de

>_ string sub \-\-end=3 abcde
abc

>_ string sub \-e \-1 abcde
abcd

>_ string sub \-s 2 \-e \-1 abcde
bcd

>_ string sub \-s \-3 \-e \-2 abcde
c
.EE
.UNINDENT
.UNINDENT
.SS string\-trim \- remove trailing whitespace
.SS Synopsis
.nf
\fBstring\fP \fBtrim\fP [\fB\-l\fP | \fB\-\-left\fP] [\fB\-r\fP | \fB\-\-right\fP] [(\fB\-c\fP | \fB\-\-chars\fP) \fICHARS\fP]
            [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring trim\fP removes leading and trailing whitespace from each \fISTRING\fP\&. If \fB\-l\fP or \fB\-\-left\fP is given, only leading whitespace is removed. If \fB\-r\fP or \fB\-\-right\fP is given, only trailing whitespace is trimmed.
.sp
The \fB\-c\fP or \fB\-\-chars\fP switch causes the set of characters in \fICHARS\fP to be removed instead of whitespace. This is a set of characters, not a string \- if you pass \fB\-c foo\fP, it will remove any \(dqf\(dq or \(dqo\(dq, not just \(dqfoo\(dq as a whole.
.sp
Exit status: 0 if at least one character was trimmed, or 1 otherwise.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ string trim \(aq abc  \(aq
abc

>_ string trim \-\-right \-\-chars=yz xyzzy zany
x
zan
.EE
.UNINDENT
.UNINDENT
.SS string\-unescape \- expand escape sequences
.SS Synopsis
.nf
\fBstring\fP \fBescape\fP [\fB\-n\fP | \fB\-\-no\-quoted\fP] [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
\fBstring\fP \fBunescape\fP [\fB\-\-style\fP\fB=\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring escape\fP escapes each \fISTRING\fP in one of several ways.
.sp
\fB\-\-style=script\fP (default) alters the string such that it can be passed back to \fBeval\fP to produce the original argument again. By default, all special characters are escaped, and quotes are used to simplify the output when possible. If \fB\-n\fP or \fB\-\-no\-quoted\fP is given, the simplifying quoted format is not used. Exit status: 0 if at least one string was escaped, or 1 otherwise.
.sp
\fB\-\-style=var\fP ensures the string can be used as a variable name by hex encoding any non\-alphanumeric characters. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=url\fP ensures the string can be used as a URL by hex encoding any character which is not legal in a URL. The string is first converted to UTF\-8 before being encoded.
.sp
\fB\-\-style=regex\fP escapes an input string for literal matching within a regex expression. The string is first converted to UTF\-8 before being encoded.
.sp
\fBstring unescape\fP performs the inverse of the \fBstring escape\fP command. If the string to be unescaped is not properly formatted it is ignored. For example, doing \fBstring unescape \-\-style=var (string escape \-\-style=var $str)\fP will return the original string. There is no support for unescaping \fB\-\-style=regex\fP\&.
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ echo \ex07 | string escape
\ecg

>_ string escape \-\-style=var \(aqa1 b2\(aq\eu6161
a1_20_b2_E6_85_A1_
.EE
.UNINDENT
.UNINDENT
.SS string\-upper \- convert strings to uppercase
.SS Synopsis
.nf
\fBstring\fP \fBupper\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...]
.fi
.sp
.SS Description
.sp
\fBstring upper\fP converts each string argument to uppercase. Exit status: 0 if at least one string was converted to uppercase, else 1. This means that in conjunction with the \fB\-q\fP flag you can readily test whether a string is already uppercase.
.SS suspend \- suspend the current shell
.SS Synopsis
.nf
\fBsuspend\fP [\fB\-\-force\fP]
.fi
.sp
.SS Description
.sp
\fBsuspend\fP suspends execution of the current shell by sending it a SIGTSTP signal, returning to the controlling process. It can be resumed later by sending it a SIGCONT.  In order to prevent suspending a shell that doesn\(aqt have a controlling process, it will not suspend the shell if it is a login shell. This requirement is bypassed if the \fB\-\-force\fP option is given or the shell is not interactive.
.SS switch \- conditionally execute a block of commands
.SS Synopsis
.nf
\fBswitch\fP \fIVALUE\fP\fB;\fP [\fBcase\fP [\fIGLOB\fP \&...]\fB;\fP [\fICOMMANDS\fP \&...]\fB;\fP \&...] \fBend\fP
.fi
.sp
.SS Description
.sp
\fBswitch\fP performs one of several blocks of commands, depending on whether a specified value equals one of several globbed values. \fBcase\fP is used together with the \fBswitch\fP statement in order to determine which block should be executed.
.sp
Each \fBcase\fP command is given one or more parameters. The first \fBcase\fP command with a parameter that matches the string specified in the switch command will be evaluated. \fBcase\fP parameters may contain globs. These need to be escaped or quoted in order to avoid regular glob expansion using filenames.
.sp
Note that fish does not fall through on case statements. Only the first matching case is executed.
.sp
Note that break \%<> cannot be used to exit a case/switch block early like in other languages. It can only be used in loops.
.sp
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
.SS Example
.sp
If the variable \fB$animal\fP contains the name of an animal, the following code would attempt to classify it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
switch $animal
    case cat
        echo evil
    case wolf dog human moose dolphin whale
        echo mammal
    case duck goose albatross
        echo bird
    case shark trout stingray
        echo fish
    case \(aq*\(aq
        echo I have no idea what a $animal is
end
.EE
.UNINDENT
.UNINDENT
.sp
If the above code was run with \fB$animal\fP set to \fBwhale\fP, the output
would be \fBmammal\fP\&.
.SS test \- perform tests on files and text
.SS Synopsis
.nf
\fBtest\fP [\fIEXPRESSION\fP]
\fB[ \fP[\fIEXPRESSION\fP]\fB ]\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBtest\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man test\fP\&.
.sp
\fBtest\fP checks the given conditions and sets the exit status to 0 if they are true, 1 if they are false.
.sp
The first form (\fBtest\fP) is preferred. For compatibility with other shells, the second form is available: a matching pair of square brackets (\fB[ [EXPRESSION] ]\fP).
.sp
When using a variable or command substitution as an argument with \fBtest\fP you should almost always enclose it in double\-quotes, as variables expanding to zero or more than one argument will most likely interact badly with \fBtest\fP\&.
.sp
\fBWarning:\fP
.INDENT 0.0
.INDENT 3.5
For historical reasons, \fBtest\fP supports the one\-argument form (\fBtest foo\fP), and this will also be triggered by e.g. \fBtest \-n $foo\fP if $foo is unset. We recommend you don\(aqt use the one\-argument form and quote all variables or command substitutions used with \fBtest\fP\&.
.sp
This confusing misfeature will be removed in future. \fBtest \-n\fP without any additional argument will be false, \fBtest \-z\fP will be true and any other invocation with exactly one or zero arguments, including \fBtest \-d\fP and \fBtest \(dqfoo\(dq\fP will be an error.
.sp
The same goes for \fB[\fP, e.g. \fB[ \(dqfoo\(dq ]\fP and \fB[ \-d ]\fP will be errors.
.sp
This can be turned on already via the \fBtest\-require\-arg\fP feature flag \%<#\:featureflags>, and will eventually become the default and then only option.
.UNINDENT
.UNINDENT
.SS Operators for files and directories
.INDENT 0.0
.TP
\fB\-b\fP \fIFILE\fP
Returns true if \fIFILE\fP is a block device.
.TP
\fB\-c\fP \fIFILE\fP
Returns true if \fIFILE\fP is a character device.
.TP
\fB\-d\fP \fIFILE\fP
Returns true if \fIFILE\fP is a directory.
.TP
\fB\-e\fP \fIFILE\fP
Returns true if \fIFILE\fP exists.
.TP
\fB\-f\fP \fIFILE\fP
Returns true if \fIFILE\fP is a regular file.
.TP
\fB\-g\fP \fIFILE\fP
Returns true if \fIFILE\fP has the set\-group\-ID bit set.
.TP
\fB\-G\fP \fIFILE\fP
Returns true if \fIFILE\fP exists and has the same group ID as the current user.
.TP
\fB\-k\fP \fIFILE\fP
Returns true if \fIFILE\fP has the sticky bit set. If the OS does not support the concept it returns false. See \%<https://\:en\:.wikipedia\:.org/\:wiki/\:Sticky_bit>\&.
.TP
\fB\-L\fP \fIFILE\fP
Returns true if \fIFILE\fP is a symbolic link.
.TP
\fB\-O\fP \fIFILE\fP
Returns true if \fIFILE\fP exists and is owned by the current user.
.TP
\fB\-p\fP \fIFILE\fP
Returns true if \fIFILE\fP is a named pipe.
.TP
\fB\-r\fP \fIFILE\fP
Returns true if \fIFILE\fP is marked as readable.
.TP
\fB\-s\fP \fIFILE\fP
Returns true if the size of \fIFILE\fP is greater than zero.
.TP
\fB\-S\fP \fIFILE\fP
Returns true if \fIFILE\fP is a socket.
.TP
\fB\-t\fP \fIFD\fP
Returns true if the file descriptor \fIFD\fP is a terminal (TTY).
.TP
\fB\-u\fP \fIFILE\fP
Returns true if \fIFILE\fP has the set\-user\-ID bit set.
.TP
\fB\-w\fP \fIFILE\fP
Returns true if \fIFILE\fP is marked as writable; note that this does not check if the filesystem is read\-only.
.TP
\fB\-x\fP \fIFILE\fP
Returns true if \fIFILE\fP is marked as executable.
.UNINDENT
.SS Operators to compare files and directories
.INDENT 0.0
.TP
\fIFILE1\fP \fB\-nt\fP \fIFILE2\fP
Returns true if \fIFILE1\fP is newer than \fIFILE2\fP, or \fIFILE1\fP exists and \fIFILE2\fP does not.
.TP
\fIFILE1\fP \fB\-ot\fP \fIFILE2\fP
Returns true if \fIFILE1\fP is older than \fIFILE2\fP, or \fIFILE2\fP exists and \fIFILE1\fP does not.
.TP
\fIFILE1\fP \fB\-ef\fP \fIFILE1\fP
Returns true if \fIFILE1\fP and \fIFILE2\fP refer to the same file.
.UNINDENT
.SS Operators for text strings
.INDENT 0.0
.TP
\fISTRING1\fP \fB=\fP \fISTRING2\fP
Returns true if the strings \fISTRING1\fP and \fISTRING2\fP are identical.
.TP
\fISTRING1\fP \fB!=\fP \fISTRING2\fP
Returns true if the strings \fISTRING1\fP and \fISTRING2\fP are not identical.
.TP
\fB\-n\fP \fISTRING\fP
Returns true if the length of \fISTRING\fP is non\-zero.
.TP
\fB\-z\fP \fISTRING\fP
Returns true if the length of \fISTRING\fP is zero.
.UNINDENT
.SS Operators to compare and examine numbers
.INDENT 0.0
.TP
\fINUM1\fP \fB\-eq\fP \fINUM2\fP
Returns true if \fINUM1\fP and \fINUM2\fP are numerically equal.
.TP
\fINUM1\fP \fB\-ne\fP \fINUM2\fP
Returns true if \fINUM1\fP and \fINUM2\fP are not numerically equal.
.TP
\fINUM1\fP \fB\-gt\fP \fINUM2\fP
Returns true if \fINUM1\fP is greater than \fINUM2\fP\&.
.TP
\fINUM1\fP \fB\-ge\fP \fINUM2\fP
Returns true if \fINUM1\fP is greater than or equal to \fINUM2\fP\&.
.TP
\fINUM1\fP \fB\-lt\fP \fINUM2\fP
Returns true if \fINUM1\fP is less than \fINUM2\fP\&.
.TP
\fINUM1\fP \fB\-le\fP \fINUM2\fP
Returns true if \fINUM1\fP is less than or equal to \fINUM2\fP\&.
.UNINDENT
.sp
Both integers and floating point numbers are supported.
.SS Operators to combine expressions
.INDENT 0.0
.TP
\fICOND1\fP \fB\-a\fP \fICOND2\fP
Returns true if both \fICOND1\fP and \fICOND2\fP are true.
.TP
\fICOND1\fP \fB\-o\fP \fICOND2\fP
Returns true if either \fICOND1\fP or \fICOND2\fP are true.
.UNINDENT
.sp
Expressions can be inverted using the \fB!\fP operator:
.INDENT 0.0
.TP
\fB!\fP \fIEXPRESSION\fP
Returns true if \fIEXPRESSION\fP is false, and false if \fIEXPRESSION\fP is true.
.UNINDENT
.sp
Expressions can be grouped using parentheses.
.INDENT 0.0
.TP
\fB(\fP \fIEXPRESSION\fP \fB)\fP
Returns the value of \fIEXPRESSION\fP\&.
.UNINDENT
.sp
Note that parentheses will usually require escaping with \fB\e\fP (so they appear as \fB\e(\fP and \fB\e)\fP) to avoid being interpreted as a command substitution.
.SS Examples
.sp
If the \fB/tmp\fP directory exists, copy the \fB/etc/motd\fP file to it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-d /tmp
    cp /etc/motd /tmp/motd
end
.EE
.UNINDENT
.UNINDENT
.sp
If the variable \fBMANPATH\fP is defined and not empty, print the contents. (If \fBMANPATH\fP is not defined, then it will expand to zero arguments, unless quoted.)
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-n \(dq$MANPATH\(dq
    echo $MANPATH
end
.EE
.UNINDENT
.UNINDENT
.sp
Be careful with unquoted variables:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \-n $MANPATH
    # This will also be reached if $MANPATH is unset,
    # because in that case we have \(gatest \-n\(ga, so it checks if \(dq\-n\(dq is non\-empty, and it is.
    echo $MANPATH
end
.EE
.UNINDENT
.UNINDENT
.sp
This will change in a future release of fish, or already with the \fBtest\-require\-arg\fP feature flag \%<#\:featureflags> \- if $MANPATH is unset, \fBif test \-n $MANPATH\fP will be false.
.sp
Parentheses and the \fB\-o\fP and \fB\-a\fP operators can be combined to produce more complicated expressions. In this example, success is printed if there is a \fB/foo\fP or \fB/bar\fP file as well as a \fB/baz\fP or \fB/bat\fP file.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \e( \-f /foo \-o \-f /bar \e) \-a \e( \-f /baz \-o \-f /bat \e)
    echo Success.
end
.EE
.UNINDENT
.UNINDENT
.sp
Numerical comparisons will fail if one of the operands is not a number:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test 42 \-eq \(dqThe answer to life, the universe and everything\(dq
    echo So long and thanks for all the fish # will not be executed
end
.EE
.UNINDENT
.UNINDENT
.sp
A common comparison is with \fBstatus\fP \%<#\:envvar-status>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test $status \-eq 0
    echo \(dqPrevious command succeeded\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
The previous test can likewise be inverted:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test ! $status \-eq 0
    echo \(dqPrevious command failed\(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
which is logically equivalent to the following:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test $status \-ne 0
    echo \(dqPrevious command failed\(dq
end
.EE
.UNINDENT
.UNINDENT
.SS Standards
.sp
Unlike many things in fish, \fBtest\fP implements a subset of the IEEE Std 1003.1\-2008 (POSIX.1) standard \%<https://\:pubs\:.opengroup\:.org/\:onlinepubs/\:9699919799/\:utilities/\:test\:.html>\&. The following exceptions apply:
.INDENT 0.0
.IP \(bu 2
The \fB<\fP and \fB>\fP operators for comparing strings are not implemented.
.IP \(bu 2
With \fBtest\-require\-arg\fP, the zero\- and one\-argument modes will behave differently.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
In cases such as this, one can use \fBcommand\fP \fBtest\fP to explicitly use the system\(aqs standalone \fBtest\fP rather than this \fBbuiltin\fP \fBtest\fP\&.
.UNINDENT
.UNINDENT
.SS See also
.sp
Other commands that may be useful as a condition, and are often easier to use:
.INDENT 0.0
.IP \(bu 2
string \- manipulate strings \%<>, which can do string operations including wildcard and regular expression matching
.IP \(bu 2
path \- manipulate and check paths \%<>, which can do file checks and operations, including filters on multiple paths at once
.UNINDENT
.SS time \- measure how long a command or block takes
.SS Synopsis
.nf
\fBtime\fP \fICOMMAND\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish keyword \fBtime\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man time\fP\&.
.sp
\fBtime\fP causes fish to measure how long a command takes and print the results afterwards. The command can be a simple fish command or a block. The results can not currently be redirected.
.sp
For checking timing after a command has completed, check $CMD_DURATION \%<#\:variables-special>\&.
.sp
Your system most likely also has a \fBtime\fP command. To use that use something like \fBcommand time\fP, as in \fBcommand time sleep 10\fP\&. Because it\(aqs not inside fish, it won\(aqt have access to fish functions and won\(aqt be able to time blocks and such.
.SS How to interpret the output
.sp
Time outputs a few different values. Let\(aqs look at an example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> time string repeat \-n 10000000 y\en | command grep y >/dev/null
________________________________________________________
Executed in  805.98 millis    fish           external
   usr time  798.88 millis  763.88 millis   34.99 millis
   sys time  141.22 millis   40.20 millis  101.02 millis
.EE
.UNINDENT
.UNINDENT
.sp
The time after \(dqExecuted in\(dq is what is known as the \(dqwall\-clock time\(dq. It is simply a measure of how long it took from the start of the command until it finished. Typically it is reasonably close to \fBCMD_DURATION\fP \%<#\:envvar-CMD_DURATION>, except for a slight skew because the two are taken at slightly different times.
.sp
The other times are all measures of CPU time. That means they measure how long the CPU was used in this part, and they count multiple cores separately. So a program with four threads using all CPU for a second will have a time of 4 seconds.
.sp
The \(dqusr\(dq time is how much CPU time was spent inside the program itself, the \(dqsys\(dq time is how long was spent in the kernel on behalf of that program.
.sp
The \(dqfish\(dq time is how much CPU was spent in fish, the \(dqexternal\(dq time how much was spent in external commands.
.sp
So in this example, since \fBstring\fP is a builtin, everything that \fBstring repeat\fP did is accounted to fish. Any time it spends doing syscalls like \fBwrite()\fP is accounted for in the fish/sys time.
.sp
And \fBgrep\fP here is explicitly invoked as an external command, so its times will be counted in the \(dqexternal\(dq column.
.sp
Note that, as in this example, the CPU times can add up to more than the execution time. This is because things can be done in parallel \- \fBgrep\fP can match while \fBstring repeat\fP writes.
.SS Example
.sp
(for obvious reasons exact results will vary on your system)
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ time sleep 1s

________________________________________________________
Executed in    1,01 secs   fish           external
   usr time    2,32 millis    0,00 micros    2,32 millis
   sys time    0,88 millis  877,00 micros    0,00 millis

>_ time for i in 1 2 3; sleep 1s; end

________________________________________________________
Executed in    3,01 secs   fish           external
   usr time    9,16 millis    2,94 millis    6,23 millis
   sys time    0,23 millis    0,00 millis    0,23 millis
.EE
.UNINDENT
.UNINDENT
.sp
Inline variable assignments need to follow the \fBtime\fP keyword:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ time a_moment=1.5m sleep $a_moment

________________________________________________________
Executed in   90.00 secs      fish           external
   usr time    4.62 millis    4.62 millis    0.00 millis
   sys time    2.35 millis    0.41 millis    1.95 millis
.EE
.UNINDENT
.UNINDENT
.SS trap \- perform an action when the shell receives a signal
.SS Synopsis
.nf
\fBtrap\fP [\fIOPTIONS\fP] [[\fIARG\fP] \fIREASON\fP \&...\fB ]\fP
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBtrap\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man trap\fP\&.
.sp
\fBtrap\fP is a wrapper around the fish event delivery framework. It exists for backwards compatibility with POSIX shells. For other uses, it is recommended to define an event handler \%<#\:event>\&.
.sp
The following parameters are available:
.INDENT 0.0
.TP
.B \fIARG\fP
Command to be executed on signal delivery.
.TP
.B \fIREASON\fP
Name of the event to trap. For example, a signal like \fBINT\fP or \fBSIGINT\fP, or the special symbol \fBEXIT\fP\&.
.TP
\fB\-l\fP or \fB\-\-list\-signals\fP
Prints a list of signal names.
.TP
\fB\-p\fP or \fB\-\-print\fP
Prints all defined signal handlers.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
If \fIARG\fP and \fIREASON\fP are both specified, \fIARG\fP is the command to be executed when the event specified by \fIREASON\fP occurs (e.g., the signal is delivered).
.sp
If \fIARG\fP is absent (and there is a single \fIREASON\fP) or \fB\-\fP, each specified signal is reset to its original disposition (the value it had upon entrance to the shell).  If \fIARG\fP is the null string the signal specified by each \fIREASON\fP is ignored by the shell and by the commands it invokes.
.sp
If \fIARG\fP is not present and \fB\-p\fP has been supplied, then the trap commands associated with each \fIREASON\fP are displayed. If no arguments are supplied or if only \fB\-p\fP is given, \fBtrap\fP prints the list of commands associated with each signal.
.sp
Signal names are case insensitive and the \fBSIG\fP prefix is optional. Trapping a signal will prevent fish from exiting in response to that signal.
.sp
The exit status is 1 if any \fIREASON\fP is invalid; otherwise trap returns 0.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
trap \(dqstatus \-\-print\-stack\-trace\(dq SIGUSR1
# Prints a stack trace each time the SIGUSR1 signal is sent to the shell.
.EE
.UNINDENT
.UNINDENT
.SS true \- return a successful result
.SS Synopsis
.nf
\fBtrue\fP
.fi
.sp
.SS Description
.sp
\fBtrue\fP sets the exit status to 0.
.sp
\fB:\fP (a single colon) is an alias for the \fBtrue\fP command.
.SS See Also
.INDENT 0.0
.IP \(bu 2
false \%<> command
.IP \(bu 2
$status \%<#\:variables-status> variable
.UNINDENT
.SS type \- locate a command and describe its type
.SS Synopsis
.nf
\fBtype\fP [\fIOPTIONS\fP] \fINAME\fP [\&...]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBtype\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man type\fP\&.
.sp
With no options, \fBtype\fP indicates how each \fINAME\fP would be interpreted if used as a command name.
.sp
The following options are available:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-all\fP
Prints all of possible definitions of the specified names.
.TP
\fB\-s\fP or \fB\-\-short\fP
Don\(aqt print function definitions when used with no options or with \fB\-a\fP/\fB\-\-all\fP\&.
.TP
\fB\-f\fP or \fB\-\-no\-functions\fP
Suppresses function lookup.
.TP
\fB\-t\fP or \fB\-\-type\fP
Prints \fBfunction\fP, \fBbuiltin\fP, or \fBfile\fP if \fINAME\fP is a shell function, builtin, or disk file, respectively.
.TP
\fB\-p\fP or \fB\-\-path\fP
Prints the path to \fINAME\fP if \fINAME\fP resolves to an executable file in \fBPATH\fP \%<#\:envvar-PATH>, the path to the script containing the definition of the function \fINAME\fP if \fINAME\fP resolves to a function loaded from a file on disk (i.e. not interactively defined at the prompt), or nothing otherwise.
.TP
\fB\-P\fP or \fB\-\-force\-path\fP
Returns the path to the executable file \fINAME\fP, presuming \fINAME\fP is found in the \fBPATH\fP \%<#\:envvar-PATH> environment variable, or nothing otherwise. \fB\-\-force\-path\fP explicitly resolves only the path to executable files in  \fBPATH\fP \%<#\:envvar-PATH>, regardless of whether \fINAME\fP is shadowed by a function or builtin with the same name.
.TP
\fB\-q\fP or \fB\-\-query\fP
Suppresses all output; this is useful when testing the exit status. For compatibility with old fish versions this is also \fB\-\-quiet\fP\&.
.TP
\fB\-\-color\fP \fIWHEN\fP
Controls when to use syntax highlighting colors when printing function definitions.
\fIWHEN\fP can be \fBauto\fP (the default, colorize if the output is a terminal \%<>), \fBalways\fP, or \fBnever\fP\&.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
The \fB\-q\fP, \fB\-p\fP, \fB\-t\fP and \fB\-P\fP flags (and their long flag aliases) are mutually exclusive. Only one can be specified at a time.
.sp
\fBtype\fP returns 0 if at least one entry was found, 1 otherwise, and 2 for invalid options or option combinations.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
>_ type fg
fg is a builtin
.EE
.UNINDENT
.UNINDENT
.SS ulimit \- set or get resource usage limits
.SS Synopsis
.nf
\fBulimit\fP [\fIOPTIONS\fP] [\fILIMIT\fP]
.fi
.sp
.SS Description
.sp
\fBulimit\fP sets or outputs the resource usage limits of the shell and any processes spawned by it. If a new limit value is omitted, the current value of the limit of the resource is printed; otherwise, the specified limit is set to the new value.
.sp
Use one of the following switches to specify which resource limit to set or report:
.INDENT 0.0
.TP
\fB\-b\fP or \fB\-\-socket\-buffers\fP
The maximum size of socket buffers.
.TP
\fB\-c\fP or \fB\-\-core\-size\fP
The maximum size of core files created. By setting this limit to zero, core dumps can be disabled.
.TP
\fB\-d\fP or \fB\-\-data\-size\fP
The maximum size of a process\(aq data segment.
.TP
\fB\-e\fP or \fB\-\-nice\fP
Controls the maximum nice value; on Linux, this value is subtracted from 20 to give the effective value.
.TP
\fB\-f\fP or \fB\-\-file\-size\fP
The maximum size of files created by a process.
.TP
\fB\-i\fP or \fB\-\-pending\-signals\fP
The maximum number of signals that may be queued.
.TP
\fB\-l\fP or \fB\-\-lock\-size\fP
The maximum size that may be locked into memory.
.TP
\fB\-m\fP or \fB\-\-resident\-set\-size\fP
The maximum resident set size.
.TP
\fB\-n\fP or \fB\-\-file\-descriptor\-count\fP
The maximum number of open file descriptors.
.TP
\fB\-q\fP or \fB\-\-queue\-size\fP
The maximum size of data in POSIX message queues.
.TP
\fB\-r\fP or \fB\-\-realtime\-priority\fP
The maximum realtime scheduling priority.
.TP
\fB\-s\fP or \fB\-\-stack\-size\fP
The maximum stack size.
.TP
\fB\-t\fP or \fB\-\-cpu\-time\fP
The maximum amount of CPU time in seconds.
.TP
\fB\-u\fP or \fB\-\-process\-count\fP
The maximum number of processes available to the current user.
.TP
\fB\-w\fP or \fB\-\-swap\-size\fP
The maximum swap space available to the current user.
.TP
\fB\-v\fP or \fB\-\-virtual\-memory\-size\fP
The maximum amount of virtual memory available to the shell.
.TP
\fB\-y\fP or \fB\-\-realtime\-maxtime\fP
The maximum contiguous realtime CPU time in microseconds.
.TP
\fB\-K\fP or \fB\-\-kernel\-queues\fP
The maximum number of kqueues (kernel queues) for the current user.
.TP
\fB\-P\fP or \fB\-\-ptys\fP
The maximum number of pseudo\-terminals for the current user.
.TP
\fB\-T\fP or \fB\-\-threads\fP
The maximum number of simultaneous threads for the current user.
.UNINDENT
.sp
Note that not all these limits are available in all operating systems; consult the documentation for \fBsetrlimit\fP in your operating system.
.sp
The value of limit can be a number in the unit specified for the resource or one of the special values \fBhard\fP, \fBsoft\fP, or \fBunlimited\fP, which stand for the current hard limit, the current soft limit, and no limit, respectively.
.sp
If limit is given, it is the new value of the specified resource. If no option is given, then \fB\-f\fP is assumed. Values are in kilobytes, except for \fB\-t\fP, which is in seconds and \fB\-n\fP and \fB\-u\fP, which are unscaled values. The exit status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.
.sp
\fBulimit\fP also accepts the following options that determine what type of limit to set:
.INDENT 0.0
.TP
\fB\-H\fP or \fB\-\-hard\fP
Sets hard resource limit.
.TP
\fB\-S\fP or \fB\-\-soft\fP
Sets soft resource limit.
.UNINDENT
.sp
A hard limit can only be decreased. Once it is set it cannot be increased; a soft limit may be increased up to the value of the hard limit. If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard limits are updated when assigning a new limit value, and the soft limit is used when reporting the current value.
.sp
The following additional options are also understood by \fBulimit\fP:
.INDENT 0.0
.TP
\fB\-a\fP or \fB\-\-all\fP
Prints all current limits.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
The \fBfish\fP implementation of \fBulimit\fP should behave identically to the implementation in bash, except for these differences:
.INDENT 0.0
.IP \(bu 2
Fish \fBulimit\fP supports GNU\-style long options for all switches.
.IP \(bu 2
Fish \fBulimit\fP does not support the \fB\-p\fP option for getting the pipe size. The bash implementation consists of a compile\-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because this method of determining pipe size is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
.IP \(bu 2
Fish \fBulimit\fP does not support getting or setting multiple limits in one command, except reporting all values using the \fB\-a\fP switch.
.UNINDENT
.SS Example
.sp
\fBulimit \-Hs 64\fP sets the hard stack size limit to 64 kB.
.SS umask \- set or get the file creation mode mask
.SS Synopsis
.nf
\fBumask\fP [\fIOPTIONS\fP] [\fIMASK\fP]
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBumask\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man umask\fP\&.
.sp
\fBumask\fP displays and manipulates the \(dqumask\(dq, or file creation mode mask, which is used to restrict the default access to files.
.sp
The umask may be expressed either as an octal number, which represents the rights that will be removed by default, or symbolically, which represents the only rights that will be granted by default.
.sp
Access rights are explained in the manual page for the \fBchmod(1)\fP program.
.sp
With no parameters, the current file creation mode mask is printed as an octal number.
.INDENT 0.0
.TP
\fB\-S\fP or \fB\-\-symbolic\fP
Prints the umask in symbolic form instead of octal form.
.TP
\fB\-p\fP or \fB\-\-as\-command\fP
Outputs the umask in a form that may be reused as input.
.TP
\fB\-h\fP or \fB\-\-help\fP
Displays help about using this command.
.UNINDENT
.sp
If a numeric mask is specified as a parameter, the current shell\(aqs umask will be set to that value, and the rights specified by that mask will be removed from new files and directories by default.
.sp
If a symbolic mask is specified, the desired permission bits, and not the inverse, should be specified. A symbolic mask is a comma separated list of rights. Each right consists of three parts:
.INDENT 0.0
.IP \(bu 2
The first part specifies to whom this set of right applies, and can be one of \fBu\fP, \fBg\fP, \fBo\fP or \fBa\fP, where \fBu\fP specifies the user who owns the file, \fBg\fP specifies the group owner of the file, \fBo\fP specific other users rights and \fBa\fP specifies all three should be changed.
.IP \(bu 2
The second part of a right specifies the mode, and can be one of \fB=\fP, \fB+\fP or \fB\-\fP, where \fB=\fP specifies that the rights should be set to the new value, \fB+\fP specifies that the specified right should be added to those previously specified and \fB\-\fP specifies that the specified rights should be removed from those previously specified.
.IP \(bu 2
The third part of a right specifies what rights should be changed and can be any combination of \fBr\fP, \fBw\fP and \fBx\fP, representing read, write and execute rights.
.UNINDENT
.sp
If the first and second parts are skipped, they are assumed to be \fBa\fP and \fB=\fP, respectively. As an example, \fBr,u+w\fP means all users should have read access and the file owner should also have write access.
.sp
Note that symbolic masks currently do not work as intended.
.SS Example
.sp
\fBumask 177\fP or \fBumask u=rw\fP sets the file creation mask to read and write for the owner and no permissions at all for any other users.
.SS vared \- interactively edit the value of an environment variable
.SS Synopsis
.nf
\fBvared\fP \fIVARIABLE_NAME\fP
.fi
.sp
.SS Description
.sp
\fBvared\fP is used to interactively edit the value of an environment variable. Array variables as a whole can not be edited using \fBvared\fP, but individual list elements can.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.sp
\fBvared PATH[3]\fP edits the third element of the PATH list
.SS wait \- wait for jobs to complete
.SS Synopsis
.nf
\fBwait\fP [\fB\-n\fP | \fB\-\-any\fP] [\fIPID\fP | \fIPROCESS_NAME\fP] \&...
.fi
.sp
.SS Description
.sp
NOTE: This page documents the fish builtin \fBwait\fP\&.
To see the documentation on any non\-fish versions, use \fBcommand man wait\fP\&.
.sp
\fBwait\fP waits for child jobs to complete.
.sp
If a \fIPID\fP is specified, the command waits for the job that the process with that process ID belongs to.
.sp
If a \fIPROCESS_NAME\fP is specified, the command waits for the jobs that the matched processes belong to.
.sp
If neither a pid nor a process name is specified, the command waits for all background jobs.
.sp
If the \fB\-n\fP or \fB\-\-any\fP flag is provided, the command returns as soon as the first job completes. If it is not provided, it returns after all jobs complete.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
sleep 10 &
wait $last_pid
.EE
.UNINDENT
.UNINDENT
.sp
spawns \fBsleep\fP in the background, and then waits until it finishes.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (seq 1 5); sleep 10 &; end
wait
.EE
.UNINDENT
.UNINDENT
.sp
spawns five jobs in the background, and then waits until all of them finish.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (seq 1 5); sleep 10 &; end
hoge &
wait sleep
.EE
.UNINDENT
.UNINDENT
.sp
spawns five \fBsleep\fP jobs and \fBhoge\fP in the background, and then waits until all \fBsleep\fPs finish, and doesn\(aqt wait for \fBhoge\fP\&.
.SS while \- perform a set of commands multiple times
.SS Synopsis
.nf
\fBwhile\fP \fICONDITION\fP\fB;\fP \fICOMMANDS\fP\fB;\fP \fBend\fP
.fi
.sp
.SS Description
.sp
\fBwhile\fP repeatedly executes \fBCONDITION\fP, and if the exit status is 0, then executes \fBCOMMANDS\fP\&.
.sp
The exit status of the \fBwhile\fP loop is the exit status of the last iteration of the \fBCOMMANDS\fP executed, or 0 if none were executed. (This matches other shells and is POSIX\-compatible.)
.sp
You can use and \%<> or or \%<> for complex conditions. Even more complex control can be achieved with \fBwhile true\fP containing a break \%<>\&.
.sp
The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command.
.SS Example
.INDENT 0.0
.INDENT 3.5
.sp
.EX
while test \-f foo.txt; or test \-f bar.txt ; echo file exists; sleep 10; end
# outputs \(aqfile exists\(aq at 10 second intervals,
# as long as the file foo.txt or bar.txt exists.
.EE
.UNINDENT
.UNINDENT
.SS Fish for bash users
.sp
This is to give you a quick overview if you come from bash (or to a lesser extent other shells like zsh or ksh) and want to know how fish differs. Fish is intentionally not POSIX\-compatible and as such some of the things you are used to work differently.
.sp
Many things are similar \- they both fundamentally expand commandlines to execute commands, have pipes, redirections, variables, globs, use command output in various ways. This document is there to quickly show you the differences.
.SS Command substitutions
.sp
Fish spells command substitutions as \fB$(command)\fP or \fB(command)\fP, but not \fB\(gacommand\(ga\fP\&.
.sp
In addition, it only splits them on newlines instead of $IFS. If you want to split on something else, use string split \%<>, string split0 \%<> or string collect \%<>\&. If those are used as the last command in a command substitution the splits they create are carried over. So:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in (find . \-print0 | string split0)
.EE
.UNINDENT
.UNINDENT
.sp
will correctly handle all possible filenames.
.SS Variables
.sp
Fish sets and erases variables with set \%<> instead of \fBVAR=VAL\fP and a variety of separate builtins like \fBdeclare\fP and \fBunset\fP and \fBexport\fP\&. \fBset\fP takes options to determine the scope and exportedness of a variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Define $PAGER *g*lobal and e*x*ported,
# so this is like \(ga\(gaexport PAGER=less\(ga\(ga
set \-gx PAGER less

# Define $alocalvariable only locally,
# like \(ga\(galocal alocalvariable=foo\(ga\(ga
set \-l alocalvariable foo
.EE
.UNINDENT
.UNINDENT
.sp
or to erase variables:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-e PAGER
.EE
.UNINDENT
.UNINDENT
.sp
\fBVAR=VAL\fP statements are available as environment overrides:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
PAGER=cat git log
.EE
.UNINDENT
.UNINDENT
.sp
Fish does not perform word splitting. Once a variable has been set to a value, that value stays as it is, so double\-quoting variable expansions isn\(aqt the necessity it is in bash. [1]
.sp
For instance, here\(aqs bash
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> foo=\(dqbar baz\(dq
> printf \(aq\(dq%s\(dq\en\(aq $foo
# will print two lines, because we didn\(aqt double\-quote
# this is word splitting
\(dqbar\(dq
\(dqbaz\(dq
.EE
.UNINDENT
.UNINDENT
.sp
And here is fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set foo \(dqbar baz\(dq
> printf \(aq\(dq%s\(dq\en\(aq $foo
# foo was set as one element,
# so it will be passed as one element, so this is one line
\(dqbar baz\(dq
.EE
.UNINDENT
.UNINDENT
.sp
All variables are \(dqarrays\(dq (we use the term \(dqlists\(dq), and expanding a variable expands to all its elements, with each element as its own argument (like bash\(aqs \fB\(dq${var[@]}\(dq\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set var \(dqfoo bar\(dq banana
> printf %s\en $var
foo bar
banana
.EE
.UNINDENT
.UNINDENT
.sp
Specific elements of a list can be selected:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo $list[5..7]
.EE
.UNINDENT
.UNINDENT
.sp
The arguments to \fBset\fP are ordinary, so you can also set a variable to the output of a command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Set lines to all the lines in file, one element per line
set lines (cat file)
.EE
.UNINDENT
.UNINDENT
.sp
or a mixture of literal values and output:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set numbers 1 2 3 (seq 5 8) 9
> printf \(aq%s\en\(aq $numbers
1
2
3
5
6
7
8
9
.EE
.UNINDENT
.UNINDENT
.sp
A \fB=\fP is unnecessary and unhelpful with \fBset\fP \- \fBset foo = bar\fP will set the variable \(dqfoo\(dq to two values: \(dq=\(dq and \(dqbar\(dq. \fBset foo=bar\fP will print an error.
.sp
See Shell variables \%<#\:variables> for more.
.IP [1] 5
zsh also does not perform word splitting by default (the SH_WORD_SPLIT option controls this)
.SS Wildcards (globs)
.sp
Fish only supports the \fB*\fP and \fB**\fP glob (and the deprecated \fB?\fP glob) as syntax. If a glob doesn\(aqt match it fails the command (like with bash\(aqs \fBfailglob\fP) unless the command is \fBfor\fP, \fBset\fP or \fBcount\fP or the glob is used with an environment override (\fBVAR=* command\fP), in which case it expands to nothing (like with bash\(aqs \fBnullglob\fP option).
.sp
Globbing doesn\(aqt happen on expanded variables, so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set foo \(dq*\(dq
echo $foo
.EE
.UNINDENT
.UNINDENT
.sp
will not match any files.
.sp
There are no options to control globbing so it always behaves like that.
.sp
The \fB**\fP glob will match in subdirectories as well. In other shells this often needs to be turned on with an option, like \fBsetopt globstar\fP in bash.
.sp
Unlike bash, fish will also follow symlinks, and will sort the results in a natural sort, with included numbers compared as numbers. That means it will sort e.g. music tracks correctly even if they have numbers like \fB1\fP instead of \fB01\fP\&.
.sp
See Wildcards \%<#\:expand-wildcard> for more.
.SS Quoting
.sp
Fish has two quoting styles: \fB\(dq\(dq\fP and \fB\(aq\(aq\fP\&. Variables are expanded in double\-quotes, nothing is expanded in single\-quotes.
.sp
There is no \fB$\(aq\(aq\fP, instead the sequences that would transform are transformed \fIwhen unquoted\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo a\enb
a
b
.EE
.UNINDENT
.UNINDENT
.sp
See Quotes \%<#\:quotes> for more.
.SS String manipulation
.sp
Fish does not have \fB${foo%bar}\fP, \fB${foo#bar}\fP and \fB${foo/bar/baz}\fP\&. Instead string manipulation is done by the string \%<> builtin.
.sp
For example, to replace \(dqbar\(dq with \(dqbaz\(dq:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> string replace bar baz \(dqbar luhrmann\(dq
baz luhrmann
.EE
.UNINDENT
.UNINDENT
.sp
It can also split strings:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> string split \(dq,\(dq \(dqfoo,bar\(dq
foo
bar
.EE
.UNINDENT
.UNINDENT
.sp
Match regular expressions as a replacement for \fBgrep\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo bababa | string match \-r \(aqaba$\(aq
aba
.EE
.UNINDENT
.UNINDENT
.sp
Pad strings to a given width, with arbitrary characters:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> string pad \-c x \-w 20 \(dqfoo\(dq
xxxxxxxxxxxxxxxxxfoo
.EE
.UNINDENT
.UNINDENT
.sp
Make strings lower/uppercase:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> string lower Foo
foo

> string upper Foo
FOO
.EE
.UNINDENT
.UNINDENT
.sp
repeat strings, trim strings, escape strings or print a string\(aqs length or width (in terminal cells).
.SS Special variables
.sp
Some bash variables and their closest fish equivalent:
.INDENT 0.0
.IP \(bu 2
\fB$*\fP, \fB$@\fP, \fB$1\fP and so on: \fB$argv\fP
.IP \(bu 2
\fB$?\fP: \fB$status\fP
.IP \(bu 2
\fB$$\fP: \fB$fish_pid\fP
.IP \(bu 2
\fB$#\fP: No variable, instead use \fBcount $argv\fP
.IP \(bu 2
\fB$!\fP: \fB$last_pid\fP
.IP \(bu 2
\fB$0\fP: \fBstatus filename\fP
.IP \(bu 2
\fB$\-\fP: Mostly \fBstatus is\-interactive\fP and \fBstatus is\-login\fP
.UNINDENT
.SS Process substitution
.sp
Instead of \fB<(command)\fP fish uses \fB(command | psub)\fP\&. There is no equivalent to \fB>(command)\fP\&.
.sp
Note that both of these are bashisms, and most things can easily be expressed without. E.g. instead of:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
source (command | psub)
.EE
.UNINDENT
.UNINDENT
.sp
Use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
command | source
.EE
.UNINDENT
.UNINDENT
.sp
as fish\(aqs source \%<> can read from stdin.
.SS Heredocs
.sp
Fish does not have \fB<<EOF\fP \(dqheredocs\(dq. Instead of
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cat <<EOF
some string
some more string
EOF
.EE
.UNINDENT
.UNINDENT
.sp
use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
printf %s\en \(dqsome string\(dq \(dqsome more string\(dq
.EE
.UNINDENT
.UNINDENT
.sp
or:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(dqsome string
some more string\(dq

# or if you want the quotes on separate lines:

echo \(dq\e
some string
some more string\e
\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Quotes are followed across newlines.
.sp
What \(dqheredocs\(dq do is:
.INDENT 0.0
.IP 1. 3
Read/interpret the string, with special rules, up to the terminator. [2]
.IP 2. 3
Write the resulting string to a temporary file.
.IP 3. 3
Start the command the heredoc is attached to with that file as stdin.
.UNINDENT
.sp
This means it is essentially the same as just reading from a pipe, so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(dqfoo\(dq | cat
.EE
.UNINDENT
.UNINDENT
.sp
is mostly the same as
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cat <<EOF
foo
EOF
.EE
.UNINDENT
.UNINDENT
.sp
Like with heredocs, the command has to be prepared to read from stdin. Sometimes this requires special options to be used, often giving a filename of \fB\-\fP turns it on.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \(dqxterm
rxvt\-unicode\(dq | pacman \-\-remove \-

# is the same as (the \(ga\-\(ga makes pacman read arguments from stdin)
pacman \-\-remove xterm rxvt\-unicode
.EE
.UNINDENT
.UNINDENT
.sp
and could be written in other shells as
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# This \(dq\-\(dq is still necessary \- the heredoc is *also* passed over stdin!
pacman \-\-remove \- << EOF
xterm
rxvt\-unicode
EOF
.EE
.UNINDENT
.UNINDENT
.sp
So heredocs really are minor syntactical sugar that introduces a lot of special rules, which is why fish doesn\(aqt have them. Pipes are a core concept, and are simpler and compose nicer.
.IP [2] 5
For example, the \(dqEOF\(dq is just a convention, the terminator can be an arbitrary string, something like \(dqTHISISTHEEND\(dq also works. And using \fB<<\-\fP trims leading \fItab\fP characters (but not other whitespace), so you can indent the lines, but only with tabs. Substitutions (variables, commands) are done on the heredoc by default, but not if the terminator is quoted: \fBcat << \(dqEOF\(dq\fP\&.
.SS Test (\fBtest\fP, \fB[\fP, \fB[[\fP)
.sp
Fish has a POSIX\-compatible \fBtest\fP or \fB[\fP builtin. There is no \fB[[\fP and \fBtest\fP does not accept \fB==\fP as a synonym for \fB=\fP\&. It can compare floating point numbers, however.
.sp
\fBset \-q\fP can be used to determine if a variable exists or has a certain number of elements (\fBset \-q foo[2]\fP).
.SS Arithmetic Expansion
.sp
Fish does not have \fB$((i+1))\fP arithmetic expansion, computation is handled by math \%<>:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
math $i + 1
.EE
.UNINDENT
.UNINDENT
.sp
Unlike bash\(aqs arithmetic, it can handle floating point numbers:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> math 5 / 2
2.5
.EE
.UNINDENT
.UNINDENT
.sp
And also has some functions, like for trigonometry:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> math cos 2 x pi
1
.EE
.UNINDENT
.UNINDENT
.sp
You can pass arguments to \fBmath\fP separately like above or in quotes. Because fish uses \fB()\fP parentheses for command substitutions, quoting is needed if you want to use them in your expression:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> math \(aq(5 + 2) * 4\(aq
.EE
.UNINDENT
.UNINDENT
.sp
Both \fB*\fP and \fBx\fP are valid ways to spell multiplication, but \fB*\fP needs to be quoted because it looks like a glob\&.
.SS Prompts
.sp
Fish does not use the \fB$PS1\fP, \fB$PS2\fP and so on variables. Instead the prompt is the output of the fish_prompt \%<> function, plus the fish_mode_prompt \%<> function if vi mode \%<#\:vi-mode> is enabled. The output of the fish_right_prompt \%<> function is used for the right\-sided prompt.
.sp
As an example, here\(aqs a relatively simple bash prompt:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# <$HOSTNAME> <$PWD in blue> <Prompt Sign in Yellow> <Rest in default light white>
PS1=\(aq\eh\e[\ee[1;34m\e]\ew\e[\ee[m\e] \e[\ee[1;32m\e]\e$\e[\ee[m\e] \(aq
.EE
.UNINDENT
.UNINDENT
.sp
and a rough fish equivalent:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    set \-l prompt_symbol \(aq$\(aq
    fish_is_root_user; and set prompt_symbol \(aq#\(aq

    echo \-s (prompt_hostname) \e
    (set_color blue) (prompt_pwd) \e
    (set_color yellow) $prompt_symbol (set_color \-\-reset)
end
.EE
.UNINDENT
.UNINDENT
.sp
This shows a few differences:
.INDENT 0.0
.IP \(bu 2
Fish provides set_color \%<> to color text. It can use the 16 named colors and also RGB sequences (so you could also use \fBset_color 5555FF\fP)
.IP \(bu 2
Instead of introducing specific escapes like \fB\eh\fP for the hostname, the prompt is a function. To achieve the effect of \fB\eh\fP, fish provides helper functions like prompt_hostname \%<>, which prints a shortened version of the hostname.
.IP \(bu 2
Fish offers other helper functions for adding things to the prompt, like fish_vcs_prompt \%<> for adding a display for common version control systems (git, mercurial, svn), and prompt_pwd \%<> for showing a shortened \fB$PWD\fP (the user\(aqs home directory becomes \fB~\fP and any path component is shortened).
.UNINDENT
.sp
The default prompt is reasonably full\-featured and its code can be read via \fBtype fish_prompt\fP\&.
.sp
Fish does not have \fB$PS2\fP for continuation lines, instead it leaves the lines indented to show that the commandline isn\(aqt complete yet.
.SS Blocks and loops
.sp
Fish\(aqs blocking constructs look a little different. They all start with a word, end in \fBend\fP and don\(aqt have a second starting word:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for i in 1 2 3; do
   echo $i
done

# becomes

for i in 1 2 3
   echo $i
end

while true; do
   echo Weeee
done

# becomes

while true
   echo Weeeeeee
end

{
   echo Hello
}

# becomes

begin
   echo Hello
end

if true; then
   echo Yes I am true
else
   echo \(dqHow is true not true?\(dq
fi

# becomes

if true
   echo Yes I am true
else
   echo \(dqHow is true not true?\(dq
end

foo() {
   echo foo
}

# becomes

function foo
    echo foo
end

# (bash allows the word \(dqfunction\(dq,
#  but this is an extension)
.EE
.UNINDENT
.UNINDENT
.sp
Fish does not have an \fBuntil\fP\&. Use \fBwhile not\fP or \fBwhile !\fP\&.
.SS Subshells
.sp
Bash has a feature called \(dqsubshells\(dq, where it will start another shell process for certain things. That shell will then be independent and e.g. any changes it makes to variables won\(aqt be visible in the main shell.
.sp
This includes things like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# A list of commands in \(ga()\(ga parentheses
(foo; bar) | baz

# Both sides of a pipe
foo | while read \-r bar; do
    # This will not be visible outside of the loop.
    VAR=VAL
    # This background process will not be, either
    baz &
done
.EE
.UNINDENT
.UNINDENT
.sp
Fish does not currently have subshells. You will have to find a different solution. The isolation can usually be achieved by scoping variables (with \fBset \-l\fP), but if you really do need to run your code in a new shell environment you can use \fBfish \-c \(aqyour code here\(aq\fP to do so explicitly.
.sp
\fB()\fP subshells are often confused with \fB{}\fP grouping, which does \fInot\fP use a subshell. When you just need to group, you can use \fBbegin; end\fP in fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
(foo; bar) | baz
# when it should really have been:
{ foo; bar; } | baz
# becomes
begin; foo; bar; end | baz
.EE
.UNINDENT
.UNINDENT
.sp
The pipe will be run in the same process, so \fBwhile read\fP loops can set variables outside:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
foo | while read bar
    set \-g VAR VAL
    baz &
end

echo $VAR # will print VAL
jobs # will show \(dqbaz\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Subshells are also frequently confused with command substitutions, which bash writes as \fB\(gacommand\(ga\fP or \fB$(command)\fP and fish writes as \fB$(command)\fP or \fB(command)\fP\&. Bash also \fIuses\fP subshells to implement them.
.SS Builtins and other commands
.sp
By now it has become apparent that fish puts much more of a focus on its builtins and external commands rather than its syntax. So here are some helpful builtins and their rough equivalent in bash:
.INDENT 0.0
.IP \(bu 2
string \%<> \- this replaces most of the string transformation (\fB${i%foo}\fP et al) and can also be used instead of \fBgrep\fP and \fBsed\fP and such.
.IP \(bu 2
math \%<> \- this replaces \fB$((i + 1))\fP arithmetic and can also do floats and some simple functions (sine and friends).
.IP \(bu 2
argparse \%<> \- this can handle a script\(aqs option parsing, for which bash would probably use \fBgetopt\fP (zsh provides \fBzparseopts\fP).
.IP \(bu 2
count \%<> can be used to count things and therefore replaces \fB$#\fP and can be used instead of \fBwc\fP\&.
.IP \(bu 2
status \%<> provides information about the shell status, e.g. if it\(aqs interactive or what the current linenumber is. This replaces \fB$\-\fP and \fB$BASH_LINENO\fP and other variables.
.IP \(bu 2
\fBseq(1)\fP can be used as a replacement for \fB{1..10}\fP range expansion. If your OS doesn\(aqt ship a \fBseq\fP fish includes a replacement function.
.UNINDENT
.SS Other facilities
.sp
Bash has \fBset \-x\fP or \fBset \-o xtrace\fP to print all commands that are being executed. In fish, this would be enabled by setting \fBfish_trace\fP \%<#\:envvar-fish_trace>\&.
.sp
Or, if your intention is to \fIprofile\fP how long each line of a script takes, you can use \fBfish \-\-profile\fP \- see the page for the fish command \%<>\&.
.SS Tutorial
.SS Why fish?
.sp
Fish is a fully\-equipped command line shell (like bash or zsh) that is smart and user\-friendly. Fish supports powerful features like syntax highlighting, autosuggestions, and tab completions that just work, with nothing to learn or configure.
.sp
If you want to make your command line more productive, more useful, and more fun, without learning a bunch of arcane syntax and configuration options, then fish might be just what you\(aqre looking for!
.SS Getting started
.sp
Once installed, just type in \fBfish\fP into your current shell to try it out!
.sp
You will be greeted by the standard fish prompt,
which means you are all set up and can start using fish:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
you@hostname ~>
.EE
.UNINDENT
.UNINDENT
.sp
This prompt that you see above is the fish default prompt: it shows your username, hostname, and working directory. You can customize it, see how to change your prompt \%<#\:prompt>\&.
.sp
From now on, we\(aqll pretend your prompt is just a \fB>\fP to save space.
.SS Learning fish
.sp
This tutorial assumes a basic understanding of command line shells and Unix commands, and that you have a working copy of fish.
.sp
If you have a strong understanding of other shells, and want to know what fish does differently, search for the magic phrase \fIunlike other shells\fP, which is used to call out important differences.
.sp
Or, if you want a quick overview over the differences to other shells like Bash, see Fish For Bash Users \%<>\&.
.sp
For the full, detailed description of how to use fish interactively, see Interactive Use \%<>\&.
.sp
For a comprehensive description of fish\(aqs scripting language, see The Fish Language \%<>\&.
.SS Running Commands
.sp
Fish runs commands like other shells: you type a command, followed by its arguments. Spaces are separators:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo hello world
hello world
.EE
.UNINDENT
.UNINDENT
.sp
This runs the command \fBecho\fP with the arguments \fBhello\fP and \fBworld\fP\&. In this case that\(aqs the same as one argument \fBhello world\fP, but in many cases it\(aqs not. If you need to pass an argument that includes a space, you can escape \%<#\:escapes> with a backslash, or quote \%<#\:quotes> it using single or double quotes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> mkdir My\e Files
# Makes a directory called \(dqMy Files\(dq, with a space in the name
> cp ~/Some\e File \(aqMy Files\(aq
# Copies a file called \(dqSome File\(dq in the home directory to \(dqMy Files\(dq
> ls \(dqMy Files\(dq
Some File
.EE
.UNINDENT
.UNINDENT
.SS Getting Help
.sp
Run \fBhelp\fP to open fish\(aqs help in a web browser, and \fBman\fP with the page (like \fBfish\-language\fP) to open it in a man page. You can also ask for help with a specific command, for example, \fBhelp set\fP to open in a web browser, or \fBman set\fP to see it in the terminal.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> man set
set \- handle shell variables
  Synopsis...
.EE
.UNINDENT
.UNINDENT
.sp
To open this section, use \fBhelp getting\-help\fP\&.
.sp
This only works for fish\(aqs own documentation for itself and its built\-in commands (the \(dqbuiltins\(dq). For any other commands on your system, they should provide their own documentation, often in the man system. For example \fBman ls\fP should tell you about your computer\(aqs \fBls\fP command.
.SS Syntax Highlighting
.sp
You\(aqll quickly notice that fish performs syntax highlighting as you type. Invalid commands are colored red by default:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> /bin/mkd
.EE
.UNINDENT
.UNINDENT
.sp
A command may be invalid because it does not exist, or refers to a file that you cannot execute. When the command becomes valid, it is shown in a different color:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> /bin/mkdir
.EE
.UNINDENT
.UNINDENT
.sp
Valid file paths are underlined as you type them:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cat ~/somefi
.EE
.UNINDENT
.UNINDENT
.sp
This tells you that there exists a file that starts with \fBsomefi\fP, which is useful feedback as you type.
.sp
These colors, and many more, can be changed by running \fBfish_config\fP, or by modifying color variables \%<#\:variables-color> directly.
.sp
For example, if you want to disable (almost) all coloring:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_config theme choose none
.EE
.UNINDENT
.UNINDENT
.sp
This picks the \(dqnone\(dq theme. To see all themes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_config theme show
.EE
.UNINDENT
.UNINDENT
.sp
Just running \fBfish_config\fP will open up a browser interface that allows you to pick from the available themes.
.SS Autosuggestions
.sp
As you type fish will suggest commands to the right of the cursor, in gray. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> /bin/hostname
.EE
.UNINDENT
.UNINDENT
.sp
It knows about paths and options:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> grep \-\-ignore\-case
.EE
.UNINDENT
.UNINDENT
.sp
And history too. Type a command once, and you can re\-summon it by just typing a few letters:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> rsync \-avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo
.EE
.UNINDENT
.UNINDENT
.sp
To accept the autosuggestion, hit \fBright\fP (\fB→\fP) or \fBctrl\fP\-\fBf\fP\&. To accept a single word of the autosuggestion, \fBalt\fP\-\fBright\fP (\fB→\fP). If the autosuggestion is not what you want, just ignore it.
.sp
If you don\(aqt like autosuggestions, you can disable them by setting \fB$fish_autosuggestion_enabled\fP to 0:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_autosuggestion_enabled 0
.EE
.UNINDENT
.UNINDENT
.SS Tab Completions
.sp
A rich set of tab completions work \(dqout of the box\(dq.
.sp
Press \fBtab\fP and fish will attempt to complete the command, argument, or path:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> /pri\fBtab\fP => /private/
.EE
.UNINDENT
.UNINDENT
.sp
If there\(aqs more than one possibility, it will list them:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> ~/stuff/s\fBtab\fP
~/stuff/script.sh  (command)  ~/stuff/sources/  (directory)
.EE
.UNINDENT
.UNINDENT
.sp
Hit tab again to cycle through the possibilities. The part in parentheses there (that \(dqcommand\(dq and \(dqdirectory\(dq) is the completion description. It\(aqs just a short hint to explain what kind of argument it is.
.sp
fish can also complete many commands, like git branches:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> git merge pr\fBtab\fP => git merge prompt_designer
> git checkout b\fBtab\fP
builtin_list_io_merge (Branch)  builtin_set_color (Branch) busted_events (Tag)
.EE
.UNINDENT
.UNINDENT
.sp
Try hitting tab and see what fish can do!
.SS Variables
.sp
Like other shells, a dollar sign followed by a variable name is replaced with the value of that variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo My home directory is $HOME
My home directory is /home/tutorial
.EE
.UNINDENT
.UNINDENT
.sp
This is known as variable substitution, and it also happens in double quotes, but not single quotes:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo \(dqMy current directory is $PWD\(dq
My current directory is /home/tutorial
> echo \(aqMy current directory is $PWD\(aq
My current directory is $PWD
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, fish has an ordinary command to set variables: \fBset\fP, which takes a variable name, and then its value.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set name \(aqMister Noodle\(aq
> echo $name
Mister Noodle
.EE
.UNINDENT
.UNINDENT
.sp
(Notice the quotes: without them, \fBMister\fP and \fBNoodle\fP would have been separate arguments, and \fB$name\fP would have been made into a list of two elements.)
.sp
Unlike other shells, variables are not further split after substitution:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> mkdir $name
> ls
Mister Noodle
.EE
.UNINDENT
.UNINDENT
.sp
In bash, this would have created two directories \(dqMister\(dq and \(dqNoodle\(dq. In fish, it created only one: the variable had the value \(dqMister Noodle\(dq, so that is the argument that was passed to \fBmkdir\fP, spaces and all.
.sp
You can erase (or \(dqdelete\(dq) a variable with \fB\-e\fP or \fB\-\-erase\fP
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-e MyVariable
> env | grep MyVariable
(no output)
.EE
.UNINDENT
.UNINDENT
.sp
For more, see Variable expansion \%<#\:expand-variable>\&.
.SS Exports (Shell Variables)
.sp
Sometimes you need to have a variable available to an external command, often as a setting. For example many programs like \fBgit\fP or \fBman\fP read the \fB$PAGER\fP variable to figure out your preferred pager (the program that lets you scroll text). Other variables used like this include \fB$BROWSER\fP, \fB$LANG\fP (to configure your language) and \fB$PATH\fP\&. You\(aqll note these are written in ALLCAPS, but that\(aqs just a convention.
.sp
To give a variable to an external command, it needs to be \(dqexported\(dq. This is done with a flag to \fBset\fP, either \fB\-\-export\fP or just \fB\-x\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-x MyVariable SomeValue
> env | grep MyVariable
MyVariable=SomeValue
.EE
.UNINDENT
.UNINDENT
.sp
It can also be unexported with \fB\-\-unexport\fP or \fB\-u\fP\&.
.sp
This works the other way around as well! If fish is started by something else, it inherits that parents exported variables. So if your terminal emulator starts fish, and it exports \fB$LANG\fP set to \fBen_US.UTF\-8\fP, fish will receive that setting. And whatever started your terminal emulator also gave \fIit\fP some variables that it will then pass on unless it specifically decides not to. This is how fish usually receives the values for things like \fB$LANG\fP, \fB$PATH\fP and \fB$TERM\fP, without you having to specify them again.
.sp
Exported variables can be local or global or universal \- \(dqexported\(dq is not a scope \%<#\:variables-scope>! Usually you\(aqd make them global via \fBset \-gx MyVariable SomeValue\fP\&.
.sp
For more, see Exporting variables \%<#\:variables-export>\&.
.SS Lists
.sp
The \fBset\fP command above used quotes to ensure that \fBMister Noodle\fP was one argument. If it had been two arguments, then \fBname\fP would have been a list of length 2.  In fact, all variables in fish are really lists, that can contain any number of values, or none at all.
.sp
Some variables, like \fB$PWD\fP, only have one value. By convention, we talk about that variable\(aqs value, but we really mean its first (and only) value.
.sp
Other variables, like \fB$PATH\fP, really do have multiple values. During variable expansion, the variable expands to become multiple arguments:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo $PATH
/usr/bin /bin /usr/sbin /sbin /usr/local/bin
.EE
.UNINDENT
.UNINDENT
.sp
Variables whose name ends in \(dqPATH\(dq are automatically split on colons to become lists. They are joined using colons when exported to subcommands. This is for compatibility with other tools, which expect $PATH to use colons. You can also explicitly add this quirk to a variable with \fBset \-\-path\fP, or remove it with \fBset \-\-unpath\fP\&.
.sp
Lists cannot contain other lists: there is no recursion.  A variable is a list of strings, full stop.
.sp
Get the length of a list with \fBcount\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> count $PATH
5
.EE
.UNINDENT
.UNINDENT
.sp
You can append (or prepend) to a list by setting the list to itself, with some additional arguments. Here we append /usr/local/bin to $PATH:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set PATH $PATH /usr/local/bin
.EE
.UNINDENT
.UNINDENT
.sp
You can access individual elements with square brackets. Indexing starts at 1 from the beginning, and \-1 from the end:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo $PATH
/usr/bin /bin /usr/sbin /sbin /usr/local/bin
> echo $PATH[1]
/usr/bin
> echo $PATH[\-1]
/usr/local/bin
.EE
.UNINDENT
.UNINDENT
.sp
You can also access ranges of elements, known as \(dqslices\(dq:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo $PATH[1..2]
/usr/bin /bin
> echo $PATH[\-1..2]
/usr/local/bin /sbin /usr/sbin /bin
.EE
.UNINDENT
.UNINDENT
.sp
You can iterate over a list (or a slice) with a for loop:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for val in $PATH
  echo \(dqentry: $val\(dq
end
# Will print:
# entry: /usr/bin/
# entry: /bin
# entry: /usr/sbin
# entry: /sbin
# entry: /usr/local/bin
.EE
.UNINDENT
.UNINDENT
.sp
One particular bit is that you can use lists like Brace expansion \%<#\:expand-brace>\&. If you attach another string to a list, it\(aqll combine every element of the list with the string:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set mydirs /usr/bin /bin
> echo $mydirs/fish # this is just like {/usr/bin,/bin}/fish
/usr/bin/fish /bin/fish
.EE
.UNINDENT
.UNINDENT
.sp
This also means that, if the list is empty, there will be no argument:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set empty # no argument
> echo $empty/this_is_gone # prints an empty line
.EE
.UNINDENT
.UNINDENT
.sp
If you quote the list, it will be used as one string and so you\(aqll get one argument even if it is empty.
.sp
For more, see Lists \%<#\:variables-lists>\&.
For more on combining lists with strings (or even other lists), see cartesian products \%<#\:cartesian-product> and Variable expansion \%<#\:expand-variable>\&.
.SS Wildcards
.sp
Fish supports the familiar wildcard \fB*\fP\&. To list all JPEG files:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> ls *.jpg
lena.jpg
meena.jpg
santa maria.jpg
.EE
.UNINDENT
.UNINDENT
.sp
You can include multiple wildcards:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> ls l*.p*
lena.png
lesson.pdf
.EE
.UNINDENT
.UNINDENT
.sp
The recursive wildcard \fB**\fP searches directories recursively:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> ls /var/**.log
/var/log/system.log
/var/run/sntp.log
.EE
.UNINDENT
.UNINDENT
.sp
If that directory traversal is taking a long time, you can \fBctrl\fP\-\fBc\fP out of it.
.sp
For more, see Wildcards \%<#\:expand-wildcard>\&.
.SS Pipes and Redirections
.sp
You can pipe between commands with the usual vertical bar:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo hello world | wc
      1       2      12
.EE
.UNINDENT
.UNINDENT
.sp
stdin and stdout can be redirected via the familiar \fB<\fP and \fB>\fP\&. stderr is redirected with a \fB2>\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> grep fish < /etc/shells > ~/output.txt 2> ~/errors.txt
.EE
.UNINDENT
.UNINDENT
.sp
To redirect stdout and stderr into one file, you can use \fB&>\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> make &> make_output.txt
.EE
.UNINDENT
.UNINDENT
.sp
For more, see Input and output redirections \%<#\:redirects> and Pipes \%<#\:pipes>\&.
.SS Command Substitutions
.sp
Command substitutions use the output of one command as an argument to another. Unlike other shells, fish does not use backticks \(ga\(ga for command substitutions. Instead, it uses parentheses with or without a dollar:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo In (pwd), running $(uname)
In /home/tutorial, running FreeBSD
.EE
.UNINDENT
.UNINDENT
.sp
A common idiom is to capture the output of a command in a variable:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set os (uname)
> echo $os
Linux
.EE
.UNINDENT
.UNINDENT
.sp
Command substitutions without a dollar are not expanded within quotes, so the version with a dollar is simpler:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> touch \(dqtesting_$(date +%s).txt\(dq
> ls *.txt
testing_1360099791.txt
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, fish does not split command substitutions on any whitespace (like spaces or tabs), only newlines. Usually this is a big help because unix commands operate on a line\-by\-line basis. Sometimes it can be an issue with commands like \fBpkg\-config\fP that print what is meant to be multiple arguments on a single line. To split it on spaces too, use \fBstring split\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> printf \(aq%s\en\(aq (pkg\-config \-\-libs gio\-2.0)
\-lgio\-2.0 \-lgobject\-2.0 \-lglib\-2.0
> printf \(aq%s\en\(aq (pkg\-config \-\-libs gio\-2.0 | string split \-n \(dq \(dq)
\-lgio\-2.0
\-lgobject\-2.0
\-lglib\-2.0
.EE
.UNINDENT
.UNINDENT
.sp
If you need a command substitutions output as one argument, without any splits, use quoted command substitution:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo \(dqfirst line
second line\(dq > myfile
> set myfile \(dq$(cat myfile)\(dq
> printf \(aq|%s|\(aq $myfile
|first line
second line|
.EE
.UNINDENT
.UNINDENT
.sp
For more, see Command substitution \%<#\:expand-command-substitution>\&.
.SS Separating Commands (Semicolon)
.sp
Like other shells, fish allows multiple commands either on separate lines or the same line.
.sp
To write them on the same line, use the semicolon (\(dq;\(dq). That means the following two examples are equivalent:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo fish; echo chips

# or
echo fish
echo chips
.EE
.UNINDENT
.UNINDENT
.sp
This is useful interactively to enter multiple commands. In a script it\(aqs easier to read if the commands are on separate lines.
.SS Exit Status
.sp
When a command exits, it returns a status code as a non\-negative integer (that\(aqs a whole number >= 0).
.sp
Unlike other shells, fish stores the exit status of the last command in \fB$status\fP instead of \fB$?\fP\&.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> false
> echo $status
1
.EE
.UNINDENT
.UNINDENT
.sp
This indicates how the command fared \- 0 usually means success, while the others signify kinds of failure. For instance fish\(aqs \fBset \-\-query\fP returns the number of variables it queried that weren\(aqt set \- \fBset \-\-query PATH\fP usually returns 0, \fBset \-\-query arglbargl boogagoogoo\fP usually returns 2.
.sp
There is also a \fB$pipestatus\fP list variable for the exit statuses [1] of processes in a pipe.
.sp
For more, see The status variable \%<#\:variables-status>\&.
.IP [1] 5
or \(dqstati\(dq if you prefer, or \(dqstatūs\(dq if you\(aqve time\-travelled from ancient Rome or work as a latin teacher
.SS Combiners (And, Or, Not)
.sp
fish supports the familiar \fB&&\fP and \fB||\fP to combine commands, and \fB!\fP to negate them:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> ./configure && make && sudo make install
.EE
.UNINDENT
.UNINDENT
.sp
Here, \fBmake\fP is only executed if \fB\&./configure\fP succeeds (returns 0), and \fBsudo make install\fP is only executed if both \fB\&./configure\fP and \fBmake\fP succeed.
.sp
fish also supports and \%<>, or \%<>, and not \%<>\&. The first two are job modifiers and have lower precedence. Example usage:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cp file1 file1_bak && cp file2 file2_bak; and echo \(dqBackup successful\(dq; or echo \(dqBackup failed\(dq
Backup failed
.EE
.UNINDENT
.UNINDENT
.sp
As mentioned in the section on the semicolon, this can also be written in multiple lines, like so:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cp file1 file1_bak && cp file2 file2_bak
and echo \(dqBackup successful\(dq
or echo \(dqBackup failed\(dq
.EE
.UNINDENT
.UNINDENT
.SS Conditionals (If, Else, Switch)
.sp
Use if \%<> and else \%<> to conditionally execute code, based on the exit status of a command.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if grep fish /etc/shells
    echo Found fish
else if grep bash /etc/shells
    echo Found bash
else
    echo Got nothing
end
.EE
.UNINDENT
.UNINDENT
.sp
To compare strings or numbers or check file properties (whether a file exists or is writeable and such), use test \%<>, like
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if test \(dq$fish\(dq = \(dqflounder\(dq
    echo FLOUNDER
end

# or

if test \(dq$number\(dq \-gt 5
    echo $number is greater than five
else
    echo $number is five or less
end

# or

# This test is true if the path /etc/hosts exists
# \- it could be a file or directory or symlink (or possibly something else).
if test \-e /etc/hosts
    echo We most likely have a hosts file
else
    echo We do not have a hosts file
end
.EE
.UNINDENT
.UNINDENT
.sp
Combiners can also be used to make more complex conditions, like
.INDENT 0.0
.INDENT 3.5
.sp
.EX
if command \-sq fish; and grep fish /etc/shells
    echo fish is installed and configured
end
.EE
.UNINDENT
.UNINDENT
.sp
For even more complex conditions, use begin \%<> and end \%<> to group parts of them.
.sp
There is also a switch \%<> command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
switch (uname)
case Linux
    echo Hi Tux!
case Darwin
    echo Hi Hexley!
case FreeBSD NetBSD DragonFly
    echo Hi Beastie!
case \(aq*\(aq
    echo Hi, stranger!
end
.EE
.UNINDENT
.UNINDENT
.sp
As you see, case \%<> does not fall through, and can accept multiple arguments or (quoted) wildcards.
.sp
For more, see Conditions \%<#\:syntax-conditional>\&.
.SS Functions
.sp
A fish function is a list of commands, which may optionally take arguments. Unlike other shells, arguments are not passed in \(dqnumbered variables\(dq like \fB$1\fP, but instead in a single list \fB$argv\fP\&. To create a function, use the function \%<> builtin:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function say_hello
    echo Hello $argv
end
say_hello
# prints: Hello
say_hello everybody!
# prints: Hello everybody!
.EE
.UNINDENT
.UNINDENT
.sp
Unlike other shells, fish does not have aliases or special prompt syntax. Functions take their place. [2]
.sp
You can list the names of all functions with the functions \%<> builtin (note the plural!). fish starts out with a number of functions:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> functions
N_, abbr, alias, bg, cd, cdh, contains_seq, dirh, dirs, disown, down\-or\-search, edit_command_buffer, export, fg, fish_add_path, fish_breakpoint_prompt, fish_clipboard_copy, fish_clipboard_paste, fish_config, fish_default_key_bindings, fish_default_mode_prompt, fish_git_prompt, fish_hg_prompt, fish_hybrid_key_bindings, fish_indent, fish_is_root_user, fish_job_summary, fish_key_reader, fish_md5, fish_mode_prompt, fish_npm_helper, fish_opt, fish_print_git_action, fish_print_hg_root, fish_prompt, fish_sigtrap_handler, fish_svn_prompt, fish_title, fish_update_completions, fish_vcs_prompt, fish_vi_cursor, fish_vi_key_bindings, funced, funcsave, grep, help, history, hostname, isatty, kill, la, ll, ls, man, nextd, open, popd, prevd, prompt_hostname, prompt_pwd, psub, pushd, realpath, seq, setenv, suspend, trap, type, umask, up\-or\-search, vared, wait
.EE
.UNINDENT
.UNINDENT
.sp
You can see the source for any function by passing its name to \fBfunctions\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> functions ls
function ls \-\-description \(aqList contents of directory\(aq
    command ls \-G $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
For more, see Functions \%<#\:syntax-function>\&.
.IP [2] 5
There is a function called alias \%<>, but it\(aqs just a shortcut to make functions. fish also provides abbreviations \%<#\:abbreviations>, through the abbr \%<> command.
.SS Loops
.sp
While loops:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
while true
    echo \(dqLoop forever\(dq
end
# Prints:
# Loop forever
# Loop forever
# Loop forever
# yes, this really will loop forever. Unless you abort it with ctrl\-c.
.EE
.UNINDENT
.UNINDENT
.sp
For loops can be used to iterate over a list. For example, a list of files:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for file in *.txt
    cp $file $file.bak
end
.EE
.UNINDENT
.UNINDENT
.sp
Iterating over a list of numbers can be done with \fBseq\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
for x in (seq 5)
    touch file_$x.txt
end
.EE
.UNINDENT
.UNINDENT
.sp
For more, see Loops and blocks \%<#\:syntax-loops-and-blocks>\&.
.SS Prompt
.sp
Unlike other shells, there is no prompt variable like \fBPS1\fP\&. To display your prompt, fish executes the fish_prompt \%<> function and uses its output as the prompt. And if it exists, fish also executes the fish_right_prompt \%<> function and uses its output as the right prompt.
.sp
You can define your own prompt from the command line:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> function fish_prompt; echo \(dqNew Prompt % \(dq; end
New Prompt % _
.EE
.UNINDENT
.UNINDENT
.sp
Then, if you are happy with it, you can save it to disk by typing \fBfuncsave fish_prompt\fP\&. This saves the prompt in \fB~/.config/fish/functions/fish_prompt.fish\fP\&. (Or, if you want, you can create that file manually from the start.)
.sp
Multiple lines are OK. Colors can be set via set_color \%<> by passing it named ANSI colors, or hex RGB values:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    set_color purple
    date \(dq+%m/%d/%y\(dq
    set_color FF0000
    echo (pwd) \(aq>\(aq (set_color \-\-reset)
end
.EE
.UNINDENT
.UNINDENT
.sp
This prompt would look like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
02/06/13
/home/tutorial > _
.EE
.UNINDENT
.UNINDENT
.sp
See also Writing your own prompt \%<>\&.
.sp
You can choose among sample prompts by running \fBfish_config\fP for a web UI or \fBfish_config prompt\fP for a simpler version inside your terminal.
.SS $PATH
.sp
\fB$PATH\fP is an environment variable containing the directories that fish searches for commands. Unlike other shells, $PATH is a list, not a colon\-delimited string.
.sp
Fish takes care to set \fB$PATH\fP to a default, but typically it is just inherited from fish\(aqs parent process and is set to a value that makes sense for the system \- see Exports\&.
.sp
To prepend /usr/local/bin and /usr/sbin to \fB$PATH\fP, you can write:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set PATH /usr/local/bin /usr/sbin $PATH
.EE
.UNINDENT
.UNINDENT
.sp
To remove /usr/local/bin from \fB$PATH\fP, you can write:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set PATH (string match \-v /usr/local/bin $PATH)
.EE
.UNINDENT
.UNINDENT
.sp
For compatibility with other shells and external commands, $PATH is a path variable \%<#\:variables-path>, and so will be joined with colons (not spaces) when you quote it:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo \(dq$PATH\(dq
/usr/local/sbin:/usr/local/bin:/usr/bin
.EE
.UNINDENT
.UNINDENT
.sp
and it will be exported like that, and when fish starts it splits the $PATH it receives into a list on colon.
.sp
You can do so directly in \fBconfig.fish\fP, like you might do in other shells with \fB\&.profile\fP\&. See this example\&.
.sp
A faster way is to use the fish_add_path \%<> function, which adds given directories to the path if they aren\(aqt already included. It does this by modifying the \fB$fish_user_paths\fP universal variable, which is automatically prepended to \fB$PATH\fP\&. For example, to permanently add \fB/usr/local/bin\fP to your \fB$PATH\fP, you could write:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> fish_add_path /usr/local/bin
.EE
.UNINDENT
.UNINDENT
.sp
The advantage is that you don\(aqt have to go mucking around in files: just run this once at the command line, and it will affect the current session and all future instances too. You can also add this line to config.fish, as it only adds the component if necessary.
.sp
Or you can modify $fish_user_paths yourself, but you should be careful \fInot\fP to append to it unconditionally in config.fish, or it will grow longer and longer.
.SS Startup (Where\(aqs .bashrc?)
.sp
Fish starts by executing commands in \fB~/.config/fish/config.fish\fP\&. You can create it if it does not exist.
.sp
It is possible to directly create functions and variables in \fBconfig.fish\fP file, using the commands shown above. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cat ~/.config/fish/config.fish

set \-x PATH $PATH /sbin/

function ll
    ls \-lh $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
However, it is more common and efficient to use  autoloading functions and universal variables.
.sp
If you want to organize your configuration, fish also reads commands in .fish files in \fB~/.config/fish/conf.d/\fP\&. See Configuration Files \%<#\:configuration> for the details.
.SS Autoloading Functions
.sp
When fish encounters a command, it attempts to autoload a function for that command, by looking for a file with the name of that command in \fB~/.config/fish/functions/\fP\&.
.sp
For example, if you wanted to have a function \fBll\fP, you would add a text file \fBll.fish\fP to \fB~/.config/fish/functions\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cat ~/.config/fish/functions/ll.fish
function ll
    ls \-lh $argv
end
.EE
.UNINDENT
.UNINDENT
.sp
This is the preferred way to define your prompt as well:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> cat ~/.config/fish/functions/fish_prompt.fish
function fish_prompt
    echo (pwd) \(dq> \(dq
end
.EE
.UNINDENT
.UNINDENT
.sp
See the documentation for funced \%<> and funcsave \%<> for ways to create these files automatically, and $fish_function_path \%<#\:syntax-function-autoloading> to control their location.
.SS Universal Variables
.sp
A universal variable is a variable whose value is shared across all instances of fish, now and in the future – even after a reboot. You can make a variable universal with \fBset \-U\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> set \-U EDITOR vim
.EE
.UNINDENT
.UNINDENT
.sp
Now in another shell:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> echo $EDITOR
vim
.EE
.UNINDENT
.UNINDENT
.sp
You only need to set universal variables once interactively. There is no need to add them to your config files \%<#\:configuration>\&. For more details, see Universal Variables \%<#\:variables-universal>\&.
.SS Ready for more?
.sp
If you want to learn more about fish, there is lots of detailed documentation \%<#\:intro>, the official gitter channel \%<https://\:gitter\:.im/\:fish-shell/\:fish-shell>, an official mailing list \%<https://\:lists\:.sourceforge\:.net/\:lists/\:listinfo/\:fish-users>, and the github page \%<https://\:github\:.com/\:fish-shell/\:fish-shell/>\&.
.SS Writing your own completions
.sp
To specify a completion, use the \fBcomplete\fP command. \fBcomplete\fP takes as a parameter the name of the command to specify a completion for. For example, to add a completion for the program \fBmyprog\fP (or \fBmyprog.exe\fP on Cygwin/MSYS2 \%<#\:completions-cygwin>), start the completion command with \fBcomplete \-c myprog ...\fP
.sp
For a complete description of the various switches accepted by the \fBcomplete\fP command, see the documentation for the complete \%<> builtin, or write \fBcomplete \-\-help\fP inside the \fBfish\fP shell.
.sp
To provide a list of possible completions for myprog, use the \fB\-a\fP switch. If \fBmyprog\fP accepts the arguments start and stop, this can be specified as \fBcomplete \-c myprog \-a \(aqstart stop\(aq\fP\&. The argument to the \fB\-a\fP switch is always a single string. At completion time, it will be tokenized on spaces and tabs, and variable expansion, command substitution and other forms of parameter expansion will take place:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# If myprog can list the valid outputs with the list\-outputs subcommand:
complete \-c myprog \-l output \-a \(aq(myprog list\-outputs)\(aq
.EE
.UNINDENT
.UNINDENT
.sp
\fBfish\fP has a special syntax to support specifying switches accepted by a command. The switches \fB\-s\fP, \fB\-l\fP and \fB\-o\fP are used to specify a short switch (single character, such as \fB\-l\fP), a gnu style long switch (such as \fB\-\-color\fP) and an old\-style long switch (with one \fB\-\fP, like \fB\-shuffle\fP), respectively. If the command \(aqmyprog\(aq has an option that can be written as \fB\-o\fP or \fB\-\-output\fP, that is:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-s o \-l output
.EE
.UNINDENT
.UNINDENT
.sp
If this option takes an optional argument, you would also add \fB\-\-argument\fP or \fB\-a\fP, and give that the possible arguments:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-s o \-l output \-a \(dqyes no\(dq
.EE
.UNINDENT
.UNINDENT
.sp
This offers the arguments \(dqyes\(dq and \(dqno\(dq for:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> myprog \-o<TAB>
> myprog \-\-output=<TAB>
.EE
.UNINDENT
.UNINDENT
.sp
By default, option arguments are \fIoptional\fP, so the candidates are only offered directly attached like that, so they aren\(aqt given in this case:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> myprog \-o <TAB>
.EE
.UNINDENT
.UNINDENT
.sp
Usually options \fIrequire\fP a parameter, so you would give \fB\-\-require\-parameter\fP / \fB\-r\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-s o \-l output \-ra \(dqyes no\(dq
.EE
.UNINDENT
.UNINDENT
.sp
which offers yes/no in these cases:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
> myprog \-o<TAB>
> myprog \-\-output=<TAB>
> myprog \-o <TAB>
> myprog \-\-output <TAB>
.EE
.UNINDENT
.UNINDENT
.sp
Fish will also offer files by default, in addition to the arguments you specified. You would either inhibit file completion for a single option:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-s o \-l output \-\-no\-files \-ra \(dqyes no\(dq
.EE
.UNINDENT
.UNINDENT
.sp
or with a specific condition:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-f \-\-condition \(aq__fish_seen_subcommand_from somesubcommand\(aq
.EE
.UNINDENT
.UNINDENT
.sp
or you can disable file completions globally for the command:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
complete \-c myprog \-f
.EE
.UNINDENT
.UNINDENT
.sp
If you have disabled them globally, you can enable them just for a specific condition or option with the \fB\-\-force\-files\fP / \fB\-F\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Disable files by default
complete \-c myprog \-f
# but reenable them for \-\-config\-file
complete \-c myprog \-l config\-file \-\-force\-files \-r
.EE
.UNINDENT
.UNINDENT
.sp
As a more comprehensive example, here\(aqs a commented excerpt of the completions for systemd\(aqs \fBtimedatectl\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# All subcommands that timedatectl knows \- this is useful for later.
set \-l commands status set\-time set\-timezone list\-timezones set\-local\-rtc set\-ntp

# Disable file completions for the entire command
# because it does not take files anywhere
# Note that this can be undone by using \(dq\-F\(dq.
#
# File completions also need to be disabled
# if you want to have more control over what files are offered
# (e.g. just directories, or just files ending in \(dq.mp3\(dq).
complete \-c timedatectl \-f

# This line offers the subcommands
# \-\(dqstatus\(dq,
# \-\(dqset\-timezone\(dq,
# \-\(dqset\-time\(dq
# \-\(dqlist\-timezones\(dq
# if no subcommand has been given so far.
#
# The \(ga\-n\(ga/\(ga\-\-condition\(ga option takes script as a string, which it executes.
# If it returns true, the completion is offered.
# Here the condition is the \(ga__fish_seen_subcommand_from\(ga helper function.
# It returns true if any of the given commands is used on the commandline,
# as determined by a simple heuristic.
# For more complex uses, you can write your own function.
# See e.g. the git completions for an example.
#
complete \-c timedatectl \-n \(dqnot __fish_seen_subcommand_from $commands\(dq \e
    \-a \(dqstatus set\-time set\-timezone list\-timezones\(dq

# If the \(dqset\-timezone\(dq subcommand is used,
# offer the output of \(gatimedatectl list\-timezones\(ga as completions.
# Each line of output is used as a separate candidate,
# and anything after a tab is taken as the description.
# It\(aqs often useful to transform command output with \(gastring\(ga into that form.
complete \-c timedatectl \-n \(dq__fish_seen_subcommand_from set\-timezone\(dq \e
    \-a \(dq(timedatectl list\-timezones)\(dq

# Completion candidates can also be described via \(ga\-d\(ga,
# which is useful if the description is constant.
# Try to keep these short, because that means the user gets to see more at once.
complete \-c timedatectl \-n \(dqnot __fish_seen_subcommand_from $commands\(dq \e
    \-a \(dqset\-local\-rtc\(dq \-d \(dqMaintain RTC in local time\(dq

# We can also limit options to certain subcommands by using conditions.
complete \-c timedatectl \-n \(dq__fish_seen_subcommand_from set\-local\-rtc\(dq \e
    \-l adjust\-system\-clock \-d \(aqSynchronize system clock from the RTC\(aq

# These are simple options that can be used everywhere.
complete \-c timedatectl \-s h \-l help \-d \(aqPrint a short help text and exit\(aq
complete \-c timedatectl \-l version \-d \(aqPrint a short version string and exit\(aq
complete \-c timedatectl \-l no\-pager \-d \(aqDo not pipe output into a pager\(aq
.EE
.UNINDENT
.UNINDENT
.sp
For examples of how to write your own complex completions, study the completions in \fB/usr/share/fish/completions\fP\&. (The exact path depends on your chosen installation prefix and may be slightly different)
.SS Useful functions for writing completions
.sp
\fBfish\fP ships with several functions that may be useful when writing command\-specific completions. Most of these function names begin with the string \fB__fish_\fP\&. Such functions are internal to \fBfish\fP and their name and interface may change in future fish versions. A few of these functions are described here.
.sp
Functions beginning with the string \fB__fish_print_\fP print a newline separated list of strings. For example, \fB__fish_print_filesystems\fP prints a list of all known file systems. Functions beginning with \fB__fish_complete_\fP print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character.
.INDENT 0.0
.IP \(bu 2
\fB__fish_complete_directories STRING DESCRIPTION\fP performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION.
.IP \(bu 2
\fB__fish_complete_path STRING DESCRIPTION\fP performs path completion on STRING, giving them the description DESCRIPTION.
.IP \(bu 2
\fB__fish_complete_groups\fP prints a list of all user groups with the groups members as description.
.IP \(bu 2
\fB__fish_complete_pids\fP prints a list of all processes IDs with the command name as description.
.IP \(bu 2
\fB__fish_complete_suffix SUFFIX\fP performs file completion but sorts files ending in SUFFIX first. This is useful in conjunction with \fBcomplete \-\-keep\-order\fP\&.
.IP \(bu 2
\fB__fish_complete_users\fP prints a list of all users with their full name as description.
.IP \(bu 2
\fB__fish_print_filesystems\fP prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands.
.IP \(bu 2
\fB__fish_print_hostnames\fP prints a list of all known hostnames. This function searches the fstab for nfs servers, ssh for known hosts and checks the \fB/etc/hosts\fP file.
.IP \(bu 2
\fB__fish_print_interfaces\fP prints a list of all known network interfaces.
.UNINDENT
.SS Where to put completions
.sp
Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the list variable \fB$fish_complete_path\fP, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix \fB\&.fish\fP\&.
.sp
By default, Fish searches the following for completions, using the first available file that it finds:
.INDENT 0.0
.IP \(bu 2
A directory for end\-users to keep their own completions, usually \fB~/.config/fish/completions\fP (controlled by the \fBXDG_CONFIG_HOME\fP environment variable);
.IP \(bu 2
A directory for systems administrators to install completions for all users on the system, usually \fB/etc/fish/completions\fP;
.IP \(bu 2
A user\-specified directory for third\-party vendor completions, usually \fB~/.local/share/fish/vendor_completions.d\fP (controlled by the \fBXDG_DATA_HOME\fP environment variable);
.IP \(bu 2
A directory for third\-party software vendors to ship their own completions for their software, usually \fB/usr/share/fish/vendor_completions.d\fP;
.IP \(bu 2
The completions shipped with fish, usually installed in \fB/usr/share/fish/completions\fP; and
.IP \(bu 2
Completions automatically generated from the operating system\(aqs manual, usually stored in \fB~/.cache/fish/generated_completions\fP (controlled by \fBXDG_CACHE_HOME\fP environment variable).
.UNINDENT
.sp
These paths are controlled by parameters set at build, install, or run time, and may vary from the defaults listed above.
.sp
This wide search may be confusing. If you are unsure, your completions probably belong in \fB~/.config/fish/completions\fP\&.
.sp
If you have written new completions for a common Unix command, please consider sharing your work by submitting it via the instructions in Further help and development \%<#\:more-help>\&.
.sp
If you are developing another program and would like to ship completions with your program, install them to the \(dqvendor\(dq completions directory. As this path may vary from system to system, the \fBpkgconfig\fP framework should be used to discover this path with the output of \fBpkg\-config \-\-variable completionsdir fish\fP\&.
.SS Writing your own prompt
.sp
\fBWarning:\fP
.INDENT 0.0
.INDENT 3.5
This document uses formatting to show what a prompt would look like. If you are viewing this in the man page,
you probably want to switch to looking at the html version instead. Run \fBhelp custom\-prompt\fP to view it in a web browser.
.UNINDENT
.UNINDENT
.sp
Fish ships a number of prompts that you can view with the fish_config \%<> command, and many users have shared their prompts online.
.sp
However, you can also write your own, or adjust an existing prompt. This is a good way to get used to fish\(aqs scripting language \%<>\&.
.sp
Unlike other shells, fish\(aqs prompt is built by running a function \- fish_prompt \%<>\&. Or, more specifically, three functions:
.INDENT 0.0
.IP \(bu 2
fish_prompt \%<>, which is the main prompt function
.IP \(bu 2
fish_right_prompt \%<>, which is shown on the right side of the terminal.
.IP \(bu 2
fish_mode_prompt \%<>, which is shown if vi mode \%<#\:vi-mode> is used.
.UNINDENT
.sp
These functions are run, and whatever they print is displayed as the prompt (minus one trailing newline).
.sp
If the \fBSHELL_PROMPT_PREFIX\fP \%<#\:envvar-SHELL_PROMPT_PREFIX> or \fBSHELL_PROMPT_SUFFIX\fP \%<#\:envvar-SHELL_PROMPT_SUFFIX> environment variables are set, they are automatically prepended and appended to the left prompt.
.sp
Here, we will just be writing a simple fish_prompt.
.SS Our first prompt
.sp
Let\(aqs look at a very simple example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    echo $PWD \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
This prints the current working directory (\fBPWD\fP \%<#\:envvar-PWD>) and a \fB>\fP symbol to show where the prompt ends. The \fB>\fP is quoted \%<#\:quotes> because otherwise it would signify a redirection \%<#\:redirects>\&.
.sp
Because we\(aqve used echo \%<>, it adds spaces between the two so it ends up looking like (assuming \fB_\fP is your cursor):
.INDENT 0.0
.INDENT 3.5
.sp
.EX
/home/tutorial >_
.EE
.UNINDENT
.UNINDENT
.SS Formatting
.sp
\fBecho\fP adds spaces between its arguments. If you don\(aqt want those, you can use string join \%<> like this:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    string join \(aq\(aq \-\- $PWD \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
The \fB\-\-\fP indicates to \fBstring\fP that no options can come after it, in case we extend this with something that can start with a \fB\-\fP\&.
.sp
There are other ways to remove the space, including \fBecho \-s\fP and printf \%<>\&.
.SS Adding color
.sp
This prompt is functional, but a bit boring. We could add some color.
.sp
Fortunately, fish offers the set_color \%<> command, so you can do:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo (set_color red)foo
.EE
.UNINDENT
.UNINDENT
.sp
\fBset_color\fP can also handle RGB colors like \fBset_color 23b455\fP, and other formatting options including bold and italics.
.sp
So, taking our previous prompt and adding some color:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    string join \(aq\(aq \-\- (set_color green) $PWD (set_color \-\-reset) \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
\(dq\-\-reset\(dq tells the terminal to go back to its default formatting options.
.sp
\fBset_color\fP works by producing an escape sequence, which is a special piece of text that terminals
interpret as instructions \- for example, to change color. So \fBset_color red\fP produces the same
effect as:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo \ee\e[31m
.EE
.UNINDENT
.UNINDENT
.sp
Although you can write your own escape sequences by hand, it\(aqs much easier to use \fBset_color\fP\&.
.SS Shortening the working directory
.sp
This is fine, but our \fBPWD\fP \%<#\:envvar-PWD> can be a bit long, and we are typically only interested in the last few directories. We can shorten this with the prompt_pwd \%<> helper that will give us a shortened working directory:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    string join \(aq\(aq \-\- (set_color green) (prompt_pwd) (set_color \-\-reset) \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
\fBprompt_pwd\fP takes options to control how much to shorten. For instance, if we want to display the last two directories, we\(aqd use \fBprompt_pwd \-\-full\-length\-dirs 2\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    string join \(aq\(aq \-\- (set_color green) (prompt_pwd \-\-full\-length\-dirs 2) (set_color \-\-reset) \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
With a current directory of \(dq/home/tutorial/Music/Lena Raine/Oneknowing\(dq, this would print
.INDENT 0.0
.INDENT 3.5
.sp
.EX
~/M/Lena Raine/Oneknowing>_
.EE
.UNINDENT
.UNINDENT
.SS Status
.sp
One important bit of information that every command returns is the status \%<#\:variables-status>\&. This is a whole number from 0 to 255, and usually it is used as an error code \- 0 if the command returned successfully, or a number from 1 to 255 if not.
.sp
It\(aqs useful to display this in your prompt, but showing it when it\(aqs 0 seems kind of wasteful.
.sp
First of all, since every command (except for set \%<>) changes the status, you need to store it for later use as the first thing in your prompt. Use a local variable \%<#\:variables-scope> so it will be confined to your prompt function:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-l last_status $status
.EE
.UNINDENT
.UNINDENT
.sp
And after that, you can set a string if it is not zero:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
# Prompt status only if it\(aqs not 0
set \-l stat
if test $last_status \-ne 0
    set stat (set_color red)\(dq[$last_status]\(dq(set_color \-\-reset)
end
.EE
.UNINDENT
.UNINDENT
.sp
And to print it, we add it to our \fBstring join\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
string join \(aq\(aq \-\- (set_color green) (prompt_pwd) (set_color \-\-reset) $stat \(aq>\(aq
.EE
.UNINDENT
.UNINDENT
.sp
If \fB$last_status\fP was 0, \fB$stat\fP is empty, and so it will simply disappear.
.sp
So our entire prompt is now:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    set \-l last_status $status
    # Prompt status only if it\(aqs not 0
    set \-l stat
    if test $last_status \-ne 0
        set stat (set_color red)\(dq[$last_status]\(dq(set_color \-\-reset)
    end

    string join \(aq\(aq \-\- (set_color green) (prompt_pwd) (set_color \-\-reset) $stat \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
And it looks like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
~/M/L/Oneknowing>false
~/M/L/Oneknowing[1]>_
.EE
.UNINDENT
.UNINDENT
.sp
after we run \fBfalse\fP (which returns 1).
.SS Transient prompt
.sp
To enable transient prompt functionality, set the \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> variable to 1:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set \-g fish_transient_prompt 1
.EE
.UNINDENT
.UNINDENT
.sp
With this set, fish re\-runs prompt functions with a \fB\-\-final\-rendering\fP argument before running a commandline.
So you can use it to declutter your old prompts. For example if you want to see only the current directory name when you scroll up:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function fish_prompt
    set \-l last_status $status
    set \-l stat
    set \-l pwd
    # Check if it\(aqs a transient or final prompt
    if contains \-\- \-\-final\-rendering $argv
        set pwd (path basename $PWD)
    else
        set pwd (prompt_pwd)
        # Prompt status only if it\(aqs not 0
        if test $last_status \-ne 0
            set stat (set_color red)\(dq[$last_status]\(dq(set_color \-\-reset)
        end
    end

    string join \(aq\(aq \-\- (set_color green) $pwd (set_color \-\-reset) $stat \(aq>\(aq
end
.EE
.UNINDENT
.UNINDENT
.sp
Now running two commands in the same directory could result in this screen:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
Oneknowing>false
~/M/L/Oneknowing[1]>_
.EE
.UNINDENT
.UNINDENT
.SS Save the prompt
.sp
Once you are happy with your prompt, you can save it with \fBfuncsave fish_prompt\fP (see funcsave \- save the definition of a function to the user\(aqs autoload directory \%<>) or write it to ~/.config/fish/functions/fish_prompt.fish yourself.
.sp
If you want to edit it again, open that file or use \fBfunced fish_prompt\fP (see funced \- edit a function interactively \%<>).
.SS Where to go from here?
.sp
We have now built a simple but working and usable prompt, but of course more can be done.
.INDENT 0.0
.IP \(bu 2
.INDENT 2.0
.TP
.B Fish offers more helper functions:
.INDENT 7.0
.IP \(bu 2
\fBprompt_login\fP to describe the user/hostname/container or \fBprompt_hostname\fP to describe just the host
.IP \(bu 2
\fBfish_is_root_user\fP to help with changing the symbol for root.
.IP \(bu 2
\fBfish_vcs_prompt\fP to show version control information (or \fBfish_git_prompt\fP / \fBfish_hg_prompt\fP / \fBfish_svn_prompt\fP to limit it to specific systems)
.UNINDENT
.UNINDENT
.IP \(bu 2
You can add a right prompt by changing fish_right_prompt \%<> or a vi mode prompt by changing fish_mode_prompt \%<>\&.
.IP \(bu 2
.INDENT 2.0
.TP
.B Some prompts have interesting or advanced features
.INDENT 7.0
.IP \(bu 2
Add the time when the prompt was printed
.IP \(bu 2
Show various integrations like python\(aqs venv
.IP \(bu 2
Color the parts differently.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
You can look at fish\(aqs sample prompts for inspiration. Open up fish_config \%<>, find one you like and pick it. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
fish_config prompt show # <\- shows all the sample prompts
fish_config prompt choose disco # <\- this picks the \(dqdisco\(dq prompt for this session
funced fish_prompt # <\- opens fish_prompt in your editor, and reloads it once the editor exits
.EE
.UNINDENT
.UNINDENT
.SS Design
.sp
This is a description of the design principles that have been used to design fish. The fish design has three high level goals. These are:
.INDENT 0.0
.IP 1. 3
Everything that can be done in other shell languages should be possible to do in fish, though fish may rely on external commands in doing so.
.IP 2. 3
Fish should be user\-friendly, but not at the expense of expressiveness. Most tradeoffs between power and ease of use can be avoided with careful design.
.IP 3. 3
Whenever possible without breaking the above goals, fish should follow POSIX.
.UNINDENT
.sp
To achieve these high\-level goals, the fish design relies on a number of more specific design principles. These are presented below, together with a rationale and a few examples for each.
.SS The law of orthogonality
.sp
The shell language should have a small set of orthogonal features. Any situation where two features are related but not identical, one of them should be removed, and the other should be made powerful and general enough to handle all common use cases of either feature.
.sp
Rationale:
Related features make the language larger, which makes it harder to learn. It also increases the size of the source code, making the program harder to maintain and update.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
Here documents are too similar to using echo inside of a pipeline.
.IP \(bu 2
Subshells, command substitution and process substitution are strongly related. \fBfish\fP only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
.IP \(bu 2
Having both aliases and functions is confusing, especially since both of them have limitations and problems. \fBfish\fP functions have none of the drawbacks of either syntax.
.IP \(bu 2
The many Posix quoting styles are silly, especially \fB$\fP\&.
.UNINDENT
.SS The law of responsiveness
.sp
The shell should attempt to remain responsive to the user at all times, even in the face of contended or unresponsive filesystems. It is only acceptable to block in response to a user initiated action, such as running a command.
.sp
Rationale:
Bad performance increases user\-facing complexity, because it trains users to recognize and route around slow use cases. It is also incredibly frustrating.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
Features like syntax highlighting and autosuggestions must perform all of their disk I/O asynchronously.
.IP \(bu 2
Startup should minimize forks and disk I/O, so that fish can be started even if the system is under load.
.UNINDENT
.SS Configurability is the root of all evil
.sp
Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it.
.sp
Rationale:
Different configuration options are a nightmare to maintain, since the number of potential bugs caused by specific configuration combinations quickly becomes an issue. Configuration options often imply assumptions about the code which change when reimplementing the code, causing issues with backwards compatibility. But mostly, configuration options should be avoided since they simply should not exist, as the program should be smart enough to do what is best, or at least a good enough approximation of it.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
.IP \(bu 2
Fish does not allow you to set the number of history entries, different language substyles or any number of other common shell configuration options.
.UNINDENT
.sp
A special note on the evils of configurability is the long list of very useful features found in some shells, that are not turned on by default. Both zsh and bash support command\-specific completions, but no such completions are shipped with bash by default, and they are turned off by default in zsh. Other features that zsh supports that are disabled by default include tab\-completion of strings containing wildcards, a sane completion pager and a history file.
.SS The law of user focus
.sp
When designing a program, one should first think about how to make an intuitive and powerful program. Implementation issues should only be considered once a user interface has been designed.
.sp
Rationale:
This design rule is different than the others, since it describes how one should go about designing new features, not what the features should be. The problem with focusing on what can be done, and what is easy to do, is that too much of the implementation is exposed. This means that the user must know a great deal about the underlying system to be able to guess how the shell works, it also means that the language will often be rather low\-level.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
.IP \(bu 2
The differences between built\-in commands and shellscript functions should be made as small as possible. Built\-ins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any I/O redirection.
.IP \(bu 2
Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
.IP \(bu 2
All blocks end with the \fBend\fP built\-in.
.UNINDENT
.SS The law of discoverability
.sp
A program should be designed to make its features as easy as possible to discover for the user.
.sp
Rationale:
A program whose features are discoverable turns a new user into an expert in a shorter span of time, since the user will become an expert on the program simply by using it.
.sp
The main benefit of a graphical program over a command\-line\-based program is discoverability. In a graphical program, one can discover all the common features by simply looking at the user interface and guessing what the different buttons, menus and other widgets do. The traditional way to discover features in command\-line programs is through manual pages. This requires both that the user starts to use a different program, and then they remember the new information until the next time they use the same program.
.sp
Examples:
.INDENT 0.0
.IP \(bu 2
Everything should be tab\-completable, and every tab completion should have a description.
.IP \(bu 2
Every syntax error and error in a built\-in command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
.IP \(bu 2
The help manual should be easy to read, easily available from the shell, complete and contain many examples
.IP \(bu 2
The language should be uniform, so that once the user understands the command/argument syntax, they will know the whole language, and be able to use tab\-completion to discover new features.
.UNINDENT
.SS Release notes
.SS fish 4.6.0 (released March 28, 2026)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
New Spanish translations (#12489 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12489>).
.IP \(bu 2
New Japanese translations (#12499 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12499>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The default width for emoji is switched from 1 to 2, improving the experience for users connecting to old systems from modern desktops. Users of old desktops who notice that lines containing emoji are misaligned can set \fB$fish_emoji_width\fP back to 1 (#12562 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12562>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
The tab completion pager now left\-justifies the description of each column (#12546 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12546>).
.IP \(bu 2
fish now supports the \fBSHELL_PROMPT_PREFIX\fP, \fBSHELL_PROMPT_SUFFIX\fP, and \fBSHELL_WELCOME\fP environment variables. The prefix and suffix are automatically prepended and appended to the left prompt, and the welcome message is displayed on startup after the greeting.
These variables are set by systemd\(aqs \fBrun0\fP for example (#10924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10924>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
\fBset_color\fP is able to turn off italics, reverse mode, strikethrough and underline individually (e.g. \fB\-\-italics=off\fP).
.IP \(bu 2
\fBset_color\fP learned the foreground (\fB\-\-foreground\fP or \fB\-f\fP) and reset (\fB\-\-reset\fP) options.
.IP \(bu 2
An error caused by slow terminal responses at macOS startup has been addressed (#12571 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12571>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
Signals like \fBSIGWINCH\fP (as sent on terminal resize) no longer interrupt builtin output (#12496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12496>).
.IP \(bu 2
For compatibility with Bash, fish now accepts \fB|&\fP as alternate spelling of \fB&|\fP, for piping both standard output and standard error (#11516 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11516>).
.IP \(bu 2
\fBfish_indent\fP now preserves comments and newlines immediately preceding a brace block (\fB{ }\fP) (#12505 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12505>).
.IP \(bu 2
A crash when suspending certain pipelines with \fBctrl\fP\-\fBz\fP has been fixed (#12301 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12301>).
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
\fBcargo xtask\fP subcommands no longer panic on test failures.
.UNINDENT
.SS Regression fixes:
.INDENT 0.0
.IP \(bu 2
(from 4.5.0) Intermediate \fB⏎\fP artifact when redrawing prompt (#12476 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12476>).
.IP \(bu 2
(from 4.4.0) \fBhistory\fP honors explicitly specified \fB\-\-color=\fP again (#12512 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12512>).
.IP \(bu 2
(from 4.4.0) Vi mode \fBdl\fP and \fBdh\fP (#12461 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12461>).
.IP \(bu 2
(from 4.3.0) Error completing of commands starting with \fB\-\fP (#12522 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12522>).
.UNINDENT
.SS fish 4.5.0 (released February 17, 2026)
.sp
This is mostly a patch release for Vi mode regressions in 4.4.0 but other minor behavior changes are included as well.
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
\fBctrl\fP\-\fBl\fP no longer cancels history search (#12436 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12436>).
.IP \(bu 2
History search cursor positioning now works correctly with characters of arbitrary width.
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
fish no longer reads the terminfo database to alter behaviour based on the \fBTERM\fP environment variable, and does not depend on ncurses or terminfo. The \fBignore\-terminfo\fP feature flag, introduced and enabled by default in fish 4.1, is now permanently enabled. fish may no longer work correctly on Data General Dasher D220 and Wyse WY\-350 terminals, but should continue to work on all known terminal emulators released in the 21st century.
.UNINDENT
.SS Regression fixes:
.INDENT 0.0
.IP \(bu 2
(from 4.4.0) Vi mode \fBd,f\fP key binding did not work (#12417 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12417>).
.IP \(bu 2
(from 4.4.0) Vi mode \fBc,w\fP key binding wrongly deleted trailing spaces (#12443 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12443>).
.IP \(bu 2
(from 4.4.0) Vi mode crash on \fBc,i,w\fP after accepting autosuggestion (#12430 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12430>).
.IP \(bu 2
(from 4.4.0) \fBfish_vi_key_bindings\fP called with a mode argument produced an error (#12413 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12413>).
.IP \(bu 2
(from 4.0.0) Build on Illumos (#12410 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12410>).
.UNINDENT
.SS fish 4.4.0 (released February 03, 2026)
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The default fossil prompt has been disabled (#12342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12342>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
The \fBbind\fP builtin lists mappings from all modes if \fB\-\-mode\fP is not provided (#12214 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12214>).
.IP \(bu 2
Line\-wise autosuggestions that don\(aqt start a command are no longer shown (739b82c34db, 58e7a50de8a).
.IP \(bu 2
Builtin \fBhistory\fP now assumes that \fBPAGER\fP supports ANSI color sequences.
.IP \(bu 2
fish now clears the terminal\(aqs \fBFLUSHO\fP flag when acquiring control of the terminal, to fix an issue caused by pressing \fBctrl\fP\-\fBo\fP on macOS (#12304 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12304>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
Vi mode word movements (\fBw\fP, \fBW\fP, \fBe\fP, and \fBE\fP) are now largely in line with Vim. The only exception is that underscores are treated as word separators (#12269 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12269>).
.IP \(bu 2
New special input functions to support these movements: \fBforward\-word\-vi\fP, \fBkill\-word\-vi\fP, \fBforward\-bigword\-vi\fP, \fBkill\-bigword\-vi\fP, \fBforward\-word\-end\fP, \fBbackward\-word\-end\fP, \fBforward\-bigword\-end\fP, \fBbackward\-bigword\-end\fP, \fBkill\-a\-word\fP, \fBkill\-inner\-word\fP, \fBkill\-a\-bigword\fP, and \fBkill\-inner\-bigword\fP\&.
.IP \(bu 2
Vi mode key bindings now support counts for movement and deletion commands (e.g. \fId3w\fP or \fI3l\fP), via a new operator mode (#2192 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2192>).
.IP \(bu 2
New \fBcatppuccin\-*\fP color themes.
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
\fBset_color\fP learned the strikethrough (\fB\-\-strikethrough\fP or \fB\-s\fP) modifier.
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
The CMake option \fBWITH_GETTEXT\fP has been renamed to \fBWITH_MESSAGE_LOCALIZATION\fP, to reflect that it toggles localization independently of the backend used in the implementation.
.IP \(bu 2
New \fBcargo xtask\fP commands can replace some CMake workflows.
.UNINDENT
.SS Regression fixes:
.INDENT 0.0
.IP \(bu 2
(from 4.1.0) Crash when autosuggesting Unicode characters with nontrivial lowercase mapping (#12326 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12326>, 78f4541116e).
.IP \(bu 2
(from 4.3.0) Glitch on \fBread \-\-prompt\-str \(dq\(dq\fP (#12296 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12296>).
.UNINDENT
.SS fish 4.3.3 (released January 07, 2026)
.sp
This release fixes the following problems identified in fish 4.3.0:
.INDENT 0.0
.IP \(bu 2
Selecting a completion could insert only part of the token (#12249 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12249>).
.IP \(bu 2
Glitch with soft\-wrapped autosuggestions and fish_right_prompt \%<> (#12255 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12255>).
.IP \(bu 2
Spurious echo in tmux when typing a command really fast (#12261 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12261>).
.IP \(bu 2
\fBtomorrow\fP theme always using the light variant (#12266 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12266>).
.IP \(bu 2
\fBfish_config theme choose\fP sometimes not shadowing themes set by e.g. webconfig (#12278 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12278>).
.IP \(bu 2
The sample prompts and themes are correctly installed (#12241 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12241>).
.IP \(bu 2
Last line of command output could be hidden when missing newline (#12246 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12246>).
.UNINDENT
.sp
Other improvements include:
.INDENT 0.0
.IP \(bu 2
The \fBabbr\fP, \fBbind\fP, \fBcomplete\fP, \fBfunctions\fP, \fBhistory\fP and \fBtype\fP commands now support a \fB\-\-color\fP option to control syntax highlighting in their output. Valid values are \fBauto\fP (default), \fBalways\fP, or \fBnever\fP\&.
.IP \(bu 2
Existing file paths in redirection targets such as \fB> file.txt\fP are now highlighted using \fBfish_color_valid_path\fP \%<#\:envvar-fish_color_valid_path>, indicating that \fBfile.txt\fP will be clobbered (#12260 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12260>).
.UNINDENT
.SS fish 4.3.2 (released December 30, 2025)
.sp
This release fixes the following problems identified in 4.3.0:
.INDENT 0.0
.IP \(bu 2
Pre\-built macOS packages failed to start due to a \fBMalformed Mach\-O file\fP error (#12224 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12224>).
.IP \(bu 2
\fBextra_functionsdir\fP (usually \fBvendor_functions.d\fP) and friends were not used (#12226 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12226>).
.IP \(bu 2
Sample config file \fB~/.config/fish/config.fish/\fP and config directories \fB~/.config/fish/conf.d/\fP, \fB~/.config/fish/completions/\fP and \fB~/.config/fish/functions/\fP were recreated on every startup instead of only the first time fish runs on a system (#12230 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12230>).
.IP \(bu 2
Spurious echo of \fB^[[I\fP in some scenarios (#12232 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12232>).
.IP \(bu 2
Infinite prompt redraw loop on some prompts (#12233 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12233>).
.IP \(bu 2
The removal of pre\-built HTML docs from tarballs revealed that cross compilation is broken because we use \fB${CMAKE_BINARY_DIR}/fish_indent\fP for building HTML docs.
As a workaround, the new CMake build option \fBFISH_INDENT_FOR_BUILDING_DOCS\fP can be set to the path of a runnable \fBfish_indent\fP binary.
.UNINDENT
.SS fish 4.3.1 (released December 28, 2025)
.sp
This release fixes the following problem identified in 4.3.0:
.INDENT 0.0
.IP \(bu 2
Possible crash after expanding an abbreviation (#12223 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12223>).
.UNINDENT
.SS fish 4.3.0 (released December 28, 2025)
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
fish no longer sets user\-facing universal variables \%<#\:variables-universal> by default, making the configuration easier to understand.
Specifically, the \fBfish_color_*\fP, \fBfish_pager_color_*\fP and \fBfish_key_bindings\fP variables are now set in the global scope by default.
After upgrading to 4.3.0, fish will (once and never again) migrate these universals to globals set at startup in the
\fB~/.config/fish/conf.d/fish_frozen_theme.fish\fP and
\fB~/.config/fish/conf.d/fish_frozen_key_bindings.fish\fP files.
We suggest that you delete those files and set your theme \%<#\:syntax-highlighting> in \fB~/.config/fish/config.fish\fP\&.
.INDENT 2.0
.IP \(bu 2
You can still configure fish to propagate theme changes instantly; see here \%<#\:syntax-highlighting-instant-update> for an example.
.IP \(bu 2
You can still opt into storing color variables in the universal scope
via \fBfish_config theme save\fP though unlike \fBfish_config theme choose\fP,
it does not support dynamic theme switching based on the terminal\(aqs color theme (see below).
.UNINDENT
.IP \(bu 2
In addition to setting the variables which are explicitly defined in the given theme,
\fBfish_config theme choose\fP now clears only color variables that were set by earlier invocations of a \fBfish_config theme choose\fP command
(which is how fish\(aqs default theme is set).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
New status language \%<#\:status-language> command allows showing and modifying language settings for fish messages without having to modify environment variables.
.IP \(bu 2
When using a noninteractive fish instance to compute completions, \fBcommandline \-\-cursor\fP works as expected instead of throwing an error (#11993 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11993>).
.IP \(bu 2
\fBfish_trace\fP \%<#\:envvar-fish_trace> can now be set to \fBall\fP to also trace execution of key bindings, event handlers as well as prompt and title functions.
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
When typing immediately after starting fish, the first prompt is now rendered correctly.
.IP \(bu 2
Completion accuracy was improved for file paths containing \fB=\fP or \fB:\fP (#5363 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5363>).
.IP \(bu 2
Prefix\-matching completions are now shown even if they don\(aqt match the case typed by the user (#7944 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7944>).
.IP \(bu 2
On Cygwin/MSYS, command name completion will favor the non\-exe name (\fBfoo\fP) unless the user started typing the extension.
.IP \(bu 2
When using the exe name (\fBfoo.exe\fP), fish will use the description and completions for \fBfoo\fP if there are none for \fBfoo.exe\fP\&.
.IP \(bu 2
Autosuggestions now also show soft\-wrapped portions (#12045 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12045>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
\fBctrl\fP\-\fBw\fP (\fBbackward\-kill\-path\-component\fP) also deletes escaped spaces (#2016 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2016>).
.IP \(bu 2
New special input functions \fBbackward\-path\-component\fP, \fBforward\-path\-component\fP and \fBkill\-path\-component\fP (#12127 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12127>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
Themes can now be made color\-theme\-aware by including both \fB[light]\fP and \fB[dark]\fP sections in the theme file \%<#\:fish-config-theme-files>\&.
Some default themes have been made color\-theme\-aware, meaning they dynamically adjust as your terminal\(aqs background color switches between light and dark colors (#11580 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11580>).
.IP \(bu 2
The working directory is now reported on every fresh prompt (via OSC 7), fixing scenarios where a child process (like \fBssh\fP) left behind a stale working directory (#12191 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12191>).
.IP \(bu 2
OSC 133 prompt markers now also mark the prompt end, which improves shell integration with terminals like iTerm2 (#11837 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11837>).
.IP \(bu 2
Operating\-system\-specific key bindings are now decided based on the terminal\(aqs host OS \%<#\:status-terminal-os>\&.
.IP \(bu 2
New feature flag \%<#\:featureflags> \fBomit\-term\-workarounds\fP can be turned on to prevent fish from trying to work around some incompatible terminals.
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
Tarballs no longer contain prebuilt documentation,
so building and installing documentation requires Sphinx.
To avoid users accidentally losing docs, the \fBBUILD_DOCS\fP and \fBINSTALL_DOCS\fP configuration options have been replaced with a new \fBWITH_DOCS\fP option.
.IP \(bu 2
\fBfish_key_reader\fP and \fBfish_indent\fP are now installed as hardlinks to \fBfish\fP, to save some space.
.UNINDENT
.SS Regression fixes:
.INDENT 0.0
.IP \(bu 2
(from 4.1.0) Crash on incorrectly\-set color variables (#12078 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12078>).
.IP \(bu 2
(from 4.1.0) Crash when autosuggesting Unicode characters with nontrivial lowercase mapping.
.IP \(bu 2
(from 4.2.0) Incorrect emoji width computation on macOS.
.IP \(bu 2
(from 4.2.0) Mouse clicks and \fBctrl\fP\-\fBl\fP edge cases in multiline command lines (#12121 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12121>).
.IP \(bu 2
(from 4.2.0) Completions for Git remote names on some non\-glibc systems.
.IP \(bu 2
(from 4.2.0) Expansion of \fB~$USER\fP\&.
.UNINDENT
.SS fish 4.2.1 (released November 13, 2025)
.sp
This release fixes the following problems identified in 4.2.0:
.INDENT 0.0
.IP \(bu 2
When building from a tarball without Sphinx (that is, with \fB\-DBUILD_DOCS=OFF\fP or when \fBsphinx\-build\fP is not found),
builtin man pages and help files were missing, which has been fixed (#12052 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12052>).
.IP \(bu 2
\fBfish_config\fP\(aqs theme selector (the \(dqcolors\(dq tab) was broken, which has been fixed (#12053 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12053>).
.UNINDENT
.SS fish 4.2.0 (released November 10, 2025)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
History\-based autosuggestions now include multi\-line commands.
.IP \(bu 2
A transient prompt \%<#\:transient-prompt> containing more lines than the final prompt will now be cleared properly (#11875 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11875>).
.IP \(bu 2
Taiwanese Chinese translations have been added.
.IP \(bu 2
French translations have been supplemented (#11842 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11842>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
fish now assumes UTF\-8 for character encoding even if the system does not have a UTF\-8 locale.
Input bytes which are not valid UTF\-8 are still round\-tripped correctly.
For example, file paths using legacy encodings can still be used,
but may be rendered differently on the command line.
.IP \(bu 2
On systems where no multi\-byte locale is available,
fish will no longer fall back to using ASCII replacements for Unicode characters \%<#\:term-compat-unicode-codepoints> such as \(dq…\(dq.
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
The title of the terminal tab can now be set separately from the window title by defining the fish_tab_title \%<> function (#2692 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2692>).
.IP \(bu 2
fish now hides the portion of a multiline prompt that is scrolled out of view due to a huge command line. This prevents duplicate lines after repainting with partially visible prompt (#11911 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11911>).
.IP \(bu 2
fish_config prompt \%<>\(aqs \fBchoose\fP and \fBsave\fP subcommands have been taught to reset fish_mode_prompt \%<> in addition to the other prompt functions (#11937 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11937>).
.IP \(bu 2
fish no longer force\-disables mouse capture (DECSET/DECRST 1000),
so you can use those commands
to let mouse clicks move the cursor or select completions items (#4918 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4918>).
.IP \(bu 2
The \fBalt\fP\-\fBp\fP binding no longer adds a redundant space to the command line.
.IP \(bu 2
When run as a login shell on macOS, fish now sets \fBMANPATH\fP correctly when that variable was already present in the environment (#10684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10684>).
.IP \(bu 2
A Windows\-specific case of the web\-based config \%<> failing to launch has been fixed (#11805 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11805>).
.IP \(bu 2
A MSYS2\-specific workaround for Konsole and WezTerm has been added,
to prevent them from using the wrong working directory when opening new tabs (#11981 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11981>).
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
Release tags and source code tarballs are GPG\-signed again (#11996 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11996>).
.IP \(bu 2
Documentation in release tarballs is now built with the latest version of Sphinx,
which means that pre\-built man pages include OSC 8 hyperlinks \%<#\:term-compat-osc-8>\&.
.IP \(bu 2
The Sphinx dependency is now specified in \fBpyproject.toml\fP,
which allows you to use uv \%<https://\:github\:.com/\:astral-sh/uv> to provide Sphinx for building documentation (e.g. \fBuv run cargo install \-\-path .\fP).
.IP \(bu 2
The minimum supported Rust version (MSRV) has been updated to 1.85.
.IP \(bu 2
The standalone build mode has been made the default.
This means that the files in \fB$CMAKE_INSTALL_PREFIX/share/fish\fP will not be used anymore, except for HTML docs.
As a result, future upgrades will no longer break running shells
if one of fish\(aqs internal helper functions has been changed in the updated version.
For now, the data files are still installed redundantly,
to prevent upgrades from breaking already\-running shells (#11921 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11921>).
To reverse this change (which should not be necessary),
patch out the \fBembed\-data\fP feature from \fBcmake/Rust.cmake\fP\&.
This option will be removed in future.
.IP \(bu 2
OpenBSD 7.8 revealed an issue with fish\(aqs approach for displaying builtin man pages, which has been fixed.
.UNINDENT
.SS Regression fixes:
.INDENT 0.0
.IP \(bu 2
(from 4.1.0) Fix the web\-based config \%<> for Python 3.9 and older (#12039 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12039>).
.IP \(bu 2
(from 4.1.0) Correct wrong terminal modes set by \fBfish \-c \(aqread; cat\fP (#12024 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:12024>).
.IP \(bu 2
(from 4.1.0) On VTE\-based terminals, stop redrawing the prompt on resize again, to avoid glitches.
.IP \(bu 2
(from 4.1.0) On MSYS2, fix saving/loading of universal variables (#11948 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11948>).
.IP \(bu 2
(from 4.1.0) Fix error using \fBman\fP for the commands \fB!\fP \fB\&.\fP \fB:\fP \fB[\fP \fB{\fP (#11955 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11955>).
.IP \(bu 2
(from 4.1.0) Fix build issues on illumos systems (#11982 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11982>).
.IP \(bu 2
(from 4.1.0) Fix crash on invalid function \%<> command (#11912 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11912>).
.IP \(bu 2
(from 4.0.0) Fix build on SPARC and MIPS Linux by disabling \fBSIGSTKFLT\fP\&.
.IP \(bu 2
(from 4.0.0) Fix crash when passing negative PIDs to builtin wait \%<> (#11929 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11929>).
.IP \(bu 2
(from 4.0.0) On Linux, fix status fish\-path \%<> output when fish has been reinstalled since it was started.
.UNINDENT
.SS fish 4.1.2 (released October 7, 2025)
.sp
This release fixes the following regressions identified in 4.1.0:
.INDENT 0.0
.IP \(bu 2
Fixed spurious error output when completing remote file paths for \fBscp\fP (#11860 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11860>).
.IP \(bu 2
Fixed the \fBalt\fP\-\fBl\fP binding not formatting \fBls\fP output correctly (one entry per line, no colors) (#11888 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11888>).
.IP \(bu 2
Fixed an issue where focus events (currently only enabled in \fBtmux\fP) would cause multiline prompts to be redrawn in the wrong line (#11870 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11870>).
.IP \(bu 2
Stopped printing output that would cause a glitch on old versions of Midnight Commander (#11869 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11869>).
.IP \(bu 2
Added a fix for some configurations of Zellij where \fBescape\fP key processing was delayed (#11868 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11868>).
.IP \(bu 2
Fixed a case where the web\-based configuration tool \%<> would generate invalid configuration (#11861 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11861>).
.IP \(bu 2
Fixed a case where pasting into \fBfish \-c read\fP would fail with a noisy error (#11836 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11836>).
.IP \(bu 2
Fixed a case where upgrading fish would break old versions of fish that were still running.
.sp
In general, fish still needs to be restarted after it is upgraded,
except for standalone builds \%<https://\:github\:.com/\:fish-shell/\:fish-shell/?\:tab=readme-ov-file#\:building-fish-with-embedded-data-experimental>\&.
.UNINDENT
.SS fish 4.1.1 (released September 30, 2025)
.sp
This release fixes the following regressions identified in 4.1.0:
.INDENT 0.0
.IP \(bu 2
Many of our new Chinese translations were more confusing than helpful; they have been fixed or removed (#11833 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11833>).
.sp
Note that you can work around this type of issue by configuring fish\(aqs message localization \%<>:
if your environment contains something like \fBLANG=zh_CN.UTF\-8\fP,
you can use \fBset \-g LC_MESSAGES en\fP to use English messages inside fish.
This will not affect fish\(aqs child processes unless \fBLC_MESSAGES\fP was already exported.
.IP \(bu 2
Some fish_config \%<> subcommands for showing prompts and themes had been broken in standalone Linux builds (those using the \fBembed\-data\fP cargo feature), which has been fixed (#11832 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11832>).
.IP \(bu 2
On Windows Terminal, we observed an issue where fish would fail to read the terminal\(aqs response to our new startup queries, causing noticeable lags and a misleading error message. A workaround has been added (#11841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11841>).
.IP \(bu 2
A WezTerm issue breaking shifted key input \%<https://\:github\:.com/\:wezterm/\:wezterm/\:issues/\:6087> has resurfaced on some versions of WezTerm; our workaround has been extended to cover all versions for now (#11204 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11204>).
.IP \(bu 2
Fixed a crash in the web\-based configuration tool \%<> when using the new underline styles (#11840 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11840>).
.UNINDENT
.SS fish 4.1.0 (released September 27, 2025)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
Compound commands (\fBbegin; echo 1; echo 2; end\fP) can now be written using braces (\fB{ echo1; echo 2 }\fP), like in other shells.
.IP \(bu 2
fish now supports transient prompts: if \fBfish_transient_prompt\fP \%<#\:envvar-fish_transient_prompt> is set to 1, fish will reexecute prompt functions with the \fB\-\-final\-rendering\fP argument before running a commandline (#11153 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11153>).
.IP \(bu 2
Tab completion results are truncated up to the common directory path, instead of somewhere inside that path. E.g. if you complete \(dqshare/functions\(dq, and it includes the files \(dqfoo.fish\(dq and \(dqbar.fish\(dq,
the completion pager will now show \(dq…/foo.fish\(dq and \(dq…/bar.fish\(dq (#11250 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11250>).
.IP \(bu 2
Self\-installing builds as created by e.g. \fBcargo install\fP no longer install other files, see below\&.
.IP \(bu 2
Our gettext\-based message\-localization has been reworked,
adding translations to self\-installing builds; see below\&.
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
\fBset_color \-\-background=COLOR\fP no longer implicitly activates bold mode.
If your theme is stored in universal variables (the historical default), some bold formatting might be lost.
To fix this, we suggest updating to the latest version of our theme, to explicitly activate bold mode,
for example use \fBfish_config theme save \(dqfish default\(dq\fP\&.
.IP \(bu 2
\fB{echo,echo}\fP or \fB{ echo, echo }\fP are no longer interpreted as brace expansion tokens but as compound commands \%<>\&.
.IP \(bu 2
Terminfo\-style key names (\fBbind \-k nul\fP) are no longer supported. They had been superseded by fish\(aqs own key names \%<> since 4.0 (#11342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11342>).
.IP \(bu 2
fish no longer reads the terminfo database, so its behavior is generally no longer affected by the \fBTERM\fP environment variable (#11344 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11344>).
For the time being, this change can be reversed via the \fBignore\-terminfo\fP feature flag \%<#\:featureflags>\&.
To do so, run the following once and restart fish:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features no\-ignore\-terminfo
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
The \fB\-\-install\fP option when fish is built as self\-installing is removed, see below\&.
.IP \(bu 2
\fBset_color ff0000\fP now outputs 24\-bit RGB true\-color even if \fBCOLORTERM\fP is unset.
One can override this by setting \fBfish_term24bit\fP \%<#\:envvar-fish_term24bit> to 0 (#11372 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11372>).
.IP \(bu 2
fish now requires the terminal to respond to queries for the Primary Device Attribute \%<#\:term-compat-primary-da>\&.
For now, this can be reversed via a feature flag \%<#\:featureflags>,
by running (once) \fBset \-Ua fish_features no\-query\-term\fP and restarting fish.
.IP \(bu 2
Users of GNU screen may experience minor glitches \%<#\:term-compat-dcs-gnu-screen> when starting fish.
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
The argparse \%<> builtin has seen many improvements, see below\&.
.IP \(bu 2
The string pad \%<> command now has a \fB\-C/\-\-center\fP option.
.IP \(bu 2
The psub \%<> command now allows combining \fB\-\-suffix\fP with \fB\-\-fifo\fP (#11729 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11729>).
.IP \(bu 2
The read \%<> builtin has learned the \fB\-\-tokenize\-raw\fP option to tokenize without quote removal (#11084 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11084>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Autosuggestions are now also provided in multi\-line command lines. Like \fBctrl\fP\-\fBr\fP, these operate only on the current line.
.IP \(bu 2
Autosuggestions used to not suggest multi\-line command\-lines from history; now autosuggestions include individual lines from multi\-line command\-lines.
.IP \(bu 2
The history pager search now preserves ordering between \fBctrl\fP\-\fBs\fP forward and \fBctrl\fP\-\fBr\fP backward searches.
.IP \(bu 2
Instead of highlighting events by flashing \fIall text to the left of the cursor\fP,
failing history token search (\fBalt\fP\-\fB\&.\fP) flashes the associated token,
failing tab\-completion flashes the to\-be\-completed token (#11050 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11050>),
deleting an autosuggestion (\fBshift\fP\-\fBdelete\fP) flashes the suggestion,
and all other scenarios flash the full command line.
.IP \(bu 2
Pasted commands are now stripped of any \fB$\ \fP command prefixes, to help pasting code snippets.
.IP \(bu 2
Builtin help options (e.g. \fBabbr \-\-help\fP) now use \fBman\fP directly, meaning that variables like \fBMANWIDTH\fP are respected (#11786 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11786>).
.IP \(bu 2
\fBfunced\fP will now edit copied functions directly, instead of the file where \fBfunction \-\-copy\fP was invoked. (#11614 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11614>)
.IP \(bu 2
Added a simple \fBfish_jj_prompt\fP which reduces visual noise in the prompt inside Jujutsu \%<https://\:jj-vcs\:.github\:.io/\:jj/\:latest/> repositories that are colocated with Git.
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
On non\-macOS systems, \fBalt\fP\-\fBleft\fP, \fBalt\fP\-\fBright\fP, \fBalt\fP\-\fBbackspace\fP and \fBalt\fP\-\fBdelete\fP no longer operate on punctuation\-delimited words but on whole arguments, possibly including special characters like \fB/\fP and quoted spaces.
On macOS, the corresponding \fBctrl\-\fP prefixed keys operate on whole arguments.
Word operations are still available via the other respective modifier, just like in most web browsers.
.IP \(bu 2
\fBctrl\fP\-\fBz\fP (undo) after executing a command will restore the previous cursor position instead of placing the cursor at the end of the command line.
.IP \(bu 2
The \fBalt\fP\-\fBs\fP binding will now also use \fBrun0\fP if available.
.IP \(bu 2
Some mouse support has been added: the OSC 133 prompt marking feature has learned about kitty\(aqs \fBclick_events=1\fP flag, which allows moving fish\(aqs cursor by clicking in the command line,
and selecting pager items (#10932 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10932>).
.IP \(bu 2
Before clearing the screen and redrawing, \fBctrl\fP\-\fBl\fP now pushes all text located above the prompt to the terminal\(aqs scrollback,
via a new special input function scrollback\-push \%<#\:special-input-functions-scrollback-push>\&.
For compatibility with terminals that do not implement ECMA\-48\(aqs SCROLL UP \%<#\:term-compat-indn> command,
this function is only used if the terminal advertises support for that via XTGETTCAP \%<#\:term-compat-xtgettcap>\&.
.IP \(bu 2
Vi mode has learned \fBctrl\fP\-\fBa\fP (increment) and \fBctrl\fP\-\fBx\fP (decrement) (#11570 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11570>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
\fBgit\fP completions now show the remote URL as description when completing remotes.
.IP \(bu 2
\fBsystemctl\fP completions no longer print escape codes if \fBSYSTEMD_COLORS\fP happens to be set (#11465 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11465>).
.IP \(bu 2
Added and improved many completion scripts, notably \fBtmux\fP\&.
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
Support for double, curly, dotted and dashed underlines, for use in \fBfish_color_*\fP variables and the set_color builtin \%<> (#10957 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10957>).
.IP \(bu 2
Underlines can now be colored independent of text (#7619 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7619>).
.IP \(bu 2
New documentation page Terminal Compatibility \%<> (also accessible via \fBman fish\-terminal\-compatibility\fP) lists the terminal control sequences used by fish.
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
Updated Chinese and German translations.
.IP \(bu 2
\fBfish_indent \-\-dump\-parse\-tree\fP now emits simple metrics about the tree including its memory consumption.
.IP \(bu 2
We added some tools to improve development workflows, for example \fBbuild_tools/{check,update_translations,release}.sh\fP and \fBtests/test_driver.py\fP\&.
In conjunction with \fBcargo\fP, these enable almost all day\-to\-day development tasks without using CMake.
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
Builtin commands that support the \fB\-\-help\fP option now require the \fBman\fP program.
The direct dependency on \fBmandoc\fP and \fBnroff\fP has been removed.
.IP \(bu 2
fish no longer uses gettext MO files, see below\&.
If you have use cases which are incompatible with our new approach, please let us know.
.IP \(bu 2
The fish_indent \%<> and fish_key_reader \%<> programs are now also available as builtins.
If fish is invoked via e.g. a symlink with one of these names,
it will act like the given tool (i.e. it\(aqs a multi\-call binary).
This allows truly distributing fish as a single file (#10876 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10876>).
.IP \(bu 2
The CMake build configuration has been simplified and no longer second\-guesses rustup.
It will run rustc and cargo via \fBPATH\fP \%<#\:envvar-PATH> or in ~/.cargo/bin/.
If that doesn\(aqt match your setup, set the Rust_COMPILER and Rust_CARGO CMake variables (#11328 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11328>).
.IP \(bu 2
Cygwin support has been reintroduced, since Rust gained a Cygwin target \%<https://\:github\:.com/\:rust-lang/\:rust/\:pull/\:134999> (#11238 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11238>).
.IP \(bu 2
CMake 3.15 is now required.
.UNINDENT
.SS Changes to self\-installing builds
.sp
The self\-installing build type introduced in fish 4.0 has been changed (#11143 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11143>).
Now fish built with embedded data will just read the data straight from its own binary or write it out to temporary files when necessary, instead of requiring an installation step on start.
That means it is now possible to build fish as a single file and copy it to any system with a compatible CPU architecture, including as a different user, without extracting any files.
As before, this is the default when building via \fBcargo\fP, and disabled when building via CMake.
For packagers we continue to recommend CMake.
.sp
Note: When fish is built like this, the \fB__fish_data_dir\fP variable will be empty because that directory no longer has meaning.
You should generally not need these files.
For example, if you want to make sure that completions for \(dqfoo\(dq are loaded, use \fBcomplete \-C\(dqfoo \(dq >/dev/null\fP  instead).
The raw files are still exposed via status subcommands \%<#\:status-get-file>, mainly for fish\(aqs internal use, but you can also use them as a last resort.
.sp
Remaining benefits of a full installation (as currently done by CMake) are:
.INDENT 0.0
.IP \(bu 2
man pages like \fBfish(1)\fP in standard locations, easily accessible from outside fish.
.IP \(bu 2
a local copy of the HTML documentation, typically accessed via the help \%<> function.
In builds with embedded data, \fBhelp\fP will redirect to e.g. \%<https://\:fishshell\:.com/\:docs/\:current/>
.IP \(bu 2
\fBfish_indent\fP and \fBfish_key_reader\fP as separate files, making them easily accessible outside fish
.IP \(bu 2
an (empty) \fB/etc/fish/config.fish\fP as well as empty directories \fB/etc/fish/{functions,completions,conf.d}\fP
.IP \(bu 2
\fB$PREFIX/share/pkgconfig/fish.pc\fP, which defines directories for configuration\-snippets, like \fBvendor_completions.d\fP
.UNINDENT
.SS Changes to gettext localization
.sp
We replaced several parts of the gettext functionality with custom implementations (#11726 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11726>).
Most notably, message extraction, which should now work reliably, and the runtime implementation, where we no longer dynamically link to gettext, but instead use our own implementation, whose behavior is similar to GNU gettext, with some minor deviations \%<>\&.
Our implementation now fully respects fish variables, so locale variables do not have to be exported for fish localizations to work.
They still have to be exported to inform other programs about language preferences.
The \fBLANGUAGE\fP \%<#\:envvar-LANGUAGE> environment variable is now treated as a path variable, meaning it is an implicitly colon\-separated list.
While we no longer have any runtime dependency on gettext, we still need gettext tools for building, most notably \fBmsgfmt\fP\&.
When building without \fBmsgfmt\fP available, localization will not work with the resulting executable.
Localization data is no longer sourced at runtime from MO files on the file system, but instead built into the executable.
This is always done, independently of the other data embedding, so all fish executables will have access to all message catalogs, regardless of the state of the file system.
Disabling our new \fBlocalize\-messages\fP cargo feature will cause fish to be built without localization support.
CMake builds can continue to use the \fBWITH_GETTEXT\fP option, with the same semantics as the \fBlocalize\-messages\fP feature.
The current implementation does not provide any configuration options for controlling which language catalogs are built into the executable (other than disabling them all).
As a workaround, you can delete files in the \fBpo\fP directory before building to exclude unwanted languages.
.SS Changes to the argparse \%<> builtin
.INDENT 0.0
.IP \(bu 2
\fBargparse\fP now saves recognised options, including option\-arguments in \fBargv_opts\fP \%<#\:envvar-argv_opts>, allowing them to be forwarded to other commands (#6466 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6466>).
.IP \(bu 2
\fBargparse\fP options can now be marked to be deleted from \fBargv_opts\fP \%<#\:envvar-argv_opts> (by adding a \fB&\fP at the end of the option spec, before a \fB!\fP if present). There is now also a corresponding \fB\-d\fP / \fB\-\-delete\fP option to \fBfish_opt\fP\&.
.IP \(bu 2
\fBargparse \-\-ignore\-unknown\fP now removes preceding known short options from groups containing unknown options (e.g. when parsing \fB\-abc\fP, if \fBa\fP is known but \fBb\fP is not, then \fBargv\fP \%<#\:envvar-argv> will contain \fB\-bc\fP).
.IP \(bu 2
\fBargparse\fP now has an \fB\-u\fP / \fB\-\-move\-unknown\fP option that works like \fB\-\-ignore\-unknown\fP but preserves unknown options in \fBargv\fP \%<#\:envvar-argv>\&.
.IP \(bu 2
\fBargparse\fP now has an \fB\-S\fP / \fB\-\-strict\-longopts\fP option that forbids abbreviating long options or passing them with a single dash (e.g. if there is a long option called \fBfoo\fP, \fB\-\-fo\fP and \fB\-\-foo\fP won\(aqt match it).
.IP \(bu 2
\fBargparse\fP now has a \fB\-U\fP / \fB\-\-unknown\-arguments\fP option to specify how to parse unknown option\(aqs arguments.
.IP \(bu 2
\fBargparse\fP now allows specifying options that take multiple optional values by using \fB=*\fP in the option spec (#8432 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8432>).
In addition, \fBfish_opt\fP has been modified to support such options by using the \fB\-\-multiple\-vals\fP together with \fB\-o\fP / \fB\-\-optional\-val\fP; \fB\-m\fP is also now acceptable as an abbreviation for \fB\-\-multiple\-vals\fP\&.
.IP \(bu 2
\fBfish_opt\fP no longer requires you give a short flag name when defining options, provided you give it a long flag name with more than one character.
.IP \(bu 2
\fBargparse\fP option specifiers for long\-only options can now start with \fB/\fP, allowing the definition of long options with a single letter. Due to this change, the \fB\-\-long\-only\fP option to \fBfish_opt\fP is now no longer necessary and is deprecated.
.IP \(bu 2
\fBfish_opt\fP now has a \fB\-v\fP / \fB\-\-validate\fP option you can use to give a fish script to validate values of the option.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.9 (released September 27, 2025)
.sp
This release fixes:
.INDENT 0.0
.IP \(bu 2
a regression in 4.0.6 causing shifted keys to not be inserted on some terminals (#11813 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11813>).
.IP \(bu 2
a regression in 4.0.6 causing the build to fail on systems where \fBchar\fP is unsigned (#11804 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11804>).
.IP \(bu 2
a regression in 4.0.0 causing a crash on an invalid bg \%<> invocation.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.8 (released September 18, 2025)
.sp
This release fixes a regression in 4.0.6 that caused user bindings to be shadowed by either fish\(aqs or a plugin\(aqs bindings (#11803 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11803>).

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.6 (released September 12, 2025)
.sp
This release of fish fixes a number of issues identified in fish 4.0.2:
.INDENT 0.0
.IP \(bu 2
fish now properly inherits $PATH under Windows WSL2 (#11354 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11354>).
.IP \(bu 2
Remote filesystems are detected properly again on non\-Linux systems.
.IP \(bu 2
the printf \%<> builtin no longer miscalculates width of multi\-byte characters (#11412 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11412>).
.IP \(bu 2
For many years, fish has been \(dqrelocatable\(dq \-\- it was possible to move the entire \fBCMAKE_INSTALL_PREFIX\fP and fish would use paths relative to its binary.
Only gettext locale paths were still determined purely at compile time, which has been fixed.
.IP \(bu 2
the commandline \%<> builtin failed to print the commandline set by a \fBcommandline \-C\fP invocation, which broke some completion scripts.
This has been corrected (#11423 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11423>).
.IP \(bu 2
To work around terminals that fail to parse Operating System Command (OSC) sequences, a temporary feature flag has been added.
It allows you to disable prompt marking (OSC 133) by running (once) \fBset \-Ua fish_features no\-mark\-prompt\fP and restarting fish (#11749 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11749>).
.IP \(bu 2
The routines to save history and universal variables have seen some robustness improvements.
.IP \(bu 2
builtin status current\-command \%<> no longer prints a trailing blank line.
.IP \(bu 2
A crash displaying multi\-line quoted command substitutions has been fixed (#11444 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11444>).
.IP \(bu 2
Commands like \fBset fish_complete_path ...\fP accidentally disabled completion autoloading, which has been corrected.
.IP \(bu 2
\fBnmcli\fP completions have been fixed to query network information dynamically instead of only when completing the first time.
.IP \(bu 2
Git completions no longer print an error when no \fIgit\-foo\fP executable is in \fBPATH\fP \%<#\:envvar-PATH>\&.
.IP \(bu 2
Custom completions like \fBcomplete foo \-l long \-xa ...\fP that use the output of \fBcommandline \-t\fP\&.
on a command\-line like \fBfoo \-\-long=\fP have been invalidated by a change in 4.0; the completion scripts have been adjusted accordingly (#11508 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11508>).
.IP \(bu 2
Some completions were misinterpreted, which caused garbage to be displayed in the completion list. This has been fixed.
.IP \(bu 2
fish no longer interprets invalid control sequences from the terminal as if they were \fBalt\fP\-\fB[\fP or \fBalt\fP\-\fBo\fP key strokes.
.IP \(bu 2
bind \%<> has been taught about the \fBprintscreen\fP and \fBmenu\fP keys.
.IP \(bu 2
\fBalt\fP\-\fBdelete\fP now deletes the word right of the cursor.
.IP \(bu 2
\fBctrl\fP\-\fBalt\fP\-\fBh\fP erases the last word again (#11548 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11548>).
.IP \(bu 2
\fBalt\fP\-\fBleft\fP \fBalt\fP\-\fBright\fP were misinterpreted because they send unexpected sequences on some terminals; a workaround has been added.  (#11479 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11479>).
.IP \(bu 2
Key bindings like \fBbind shift\-A\fP are no longer accepted; use \fBbind shift\-a\fP or \fBbind A\fP\&.
.IP \(bu 2
Key bindings like \fBbind shift\-a\fP take precedence over \fBbind A\fP when the key event included the shift modifier.
.IP \(bu 2
Bindings using shift with non\-ASCII letters (such as \fBctrl\fP\-\fBshift\fP\-\fBä\fP) are now supported.
.IP \(bu 2
Bindings with modifiers such as \fBbind ctrl\-w\fP work again on non\-Latin keyboard layouts such as a Russian one.
This is implemented by allowing key events such as \fBctrl\fP\-\fBц\fP to match bindings of the corresponding Latin key, using the kitty keyboard protocol\(aqs base layout key (#11520 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11520>).
.IP \(bu 2
Vi mode: The cursor position after pasting via \fBp\fP has been corrected.
.IP \(bu 2
Vi mode: Trying to replace the last character via \fBr\fP no longer replaces the last\-but\-one character (#11484 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11484>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.2 (released April 20, 2025)
.sp
This release of fish fixes a number of issues identified in fish 4.0.1:
.INDENT 0.0
.IP \(bu 2
Completions are quoted, rather than backslash\-escaped, only if the completion is unambiguous. Continuing to edit the token is therefore easier (#11271 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11271>). This changes the behavior introduced in 4.0.0 where all completions were quoted.
.IP \(bu 2
The warning when the terminfo database can\(aqt be found has been downgraded to a log message. fish will act as if the terminal behaves like xterm\-256color, which is correct for the vast majority of cases (#11277 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11277>, #11290 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11290>).
.IP \(bu 2
Key combinations using the super (Windows/command) key can now (actually) be bound using the \fBsuper\-\fP prefix (#11217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11217>). This was listed in the release notes for 4.0.1 but did not work correctly.
.IP \(bu 2
function \%<> is stricter about argument parsing, rather than allowing additional parameters to be silently ignored (#11295 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11295>).
.IP \(bu 2
Using parentheses in the test \%<> builtin works correctly, following a regression in 4.0.0 where they were not recognized (#11387 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11387>).
.IP \(bu 2
\fBdelete\fP in Vi mode when Num Lock is active will work correctly (#11303 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11303>).
.IP \(bu 2
Abbreviations cannot alter the command\-line contents, preventing a crash (#11324 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11324>).
.IP \(bu 2
Improvements to various completions, including new completions for \fBwl\-randr\fP (#11301 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11301>), performance improvements for \fBcargo\fP completions by avoiding network requests (#11347 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11347>), and other improvements for  \fBbtrfs\fP (#11320 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11320>), \fBcryptsetup\fP (#11315 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11315>), \fBgit\fP (#11319 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11319>, #11322 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11322>, #11323 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11323>), \fBjj\fP (#11046 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11046>), and \fBsystemd\-analyze\fP (#11314 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11314>).
.IP \(bu 2
The Mercurial (\fBhg\fP) prompt can handle working directories that contain an embedded newline, rather than producing errors (#11348 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11348>).
.IP \(bu 2
A number of crashes have been fixed. Triggers include prompts containing backspace characters (#11280 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11280>), history pager search (#11355 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11355>), invalid UTF\-8 in read \%<> (#11383 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11383>), and the \fBkill\-selection\fP binding (#11367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11367>).
.IP \(bu 2
A race condition in the test suite has been fixed (#11254 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11254>), and a test for fish versioning relaxed to support downstream distributors\(aq modifications (#11173 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11173>).
.IP \(bu 2
Small improvements to the documentation (#11264 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11264>, #11329 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11329>, #11361 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11361>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.1 (released March 12, 2025)
.sp
This release of fish includes the following improvements compared to fish 4.0.0:
.INDENT 0.0
.IP \(bu 2
Key combinations using the super (Windows/command) key can be bound using the \fBsuper\-\fP prefix (#11217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11217>).
.IP \(bu 2
Konsole\(aqs menu shows the \(dqOpen folder with\(dq option again (#11198 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11198>).
.IP \(bu 2
.INDENT 2.0
.TP
.B \fB$fish_color_search_match\fP will now only be applied to the foreground color if it has an explicit foreground. For example, this allows setting::
set \-g fish_color_search_match \-\-reverse
.UNINDENT
.IP \(bu 2
Cursor shape commands (\fB\ee[2 q\fP) are no longer sent in non\-interactive shells or in redirections (#11255 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11255>).
.IP \(bu 2
status \%<> gained a \fBis\-interactive\-read\fP subcommand, to check whether the script is being called from an interactive read \%<> invocation.
.IP \(bu 2
fish\(aqs background tasks are now started in a way that avoids an error on macOS Terminal.app (#11181 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11181>).
.IP \(bu 2
Using key combinations within qemu should work correctly.
.IP \(bu 2
Prompts containing control characters no longer cause incorrect display of command lines (#11252 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11252>).
.IP \(bu 2
Cancelling the command\-line in Vi mode displays correctly again (#11261 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11261>).
.IP \(bu 2
The acidhub prompt properly displays the git branch again (#11179 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11179>).
.IP \(bu 2
Completions for \fBwine\fP correctly include files again (#11202 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11202>).
.IP \(bu 2
On macOS, paths from \fB/etc/paths\fP and \fB/etc/manpaths\fP containing colons are handled correctly (#10684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10684>). This functionality was included in the 4.0.0 release notes but was missing from the source code.
.IP \(bu 2
The XTerm \fBmodifyOtherKeys\fP keyboard encoding is no longer used under WezTerm, as it does not work correctly in all layouts (#11204 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11204>).
.IP \(bu 2
\fBoption\fP\-\fBleft\fP and other similar keys should now work in iTerm versions before 3.5.12; the kitty keyboard protocol is now disabled on these versions (#11192 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11192>).
.IP \(bu 2
The kitty keyboard protocol is no longer used under Midnight Commander, as it does not work correctly (#10640 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10640>).
.IP \(bu 2
fish now sends the commandline along with the OSC 133 semantic prompt command start sequence. This fixes a test in the kitty terminal (#11203 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11203>).
.IP \(bu 2
Git completions for third\-party commands like \(dqgit\-absorb\(dq are completed correctly again (#11205 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11205>).
.IP \(bu 2
Completions for \fBdiskutil\fP no longer produce an error (#11201 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11201>).
.IP \(bu 2
The output of certain error messages no longer prints newlines to standard output (#11248 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11248>).
.IP \(bu 2
A number of crashes have been fixed, including file names longer than 255 bytes (#11221 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11221>), using fish on a btrfs filesystem (#11219 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11219>), history files that do not have the expected format (#11236 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11236>), and pasting into an empty command line (#11256 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11256>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0.0 (released February 27, 2025)
.sp
fish\(aqs core code has been ported from C++ to Rust (#9512 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9512>). This means a large change in dependencies and how to build fish. However, there should be no direct impact on users. Packagers should see the For Distributors section at the end.
.SS Notable backwards\-incompatible changes
.INDENT 0.0
.IP \(bu 2
As part of a larger binding rework, \fBbind\fP gained a new key notation.
In most cases the old notation should keep working, but in rare cases you may have to change a \fBbind\fP invocation to use the new notation.
See below for details.
.IP \(bu 2
\fBctrl\fP\-\fBc\fP now calls a new bind function called \fBclear\-commandline\fP\&. The old behavior, which leaves a \(dq^C\(dq marker, is available as \fBcancel\-commandline\fP (#10935 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10935>)
.IP \(bu 2
\fBrandom\fP 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9593>).
.IP \(bu 2
Variables in command position that expand to a subcommand keyword are now forbidden to fix a likely user error.
For example, \fBset editor command emacs; $editor\fP is no longer allowed (#10249 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10249>).
.IP \(bu 2
\fBfunctions \-\-handlers\fP 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9944>).
.IP \(bu 2
The \fBqmark\-noglob\fP feature, introduced in fish 3.0, is enabled by default. That means \fB?\fP will no longer act as a single\-character glob.
You can, for the time being, turn it back on by adding \fBno\-qmark\-noglob\fP to \fBfish_features\fP and restarting fish:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features no\-qmark\-noglob
.EE
.UNINDENT
.UNINDENT
.sp
The flag will eventually be made read\-only, making it impossible to turn off.
.IP \(bu 2
Terminals that fail to ignore unrecognized OSC or CSI sequences may display garbage. We know cool\-retro\-term and emacs\(aq ansi\-term are affected, but most mainstream terminals are not.
.IP \(bu 2
fish no longer searches directories from the Windows system/user \fB$PATH\fP 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 \fB/mnt/c/...\fP path is explicitly added to \fB$fish_user_paths\fP and not just automatically appended to \fB$PATH\fP by \fBwsl.exe\fP (#10506 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10506>).
.IP \(bu 2
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 \fBSIGHUP\fP + \fBSIGCONT\fP 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 into \fBSIGTTOU\fP remain in a suspended state indefinitely (#5263 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5263>). The workaround is to explicitly \fBdisown\fP processes you wish to outlive the shell session.
.UNINDENT
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
fish now requests XTerm\(aqs \fBmodifyOtherKeys\fP keyboard encoding and kitty keyboard protocol\(aqs \%<https://\:sw\:.kovidgoyal\:.net/\:kitty/\:keyboard-protocol/> progressive enhancements (#10359 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10359>).
Depending on terminal support, this allows to binding more key combinations, including arbitrary combinations of modifiers \fBctrl\fP, \fBalt\fP and \fBshift\fP, and distinguishing (for example) \fBctrl\fP\-\fBi\fP from \fBtab\fP\&.
.sp
Additionally, \fBbind\fP now supports a human\-readable syntax in addition to byte sequences.
This includes modifier names, and names for keys like \fBenter\fP and \fBbackspace\fP\&.
For example
.INDENT 2.0
.IP \(bu 2
\fBbind up \(aqdo something\(aq\fP binds the up\-arrow key instead of a two\-key sequence (\(dqu\(dq and then \(dqp\(dq)
.IP \(bu 2
\fBbind ctrl\-x,alt\-c \(aqdo something\(aq\fP binds a sequence of two keys.
.UNINDENT
.sp
Any key argument that starts with an ASCII control character (like \fB\ee\fP or \fB\ecX\fP) or is up to 3 characters long, not a named key, and does not contain \fB,\fP or \fB\-\fP will be interpreted in the old syntax to keep compatibility for the majority of bindings.
.sp
Keyboard protocols can be turned off by disabling the \(dqkeyboard\-protocols\(dq feature flag:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features no\-keyboard\-protocols
.EE
.UNINDENT
.UNINDENT
.sp
This is a temporary measure to work around buggy terminals (#11056 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11056>), which appear to be relatively rare.
Use this if something like \(dq=0\(dq or \(dq=5u\(dq appears in your commandline mysteriously.
.IP \(bu 2
fish can now be built as a self\-installing binary (#10367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\: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:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
cargo install \-\-path . # in a clone of the fish repository
# or \(gacargo build \-\-release\(ga and copy target/release/fish{,_indent,_key_reader} wherever you want
.EE
.UNINDENT
.UNINDENT
.sp
The first time it runs interactively, it will extract all the data files to  \fB~/.local/share/fish/install/\fP\&. A specific path can be used for the data files with \fBfish \-\-install=PATH\fP To uninstall, remove the fish binaries and that directory.
.sp
This build system is experimental; the main build system, using \fBcmake\fP, remains the recommended approach for packaging and installation to a prefix.
.IP \(bu 2
A new function \fBfish_should_add_to_history\fP can be overridden to decide whether a command should be added to the history (#10302 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10302>).
.IP \(bu 2
Bindings can now mix special input functions and shell commands, so \fBbind ctrl\-g expand\-abbr \(dqcommandline \-i \en\(dq\fP works as expected (#8186 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8186>).
.IP \(bu 2
Special input functions run from bindings via \fBcommandline \-f\fP are now applied immediately, instead of after the currently executing binding (#3031 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3031>, #10126 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10126>).
For example, \fBcommandline \-i foo; commandline | grep foo\fP succeeds now.
.IP \(bu 2
Undo history is no longer truncated after every command, but kept for the lifetime of the shell process.
.IP \(bu 2
The \fBctrl\fP\-\fBr\fP history search now uses glob syntax (#10131 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10131>).
.IP \(bu 2
The \fBctrl\fP\-\fBr\fP history search now operates only on the line or command substitution at cursor, making it easier to combine commands from history (#9751 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9751>).
.IP \(bu 2
Abbreviations can now be restricted to specific commands. For instance:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
abbr \-\-add \-\-command git back \(aqreset \-\-hard HEAD^\(aq
.EE
.UNINDENT
.UNINDENT
.sp
will expand \(dqback\(dq to \fBreset \-\-hard HEAD^\fP, but only when the command is \fBgit\fP (#9411 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9411>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
\fBcommandline \-\-tokenize\fP (short option \fB\-o\fP) has been deprecated in favor of \fBcommandline \-\-tokens\-expanded\fP (short option \fB\-x\fP) which expands variables and other shell syntax, removing the need to use eval \%<> in completion scripts (#10212 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10212>).
.IP \(bu 2
Two new feature flags:
.INDENT 2.0
.IP \(bu 2
\fBremove\-percent\-self\fP (see \fBstatus features\fP) disables PID expansion of \fB%self\fP, which has been supplanted by \fB$fish_pid\fP (#10262 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10262>).
.IP \(bu 2
\fBtest\-require\-arg\fP disables \fBtest\fP\(aqs one\-argument mode. That means \fBtest \-n\fP without an additional argument will return false, \fBtest \-z\fP 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 \fB[\fP, test\(aqs 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 \(dqdeprecated\-test\(dq. Running fish with \fBfish \-d deprecated\-test\fP will show warnings whenever a \fBtest\fP invocation that would change is used. (#10365 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10365>).
.UNINDENT
.sp
These can be enabled with:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features remove\-percent\-self test\-require\-arg
.EE
.UNINDENT
.UNINDENT
.sp
We intend to enable them by default in future, and after that eventually make them read\-only.
.IP \(bu 2
Specifying key names as terminfo names (using the \fBbind \-k\fP syntax) is deprecated and may be removed in a future version.
.IP \(bu 2
When a terminal pastes text into fish using bracketed paste, fish used to switch to a special \fBpaste\fP bind mode.
This bind mode has been removed. The behavior on paste is no longer configurable.
.IP \(bu 2
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 the \fBreset\fP command from \fBncurses\fP to restore the terminal state.
.IP \(bu 2
\fBfish_key_reader \-\-verbose\fP no longer shows timing information.
.IP \(bu 2
Terminal information is no longer read from hashed terminfo databases, or termcap databases (#10269 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10269>). The vast majority of systems use a non\-hashed terminfo database, which is still supported.
.IP \(bu 2
\fBsource\fP returns an error if used without a filename or pipe/redirection (#10774 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10774>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBfor\fP loops will no longer remember local variables from the previous iteration (#10525 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10525>).
.IP \(bu 2
A new \fBhistory append\fP subcommand appends a command to the history, without executing it (#4506 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4506>).
.IP \(bu 2
A new redirection: \fB<? /path/to/file\fP will try opening the file as input, and if it doesn\(aqt succeed silently uses \fB/dev/null\fP instead.
This can help with checks like \fBtest \-f /path/to/file; and string replace foo bar < /path/to/file\fP\&. (#10387 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10387>)
.IP \(bu 2
A new option \fBcommandline \-\-tokens\-raw\fP prints a list of tokens without any unescaping (#10212 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10212>).
.IP \(bu 2
A new option \fBcommandline \-\-showing\-suggestion\fP tests whether an autosuggestion is currently displayed (#10586 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10586>).
.IP \(bu 2
\fBfunctions\fP and \fBtype\fP now show that a function was copied and its source, rather than solely \fBDefined interactively\fP (#6575 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6575>).
.IP \(bu 2
Stack trace now shows line numbers for copied functions (#6575 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6575>).
.IP \(bu 2
\fBfoo & && bar\fP is now a syntax error, like in other shells (#9911 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9911>).
.IP \(bu 2
\fBif \-e foo; end\fP now prints a more accurate error (#10000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10000>).
.IP \(bu 2
\fBcd\fP into a directory that is not readable but accessible (permissions \fB\-\-x\fP) is now possible (#10432 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10432>).
.IP \(bu 2
An integer overflow in \fBstring repeat\fP leading to a near\-infinite loop has been fixed (#9899 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9899>).
.IP \(bu 2
\fBstring shorten\fP behaves better in the presence of non\-printable characters, including fixing an integer overflow that shortened strings more than intended (#9854 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9854>).
.IP \(bu 2
\fBstring pad\fP no longer allows non\-printable characters as padding (#9854 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9854>).
.IP \(bu 2
\fBstring repeat\fP now allows omission of \fB\-n\fP when the first argument is an integer (#10282 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10282>).
.IP \(bu 2
\fBstring match\fP and \fBreplace\fP have a new \fB\-\-max\-matches\fP option to return as soon as the specified number of matches have been identified, which can improve performance in scripts (#10587 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10587>).
.IP \(bu 2
\fBfunctions \-\-handlers\-type caller\-exit\fP once again lists functions defined as \fBfunction \-\-on\-job\-exit caller\fP, rather than them being listed by \fBfunctions \-\-handlers\-type process\-exit\fP\&.
.IP \(bu 2
A new \fBset \-\-no\-event\fP option sets or erases variables without triggering a variable event. This can be useful to change a variable in an event handler (#10480 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10480>).
.IP \(bu 2
Commas in command substitution output are no longer used as separators in brace expansion, preventing a surprising expansion in some cases (#5048 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5048>).
.IP \(bu 2
Universal variables can now store strings containing invalid UTF\-8 (#10313 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10313>).
.IP \(bu 2
A new \fBpath basename \-E\fP option that causes it to return the basename (\(dqfilename\(dq with the directory prefix removed) with the final extension (if any) also removed. This is a shorter version of \fBpath change\-extension \(dq\(dq (path basename $foo)\fP (#10521 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10521>).
.IP \(bu 2
A new \fBmath \-\-scale\-mode\fP option to select \fBtruncate\fP, \fBround\fP, \fBfloor\fP, \fBceiling\fP as you wish; the default value is \fBtruncate\fP\&. (#9117 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9117>).
.IP \(bu 2
\fBrandom\fP is now less strict about its arguments, allowing a start larger or equal to the end. (#10879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10879>)
.IP \(bu 2
\fBfunction \-\-argument\-names\fP now produces an error if a read\-only variable name is used, rather than simply ignoring it (#10842 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10842>).
.IP \(bu 2
Tilde expansion in braces (that is, \fB{~,}\fP) works correctly (#10610 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10610>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Autosuggestions were sometimes not shown after recalling a line from history, which has been fixed (#10287 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10287>).
.IP \(bu 2
Up\-arrow search matches \-\- which are highlighted in reverse colors \-\- are no longer syntax\-highlighted, to fix bad contrast with the search match highlighting.
.IP \(bu 2
Command abbreviations (those with \fB\-\-position command\fP or without a \fB\-\-position\fP) now also expand after decorators like \fBcommand\fP (#10396 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10396>).
.IP \(bu 2
Abbreviations now expand after process separators like \fB;\fP and \fB|\fP\&. This fixes a regression in version 3.6 (#9730 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9730>).
.IP \(bu 2
When exporting interactively defined functions (using \fBtype\fP, \fBfunctions\fP or \fBfuncsave\fP) the function body is now indented, to match the interactive command line editor (#8603 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8603>).
.IP \(bu 2
\fBctrl\fP\-\fBx\fP (\fBfish_clipboard_copy\fP) on multiline commands now includes indentation (#10437 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10437>).
.IP \(bu 2
\fBctrl\fP\-\fBv\fP (\fBfish_clipboard_paste\fP) now strips ASCII control characters from the pasted text.
This is consistent with normal keyboard input (#5274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5274>).
.IP \(bu 2
When a command like \fBfg %2\fP fails to find the given job, it no longer behaves as if no job spec was given (#9835 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9835>).
.IP \(bu 2
Redirection in command position like \fB>echo\fP is now highlighted as error (#8877 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8877>).
.IP \(bu 2
\fBfish_vi_cursor\fP now works properly inside the prompt created by builtin \fBread\fP (#10088 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10088>).
.IP \(bu 2
fish no longer fails to open a FIFO if interrupted by a terminal resize signal (#10250 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10250>).
.IP \(bu 2
\fBread \-\-help\fP and friends no longer ignore redirections. This fixes a regression in version 3.1 (#10274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10274>).
.IP \(bu 2
Measuring a command with \fBtime\fP now considers the time taken for command substitution (#9100 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9100>).
.IP \(bu 2
\fBfish_add_path\fP now automatically enables verbose mode when used interactively (in the command line), in an effort to be clearer about what it does (#10532 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10532>).
.IP \(bu 2
fish no longer adopts TTY modes of failed commands (#10603 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10603>).
.IP \(bu 2
\fBcomplete \-e cmd\fP now prevents autoloading completions for \fBcmd\fP (#6716 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6716>).
.IP \(bu 2
fish\(aqs default color scheme no longer uses the color \(dqblue\(dq, as it has bad contrast against the background in a few terminal\(aqs default palettes (#10758 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10758>, #10786 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10786>)
The color scheme will not be upgraded for existing installs. If you want, you should select it again via \fBfish_config\fP\&.
.IP \(bu 2
Command lines which are larger than the terminal are now displayed correctly, instead of multiple blank lines being displayed (#7296 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7296>).
.IP \(bu 2
Prompts that use external commands will no longer produce an infinite loop if the command crashes (#9796 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9796>).
.IP \(bu 2
The output of \fBjobs\fP shows \(dq\-\(dq for jobs that have the same process group ID as the fish process, rather than \(dq\-2\(dq (#10833 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10833>).
.IP \(bu 2
Job expansion (\fB%1\fP syntax) works properly for jobs that are a mixture of external commands and functions (#10832 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10832>).
.IP \(bu 2
Command lines which have more lines than the terminal can be displayed and edited correctly (#10827 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10827>).
.IP \(bu 2
Functions that have been erased are no longer highlighted as valid commands (#10866 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10866>).
.IP \(bu 2
\fBnot\fP, \fBtime\fP, and variable assignments (that is \fBnot time a=b env\fP) is correctly recognized as valid syntax (#10890 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10890>).
.IP \(bu 2
The Web\-based configuration removes old right\-hand\-side prompts again, fixing a regression in fish 3.4.0 (#10675 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10675>).
.IP \(bu 2
Further protection against programs which crash and leave the terminal in an inconsistent state (#10834 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10834>, #11038 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11038>).
.IP \(bu 2
A workaround for git being very slow on macOS has been applied, improving performance after a fresh boot (#10535 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10535>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
When the cursor is on a command that resolves to an executable script, \fBalt\fP\-\fBo\fP will now open that script in your editor (#10266 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10266>).
.IP \(bu 2
During up\-arrow history search, \fBshift\fP\-\fBdelete\fP will delete the current search item and move to the next older item. Previously this was only supported in the history pager.
.IP \(bu 2
\fBshift\fP\-\fBdelete\fP will also remove the currently\-displayed autosuggestion from history, and remove it as a suggestion.
.IP \(bu 2
\fBctrl\fP\-\fBZ\fP (also known as \fBctrl\fP\-\fBshift\fP\-\fBz\fP) is now bound to redo.
.IP \(bu 2
Some improvements to the \fBalt\fP\-\fBe\fP binding which edits the command line in an external editor:
.INDENT 2.0
.IP \(bu 2
The editor\(aqs cursor position is copied back to fish. This is currently supported for Vim and Kakoune.
.IP \(bu 2
Cursor position synchronization is only supported for a set of known editors, which are now also detected in aliases which use \fBcomplete \-\-wraps\fP\&. For example, use \fBcomplete \-\-wraps my\-vim vim\fP to synchronize cursors when \fBEDITOR=my\-vim\fP\&.
.IP \(bu 2
Multiline commands are indented before being sent to the editor, which matches how they are displayed in fish.
.UNINDENT
.IP \(bu 2
The \fB\&...\-path\-component\fP bindings, like \fBbackward\-kill\-path\-component\fP, now treat \fB#\fP as part of a path component (#10271 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10271>).
.IP \(bu 2
Bindings like \fBalt\fP\-\fBl\fP that print output in between prompts now work correctly with multiline commandlines.
.IP \(bu 2
\fBalt\fP\-\fBd\fP on an empty command line lists the directory history again. This restores the behavior of version 2.1.
.IP \(bu 2
\fBhistory\-prefix\-search\-backward\fP and \fB\-forward\fP now maintain the cursor position, instead of moving the cursor to the end of the command line (#10430 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10430>).
.IP \(bu 2
The following keys have refined behavior if the terminal supports the new keyboard encodings:
.INDENT 2.0
.IP \(bu 2
\fBshift\fP\-\fBenter\fP now inserts a newline instead of executing the command line.
.IP \(bu 2
\fBctrl\fP\-\fBbackspace\fP now deletes the last word instead of only one character (#10741 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10741>).
.IP \(bu 2
\fBctrl\fP\-\fBdelete\fP deletes the next word (same as \fBalt\fP\-\fBd\fP).
.UNINDENT
.IP \(bu 2
New special input functions:
.INDENT 2.0
.IP \(bu 2
\fBforward\-char\-passive\fP and \fBbackward\-char\-passive\fP are like their non\-passive variants but do not accept autosuggestions or move focus in the completion pager (#10398 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10398>).
.IP \(bu 2
\fBforward\-token\fP, \fBbackward\-token\fP, \fBkill\-token\fP, and \fBbackward\-kill\-token\fP are similar to the \fB*\-bigword\fP variants but for the whole argument token (which includes escaped spaces) (#2014 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2014>).
.IP \(bu 2
\fBclear\-commandline\fP, which merely clears the command line, as an alternative to \fBcancel\-commandline\fP which prints \fB^C\fP and a new prompt (#10213 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10213>).
.UNINDENT
.IP \(bu 2
The \fBaccept\-autosuggestion\fP special input function now returns false when there was nothing to accept (#10608 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10608>).
.IP \(bu 2
Vi mode has seen some improvements but continues to suffer from the lack of people working on it.
.INDENT 2.0
.IP \(bu 2
New default cursor shapes for insert and replace mode.
.IP \(bu 2
\fBctrl\fP\-\fBn\fP in insert mode accepts autosuggestions (#10339 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10339>).
.IP \(bu 2
Outside insert mode, the cursor will no longer be placed beyond the last character on the commandline.
.IP \(bu 2
When the cursor is at the end of the commandline, a single \fBl\fP will accept an autosuggestion (#10286 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10286>).
.IP \(bu 2
The cursor position after pasting (\fBp\fP) has been corrected.
.IP \(bu 2
Added an additional binding, \fB_\fP, for moving to the beginning of the line (#10720 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10720>).
.IP \(bu 2
When the cursor is at the start of a line, escaping from insert mode no longer moves the cursor to the previous line.
.IP \(bu 2
Added bindings for clipboard interaction, like \fB\(dq,\fP+\fB,p\fP and \fB\(dq,\fP+\fB,y,y\fP\&.
.IP \(bu 2
Deleting in visual mode now moves the cursor back, matching vi (#10394 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10394>).
.IP \(bu 2
The \fB;\fP, \fB,\fP, \fBv\fP, \fBV\fP, \fBI\fP, and \fBgU\fP bindings work in visual mode (#10601 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10601>, #10648 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10648>).
.IP \(bu 2
Support \fB%\fP motion (#10593 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10593>).
.IP \(bu 2
\fBctrl\fP\-\fBk\fP to remove the contents of the line beyond the cursor in all modes (#10648 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10648>).
.IP \(bu 2
Support \fIab\fP and \fIib\fP vi text objects. New input functions are introduced \fBjump\-{to,till}\-matching\-bracket\fP (#1842 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1842>).
.IP \(bu 2
The \fBE\fP binding now correctly handles the last character of the word, by jumping to the next word (#9700 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9700>).
.UNINDENT
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Command\-specific tab completions may now offer results whose first character is a period. For example, it is now possible to tab\-complete \fBgit add\fP for files with leading periods. The default file completions hide these files, unless the token itself has a leading period (#3707 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3707>).
.IP \(bu 2
Option completion now uses fuzzy subsequence filtering, just like non\-option completion (#830 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:830>).
This means that \fB\-\-fb\fP may be completed to \fB\-\-foobar\fP if there is no better match.
.IP \(bu 2
Completions that insert an entire token now use quotes instead of backslashes to escape special characters (#5433 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5433>).
.IP \(bu 2
Normally, file name completions start after the last \fB:\fP  or \fB=\fP in a token.
This helps commands like \fBrsync \-\-files\-from=\fP\&.
This special meaning can now disabled by escaping these separators as \fB\e:\fP and \fB\e=\fP\&.
This matches Bash\(aqs behavior.
Note that this escaping is usually not necessary since the completion engine already tries
to guess whether the separator is actually part of a file name.
.IP \(bu 2
Various new completion scripts and numerous updates to existing ones.
.IP \(bu 2
Completions could hang if the \fBPAGER\fP environment variable was sent to certain editors on macOS, FreeBSD and some other platforms. This has been fixed (#10820 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10820>).
.IP \(bu 2
Generated completions are now stored in \fB$XDG_CACHE_HOME/fish\fP or \fB~/.cache/fish\fP by default (#10369 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10369>)
.IP \(bu 2
A regression in fish 3.1, where completing a command line could change it completely, has been fixed (#10904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10904>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
fish now marks the prompt and command\-output regions (via OSC 133) to enable terminal shell integration (#10352 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10352>).
Shell integration shortcuts can scroll to the next/previous prompt or show the last command output in a pager.
.IP \(bu 2
fish now reports the working directory (via OSC 7) unconditionally instead of only for some terminals (#9955 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9955>).
.IP \(bu 2
fish now sets the terminal window title (via OSC 0) unconditionally instead of only for some terminals (#10037 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10037>).
.IP \(bu 2
Focus reporting in tmux is no longer disabled on the first prompt.
.IP \(bu 2
Focus reporting is now disabled during commands run inside key bindings (#6942 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6942>).
.IP \(bu 2
Cursor changes are applied to all terminals that support them, and the list of specifically\-supported terminals has been removed (#10693 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10693>).
.IP \(bu 2
If it cannot find the terminfo entry given by \fBTERM\fP environment variable, fish will now use an included \fBxterm\-256color\fP definition to match the vast majority of current terminal emulators (#10905 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10905>). If you need to have a specific terminfo profile for your terminal\(aqs \fBTERM\fP variable, install it into the terminfo database.
.IP \(bu 2
Further improvements to the correct display of prompts which fill the width of the terminal (#8164 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8164>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
\fBstatus\fP gained a \fBbuild\-info\fP subcommand, to print information on how fish was built, to help with debugging (#10896 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10896>).
.IP \(bu 2
\fBfish_indent\fP will now collapse multiple empty lines into one (#10325 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10325>).
.IP \(bu 2
\fBfish_indent\fP now preserves the modification time of files if there were no changes (#10624 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10624>).
.IP \(bu 2
Performance in launching external processes has been improved for many cases (#10869 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10869>).
.IP \(bu 2
Performance and interactivity under Windows Subsystem for Linux has been improved, with a workaround for Windows\-specific locations being appended to \fB$PATH\fP by default (#10506 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10506>).
.IP \(bu 2
On macOS, paths from \fB/etc/paths\fP and \fB/etc/manpaths\fP containing colons are handled correctly (#10684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10684>).
.IP \(bu 2
Additional filesystems such as AFS are properly detected as remote, which avoids certain hangs due to expensive filesystem locks (#10818 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10818>).
.IP \(bu 2
A spurious error when launching multiple instances of fish for the first time has been removed (#10813 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10813>).
.UNINDENT
.SS For distributors
.sp
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).
.sp
CMake remains the recommended build system, because of cargo\(aqs 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9924>). CMake builds default to optimized release builds (#10799 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10799>).
.sp
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.
.sp
The \fBtest\fP target was removed as it can no longer be defined in new CMake versions. Use \fBmake fish_run_tests\fP\&. Any existing test target will not print output if it fails (#11116 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:11116>).
.sp
The Web\-based configuration has been rewritten to use Alpine.js (#9554 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9554>).

.sp
.ce
----

.ce 0
.sp
.SS fish 4.0b1 (released December 17, 2024)
.sp
A number of improvements were included in fish 4.0.0 following the beta release of 4.0b1. These include fixes for regressions, improvements to completions and documentation, and the removal of a small number of problematic changes.
.sp
The full list of fixed issues can be found on the GitHub milestone page for 4.0\-final \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:milestone/43>\&.

.sp
.ce
----

.ce 0
.sp
.SS fish 3.7.1 (released March 19, 2024)
.sp
This release of fish fixes the following problems identified in fish 3.7.0:
.INDENT 0.0
.IP \(bu 2
Deleting the last history entry via \fBhistory delete\fP works again (#10190 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10190>).
.IP \(bu 2
Wildcards (\fB*\fP) will no longer sometimes generate paths that did not exist (#10205 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10205>).
.UNINDENT
.sp
This release also contains some improvements:
.INDENT 0.0
.IP \(bu 2
A crash when trying to run an ELF program with a missing interpreter has been fixed. This crashed in the process after fork, so did not affect the fish process that tried to start the program (#10199 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10199>).
.IP \(bu 2
\fBfunced\fP will now always \fBsource\fP the file after it has written it, even if the contents did not change. This prevents issues if the file was otherwise modified (#10318 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10318>).
.IP \(bu 2
The warning for when a builtin returns a negative exit code was improved, now mentioning the original status (#10187 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10187>).
.IP \(bu 2
Added completions for
.INDENT 2.0
.IP \(bu 2
\fBcobra\-cli\fP (#10293 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10293>)
.IP \(bu 2
\fBdmidecode\fP (#10368 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10368>)
.IP \(bu 2
\fBmycli\fP (#10309 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10309>)
.IP \(bu 2
\fBollama\fP (#10327 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10327>)
.IP \(bu 2
\fBpstree\fP (#10317 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10317>)
.UNINDENT
.IP \(bu 2
Some improvements to documentation and completions.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.7.0 (released January 1, 2024)
.sp
This release of fish includes a number of improvements over fish 3.6.4, detailed below. Although work continues on the porting of fish internals to the Rust programming language, that work is not included in this release. fish 3.7.0 and any future releases in the 3.7 series remain C++ programs.
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
Improvements to the history pager, including:
.INDENT 2.0
.IP \(bu 2
The history pager will now also attempt subsequence matches (#9476 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9476>), so you can find a command line like \fBgit log 3.6.1..Integration_3.7.0\fP by searching for \fBgitInt\fP\&.
.IP \(bu 2
Opening the history pager will now fill the search field with a search string if you\(aqre already in a search (#10005 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10005>). This makes it nicer to search something with \fBup\fP and then later decide to switch to the full pager.
.IP \(bu 2
Closing the history pager with enter will now copy the search text to the commandline if there was no match, so you can continue editing the command you tried to find right away (#9934 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9934>).
.UNINDENT
.IP \(bu 2
Performance improvements for command completions and globbing, where supported by the operating system, especially on slow filesystems such as NFS (#9891 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9891>, #9931 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9931>, #10032 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10032>, #10052 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10052>).
.IP \(bu 2
fish can now be configured to wait a specified amount of time for a multi\-key sequence to be completed,  instead of waiting indefinitely. For example, this makes binding \fBkj\fP to switching modes in vi mode possible.
The timeout can be set via the new \fBfish_sequence_key_delay_ms\fP \%<#\:envvar-fish_sequence_key_delay_ms> variable (#7401 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7401>), and may be set by default in future versions.
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
\fBLS_COLORS\fP is no longer set automatically by the \fBls\fP function (#10080 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10080>). Users
that set \fB\&.dircolors\fP should manually import it using other means. Typically this would be \fBset \-gx LS_COLORS (dircolors \-c .dircolors | string split \(aq \(aq)[3]\fP
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
Running \fBexit\fP with a negative number no longer crashes fish (#9659 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9659>).
.IP \(bu 2
\fBfish \-\-command\fP will now return a non\-zero status if parsing failed (#9888 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9888>).
.IP \(bu 2
The \fBjobs\fP builtin will now escape the commands it prints (#9808 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9808>).
.IP \(bu 2
\fBstring repeat\fP no longer overflows if the count is a multiple of the chunk size (#9900 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9900>).
.IP \(bu 2
The \fBbuiltin\fP builtin will now properly error out with invalid arguments instead of doing nothing and returning true (#9942 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9942>).
.IP \(bu 2
\fBcommand time\fP in a pipeline is allowed again, as is \fBcommand and\fP and \fBcommand or\fP (#9985 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9985>).
.IP \(bu 2
\fBexec\fP will now also apply variable overrides, so \fBFOO=bar exec\fP will now set \fB$FOO\fP correctly (#9995 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9995>).
.IP \(bu 2
\fBumask\fP will now handle empty symbolic modes correctly, like \fBumask u=,g=rwx,o=\fP (#10177 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10177>).
.IP \(bu 2
Improved error messages for errors occurring in command substitutions (#10054 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10054>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
\fBread\fP no longer enables bracketed paste so it doesn\(aqt stay enabled in combined commandlines like \fBmysql \-p(read \-\-silent)\fP (#8285 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8285>).
.IP \(bu 2
Vi mode now uses \fBfish_cursor_external\fP to set the cursor shape for external commands (#4656 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4656>).
.IP \(bu 2
Opening the history search in vi mode switches to insert mode correctly (#10141 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10141>).
.IP \(bu 2
Vi mode cursor shaping is now enabled in iTerm2 (#9698 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9698>).
.IP \(bu 2
Completing commands as root includes commands not owned by root, fixing a regression introduced in fish 3.2.0 (#9699 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9699>).
.IP \(bu 2
Selection uses \fBfish_color_selection\fP for the foreground and background colors, as intended, rather than just the background (#9717 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9717>).
.IP \(bu 2
The completion pager will no longer sometimes skip the last entry when moving through a long list (#9833 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9833>).
.IP \(bu 2
The interactive \fBhistory delete\fP interface now allows specifying index ranges like \(dq1..5\(dq (#9736 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9736>), and \fBhistory delete \-\-exact\fP now properly saves the history (#10066 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10066>).
.IP \(bu 2
Command completion will now call the stock \fBmanpath\fP on macOS, instead of a potential Homebrew version. This prevents awkward error messages (#9817 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9817>).
.IP \(bu 2
the \fBredo\fP special input function restores the pre\-undo cursor position.
.IP \(bu 2
A new bind function \fBhistory\-pager\-delete\fP, bound to \fBshift\fP\-\fBdelete\fP by default, will delete the currently\-selected history pager item from history (#9454 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9454>).
.IP \(bu 2
\fBfish_key_reader\fP will now use printable characters as\-is, so pressing \(dqö\(dq no longer leads to it telling you to bind \fB\eu00F6\fP (#9986 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9986>).
.IP \(bu 2
\fBopen\fP can be used to launch terminal programs again, as an \fBxdg\-open\fP bug has been fixed and a workaround has been removed  (#10045 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10045>).
.IP \(bu 2
The \fBrepaint\-mode\fP binding will now only move the cursor if there is repainting to be done. This fixes \fBalt\fP combination bindings in vi mode (#7910 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7910>).
.IP \(bu 2
A new \fBclear\-screen\fP bind function is used for \fBctrl\fP\-\fBl\fP by default. This clears the screen and repaints the existing prompt at first,
so it eliminates visible flicker unless the terminal is very slow (#10044 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10044>).
.IP \(bu 2
The \fBalias\fP convenience function has better support for commands with unusual characters, like \fB+\fP (#8720 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8720>).
.IP \(bu 2
A longstanding issue where items in the pager would sometimes display without proper formatting has been fixed (#9617 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9617>).
.IP \(bu 2
The \fBalt\fP\-\fBl\fP binding, which lists the directory of the token under the cursor, correctly expands tilde (\fB~\fP) to the home directory (#9954 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9954>).
.IP \(bu 2
Various fish utilities that use an external pager will now try a selection of common pagers if the \fBPAGER\fP environment variable is not set, or write the output to the screen without a pager if there is not one available (#10074 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10074>).
.IP \(bu 2
Command\-specific tab completions may now offer results whose first character is a period. For example, it is now possible to tab\-complete \fBgit add\fP for files with leading periods. The default file completions hide these files, unless the token itself has a leading period (#3707 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3707>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The default theme now only uses named colors, so it will track the terminal\(aqs palette (#9913 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9913>).
.IP \(bu 2
The Dracula theme has now been synced with upstream (#9807 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9807>); use \fBfish_config\fP to re\-apply it to pick up the changes.
.IP \(bu 2
\fBfish_vcs_prompt\fP now also supports fossil (#9497 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9497>).
.IP \(bu 2
Prompts which display the working directory using the \fBprompt_pwd\fP function correctly display directories beginning with dashes (#10169 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10169>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBage\fP and \fBage\-keygen\fP (#9813 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9813>)
.IP \(bu 2
\fBairmon\-ng\fP (#10116 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10116>)
.IP \(bu 2
\fBar\fP (#9720 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9720>)
.IP \(bu 2
\fBblender\fP (#9905 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9905>)
.IP \(bu 2
\fBbws\fP (#10165 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10165>)
.IP \(bu 2
\fBcalendar\fP (#10138 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10138>)
.IP \(bu 2
\fBcheckinstall\fP (#10106 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10106>)
.IP \(bu 2
\fBcrc\fP (#10034 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10034>)
.IP \(bu 2
\fBdoctl\fP
.IP \(bu 2
\fBgimp\fP (#9904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9904>)
.IP \(bu 2
\fBgojq\fP (#9740 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9740>)
.IP \(bu 2
\fBhorcrux\fP (#9922 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9922>)
.IP \(bu 2
\fBibmcloud\fP (#10004 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10004>)
.IP \(bu 2
\fBiwctl\fP (#6884 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6884>)
.IP \(bu 2
\fBjava_home\fP (#9998 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9998>)
.IP \(bu 2
\fBkrita\fP (#9903 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9903>)
.IP \(bu 2
\fBoc\fP (#10034 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10034>)
.IP \(bu 2
\fBqjs\fP (#9723 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9723>)
.IP \(bu 2
\fBqjsc\fP (#9731 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9731>)
.IP \(bu 2
\fBrename\fP (#10136 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10136>)
.IP \(bu 2
\fBrpm\-ostool\fP (#9669 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9669>)
.IP \(bu 2
\fBsmerge\fP (#10135 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10135>)
.IP \(bu 2
\fBuserdel\fP (#10056 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10056>)
.IP \(bu 2
\fBwatchexec\fP (#10027 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10027>)
.IP \(bu 2
\fBwpctl\fP (#10043 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10043>)
.IP \(bu 2
\fBxxd\fP (#10137 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10137>)
.IP \(bu 2
\fBzabbix\fP (#9647 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9647>)
.UNINDENT
.IP \(bu 2
The \fBzfs\fP completions no longer print errors about setting a read\-only variable (#9705 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9705>).
.IP \(bu 2
The \fBkitty\fP completions have been removed in favor of keeping them upstream (#9750 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9750>).
.IP \(bu 2
\fBgit\fP completions now support aliases that reference other aliases (#9992 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9992>).
.IP \(bu 2
The \fBgw\fP and \fBgradlew\fP completions are loaded properly (#10127 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10127>).
.IP \(bu 2
Improvements to many other completions.
.IP \(bu 2
Improvements to the manual page completion generator (#9787 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9787>, #9814 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9814>, #9961 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9961>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
Improvements and corrections to the documentation.
.IP \(bu 2
The Web\-based configuration now uses a more readable style when printed, such as for a keybinding reference (#9828 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9828>).
.IP \(bu 2
Updates to the German translations (#9824 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9824>).
.IP \(bu 2
The colors of the Nord theme better match their official style (#10168 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10168>).
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
The licensing information for some of the derived code distributed with fish was incomplete. Though the license information was present in the source distribution, it was not present in the documentation. This has been corrected (#10162 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:10162>).
.IP \(bu 2
The CMake configure step will now also look for libterminfo as an alternative name for libtinfo, as used in NetBSD curses (#9794 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9794>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.6.4 (released December 5, 2023)
.sp
This release contains a complete fix for the test suite failure in fish 3.6.2 and 3.6.3.

.sp
.ce
----

.ce 0
.sp
.SS fish 3.6.3 (released December 4, 2023)
.sp
This release contains a fix for a test suite failure in fish 3.6.2.

.sp
.ce
----

.ce 0
.sp
.SS fish 3.6.2 (released December 4, 2023)
.sp
This release of fish contains a security fix for CVE\-2023\-49284, a minor security problem identified
in fish 3.6.1 and previous versions (thought to affect all released versions of fish).
.sp
fish uses certain Unicode non\-characters internally for marking wildcards and expansions. It
incorrectly allowed these markers to be read on command substitution output, rather than
transforming them into a safe internal representation.
.sp
For example, \fBecho \eUFDD2HOME\fP has the same output as \fBecho $HOME\fP\&.
.sp
While this may cause unexpected behavior with direct input, this may become a minor security problem
if the output is being fed from an external program into a command substitution where this output
may not be expected.

.sp
.ce
----

.ce 0
.sp
.SS fish 3.6.1 (released March 25, 2023)
.sp
This release of fish contains a number of fixes for problems identified in fish 3.6.1, as well as some enhancements.
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
\fBabbr \-\-erase\fP now also erases the universal variables used by the old abbr function. That means:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
abbr \-\-erase (abbr \-\-list)
.EE
.UNINDENT
.UNINDENT
.sp
can now be used to clean out all old abbreviations (#9468 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9468>).
.IP \(bu 2
\fBabbr \-\-add \-\-universal\fP now warns about \fB\-\-universal\fP being non\-functional, to make it easier to detect old\-style \fBabbr\fP calls (#9475 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9475>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The Web\-based configuration for abbreviations has been removed, as it was not functional with the changes abbreviations introduced in 3.6.0 (#9460 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9460>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBabbr \-\-list\fP no longer escapes the abbr name, which is necessary to be able to pass it to \fBabbr \-\-erase\fP (#9470 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9470>).
.IP \(bu 2
\fBread\fP will now print an error if told to set a read\-only variable, instead of silently doing nothing (#9346 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9346>).
.IP \(bu 2
\fBset_color \-v\fP no longer crashes fish (#9640 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9640>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Using \fBfish_vi_key_bindings\fP in combination with fish\(aqs \fB\-\-no\-config\fP mode works without locking up the shell (#9443 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9443>).
.IP \(bu 2
The history pager now uses more screen space, usually half the screen (#9458 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9458>)
.IP \(bu 2
Variables that were set while the locale was C (the default ASCII\-only locale) will now properly be encoded if the locale is switched (#2613 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2613>, #9473 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9473>).
.IP \(bu 2
Escape during history search restores the original command line again (fixing a regression in 3.6.0).
.IP \(bu 2
Using \fB\-\-help\fP on builtins now respects the \fB$MANPAGER\fP variable, in preference to \fB$PAGER\fP (#9488 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9488>).
.IP \(bu 2
\fBctrl\fP\-\fBg\fP closes the history pager, like other shells (#9484 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9484>).
.IP \(bu 2
The documentation for the \fB:\fP, \fB[\fP and \fB\&.\fP builtin commands can now be looked up with \fBman\fP (#9552 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9552>).
.IP \(bu 2
fish no longer crashes when searching history for non\-ASCII codepoints case\-insensitively (#9628 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9628>).
.IP \(bu 2
The \fBalt\fP\-\fBs\fP binding will now also use \fBplease\fP if available (#9635 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9635>).
.IP \(bu 2
Themes that don\(aqt specify every color option can be installed correctly in the Web\-based configuration (#9590 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9590>).
.IP \(bu 2
Compatibility with Midnight Commander\(aqs prompt integration has been improved (#9540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9540>).
.IP \(bu 2
A spurious error, noted when using fish in Google Drive directories under WSL 2, has been silenced (#9550 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9550>).
.IP \(bu 2
Using \fBread\fP in \fBfish_greeting\fP or similar functions will not trigger an infinite loop (#9564 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9564>).
.IP \(bu 2
Compatibility when upgrading from old versions of fish (before 3.4.0) has been improved (#9569 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9569>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The git prompt will compute the stash count to be used independently of the informative status (#9572 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9572>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBapkanalyzer\fP (#9558 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9558>)
.IP \(bu 2
\fBneovim\fP (#9543 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9543>)
.IP \(bu 2
\fBotool\fP
.IP \(bu 2
\fBpre\-commit\fP (#9521 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9521>)
.IP \(bu 2
\fBproxychains\fP (#9486 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9486>)
.IP \(bu 2
\fBscrypt\fP (#9583 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9583>)
.IP \(bu 2
\fBstow\fP (#9571 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9571>)
.IP \(bu 2
\fBtrash\fP and helper utilities \fBtrash\-empty\fP, \fBtrash\-list\fP, \fBtrash\-put\fP, \fBtrash\-restore\fP (#9560 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9560>)
.IP \(bu 2
\fBssh\-copy\-id\fP (#9675 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9675>)
.UNINDENT
.IP \(bu 2
Improvements to many completions, including the speed of completing directories in WSL 2 (#9574 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9574>).
.IP \(bu 2
Completions using \fB__fish_complete_suffix\fP are now offered in the correct order, fixing a regression in 3.6.0 (#8924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8924>).
.IP \(bu 2
\fBgit\fP completions for \fBgit\-foo\fP\-style commands was restored, fixing a regression in 3.6.0 (#9457 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9457>).
.IP \(bu 2
File completion now offers \fB\&../\fP and \fB\&./\fP again, fixing a regression in 3.6.0 (#9477 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9477>).
.IP \(bu 2
The behaviour of completions using \fB__fish_complete_path\fP matches standard path completions (#9285 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9285>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
Improvements and corrections to the documentation.
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
fish 3.6.1 builds correctly on Cygwin (#9502 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9502>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.6.0 (released January 7, 2023)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
By default, \fBctrl\fP\-\fBr\fP now opens the command history in the pager (#602 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:602>). This is fully searchable and syntax\-highlighted, as an alternative to the incremental search seen in other shells. The new special input function \fBhistory\-pager\fP has been added for custom bindings.
.IP \(bu 2
Abbreviations are more flexible (#9313 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9313>, #5003 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5003>, #2287 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2287>):
.INDENT 2.0
.IP \(bu 2
They may optionally replace tokens anywhere on the command line, instead of only commands
.IP \(bu 2
Matching tokens may be described using a regular expression instead of a literal word
.IP \(bu 2
The replacement text may be produced by a fish function, instead of a literal word
.IP \(bu 2
They may position the cursor anywhere in the expansion, instead of at the end
.UNINDENT
.sp
For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
function multicd
    echo cd (string repeat \-n (math (string length \-\- $argv[1]) \- 1) ../)
end

abbr \-\-add dotdot \-\-regex \(aq^\e.\e.+$\(aq \-\-function multicd
.EE
.UNINDENT
.UNINDENT
.sp
This expands \fB\&..\fP to \fBcd ../\fP, \fB\&...\fP to \fBcd ../../\fP and \fB\&....\fP to \fBcd ../../../\fP and so on.
.sp
Or:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
function last_history_item; echo $history[1]; end
abbr \-a !! \-\-position anywhere \-\-function last_history_item
.EE
.UNINDENT
.UNINDENT
.sp
which expands \fB!!\fP to the last history item, anywhere on the command line, mimicking other shells\(aq history expansion.
.sp
See the documentation \%<> for more.
.IP \(bu 2
\fBpath\fP gained a new \fBmtime\fP subcommand to print the modification time stamp for files. For example, this can be used to handle cache file ages (#9057 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9057>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> touch foo
> sleep 10
> path mtime \-\-relative foo
10
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBstring\fP gained a new \fBshorten\fP subcommand to shorten strings to a given visible width (#9156 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9156>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> string shorten \-\-max 10 \(dqHello this is a long string\(dq
Hello thi…
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBtest\fP (aka \fB[\fP) gained \fB\-ot\fP (older than) and \fB\-nt\fP (newer than) operators to compare file modification times, and \fB\-ef\fP to compare whether the arguments are the same file (#3589 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3589>).
.IP \(bu 2
fish will now mark the extent of many errors with a squiggly line, instead of just a caret (\fB^\fP) at the beginning (#9130 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9130>). For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
checks/set.fish (line 471): for: a,b: invalid variable name. See \(gahelp identifiers\(ga
for a,b in y 1 z 3
    ^~^
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
A new function, \fBfish_delta\fP, shows changes that have been made in fish\(aqs configuration from the defaults (#9255 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9255>).
.IP \(bu 2
\fBset \-\-erase\fP can now be used with multiple scopes at once, like \fBset \-efglU foo\fP (#7711 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7711>, #9280 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9280>).
.IP \(bu 2
\fBstatus\fP gained a new subcommand, \fBcurrent\-commandline\fP, which retrieves the entirety of the currently\-executing command line when called from a function during execution. This allows easier job introspection (#8905 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8905>, #9296 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9296>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The \fB\ex\fP and \fB\eX\fP escape syntax is now equivalent. \fB\exAB\fP previously behaved the same as \fB\eXAB\fP, except that it would error if the value \(dqAB\(dq was larger than \(dq7f\(dq (127 in decimal, the highest ASCII value) (#9247 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9247>, #9245 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9245>, #1352 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1352>).
.IP \(bu 2
The \fBfish_git_prompt\fP will now only turn on features if the appropriate variable has been set to a true value (of \(dq1\(dq, \(dqyes\(dq or \(dqtrue\(dq) instead of just checking if it is defined. This allows specifically turning features \fIoff\fP without having to erase variables, such as via universal variables. If you have defined a variable to a different value and expect it to count as true, you need to change it (#9274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9274>).
For example, \fBset \-g __fish_git_prompt_show_informative_status 0\fP previously would have enabled informative status (because any value would have done so), but now it turns it off.
.IP \(bu 2
Abbreviations are no longer stored in universal variables. Existing universal abbreviations are still imported, but new abbreviations should be added to \fBconfig.fish\fP\&.
.IP \(bu 2
The short option \fB\-r\fP for abbreviations has changed from \fBrename\fP to \fBregex\fP, for consistency with \fBstring\fP\&.
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBargparse\fP can now be used without option specifications, to allow using \fB\-\-min\-args\fP, \fB\-\-max\-args\fP or for commands that take no options (but might in future) (#9006 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9006>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
function my_copy
    argparse \-\-min\-args 2 \-\- $argv
    or return

    cp $argv
end
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBset \-\-show\fP now shows when a variable was inherited from fish\(aqs parent process, which should help with debugging (#9029 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9029>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> set \-\-show XDG_DATA_DIRS
$XDG_DATA_DIRS: set in global scope, exported, a path variable with 4 elements
$XDG_DATA_DIRS[1]: |/home/alfa/.local/share/flatpak/exports/share|
$XDG_DATA_DIRS[2]: |/var/lib/flatpak/exports/share|
$XDG_DATA_DIRS[3]: |/usr/local/share|
$XDG_DATA_DIRS[4]: |/usr/share|
$XDG_DATA_DIRS: originally inherited as |/home/alfa/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/|
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
The read limit is now restored to the default when \fBfish_read_limit\fP \%<#\:envvar-fish_read_limit> is unset (#9129 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9129>).
.IP \(bu 2
\fBmath\fP produces an error for division\-by\-zero, as well as augmenting some errors with their extent (#9190 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9190>). This changes behavior in some limited cases, such as:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
math min 1 / 0, 5
.EE
.UNINDENT
.UNINDENT
.sp
which would previously print \(dq5\(dq (because in floating point division \(dq1 / 0\(dq yields infinite, and 5 is smaller than infinite) but will now return an error.
.IP \(bu 2
\fBfish_clipboard_copy\fP and \fBfish_clipboard_paste\fP can now be used in pipes (#9271 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9271>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
git rev\-list 3.5.1 | fish_clipboard_copy

fish_clipboard_paste | string join + | math
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBstatus fish\-path\fP returns a fully\-normalised path, particularly noticeable on NetBSD (#9085 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9085>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
If the terminal definition for \fBTERM\fP can\(aqt be found, fish now tries using the \(dqxterm\-256color\(dq and \(dqxterm\(dq definitions before \(dqansi\(dq and \(dqdumb\(dq. As the majority of terminal emulators in common use are now more or less xterm\-compatible (often even explicitly claiming the xterm\-256color entry), this should often result in a fully or almost fully usable terminal (#9026 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9026>).
.IP \(bu 2
A new variable, \fBfish_cursor_selection_mode\fP \%<#\:envvar-fish_cursor_selection_mode>, can be used to configure whether the command line selection includes the character under the cursor (\fBinclusive\fP) or not (\fBexclusive\fP). The new default is \fBexclusive\fP; use \fBset fish_cursor_selection_mode inclusive\fP to get the previous behavior back (#7762 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7762>).
.IP \(bu 2
fish\(aqs completion pager now fills half the terminal on first tab press instead of only 4 rows, which should make results visible more often and save key presses, without constantly snapping fish to the top of the terminal (#9105 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9105>, #2698 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2698>).
.IP \(bu 2
The \fBcomplete\-and\-search\fP binding, used with \fBshift\fP\-\fBtab\fP by default, selects the first item in the results immediately (#9080 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9080>).
.IP \(bu 2
\fBbind\fP output is now syntax\-highlighted when used interactively.
.IP \(bu 2
\fBalt\fP\-\fBh\fP (the default \fB__fish_man_page\fP binding) does a better job of showing the manual page of the command under cursor (#9020 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9020>).
.IP \(bu 2
If \fBfish_color_valid_path\fP \%<#\:envvar-fish_color_valid_path> contains an actual color instead of just modifiers, those will be used for valid paths even if the underlying color isn\(aqt \(dqnormal\(dq (#9159 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9159>).
.IP \(bu 2
The key combination for the QUIT terminal sequence, often \fBctrl\fP\-\fB\e\fP (\fB\ex1c\fP), can now be used as a binding (#9234 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9234>).
.IP \(bu 2
fish\(aqs vi mode uses normal xterm\-style sequences to signal cursor change, instead of using the iTerm\(aqs proprietary escape sequences. This allows for a blinking cursor and makes it work in complicated scenarios with nested terminals. (#3741 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3741>, #9172 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9172>)
.IP \(bu 2
When running fish on a remote system (such as inside SSH or a container), \fBctrl\fP\-\fBx\fP now copies to the local client system\(aqs clipboard if the terminal supports OSC 52.
.IP \(bu 2
\fBcommandline\fP gained two new options, \fB\-\-selection\-start\fP and \fB\-\-selection\-end\fP, to set the start/end of the current selection (#9197 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9197>, #9215 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9215>).
.IP \(bu 2
fish\(aqs builtins now handle keyboard interrupts (\fBctrl\fP\-\fBc\fP) correctly (#9266 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9266>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBark\fP
.IP \(bu 2
\fBasciinema\fP (#9257 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9257>)
.IP \(bu 2
\fBclojure\fP (#9272 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9272>)
.IP \(bu 2
\fBcsh\fP
.IP \(bu 2
\fBdirenv\fP (#9268 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9268>)
.IP \(bu 2
\fBdive\fP (#9082 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9082>)
.IP \(bu 2
\fBdolphin\fP
.IP \(bu 2
\fBdua\fP (#9277 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9277>)
.IP \(bu 2
\fBefivar\fP (#9318 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9318>)
.IP \(bu 2
\fBeg\fP
.IP \(bu 2
\fBes\fP (#9388 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9388>)
.IP \(bu 2
\fBfirefox\-developer\-edition\fP and \fBfirefox\fP (#9090 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9090>)
.IP \(bu 2
\fBfortune\fP (#9177 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9177>)
.IP \(bu 2
\fBkb\fP
.IP \(bu 2
\fBkind\fP (#9110 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9110>)
.IP \(bu 2
\fBkonsole\fP
.IP \(bu 2
\fBksh\fP
.IP \(bu 2
\fBloadkeys\fP (#9312 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9312>)
.IP \(bu 2
\fBokular\fP
.IP \(bu 2
\fBop\fP (#9300 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9300>)
.IP \(bu 2
\fBouch\fP (#9405 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9405>)
.IP \(bu 2
\fBpix\fP
.IP \(bu 2
\fBreadelf\fP (#8746 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8746>, #9386 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9386>)
.IP \(bu 2
\fBqshell\fP
.IP \(bu 2
\fBrc\fP
.IP \(bu 2
\fBsad\fP (#9145 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9145>)
.IP \(bu 2
\fBtcsh\fP
.IP \(bu 2
\fBtoot\fP
.IP \(bu 2
\fBtox\fP (#9078 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9078>)
.IP \(bu 2
\fBwish\fP
.IP \(bu 2
\fBxed\fP
.IP \(bu 2
\fBxonsh\fP (#9389 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9389>)
.IP \(bu 2
\fBxplayer\fP
.IP \(bu 2
\fBxreader\fP
.IP \(bu 2
\fBxviewer\fP
.IP \(bu 2
\fByash\fP (#9391 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9391>)
.IP \(bu 2
\fBzig\fP (#9083 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9083>)
.UNINDENT
.IP \(bu 2
Improvements to many completions, including making \fBcd\fP completion much faster (#9220 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9220>).
.IP \(bu 2
Completion of tilde (\fB~\fP) works properly even when the file name contains an escaped character (#9073 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9073>).
.IP \(bu 2
fish no longer loads completions if the command is used via a relative path and is not in \fBPATH\fP \%<#\:envvar-PATH> (#9133 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9133>).
.IP \(bu 2
fish no longer completes inside of comments (#9320 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9320>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
Opening \fBhelp\fP on WSL now uses PowerShell to open the browser if available, removing some awkward UNC path errors (#9119 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9119>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
The Web\-based configuration tool now works on systems with IPv6 disabled (#3857 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3857>).
.IP \(bu 2
Aliases can ignore arguments by ending them with \fB#\fP (#9199 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9199>).
.IP \(bu 2
\fBstring\fP is now faster when reading large strings from stdin (#9139 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9139>).
.IP \(bu 2
\fBstring repeat\fP uses less memory and is faster. (#9124 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9124>)
.IP \(bu 2
Builtins are much faster when writing to a pipe or file. (#9229 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9229>).
.IP \(bu 2
Performance improvements to highlighting (#9180 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9180>) should make using fish more pleasant on slow systems.
.IP \(bu 2
On 32\-bit systems, globs like \fB*\fP will no longer fail to return some files, as large file support has been enabled.
.UNINDENT
.SS Fixed bugs
.INDENT 0.0
.IP \(bu 2
The history search text for a token search is now highlighted correctly if the line contains multiple instances of that text (#9066 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9066>).
.IP \(bu 2
\fBprocess\-exit\fP and \fBjob\-exit\fP events are now generated for all background jobs, including those launched from event handlers (#9096 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9096>).
.IP \(bu 2
A crash when completing a token that contained both a potential glob and a quoted variable expansion was fixed (#9137 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9137>).
.IP \(bu 2
\fBprompt_pwd\fP no longer accidentally overwrites a global or universal \fB$fish_prompt_pwd_full_dirs\fP when called with the \fB\-d\fP or \fB\-\-full\-length\-dirs\fP option (#9123 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9123>).
.IP \(bu 2
A bug which caused fish to freeze or exit after running a command which does not preserve the foreground process group was fixed (#9181 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9181>).
.IP \(bu 2
The \(dqDisco\(dq sample prompt no longer prints an error in some working directories (#9164 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9164>). If you saved this prompt, you should run \fBfish_config prompt save disco\fP again.
.IP \(bu 2
fish launches external commands via the given path again, rather than always using an absolute path. This behaviour was inadvertently changed in 3.5.0 and is visible, for example, when launching a bash script which checks \fB$0\fP (#9143 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9143>).
.IP \(bu 2
\fBprintf\fP no longer tries to interpret the first argument as an option (#9132 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9132>).
.IP \(bu 2
Interactive \fBread\fP in scripts will now have the correct keybindings again (#9227 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9227>).
.IP \(bu 2
A possible stack overflow when recursively evaluating substitutions has been fixed (#9302 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9302>).
.IP \(bu 2
A crash with relative $CDPATH has been fixed (#9407 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9407>).
.IP \(bu 2
\fBprintf\fP now properly fills extra \fB%d\fP specifiers with 0 even on macOS and BSD (#9321 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9321>).
.IP \(bu 2
\fBfish_key_reader\fP now correctly exits when receiving a SIGHUP (like after closing the terminal) (#9309 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9309>).
.IP \(bu 2
\fBfish_config theme save\fP now works as documented instead of erroring out (#9088 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9088>, #9273 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9273>).
.IP \(bu 2
fish no longer triggers prompts to install command line tools when first run on macOS (#9343 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9343>).
.IP \(bu 2
\fBfish_git_prompt\fP now quietly fails on macOS if the xcrun cache is not yet populated (#6625 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6625>), working around a potential hang.
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
The vendored PCRE2 sources have been removed. It is recommended to declare PCRE2 as a dependency when packaging fish. If the CMake variable FISH_USE_SYSTEM_PCRE2 is false, fish will now download and build PCRE2 from the official repo (#8355 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8355>, #8363 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8363>). Note this variable defaults to true if PCRE2 is found installed on the system.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.5.1 (released July 20, 2022)
.sp
This release of fish introduces the following small enhancements:
.INDENT 0.0
.IP \(bu 2
Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (#8981 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8981>).
.IP \(bu 2
\fBprintf\fP returns a better error when used with arguments interpreted as octal numbers (#9035 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9035>).
.IP \(bu 2
\fBhistory merge\fP when in private mode is now an error, rather than wiping out other sessions\(aq history (#9050 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9050>).
.IP \(bu 2
The error message when launching a command that is built for the wrong architecture on macOS is more helpful (#9052 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9052>).
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBchoose\fP (#9065 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9065>)
.IP \(bu 2
\fBexpect\fP (#9060 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9060>)
.IP \(bu 2
\fBnavi\fP (#9064 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9064>)
.IP \(bu 2
\fBqdbus\fP (#9031 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9031>)
.IP \(bu 2
\fBreflector\fP (#9027 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9027>)
.UNINDENT
.IP \(bu 2
Improvements to some completions.
.UNINDENT
.sp
This release also fixes a number of problems identified in fish 3.5.0.
.INDENT 0.0
.IP \(bu 2
Completing \fBgit blame\fP or \fBgit \-C\fP works correctly (#9053 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9053>).
.IP \(bu 2
On terminals that emit a \fBCSI u\fP sequence for \fBshift\fP\-\fBspace\fP, fish inserts a space instead of printing an error. (#9054 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9054>).
.IP \(bu 2
\fBstatus fish\-path\fP on Linux\-based platforms could print the path with a \(dq (deleted)\(dq suffix (such as \fB/usr/bin/fish (deleted)\fP), which is now removed (#9019 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9019>).
.IP \(bu 2
Cancelling an initial command (from fish\(aqs \fB\-\-init\-command\fP option) with \fBctrl\fP\-\fBc\fP no longer prevents configuration scripts from running (#9024 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9024>).
.IP \(bu 2
The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (#9044 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9044>).
.IP \(bu 2
Using special input functions in bindings, in combination with \fBand\fP/\fBor\fP conditionals, no longer crashes (#9051 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9051>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.5.0 (released June 16, 2022)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
A new \fBpath\fP builtin command to filter and transform paths (#7659 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7659>, #8958 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8958>). For example, to list all the separate extensions used on files in /usr/share/man (after removing one extension, commonly a \(dq.gz\(dq):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
path filter \-f /usr/share/man/** | path change\-extension \(aq\(aq | path extension | path sort \-u
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
Tab (or any key bound to \fBcomplete\fP) now expands wildcards instead of invoking completions, if there is a wildcard in the path component under the cursor (#954 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:954>, #8593 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8593>).
.IP \(bu 2
Scripts can now catch and handle the SIGINT and SIGTERM signals, either via \fBfunction \-\-on\-signal\fP or with \fBtrap\fP (#6649 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6649>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The \fBstderr\-nocaret\fP feature flag, introduced in fish 3.0 and enabled by default in fish 3.1, has been made read\-only.
That means it is no longer possible to disable it, and code supporting the \fB^\fP redirection has been removed (#8857 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8857>, #8865 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8865>).
.sp
To recap: fish used to support \fB^\fP to redirect stderr, so you could use commands like:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
test \(dq$foo\(dq \-gt 8 ^/dev/null
.EE
.UNINDENT
.UNINDENT
.sp
to ignore error messages. This made the \fB^\fP symbol require escaping and quoting, and was a bit of a weird shortcut considering \fB2>\fP already worked, which is only one character longer.
.sp
So the above can simply become:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
test \(dq$foo\(dq \-gt 8 2>/dev/null
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
The following feature flags have been enabled by default:
.INDENT 2.0
.IP \(bu 2
\fBregex\-easyesc\fP, which makes \fBstring replace \-r\fP not do a superfluous round of unescaping in the replacement expression.
That means e.g. to escape any \(dqa\(dq or \(dqb\(dq in an argument you can use \fBstring replace \-ra \(aq([ab])\(aq \(aq\e\e\e\e$1\(aq foobar\fP instead of needing 8 backslashes.
.sp
This only affects the \fIreplacement\fP expression, not the \fImatch\fP expression (the \fB\(aq([ab])\(aq\fP part in the example).
A survey of plugins on GitHub did not turn up any affected code, so we do not expect this to affect many users.
.sp
This flag was introduced in fish 3.1.
.IP \(bu 2
\fBampersand\-nobg\-in\-token\fP, which means that \fB&\fP will not create a background job if it occurs in the middle of a word. For example, \fBecho foo&bar\fP will print \(dqfoo&bar\(dq instead of running \fBecho foo\fP in the background and then starting \fBbar\fP as a second job.
.sp
Reformatting with \fBfish_indent\fP would already introduce spaces, turning \fBecho foo&bar\fP into \fBecho foo & bar\fP\&.
.sp
This flag was introduced in fish 3.4.
.UNINDENT
.sp
To turn off these flags, add \fBno\-regex\-easyesc\fP or \fBno\-ampersand\-nobg\-in\-token\fP to \fBfish_features\fP and restart fish:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-Ua fish_features no\-regex\-easyesc
.EE
.UNINDENT
.UNINDENT
.sp
Like \fBstderr\-nocaret\fP, they will eventually be made read\-only.
.IP \(bu 2
Most \fBstring\fP subcommands no longer append a newline to their input if the input didn\(aqt have one (#8473 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8473>, #3847 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3847>)
.IP \(bu 2
Fish\(aqs escape sequence removal (like for \fBstring length \-\-visible\fP or to figure out how wide the prompt is) no longer has special support for non\-standard color sequences like from Data General terminals, e.g. the Data General Dasher D220 from 1984. This removes a bunch of work in the common case, allowing \fBstring length \-\-visible\fP to be much faster with unknown escape sequences. We don\(aqt expect anyone to have ever used fish with such a terminal (#8769 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8769>).
.IP \(bu 2
Code to upgrade universal variables from fish before 3.0 has been removed. Users who upgrade directly from fish versions 2.7.1 or before will have to set their universal variables & abbreviations again. (#8781 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8781>)
.IP \(bu 2
The meaning of an empty color variable has changed (#8793 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8793>). Previously, when a variable was set but empty, it would be interpreted as the \(dqnormal\(dq color. Now, empty color variables cause the same effect as unset variables \- the general highlighting variable for that type is used instead. For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
set \-g fish_color_command blue
set \-g fish_color_keyword
.EE
.UNINDENT
.UNINDENT
.sp
would previously make keywords \(dqnormal\(dq (usually white in a dark terminal). Now it\(aqll make them blue. To achieve the previous behavior, use the normal color explicitly: \fBset \-g fish_color_keyword normal\fP\&.
.sp
This makes it easier to make self\-contained color schemes that don\(aqt accidentally use color that was set before.
\fBfish_config\fP has been adjusted to set known color variables that a theme doesn\(aqt explicitly set to empty.
.IP \(bu 2
\fBeval\fP is now a reserved keyword, so it can\(aqt be used as a function name. This follows \fBset\fP and \fBread\fP, and is necessary because it can\(aqt be cleanly shadowed by a function \- at the very least \fBeval set \-l argv foo\fP breaks. Fish will ignore autoload files for it, so left over \fBeval.fish\fP from previous fish versions won\(aqt be loaded.
.IP \(bu 2
The git prompt in informative mode now defaults to skipping counting untracked files, as this was extremely slow. To turn it on, set \fB__fish_git_prompt_showuntrackedfiles\fP or set the git config value \(dqbash.showuntrackedfiles\(dq to \fBtrue\fP explicitly (which can be done for individual repositories). The \(dqinformative+vcs\(dq sample prompt already skipped display of untracked files, but didn\(aqt do so in a way that skipped the computation, so it should be quite a bit faster in many cases (#8980 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8980>).
.IP \(bu 2
The \fB__terlar_git_prompt\fP function, used by the \(dqTerlar\(dq sample prompt, has been rebuilt as a configuration of the normal \fBfish_git_prompt\fP to ease maintenance, improve performance and add features (like reading per\-repo git configuration). Some slight changes remain; users who absolutely must have the same behavior are encouraged to copy the old function (#9011 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9011>, #7918 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7918>, #8979 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8979>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
Quoted command substitution that directly follow a variable expansion (like \fBecho \(dq$var$(echo x)\(dq\fP) no longer affect the variable expansion (#8849 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8849>).
.IP \(bu 2
Fish now correctly expands command substitutions that are preceded by an escaped dollar (like \fBecho \e$(echo)\fP). This regressed in version 3.4.0.
.IP \(bu 2
\fBmath\fP can now handle underscores (\fB_\fP) as visual separators in numbers (#8611 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8611>, #8496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8496>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
math 5 + 2_123_252
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBmath\fP\(aqs \fBmin\fP and \fBmax\fP functions now take a variable number of arguments instead of always requiring 2 (#8644 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8644>, #8646 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8646>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> math min 8,2,4
2
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBread\fP is now faster as the last process in a pipeline (#8552 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8552>).
.IP \(bu 2
\fBstring join\fP gained a new \fB\-\-no\-empty\fP flag to skip empty arguments (#8774 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8774>, #8351 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8351>).
.IP \(bu 2
\fBread\fP now only triggers the \fBfish_read\fP event, not the \fBfish_prompt\fP event (#8797 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8797>). It was supposed to work this way in fish 3.2.0 and later, but both events were emitted.
.IP \(bu 2
The TTY modes are no longer restored when non\-interactive shells exit. This fixes wrong tty modes in pipelines with interactive commands. (#8705 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8705>).
.IP \(bu 2
Some functions shipped with fish printed error messages to standard output, but they now they rightly go to standard error (#8855 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8855>).
.IP \(bu 2
\fBjobs\fP now correctly reports CPU usage as a percentage, instead of as a number of clock ticks (#8919 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8919>).
.IP \(bu 2
\fBprocess\-exit\fP events now fire when the process exits even if the job has not yet exited, fixing a regression in 3.4.1 (#8914 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8914>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Fish now reports a special error if a command wasn\(aqt found and there is a non\-executable file by that name in \fBPATH\fP \%<#\:envvar-PATH> (#8804 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8804>).
.IP \(bu 2
\fBless\fP and other interactive commands would occasionally be stopped when run in a pipeline with fish functions; this has been fixed (#8699 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8699>).
.IP \(bu 2
Case\-changing autosuggestions generated mid\-token now correctly append only the suffix, instead of duplicating the token (#8820 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8820>).
.IP \(bu 2
\fBulimit\fP learned a number of new options for the resource limits available on Linux, FreeBSD ande NetBSD, and returns a specific warning if the limit specified is not available on the active operating system (#8823 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8823>, #8786 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8786>).
.IP \(bu 2
The \fBvared\fP command can now successfully edit variables named \(dqtmp\(dq or \(dqprompt\(dq (#8836 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8836>, #8837 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8837>).
.IP \(bu 2
\fBtime\fP now emits an error if used after the first command in a pipeline (#8841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8841>).
.IP \(bu 2
\fBfish_add_path\fP now prints a message for skipped non\-existent paths when using the \fB\-v\fP flag (#8884 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8884>).
.IP \(bu 2
Since fish 3.2.0, pressing \fBctrl\fP\-\fBd\fP while a command is running would end up inserting a space into the next commandline, which has been fixed (#8871 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8871>).
.IP \(bu 2
A bug that caused multi\-line prompts to be moved down a line when pasting or switching modes has been fixed (#3481 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3481>).
.IP \(bu 2
The Web\-based configuration system no longer strips too many quotes in the abbreviation display (#8917 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8917>, #8918 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8918>).
.IP \(bu 2
Fish started with \fB\-\-no\-config\fP will now use the default keybindings (#8493 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8493>)
.IP \(bu 2
When fish inherits a \fBUSER\fP \%<#\:envvar-USER> environment variable value that doesn\(aqt correspond to the current effective user ID, it will now correct it in all cases (#8879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8879>, #8583 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8583>).
.IP \(bu 2
Fish sets a new \fBEUID\fP \%<#\:envvar-EUID> variable containing the current effective user id (#8866 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8866>).
.IP \(bu 2
\fBhistory search\fP no longer interprets the search term as an option (#8853 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8853>)
.IP \(bu 2
The status message when a job terminates should no longer be erased by a multiline prompt (#8817 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8817>)
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
The \fBalt\fP\-\fBs\fP binding will now insert \fBdoas\fP instead of \fBsudo\fP if necessary (#8942 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8942>).
.IP \(bu 2
The \fBkill\-whole\-line\fP special input function now kills the newline preceding the last line. This makes \fBdd\fP in vi\-mode clear the last line properly.
.IP \(bu 2
The new \fBkill\-inner\-line\fP special input function kills the line without any newlines, allowing \fBcc\fP in vi\-mode to clear the line while preserving newlines (#8983 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8983>).
.IP \(bu 2
On terminals that emit special sequences for these combinations, \fBshift\fP\-\fBspace\fP is bound like \fBspace\fP, and \fBctrl\fP\-\fBenter\fP is bound like \fBreturn\fP (#8874 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8874>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
A new \fBAstronaut\fP prompt (#8775 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8775>), a multi\-line prompt using plain text reminiscent of the Starship.rs prompt.
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBarchlinux\-java\fP (#8911 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8911>)
.IP \(bu 2
\fBapk\fP (#8951 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8951>)
.IP \(bu 2
\fBbrightnessctl\fP (#8758 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8758>)
.IP \(bu 2
\fBefibootmgr\fP (#9010 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:9010>)
.IP \(bu 2
\fBfastboot\fP (#8904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8904>)
.IP \(bu 2
\fBoptimus\-manager\fP (#8913 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8913>)
.IP \(bu 2
\fBrclone\fP (#8819 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8819>)
.IP \(bu 2
\fBsops\fP (#8821 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8821>)
.IP \(bu 2
\fBtuned\-adm\fP (#8760 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8760>)
.IP \(bu 2
\fBwg\-quick\fP (#8687 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8687>)
.UNINDENT
.IP \(bu 2
\fBcomplete\fP can now be given multiple \fB\-\-condition\fP options. They will be attempted in the order they were given, and only if all succeed will the completion be made available (as if they were connected with \fB&&\fP). This helps with caching \- fish\(aqs complete system stores the return value of each condition as long as the commandline doesn\(aqt change, so this can reduce the number of conditions that need to be evaluated (#8536 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8536>, #8967 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8967>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
Working directory reporting is enabled for kitty (#8806 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8806>).
.IP \(bu 2
Changing the cursor shape is now enabled by default in iTerm2 (#3696 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3696>).
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
libatomic is now correctly detected as necessary when building on RISC\-V (#8850 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8850>, #8851 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8851>).
.IP \(bu 2
In some cases, the build process found the wrong libintl on macOS. This has been corrected (#5244 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5244>).
.IP \(bu 2
The paths for completions, functions, and configuration snippets now include
subdirectories \fBfish/vendor_completions.d\fP, \fBfish/vendor_functions.d\fP, and
\fBfish/vendor_conf.d\fP (respectively) within \fBXDG_DATA_HOME\fP (or \fB~/.local/share\fP
if not defined) (#8887 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8887>, #7816 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7816>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.4.1 (released March 25, 2022)
.sp
This release of fish fixes the following problems identified in fish 3.4.0:
.INDENT 0.0
.IP \(bu 2
An error printed after upgrading, where old instances could pick up a newer version of the \fBfish_title\fP function, has been fixed (#8778 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8778>)
.IP \(bu 2
fish builds correctly on NetBSD (#8788 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8788>) and OpenIndiana (#8780 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8780>).
.IP \(bu 2
\fBnextd\-or\-forward\-word\fP, bound to \fBalt\fP\-\fBright\fP by default, was inadvertently changed to move like \fBforward\-bigword\fP\&. This has been corrected (#8790 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8790>).
.IP \(bu 2
\fBfuncsave \-q\fP and \fBfuncsave \-\-quiet\fP now work correctly (#8830 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8830>).
.IP \(bu 2
Issues with the \fBcsharp\fP and \fBnmcli\fP completions were corrected.
.UNINDENT
.sp
If you are upgrading from version 3.3.1 or before, please also review the release notes for 3.4.0 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.4.0 (released March 12, 2022)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
fish\(aqs command substitution syntax has been extended: \fB$(cmd)\fP now has the same meaning as \fB(cmd)\fP but it can be used inside double quotes, to prevent line splitting of the results (#159 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:159>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
foo (bar | string collect)
# can now be written as
foo \(dq$(bar)\(dq

# and

foo (bar)
# can now be written as
foo $(bar)
# this will still split on newlines only.
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
Complementing the \fBprompt\fP command in 3.3.0, \fBfish_config\fP gained a \fBtheme\fP 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 example \fBfish_config theme choose Nord\fP loads the Nord theme in the current session (#8132 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8132>). The current theme can be saved with \fBfish_config theme dump\fP, and custom themes can be added by saving them in \fB~/.config/fish/themes/\fP\&.
.IP \(bu 2
\fBset\fP and \fBread\fP learned a new option, \fB\-\-function\fP, to set a variable in the function\(aqs top scope. This should be a more familiar way of scoping variables and avoids issues with \fB\-\-local\fP, which is actually block\-scoped (#565 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:565>, #8145 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8145>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
function demonstration
    if true
        set \-\-function foo bar
        set \-\-local baz banana
    end
    echo $foo # prints \(dqbar\(dq because $foo is still valid
    echo $baz # prints nothing because $baz went out of scope
end
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBstring pad\fP now excludes escape sequences like colors that fish knows about, and a new \fB\-\-visible\fP flag to \fBstring length\fP 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8182>, #7784 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7784>, #4012 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4012>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> string length \-\-visible (set_color red)foo
3
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
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.
.IP \(bu 2
Autosuggestions can now be turned off by setting \fB$fish_autosuggestion_enabled\fP to 0, and (almost) all highlighting can be turned off by choosing the new \(dqNone\(dq theme. The exception is necessary colors, like those which distinguish autosuggestions from the actual command line. (#8376 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8376>)
.IP \(bu 2
The \fBfish_git_prompt\fP function, which is included in the default prompts, now overrides \fBgit\fP 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8589>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
A new feature flag, \fBampersand\-nobg\-in\-token\fP makes \fB&\fP only act as background operator if followed by a separator. In combination with \fBqmark\-noglob\fP, this allows entering most URLs at the command line without quoting or escaping (#7991 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7991>). For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> echo foo&bar # will print \(dqfoo&bar\(dq, instead of running \(dqecho foo\(dq in the background and executing \(dqbar\(dq
> echo foo & bar # will still run \(dqecho foo\(dq in the background and then run \(dqbar\(dq
# 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
.EE
.UNINDENT
.UNINDENT
.sp
As a reminder, feature flags can be set on startup with \fBfish \-\-features ampersand\-nobg\-in\-token,qmark\-noglob\fP or with a universal variable called \fBfish_features\fP:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> set \-Ua fish_features ampersand\-nobg\-in\-token
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fB$status\fP is now forbidden as a command, to prevent a surprisingly common error among new users: Running \fBif $status\fP (#8171 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8171>). This applies \fIonly\fP to \fB$status\fP, other variables are still allowed.
.IP \(bu 2
\fBset \-\-query\fP now returns an exit status of 255 if given no variable names. This means \fBif set \-q $foo\fP will not enter the if\-block if \fB$foo\fP is empty or unset. To restore the previous behavior, use \fBif not set \-q foo; or set \-q $foo\fP \- but this is unlikely to be desirable (#8214 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8214>).
.IP \(bu 2
\fB_\fP is now a reserved keyword (#8342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8342>).
.IP \(bu 2
The special input functions \fBdelete\-or\-exit\fP, \fBnextd\-or\-forward\-word\fP and \fBprevd\-or\-backward\-word\fP replace fish functions of the same names (#8538 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8538>).
.IP \(bu 2
Mac OS X 10.9 is no longer supported. The minimum Mac version is now 10.10 \(dqYosemite.\(dq
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBstring collect\fP supports a new \fB\-\-allow\-empty\fP option, which will output one empty argument in a command substitution that has no output (#8054 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8054>). This allows commands like \fBtest \-n (echo \-n | string collect \-\-allow\-empty)\fP to work more reliably. Note this can also be written as \fBtest \-n \(dq$(echo \-n)\(dq\fP (see above).
.IP \(bu 2
\fBstring match\fP gained a \fB\-\-groups\-only\fP option, which makes it only output capturing groups, excluding the full match. This allows \fBstring match\fP to do simple transformations (#6056 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6056>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> string match \-r \-\-groups\-only \(aq(.*)fish\(aq \(aqcatfish\(aq \(aqtwofish\(aq \(aqblue fish\(aq | string escape
cat
two
\(aqblue \(aq
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fB$fish_user_paths\fP is now automatically deduplicated to fix a common user error of appending to it in config.fish when it is universal (#8117 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8117>). fish_add_path \%<> remains the recommended way to add to $PATH.
.IP \(bu 2
\fBreturn\fP can now be used outside functions. In scripts, it does the same thing as \fBexit\fP\&. In interactive mode,it sets \fB$status\fP without exiting (#8148 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8148>).
.IP \(bu 2
An oversight prevented all syntax checks from running on commands given to \fBfish \-c\fP (#8171 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8171>). This includes checks such as \fBexec\fP not being allowed in a pipeline, and \fB$$\fP not being a valid variable. Generally, another error was generated anyway.
.IP \(bu 2
\fBfish_indent\fP now correctly reformats tokens that end with a backslash followed by a newline (#8197 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8197>).
.IP \(bu 2
\fBcommandline\fP gained an \fB\-\-is\-valid\fP option to check if the command line is syntactically valid and complete. This allows basic implementation of transient prompts (#8142 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8142>).
.IP \(bu 2
\fBcommandline\fP gained a \fB\-\-paging\-full\-mode\fP option to check if the pager is showing all the possible lines (no \(dq7 more rows\(dq message) (#8485 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8485>).
.IP \(bu 2
List expansion correctly reports an error when used with all zero indexes (#8213 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8213>).
.IP \(bu 2
Running \fBfish\fP with a directory instead of a script as argument (eg \fBfish .\fP) no longer leads to an infinite loop. Instead it errors out immediately (#8258 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8258>)
.IP \(bu 2
Some error messages occurring after fork, like \(dqtext file busy\(dq have been replaced by bespoke error messages for fish (like \(dqFile is currently open for writing\(dq). This also restores error messages with current glibc versions that removed sys_errlist (#8234 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8234>, #4183 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4183>).
.IP \(bu 2
The \fBrealpath\fP builtin now also squashes leading slashes with the \fB\-\-no\-symlinks\fP option (#8281 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8281>).
.IP \(bu 2
When trying to \fBcd\fP to a dangling (broken) symbolic link, fish will print an error noting that the target is a broken link (#8264 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8264>).
.IP \(bu 2
On MacOS terminals that are not granted permissions to access a folder, \fBcd\fP would print a spurious \(dqrotten symlink\(dq error, which has been corrected to \(dqpermission denied\(dq (#8264 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8264>).
.IP \(bu 2
Since fish 3.0, \fBfor\fP 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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8384>).
.IP \(bu 2
\fBmath\fP now correctly prints negative values and values larger than \fB2**31\fP when in hex or octal bases (#8417 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8417>).
.IP \(bu 2
\fBdirs\fP always produces an exit status of 0, instead of sometimes returning 1 (#8211 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8211>).
.IP \(bu 2
\fBcd \(dq\(dq\fP no longer crashes fish (#8147 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8147>).
.IP \(bu 2
\fBset \-\-query\fP can now query whether a variable is a path variable via \fB\-\-path\fP or \fB\-\-unpath\fP (#8494 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8494>).
.IP \(bu 2
Tilde characters (\fB~\fP) produced by custom completions are no longer escaped when applied to the command line, making it easier to use the output of a recursive \fBcomplete \-C\fP in completion scripts (#4570 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4570>).
.IP \(bu 2
\fBset \-\-show\fP reports when a variable is read\-only (#8179 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8179>).
.IP \(bu 2
Erasing \fB$fish_emoji_width\fP will reset fish to the default guessed emoji width (#8274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8274>).
.IP \(bu 2
The \fBla\fP function no longer lists entries for \(dq.\(dq and \(dq..\(dq, matching other systems defaults (#8519 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8519>).
.IP \(bu 2
\fBabbr \-q\fP returns the correct exit status when given multiple abbreviation names as arguments (#8431 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8431>).
.IP \(bu 2
\fBcommand \-v\fP returns an exit status of 127 instead of 1 if no command was found (#8547 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8547>).
.IP \(bu 2
\fBargparse\fP with \fB\-\-ignore\-unknown\fP no longer breaks with multiple unknown options in a short option group (#8637 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8637>).
.IP \(bu 2
Comments inside command substitutions or brackets now correctly ignore parentheses, quotes, and brackets (#7866 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7866>, #8022 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8022>, #8695 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8695>).
.IP \(bu 2
\fBcomplete \-C\fP supports a new \fB\-\-escape\fP option, which turns on escaping in returned completion strings (#3469 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3469>).
.IP \(bu 2
Invalid byte or unicode escapes like \fB\eUtest\fP or \fB\exNotHex\fP are now a tokenizer error instead of causing the token to be truncated (#8545 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8545>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Vi mode cursors are now set properly after \fBctrl\fP\-\fBc\fP (#8125 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8125>).
.IP \(bu 2
\fBfunced\fP will try to edit the whole file containing a function definition, if there is one (#391 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:391>).
.IP \(bu 2
Running a command line consisting of just spaces now deletes an ephemeral (starting with space) history item again (#8232 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8232>).
.IP \(bu 2
Command substitutions no longer respect job control, instead running inside fish\(aqs own process group (#8172 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8172>). This more closely matches other shells, and improves \fBctrl\fP\-\fBc\fP reliability inside a command substitution.
.IP \(bu 2
\fBhistory\fP and \fB__fish_print_help\fP now properly support \fBless\fP before version 530, including the version that ships with macOS. (#8157 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8157>).
.IP \(bu 2
\fBhelp\fP now knows which section is in which document again (#8245 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8245>).
.IP \(bu 2
fish\(aqs highlighter will now color options (starting with \fB\-\fP or \fB\-\-\fP) with the color given in the new $fish_color_option, up to the first \fB\-\-\fP\&. It falls back on $fish_color_param, so nothing changes for existing setups (#8292 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8292>).
.IP \(bu 2
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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8423>).
.IP \(bu 2
\fBfish_key_reader\fP\(aqs output was simplified. By default, it now only prints a bind statement. The previous per\-character timing information can be seen with a new \fB\-\-verbose\fP switch (#8467 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8467>).
.IP \(bu 2
Custom completions are now also loaded for commands that contain tildes or variables like \fB~/bin/fish\fP or \fB$PWD/fish\fP (#8442 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8442>).
.IP \(bu 2
Command lines spanning multiple lines will not be overwritten by the completion pager when it fills the entire terminal (#8509 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8509>, #8405 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8405>).
.IP \(bu 2
When redrawing a multiline prompt, the old prompt is now properly cleared (#8163 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8163>).
.IP \(bu 2
Interactive completion would occasionally ignore the last word on the command line due to a race condition. This has been fixed (#8175 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8175>).
.IP \(bu 2
Propagation of universal variables from a fish process that is closing is faster (#8209 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8209>).
.IP \(bu 2
The command line is drawn in the correct place if the prompt ends with a newline (#8298 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8298>).
.IP \(bu 2
\fBhistory\fP learned a new subcommand \fBclear\-session\fP to erase all history from the current session (#5791 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5791>).
.IP \(bu 2
Pressing \fBctrl\fP\-\fBc\fP in \fBfish_key_reader\fP will no longer print the incorrect \(dqPress [ctrl\-C] again to exit\(dq message (#8510 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8510>).
.IP \(bu 2
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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8579>).
.IP \(bu 2
When looking for locale information, the Debian configuration is now used when available (#8557 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8557>).
.IP \(bu 2
Pasting text containing quotes from the clipboard trims spaces more appropriately (#8550 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8550>).
.IP \(bu 2
The clipboard bindings ignore X\-based clipboard programs if the \fBDISPLAY\fP environment variable is not set, which helps prefer the Windows clipboard when it is available (such as on WSL).
.IP \(bu 2
\fBfuncsave\fP will remove a saved copy of a function that has been erased with \fBfunctions \-\-erase\fP\&.
.IP \(bu 2
The Web\-based configuration tool gained a number of improvements, including the ability to set pager colors.
.IP \(bu 2
The default \fBfish_title\fP prints a shorter title with shortened $PWD and no more redundant \(dqfish\(dq (#8641 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8641>).
.IP \(bu 2
Holding down an arrow key won\(aqt freeze the terminal with long periods of flashing (#8610 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8610>).
.IP \(bu 2
Multi\-char bindings are no longer interrupted if a signal handler enqueues an event. (#8628 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8628>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
\fBescape\fP can now bound without breaking arrow key bindings (#8428 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8428>).
.IP \(bu 2
The \fBalt\fP\-\fBh\fP binding (to open a command’s manual page) now also ignores \fBcommand\fP (#8447 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8447>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The \fBfish_status_to_signal\fP helper function returns the correct signal names for the current platform, rather than Linux (#8530 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8530>).
.IP \(bu 2
The \fBprompt_pwd\fP helper function learned a \fB\-\-full\-length\-dirs N\fP 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 \fB\-d N\fP or \fB\-\-dir\-length N\fP\&. (#8208 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8208>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> prompt_pwd \-\-full\-length\-dirs 2 \-d 1 ~/dev/fish\-shell/share/tools/web_config
~/d/f/s/tools/web_config
.EE
.UNINDENT
.UNINDENT
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
Apple\(aqs \fBshortcuts\fP
.IP \(bu 2
\fBargparse\fP (#8434 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8434>)
.IP \(bu 2
\fBasd\fP (#8759 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8759>)
.IP \(bu 2
\fBaz\fP (#8141 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8141>)
.IP \(bu 2
\fBblack\fP (#8123 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8123>)
.IP \(bu 2
\fBclasp\fP (#8373 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8373>)
.IP \(bu 2
\fBcpupower\fP (#8302 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8302>)
.IP \(bu 2
\fBdart\fP (#8315 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8315>)
.IP \(bu 2
\fBdscacheutil\fP
.IP \(bu 2
\fBelvish\fP (#8416 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8416>)
.IP \(bu 2
\fBethtool\fP (#8283 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8283>)
.IP \(bu 2
\fBexif\fP (#8246 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8246>)
.IP \(bu 2
\fBfindstr\fP (#8481 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8481>)
.IP \(bu 2
\fBgit\-sizer\fP (#8156 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8156>)
.IP \(bu 2
\fBgnome\-extensions\fP (#8732 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8732>)
.IP \(bu 2
\fBgping\fP (#8181 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8181>)
.IP \(bu 2
\fBisatty\fP (#8609 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8609>)
.IP \(bu 2
\fBistioctl\fP (#8343 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8343>)
.IP \(bu 2
\fBkmutil\fP
.IP \(bu 2
\fBkubectl\fP (#8734 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8734>)
.IP \(bu 2
\fBmatlab\fP (#8505 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8505>)
.IP \(bu 2
\fBmono\fP (#8415 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8415>) and related tools \fBcsharp\fP, \fBgacutil\fP, \fBgendarme\fP, \fBikdasm\fP, \fBilasm\fP, \fBmkbundle\fP, \fBmonodis\fP, \fBmonop\fP, \fBsqlsharp\fP and \fBxsp\fP (#8452 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8452>)
.IP \(bu 2
Angular\(aqs \fBng\fP (#8111 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8111>)
.IP \(bu 2
\fBnodeenv\fP (#8533 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8533>)
.IP \(bu 2
\fBoctave\fP (#8505 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8505>)
.IP \(bu 2
\fBpabcnet_clear\fP (#8421 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8421>)
.IP \(bu 2
\fBqmk\fP (#8180 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8180>)
.IP \(bu 2
\fBrakudo\fP (#8113 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8113>)
.IP \(bu 2
\fBrc\-status\fP (#8757 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8757>)
.IP \(bu 2
\fBroswell\fP (#8330 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8330>)
.IP \(bu 2
\fBsbcl\fP (#8330 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8330>)
.IP \(bu 2
\fBstarship\fP (#8520 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8520>)
.IP \(bu 2
\fBtopgrade\fP (#8651 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8651>)
.IP \(bu 2
\fBwine\fP, \fBwineboot\fP and \fBwinemaker\fP (#8411 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8411>)
.IP \(bu 2
Windows Subsystem for Linux (WSL)\(aqs \fBwslpath\fP (#8364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8364>)
.IP \(bu 2
Windows\(aq \fBcolor\fP (#8483 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8483>), \fBattrib\fP, \fBattributes\fP, \fBchoice\fP, \fBclean\fP, \fBcleanmgr\fP, \fBcmd\fP, \fBcmdkey\fP, \fBcomp\fP, \fBforfiles\fP, \fBpowershell\fP, \fBreg\fP, \fBschtasks\fP, \fBsetx\fP (#8486 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8486>)
.IP \(bu 2
\fBzef\fP (#8114 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8114>)
.UNINDENT
.IP \(bu 2
Improvements to many completions, especially for \fBgit\fP aliases (#8129 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8129>), subcommands (#8134 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8134>) and submodules (#8716 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8716>).
.IP \(bu 2
Many adjustments to complete correct options for system utilities on BSD and macOS.
.IP \(bu 2
When evaluating custom completions, the command line state no longer includes variable overrides (\fBvar=val\fP). This unbreaks completions that read \fBcommandline \-op\fP\&.
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
Dynamic terminal titles are enabled on WezTerm (#8121 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8121>).
.IP \(bu 2
Directory history navigation works out of the box with Apple Terminal\(aqs default key settings (#2330 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2330>).
.IP \(bu 2
fish now assumes Unicode 9+ widths for emoji under iTerm 2 (#8200 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8200>).
.IP \(bu 2
Skin\-tone emoji modifiers (U+1F3FB through U+1F3FF) are now measured as width 0 (#8275 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8275>).
.IP \(bu 2
fish\(aqs escape sequence removal now also knows Tmux\(aqs wrapped escapes.
.IP \(bu 2
Vi mode cursors are enabled in Apple Terminal.app (#8167 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8167>).
.IP \(bu 2
Vi cursor shaping and $PWD reporting is now also enabled on foot (#8422 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8422>).
.IP \(bu 2
\fBls\fP will use colors also on newer versions of Apple Terminal.app (#8309 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8309>).
.IP \(bu 2
The \fBdelete\fP and \fBshift\fP\-\fBtab\fP keys work more reliably under \fBst\fP (#8352 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8352>, #8354 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8354>).
.UNINDENT
.SS Other improvements
.INDENT 0.0
.IP \(bu 2
Fish\(aqs test suite now uses \fBctest\fP, and has become much faster to run. It is now also possible to run only specific tests with targets named \fBtest_$filename\fP \- \fBmake test_set.fish\fP only runs the set.fish test. (#7851 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7851>)
.IP \(bu 2
The HTML version of the documentation now includes copy buttons for code examples (#8218 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8218>).
.IP \(bu 2
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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8632>).
.IP \(bu 2
The Debian & Ubuntu package linked from fishshell.com is now a single package, rather than split into \fBfish\fP and \fBfish\-common\fP (#7845 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7845>).
.IP \(bu 2
The macOS installer does not assert that Rosetta is required to install fish on machines with Apple Silicon (#8566 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8566>).
.IP \(bu 2
The macOS installer now cleans up previous .pkg installations when upgrading. (#2963 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2963>).
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
The minimum version of CMake required to build fish is now 3.5.0.
.IP \(bu 2
The CMake installation supports absolute paths for \fBCMAKE_INSTALL_DATADIR\fP (#8150 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8150>).
.IP \(bu 2
Building using NetBSD curses works on any platform (#8087 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8087>).
.IP \(bu 2
The build system now uses the default linker instead of forcing use of the gold or lld linker (#8152 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8152>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.3.1 (released July 6, 2021)
.sp
This release of fish fixes the following problems identified in fish 3.3.0:
.INDENT 0.0
.IP \(bu 2
The prompt and command line are redrawn correctly in response to universal variable changes (#8088 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8088>).
.IP \(bu 2
A superfluous error that was produced when setting the \fBPATH\fP or \fBCDPATH\fP environment variables to include colon\-delimited components that do not exist was removed (#8095 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8095>).
.IP \(bu 2
The Vi mode indicator in the prompt is repainted correctly after \fBctrl\fP\-\fBc\fP cancels the current command (#8103 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8103>).
.IP \(bu 2
fish builds correctly on platforms that do not have a \fBspawn.h\fP header, such as old versions of OS X (#8097 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8097>).
.UNINDENT
.sp
A number of improvements to the documentation, and fixes for completions, are included as well.
.sp
If you are upgrading from version 3.2.2 or before, please also review the release notes for 3.3.0 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.3.0 (released June 28, 2021)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
\fBfish_config\fP gained a \fBprompt\fP subcommand to show and pick from the sample prompts directly in the terminal, instead of having to open a webbrowser. For example \fBfish_config prompt choose default\fP loads the default prompt in the current session (#7958 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7958>).
.IP \(bu 2
The documentation has been reorganized to be easier to understand (#7773 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7773>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The \fB$fish_history\fP value \(dqdefault\(dq is no longer special. It used to be treated the same as \(dqfish\(dq (#7650 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7650>).
.IP \(bu 2
Redirection to standard error with the \fB^\fP character has been disabled by default. It can be turned back on using the \fBstderr\-nocaret\fP feature flag, but will eventually be disabled completely (#7105 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7105>).
.IP \(bu 2
Specifying an initial tab to \fBfish_config\fP now only works with \fBfish_config browse\fP (eg \fBfish_config browse variables\fP), otherwise it would interfere with the new \fBprompt\fP subcommand (see below) (#7958 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7958>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBmath\fP gained new functions \fBlog2\fP (like the documentation claimed), \fBmax\fP and \fBmin\fP (#7856 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7856>). \fBmath\fP functions can be used without the parentheses (eg \fBmath sin 2 + 6\fP), and functions have the lowest precedence in the order of operations (#7877 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7877>).
.IP \(bu 2
Shebang (\fB#!\fP) lines are no longer required within shell scripts, improving support for scripts with concatenated binary contents. If a file fails to execute and passes a (rudimentary) binary safety check, fish will re\-invoke it using \fB/bin/sh\fP (#7802 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7802>).
.IP \(bu 2
Exit codes are better aligned with bash. A failed execution now reports \fB$status\fP of 127 if the file is not found, and 126 if it is not executable.
.IP \(bu 2
\fBecho\fP no longer writes its output one byte at a time, improving performance and allowing use with Linux\(aqs special API files (\fB/proc\fP, \fB/sys\fP and such) (#7836 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7836>).
.IP \(bu 2
fish should now better handle \fBcd\fP on filesystems with broken \fBstat(3)\fP responses (#7577 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7577>).
.IP \(bu 2
Builtins now properly report a \fB$status\fP of 1 upon unsuccessful writes (#7857 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7857>).
.IP \(bu 2
\fBstring match\fP with unmatched capture groups and without the \fB\-\-all\fP flag now sets an empty variable instead of a variable containing the empty string. It also correctly imports the first match if multiple arguments are provided, matching the documentation. (#7938 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7938>).
.IP \(bu 2
fish produces more specific errors when a command in a command substitution wasn\(aqt found or is not allowed. This now prints something like \(dqUnknown command\(dq instead of \(dqUnknown error while evaluating command substitution\(dq.
.IP \(bu 2
\fBfish_indent\fP allows inline variable assignments (\fBFOO=BAR command\fP) to use line continuation, instead of joining them into one line (#7955 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7955>).
.IP \(bu 2
fish gained a \fB\-\-no\-config\fP option to disable configuration files. This applies to user\-specific and the systemwide \fBconfig.fish\fP (typically in \fB/etc/fish/config.fish\fP), and configuration snippets (typically in \fBconf.d\fP directories). It also disables universal variables, history, and loading of functions from system or user configuration directories (#7921 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7921>, #1256 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1256>).
.IP \(bu 2
When universal variables are unavailable for some reason, setting a universal variable now sets a global variable instead (#7921 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7921>).
.IP \(bu 2
\fB$last_pid\fP now contains the process ID of the last process in the pipeline, allowing it to be used in scripts (#5036 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5036>, #5832 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5832>, #7721 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7721>). Previously, this value contained the process group ID, but in scripts this was the same as the running fish\(aqs process ID.
.IP \(bu 2
\fBprocess\-exit\fP event handlers now receive the same value as \fB$status\fP in all cases, instead of receiving \-1 when the exit was due to a signal.
.IP \(bu 2
\fBprocess\-exit\fP event handlers for PID 0 also received \fBJOB_EXIT\fP events; this has been fixed.
.IP \(bu 2
\fBjob\-exit\fP event handlers may now be created with any of the PIDs from the job. The handler is passed the last PID in the job as its second argument, instead of the process group.
.IP \(bu 2
Trying to set an empty variable name with \fBset\fP no longer works (these variables could not be used in expansions anyway).
.IP \(bu 2
\fBfish_add_path\fP handles an undefined \fBPATH\fP environment variable correctly (#8082 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8082>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
Commands entered before the previous command finishes will now be properly syntax highlighted.
.IP \(bu 2
fish now automatically creates \fBconfig.fish\fP and the configuration directories in \fB$XDG_CONFIG_HOME/fish\fP (by default \fB~/.config/fish\fP) if they do not already exist (#7402 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7402>).
.IP \(bu 2
\fB$SHLVL\fP is no longer incremented in non\-interactive shells. This means it won\(aqt be set to values larger than 1 just because your environment happens to run some scripts in $SHELL in its startup path (#7864 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7864>).
.IP \(bu 2
fish no longer rings the bell when flashing the command line. The flashing should already be enough notification and the bell can be annoying (#7875 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7875>).
.IP \(bu 2
\fBfish \-\-help\fP is more helpful if the documentation isn\(aqt installed (#7824 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7824>).
.IP \(bu 2
\fBfunced\fP won\(aqt include an entry on where a function is defined, thanks to the new \fBfunctions \-\-no\-details\fP option (#7879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7879>).
.IP \(bu 2
A new variable, \fBfish_killring\fP, containing entries from the killring, is now available (#7445 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7445>).
.IP \(bu 2
\fBfish \-\-private\fP prints a note on private mode on startup even if \fB$fish_greeting\fP is an empty list (#7974 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7974>).
.IP \(bu 2
fish no longer attempts to lock history or universal variable files on remote filesystems, including NFS and Samba mounts. In rare cases, updates to these files may be dropped if separate fish instances modify them simultaneously. (#7968 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7968>).
.IP \(bu 2
\fBwait\fP and \fBon\-process\-exit\fP work correctly with jobs that have already exited (#7210 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7210>).
.IP \(bu 2
\fB__fish_print_help\fP (used for \fB\-\-help\fP output for fish\(aqs builtins) now respects the \fBLESS\fP environment variable, and if not set, uses better default pager settings (#7997 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7997>).
.IP \(bu 2
Errors from \fBalias\fP are now printed to standard error, matching other builtins and functions (#7925 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7925>).
.IP \(bu 2
\fBls\fP output is colorized on OpenBSD if colorls utility is installed (#8035 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8035>)
.IP \(bu 2
The default pager color looks better in terminals with light backgrounds (#3412 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3412>).
.IP \(bu 2
Further robustness improvements to the bash history import (#7874 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7874>).
.IP \(bu 2
fish now tries to find a Unicode\-aware locale for encoding (\fBLC_CTYPE\fP) if started without any locale information, improving the display of emoji and other non\-ASCII text on misconfigured systems (#8031 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8031>). To allow a C locale, set the variable \fBfish_allow_singlebyte_locale\fP to 1.
.IP \(bu 2
The Web\-based configuration and documentation now feature a dark mode if the browser requests it (#8043 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8043>).
.IP \(bu 2
Color variables can now also be given like \fB\-\-background red\fP and \fB\-b red\fP, not just \fB\-\-background=red\fP (#8053 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8053>).
.IP \(bu 2
\fBexit\fP run within \fBfish_prompt\fP now exits properly (#8033 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8033>).
.IP \(bu 2
When attempting to execute the unsupported POSIX\-style brace command group (\fB{ ... }\fP) fish will suggest its equivalent \fBbegin; ...; end\fP commands (#6415 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6415>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
Pasting in Vi mode puts text in the right place in normal mode (#7847 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7847>).
.IP \(bu 2
Vi mode\(aqs \fBu\fP is bound to \fBundo\fP instead of \fBhistory\-search\-backward\fP, following GNU readline\(aqs behavior. Similarly, \fBctrl\fP\-\fBr\fP is bound to \fBredo\fP instead of \fBhistory\-search\-backward\fP, following Vim (#7908 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7908>).
.IP \(bu 2
\fBs\fP in Vi visual mode now does the same thing as \fBc\fP (#8039 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8039>).
.IP \(bu 2
The binding for \fB\(dq,*,y\fP now uses \fBfish_clipboard_copy\fP, allowing it to support more than just \fBxsel\fP\&.
.IP \(bu 2
The \fBctrl\fP\-\fBspace\fP binding can be correctly customised (#7922 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7922>).
.IP \(bu 2
\fBexit\fP works correctly in bindings (#7967 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7967>).
.IP \(bu 2
The \fBf1\fP binding, which opens the manual page for the current command, now works around a bug in certain \fBless\fP versions that fail to clear the screen (#7863 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7863>).
.IP \(bu 2
The binding for \fBalt\fP\-\fBs\fP now toggles whether \fBsudo\fP is prepended, even when it took the commandline from history instead of only adding it.
.IP \(bu 2
The new functions \fBfish_commandline_prepend\fP and \fBfish_commandline_append\fP allow toggling the presence of a prefix/suffix on the current commandline. (#7905 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7905>).
.IP \(bu 2
\fBbackward\-kill\-path\-component\fP \fBctrl\fP\-\fBw\fP) no longer erases parts of two tokens when the cursor is positioned immediately after \fB/\fP\&. (#6258 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6258>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The default Vi mode prompt now uses foreground instead of background colors, making it less obtrusive (#7880 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7880>).
.IP \(bu 2
Performance of the \(dqinformative\(dq git prompt is improved somewhat (#7871 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7871>). This is still slower than the non\-informative version by its very nature. In particular it is IO\-bound, so it will be very slow on slow disks or network mounts.
.IP \(bu 2
The sample prompts were updated. Some duplicated prompts, like the various classic variants, or less useful ones, like the \(dqjustadollar\(dq prompt were removed, some prompts were cleaned up, and in some cases renamed. A new \(dqsimple\(dq and \(dqdisco\(dq prompt were added (#7884 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7884>, #7897 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7897>, #7930 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7930>). The new prompts will only take effect when selected and existing installed prompts will remain unchanged.
.IP \(bu 2
A new \fBprompt_login\fP helper function to describe the kind of \(dqlogin\(dq (user, host and chroot status) for use in prompts. This replaces the old \(dqdebian chroot\(dq prompt and has been added to the default and terlar prompts (#7932 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7932>).
.IP \(bu 2
The Web\-based configuration\(aqs prompt picker now shows and installs right prompts (#7930 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7930>).
.IP \(bu 2
The git prompt now has the same symbol order in normal and \(dqinformative\(dq mode, and it\(aqs customizable via \fB$__fish_git_prompt_status_order\fP (#7926 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7926>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBfirewall\-cmd\fP (#7900 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7900>)
.IP \(bu 2
\fBsv\fP (#8069 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8069>)
.UNINDENT
.IP \(bu 2
Improvements to plenty of completions!
.IP \(bu 2
Commands that wrap \fBcd\fP (using \fBcomplete \-\-wraps cd\fP) get the same completions as \fBcd\fP (#4693 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4693>).
.IP \(bu 2
The \fB\-\-force\-files\fP option to \fBcomplete\fP works for bare arguments, not just options (#7920 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7920>).
.IP \(bu 2
Completion descriptions for functions don\(aqt include the function definition, making them more concise (#7911 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7911>).
.IP \(bu 2
The \fBkill\fP completions no longer error on MSYS2 (#8046 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8046>).
.IP \(bu 2
Completion scripts are now loaded when calling a command via a relative path (like \fB\&./git\fP) (#6001 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6001>, #7992 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7992>).
.IP \(bu 2
When there are multiple completion candidates, fish inserts their shared prefix. This prefix was computed in a case\-insensitive way, resulting in wrong case in the completion pager. This was fixed by only inserting prefixes with matching case (#7744 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7744>).
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
fish no longer tries to detect a missing new line during startup, preventing an erroneous \fB⏎\fP from appearing if the terminal is resized at the wrong time, which can happen in tiling window managers (#7893 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7893>).
.IP \(bu 2
fish behaves better when it disagrees with the terminal on the width of characters. In particular, staircase effects with right prompts should be gone in most cases (#8011 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8011>).
.IP \(bu 2
If the prompt takes up the entire line, the last character should no longer be chopped off in certain terminals (#8002 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8002>).
.IP \(bu 2
fish\(aqs reflow handling has been disabled by default for kitty (#7961 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7961>).
.IP \(bu 2
The default prompt no longer produces errors when used with a dumb terminal (#7904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7904>).
.IP \(bu 2
Terminal size variables are updated for window size change signal handlers (\fBSIGWINCH\fP).
.IP \(bu 2
Pasting within a multi\-line command using a terminal that supports bracketed paste works correctly, instead of producing an error (#7782 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7782>).
.IP \(bu 2
\fBset_color\fP produces an error when used with invalid arguments, rather than empty output which interacts badly with Cartesian product expansion.
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
fish runs correctly on platforms without the \fBO_CLOEXEC\fP flag for \fBopen(2)\fP (#8023 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8023>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.2.2 (released April 7, 2021)
.sp
This release of fish fixes a number of additional issues identified in the fish 3.2 series:
.INDENT 0.0
.IP \(bu 2
The command\-not\-found handler used suggestions from \fBpacman\fP on Arch Linux, but this caused major slowdowns on some systems and has been disabled (#7841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7841>).
.IP \(bu 2
fish will no longer hang on exit if another process is in the foreground on macOS (#7901 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7901>).
.IP \(bu 2
Certain programs (such as \fBlazygit\fP) could create situations where fish would not receive keystrokes correctly, but it is now more robust in these situations (#7853 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7853>).
.IP \(bu 2
Arguments longer than 1024 characters no longer trigger excessive CPU usage on macOS (#7837 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7837>).
.IP \(bu 2
fish builds correctly on macOS when using new versions of Xcode (#7838 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7838>).
.IP \(bu 2
Completions for \fBaura\fP (#7865 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7865>) and \fBtshark\fP (#7858 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7858>) should no longer produce errors.
.IP \(bu 2
Background jobs no longer interfere with syntax highlighting (a regression introduced in fish 3.2.1, #7842 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7842>).
.UNINDENT
.sp
If you are upgrading from version 3.1.2 or before, please also review the release notes for 3.2.1 and 3.2.0 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.2.1 (released March 18, 2021)
.sp
This release of fish fixes the following problems identified in fish 3.2.0:
.INDENT 0.0
.IP \(bu 2
Commands in key bindings are run with fish\(aqs internal terminal modes, instead of the terminal modes typically used for commands. This fixes a bug introduced in 3.2.0, where text would unexpectedly appear on the terminal, especially when pasting (#7770 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7770>).
.IP \(bu 2
Prompts which use the internal \fB__fish_print_pipestatus\fP function will display correctly rather than carrying certain modifiers (such as bold) further than intended (#7771 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7771>).
.IP \(bu 2
Redirections to internal file descriptors is allowed again, reversing the changes in 3.2.0. This fixes a problem with Midnight Commander (#7769 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7769>).
.IP \(bu 2
Universal variables should be fully reliable regardless of operating system again (#7774 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7774>).
.IP \(bu 2
\fBfish_git_prompt\fP no longer causes screen flickering in certain terminals (#7775 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7775>).
.IP \(bu 2
\fBfish_add_path\fP manipulates the \fBfish_user_paths\fP variable correctly when moving multiple paths (#7776 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7776>).
.IP \(bu 2
Pasting with a multi\-line command no longer causes a \fB__fish_tokenizer_state\fP error (#7782 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7782>).
.IP \(bu 2
\fBpsub\fP inside event handlers cleans up temporary files properly (#7792 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7792>).
.IP \(bu 2
Event handlers declared with \fB\-\-on\-job\-exit $fish_pid\fP no longer run constantly (#7721 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7721>), although these functions should use \fB\-\-on\-event fish_exit\fP instead.
.IP \(bu 2
Changing terminal modes inside \fBconfig.fish\fP works (#7783 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7783>).
.IP \(bu 2
\fBset_color \-\-print\-colors\fP no longer prints all colors in bold (#7805 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7805>)
.IP \(bu 2
Completing commands starting with a \fB\-\fP no longer prints an error (#7809 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7809>).
.IP \(bu 2
Running \fBfish_command_not_found\fP directly no longer produces an error on macOS or other OSes which do not have a handler available (#7777 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7777>).
.IP \(bu 2
The new \fBtype\fP builtin now has the (deprecated) \fB\-\-quiet\fP long form of \fB\-q\fP (#7766 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7766>).
.UNINDENT
.sp
It also includes some small enhancements:
.INDENT 0.0
.IP \(bu 2
\fBhelp\fP and \fBfish_config\fP work correctly when fish is running in a Chrome OS Crostini Linux VM (#7789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7789>).
.IP \(bu 2
The history file can be made a symbolic link without it being overwritten (#7754 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7754>), matching a similar improvement for the universal variable file in 3.2.0.
.IP \(bu 2
An unhelpful error (\(dqaccess: No error\(dq), seen on Cygwin, is no longer produced (#7785 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7785>).
.IP \(bu 2
Improvements to the \fBrsync\fP completions (#7763 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7763>), some completion descriptions (#7788 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7788>), and completions that use IP address (#7787 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7787>).
.IP \(bu 2
Improvements to the appearance of \fBfish_config\fP (#7811 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7811>).
.UNINDENT
.sp
If you are upgrading from version 3.1.2 or before, please also review
the release notes for 3.2.0 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.2.0 (released March 1, 2021)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
\fBUndo and redo support\fP for the command\-line editor and pager search (#1367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1367>). By default, undo is bound to Control+Z, and redo to Alt+/.
.IP \(bu 2
\fBBuiltins can now output before all data is read\fP\&. For example, \fBstring replace\fP no longer has to read all of stdin before it can begin to output.
This makes it usable also for pipes where the previous command hasn\(aqt finished yet, like:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
# Show all dmesg lines related to \(dqusb\(dq
dmesg \-w | string match \(aq*usb*\(aq
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
\fBPrompts will now be truncated\fP instead of replaced with \fB\(dq> \(dq\fP if they are wider than the terminal (#904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:904>).
For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
~/dev/build/fish\-shell\-git/src/fish\-shell/build (makepkg)>
.EE
.UNINDENT
.UNINDENT
.sp
will turn into:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
…h\-shell/build (makepkg)>
.EE
.UNINDENT
.UNINDENT
.sp
It is still possible to react to the \fBCOLUMNS\fP variable inside the prompt to implement smarter behavior.
.IP \(bu 2
\fBfish completes ambiguous completions\fP after pressing \fBtab\fP even when they
have a common prefix, without the user having to press \fBtab\fP again
(#6924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6924>).
.IP \(bu 2
fish is less aggressive about resetting terminal modes, such as flow control, after every command.
Although flow control remains off by default, enterprising users can now enable it with
\fBstty\fP (#2315 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2315>, #7704 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7704>).
.IP \(bu 2
A new \fB\(dqfish_add_path\(dq helper function to add paths to $PATH\fP without producing duplicates,
to be used interactively or in \fBconfig.fish\fP (#6960 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6960>, #7028 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7028>).
For example:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
fish_add_path /opt/mycoolthing/bin
.EE
.UNINDENT
.UNINDENT
.sp
will add /opt/mycoolthing/bin to the beginning of $fish_user_path without creating duplicates,
so it can be called safely from config.fish or interactively, and the path will just be there, once.
.IP \(bu 2
\fBBetter errors with \(dqtest\(dq\fP (#6030 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6030>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
> test 1 = 2 and echo true or false
test: Expected a combining operator like \(aq\-a\(aq at index 4
1 = 2 and echo true or echo false
      ^
.EE
.UNINDENT
.UNINDENT
.sp
This includes numbering the index from 1 instead of 0, like fish lists.
.IP \(bu 2
\fBA new theme for the documentation and Web\-based configuration\fP (#6500 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6500>, #7371 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7371>, #7523 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7523>), matching the design on fishshell.com.
.IP \(bu 2
\fBfish \-\-no\-execute\fP \fBwill no longer complain about unknown commands\fP
or non\-matching wildcards, as these could be defined differently at
runtime (especially for functions). This makes it usable as a static syntax checker (#977 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:977>).
.IP \(bu 2
\fBstring match \-\-regex\fP now integrates \fBnamed PCRE2 capture groups as fish variables\fP, allowing variables to be set directly from \fBstring match\fP (#7459 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7459>). To support this functionality, \fBstring\fP is now a reserved word and can no longer be wrapped in a function.
.IP \(bu 2
Globs and other \fBexpansions are limited to 512,288 results\fP (#7226 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7226>). Because operating systems limit the number of arguments to commands, larger values are unlikely to work anyway, and this helps to avoid hangs.
.IP \(bu 2
A new \fB\(dqfish for bash users\(dq documentation page\fP gives a quick overview of the scripting differences between bash and fish (#2382 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2382>), and the completion tutorial has also been moved out into its own document (#6709 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6709>).
.UNINDENT
.SS Syntax changes and new commands
.INDENT 0.0
.IP \(bu 2
Range limits in index range expansions like \fB$x[$start..$end]\fP may be omitted: \fB$start\fP and \fB$end\fP default to 1 and \-1 (the last item) respectively (#6574 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6574>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
echo $var[1..]
echo $var[..\-1]
echo $var[..]
.EE
.UNINDENT
.UNINDENT
.sp
All print the full list \fB$var\fP\&.
.IP \(bu 2
When globbing, a segment which is exactly \fB**\fP may now match zero directories. For example \fB**/foo\fP may match \fBfoo\fP in the current directory (#7222 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7222>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
The \fBtype\fP, \fB_\fP (gettext), \fB\&.\fP (source) and \fB:\fP (no\-op) functions
are now implemented builtins for performance purposes (#7342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7342>, #7036 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7036>, #6854 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6854>).
.IP \(bu 2
\fBset\fP and backgrounded jobs no longer overwrite \fB$pipestatus\fP (#6820 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6820>), improving its use in command substitutions (#6998 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6998>).
.IP \(bu 2
Computed (\(dqelectric\(dq) variables such as \fBstatus\fP are now only global in scope, so \fBset \-Uq status\fP returns false (#7032 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7032>).
.IP \(bu 2
The output for \fBset \-\-show\fP has been shortened, only mentioning the scopes in which a variable exists (#6944 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6944>).
In addition, it now shows if a variable is a path variable.
.IP \(bu 2
A new variable, \fBfish_kill_signal\fP, is set to the signal that terminated the last foreground job, or \fB0\fP if the job exited normally (#6824 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6824>, #6822 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6822>).
.IP \(bu 2
A new subcommand, \fBstring pad\fP, allows extending strings to a given width (#7340 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7340>, #7102 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7102>).
.IP \(bu 2
\fBstring sub\fP has a new \fB\-\-end\fP option to specify the end index of
a substring (#6765 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6765>, #5974 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5974>).
.IP \(bu 2
\fBstring split\fP has a new \fB\-\-fields\fP option to specify fields to
output, similar to \fBcut \-f\fP (#6770 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6770>).
.IP \(bu 2
\fBstring trim\fP now also trims vertical tabs by default (#6795 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6795>).
.IP \(bu 2
\fBstring replace\fP no longer prints an error if a capturing group wasn\(aqt matched, instead treating it as empty (#7343 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7343>).
.IP \(bu 2
\fBstring\fP subcommands now quit early when used with \fB\-\-quiet\fP (#7495 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7495>).
.IP \(bu 2
\fBstring repeat\fP now handles multiple arguments, repeating each one (#5988 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5988>).
.IP \(bu 2
\fBprintf\fP no longer prints an error if not given an argument (not
even a format string).
.IP \(bu 2
The \fBtrue\fP and \fBfalse\fP builtins ignore any arguments, like other shells (#7030 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7030>).
.IP \(bu 2
\fBfish_indent\fP now removes unnecessary quotes in simple cases (#6722 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6722>)
and gained a \fB\-\-check\fP option to just check if a file is indented correctly (#7251 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7251>).
.IP \(bu 2
\fBfish_indent\fP indents continuation lines that follow a line ending in a backslash, \fB|\fP, \fB&&\fP or \fB||\fP\&.
.IP \(bu 2
\fBpushd\fP only adds a directory to the stack if changing to it was successful (#6947 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6947>).
.IP \(bu 2
A new \fBfish_job_summary\fP function is called whenever a
background job stops or ends, or any job terminates from a signal (#6959 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6959>, #2727 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2727>, #4319 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4319>).
The default behaviour can now be customized by redefining it.
.IP \(bu 2
\fBstatus\fP gained new \fBdirname\fP and \fBbasename\fP convenience subcommands
to get just the directory to the running script or the name of it,
to simplify common tasks such as running \fB(dirname (status filename))\fP (#7076 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7076>, #1818 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1818>).
.IP \(bu 2
Broken pipelines are now handled more smoothly; in particular, bad redirection mid\-pipeline
results in the job continuing to run but with the broken file descriptor replaced with a closed
file descriptor. This allows better error recovery and is more in line with other shells\(aq
behaviour (#7038 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7038>).
.IP \(bu 2
\fBjobs \-\-quiet PID\fP no longer prints \(dqno suitable job\(dq if the job for PID does not exist (eg\ because it has finished) (#6809 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6809>, #6812 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6812>).
.IP \(bu 2
\fBjobs\fP now shows continued child processes correctly (#6818 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6818>)
.IP \(bu 2
\fBdisown\fP should no longer create zombie processes when job control is off, such as in \fBconfig.fish\fP (#7183 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7183>).
.IP \(bu 2
\fBcommand\fP, \fBjobs\fP and \fBtype\fP builtins support \fB\-\-query\fP as the long form of \fB\-q\fP, matching other builtins.
The long form \fB\-\-quiet\fP is deprecated (#7276 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7276>).
.IP \(bu 2
\fBargparse\fP no longer requires a short flag letter for long\-only options (#7585 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7585>)
and only prints a backtrace with invalid options to argparse itself (#6703 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6703>).
.IP \(bu 2
\fBargparse\fP now passes the validation variables (e.g. \fB$_flag_value\fP) as local\-exported variables,
avoiding the need for \fB\-\-no\-scope\-shadowing\fP in validation functions.
.IP \(bu 2
\fBcomplete\fP takes the first argument as the name of the command if the \fB\-\-command\fP/\fB\-c\fP option is not used,
so \fBcomplete git\fP is treated like \fBcomplete \-\-command git\fP,
and it can show the loaded completions for specific commands with \fBcomplete COMMANDNAME\fP (#7321 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7321>).
.IP \(bu 2
\fBset_color \-b\fP (without an argument) no longer prints an error message, matching other invalid invocations of this command (#7154 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7154>).
.IP \(bu 2
\fBexec\fP no longer produces a syntax error when the command cannot be found (#6098 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6098>).
.IP \(bu 2
\fBset \-\-erase\fP and \fBabbr \-\-erase\fP can now erase multiple things in one go, matching \fBfunctions \-\-erase\fP (#7377 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7377>).
.IP \(bu 2
\fBabbr \-\-erase\fP no longer prints errors when used with no arguments or on an unset abbreviation (#7376 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7376>, #7732 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7732>).
.IP \(bu 2
\fBtest \-t\fP, for testing whether file descriptors are connected to a terminal, works for file descriptors 0, 1, and 2 (#4766 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4766>).
It can still return incorrect results in other cases (#1228 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1228>).
.IP \(bu 2
Trying to execute scripts with Windows line endings (CRLF) produces a sensible error (#2783 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2783>).
.IP \(bu 2
Trying to execute commands with arguments that exceed the operating system limit now produces a specific error (#6800 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6800>).
.IP \(bu 2
An \fBalias\fP that delegates to a command with the same name no longer triggers an error about recursive completion (#7389 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7389>).
.IP \(bu 2
\fBmath\fP now has a \fB\-\-base\fP option to output the result in hexadecimal or octal (#7496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7496>) and produces more specific error messages (#7508 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7508>).
.IP \(bu 2
\fBmath\fP learned bitwise functions \fBbitand\fP, \fBbitor\fP and \fBbitxor\fP, used like \fBmath \(dqbitand(0xFE, 5)\(dq\fP (#7281 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7281>).
.IP \(bu 2
\fBmath\fP learned tau for those who don\(aqt like typing \(dq2 * pi\(dq.
.IP \(bu 2
Failed redirections will now set \fB$status\fP (#7540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7540>).
.IP \(bu 2
fish sets exit status in a more consistent manner after errors, including invalid expansions like \fB$foo[\fP\&.
.IP \(bu 2
Using \fBread \-\-silent\fP while fish is in private mode was adding these potentially\-sensitive entries to the history; this has been fixed (#7230 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7230>).
.IP \(bu 2
\fBread\fP can now read interactively from other files, and can be used to read from the terminal via \fBread </dev/tty\fP (if the operating system provides \fB/dev/tty\fP) (#7358 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7358>).
.IP \(bu 2
A new \fBfish_status_to_signal\fP function for transforming exit statuses to signal names has been added (#7597 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7597>, #7595 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7595>).
.IP \(bu 2
The fallback \fBrealpath\fP builtin supports the \fB\-s\fP/\fB\-\-no\-symlinks\fP option, like GNU realpath (#7574 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7574>).
.IP \(bu 2
\fBfunctions\fP and \fBtype\fP now explain when a function was defined via \fBsource\fP instead of just saying \fBDefined in \-\fP\&.
.IP \(bu 2
Significant performance improvements when globbing, appending to variables or in \fBmath\fP\&.
.IP \(bu 2
\fBecho\fP no longer interprets options at the beginning of an argument (eg \fBecho \(dq\-n foo\(dq\fP) (#7614 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7614>).
.IP \(bu 2
fish now finds user configuration even if the \fBHOME\fP environment variable is not set (#7620 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7620>).
.IP \(bu 2
fish no longer crashes when started from a Windows\-style working directory (eg \fBF:\epath\fP) (#7636 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7636>).
.IP \(bu 2
\fBfish \-c\fP now reads the remaining arguments into \fB$argv\fP (#2314 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2314>).
.IP \(bu 2
The \fBpwd\fP command supports the long options \fB\-\-logical\fP and \fB\-\-physical\fP, matching other implementations (#6787 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6787>).
.IP \(bu 2
\fBfish \-\-profile\fP now only starts profiling after fish is ready to execute commands (all configuration is completed). There is a new \fB\-\-profile\-startup\fP option that only profiles the startup and configuration process (#7648 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7648>).
.IP \(bu 2
Builtins return a maximum exit status of 255, rather than potentially overflowing. In particular, this affects \fBexit\fP, \fBreturn\fP, \fBfunctions \-\-query\fP, and \fBset \-\-query\fP (#7698 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7698>, #7702 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7702>).
.IP \(bu 2
It is no longer an error to run builtin with closed stdin. For example \fBcount <&\-\fP now prints 0, instead of failing.
.IP \(bu 2
Blocks, functions, and builtins no longer permit redirecting to file descriptors other than 0 (standard input), 1 (standard output) and 2 (standard error). For example, \fBecho hello >&5\fP is now an error. This prevents corruption of internal state (#3303 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3303>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
fish will now always attempt to become process group leader in interactive mode (#7060 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7060>). This helps avoid hangs in certain circumstances, and allows tmux\(aqs current directory introspection to work (#5699 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5699>).
.IP \(bu 2
The interactive reader now allows ending a line in a logical operators (\fB&&\fP and \fB||\fP) instead of complaining about a missing command. (This was already syntactically valid, but interactive sessions didn\(aqt know about it yet).
.IP \(bu 2
The prompt is reprinted after a background job exits (#1018 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1018>).
.IP \(bu 2
fish no longer inserts a space after a completion ending in \fB\&.\fP, \fB,\fP or \fB\-\fP is accepted, improving completions for tools that provide dynamic completions (#6928 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6928>).
.IP \(bu 2
If a filename is invalid when first pressing \fBtab\fP, but becomes valid, it will be completed properly on the next attempt (#6863 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6863>).
.IP \(bu 2
\fBhelp string match/replace/<subcommand>\fP will show the help for string subcommands (#6786 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6786>).
.IP \(bu 2
\fBfish_key_reader\fP sets the exit status to 0 when used with \fB\-\-help\fP or \fB\-\-version\fP (#6964 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6964>).
.IP \(bu 2
\fBfish_key_reader\fP and \fBfish_indent\fP send output from \fB\-\-version\fP to standard output, matching other fish binaries (#6964 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6964>).
.IP \(bu 2
A new variable \fB$status_generation\fP is incremented only when the previous command produces an exit status (#6815 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6815>). This can be used, for example, to check whether a failure status is a holdover due to a background job, or actually produced by the last run command.
.IP \(bu 2
\fBfish_greeting\fP is now a function that reads a variable of the same name, and defaults to setting it globally.
This removes a universal variable by default and helps with updating the greeting.
However, to disable the greeting it is now necessary to explicitly specify universal scope (\fBset \-U fish_greeting\fP) or to disable it in config.fish (#7265 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7265>).
.IP \(bu 2
Events are properly emitted after a job is cancelled (#2356 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2356>).
.IP \(bu 2
\fBfish_preexec\fP and \fBfish_postexec\fP events are no longer triggered for empty commands (#4829 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4829>, #7085 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7085>).
.IP \(bu 2
Functions triggered by the \fBfish_exit\fP event are correctly run when the terminal is closed or the shell receives SIGHUP (#7014 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7014>).
.IP \(bu 2
The \fBfish_prompt\fP event no longer fires when \fBread\fP is used. If
you need a function to run any time \fBread\fP is invoked by a script,
use the new \fBfish_read\fP event instead (#7039 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7039>).
.IP \(bu 2
A new \fBfish_posterror\fP event is emitted when attempting to execute a command with syntax errors (#6880 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6880>, #6816 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6816>).
.IP \(bu 2
The debugging system has now fully switched from the old numbered level to the new named category system introduced in 3.1. A number of new debugging categories have been added, including \fBconfig\fP, \fBpath\fP, \fBreader\fP and \fBscreen\fP (#6511 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6511>). See the output of \fBfish \-\-print\-debug\-categories\fP for the full list.
.IP \(bu 2
The warning about read\-only filesystems has been moved to a new \(dqwarning\-path\(dq debug category
and can be disabled by setting a debug category of \fB\-warning\-path\fP (#6630 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6630>):
.INDENT 2.0
.INDENT 3.5
.sp
.EX
fish \-\-debug=\-warning\-path
.EE
.UNINDENT
.UNINDENT
.IP \(bu 2
The enabled debug categories are now printed on shell startup (#7007 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7007>).
.IP \(bu 2
The \fB\-o\fP short option to fish, for \fB\-\-debug\-output\fP, works correctly instead of producing an
invalid option error (#7254 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7254>).
.IP \(bu 2
fish\(aqs debugging can now also be enabled via \fBFISH_DEBUG\fP and \fBFISH_DEBUG_OUTPUT\fP environment variables.
This helps with debugging when no commandline options can be passed, like when fish is called in a shebang (#7359 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7359>).
.IP \(bu 2
Abbreviations are now expanded after all command terminators (eg \fB;\fP or \fB|\fP), not just space,
as in fish 2.7.1 and before (#6970 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6970>), and after closing a command substitution (#6658 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6658>).
.IP \(bu 2
The history file is now created with user\-private permissions,
matching other shells (#6926 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6926>). The directory containing the history
file was already private, so there should not have been any private data
revealed.
.IP \(bu 2
The output of \fBtime\fP is now properly aligned in all cases (#6726 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6726>, #6714 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6714>) and no longer depends on locale (#6757 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6757>).
.IP \(bu 2
The command\-not\-found handling has been simplified.
When it can\(aqt find a command, fish now just executes a function called \fBfish_command_not_found\fP
instead of firing an event, making it easier to replace and reason about.
Previously\-defined \fB__fish_command_not_found_handler\fP functions with an appropriate event listener will still work (#7293 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7293>).
.IP \(bu 2
\fBctrl\fP\-\fBc\fP handling has been reimplemented in C++ and is therefore quicker (#5259 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5259>), no longer occasionally prints an \(dqunknown command\(dq error (#7145 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7145>) or overwrites multiline prompts (#3537 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3537>).
.IP \(bu 2
\fBctrl\fP\-\fBc\fP no longer kills background jobs for which job control is
disabled, matching POSIX semantics (#6828 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6828>, #6861 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6861>).
.IP \(bu 2
Autosuggestions work properly after \fBctrl\fP\-\fBc\fP cancels the current command line (#6937 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6937>).
.IP \(bu 2
History search is now case\-insensitive unless the search string contains an uppercase character (#7273 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7273>).
.IP \(bu 2
\fBfish_update_completions\fP gained a new \fB\-\-keep\fP option, which improves speed by skipping completions that already exist (#6775 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6775>, #6796 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6796>).
.IP \(bu 2
Aliases containing an embedded backslash appear properly in the output of \fBalias\fP (#6910 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6910>).
.IP \(bu 2
\fBopen\fP no longer hangs indefinitely on certain systems, as a bug in \fBxdg\-open\fP has been worked around (#7215 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7215>).
.IP \(bu 2
Long command lines no longer add a blank line after execution (#6826 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6826>) and behave better with \fBbackspace\fP (#6951 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6951>).
.IP \(bu 2
\fBfunctions \-t\fP works like the long option \fB\-\-handlers\-type\fP, as documented, instead of producing an error (#6985 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6985>).
.IP \(bu 2
History search now flashes when it found no more results (#7362 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7362>)
.IP \(bu 2
fish now creates the path in the environment variable \fBXDG_RUNTIME_DIR\fP if it does not exist, before using it for runtime data storage (#7335 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7335>).
.IP \(bu 2
\fBset_color \-\-print\-colors\fP now also respects the bold, dim, underline, reverse, italic and background modifiers, to better show their effect (#7314 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7314>).
.IP \(bu 2
The fish Web configuration tool (\fBfish_config\fP) shows prompts correctly on Termux for Android (#7298 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7298>) and detects Windows Services for Linux 2 properly (#7027 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7027>). It no longer shows the \fBhistory\fP variable as it may be too large (one can use the History tab instead). It also starts the browser in another thread, avoiding hangs in some circumstances, especially with Firefox\(aqs Developer Edition (#7158 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7158>). Finally, a bug in the Source Code Pro font may cause browsers to hang, so this font is no longer chosen by default (#7714 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7714>).
.IP \(bu 2
\fBfuncsave\fP gained a new \fB\-\-directory\fP option to specify the location of the saved function (#7041 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7041>).
.IP \(bu 2
\fBhelp\fP works properly on MSYS2 (#7113 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7113>) and only uses \fBcmd.exe\fP if running on WSL (#6797 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6797>).
.IP \(bu 2
Resuming a piped job by its number, like \fBfg %1\fP, works correctly (#7406 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7406>). Resumed jobs show the correct title in the terminal emulator (#7444 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7444>).
.IP \(bu 2
Commands run from key bindings now use the same TTY modes as normal commands (#7483 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7483>).
.IP \(bu 2
Autosuggestions from history are now case\-sensitive (#3978 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3978>).
.IP \(bu 2
\fB$status\fP from completion scripts is no longer passed outside the completion, which keeps the status display in the prompt as the last command\(aqs status (#7555 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7555>).
.IP \(bu 2
Updated localisations for pt_BR (#7480 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7480>).
.IP \(bu 2
\fBfish_trace\fP output now starts with \fB\->\fP (like \fBfish \-\-profile\fP), making the depth more visible (#7538 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7538>).
.IP \(bu 2
Resizing the terminal window no longer produces a corrupted prompt (#6532 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6532>, #7404 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7404>).
.IP \(bu 2
\fBfunctions\fP produces an error rather than crashing on certain invalid arguments (#7515 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7515>).
.IP \(bu 2
A crash in completions with inline variable assignment (eg \fBA= b\fP) has been fixed (#7344 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7344>).
.IP \(bu 2
\fBfish_private_mode\fP may now be changed dynamically using \fBset\fP (#7589 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7589>), and history is kept in memory in private mode (but not stored permanently) (#7590 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7590>).
.IP \(bu 2
Commands with leading spaces may be retrieved from history with up\-arrow until a new command is run, matching zsh\(aqs \fBHIST_IGNORE_SPACE\fP (#1383 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1383>).
.IP \(bu 2
Importing bash history or reporting errors with recursive globs (\fB**\fP) no longer hangs (#7407 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7407>, #7497 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7497>).
.IP \(bu 2
\fBbind\fP now shows \fB\ex7f\fP for the del key instead of a literal DEL character (#7631 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7631>)
.IP \(bu 2
Paths containing variables or tilde expansion are only suggested when they are still valid (#7582 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7582>).
.IP \(bu 2
Syntax highlighting can now color a command as invalid even if executed quickly (#5912 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5912>).
.IP \(bu 2
Redirection targets are no longer highlighted as error if they contain variables which will likely be defined by the current commandline (#6654 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6654>).
.IP \(bu 2
fish is now more resilient against broken terminal modes (#7133 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7133>, #4873 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4873>).
.IP \(bu 2
fish handles being in control of the TTY without owning its own process group better, avoiding some hangs in special configurations (#7388 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7388>).
.IP \(bu 2
Keywords can now be colored differently by setting the \fBfish_color_keyword\fP variable (\fBfish_color_command\fP is used as a fallback) (#7678 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7678>).
.IP \(bu 2
Just like \fBfish_indent\fP, the interactive reader will indent continuation lines that follow a line ending in a backslash, \fB|\fP, \fB&&\fP or \fB||\fP (#7694 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7694>).
.IP \(bu 2
Commands with a trailing escaped space are saved in history correctly (#7661 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7661>).
.IP \(bu 2
\fBfish_prompt\fP no longer mangles Unicode characters in the private\-use range U+F600\-U+F700. (#7723 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7723>).
.IP \(bu 2
The universal variable file, \fBfish_variables\fP, can be made a symbolic link without it being overwritten (#7466 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7466>).
.IP \(bu 2
fish is now more resilient against \fBmktemp\fP failing (#7482 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7482>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
As mentioned above, new special input functions \fBundo\fP (\fBctrl\fP\-\fB_\fP or \fBctrl\fP\-\fBz\fP) and \fBredo\fP (\fBalt\fP\-\fB/\fP) can be used to revert changes to the command line or the pager search field (#6570 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6570>).
.IP \(bu 2
\fBctrl\fP\-\fBz\fP is now available for binding (#7152 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7152>).
.IP \(bu 2
Additionally, using the \fBcancel\fP special input function (bound to \fBescape\fP by default) right after fish picked an unambiguous completion will undo that (#7433 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7433>).
.IP \(bu 2
\fBfish_clipboard_paste\fP (\fBctrl\fP\-\fBv\fP) trims indentation from multiline commands, because fish already indents (#7662 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7662>).
.IP \(bu 2
Vi mode bindings now support \fBdh\fP, \fBdl\fP, \fBc0\fP, \fBcf\fP, \fBct\fP, \fBcF\fP, \fBcT\fP, \fBch\fP, \fBcl\fP, \fBy0\fP, \fBci\fP, \fBca\fP, \fByi\fP, \fBya\fP, \fBdi\fP, \fBda\fP, \fBd;\fP, \fBd,\fP, \fBo\fP, \fBO\fP and Control+left/right keys to navigate by word (#6648 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6648>, #6755 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6755>, #6769 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6769>, #7442 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7442>, #7516 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7516>).
.IP \(bu 2
Vi mode bindings support \fB~\fP (tilde) to toggle the case of the selected character (#6908 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6908>).
.IP \(bu 2
Functions \fBup\-or\-search\fP and \fBdown\-or\-search\fP (\fBup\fP and \fBdown\fP) can cross empty lines, and don\(aqt activate search mode if the search fails, which makes them easier to use to move between lines in some situations.
.IP \(bu 2
If history search fails to find a match, the cursor is no longer moved. This is useful when accidentally starting a history search on a multi\-line commandline.
.IP \(bu 2
The special input function \fBbeginning\-of\-history\fP (\fBpageup\fP) now moves to the oldest search instead of the youngest \- that\(aqs \fBend\-of\-history\fP (\fBpagedown\fP).
.IP \(bu 2
A new special input function \fBforward\-single\-char\fP moves one character to the right, and if an autosuggestion is available, only take a single character from it (#7217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7217>, #4984 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4984>).
.IP \(bu 2
Special input functions can now be joined with \fBor\fP as a modifier (adding to \fBand\fP), though only some commands set an exit status (#7217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7217>). This includes \fBsuppress\-autosuggestion\fP to reflect whether an autosuggestion was suppressed (#1419 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1419>)
.IP \(bu 2
A new function \fB__fish_preview_current_file\fP, bound to \fBalt\fP\-\fBo\fP, opens the
current file at the cursor in a pager (#6838 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6838>, #6855 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6855>).
.IP \(bu 2
\fBedit_command_buffer\fP (\fBalt\fP\-\fBe\fP and \fBalt\fP\-\fBv\fP) passes the cursor position
to the external editor if the editor is recognized (#6138 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6138>, #6954 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6954>).
.IP \(bu 2
\fB__fish_prepend_sudo\fP (\fBalt\fP\-\fBs\fP) now toggles a \fBsudo\fP prefix (#7012 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7012>) and avoids shifting the cursor (#6542 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6542>).
.IP \(bu 2
\fB__fish_prepend_sudo\fP (\fBalt\fP\-\fBs\fP) now uses the previous commandline if the current one is empty,
to simplify rerunning the previous command with \fBsudo\fP (#7079 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7079>).
.IP \(bu 2
\fB__fish_toggle_comment_commandline\fP (\fBalt\fP\-\fB#\fP) now uncomments and presents the last comment
from history if the commandline is empty (#7137 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7137>).
.IP \(bu 2
\fB__fish_whatis_current_token\fP (\fBalt\fP\-\fBw\fP) prints descriptions for functions and builtins (#7191 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7191>, #2083 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2083>).
.IP \(bu 2
The definition of \(dqword\(dq and \(dqbigword\(dq for movements was refined, fixing (eg) vi mode\(aqs behavior with \fBe\fP on the second\-to\-last char, and bigword\(aqs behavior with single\-character words and non\-blank non\-graphical characters (#7353 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7353>, #7354 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7354>, #4025 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4025>, #7328 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7328>, #7325 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7325>)
.IP \(bu 2
fish\(aqs clipboard bindings now also support Windows Subsystem for Linux via PowerShell and clip.exe (#7455 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7455>, #7458 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7458>) and will properly copy newlines in multi\-line commands.
.IP \(bu 2
Using the \fB*\-jump\fP special input functions before typing anything else no longer crashes fish.
.IP \(bu 2
Completing variable overrides (\fBfoo=bar\fP) could replace the entire thing with just the completion in some circumstances. This has been fixed (#7398 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7398>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The default and example prompts print the correct exit status for
commands prefixed with \fBnot\fP (#6566 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6566>).
.IP \(bu 2
git prompts include all untracked files in the repository, not just those in the current
directory (#6086 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6086>).
.IP \(bu 2
The git prompts correctly show stash states (#6876 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6876>, #7136 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7136>) and clean states (#7471 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7471>).
.IP \(bu 2
The Mercurial prompt correctly shows untracked status (#6906 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6906>), and by default only shows the branch for performance reasons.
A new variable \fB$fish_prompt_hg_show_informative_status\fP can be set to enable more information.
.IP \(bu 2
The \fBfish_vcs_prompt\fP passes its arguments to the various VCS prompts that it calls (#7033 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7033>).
.IP \(bu 2
The Subversion prompt was broken in a number of ways in 3.1.0 and has been restored (#6715 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6715>, #7278 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7278>).
.IP \(bu 2
A new helper function \fBfish_is_root_user\fP simplifies checking for superuser privilege (#7031 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7031>, #7123 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7123>).
.IP \(bu 2
New colorschemes \- \fBayu Light\fP, \fBayu Dark\fP and \fBayu Mirage\fP (#7596 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7596>).
.IP \(bu 2
Bugs related to multiline prompts, including repainting (#5860 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5860>) or navigating directory history (#3550 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3550>) leading to graphical glitches have been fixed.
.IP \(bu 2
The \fBnim\fP prompt now handles vi mode better (#6802 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6802>)
.UNINDENT
.SS Improved terminal support
.INDENT 0.0
.IP \(bu 2
A new variable, \fBfish_vi_force_cursor\fP, can be set to force \fBfish_vi_cursor\fP to attempt changing the cursor
shape in vi mode, regardless of terminal (#6968 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6968>). The \fBfish_vi_cursor\fP option \fB\-\-force\-iterm\fP has been deprecated.
.IP \(bu 2
\fBdiff\fP will now colourize output, if supported (#7308 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7308>).
.IP \(bu 2
Autosuggestions appear when the cursor passes the right prompt (#6948 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6948>) or wraps to the next line (#7213 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7213>).
.IP \(bu 2
The cursor shape in Vi mode changes properly in Windows Terminal (#6999 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6999>, #6478 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6478>).
.IP \(bu 2
The spurious warning about terminal size in small terminals has been removed (#6980 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6980>).
.IP \(bu 2
Dynamic titles are now enabled in Alacritty (#7073 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7073>) and emacs\(aq vterm (#7122 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7122>).
.IP \(bu 2
Current working directory updates are enabled in foot (#7099 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7099>) and WezTerm (#7649 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7649>).
.IP \(bu 2
The width computation for certain emoji agrees better with terminals (especially flags). (#7237 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7237>).
.IP \(bu 2
Long command lines are wrapped in all cases, instead of sometimes being put on a new line (#5118 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5118>).
.IP \(bu 2
The pager is properly rendered with long command lines selected (#2557 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2557>).
.IP \(bu 2
Sessions with right prompts can be resized correctly in terminals that handle reflow, like GNOME Terminal (and other VTE\-based terminals), upcoming Konsole releases and Alacritty. This detection can be overridden with the new \fBfish_handle_reflow\fP variable (#7491 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7491>).
.IP \(bu 2
fish now sets terminal modes sooner, which stops output from appearing before the greeting and prompt are ready (#7489 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7489>).
.IP \(bu 2
Better detection of new Konsole versions for true color support and cursor shape changing.
.IP \(bu 2
fish no longer attempts to modify the terminal size via \fBTIOCSWINSZ\fP, improving compatibility with Kitty (#6994 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6994>).
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for
.INDENT 2.0
.IP \(bu 2
\fB7z\fP, \fB7za\fP and \fB7zr\fP (#7220 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7220>)
.IP \(bu 2
\fBalias\fP (#7035 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7035>)
.IP \(bu 2
\fBalternatives\fP (#7616 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7616>)
.IP \(bu 2
\fBapk\fP (#7108 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7108>)
.IP \(bu 2
\fBasciidoctor\fP (#7000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7000>)
.IP \(bu 2
\fBavifdec\fP and \fBavifenc\fP (#7674 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7674>)
.IP \(bu 2
\fBbluetoothctl\fP (#7438 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7438>)
.IP \(bu 2
\fBcjxl\fP and \fBdjxl\fP (#7673 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7673>)
.IP \(bu 2
\fBcmark\fP (#7000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7000>)
.IP \(bu 2
\fBcreate_ap\fP (#7096 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7096>)
.IP \(bu 2
\fBdeno\fP (#7138 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7138>)
.IP \(bu 2
\fBdhclient\fP (#6684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6684>)
.IP \(bu 2
Postgres\-related commands \fBdropdb\fP, \fBcreatedb\fP, \fBpg_restore\fP, \fBpg_dump\fP and
\fBpg_dumpall\fP (#6620 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6620>)
.IP \(bu 2
\fBdotnet\fP (#7558 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7558>)
.IP \(bu 2
\fBdowngrade\fP (#6751 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6751>)
.IP \(bu 2
\fBgapplication\fP, \fBgdbus\fP, \fBgio\fP and \fBgresource\fP (#7300 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7300>)
.IP \(bu 2
\fBgh\fP (#7112 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7112>)
.IP \(bu 2
\fBgitk\fP
.IP \(bu 2
\fBgroups\fP (#6889 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6889>)
.IP \(bu 2
\fBhashcat\fP (#7746 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7746>)
.IP \(bu 2
\fBhikari\fP (#7083 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7083>)
.IP \(bu 2
\fBicdiff\fP (#7503 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7503>)
.IP \(bu 2
\fBimv\fP (#6675 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6675>)
.IP \(bu 2
\fBjohn\fP (#7746 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7746>)
.IP \(bu 2
\fBjulia\fP (#7468 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7468>)
.IP \(bu 2
\fBk3d\fP (#7202 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7202>)
.IP \(bu 2
\fBldapsearch\fP (#7578 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7578>)
.IP \(bu 2
\fBlightdm\fP and \fBdm\-tool\fP (#7624 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7624>)
.IP \(bu 2
\fBlosetup\fP (#7621 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7621>)
.IP \(bu 2
\fBmicro\fP (#7339 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7339>)
.IP \(bu 2
\fBmpc\fP (#7169 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7169>)
.IP \(bu 2
Metasploit\(aqs \fBmsfconsole\fP, \fBmsfdb\fP and \fBmsfvenom\fP (#6930 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6930>)
.IP \(bu 2
\fBmtr\fP (#7638 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7638>)
.IP \(bu 2
\fBmysql\fP (#6819 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6819>)
.IP \(bu 2
\fBncat\fP, \fBnc.openbsd\fP, \fBnc.traditional\fP and \fBnmap\fP (#6873 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6873>)
.IP \(bu 2
\fBopenssl\fP (#6845 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6845>)
.IP \(bu 2
\fBprime\-run\fP (#7241 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7241>)
.IP \(bu 2
\fBps2pdf{12,13,14,wr}\fP (#6673 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6673>)
.IP \(bu 2
\fBpyenv\fP (#6551 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6551>)
.IP \(bu 2
\fBrst2html\fP, \fBrst2html4\fP, \fBrst2html5\fP, \fBrst2latex\fP,
\fBrst2man\fP, \fBrst2odt\fP, \fBrst2pseudoxml\fP, \fBrst2s5\fP,
\fBrst2xetex\fP, \fBrst2xml\fP and \fBrstpep2html\fP (#7019 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7019>)
.IP \(bu 2
\fBspago\fP (#7381 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7381>)
.IP \(bu 2
\fBsphinx\-apidoc\fP, \fBsphinx\-autogen\fP, \fBsphinx\-build\fP and
\fBsphinx\-quickstart\fP (#7000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7000>)
.IP \(bu 2
\fBstrace\fP (#6656 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6656>)
.IP \(bu 2
systemd\(aqs \fBbootctl\fP, \fBcoredumpctl\fP, \fBhostnamectl\fP (#7428 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7428>), \fBhomectl\fP (#7435 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7435>), \fBnetworkctl\fP (#7668 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7668>) and \fBuserdbctl\fP (#7667 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7667>)
.IP \(bu 2
\fBtcpdump\fP (#6690 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6690>)
.IP \(bu 2
\fBtig\fP
.IP \(bu 2
\fBtraceroute\fP and \fBtracepath\fP (#6803 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6803>)
.IP \(bu 2
\fBwindscribe\fP (#6788 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6788>)
.IP \(bu 2
\fBwireshark\fP, \fBtshark\fP, and \fBdumpcap\fP
.IP \(bu 2
\fBxbps\-*\fP (#7239 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7239>)
.IP \(bu 2
\fBxxhsum\fP, \fBxxh32sum\fP, \fBxxh64sum\fP and \fBxxh128sum\fP (#7103 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7103>)
.IP \(bu 2
\fByadm\fP (#7100 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7100>)
.IP \(bu 2
\fBzopfli\fP and \fBzopflipng\fP (#6872 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6872>)
.UNINDENT
.IP \(bu 2
Lots of improvements to completions, including:
.INDENT 2.0
.IP \(bu 2
\fBgit\fP completions can complete the right and left parts of a commit range like \fBfrom..to\fP or \fBleft...right\fP\&.
.IP \(bu 2
Completion scripts for custom Git subcommands like \fBgit\-xyz\fP are now loaded with Git completions. The completions can now be defined directly on the subcommand (using \fBcomplete git\-xyz\fP), and completion for \fBgit xyz\fP will work. (#7075 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7075>, #7652 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7652>, #4358 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4358>)
.IP \(bu 2
\fBmake\fP completions no longer second\-guess make\(aqs file detection, fixing target completion in some cases (#7535 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7535>).
.IP \(bu 2
Command completions now correctly print the description even if the command was fully matched (like in \fBls<TAB>\fP).
.IP \(bu 2
\fBset\fP completions no longer hide variables starting with \fB__\fP, they are sorted last instead.
.UNINDENT
.IP \(bu 2
Improvements to the manual page completion generator (#7086 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7086>, #6879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6879>, #7187 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7187>).
.IP \(bu 2
Significant performance improvements to completion of the available commands (#7153 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7153>), especially on macOS Big Sur where there was a significant regression (#7365 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7365>, #7511 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7511>).
.IP \(bu 2
Suffix completion using \fB__fish_complete_suffix\fP uses the same fuzzy matching logic as normal file completion, and completes any file but sorts files with matching suffix first (#7040 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7040>, #7547 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7547>). Previously, it only completed files with matching suffix.
.UNINDENT
.SS For distributors
.INDENT 0.0
.IP \(bu 2
fish has a new interactive test driver based on pexpect, removing the optional dependency on expect (and adding an optional dependency on pexpect) (#5451 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5451>, #6825 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6825>).
.IP \(bu 2
The CHANGELOG was moved to restructured text, allowing it to be included in the documentation (#7057 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7057>).
.IP \(bu 2
fish handles ncurses installed in a non\-standard prefix better (#6600 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6600>, #7219 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7219>), and uses variadic tparm on NetBSD curses (#6626 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6626>).
.IP \(bu 2
The Web\-based configuration tool no longer uses an obsolete Angular version (#7147 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7147>).
.IP \(bu 2
The fish project has adopted the Contributor Covenant code of conduct (#7151 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7151>).
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The \fBfish_color_match\fP variable is no longer used. (Previously this controlled the color of matching quotes and parens when using \fBread\fP).
.IP \(bu 2
fish 3.2.0 will be the last release in which the redirection to standard error with the \fB^\fP character is enabled.
The \fBstderr\-nocaret\fP feature flag will be changed to \(dqon\(dq in future releases.
.IP \(bu 2
\fBstring\fP is now a reserved word and cannot be used for function names (see above).
.IP \(bu 2
\fBfish_vi_cursor\fP\(aqs option \fB\-\-force\-iterm\fP has been deprecated (see above).
.IP \(bu 2
\fBcommand\fP, \fBjobs\fP and \fBtype\fP long\-form option \fB\-\-quiet\fP is deprecated in favor of \fB\-\-query\fP (see above).
.IP \(bu 2
The \fBfish_command_not_found\fP event is no longer emitted, instead there is a function of that name.
By default it will call a previously\-defined \fB__fish_command_not_found_handler\fP\&. To emit the event manually use \fBemit fish_command_not_found\fP\&.
.IP \(bu 2
The \fBfish_prompt\fP event no longer fires when \fBread\fP is used. If
you need a function to run any time \fBread\fP is invoked by a script,
use the new \fBfish_read\fP event instead (#7039 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7039>).
.IP \(bu 2
To disable the greeting message permanently it is no longer enough to just run \fBset fish_greeting\fP interactively as it is
no longer implicitly a universal variable. Use \fBset \-U fish_greeting\fP or disable it in config.fish with \fBset \-g fish_greeting\fP\&.
.IP \(bu 2
The long\-deprecated and non\-functional \fB\-m\fP/\fB\-\-read\-mode\fP options to \fBread\fP were removed in 3.1b1. Using the short form, or a never\-implemented \fB\-B\fP option, no longer crashes fish (#7659 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7659>).
.IP \(bu 2
With the addition of new categories for debug options, the old numbered debugging levels have been removed.
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
fish source tarballs are now distributed using the XZ compression
method (#5460 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5460>).
.IP \(bu 2
The fish source tarball contains an example FreeDesktop entry and icon.
.IP \(bu 2
The CMake variable \fBMAC_CODESIGN_ID\fP can now be set to \(dqoff\(dq to disable code\-signing (#6952 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6952>, #6792 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6792>).
.IP \(bu 2
Building on on macOS earlier than 10.13.6 succeeds, instead of failing on code\-signing (#6791 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6791>).
.IP \(bu 2
The pkg\-config file now uses variables to ensure paths used are portable across prefixes.
.IP \(bu 2
The default values for the \fBextra_completionsdir\fP, \fBextra_functionsdir\fP
and \fBextra_confdir\fP options now use the installation prefix rather than \fB/usr/local\fP (#6778 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6778>).
.IP \(bu 2
A new CMake variable \fBFISH_USE_SYSTEM_PCRE2\fP controls whether fish
builds with the system\-installed PCRE2, or the version it bundles. By
default it prefers the system library if available, unless Mac
codesigning is enabled (#6952 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6952>).
.IP \(bu 2
Running the full interactive test suite now requires Python 3.5+ and the pexpect package (#6825 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6825>); the expect package is no longer required.
.IP \(bu 2
Support for Python 2 in fish\(aqs tools (\fBfish_config\fP and the manual page completion generator) is no longer guaranteed. Please use Python 3.5 or later (#6537 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6537>).
.IP \(bu 2
The Web\-based configuration tool is compatible with Python 3.10  (#7600 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7600>) and no longer requires Python\(aqs distutils package (#7514 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:7514>).
.IP \(bu 2
fish 3.2 is the last release to support Red Hat Enterprise Linux & CentOS version 6.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.1.2 (released April 29, 2020)
.sp
This release of fish fixes a major issue discovered in fish 3.1.1:
.INDENT 0.0
.IP \(bu 2
Commands such as \fBfzf\fP and \fBenhancd\fP, when used with \fBeval\fP,
would hang. \fBeval\fP buffered output too aggressively, which has been
fixed (#6955 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6955>).
.UNINDENT
.sp
If you are upgrading from version 3.0.0 or before, please also review
the release notes for 3.1.1, 3.1.0 and 3.1b1 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.1.1 (released April 27, 2020)
.sp
This release of fish fixes a number of major issues discovered in fish
3.1.0.
.INDENT 0.0
.IP \(bu 2
Commands which involve \fB\&. ( ... | psub)\fP now work correctly, as a
bug in the \fBfunction \-\-on\-job\-exit\fP option has been fixed (#6613 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6613>).
.IP \(bu 2
Conflicts between upstream packages for ripgrep and bat, and the fish
packages, have been resolved (#5822 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5822>).
.IP \(bu 2
Starting fish in a directory without read access, such as via \fBsu\fP,
no longer crashes (#6597 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6597>).
.IP \(bu 2
Glob ordering changes which were introduced in 3.1.0 have been
reverted, returning the order of globs to the previous state (#6593 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6593>).
.IP \(bu 2
Redirections using the deprecated caret syntax to a file descriptor
(eg \fB^&2\fP) work correctly (#6591 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6591>).
.IP \(bu 2
Redirections that append to a file descriptor (eg \fB2>>&1\fP) work
correctly (#6614 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6614>).
.IP \(bu 2
Building fish on macOS (#6602 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6602>) or with new versions of GCC (#6604 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6604>,
#6609 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6609>) is now successful.
.IP \(bu 2
\fBtime\fP is now correctly listed in the output of \fBbuiltin \-n\fP, and
\fBtime \-\-help\fP works correctly (#6598 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6598>).
.IP \(bu 2
Exported universal variables now update properly (#6612 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6612>).
.IP \(bu 2
\fBstatus current\-command\fP gives the expected output when used with
an environment override \- that is, \fBF=B status current\-command\fP
returns \fBstatus\fP instead of \fBF=B\fP (#6635 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6635>).
.IP \(bu 2
\fBtest\fP no longer crashes when used with “\fBnan\fP” or “\fBinf\fP”
arguments, erroring out instead (#6655 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6655>).
.IP \(bu 2
Copying from the end of the command line no longer crashes fish
(#6680 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6680>).
.IP \(bu 2
\fBread\fP no longer removes multiple separators when splitting a
variable into a list, restoring the previous behaviour from fish 3.0
and before (#6650 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6650>).
.IP \(bu 2
Functions using \fB\-\-on\-job\-exit\fP and \fB\-\-on\-process\-exit\fP work
reliably again (#6679 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6679>).
.IP \(bu 2
Functions using \fB\-\-on\-signal INT\fP work reliably in interactive
sessions, as they did in fish 2.7 and before (#6649 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6649>). These handlers
have never worked in non\-interactive sessions, and making them work
is an ongoing process.
.IP \(bu 2
Functions using \fB\-\-on\-variable\fP work reliably with variables which
are set implicitly (rather than with \fBset\fP), such as
“\fBfish_bind_mode\fP” and “\fBPWD\fP” (#6653 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6653>).
.IP \(bu 2
256 colors are properly enabled under certain conditions that were
incorrectly detected in fish 3.1.0 (\fB$TERM\fP begins with xterm, does
not include “\fB256color\fP”, and \fB$TERM_PROGRAM\fP is not set)
(#6701 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6701>).
.IP \(bu 2
The Mercurial (\fBhg\fP) prompt no longer produces an error when the
current working directory is removed (#6699 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6699>). Also, for performance
reasons it shows only basic information by default; to restore the
detailed status, set \fB$fish_prompt_hg_show_informative_status\fP\&.
.IP \(bu 2
The VCS prompt, \fBfish_vcs_prompt\fP, no longer displays Subversion
(\fBsvn\fP) status by default, due to the potential slowness of this
operation (#6681 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6681>).
.IP \(bu 2
Pasting of commands has been sped up (#6713 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6713>).
.IP \(bu 2
Using extended Unicode characters, such as emoji, in a non\-Unicode
capable locale (such as the \fBC\fP or \fBPOSIX\fP locale) no longer
renders all output blank (#6736 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6736>).
.IP \(bu 2
\fBhelp\fP prefers to use \fBxdg\-open\fP, avoiding the use of \fBopen\fP on
Debian systems where this command is actually \fBopenvt\fP (#6739 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6739>).
.IP \(bu 2
Command lines starting with a space, which are not saved in history,
now do not get autosuggestions. This fixes an issue with Midnight
Commander integration (#6763 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6763>), but may be changed in a future
version.
.IP \(bu 2
Copying to the clipboard no longer inserts a newline at the end of
the content, matching fish 2.7 and earlier (#6927 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6927>).
.IP \(bu 2
\fBfzf\fP in complex pipes no longer hangs. More generally, code run as
part of command substitutions or \fBeval\fP will no longer have
separate process groups. (#6624 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6624>, #6806 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6806>).
.UNINDENT
.sp
This release also includes:
.INDENT 0.0
.IP \(bu 2
several changes to improve macOS compatibility with code signing
and notarization;
.IP \(bu 2
several improvements to completions; and
.IP \(bu 2
several content and formatting improvements to the documentation.
.UNINDENT
.sp
If you are upgrading from version 3.0.0 or before, please also review
the release notes for 3.1.0 and 3.1b1 (included below).
.SS Errata for fish 3.1
.sp
A new builtin, \fBtime\fP, was introduced in the fish 3.1 releases. This
builtin is a reserved word (like \fBtest\fP, \fBfunction\fP, and others)
because of the way it is implemented, and functions can no longer be
named \fBtime\fP\&. This was not clear in the fish 3.1b1 changelog.

.sp
.ce
----

.ce 0
.sp
.SS fish 3.1.0 (released February 12, 2020)
.sp
Compared to the beta release of fish 3.1b1, fish version 3.1.0:
.INDENT 0.0
.IP \(bu 2
Fixes a regression where spaces after a brace were removed despite
brace expansion not occurring (#6564 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6564>).
.IP \(bu 2
Fixes a number of problems in compiling and testing on Cygwin
(#6549 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6549>) and Solaris\-derived systems such as Illumos (#6553 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6553>, #6554 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6554>,
#6555 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6555>, #6556 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6556>, and #6558 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6558>).
.IP \(bu 2
Fixes the process for building macOS packages.
.IP \(bu 2
Fixes a regression where excessive error messages are printed if
Unicode characters are emitted in non\-Unicode\-capable locales
(#6584 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6584>).
.IP \(bu 2
Contains some improvements to the documentation and a small number
of completions.
.UNINDENT
.sp
If you are upgrading from version 3.0.0 or before, please also review
the release notes for 3.1b1 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.1b1 (released January 26, 2020)
.SS Notable improvements and fixes
.INDENT 0.0
.IP \(bu 2
A new \fB$pipestatus\fP variable contains a list of exit statuses of
the previous job, for each of the separate commands in a pipeline
(#5632 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5632>).
.IP \(bu 2
fish no longer buffers pipes to the last function in a pipeline,
improving many cases where pipes appeared to block or hang (#1396 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1396>).
.IP \(bu 2
An overhaul of error messages for builtin commands, including a
removal of the overwhelming usage summary, more readable stack traces
(#3404 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3404>, #5434 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5434>), and stack traces for \fBtest\fP (aka \fB[\fP) (#5771 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5771>).
.IP \(bu 2
fish’s debugging arguments have been significantly improved. The
\fB\-\-debug\-level\fP option has been removed, and a new \fB\-\-debug\fP
option replaces it. This option accepts various categories, which may
be listed via \fBfish \-\-print\-debug\-categories\fP (#5879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5879>). A new
\fB\-\-debug\-output\fP option allows for redirection of debug output.
.IP \(bu 2
\fBstring\fP has a new \fBcollect\fP subcommand for use in command
substitutions, producing a single output instead of splitting on new
lines (similar to \fB\(dq$(cmd)\(dq\fP in other shells) (#159 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:159>).
.IP \(bu 2
The fish manual, tutorial and FAQ are now available in \fBman\fP format
as \fBfish\-doc\fP, \fBfish\-tutorial\fP and \fBfish\-faq\fP respectively
(#5521 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5521>).
.IP \(bu 2
Like other shells, \fBcd\fP now always looks for its argument in the
current directory as a last resort, even if the \fBCDPATH\fP variable
does not include it or “.” (#4484 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4484>).
.IP \(bu 2
fish now correctly handles \fBCDPATH\fP entries that start with \fB\&..\fP
(#6220 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6220>) or contain \fB\&./\fP (#5887 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5887>).
.IP \(bu 2
The \fBfish_trace\fP variable may be set to trace execution (#3427 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3427>).
This performs a similar role as \fBset \-x\fP in other shells.
.IP \(bu 2
fish uses the temporary directory determined by the system, rather
than relying on \fB/tmp\fP (#3845 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3845>).
.IP \(bu 2
The fish Web configuration tool (\fBfish_config\fP) prints a list of
commands it is executing, to help understanding and debugging
(#5584 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5584>).
.IP \(bu 2
Major performance improvements when pasting (#5866 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5866>), executing lots
of commands (#5905 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5905>), importing history from bash (#6295 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6295>), and when
completing variables that might match \fB$history\fP (#6288 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6288>).
.UNINDENT
.SS Syntax changes and new commands
.INDENT 0.0
.IP \(bu 2
A new builtin command, \fBtime\fP, which allows timing of fish
functions and builtins as well as external commands (#117 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:117>).
.IP \(bu 2
Brace expansion now only takes place if the braces include a “,” or a
variable expansion, meaning common commands such as
\fBgit reset HEAD@{0}\fP do not require escaping (#5869 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5869>).
.IP \(bu 2
New redirections \fB&>\fP and \fB&|\fP may be used to redirect or pipe
stdout, and also redirect stderr to stdout (#6192 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6192>).
.IP \(bu 2
\fBswitch\fP now allows arguments that expand to nothing, like empty
variables (#5677 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5677>).
.IP \(bu 2
The \fBVAR=val cmd\fP syntax can now be used to run a command in a
modified environment (#6287 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6287>).
.IP \(bu 2
\fBand\fP is no longer recognised as a command, so that nonsensical
constructs like \fBand and and\fP produce a syntax error (#6089 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6089>).
.IP \(bu 2
\fBmath\fP‘s exponent operator,’\fB^\fP‘, was previously
left\-associative, but now uses the more commonly\-used
right\-associative behaviour (#6280 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6280>). This means that
\fBmath \(aq3^0.5^2\(aq\fP was previously calculated as’(3\s-2\u0.5)\d\s02’,
but is now calculated as ‘3\s-2\u(0.5\d\s02)’.
.IP \(bu 2
In fish 3.0, the variable used with \fBfor\fP loops inside command
substitutions could leak into enclosing scopes; this was an
inadvertent behaviour change and has been reverted (#6480 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6480>).
.UNINDENT
.SS Scripting improvements
.INDENT 0.0
.IP \(bu 2
\fBstring split0\fP now returns 0 if it split something (#5701 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5701>).
.IP \(bu 2
In the interest of consistency, \fBbuiltin \-q\fP and \fBcommand \-q\fP can
now be used to query if a builtin or command exists (#5631 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5631>).
.IP \(bu 2
\fBmath\fP now accepts \fB\-\-scale=max\fP for the maximum scale (#5579 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5579>).
.IP \(bu 2
\fBbuiltin $var\fP now works correctly, allowing a variable as the
builtin name (#5639 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5639>).
.IP \(bu 2
\fBcd\fP understands the \fB\-\-\fP argument to make it possible to change
to directories starting with a hyphen (#6071 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6071>).
.IP \(bu 2
\fBcomplete \-\-do\-complete\fP now also does fuzzy matches (#5467 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5467>).
.IP \(bu 2
\fBcomplete \-\-do\-complete\fP can be used inside completions, allowing
limited recursion (#3474 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3474>).
.IP \(bu 2
\fBcount\fP now also counts lines fed on standard input (#5744 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5744>).
.IP \(bu 2
\fBeval\fP produces an exit status of 0 when given no arguments, like
other shells (#5692 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5692>).
.IP \(bu 2
\fBprintf\fP prints what it can when input hasn’t been fully converted
to a number, but still prints an error (#5532 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5532>).
.IP \(bu 2
\fBcomplete \-C foo\fP now works as expected, rather than requiring
\fBcomplete \-Cfoo\fP\&.
.IP \(bu 2
\fBcomplete\fP has a new \fB\-\-force\-files\fP option, to re\-enable file
completions. This allows \fBsudo \-E\fP and \fBpacman \-Qo\fP to complete
correctly (#5646 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5646>).
.IP \(bu 2
\fBargparse\fP now defaults to showing the current function name
(instead of \fBargparse\fP) in its errors, making \fB\-\-name\fP often
superfluous (#5835 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5835>).
.IP \(bu 2
\fBargparse\fP has a new \fB\-\-ignore\-unknown\fP option to keep
unrecognized options, allowing multiple argparse passes to parse
options (#5367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5367>).
.IP \(bu 2
\fBargparse\fP correctly handles flag value validation of options that
only have short names (#5864 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5864>).
.IP \(bu 2
\fBread \-S\fP (short option of \fB\-\-shell\fP) is recognised correctly
(#5660 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5660>).
.IP \(bu 2
\fBread\fP understands \fB\-\-list\fP, which acts like \fB\-\-array\fP in
reading all arguments into a list inside a single variable, but is
better named (#5846 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5846>).
.IP \(bu 2
\fBread\fP has a new option, \fB\-\-tokenize\fP, which splits a string into
variables according to the shell’s tokenization rules, considering
quoting, escaping, and so on (#3823 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3823>).
.IP \(bu 2
\fBread\fP interacts more correctly with the deprecated \fB$IFS\fP
variable, in particular removing multiple separators when splitting a
variable into a list (#6406 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6406>), matching other shells.
.IP \(bu 2
\fBfish_indent\fP now handles semicolons better, including leaving them
in place for \fB; and\fP and \fB; or\fP instead of breaking the line
(#5859 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5859>).
.IP \(bu 2
\fBfish_indent \-\-write\fP now supports multiple file arguments,
indenting them in turn.
.IP \(bu 2
The default read limit has been increased to 100MiB (#5267 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5267>).
.IP \(bu 2
\fBmath\fP now also understands \fBx\fP for multiplication, provided it
is followed by whitespace (#5906 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5906>).
.IP \(bu 2
\fBmath\fP reports the right error when incorrect syntax is used inside
parentheses (#6063 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6063>), and warns when unsupported logical operations
are used (#6096 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6096>).
.IP \(bu 2
\fBfunctions \-\-erase\fP now also prevents fish from autoloading a
function for the first time (#5951 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5951>).
.IP \(bu 2
\fBjobs \-\-last\fP returns 0 to indicate success when a job is found
(#6104 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6104>).
.IP \(bu 2
\fBcommandline \-p\fP and \fBcommandline \-j\fP now split on \fB&&\fP and
\fB||\fP in addition to \fB;\fP and \fB&\fP (#6214 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6214>).
.IP \(bu 2
A bug where \fBstring split\fP would drop empty strings if the output
was only empty strings has been fixed (#5987 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5987>).
.IP \(bu 2
\fBeval\fP no long creates a new local variable scope, but affects
variables in the scope it is called from (#4443 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4443>). \fBsource\fP still
creates a new local scope.
.IP \(bu 2
\fBabbr\fP has a new \fB\-\-query\fP option to check for the existence of
an abbreviation.
.IP \(bu 2
Local values for \fBfish_complete_path\fP and \fBfish_function_path\fP
are now ignored; only their global values are respected.
.IP \(bu 2
Syntax error reports now display a marker in the correct position
(#5812 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5812>).
.IP \(bu 2
Empty universal variables may now be exported (#5992 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5992>).
.IP \(bu 2
Exported universal variables are no longer imported into the global
scope, preventing shadowing. This makes it easier to change such
variables for all fish sessions and avoids breakage when the value is
a list of multiple elements (#5258 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5258>).
.IP \(bu 2
A bug where \fBfor\fP could use invalid variable names has been fixed
(#5800 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5800>).
.IP \(bu 2
A bug where local variables would not be exported to functions has
been fixed (#6153 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6153>).
.IP \(bu 2
The null command (\fB:\fP) now always exits successfully, rather than
passing through the previous exit status (#6022 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6022>).
.IP \(bu 2
The output of \fBfunctions FUNCTION\fP matches the declaration of the
function, correctly including comments or blank lines (#5285 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5285>), and
correctly includes any \fB\-\-wraps\fP flags (#1625 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1625>).
.IP \(bu 2
\fBtype\fP supports a new option, \fB\-\-short\fP, which suppress function
expansion (#6403 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6403>).
.IP \(bu 2
\fBtype \-\-path\fP with a function argument will now output the path to
the file containing the definition of that function, if it exists.
.IP \(bu 2
\fBtype \-\-force\-path\fP with an argument that cannot be found now
correctly outputs nothing, as documented (#6411 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6411>).
.IP \(bu 2
The \fB$hostname\fP variable is no longer truncated to 32 characters
(#5758 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5758>).
.IP \(bu 2
Line numbers in function backtraces are calculated correctly (#6350 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6350>).
.IP \(bu 2
A new \fBfish_cancel\fP event is emitted when the command line is
cancelled, which is useful for terminal integration (#5973 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5973>).
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
New Base16 color options are available through the Web\-based
configuration (#6504 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6504>).
.IP \(bu 2
fish only parses \fB/etc/paths\fP on macOS in login shells, matching
the bash implementation (#5637 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5637>) and avoiding changes to path ordering
in child shells (#5456 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5456>). It now ignores blank lines like the bash
implementation (#5809 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5809>).
.IP \(bu 2
The locale is now reloaded when the \fBLOCPATH\fP variable is changed
(#5815 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5815>).
.IP \(bu 2
\fBread\fP no longer keeps a history, making it suitable for operations
that shouldn’t end up there, like password entry (#5904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5904>).
.IP \(bu 2
\fBdirh\fP outputs its stack in the correct order (#5477 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5477>), and behaves
as documented when universal variables are used for its stack
(#5797 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5797>).
.IP \(bu 2
\fBfunced\fP and the edit\-commandline\-in\-buffer bindings did not work
in fish 3.0 when the \fB$EDITOR\fP variable contained spaces; this has
been corrected (#5625 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5625>).
.IP \(bu 2
Builtins now pipe their help output to a pager automatically (#6227 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6227>).
.IP \(bu 2
\fBset_color\fP now colors the \fB\-\-print\-colors\fP output in the
matching colors if it is going to a terminal.
.IP \(bu 2
fish now underlines every valid entered path instead of just the last
one (#5872 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5872>).
.IP \(bu 2
When syntax highlighting a string with an unclosed quote, only the
quote itself will be shown as an error, instead of the whole
argument.
.IP \(bu 2
Syntax highlighting works correctly with variables as commands
(#5658 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5658>) and redirections to close file descriptors (#6092 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6092>).
.IP \(bu 2
\fBhelp\fP works properly on Windows Subsystem for Linux (#5759 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5759>, #6338 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6338>).
.IP \(bu 2
A bug where \fBdisown\fP could crash the shell has been fixed (#5720 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5720>).
.IP \(bu 2
fish will not autosuggest files ending with \fB~\fP unless there are no
other candidates, as these are generally backup files (#985 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:985>).
.IP \(bu 2
Escape in the pager works correctly (#5818 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5818>).
.IP \(bu 2
Key bindings that call \fBfg\fP no longer leave the terminal in a
broken state (#2114 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2114>).
.IP \(bu 2
Brackets (#5831 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5831>) and filenames containing \fB$\fP (#6060 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6060>) are completed
with appropriate escaping.
.IP \(bu 2
The output of \fBcomplete\fP and \fBfunctions\fP is now colorized in
interactive terminals.
.IP \(bu 2
The Web\-based configuration handles aliases that include single
quotes correctly (#6120 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6120>), and launches correctly under Termux (#6248 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6248>)
and OpenBSD (#6522 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6522>).
.IP \(bu 2
\fBfunction\fP now correctly validates parameters for
\fB\-\-argument\-names\fP as valid variable names (#6147 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6147>) and correctly
parses options following \fB\-\-argument\-names\fP, as in
“\fB\-\-argument\-names foo \-\-description bar\fP” (#6186 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6186>).
.IP \(bu 2
History newly imported from bash includes command lines using \fB&&\fP
or \fB||\fP\&.
.IP \(bu 2
The automatic generation of completions from manual pages is better
described in job and process listings, and no longer produces a
warning when exiting fish (#6269 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6269>).
.IP \(bu 2
In private mode, setting \fB$fish_greeting\fP to an empty string before
starting the private session will prevent the warning about history
not being saved from being printed (#6299 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6299>).
.IP \(bu 2
In the interactive editor, a line break (Enter) inside unclosed
brackets will insert a new line, rather than executing the command
and producing an error (#6316 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6316>).
.IP \(bu 2
Ctrl\-C always repaints the prompt (#6394 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6394>).
.IP \(bu 2
When run interactively from another program (such as Python), fish
will correctly start a new process group, like other shells (#5909 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5909>).
.IP \(bu 2
Job identifiers (for example, for background jobs) are assigned more
logically (#6053 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6053>).
.IP \(bu 2
A bug where history would appear truncated if an empty command was
executed was fixed (#6032 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6032>).
.UNINDENT
.SS New or improved bindings
.INDENT 0.0
.IP \(bu 2
Pasting strips leading spaces to avoid pasted commands being omitted
from the history (#4327 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4327>).
.IP \(bu 2
Shift\-Left and Shift\-Right now default to moving backwards and
forwards by one bigword (words separated by whitespace) (#1505 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1505>).
.IP \(bu 2
The default escape delay (to differentiate between the escape key and
an alt\-combination) has been reduced to 30ms, down from 300ms for the
default mode and 100ms for Vi mode (#3904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3904>).
.IP \(bu 2
The \fBforward\-bigword\fP binding now interacts correctly with
autosuggestions (#5336 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5336>).
.IP \(bu 2
The \fBfish_clipboard_*\fP functions support Wayland by using
wl\-clipboard \%<https://\:github\:.com/\:bugaevc/\:wl-clipboard>
(#5450 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5450>).
.IP \(bu 2
The \fBnextd\fP and \fBprevd\fP functions no longer print “Hit end of
history”, instead using a bell. They correctly store working
directories containing symbolic links (#6395 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6395>).
.IP \(bu 2
If a \fBfish_mode_prompt\fP function exists, Vi mode will only execute
it on mode\-switch instead of the entire prompt. This should make it
much more responsive with slow prompts (#5783 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5783>).
.IP \(bu 2
The path\-component bindings (like Ctrl\-w) now also stop at “:” and
“@”, because those are used to denote user and host in commands such
as \fBssh\fP (#5841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5841>).
.IP \(bu 2
The NULL character can now be bound via \fBbind \-k nul\fP\&. Terminals
often generate this character via control\-space. (#3189 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3189>).
.IP \(bu 2
A new readline command \fBexpand\-abbr\fP can be used to trigger
abbreviation expansion (#5762 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5762>).
.IP \(bu 2
A new readline command, \fBdelete\-or\-exit\fP, removes a character to
the right of the cursor or exits the shell if the command line is
empty (moving this functionality out of the \fBdelete\-or\-exit\fP
function).
.IP \(bu 2
The \fBself\-insert\fP readline command will now insert the binding
sequence, if not empty.
.IP \(bu 2
A new binding to prepend \fBsudo\fP, bound to Alt\-S by default (#6140 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6140>).
.IP \(bu 2
The Alt\-W binding to describe a command should now work better with
multiline prompts (#6110 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6110>)
.IP \(bu 2
The Alt\-H binding to open a command’s man page now tries to ignore
\fBsudo\fP (#6122 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6122>).
.IP \(bu 2
A new pair of bind functions, \fBhistory\-prefix\-search\-backward\fP (and
\fBforward\fP), was introduced (#6143 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6143>).
.IP \(bu 2
Vi mode now supports R to enter replace mode (#6342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6342>), and \fBd0\fP to
delete the current line (#6292 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6292>).
.IP \(bu 2
In Vi mode, hitting Enter in replace\-one mode no longer erases the
prompt (#6298 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6298>).
.IP \(bu 2
Selections in Vi mode are inclusive, matching the actual behaviour of
Vi (#5770 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5770>).
.UNINDENT
.SS Improved prompts
.INDENT 0.0
.IP \(bu 2
The Git prompt in informative mode now shows the number of stashes if
enabled.
.IP \(bu 2
The Git prompt now has an option
(\fB$__fish_git_prompt_use_informative_chars\fP) to use the (more
modern) informative characters without enabling informative mode.
.IP \(bu 2
The default prompt now also features VCS integration and will color
the host if running via SSH (#6375 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6375>).
.IP \(bu 2
The default and example prompts print the pipe status if an earlier
command in the pipe fails.
.IP \(bu 2
The default and example prompts try to resolve exit statuses to
signal names when appropriate.
.UNINDENT
.SS Improved terminal output
.INDENT 0.0
.IP \(bu 2
New \fBfish_pager_color_\fP options have been added to control more
elements of the pager’s colors (#5524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5524>).
.IP \(bu 2
Better detection and support for using fish from various system
consoles, where limited colors and special characters are supported
(#5552 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5552>).
.IP \(bu 2
fish now tries to guess if the system supports Unicode 9 (and
displays emoji as wide), eliminating the need to set
\fB$fish_emoji_width\fP in most cases (#5722 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5722>).
.IP \(bu 2
Improvements to the display of wide characters, particularly Korean
characters and emoji (#5583 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5583>, #5729 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5729>).
.IP \(bu 2
The Vi mode cursor is correctly redrawn when regaining focus under
terminals that report focus (eg tmux) (#4788 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4788>).
.IP \(bu 2
Variables that control background colors (such as
\fBfish_pager_color_search_match\fP) can now use \fB\-\-reverse\fP\&.
.UNINDENT
.SS Completions
.INDENT 0.0
.IP \(bu 2
Added completions for
.INDENT 2.0
.IP \(bu 2
\fBaws\fP
.IP \(bu 2
\fBbat\fP (#6052 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6052>)
.IP \(bu 2
\fBbosh\fP (#5700 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5700>)
.IP \(bu 2
\fBbtrfs\fP
.IP \(bu 2
\fBcamcontrol\fP
.IP \(bu 2
\fBcf\fP (#5700 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5700>)
.IP \(bu 2
\fBchronyc\fP (#6496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6496>)
.IP \(bu 2
\fBcode\fP (#6205 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6205>)
.IP \(bu 2
\fBcryptsetup\fP (#6488 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6488>)
.IP \(bu 2
\fBcsc\fP and \fBcsi\fP (#6016 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6016>)
.IP \(bu 2
\fBcwebp\fP (#6034 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6034>)
.IP \(bu 2
\fBcygpath\fP and \fBcygstart\fP (#6239 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6239>)
.IP \(bu 2
\fBepkginfo\fP (#5829 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5829>)
.IP \(bu 2
\fBffmpeg\fP, \fBffplay\fP, and \fBffprobe\fP (#5922 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5922>)
.IP \(bu 2
\fBfsharpc\fP and \fBfsharpi\fP (#6016 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6016>)
.IP \(bu 2
\fBfzf\fP (#6178 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6178>)
.IP \(bu 2
\fBg++\fP (#6217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6217>)
.IP \(bu 2
\fBgpg1\fP (#6139 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6139>)
.IP \(bu 2
\fBgpg2\fP (#6062 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6062>)
.IP \(bu 2
\fBgrub\-mkrescue\fP (#6182 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6182>)
.IP \(bu 2
\fBhledger\fP (#6043 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6043>)
.IP \(bu 2
\fBhwinfo\fP (#6496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6496>)
.IP \(bu 2
\fBirb\fP (#6260 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6260>)
.IP \(bu 2
\fBiw\fP (#6232 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6232>)
.IP \(bu 2
\fBkak\fP
.IP \(bu 2
\fBkeepassxc\-cli\fP (#6505 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6505>)
.IP \(bu 2
\fBkeybase\fP (#6410 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6410>)
.IP \(bu 2
\fBloginctl\fP (#6501 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6501>)
.IP \(bu 2
\fBlz4\fP, \fBlz4c\fP and \fBlz4cat\fP (#6364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6364>)
.IP \(bu 2
\fBmariner\fP (#5718 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5718>)
.IP \(bu 2
\fBnethack\fP (#6240 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6240>)
.IP \(bu 2
\fBpatool\fP (#6083 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6083>)
.IP \(bu 2
\fBphpunit\fP (#6197 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6197>)
.IP \(bu 2
\fBplutil\fP (#6301 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6301>)
.IP \(bu 2
\fBpzstd\fP (#6364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6364>)
.IP \(bu 2
\fBqubes\-gpg\-client\fP (#6067 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6067>)
.IP \(bu 2
\fBresolvectl\fP (#6501 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6501>)
.IP \(bu 2
\fBrg\fP
.IP \(bu 2
\fBrustup\fP
.IP \(bu 2
\fBsfdx\fP (#6149 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6149>)
.IP \(bu 2
\fBspeedtest\fP and \fBspeedtest\-cli\fP (#5840 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5840>)
.IP \(bu 2
\fBsrc\fP (#6026 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6026>)
.IP \(bu 2
\fBtokei\fP (#6085 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6085>)
.IP \(bu 2
\fBtsc\fP (#6016 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6016>)
.IP \(bu 2
\fBunlz4\fP (#6364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6364>)
.IP \(bu 2
\fBunzstd\fP (#6364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6364>)
.IP \(bu 2
\fBvbc\fP (#6016 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6016>)
.IP \(bu 2
\fBzpaq\fP (#6245 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6245>)
.IP \(bu 2
\fBzstd\fP, \fBzstdcat\fP, \fBzstdgrep\fP, \fBzstdless\fP and \fBzstdmt\fP
(#6364 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6364>)
.UNINDENT
.IP \(bu 2
Lots of improvements to completions.
.IP \(bu 2
Selecting short options which also have a long name from the
completion pager is possible (#5634 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5634>).
.IP \(bu 2
Tab completion will no longer add trailing spaces if they already
exist (#6107 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6107>).
.IP \(bu 2
Completion of subcommands to builtins like \fBand\fP or \fBnot\fP now
works correctly (#6249 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6249>).
.IP \(bu 2
Completion of arguments to short options works correctly when
multiple short options are used together (#332 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:332>).
.IP \(bu 2
Activating completion in the middle of an invalid completion does not
move the cursor any more, making it easier to fix a mistake (#4124 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4124>).
.IP \(bu 2
Completion in empty commandlines now lists all available commands.
.IP \(bu 2
Functions listed as completions could previously leak parts of the
function as other completions; this has been fixed.
.UNINDENT
.SS Deprecations and removed features
.INDENT 0.0
.IP \(bu 2
The vcs\-prompt functions have been promoted to names without
double\-underscore, so __fish_git_prompt is now fish_git_prompt,
__fish_vcs_prompt is now fish_vcs_prompt, __fish_hg_prompt is now
fish_hg_prompt and __fish_svn_prompt is now fish_svn_prompt. Shims
at the old names have been added, and the variables have kept their
old names (#5586 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5586>).
.IP \(bu 2
\fBstring replace\fP has an additional round of escaping in the
replacement expression, so escaping backslashes requires many escapes
(eg \fBstring replace \-ra \(aq([ab])\(aq \(aq\e\e\e\e\e\e\e$1\(aq a\fP). The new feature
flag \fBregex\-easyesc\fP can be used to disable this, so that the same
effect can be achieved with
\fBstring replace \-ra \(aq([ab])\(aq \(aq\e\e\e\e$1\(aq a\fP (#5556 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5556>). As a reminder,
the intention behind feature flags is that this will eventually
become the default and then only option, so scripts should be
updated.
.IP \(bu 2
The \fBfish_vi_mode\fP function, deprecated in fish 2.3, has been
removed. Use \fBfish_vi_key_bindings\fP instead (#6372 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:6372>).
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
fish 3.0 introduced a CMake\-based build system. In fish 3.1, both the
Autotools\-based build and legacy Xcode build system have been
removed, leaving only the CMake build system. All distributors and
developers must install CMake.
.IP \(bu 2
fish now depends on the common \fBtee\fP external command, for the
\fBpsub\fP process substitution function.
.IP \(bu 2
The documentation is now built with Sphinx. The old Doxygen\-based
documentation system has been removed. Developers, and distributors
who wish to rebuild the documentation, must install Sphinx.
.IP \(bu 2
The \fBINTERNAL_WCWIDTH\fP build option has been removed, as fish now
always uses an internal \fBwcwidth\fP function. It has a number of
configuration options that make it more suitable for general use
(#5777 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5777>).
.IP \(bu 2
mandoc can now be used to format the output from \fB\-\-help\fP if
\fBnroff\fP is not installed, reducing the number of external
dependencies on systems with \fBmandoc\fP installed (#5489 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5489>).
.IP \(bu 2
Some bugs preventing building on Solaris\-derived systems such as
Illumos were fixed (#5458 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5458>, #5461 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5461>, #5611 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5611>).
.IP \(bu 2
Completions for \fBnpm\fP, \fBbower\fP and \fByarn\fP no longer require the
\fBjq\fP utility for full functionality, but will use Python instead if
it is available.
.IP \(bu 2
The paths for completions, functions and configuration snippets have
been extended. On systems that define \fBXDG_DATA_DIRS\fP, each of the
directories in this variable are searched in the subdirectories
\fBfish/vendor_completions.d\fP, \fBfish/vendor_functions.d\fP, and
\fBfish/vendor_conf.d\fP respectively. On systems that do not define
this variable in the environment, the vendor directories are searched
for in both the installation prefix and the default “extra”
directory, which now defaults to \fB/usr/local\fP (#5029 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5029>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 3.0.2 (released February 19, 2019)
.sp
This release of fish fixes an issue discovered in fish 3.0.1.
.SS Fixes and improvements
.INDENT 0.0
.IP \(bu 2
The PWD environment variable is now ignored if it does not resolve to
the true working directory, fixing strange behaviour in terminals
started by editors and IDEs (#5647 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5647>).
.UNINDENT
.sp
If you are upgrading from version 2.7.1 or before, please also review
the release notes for 3.0.1, 3.0.0 and 3.0b1 (included below).
.SS fish 3.0.1 (released February 11, 2019)
.sp
This release of fish fixes a number of major issues discovered in fish
3.0.0.
.SS Fixes and improvements
.INDENT 0.0
.IP \(bu 2
\fBexec\fP does not complain about running foreground jobs when called
(#5449 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5449>).
.IP \(bu 2
while loops now evaluate to the last executed command in the loop
body (or zero if the body was empty), matching POSIX semantics
(#4982 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4982>).
.IP \(bu 2
\fBread \-\-silent\fP no longer echoes to the tty when run from a
non\-interactive script (#5519 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5519>).
.IP \(bu 2
On macOS, path entries with spaces in \fB/etc/paths\fP and
\fB/etc/paths.d\fP now correctly set path entries with spaces.
Likewise, \fBMANPATH\fP is correctly set from \fB/etc/manpaths\fP and
\fB/etc/manpaths.d\fP (#5481 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5481>).
.IP \(bu 2
fish starts correctly under Cygwin/MSYS2 (#5426 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5426>).
.IP \(bu 2
The \fBpager\-toggle\-search\fP binding (Ctrl\-S by default) will now
activate the search field, even when the pager is not focused.
.IP \(bu 2
The error when a command is not found is now printed a single time,
instead of once per argument (#5588 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5588>).
.IP \(bu 2
Fixes and improvements to the git completions, including printing
correct paths with older git versions, fuzzy matching again, reducing
unnecessary offers of root paths (starting with \fB:/\fP) (#5578 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5578>,
#5574 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5574>, #5476 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5476>), and ignoring shell aliases, so enterprising users can
set up the wrapping command (via
\fBset \-g __fish_git_alias_$command $whatitwraps\fP) (#5412 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5412>).
.IP \(bu 2
Significant performance improvements to core shell functions (#5447 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5447>)
and to the \fBkill\fP completions (#5541 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5541>).
.IP \(bu 2
Starting in symbolically\-linked working directories works correctly
(#5525 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5525>).
.IP \(bu 2
The default \fBfish_title\fP function no longer contains extra spaces
(#5517 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5517>).
.IP \(bu 2
The \fBnim\fP prompt now works correctly when chosen in the Web\-based
configuration (#5490 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5490>).
.IP \(bu 2
\fBstring\fP now prints help to stdout, like other builtins (#5495 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5495>).
.IP \(bu 2
Killing the terminal while fish is in vi normal mode will no longer
send it spinning and eating CPU. (#5528 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5528>)
.IP \(bu 2
A number of crashes have been fixed (#5550 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5550>, #5548 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5548>, #5479 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5479>, #5453 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5453>).
.IP \(bu 2
Improvements to the documentation and certain completions.
.UNINDENT
.SS Known issues
.sp
There is one significant known issue that was not corrected before the
release:
.INDENT 0.0
.IP \(bu 2
fish does not run correctly under Windows Services for Linux before
Windows 10 version 1809/17763, and the message warning of this may
not be displayed (#5619 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5619>).
.UNINDENT
.sp
If you are upgrading from version 2.7.1 or before, please also review
the release notes for 3.0.0 and 3.0b1 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.0.0 (released December 28, 2018)
.sp
fish 3 is a major release, which introduces some breaking changes
alongside improved functionality. Although most existing scripts will
continue to work, they should be reviewed against the list contained in
the 3.0b1 release notes below.
.sp
Compared to the beta release of fish 3.0b1, fish version 3.0.0:
.INDENT 0.0
.IP \(bu 2
builds correctly against musl libc (#5407 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5407>)
.IP \(bu 2
handles huge numeric arguments to \fBtest\fP correctly (#5414 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5414>)
.IP \(bu 2
removes the history colouring introduced in 3.0b1, which did not
always work correctly
.UNINDENT
.sp
There is one significant known issue which was not able to be corrected
before the release:
.INDENT 0.0
.IP \(bu 2
fish 3.0.0 builds on Cygwin (#5423 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5423>), but does not run correctly
(#5426 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5426>) and will result in a hanging terminal when started. Cygwin
users are encouraged to continue using 2.7.1 until a release which
corrects this is available.
.UNINDENT
.sp
If you are upgrading from version 2.7.1 or before, please also review
the release notes for 3.0b1 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 3.0b1 (released December 11, 2018)
.sp
fish 3 is a major release, which introduces some breaking changes
alongside improved functionality. Although most existing scripts will
continue to work, they should be reviewed against the list below.
.SS Notable non\-backward compatible changes
.INDENT 0.0
.IP \(bu 2
Process and job expansion has largely been removed. \fB%\fP will no
longer perform these expansions, except for \fB%self\fP for the PID of
the current shell. Additionally, job management commands (\fBdisown\fP,
\fBwait\fP, \fBbg\fP, \fBfg\fP and \fBkill\fP) will expand job specifiers
starting with \fB%\fP (#4230 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4230>, #1202 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1202>).
.IP \(bu 2
\fBset x[1] x[2] a b\fP, to set multiple elements of an array at once,
is no longer valid syntax (#4236 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4236>).
.IP \(bu 2
A literal \fB{}\fP now expands to itself, rather than nothing. This
makes working with \fBfind \-exec\fP easier (#1109 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1109>, #4632 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4632>).
.IP \(bu 2
Literally accessing a zero\-index is now illegal syntax and is caught
by the parser (#4862 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4862>). (fish indices start at 1)
.IP \(bu 2
Successive commas in brace expansions are handled in less surprising
manner. For example, \fB{,,,}\fP expands to four empty strings rather
than an empty string, a comma and an empty string again (#3002 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3002>,
#4632 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4632>).
.IP \(bu 2
\fBfor\fP loop control variables are no longer local to the \fBfor\fP
block (#1935 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1935>).
.IP \(bu 2
Variables set in \fBif\fP and \fBwhile\fP conditions are available
outside the block (#4820 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4820>).
.IP \(bu 2
Local exported (\fBset \-lx\fP) vars are now visible to functions
(#1091 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1091>).
.IP \(bu 2
The new \fBmath\fP builtin (see below) does not support logical
expressions; \fBtest\fP should be used instead (#4777 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4777>).
.IP \(bu 2
Range expansion will now behave sensibly when given a single positive
and negative index (\fB$foo[5..\-1]\fP or \fB$foo[\-1..5]\fP), clamping to
the last valid index without changing direction if the list has fewer
elements than expected.
.IP \(bu 2
\fBread\fP now uses \fB\-s\fP as short for \fB\-\-silent\fP (à la \fBbash\fP);
\fB\-\-shell\fP’s abbreviation (formerly \fB\-s\fP) is now \fB\-S\fP instead
(#4490 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4490>).
.IP \(bu 2
\fBcd\fP no longer resolves symlinks. fish now maintains a virtual
path, matching other shells (#3350 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3350>).
.IP \(bu 2
\fBsource\fP now requires an explicit \fB\-\fP as the filename to read
from the terminal (#2633 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2633>).
.IP \(bu 2
Arguments to \fBend\fP are now errors, instead of being silently
ignored.
.IP \(bu 2
The names \fBargparse\fP, \fBread\fP, \fBset\fP, \fBstatus\fP, \fBtest\fP and
\fB[\fP are now reserved and not allowed as function names. This
prevents users unintentionally breaking stuff (#3000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3000>).
.IP \(bu 2
The \fBfish_user_abbreviations\fP variable is no longer used;
abbreviations will be migrated to the new storage format
automatically.
.IP \(bu 2
The \fBFISH_READ_BYTE_LIMIT\fP variable is now called
\fBfish_byte_limit\fP (#4414 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4414>).
.IP \(bu 2
Environment variables are no longer split into arrays based on the
record separator character on startup. Instead, variables are not
split, unless their name ends in PATH, in which case they are split
on colons (#436 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:436>).
.IP \(bu 2
The \fBhistory\fP builtin’s \fB\-\-with\-time\fP option has been removed;
this has been deprecated in favor of \fB\-\-show\-time\fP since 2.7.0
(#4403 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4403>).
.IP \(bu 2
The internal variables \fB__fish_datadir\fP and \fB__fish_sysconfdir\fP
are now known as \fB__fish_data_dir\fP and \fB__fish_sysconf_dir\fP
respectively.
.UNINDENT
.SS Deprecations
.sp
With the release of fish 3, a number of features have been marked for
removal in the future. All users are encouraged to explore alternatives.
A small number of these features are currently behind feature flags,
which are turned on at present but may be turned off by default in the
future.
.sp
A new feature flags mechanism is added for staging deprecations and
breaking changes. Feature flags may be specified at launch with
\fBfish \-\-features ...\fP or by setting the universal \fBfish_features\fP
variable. (#4940 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4940>)
.INDENT 0.0
.IP \(bu 2
The use of the \fBIFS\fP variable for \fBread\fP is deprecated; \fBIFS\fP
will be ignored in the future (#4156 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4156>). Use the \fBread \-\-delimiter\fP
option instead.
.IP \(bu 2
The \fBfunction \-\-on\-process\-exit\fP switch will be removed in future
(#4700 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4700>). Use the \fBfish_exit\fP event instead:
\fBfunction \-\-on\-event fish_exit\fP\&.
.IP \(bu 2
\fB$_\fP is deprecated and will removed in the future (#813 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:813>). Use
\fBstatus current\-command\fP in a command substitution instead.
.IP \(bu 2
\fB^\fP as a redirection deprecated and will be removed in the future.
(#4394 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4394>). Use \fB2>\fP to redirect stderr. This is controlled by the
\fBstderr\-nocaret\fP feature flag.
.IP \(bu 2
\fB?\fP as a glob (wildcard) is deprecated and will be removed in the
future (#4520 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4520>). This is controlled by the \fBqmark\-noglob\fP feature
flag.
.UNINDENT
.SS Notable fixes and improvements
.SS Syntax changes and new commands
.INDENT 0.0
.IP \(bu 2
fish now supports \fB&&\fP (like \fBand\fP), \fB||\fP (like \fBor\fP), and
\fB!\fP (like \fBnot\fP), for better migration from POSIX\-compliant
shells (#4620 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4620>).
.IP \(bu 2
Variables may be used as commands (#154 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:154>).
.IP \(bu 2
fish may be started in private mode via \fBfish \-\-private\fP\&. Private
mode fish sessions do not have access to the history file and any
commands evaluated in private mode are not persisted for future
sessions. A session variable \fB$fish_private_mode\fP can be queried to
detect private mode and adjust the behavior of scripts accordingly to
respect the user’s wish for privacy.
.IP \(bu 2
A new \fBwait\fP command for waiting on backgrounded processes (#4498 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4498>).
.IP \(bu 2
\fBmath\fP is now a builtin rather than a wrapper around \fBbc\fP
(#3157 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3157>). Floating point computations is now used by default, and can
be controlled with the new \fB\-\-scale\fP option (#4478 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4478>).
.IP \(bu 2
Setting \fB$PATH\fP no longer warns on non\-existent directories,
allowing for a single $PATH to be shared across machines (eg via
dotfiles) (#2969 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2969>).
.IP \(bu 2
\fBwhile\fP sets \fB$status\fP to a non\-zero value if the loop is not
executed (#4982 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4982>).
.IP \(bu 2
Command substitution output is now limited to 10 MB by default,
controlled by the \fBfish_read_limit\fP variable (#3822 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3822>). Notably, this
is larger than most operating systems’ argument size limit, so trying
to pass argument lists this size to external commands has never
worked.
.IP \(bu 2
The machine hostname, where available, is now exposed as the
\fB$hostname\fP reserved variable. This removes the dependency on the
\fBhostname\fP executable (#4422 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4422>).
.IP \(bu 2
Bare \fBbind\fP invocations in config.fish now work. The
\fBfish_user_key_bindings\fP function is no longer necessary, but will
still be executed if it exists (#5191 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5191>).
.IP \(bu 2
\fB$fish_pid\fP and \fB$last_pid\fP are available as replacements for
\fB%self\fP and \fB%last\fP\&.
.UNINDENT
.SS New features in commands
.INDENT 0.0
.IP \(bu 2
\fBalias\fP has a new \fB\-\-save\fP option to save the generated function
immediately (#4878 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4878>).
.IP \(bu 2
\fBbind\fP has a new \fB\-\-silent\fP option to ignore bind requests for
named keys not available under the current terminal (#4188 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4188>, #4431 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4431>).
.IP \(bu 2
\fBcomplete\fP has a new \fB\-\-keep\-order\fP option to show the provided
or dynamically\-generated argument list in the same order as
specified, rather than alphabetically (#361 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:361>).
.IP \(bu 2
\fBexec\fP prompts for confirmation if background jobs are running.
.IP \(bu 2
\fBfunced\fP has a new \fB\-\-save\fP option to automatically save the
edited function after successfully editing (#4668 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4668>).
.IP \(bu 2
\fBfunctions\fP has a new \fB\-\-handlers\fP option to show functions
registered as event handlers (#4694 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4694>).
.IP \(bu 2
\fBhistory search\fP supports globs for wildcard searching (#3136 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3136>) and
has a new \fB\-\-reverse\fP option to show entries from oldest to newest
(#4375 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4375>).
.IP \(bu 2
\fBjobs\fP has a new \fB\-\-quiet\fP option to silence the output.
.IP \(bu 2
\fBread\fP has a new \fB\-\-delimiter\fP option for splitting input into
arrays (#4256 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4256>).
.IP \(bu 2
\fBread\fP writes directly to stdout if called without arguments
(#4407 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4407>).
.IP \(bu 2
\fBread\fP can now read individual lines into separate variables
without consuming the input in its entirety via the new \fB/\-\-line\fP
option.
.IP \(bu 2
\fBset\fP has new \fB\-\-append\fP and \fB\-\-prepend\fP options (#1326 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1326>).
.IP \(bu 2
\fBstring match\fP with an empty pattern and \fB\-\-entire\fP in glob mode
now matches everything instead of nothing (#4971 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4971>).
.IP \(bu 2
\fBstring split\fP supports a new \fB\-\-no\-empty\fP option to exclude
empty strings from the result (#4779 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4779>).
.IP \(bu 2
\fBstring\fP has new subcommands \fBsplit0\fP and \fBjoin0\fP for working
with NUL\-delimited output.
.IP \(bu 2
\fBstring\fP no longer stops processing text after NUL characters
(#4605 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4605>)
.IP \(bu 2
\fBstring escape\fP has a new \fB\-\-style regex\fP option for escaping
strings to be matched literally in \fBstring\fP regex operations.
.IP \(bu 2
\fBtest\fP now supports floating point values in numeric comparisons.
.UNINDENT
.SS Interactive improvements
.INDENT 0.0
.IP \(bu 2
A pipe at the end of a line now allows the job to continue on the
next line (#1285 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1285>).
.IP \(bu 2
Italics and dim support out of the box on macOS for Terminal.app and
iTerm (#4436 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4436>).
.IP \(bu 2
\fBcd\fP tab completions no longer descend into the deepest unambiguous
path (#4649 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4649>).
.IP \(bu 2
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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4680>).
.IP \(bu 2
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 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2249>).
.IP \(bu 2
A new input binding \fBpager\-toggle\-search\fP toggles the search field
in the completions pager on and off. By default, this is bound to
Ctrl\-S.
.IP \(bu 2
Searching in the pager now does a full fuzzy search (#5213 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5213>).
.IP \(bu 2
The pager will now show the full command instead of just its last
line if the number of completions is large (#4702 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4702>).
.IP \(bu 2
Abbreviations can be tab\-completed (#3233 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3233>).
.IP \(bu 2
Tildes in file names are now properly escaped in completions (#2274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2274>).
.IP \(bu 2
Wrapping completions (from \fBcomplete \-\-wraps\fP or
\fBfunction \-\-wraps\fP) can now inject arguments. For example,
\fBcomplete gco \-\-wraps \(aqgit checkout\(aq\fP now works properly (#1976 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1976>).
The \fBalias\fP function has been updated to respect this behavior.
.IP \(bu 2
Path completions now support expansions, meaning expressions like
\fBpython ~/<TAB>\fP now provides file suggestions just like any other
relative or absolute path. (This includes support for other
expansions, too.)
.IP \(bu 2
Autosuggestions try to avoid arguments that are already present in
the command line.
.IP \(bu 2
Notifications about crashed processes are now always shown, even in
command substitutions (#4962 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4962>).
.IP \(bu 2
The screen is no longer reset after a BEL, fixing graphical glitches
(#3693 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3693>).
.IP \(bu 2
vi\-mode now supports ‘;’ and ‘,’ motions. This introduces new
{forward,backward}\-jump\-till and repeat\-jump{,\-reverse} bind
functions (#5140 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5140>).
.IP \(bu 2
The \fB*y\fP vi\-mode binding now works (#5100 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5100>).
.IP \(bu 2
True color is now enabled in neovim by default (#2792 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2792>).
.IP \(bu 2
Terminal size variables (\fB$COLUMNS\fP/\fB$LINES\fP) are now updated
before \fBfish_prompt\fP is called, allowing the prompt to react
(#904 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:904>).
.IP \(bu 2
Multi\-line prompts no longer repeat when the terminal is resized
(#2320 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2320>).
.IP \(bu 2
\fBxclip\fP support has been added to the clipboard integration
(#5020 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5020>).
.IP \(bu 2
The Alt\-P keybinding paginates the last command if the command line
is empty.
.IP \(bu 2
\fB$cmd_duration\fP is no longer reset when no command is executed
(#5011 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5011>).
.IP \(bu 2
Deleting a one\-character word no longer erases the next word as well
(#4747 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4747>).
.IP \(bu 2
Token history search (Alt\-Up) omits duplicate entries (#4795 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4795>).
.IP \(bu 2
The \fBfish_escape_delay_ms\fP timeout, allowing the use of the escape
key both on its own and as part of a control sequence, was applied to
all control characters; this has been reduced to just the escape key.
.IP \(bu 2
Completing a function shows the description properly (#5206 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5206>).
.IP \(bu 2
\fBcommandline\fP can now be used to set the commandline for the next command, restoring a behavior in 3.4.1 (#8807 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:8807>).
.IP \(bu 2
Added completions for
.INDENT 2.0
.IP \(bu 2
\fBansible\fP, including \fBansible\-galaxy\fP, \fBansible\-playbook\fP
and \fBansible\-vault\fP (#4697 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4697>)
.IP \(bu 2
\fBbb\-power\fP (#4800 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4800>)
.IP \(bu 2
\fBbd\fP (#4472 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4472>)
.IP \(bu 2
\fBbower\fP
.IP \(bu 2
\fBclang\fP and \fBclang++\fP (#4174 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4174>)
.IP \(bu 2
\fBconda\fP (#4837 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4837>)
.IP \(bu 2
\fBconfigure\fP (for autoconf\-generated files only)
.IP \(bu 2
\fBcurl\fP
.IP \(bu 2
\fBdoas\fP (#5196 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5196>)
.IP \(bu 2
\fBebuild\fP (#4911 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4911>)
.IP \(bu 2
\fBemaint\fP (#4758 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4758>)
.IP \(bu 2
\fBeopkg\fP (#4600 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4600>)
.IP \(bu 2
\fBexercism\fP (#4495 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4495>)
.IP \(bu 2
\fBhjson\fP
.IP \(bu 2
\fBhugo\fP (#4529 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4529>)
.IP \(bu 2
\fBj\fP (from autojump #4344 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4344>)
.IP \(bu 2
\fBjbake\fP (#4814 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4814>)
.IP \(bu 2
\fBjhipster\fP (#4472 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4472>)
.IP \(bu 2
\fBkitty\fP
.IP \(bu 2
\fBkldload\fP
.IP \(bu 2
\fBkldunload\fP
.IP \(bu 2
\fBmakensis\fP (#5242 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5242>)
.IP \(bu 2
\fBmeson\fP
.IP \(bu 2
\fBmkdocs\fP (#4906 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4906>)
.IP \(bu 2
\fBngrok\fP (#4642 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4642>)
.IP \(bu 2
OpenBSD’s \fBpkg_add\fP, \fBpkg_delete\fP, \fBpkg_info\fP, \fBpfctl\fP,
\fBrcctl\fP, \fBsignify\fP, and \fBvmctl\fP (#4584 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4584>)
.IP \(bu 2
\fBopenocd\fP
.IP \(bu 2
\fBoptipng\fP
.IP \(bu 2
\fBopkg\fP (#5168 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5168>)
.IP \(bu 2
\fBpandoc\fP (#2937 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2937>)
.IP \(bu 2
\fBport\fP (#4737 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4737>)
.IP \(bu 2
\fBpowerpill\fP (#4800 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4800>)
.IP \(bu 2
\fBpstack\fP (#5135 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5135>)
.IP \(bu 2
\fBserve\fP (#5026 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5026>)
.IP \(bu 2
\fBttx\fP
.IP \(bu 2
\fBunzip\fP
.IP \(bu 2
\fBvirsh\fP (#5113 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5113>)
.IP \(bu 2
\fBxclip\fP (#5126 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5126>)
.IP \(bu 2
\fBxsv\fP
.IP \(bu 2
\fBzfs\fP and \fBzpool\fP (#4608 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4608>)
.UNINDENT
.IP \(bu 2
Lots of improvements to completions (especially \fBdarcs\fP (#5112 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5112>),
\fBgit\fP, \fBhg\fP and \fBsudo\fP).
.IP \(bu 2
Completions for \fByarn\fP and \fBnpm\fP now require the
\fBall\-the\-package\-names\fP NPM package for full functionality.
.IP \(bu 2
Completions for \fBbower\fP and \fByarn\fP now require the \fBjq\fP utility
for full functionality.
.IP \(bu 2
Improved French translations.
.UNINDENT
.SS Other fixes and improvements
.INDENT 0.0
.IP \(bu 2
Significant performance improvements to \fBabbr\fP (#4048 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4048>), setting
variables (#4200 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4200>, #4341 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4341>), executing functions, globs (#4579 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4579>),
\fBstring\fP reading from standard input (#4610 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4610>), and slicing history
(in particular, \fB$history[1]\fP for the last executed command).
.IP \(bu 2
Fish’s internal wcwidth function has been updated to deal with newer
Unicode, and the width of some characters can be configured via the
\fBfish_ambiguous_width\fP (#5149 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5149>) and \fBfish_emoji_width\fP (#2652 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2652>)
variables. Alternatively, a new build\-time option INTERNAL_WCWIDTH
can be used to use the system’s wcwidth instead (#4816 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4816>).
.IP \(bu 2
\fBfunctions\fP correctly supports \fB\-d\fP as the short form of
\fB\-\-description\fP\&. (#5105 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5105>)
.IP \(bu 2
\fB/etc/paths\fP is now parsed like macOS’ bash \fBpath_helper\fP, fixing
$PATH order (#4336 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4336>, #4852 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4852>) on macOS.
.IP \(bu 2
Using a read\-only variable in a \fBfor\fP loop produces an error,
rather than silently producing incorrect results (#4342 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4342>).
.IP \(bu 2
The universal variables filename no longer contains the hostname or
MAC address. It is now at the fixed location
\fB\&.config/fish/fish_variables\fP (#1912 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1912>).
.IP \(bu 2
Exported variables in the global or universal scope no longer have
their exported status affected by local variables (#2611 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2611>).
.IP \(bu 2
Major rework of terminal and job handling to eliminate bugs (#3805 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3805>,
#3952 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3952>, #4178 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4178>, #4235 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4235>, #4238 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4238>, #4540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4540>, #4929 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4929>, #5210 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5210>).
.IP \(bu 2
Improvements to the manual page completion generator (#2937 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2937>, #4313 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4313>).
.IP \(bu 2
\fBsuspend \-\-force\fP now works correctly (#4672 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4672>).
.IP \(bu 2
Pressing Ctrl\-C while running a script now reliably terminates fish
(#5253 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:5253>).
.UNINDENT
.SS For distributors and developers
.INDENT 0.0
.IP \(bu 2
fish ships with a new build system based on CMake. CMake 3.2 is the
minimum required version. Although the autotools\-based Makefile and
the Xcode project are still shipped with this release, they will be
removed in the near future. All distributors and developers are
encouraged to migrate to the CMake build.
.IP \(bu 2
Build scripts for most platforms no longer require bash, using the
standard sh instead.
.IP \(bu 2
The \fBhostname\fP command is no longer required for fish to operate.
.UNINDENT
.sp
–
.SS fish 2.7.1 (released December 23, 2017)
.sp
This release of fish fixes an issue where iTerm 2 on macOS would display
a warning about paste bracketing being left on when starting a new fish
session (#4521 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4521>).
.sp
If you are upgrading from version 2.6.0 or before, please also review
the release notes for 2.7.0 and 2.7b1 (included below).
.sp
–
.SS fish 2.7.0 (released November 23, 2017)
.sp
There are no major changes between 2.7b1 and 2.7.0. If you are upgrading
from version 2.6.0 or before, please also review the release notes for
2.7b1 (included below).
.sp
Xcode builds and macOS packages could not be produced with 2.7b1, but
this is fixed in 2.7.0.
.sp
–
.SS fish 2.7b1 (released October 31, 2017)
.SS Notable improvements
.INDENT 0.0
.IP \(bu 2
A new \fBcdh\fP (change directory using recent history) command
provides a more friendly alternative to prevd/nextd and pushd/popd
(#2847 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2847>).
.IP \(bu 2
A new \fBargparse\fP command is available to allow fish script to parse
arguments with the same behavior as builtin commands. This also
includes the \fBfish_opt\fP helper command. (#4190 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4190>).
.IP \(bu 2
Invalid array indexes are now silently ignored (#826 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:826>, #4127 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4127>).
.IP \(bu 2
Improvements to the debugging facility, including a prompt specific
to the debugger (\fBfish_breakpoint_prompt\fP) and a
\fBstatus is\-breakpoint\fP subcommand (#1310 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1310>).
.IP \(bu 2
\fBstring\fP supports new \fBlower\fP and \fBupper\fP subcommands, for
altering the case of strings (#4080 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4080>). The case changing is not
locale\-aware yet.\- \fBstring escape\fP has a new \fB\-\-style=xxx\fP flag
where \fBxxx\fP can be \fBscript\fP, \fBvar\fP, or \fBurl\fP (#4150 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4150>), and can
be reversed with \fBstring unescape\fP (#3543 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3543>).
.IP \(bu 2
History can now be split into sessions with the \fBfish_history\fP
variable, or not saved to disk at all (#102 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:102>).
.IP \(bu 2
Read history is now controlled by the \fBfish_history\fP variable
rather than the \fB\-\-mode\-name\fP flag (#1504 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1504>).
.IP \(bu 2
\fBcommand\fP now supports an \fB\-\-all\fP flag to report all directories
with the command. \fBwhich\fP is no longer a runtime dependency
(#2778 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2778>).
.IP \(bu 2
fish can run commands before starting an interactive session using
the new \fB\-\-init\-command\fP/\fB\-C\fP options (#4164 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4164>).
.IP \(bu 2
\fBset\fP has a new \fB\-\-show\fP option to show lots of information about
variables (#4265 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4265>).
.UNINDENT
.SS Other significant changes
.INDENT 0.0
.IP \(bu 2
The \fBCOLUMNS\fP and \fBLINES\fP environment variables are now correctly
set the first time \fBfish_prompt\fP is run (#4141 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4141>).
.IP \(bu 2
\fBcomplete\fP’s \fB\-\-no\-files\fP option works as intended (#112 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:112>).
.IP \(bu 2
\fBecho \-h\fP now correctly echoes \fB\-h\fP in line with other shells
(#4120 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4120>).
.IP \(bu 2
The \fBexport\fP compatibility function now returns zero on success,
rather than always returning 1 (#4435 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4435>).
.IP \(bu 2
Stop converting empty elements in MANPATH to “.” (#4158 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4158>). The
behavior being changed was introduced in fish 2.6.0.
.IP \(bu 2
\fBcount \-h\fP and \fBcount \-\-help\fP now return 1 rather than produce
command help output (#4189 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4189>).
.IP \(bu 2
An attempt to \fBread\fP which stops because too much data is available
still defines the variables given as parameters (#4180 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4180>).
.IP \(bu 2
A regression in fish 2.4.0 which prevented \fBpushd +1\fP from working
has been fixed (#4091 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4091>).
.IP \(bu 2
A regression in fish 2.6.0 where multiple \fBread\fP commands in
non\-interactive scripts were broken has been fixed (#4206 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4206>).
.IP \(bu 2
A regression in fish 2.6.0 involving universal variables with
side\-effects at startup such as \fBset \-U fish_escape_delay_ms 10\fP
has been fixed (#4196 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4196>).
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBas\fP (#4130 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4130>)
.IP \(bu 2
\fBcdh\fP (#2847 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2847>)
.IP \(bu 2
\fBdhcpd\fP (#4115 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4115>)
.IP \(bu 2
\fBezjail\-admin\fP (#4324 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4324>)
.IP \(bu 2
Fabric’s \fBfab\fP (#4153 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4153>)
.IP \(bu 2
\fBgrub\-file\fP (#4119 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4119>)
.IP \(bu 2
\fBgrub\-install\fP (#4119 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4119>)
.IP \(bu 2
\fBjest\fP (#4142 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4142>)
.IP \(bu 2
\fBkdeconnect\-cli\fP
.IP \(bu 2
\fBmagneto\fP (#4043 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4043>, #4108 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4108>)
.IP \(bu 2
\fBmdadm\fP (#4198 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4198>)
.IP \(bu 2
\fBpasswd\fP (#4209 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4209>)
.IP \(bu 2
\fBpip\fP and \fBpipenv\fP (#4448 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4448>)
.IP \(bu 2
\fBs3cmd\fP (#4332 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4332>)
.IP \(bu 2
\fBsbt\fP (#4347 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4347>)
.IP \(bu 2
\fBsnap\fP (#4215 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4215>)
.IP \(bu 2
Sublime Text 3’s \fBsubl\fP (#4277 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4277>)
.UNINDENT
.IP \(bu 2
Lots of improvements to completions.
.IP \(bu 2
Updated Chinese and French translations.
.IP \(bu 2
Improved completions for:
.INDENT 2.0
.IP \(bu 2
\fBapt\fP
.IP \(bu 2
\fBcd\fP (#4061 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4061>)
.IP \(bu 2
\fBcomposer\fP (#4295 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4295>)
.IP \(bu 2
\fBeopkg\fP
.IP \(bu 2
\fBflatpak\fP (#4456 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4456>)
.IP \(bu 2
\fBgit\fP (#4117 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4117>, #4147 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4147>, #4329 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4329>, #4368 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4368>)
.IP \(bu 2
\fBgphoto2\fP
.IP \(bu 2
\fBkillall\fP (#4052 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4052>)
.IP \(bu 2
\fBln\fP
.IP \(bu 2
\fBnpm\fP (#4241 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4241>)
.IP \(bu 2
\fBssh\fP (#4377 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4377>)
.IP \(bu 2
\fBtail\fP
.IP \(bu 2
\fBxdg\-mime\fP (#4333 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4333>)
.IP \(bu 2
\fBzypper\fP (#4325 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4325>)
.UNINDENT
.UNINDENT
.SS fish 2.6.0 (released June 3, 2017)
.sp
Since the beta release of fish 2.6b1, fish version 2.6.0 contains a
number of minor fixes, new completions for \fBmagneto\fP (#4043 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4043>), and
improvements to the documentation.
.SS Known issues
.INDENT 0.0
.IP \(bu 2
Apple macOS Sierra 10.12.5 introduced a problem with launching web
browsers from other programs using AppleScript. This affects the fish
Web configuration (\fBfish_config\fP); users on these platforms will
need to manually open the address displayed in the terminal, such as
by copying and pasting it into a browser. This problem will be fixed
with macOS 10.12.6.
.UNINDENT
.sp
If you are upgrading from version 2.5.0 or before, please also review
the release notes for 2.6b1 (included below).

.sp
.ce
----

.ce 0
.sp
.SS fish 2.6b1 (released May 14, 2017)
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
Jobs running in the background can now be removed from the list of
jobs with the new \fBdisown\fP builtin, which behaves like the same
command in other shells (#2810 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2810>).
.IP \(bu 2
Command substitutions now have access to the terminal, like in other
shells. This allows tools like \fBfzf\fP to work properly (#1362 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1362>,
#3922 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3922>).
.IP \(bu 2
In cases where the operating system does not report the size of the
terminal, the \fBCOLUMNS\fP and \fBLINES\fP environment variables are
used; if they are unset, a default of 80x24 is assumed.
.IP \(bu 2
New French (#3772 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3772> & #3788 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3788>) and improved German (#3834 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3834>) translations.
.IP \(bu 2
fish no longer depends on the \fBwhich\fP external command.
.UNINDENT
.SS Other significant changes
.INDENT 0.0
.IP \(bu 2
Performance improvements in launching processes, including major
reductions in signal blocking. Although this has been heavily tested,
it may cause problems in some circumstances; set the
\fBFISH_NO_SIGNAL_BLOCK\fP variable to 0 in your fish configuration
file to return to the old behaviour (#2007 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2007>).
.IP \(bu 2
Performance improvements in prompts and functions that set lots of
colours (#3793 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3793>).
.IP \(bu 2
The Delete key no longer deletes backwards (a regression in 2.5.0).
.IP \(bu 2
\fBfunctions\fP supports a new \fB\-\-details\fP option, which identifies
where the function was loaded from (#3295 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3295>), and a
\fB\-\-details \-\-verbose\fP option which includes the function
description (#597 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:597>).
.IP \(bu 2
\fBread\fP will read up to 10 MiB by default, leaving the target
variable empty and exiting with status 122 if the line is too long.
You can set a different limit with the \fBFISH_READ_BYTE_LIMIT\fP
variable.
.IP \(bu 2
\fBread\fP supports a new \fB\-\-silent\fP option to hide the characters
typed (#838 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:838>), for when reading sensitive data from the terminal.
\fBread\fP also now accepts simple strings for the prompt (rather than
scripts) with the new \fB\-P\fP and \fB\-\-prompt\-str\fP options (#802 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:802>).
.IP \(bu 2
\fBexport\fP and \fBsetenv\fP now understand colon\-separated \fBPATH\fP,
\fBCDPATH\fP and \fBMANPATH\fP variables.
.IP \(bu 2
\fBsetenv\fP is no longer a simple alias for \fBset \-gx\fP and will
complain, just like the csh version, if given more than one value
(#4103 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4103>).
.IP \(bu 2
\fBbind\fP supports a new \fB\-\-list\-modes\fP option (#3872 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3872>).
.IP \(bu 2
\fBbg\fP will check all of its arguments before backgrounding any jobs;
any invalid arguments will cause a failure, but non\-existent (eg
recently exited) jobs are ignored (#3909 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3909>).
.IP \(bu 2
\fBfunced\fP warns if the function being edited has not been modified
(#3961 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3961>).
.IP \(bu 2
\fBprintf\fP correctly outputs “long long” integers (#3352 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3352>).
.IP \(bu 2
\fBstatus\fP supports a new \fBcurrent\-function\fP subcommand to print
the current function name (#1743 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1743>).
.IP \(bu 2
\fBstring\fP supports a new \fBrepeat\fP subcommand (#3864 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3864>).
\fBstring match\fP supports a new \fB\-\-entire\fP option to emit the
entire line matched by a pattern (#3957 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3957>). \fBstring replace\fP supports
a new \fB\-\-filter\fP option to only emit lines which underwent a
replacement (#3348 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3348>).
.IP \(bu 2
\fBtest\fP supports the \fB\-k\fP option to test for sticky bits (#733 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:733>).
.IP \(bu 2
\fBumask\fP understands symbolic modes (#738 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:738>).
.IP \(bu 2
Empty components in the \fBCDPATH\fP, \fBMANPATH\fP and \fBPATH\fP
variables are now converted to “.” (#2106 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2106>, #3914 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3914>).
.IP \(bu 2
New versions of ncurses (6.0 and up) wipe terminal scrollback buffers
with certain commands; the \fBC\-l\fP binding tries to avoid this
(#2855 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2855>).
.IP \(bu 2
Some systems’ \fBsu\fP implementations do not set the \fBUSER\fP
environment variable; it is now reset for root users (#3916 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3916>).
.IP \(bu 2
Under terminals which support it, bracketed paste is enabled,
escaping problematic characters for security and convenience (#3871 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3871>).
Inside single quotes (\fB\(aq\fP), single quotes and backslashes in pasted
text are escaped (#967 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:967>). The \fBfish_clipboard_paste\fP function (bound
to \fBC\-v\fP by default) is still the recommended pasting method where
possible as it includes this functionality and more.
.IP \(bu 2
Processes in pipelines are no longer signalled as soon as one command
in the pipeline has completed (#1926 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1926>). This behaviour matches other
shells mre closely.
.IP \(bu 2
All functions requiring Python work with whichever version of Python
is installed (#3970 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3970>). Python 3 is preferred, but Python 2.6 remains
the minimum version required.
.IP \(bu 2
The color of the cancellation character can be controlled by the
\fBfish_color_cancel\fP variable (#3963 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3963>).
.IP \(bu 2
Added completions for:
.IP \(bu 2
\fBcaddy\fP (#4008 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4008>)
.IP \(bu 2
\fBcastnow\fP (#3744 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3744>)
.IP \(bu 2
\fBclimate\fP (#3760 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3760>)
.IP \(bu 2
\fBflatpak\fP
.IP \(bu 2
\fBgradle\fP (#3859 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3859>)
.IP \(bu 2
\fBgsettings\fP (#4001 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4001>)
.IP \(bu 2
\fBhelm\fP (#3829 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3829>)
.IP \(bu 2
\fBi3\-msg\fP (#3787 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3787>)
.IP \(bu 2
\fBipset\fP (#3924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3924>)
.IP \(bu 2
\fBjq\fP (#3804 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3804>)
.IP \(bu 2
\fBlight\fP (#3752 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3752>)
.IP \(bu 2
\fBminikube\fP (#3778 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3778>)
.IP \(bu 2
\fBmocha\fP (#3828 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3828>)
.IP \(bu 2
\fBmkdosfs\fP (#4017 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:4017>)
.IP \(bu 2
\fBpv\fP (#3773 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3773>)
.IP \(bu 2
\fBsetsid\fP (#3791 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3791>)
.IP \(bu 2
\fBterraform\fP (#3960 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3960>)
.IP \(bu 2
\fBusermod\fP (#3775 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3775>)
.IP \(bu 2
\fBxinput\fP
.IP \(bu 2
\fByarn\fP (#3816 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3816>)
.IP \(bu 2
Improved completions for \fBadb\fP (#3853 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3853>), \fBapt\fP (#3771 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3771>), \fBbzr\fP
(#3769 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3769>), \fBdconf\fP, \fBgit\fP (including #3743 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3743>), \fBgrep\fP (#3789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3789>),
\fBgo\fP (#3789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3789>), \fBhelp\fP (#3789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3789>), \fBhg\fP (#3975 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3975>), \fBhtop\fP (#3789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3789>),
\fBkillall\fP (#3996 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3996>), \fBlua\fP, \fBman\fP (#3762 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3762>), \fBmount\fP (#3764 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3764> &
#3841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3841>), \fBobnam\fP (#3924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3924>), \fBperl\fP (#3856 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3856>), \fBportmaster\fP (#3950 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3950>),
\fBpython\fP (#3840 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3840>), \fBssh\fP (#3781 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3781>), \fBscp\fP (#3781 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3781>), \fBsystemctl\fP
(#3757 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3757>) and \fBudisks\fP (#3764 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3764>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.5.0 (released February 3, 2017)
.sp
There are no major changes between 2.5b1 and 2.5.0. If you are upgrading
from version 2.4.0 or before, please also review the release notes for
2.5b1 (included below).
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
The Home, End, Insert, Delete, Page Up and Page Down keys work in
Vi\-style key bindings (#3731 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3731>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.5b1 (released January 14, 2017)
.SS Platform Changes
.sp
Starting with version 2.5, fish requires a more up\-to\-date version of
C++, specifically C++11 (from 2011). This affects some older platforms:
.SS Linux
.sp
For users building from source, GCC’s g++ 4.8 or later, or LLVM’s clang
3.3 or later, are known to work. Older platforms may require a newer
compiler installed.
.sp
Unfortunately, because of the complexity of the toolchain, binary
packages are no longer published by the fish\-shell developers for the
following platforms:
.INDENT 0.0
.IP \(bu 2
Red Hat Enterprise Linux and CentOS 5 & 6 for 64\-bit builds
.IP \(bu 2
Ubuntu 12.04 (EoLTS April 2017)
.IP \(bu 2
Debian 7 (EoLTS May 2018)
.UNINDENT
.sp
Installing newer version of fish on these systems will require building
from source.
.SS OS X SnowLeopard
.sp
Starting with version 2.5, fish requires a C++11 standard library on OS
X 10.6 (“SnowLeopard”). If this library is not installed, you will see
this error: \fBdyld: Library not loaded: /usr/lib/libc++.1.dylib\fP
.sp
MacPorts is the easiest way to obtain this library. After installing the
SnowLeopard MacPorts release from the install page, run:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
sudo port \-v install libcxx
.EE
.UNINDENT
.UNINDENT
.sp
Now fish should launch successfully. (Please open an issue if it does
not.)
.sp
This is only necessary on 10.6. OS X 10.7 and later include the required
library by default.
.SS Other significant changes
.INDENT 0.0
.IP \(bu 2
Attempting to exit with running processes in the background produces
a warning, then signals them to terminate if a second attempt to exit
is made. This brings the behaviour for running background processes
into line with stopped processes. (#3497 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3497>)
.IP \(bu 2
\fBrandom\fP can now have start, stop and step values specified, or the
new \fBchoice\fP subcommand can be used to pick an argument from a list
(#3619 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3619>).
.IP \(bu 2
A new key bindings preset, \fBfish_hybrid_key_bindings\fP, including
all the Emacs\-style and Vi\-style bindings, which behaves like
\fBfish_vi_key_bindings\fP in fish 2.3.0 (#3556 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3556>).
.IP \(bu 2
\fBfunction\fP now returns an error when called with invalid options,
rather than defining the function anyway (#3574 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3574>). This was a
regression present in fish 2.3 and 2.4.0.
.IP \(bu 2
fish no longer prints a warning when it identifies a running instance
of an old version (2.1.0 and earlier). Changes to universal variables
may not propagate between these old versions and 2.5b1.
.IP \(bu 2
Improved compatibility with Android (#3585 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3585>), MSYS/mingw (#2360 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2360>), and
Solaris (#3456 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3456>, #3340 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3340>).
.IP \(bu 2
Like other shells, the \fBtest\fP built\-in now returns an error for
numeric operations on invalid integers (#3346 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3346>, #3581 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3581>).
.IP \(bu 2
\fBcomplete\fP no longer recognises \fB\-\-authoritative\fP and
\fB\-\-unauthoritative\fP options, and they are marked as obsolete.
.IP \(bu 2
\fBstatus\fP accepts subcommands, and should be used like
\fBstatus is\-interactive\fP\&. The old options continue to be supported
for the foreseeable future (#3526 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3526>), although only one subcommand or
option can be specified at a time.
.IP \(bu 2
Selection mode (used with “begin\-selection”) no longer selects a
character the cursor does not move over (#3684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3684>).
.IP \(bu 2
List indexes are handled better, and a bit more liberally in some
cases (\fBecho $PATH[1 .. 3]\fP is now valid) (#3579 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3579>).
.IP \(bu 2
The \fBfish_mode_prompt\fP function is now simply a stub around
\fBfish_default_mode_prompt\fP, which allows the mode prompt to be
included more easily in customised prompt functions (#3641 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3641>).
.UNINDENT
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
\fBalias\fP, run without options or arguments, lists all defined
aliases, and aliases now include a description in the function
signature that identifies them.
.IP \(bu 2
\fBcomplete\fP accepts empty strings as descriptions (#3557 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3557>).
.IP \(bu 2
\fBcommand\fP accepts \fB\-q\fP/\fB\-\-quiet\fP in combination with
\fB\-\-search\fP (#3591 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3591>), providing a simple way of checking whether a
command exists in scripts.
.IP \(bu 2
Abbreviations can now be renamed with
\fBabbr \-\-rename OLD_KEY NEW_KEY\fP (#3610 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3610>).
.IP \(bu 2
The command synopses printed by \fB\-\-help\fP options work better with
copying and pasting (#2673 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2673>).
.IP \(bu 2
\fBhelp\fP launches the browser specified by the
\fB$fish_help_browser variable\fP if it is set (#3131 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3131>).
.IP \(bu 2
History merging could lose items under certain circumstances and is
now fixed (#3496 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3496>).
.IP \(bu 2
The \fB$status\fP variable is now set to 123 when a syntactically
invalid command is entered (#3616 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3616>).
.IP \(bu 2
Exiting fish now signals all background processes to terminate, not
just stopped jobs (#3497 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3497>).
.IP \(bu 2
A new \fBprompt_hostname\fP function which prints a hostname suitable
for use in prompts (#3482 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3482>).
.IP \(bu 2
The \fB__fish_man_page\fP function (bound to Alt\-h by default) now
tries to recognize subcommands (e.g.\ \fBgit add\fP will now open the
“git\-add” man page) (#3678 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3678>).
.IP \(bu 2
A new function \fBedit_command_buffer\fP (bound to Alt\-e & Alt\-v by
default) to edit the command buffer in an external editor (#1215 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1215>,
#3627 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3627>).
.IP \(bu 2
\fBset_color\fP now supports italics (\fB\-\-italics\fP), dim (\fB\-\-dim\fP)
and reverse (\fB\-\-reverse\fP) modes (#3650 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3650>).
.IP \(bu 2
Filesystems with very slow locking (eg incorrectly\-configured NFS)
will no longer slow fish down (#685 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:685>).
.IP \(bu 2
Improved completions for \fBapt\fP (#3695 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3695>), \fBfusermount\fP (#3642 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3642>),
\fBmake\fP (#3628 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3628>), \fBnetctl\-auto\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>), \fBnmcli\fP (#3648 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3648>),
\fBpygmentize\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>), and \fBtar\fP (#3719 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3719>).
.IP \(bu 2
Added completions for:
.IP \(bu 2
\fBVBoxHeadless\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBVBoxSDL\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBbase64\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBcaffeinate\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBdconf\fP (#3638 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3638>)
.IP \(bu 2
\fBdig\fP (#3495 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3495>)
.IP \(bu 2
\fBdpkg\-reconfigure\fP (#3521 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3521> & #3522 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3522>)
.IP \(bu 2
\fBfeh\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBlaunchctl\fP (#3682 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3682>)
.IP \(bu 2
\fBlxc\fP (#3554 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3554> & #3564 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3564>),
.IP \(bu 2
\fBmddiagnose\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBmdfind\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBmdimport\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBmdls\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBmdutil\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBmkvextract\fP (#3492 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3492>)
.IP \(bu 2
\fBnvram\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.IP \(bu 2
\fBobjdump\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBsysbench\fP (#3491 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3491>)
.IP \(bu 2
\fBtmutil\fP (#3524 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3524>)
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.4.0 (released November 8, 2016)
.sp
There are no major changes between 2.4b1 and 2.4.0.
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
The documentation is now generated properly and with the correct
version identifier.
.IP \(bu 2
Automatic cursor changes are now only enabled on the subset of XTerm
versions known to support them, resolving a problem where older
versions printed garbage to the terminal before and after every
prompt (#3499 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3499>).
.IP \(bu 2
Improved the title set in Apple Terminal.app.
.IP \(bu 2
Added completions for \fBdefaults\fP and improved completions for
\fBdiskutil\fP (#3478 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3478>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.4b1 (released October 18, 2016)
.SS Significant changes
.INDENT 0.0
.IP \(bu 2
The clipboard integration has been revamped with explicit bindings.
The killring commands no longer copy from, or paste to, the X11
clipboard \- use the new copy (\fBC\-x\fP) and paste (\fBC\-v\fP) bindings
instead. The clipboard is now available on OS X as well as systems
using X11 (e.g.\ Linux). (#3061 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3061>)
.IP \(bu 2
\fBhistory\fP uses subcommands (\fBhistory delete\fP) rather than options
(\fBhistory \-\-delete\fP) for its actions (#3367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3367>). You can no longer
specify multiple actions via flags (e.g.,
\fBhistory \-\-delete \-\-save something\fP).
.IP \(bu 2
New \fBhistory\fP options have been added, including \fB\-\-max=n\fP to
limit the number of history entries, \fB\-\-show\-time\fP option to show
timestamps (#3175 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3175>, #3244 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3244>), and \fB\-\-null\fP to null terminate history
entries in the search output.
.IP \(bu 2
\fBhistory search\fP is now case\-insensitive by default (which also
affects \fBhistory delete\fP) (#3236 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3236>).
.IP \(bu 2
\fBhistory delete\fP now correctly handles multiline commands (#31 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/31>).
.IP \(bu 2
Vi\-style bindings no longer include all of the default emacs\-style
bindings; instead, they share some definitions (#3068 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3068>).
.IP \(bu 2
If there is no locale set in the environment, various known system
configuration files will be checked for a default. If no locale can
be found, \fBen_US\-UTF.8\fP will be used (#277 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:277>).
.IP \(bu 2
A number followed by a caret (e.g.\ \fB5^\fP) is no longer treated as a
redirection (#1873 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1873>).
.IP \(bu 2
The \fB$version\fP special variable can be overwritten, so that it can
be used for other purposes if required.
.UNINDENT
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
The \fBfish_realpath\fP builtin has been renamed to \fBrealpath\fP and
made compatible with GNU \fBrealpath\fP when run without arguments
(#3400 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3400>). It is used only for systems without a \fBrealpath\fP or
\fBgrealpath\fP utility (#3374 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3374>).
.IP \(bu 2
Improved color handling on terminals/consoles with 8\-16 colors,
particularly the use of bright named color (#3176 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3176>, #3260 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3260>).
.IP \(bu 2
\fBfish_indent\fP can now read from files given as arguments, rather
than just standard input (#3037 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3037>).
.IP \(bu 2
Fuzzy tab completions behave in a less surprising manner (#3090 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3090>,
#3211 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3211>).
.IP \(bu 2
\fBjobs\fP should only print its header line once (#3127 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3127>).
.IP \(bu 2
Wildcards in redirections are highlighted appropriately (#2789 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2789>).
.IP \(bu 2
Suggestions will be offered more often, like after removing
characters (#3069 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3069>).
.IP \(bu 2
\fBhistory \-\-merge\fP now correctly interleaves items in chronological
order (#2312 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2312>).
.IP \(bu 2
Options for \fBfish_indent\fP have been aligned with the other binaries
\- in particular, \fB\-d\fP now means \fB\-\-debug\fP\&. The \fB\-\-dump\fP option
has been renamed to \fB\-\-dump\-parse\-tree\fP (#3191 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3191>).
.IP \(bu 2
The display of bindings in the Web\-based configuration has been
greatly improved (#3325 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3325>), as has the rendering of prompts (#2924 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2924>).
.IP \(bu 2
fish should no longer hang using 100% CPU in the C locale (#3214 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3214>).
.IP \(bu 2
A bug in FreeBSD 11 & 12, Dragonfly BSD & illumos prevented fish from
working correctly on these platforms under UTF\-8 locales; fish now
avoids the buggy behaviour (#3050 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3050>).
.IP \(bu 2
Prompts which show git repository information (via
\fB__fish_git_prompt\fP) are faster in large repositories (#3294 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3294>) and
slow filesystems (#3083 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3083>).
.IP \(bu 2
fish 2.3.0 reintroduced a problem where the greeting was printed even
when using \fBread\fP; this has been corrected again (#3261 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3261>).
.IP \(bu 2
Vi mode changes the cursor depending on the current mode (#3215 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3215>).
.IP \(bu 2
Command lines with escaped space characters at the end tab\-complete
correctly (#2447 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2447>).
.IP \(bu 2
Added completions for:
.INDENT 2.0
.IP \(bu 2
\fBarcanist\fP (#3256 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3256>)
.IP \(bu 2
\fBconnmanctl\fP (#3419 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3419>)
.IP \(bu 2
\fBfiglet\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBmdbook\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBninja\fP (#3415 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3415>)
.IP \(bu 2
\fBp4\fP, the Perforce client (#3314 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3314>)
.IP \(bu 2
\fBpygmentize\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.IP \(bu 2
\fBranger\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>)
.UNINDENT
.IP \(bu 2
Improved completions for \fBaura\fP (#3297 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3297>), \fBabbr\fP (#3267 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3267>), \fBbrew\fP
(#3309 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3309>), \fBchown\fP (#3380 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3380>, #3383 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3383>),\fBcygport\fP (#3392 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3392>), \fBgit\fP
(#3274 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3274>, #3226 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3226>, #3225 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3225>, #3094 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3094>, #3087 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3087>, #3035 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3035>, #3021 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3021>, #2982 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2982>, #3230 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3230>),
\fBkill\fP & \fBpkill\fP (#3200 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3200>), \fBscreen\fP (#3271 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3271>), \fBwget\fP (#3470 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3470>),
and \fBxz\fP (#3378 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3378>).
.IP \(bu 2
Distributors, packagers and developers will notice that the build
process produces more succinct output by default; use \fBmake V=1\fP to
get verbose output (#3248 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3248>).
.IP \(bu 2
Improved compatibility with minor platforms including musl (#2988 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2988>),
Cygwin (#2993 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2993>), Android (#3441 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3441>, #3442 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3442>), Haiku (#3322 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3322>) and Solaris .
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.3.1 (released July 3, 2016)
.sp
This is a functionality and bugfix release. This release does not
contain all the changes to fish since the last release, but fixes a
number of issues directly affecting users at present and includes a
small number of new features.
.SS Significant changes
.INDENT 0.0
.IP \(bu 2
A new \fBfish_key_reader\fP binary for decoding interactive keypresses
(#2991 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2991>).
.IP \(bu 2
\fBfish_mode_prompt\fP has been updated to reflect the changes in the
way the Vi input mode is set up (#3067 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3067>), making this more reliable.
.IP \(bu 2
\fBfish_config\fP can now properly be launched from the OS X app bundle
(#3140 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3140>).
.UNINDENT
.SS Notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
Extra lines were sometimes inserted into the output under Windows
(Cygwin and Microsoft Windows Subsystem for Linux) due to TTY
timestamps not being updated (#2859 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2859>).
.IP \(bu 2
The \fBstring\fP builtin’s \fBmatch\fP mode now handles the combination
of \fB\-rnv\fP (match, invert and count) correctly (#3098 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3098>).
.IP \(bu 2
Improvements to TTY special character handling (#3064 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3064>), locale
handling (#3124 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3124>) and terminal environment variable handling (#3060 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3060>).
.IP \(bu 2
Work towards handling the terminal modes for external commands
launched from initialisation files (#2980 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2980>).
.IP \(bu 2
Ease the upgrade path from fish 2.2.0 and before by warning users to
restart fish if the \fBstring\fP builtin is not available (#3057 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3057>).
.IP \(bu 2
\fBtype \-a\fP now syntax\-colorizes function source output.
.IP \(bu 2
Added completions for \fBalsamixer\fP, \fBgodoc\fP, \fBgofmt\fP,
\fBgoimports\fP, \fBgorename\fP, \fBlscpu\fP, \fBmkdir\fP, \fBmodinfo\fP,
\fBnetctl\-auto\fP, \fBpoweroff\fP, \fBtermite\fP, \fBudisksctl\fP and \fBxz\fP
(#3123 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3123>).
.IP \(bu 2
Improved completions for \fBapt\fP (#3097 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3097>), \fBaura\fP (#3102 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3102>),\fBgit\fP
(#3114 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3114>), \fBnpm\fP (#3158 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3158>), \fBstring\fP and \fBsuspend\fP (#3154 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3154>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.3.0 (released May 20, 2016)
.sp
There are no significant changes between 2.3.0 and 2.3b2.
.SS Other notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
\fBabbr\fP now allows non\-letter keys (#2996 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2996>).
.IP \(bu 2
Define a few extra colours on first start (#2987 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2987>).
.IP \(bu 2
Multiple documentation updates.
.IP \(bu 2
Added completions for rmmod (#3007 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:3007>).
.IP \(bu 2
Improved completions for git (#2998 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2998>).
.UNINDENT
.SS Known issues
.INDENT 0.0
.IP \(bu 2
Interactive commands started from fish configuration files or from
the \fB\-c\fP option may, under certain circumstances, be started with
incorrect terminal modes and fail to behave as expected. A fix is
planned but requires further testing (#2619 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2619>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.3b2 (released May 5, 2016)
.SS Significant changes
.INDENT 0.0
.IP \(bu 2
A new \fBfish_realpath\fP builtin and associated function to allow the
use of \fBrealpath\fP even on those platforms that don’t ship an
appropriate command (#2932 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2932>).
.IP \(bu 2
Alt\-# toggles the current command line between commented and
uncommented states, making it easy to save a command in history
without executing it.
.IP \(bu 2
The \fBfish_vi_mode\fP function is now deprecated in favour of
\fBfish_vi_key_bindings\fP\&.
.UNINDENT
.SS Other notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
Fix the build on Cygwin (#2952 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2952>) and RedHat Enterprise Linux/CentOS 5
(#2955 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2955>).
.IP \(bu 2
Avoid confusing the terminal line driver with non\-printing characters
in \fBfish_title\fP (#2453 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2453>).
.IP \(bu 2
Improved completions for busctl, git (#2585 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2585>, #2879 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2879>, #2984 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2984>), and
netctl.
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.3b1 (released April 19, 2016)
.SS Significant Changes
.INDENT 0.0
.IP \(bu 2
A new \fBstring\fP builtin to handle… strings! This builtin will
measure, split, search and replace text strings, including using
regular expressions. It can also be used to turn lists into plain
strings using \fBjoin\fP\&. \fBstring\fP can be used in place of \fBsed\fP,
\fBgrep\fP, \fBtr\fP, \fBcut\fP, and \fBawk\fP in many situations. (#2296 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2296>)
.IP \(bu 2
Allow using escape as the Meta modifier key, by waiting after seeing
an escape character wait up to 300ms for an additional character.
This is consistent with readline (e.g.\ bash) and can be configured
via the \fBfish_escape_delay_ms variable\fP\&. This allows using escape
as the Meta modifier. (#1356 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1356>)
.IP \(bu 2
Add new directories for vendor functions and configuration snippets
(#2500 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2500>)
.IP \(bu 2
A new \fBfish_realpath\fP builtin and associated \fBrealpath\fP function
should allow scripts to resolve path names via \fBrealpath\fP
regardless of whether there is an external command of that name;
albeit with some limitations. See the associated documentation.
.UNINDENT
.SS Backward\-incompatible changes
.INDENT 0.0
.IP \(bu 2
Unmatched globs will now cause an error, except when used with
\fBfor\fP, \fBset\fP or \fBcount\fP (#2719 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2719>)
.IP \(bu 2
\fBand\fP and \fBor\fP will now bind to the closest \fBif\fP or \fBwhile\fP,
allowing compound conditions without \fBbegin\fP and \fBend\fP (#1428 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1428>)
.IP \(bu 2
\fBset \-ql\fP now searches up to function scope for variables (#2502 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2502>)
.IP \(bu 2
\fBstatus \-f\fP will now behave the same when run as the main script or
using \fBsource\fP (#2643 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2643>)
.IP \(bu 2
\fBsource\fP no longer puts the file name in \fB$argv\fP if no arguments
are given (#139 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:139>)
.IP \(bu 2
History files are stored under the \fBXDG_DATA_HOME\fP hierarchy (by
default, in \fB~/.local/share\fP), and existing history will be moved
on first use (#744 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:744>)
.UNINDENT
.SS Other notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
Fish no longer silences errors in config.fish (#2702 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2702>)
.IP \(bu 2
Directory autosuggestions will now descend as far as possible if
there is only one child directory (#2531 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2531>)
.IP \(bu 2
Add support for bright colors (#1464 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1464>)
.IP \(bu 2
Allow Ctrl\-J (\fB\ecj\fP) to be bound separately from Ctrl\-M
(\fB\ecm\fP) (#217 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:217>)
.IP \(bu 2
psub now has a “\-s”/“–suffix” option to name the temporary file with
that suffix
.IP \(bu 2
Enable 24\-bit colors on select terminals (#2495 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2495>)
.IP \(bu 2
Support for SVN status in the prompt (#2582 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2582>)
.IP \(bu 2
Mercurial and SVN support have been added to the Classic + Git (now
Classic + VCS) prompt (via the new __fish_vcs_prompt function)
(#2592 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2592>)
.IP \(bu 2
export now handles variables with a “=” in the value (#2403 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2403>)
.IP \(bu 2
New completions for:
.INDENT 2.0
.IP \(bu 2
alsactl
.IP \(bu 2
Archlinux’s asp, makepkg
.IP \(bu 2
Atom’s apm (#2390 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2390>)
.IP \(bu 2
entr \- the “Event Notify Test Runner” (#2265 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2265>)
.IP \(bu 2
Fedora’s dnf (#2638 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2638>)
.IP \(bu 2
OSX diskutil (#2738 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2738>)
.IP \(bu 2
pkgng (#2395 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2395>)
.IP \(bu 2
pulseaudio’s pacmd and pactl
.IP \(bu 2
rust’s rustc and cargo (#2409 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2409>)
.IP \(bu 2
sysctl (#2214 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2214>)
.IP \(bu 2
systemd’s machinectl (#2158 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2158>), busctl (#2144 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2144>), systemd\-nspawn,
systemd\-analyze, localectl, timedatectl
.IP \(bu 2
and more
.UNINDENT
.IP \(bu 2
Fish no longer has a function called sgrep, freeing it for user
customization (#2245 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2245>)
.IP \(bu 2
A rewrite of the completions for cd, fixing a few bugs (#2299 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2299>, #2300 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2300>,
#562 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:562>)
.IP \(bu 2
Linux VTs now run in a simplified mode to avoid issues (#2311 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2311>)
.IP \(bu 2
The vi\-bindings now inherit from the emacs bindings
.IP \(bu 2
Fish will also execute \fBfish_user_key_bindings\fP when in vi\-mode
.IP \(bu 2
\fBfunced\fP will now also check $VISUAL (#2268 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2268>)
.IP \(bu 2
A new \fBsuspend\fP function (#2269 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2269>)
.IP \(bu 2
Subcommand completion now works better with split /usr (#2141 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2141>)
.IP \(bu 2
The command\-not\-found\-handler can now be overridden by defining a
function called \fB__fish_command_not_found_handler\fP in config.fish
(#2332 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2332>)
.IP \(bu 2
A few fixes to the Sorin theme
.IP \(bu 2
PWD shortening in the prompt can now be configured via the
\fBfish_prompt_pwd_dir_length\fP variable, set to the length per path
component (#2473 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2473>)
.IP \(bu 2
fish no longer requires \fB/etc/fish/config.fish\fP to correctly start,
and now ships a skeleton file that only contains some documentation
(#2799 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2799>)
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.2.0 (released July 12, 2015)
.SS Significant changes
.INDENT 0.0
.IP \(bu 2
Abbreviations: the new \fBabbr\fP command allows for
interactively\-expanded abbreviations, allowing quick access to
frequently\-used commands (#731 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:731>).
.IP \(bu 2
Vi mode: run \fBfish_vi_mode\fP to switch fish into the key bindings
and prompt familiar to users of the Vi editor (#65 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/65>).
.IP \(bu 2
New inline and interactive pager, which will be familiar to users of
zsh (#291 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:291>).
.IP \(bu 2
Underlying architectural changes: the \fBfishd\fP universal variable
server has been removed as it was a source of many bugs and security
problems. Notably, old fish sessions will not be able to communicate
universal variable changes with new fish sessions. For best results,
restart all running instances of \fBfish\fP\&.
.IP \(bu 2
The web\-based configuration tool has been redesigned, featuring a
prompt theme chooser and other improvements.
.IP \(bu 2
New German, Brazilian Portuguese, and Chinese translations.
.UNINDENT
.SS Backward\-incompatible changes
.sp
These are kept to a minimum, but either change undocumented features or
are too hard to use in their existing forms. These changes may break
existing scripts.
.INDENT 0.0
.IP \(bu 2
\fBcommandline\fP no longer interprets functions “in reverse”, instead
behaving as expected (#1567 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1567>).
.IP \(bu 2
The previously\-undocumented \fBCMD_DURATION\fP variable is now set for
all commands and contains the execution time of the last command in
milliseconds (#1585 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1585>). It is no longer exported to other commands
(#1896 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1896>).
.IP \(bu 2
\fBif\fP / \fBelse\fP conditional statements now return values consistent
with the Single Unix Specification, like other shells (#1443 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1443>).
.IP \(bu 2
A new “top\-level” local scope has been added, allowing local
variables declared on the commandline to be visible to subsequent
commands. (#1908 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1908>)
.UNINDENT
.SS Other notable fixes and improvements
.INDENT 0.0
.IP \(bu 2
New documentation design (#1662 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1662>), which requires a Doxygen version
1.8.7 or newer to build.
.IP \(bu 2
Fish now defines a default directory for other packages to provide
completions. By default this is
\fB/usr/share/fish/vendor\-completions.d\fP; on systems with
\fBpkgconfig\fP installed this path is discoverable with
\fBpkg\-config \-\-variable completionsdir fish\fP\&.
.IP \(bu 2
A new parser removes many bugs; all existing syntax should keep
working.
.IP \(bu 2
New \fBfish_preexec\fP and \fBfish_postexec\fP events are fired before
and after job execution respectively (#1549 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1549>).
.IP \(bu 2
Unmatched wildcards no longer prevent a job from running. Wildcards
used interactively will still print an error, but the job will
proceed and the wildcard will expand to zero arguments (#1482 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1482>).
.IP \(bu 2
The \fB\&.\fP command is deprecated and the \fBsource\fP command is
preferred (#310 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:310>).
.IP \(bu 2
\fBbind\fP supports “bind modes”, which allows bindings to be set for a
particular named mode, to support the implementation of Vi mode.
.IP \(bu 2
A new \fBexport\fP alias, which behaves like other shells (#1833 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1833>).
.IP \(bu 2
\fBcommand\fP has a new \fB\-\-search\fP option to print the name of the
disk file that would be executed, like other shells’ \fBcommand \-v\fP
(#1540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1540>).
.IP \(bu 2
\fBcommandline\fP has a new \fB\-\-paging\-mode\fP option to support the new
pager.
.IP \(bu 2
\fBcomplete\fP has a new \fB\-\-wraps\fP option, which allows a command to
(recursively) inherit the completions of a wrapped command (#393 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:393>),
and \fBcomplete \-e\fP now correctly erases completions (#380 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:380>).
.IP \(bu 2
Completions are now generated from manual pages by default on the
first run of fish (#997 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:997>).
.IP \(bu 2
\fBfish_indent\fP can now produce colorized (\fB\-\-ansi\fP) and HTML
(\fB\-\-html\fP) output (#1827 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1827>).
.IP \(bu 2
\fBfunctions \-\-erase\fP now prevents autoloaded functions from being
reloaded in the current session.
.IP \(bu 2
\fBhistory\fP has a new \fB\-\-merge\fP option, to incorporate history from
other sessions into the current session (#825 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:825>).
.IP \(bu 2
\fBjobs\fP returns 1 if there are no active jobs (#1484 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1484>).
.IP \(bu 2
\fBread\fP has several new options:
.IP \(bu 2
\fB\-\-array\fP to break input into an array (#1540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1540>)
.IP \(bu 2
\fB\-\-null\fP to break lines on NUL characters rather than newlines
(#1694 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1694>)
.IP \(bu 2
\fB\-\-nchars\fP to read a specific number of characters (#1616 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1616>)
.IP \(bu 2
\fB\-\-right\-prompt\fP to display a right\-hand\-side prompt during
interactive read (#1698 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1698>).
.IP \(bu 2
\fBtype\fP has a new \fB\-q\fP option to suppress output (#1540 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1540> and, like
other shells, \fBtype \-a\fP now prints all matches for a command
(#261 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:261>).
.IP \(bu 2
Pressing \fBf1\fP now shows the manual page for the current command
(#1063 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1063>).
.IP \(bu 2
\fBfish_title\fP functions have access to the arguments of the
currently running argument as \fB$argv[1]\fP (#1542 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1542>).
.IP \(bu 2
The OS command\-not\-found handler is used on Arch Linux (#1925 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1925>), nixOS
(#1852 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1852>), openSUSE and Fedora (#1280 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1280>).
.IP \(bu 2
\fBAlt\fP+\fB\&.\fP searches backwards in the token history, mapping to
the same behavior as inserting the last argument of the previous
command, like other shells (#89 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/89>).
.IP \(bu 2
The \fBSHLVL\fP environment variable is incremented correctly (#1634 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1634> &
#1693 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1693>).
.IP \(bu 2
Added completions for \fBadb\fP (#1165 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1165> & #1211 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1211>), \fBapt\fP (#2018 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2018>),
\fBaura\fP (#1292 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1292>), \fBcomposer\fP (#1607 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1607>), \fBcygport\fP (#1841 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1841>),
\fBdropbox\fP (#1533 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1533>), \fBelixir\fP (#1167 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1167>), \fBfossil\fP, \fBheroku\fP
(#1790 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1790>), \fBiex\fP (#1167 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1167>), \fBkitchen\fP (#2000 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:2000>), \fBnix\fP (#1167 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1167>),
\fBnode\fP/\fBnpm\fP (#1566 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1566>), \fBopam\fP (#1615 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1615>), \fBsetfacl\fP (#1752 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1752>),
\fBtmuxinator\fP (#1863 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1863>), and \fByast2\fP (#1739 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1739>).
.IP \(bu 2
Improved completions for \fBbrew\fP (#1090 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1090> & #1810 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1810>), \fBbundler\fP
(#1779 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1779>), \fBcd\fP (#1135 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1135>), \fBemerge\fP (#1840 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1840>),\fBgit\fP (#1680 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1680>, #1834 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1834> &
#1951 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1951>), \fBman\fP (#960 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:960>), \fBmodprobe\fP (#1124 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1124>), \fBpacman\fP (#1292 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1292>),
\fBrpm\fP (#1236 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1236>), \fBrsync\fP (#1872 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1872>), \fBscp\fP (#1145 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1145>), \fBssh\fP (#1234 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1234>),
\fBsshfs\fP (#1268 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1268>), \fBsystemctl\fP (#1462 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1462>, #1950 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1950> & #1972 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1972>), \fBtmux\fP
(#1853 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1853>), \fBvagrant\fP (#1748 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1748>), \fByum\fP (#1269 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1269>), and \fBzypper\fP
(#1787 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1787>).
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.1.2 (released Feb 24, 2015)
.sp
fish 2.1.2 contains a workaround for a filesystem bug in Mac OS X
Yosemite. #1859 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1859>
.sp
Specifically, after installing fish 2.1.1 and then rebooting, “Verify
Disk” in Disk Utility will report “Invalid number of hard links.” We
don’t have any reports of data loss or other adverse consequences. fish
2.1.2 avoids triggering the bug, but does not repair an already affected
filesystem. To repair the filesystem, you can boot into Recovery Mode
and use Repair Disk from Disk Utility. Linux and versions of OS X prior
to Yosemite are believed to be unaffected.
.sp
There are no other changes in this release.

.sp
.ce
----

.ce 0
.sp
.SS fish 2.1.1 (released September 26, 2014)
.sp
\fBImportant:\fP if you are upgrading, stop all running instances of
\fBfishd\fP as soon as possible after installing this release; it will be
restarted automatically. On most systems, there will be no further
action required. Note that some environments (where \fBXDG_RUNTIME_DIR\fP
is set), such as Fedora 20, will require a restart of all running fish
processes before universal variables work as intended.
.sp
Distributors are highly encouraged to call \fBkillall fishd\fP,
\fBpkill fishd\fP or similar in installation scripts, or to warn their
users to do so.
.SS Security fixes
.INDENT 0.0
.IP \(bu 2
The fish_config web interface now uses an authentication token to
protect requests and only responds to requests from the local machine
with this token, preventing a remote code execution attack. (closing
CVE\-2014\-2914). #1438 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1438>
.IP \(bu 2
\fBpsub\fP and \fBfunced\fP are no longer vulnerable to attacks which
allow local privilege escalation and data tampering (closing
CVE\-2014\-2906 and CVE\-2014\-3856). #1437 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1437>
.IP \(bu 2
\fBfishd\fP uses a secure path for its socket, preventing a local
privilege escalation attack (closing CVE\-2014\-2905). #1436 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1436>
.IP \(bu 2
\fB__fish_print_packages\fP is no longer vulnerable to attacks which
would allow local privilege escalation and data tampering (closing
CVE\-2014\-3219). #1440 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1440>
.UNINDENT
.SS Other fixes
.INDENT 0.0
.IP \(bu 2
\fBfishd\fP now ignores SIGPIPE, fixing crashes using tools like GNU
Parallel and which occurred more often as a result of the other
\fBfishd\fP changes. #1084 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1084> & #1690 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1690>
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.1.0
.SS Significant Changes
.INDENT 0.0
.IP \(bu 2
\fBTab completions will fuzzy\-match files.\fP #568 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:568>
.sp
When tab\-completing a file, fish will first attempt prefix matches
(\fBfoo\fP matches \fBfoobar\fP), then substring matches (\fBooba\fP
matches \fBfoobar\fP), and lastly subsequence matches (\fBfbr\fP matches
\fBfoobar\fP). For example, in a directory with files foo1.txt,
foo2.txt, foo3.txt…, you can type only the numeric part and hit tab
to fill in the rest.
.sp
This feature is implemented for files and executables. It is not yet
implemented for options (like \fB\-\-foobar\fP), and not yet implemented
across path components (like \fB/u/l/b\fP to match \fB/usr/local/bin\fP).
.IP \(bu 2
\fBRedirections now work better across pipelines.\fP #110 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:110>, #877 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:877>
.sp
In particular, you can pipe stderr and stdout together, for example,
with \fBcmd ^&1 | tee log.txt\fP, or the more familiar
\fBcmd 2>&1 | tee log.txt\fP\&.
.IP \(bu 2
\fBA single \(ga\(ga%\(ga\(ga now expands to the last job backgrounded.\fP #1008 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:1008>
.sp
Previously, a single \fB%\fP would pid\-expand to either all
backgrounded jobs, or all jobs owned by your user. Now it expands to
the last job backgrounded. If no job is in the background, it will
fail to expand. In particular, \fBfg %\fP can be used to put the most
recent background job in the foreground.
.UNINDENT
.SS Other Notable Fixes
.INDENT 0.0
.IP \(bu 2
alt\-U and alt+C now uppercase and capitalize words, respectively.
#995 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:995>
.IP \(bu 2
VTE based terminals should now know the working directory. #906 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:906>
.IP \(bu 2
The autotools build now works on Mavericks. #968 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:968>
.IP \(bu 2
The end\-of\-line binding (ctrl+E) now accepts autosuggestions. #932 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:932>
.IP \(bu 2
Directories in \fB/etc/paths\fP (used on OS X) are now prepended
instead of appended, similar to other shells. #927 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:927>
.IP \(bu 2
Option\-right\-arrow (used for partial autosuggestion completion) now
works on iTerm2. #920 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:920>
.IP \(bu 2
Tab completions now work properly within nested subcommands. #913 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:913>
.IP \(bu 2
\fBprintf\fP supports \fB\ee\fP, the escape character. #910 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:910>
.IP \(bu 2
\fBfish_config history\fP no longer shows duplicate items. #900 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:900>
.IP \(bu 2
\fB$fish_user_paths\fP is now prepended to $PATH instead of appended.
#888 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:888>
.IP \(bu 2
Jobs complete when all processes complete. #876 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:876>
.sp
For example, in previous versions of fish, \fBsleep 10 | echo Done\fP
returns control immediately, because echo does not read from stdin.
Now it does not complete until sleep exits (presumably after 10
seconds).
.IP \(bu 2
Better error reporting for square brackets. #875 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:875>
.IP \(bu 2
fish no longer tries to add \fB/bin\fP to \fB$PATH\fP unless PATH is
totally empty. #852 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:852>
.IP \(bu 2
History token substitution (alt\-up) now works correctly inside
subshells. #833 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:833>
.IP \(bu 2
Flow control is now disabled, freeing up ctrl\-S and ctrl\-Q for other
uses. #814 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:814>
.IP \(bu 2
sh\-style variable setting like \fBfoo=bar\fP now produces better error
messages. #809 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:809>
.IP \(bu 2
Commands with wildcards no longer produce autosuggestions. #785 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:785>
.IP \(bu 2
funced no longer freaks out when supplied with no arguments. #780 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:780>
.IP \(bu 2
fish.app now works correctly in a directory containing spaces. #774 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:774>
.IP \(bu 2
Tab completion cycling no longer occasionally fails to repaint. #765 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:765>
.IP \(bu 2
Comments now work in eval’d strings. #684 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:684>
.IP \(bu 2
History search (up\-arrow) now shows the item matching the
autosuggestion, if that autosuggestion was truncated. #650 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:650>
.IP \(bu 2
Ctrl\-T now transposes characters, as in other shells. #128 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:128>
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fish 2.0.0
.SS Significant Changes
.INDENT 0.0
.IP \(bu 2
\fBCommand substitutions now modify \(ga\(ga$status\(ga\(ga :issue:\(ga547\(ga.\fP Previously the
exit status of command substitutions (like \fB(pwd)\fP) was ignored;
however now it modifies $status. Furthermore, the \fBset\fP command now
only sets $status on failure; it is untouched on success. This allows
for the following pattern:
.INDENT 2.0
.INDENT 3.5
.sp
.EX
if set python_path (which python)
   ...
end
.EE
.UNINDENT
.UNINDENT
.sp
Because set does not modify $status on success, the if branch
effectively tests whether \fBwhich\fP succeeded, and if so, whether the
\fBset\fP also succeeded.
.IP \(bu 2
Improvements to PATH handling. There is a new variable, fish_user_paths,
which can be set universally, and whose contents are appended to
$PATH #527 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:527>
.INDENT 2.0
.IP \(bu 2
/etc/paths and /etc/paths.d are now respected on OS X
.IP \(bu 2
fish no longer modifies $PATH to find its own binaries
.UNINDENT
.IP \(bu 2
\fBLong lines no longer use ellipsis for line breaks\fP, and copy and
paste should no longer include a newline even if the line was broken
#300 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:300>
.IP \(bu 2
\fBNew syntax for index ranges\fP (sometimes known as “slices”) #212 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:212>
.IP \(bu 2
\fBfish now supports an \(ga\(gaelse if\(ga\(ga statement\fP #134 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:134>
.IP \(bu 2
\fBProcess and pid completion now works on OS X\fP #129 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:129>
.IP \(bu 2
\fBfish is now relocatable\fP, and no longer depends on compiled\-in
paths #125 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:125>
.IP \(bu 2
\fBfish now supports a right prompt (RPROMPT)\fP through the
fish_right_prompt function #80 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/80>
.IP \(bu 2
\fBfish now uses posix_spawn instead of fork when possible\fP, which is
much faster on BSD and OS X #11 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/11>
.UNINDENT
.SS Other Notable Fixes
.INDENT 0.0
.IP \(bu 2
Updated VCS completions (darcs, cvs, svn, etc.)
.IP \(bu 2
Avoid calling getcwd on the main thread, as it can hang #696 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:696>
.IP \(bu 2
Control\-D (forward delete) no longer stops at a period #667 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:667>
.IP \(bu 2
Completions for many new commands
.IP \(bu 2
fish now respects rxvt’s unique keybindings #657 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:657>
.IP \(bu 2
xsel is no longer built as part of fish. It will still be invoked if
installed separately #633 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:633>
.IP \(bu 2
__fish_filter_mime no longer spews #628 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:628>
.IP \(bu 2
The –no\-execute option to fish no longer falls over when reaching the
end of a block #624 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:624>
.IP \(bu 2
fish_config knows how to find fish even if it’s not in the $PATH #621 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:621>
.IP \(bu 2
A leading space now prevents writing to history, as is done in bash
and zsh #615 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:615>
.IP \(bu 2
Hitting enter after a backslash only goes to a new line if it is
followed by whitespace or the end of the line #613 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:613>
.IP \(bu 2
printf is now a builtin #611 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:611>
.IP \(bu 2
Event handlers should no longer fire if signals are blocked #608 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:608>
.IP \(bu 2
set_color is now a builtin #578 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:578>
.IP \(bu 2
man page completions are now located in a new generated_completions
directory, instead of your completions directory #576 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:576>
.IP \(bu 2
tab now clears autosuggestions #561 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:561>
.IP \(bu 2
tab completion from within a pair of quotes now attempts to
“appropriate” the closing quote #552 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:552>
.IP \(bu 2
$EDITOR can now be a list: for example, \fBset EDITOR gvim \-f\fP) #541 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:541>
.IP \(bu 2
\fBcase\fP bodies are now indented #530 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:530>
.IP \(bu 2
The profile switch \fB\-p\fP no longer crashes #517 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:517>
.IP \(bu 2
You can now control\-C out of \fBread\fP #516 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:516>
.IP \(bu 2
\fBumask\fP is now functional on OS X #515 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:515>
.IP \(bu 2
Avoid calling getpwnam on the main thread, as it can hang #512 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:512>
.IP \(bu 2
Alt\-F or Alt\-right\-arrow (Option\-F or option\-right\-arrow) now accepts
one word of an autosuggestion #435 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:435>
.IP \(bu 2
Setting fish as your login shell no longer kills OpenSUSE #367 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:367>
.IP \(bu 2
Backslashes now join lines, instead of creating multiple commands
#347 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:347>
.IP \(bu 2
echo now implements the \-e flag to interpret escapes #337 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:337>
.IP \(bu 2
When the last token in the user’s input contains capital letters, use
its case in preference to that of the autosuggestion #335 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:335>
.IP \(bu 2
Descriptions now have their own muted color #279 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:279>
.IP \(bu 2
Wildcards beginning with a . (for example, \fBls .*\fP) no longer match
\&. and .. #270 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:270>
.IP \(bu 2
Recursive wildcards now handle symlink loops #268 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:268>
.IP \(bu 2
You can now delete history items from the fish_config web interface
#250 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:250>
.IP \(bu 2
The OS X build now weak links \fBwcsdup\fP and \fBwcscasecmp\fP #240 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:240>
.IP \(bu 2
fish now saves and restores the process group, which prevents certain
processes from being erroneously reported as stopped #197 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:197>
.IP \(bu 2
funced now takes an editor option #187 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:187>
.IP \(bu 2
Alternating row colors are available in fish pager through
\fBfish_pager_color_secondary\fP #186 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:186>
.IP \(bu 2
Universal variable values are now stored based on your MAC address,
not your hostname #183 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:183>
.IP \(bu 2
The caret ^ now only does a stderr redirection if it is the first
character of a token, making git users happy #168 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:168>
.IP \(bu 2
Autosuggestions will no longer cause line wrapping #167 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:167>
.IP \(bu 2
Better handling of Unicode combining characters #155 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:155>
.IP \(bu 2
fish SIGHUPs processes more often #138 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:138>
.IP \(bu 2
fish no longer causes \fBsudo\fP to ask for a password every time
.IP \(bu 2
fish behaves better under Midnight Commander #121 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:121>
.IP \(bu 2
\fBset \-e\fP no longer crashes #100 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/\:100>
.IP \(bu 2
fish now will automatically import history from bash, if there is no
fish history #66 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/66>
.IP \(bu 2
Backslashed\-newlines inside quoted strings now behave more
intuitively #52 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/52>
.IP \(bu 2
Tab titles should be shown correctly in iTerm2 #47 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/47>
.IP \(bu 2
scp remote path completion now sometimes works #42 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/42>
.IP \(bu 2
The \fBread\fP builtin no longer shows autosuggestions #29 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/29>
.IP \(bu 2
Custom key bindings can now be set via the \fBfish_user_key_bindings\fP
function #21 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/21>
.IP \(bu 2
All Python scripts now run correctly under both Python 2 and Python 3
#14 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/14>
.IP \(bu 2
The “accept autosuggestion” key can now be configured #19 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/19>
.IP \(bu 2
Autosuggestions will no longer suggest invalid commands #6 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/6>
.UNINDENT

.sp
.ce
----

.ce 0
.sp
.SS fishfish Beta r2
.SS Bug Fixes
.INDENT 0.0
.IP \(bu 2
\fBImplicit cd\fP is back, for paths that start with one or two dots, a
slash, or a tilde.
.IP \(bu 2
\fBOverrides of default functions should be fixed.\fP The “internalized
scripts” feature is disabled for now.
.IP \(bu 2
\fBDisabled delayed suspend.\fP This is a strange job\-control feature
of BSD systems, including OS X. Disabling it frees up Control Y for
other purposes; in particular, for yank, which now works on OS X.
.IP \(bu 2
\fBfish_indent is fixed.\fP In particular, the \fBfunced\fP and
\fBfuncsave\fP functions work again.
.IP \(bu 2
A SIGTERM now ends the whole execution stack again (resolving #13 \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:issues/13>).
.IP \(bu 2
Bumped the __fish_config_interactive version number so the default
fish_color_autosuggestion kicks in.
.IP \(bu 2
fish_config better handles combined term256 and classic colors like
“555 yellow”.
.UNINDENT
.SS New Features
.INDENT 0.0
.IP \(bu 2
\fBA history builtin\fP, and associated interactive function that
enables deleting history items. Example usage: * Print all history
items beginning with echo: \fBhistory \-\-prefix echo\fP * Print all
history items containing foo: \fBhistory \-\-contains foo\fP *
Interactively delete some items containing foo:
\fBhistory \-\-delete \-\-contains foo\fP
.UNINDENT
.sp
Credit to @siteshwar for implementation. Thanks @siteshwar!

.sp
.ce
----

.ce 0
.sp
.SS fishfish Beta r1
.SS Scripting
.INDENT 0.0
.IP \(bu 2
No changes! All existing fish scripts, config files, completions,
etc. from trunk should continue to work.
.UNINDENT
.SS New Features
.INDENT 0.0
.IP \(bu 2
\fBAutosuggestions\fP\&. Think URL fields in browsers. When you type a
command, fish will suggest the rest of the command after the cursor,
in a muted gray when possible. You can accept the suggestion with the
right arrow key or Ctrl\-F. Suggestions come from command history,
completions, and some custom code for cd; there’s a lot of potential
for improvement here. The suggestions are computed on a background
pthread, so they never slow down your typing. The autosuggestion
feature is incredible. I miss it dearly every time I use anything
else.
.IP \(bu 2
\fBterm256 support\fP where available, specifically modern xterms and
OS X Lion. You can specify colors the old way (‘set_color cyan’) or
by specifying RGB hex values (‘set_color FF3333’); fish will pick the
closest supported color. Some xterms do not advertise term256 support
either in the $TERM or terminfo max_colors field, but nevertheless
support it. For that reason, fish will default into using it on any
xterm (but it can be disabled with an environment variable).
.IP \(bu 2
\fBWeb\-based configuration\fP page. There is a new function
‘fish_config’. This spins up a simple Python web server and opens a
browser window to it. From this web page, you can set your shell
colors and view your functions, variables, and history; all changes
apply immediately to all running shells. Eventually all configuration
ought to be supported via this mechanism (but in addition to, not
instead of, command line mechanisms).
.IP \(bu 2
\fBMan page completions\fP\&. There is a new function
‘fish_update_completions’. This function reads all the man1 files
from your manpath, removes the roff formatting, parses them to find
the commands and options, and outputs fish completions into
~/.config/fish/completions. It won’t overwrite existing completion
files (except ones that it generated itself).
.UNINDENT
.SS Programmatic Changes
.INDENT 0.0
.IP \(bu 2
fish is now entirely in C++. I have no particular love for C++, but
it provides a ready memory\-model to replace halloc. We’ve made an
effort to keep it to a sane and portable subset (no C++11, no boost,
no going crazy with templates or smart pointers), but we do use the
STL and a little tr1.
.IP \(bu 2
halloc is entirely gone, replaced by normal C++ ownership semantics.
If you don’t know what halloc is, well, now you have two reasons to
be happy.
.IP \(bu 2
All the crufty C data structures are entirely gone. array_list_t,
priority_queue_t, hash_table_t, string_buffer_t have been removed and
replaced by STL equivalents like std::vector, std::map, and
std::wstring. A lot of the string handling now uses std::wstring
instead of wchar_t *
.IP \(bu 2
fish now spawns pthreads for tasks like syntax highlighting that
require blocking I/O.
.IP \(bu 2
History has been completely rewritten. History files now use an
extensible YAML\-style syntax. History “merging” (multiple shells
writing to the same history file) now works better. There is now a
maximum history length of about 250k items (256 * 1024).
.IP \(bu 2
The parser has been “instanced,” so you can now create more than one.
.IP \(bu 2
Total #LoC has shrunk slightly even with the new features.
.UNINDENT
.SS Performance
.INDENT 0.0
.IP \(bu 2
fish now runs syntax highlighting in a background thread, so typing
commands is always responsive even on slow filesystems.
.IP \(bu 2
echo, test, and pwd are now builtins, which eliminates many forks.
.IP \(bu 2
The files in share/functions and share/completions now get
‘internalized’ into C strings that get compiled in with fish. This
substantially reduces the number of files touched at startup. A
consequence is that you cannot change these functions without
recompiling, but often other functions depend on these “standard”
functions, so changing them is perhaps not a good idea anyways.
.UNINDENT
.sp
Here are some system call counts for launching and then exiting fish
with the default configuration, on OS X. The first column is fish trunk,
the next column is with our changes, and the last column is bash for
comparison. This data was collected via dtrace.
.sp
before
.sp
after
.sp
bash
.sp
open
.sp
9
.sp
4
.sp
5
.sp
fork
.sp
28
.sp
14
.sp
0
.sp
stat
.sp
131
.sp
85
.sp
11
.sp
lstat
.sp
670
.sp
0
.sp
0
.sp
read
.sp
332
.sp
80
.sp
4
.sp
write
.sp
172
.sp
149
.sp
0
.sp
The large number of forks relative to bash are due to fish’s insanely
expensive default prompt, which is unchanged in my version. If we switch
to a prompt comparable to bash’s (lame) default, the forks drop to 16
with trunk, 4 after our changes.
.sp
The large reduction in lstat() numbers is due to fish no longer needing
to call ttyname() on OS X.
.sp
We’ve got some work to do to be as lean as bash, but we’re on the right
track.
.SS Terminal Compatibility
.sp
fish writes various control sequences to the terminal.
Some must be implemented to enable basic functionality,
while others enable optional features and may be ignored by the terminal.
.sp
The terminal must be able to parse Control Sequence Introducer (CSI) commands, Operating System Commands (OSC) and optionally Device Control Strings (DCS).
These are defined by ECMA\-48.
If a valid CSI, OSC or DCS sequence does not represent a command implemented by the terminal, the terminal must ignore it.
For historical reasons, OSC sequences may be terminated with \fB\ex07\fP instead of \fB\ee\e\e\fP\&.
.sp
Control sequences are denoted in a fish\-like syntax.
Special characters other than \fB\e\fP are not escaped.
Spaces are only added for readability and are not part of the sequence.
Placeholders are written as \fBPs\fP for a number or \fBPt\fP for an arbitrary printable string.
.sp
\fBNOTE:\fP fish does not rely on your system\(aqs terminfo database.
In this document, terminfo (TI) codes are included for reference only.
.SS Required Commands
.TS
box center;
l|l|l.
T{
Sequence
T}	T{
TI
T}	T{
Description
T}
_
T{
\fB\er\fP
T}	T{
n/a
T}	T{
Move cursor to the beginning of the line
T}
_
T{
\fB\en\fP
T}	T{
cud1
T}	T{
Move cursor down one line.
T}
_
T{
\fB\ee[\ Ps\ A\fP
T}	T{
cuu
T}	T{
Move cursor up Ps columns, or one column if no parameter.
T}
_
T{
\fB\ee[\ Ps\ C\fP
T}	T{
cuf
T}	T{
Move cursor to the right Ps columns, or one column if no parameter.
T}
_
T{
\fB\ex08\fP
T}	T{
cub1
T}	T{
Move cursor one column to the left.
T}
_
T{
\fB\ee[\ Ps\ D\fP
T}	T{
cub
T}	T{
Move cursor to the left Ps times.
T}
_
T{
\fB\ee[H\fP
T}	T{
cup
T}	T{
Set cursor position (no parameters means: move to row 1, column 1).
T}
_
T{
\fB\ee[K\fP
T}	T{
el
T}	T{
Clear to end of line.
T}
_
T{
\fB\ee[J\fP
T}	T{
ed
T}	T{
Clear to the end of screen.
T}
_
T{
\fB\ee[2J\fP
T}	T{
clear
T}	T{
Clear the screen.
T}
_
T{
\fB\ee[0c\fP
T}	T{
T}	T{
Request Primary Device Attribute.
The terminal must respond with a CSI command that starts with the \fB?\fP parameter byte (so a sequence starting with \fB\ee[?\fP) and has \fBc\fP as final byte.
.sp
Failure to implement this will cause a brief pause at startup followed by a warning.
For the time being, both can be turned off by turning off the \fBquery\-terminal\fP feature flag \%<#\:featureflags>\&.
T}
_
T{
n/a
T}	T{
am
T}	T{
Soft wrap text at screen width.
T}
_
T{
n/a
T}	T{
xenl
T}	T{
Printing to the last column does not move the cursor to the next line.
Verify this by running \fBprintf %0\(dq$COLUMNS\(dqd 0; sleep 3\fP
T}
.TE
.SS Optional Commands
.TS
box center;
l|l|l.
T{
Sequence
T}	T{
TI
T}	T{
Description
T}
_
T{
\fB\et\fP
T}	T{
it
T}	T{
Move the cursor to the next tab stop (à 8 columns).
This is mainly relevant if your prompt includes tabs.
T}
_
T{
\fB\ee[m\fP
T}	T{
sgr0
T}	T{
Turn off bold/dim/italic/underline/strikethrough/reverse attribute modes and select default colors.
T}
_
T{
\fB\ee[1m\fP
T}	T{
bold
T}	T{
Enter bold mode.
T}
_
T{
\fB\ee[2m\fP
T}	T{
dim
T}	T{
Enter dim mode.
T}
_
T{
\fB\ee[3m\fP
T}	T{
sitm
T}	T{
Enter italic mode.
T}
_
T{
\fB\ee[4m\fP
T}	T{
smul
T}	T{
Enter underline mode.
T}
_
T{
\fB\ee[4:2m\fP
T}	T{
Su
T}	T{
Enter double underline mode.
T}
_
T{
\fB\ee[4:3m\fP
T}	T{
Su
T}	T{
Enter curly underline mode.
T}
_
T{
\fB\ee[4:4m\fP
T}	T{
Su
T}	T{
Enter dotted underline mode.
T}
_
T{
\fB\ee[4:5m\fP
T}	T{
Su
T}	T{
Enter dashed underline mode.
T}
_
T{
\fB\ee[7m\fP
T}	T{
rev
T}	T{
Enter reverse video mode (swap foreground and background colors).
T}
_
T{
\fB\ee[9m\fP
T}	T{
smxx
T}	T{
Enter strikethrough mode
T}
_
T{
\fB\ee[23m\fP
T}	T{
ritm
T}	T{
Exit italic mode.
T}
_
T{
\fB\ee[24m\fP
T}	T{
rmul
T}	T{
Exit underline mode.
T}
_
T{
\fB\ee[29m\fP
T}	T{
rmxx
T}	T{
Exit strikethrough mode.
T}
_
T{
\fB\ee[38;5; Ps m\fP
T}	T{
setaf
T}	T{
Select foreground color Ps from the 256\-color\-palette.
T}
_
T{
\fB\ee[48;5; Ps m\fP
T}	T{
setab
T}	T{
Select background color Ps from the 256\-color\-palette.
T}
_
T{
\fB\ee[58:5: Ps m\fP (note: colons not semicolons)
T}	T{
Su
T}	T{
Select underline color Ps from the 256\-color\-palette.
T}
_
T{
\fB\ee[ Ps m\fP
T}	T{
setaf
setab
T}	T{
Select foreground/background color. This uses a color in the aforementioned 256\-color\-palette, based on the range that contains the parameter:
30\-37 maps to foreground 0\-7,
40\-47 maps to background 0\-7,
90\-97 maps to foreground 8\-15 and
100\-107 maps to background 8\-15.
T}
_
T{
\fB\ee[38;2; Ps ; Ps ; Ps m\fP
T}	T{
T}	T{
Select foreground color from 24\-bit RGB colors.
T}
_
T{
\fB\ee[48;2; Ps ; Ps ; Ps m\fP
T}	T{
T}	T{
Select background color from 24\-bit RGB colors.
T}
_
T{
\fB\ee[39m\fP
T}	T{
T}	T{
Reset foreground color to the terminal\(aqs default.
T}
_
T{
\fB\ee[49m\fP
T}	T{
T}	T{
Reset background color to the terminal\(aqs default.
T}
_
T{
\fB\ee[58:2:: Ps : Ps : Ps m\fP (note: colons not semicolons)
T}	T{
Su
T}	T{
Select underline color from 24\-bit RGB colors.
T}
_
T{
\fB\ee[59m\fP
T}	T{
Su
T}	T{
Reset underline color to the default (follow the foreground color).
T}
_
T{
\fB\ee[ Ps S\fP
T}	T{
indn
T}	T{
Scroll up the content (not the viewport) Ps lines (called \fBSCROLL UP\fP / \fBSU\fP by ECMA\-48 and \(dqscroll forward\(dq by terminfo).
When fish detects support for this feature, status test\-terminal\-features scroll\-content\-up \%<#\:status-test-terminal-features> will return 0,
which enables the \fBctrl\fP\-\fBl\fP binding to use the scrollback\-push \%<#\:special-input-functions-scrollback-push> special input function.
T}
_
T{
\fB\ee[= Ps u\fP, \fB\ee[? Ps u\fP
T}	T{
n/a
T}	T{
Enable the kitty keyboard protocol.
T}
_
T{
\fB\ee[6n\fP
T}	T{
n/a
T}	T{
Request cursor position report.
The response must be of the form \fB\ee[ Ps ; Ps R\fP
where the first parameter is the row number
and the second parameter is the column number.
Both start at 1.
.sp
This is used for truncating multiline autosuggestions at the screen\(aqs bottom edge,
by the scrollback\-push \%<#\:special-input-functions-scrollback-push> special input function,
and inside terminals that implement the OSC 133 click_events feature.
T}
_
T{
\fB\ee[ \ex20 q\fP
T}	T{
Se
T}	T{
Reset cursor style to the terminal\(aqs default. This is not used as of today but may be
in future.
T}
_
T{
\fB\ee[ Ps \ex20 q\fP
T}	T{
Ss
T}	T{
Set cursor style (DECSCUSR); Ps is 2, 4 or 6 for block, underscore or line shape.
T}
_
T{
\fB\ee[ Ps q\fP
T}	T{
n/a
T}	T{
Request terminal name and version (XTVERSION).
This is only used for temporary workarounds for incompatible terminals.
T}
_
T{
\fB\ee[?25h\fP
T}	T{
cvvis
T}	T{
Enable cursor visibility (DECTCEM).
T}
_
T{
\fB\ee[?1004h\fP
T}	T{
n/a
T}	T{
Enable focus reporting.
T}
_
T{
\fB\ee[?1004l\fP
T}	T{
n/a
T}	T{
Disable focus reporting.
T}
_
T{
\fB\ee[?1049h\fP
T}	T{
n/a
T}	T{
Enable alternate screen buffer.
T}
_
T{
\fB\ee[?1049l\fP
T}	T{
n/a
T}	T{
Disable alternate screen buffer.
T}
_
T{
\fB\ee[?2004h\fP
T}	T{
T}	T{
Enable bracketed paste.
T}
_
T{
\fB\ee[?2004l\fP
T}	T{
T}	T{
Disable bracketed paste.
T}
_
T{
\fB\ee[?2031h\fP
T}	T{
T}	T{
Enable unsolicited color theme reporting \%<https://\:contour-terminal\:.org/\:vt-extensions/\:color-palette-update-notifications/>\&.
When enabled, the terminal should send \fB\ee[?997;1n\fP or \fB\ee[?997;2n\fP whenever its color theme has changed.
This prompts fish to query for background color\&.
T}
_
T{
\fB\ee[?2031l\fP
T}	T{
T}	T{
Disable unsolicited color theme reporting.
T}
_
T{
\fB\ee]0; Pt \ee\e\e\fP
T}	T{
ts
T}	T{
Set terminal window title (OSC 0). Used in fish_title \%<>\&.
T}
_
T{
\fB\ee]2; Pt \ee\e\e\fP
T}	T{
ts
T}	T{
Set terminal tab title (OSC 1). Used in fish_tab_title \%<>\&.
T}
_
T{
\fB\ee]7;file:// Pt / Pt \ee\e\e\fP
T}	T{
T}	T{
Report working directory (OSC 7).
Since the terminal may be running on a different system than a (remote) shell,
the hostname (first parameter) will \fInot\fP be \fBlocalhost\fP\&.
T}
_
T{
\fB\ee]8;; Pt \ee\e\e\fP
T}	T{
T}	T{
Create a hyperlink (OSC 8) \%<https://\:gist\:.github\:.com/\:egmontkob/\:eb114294efbcd5adb1944c9f3cb5feda>\&.
This is used in fish\(aqs man pages.
T}
_
T{
\fB\ee]11;?\ee\e\e\fP
T}	T{
n/a
T}	T{
Query background color.
.sp
A valid response would be of the form \fB\ee]11;rgb: Pt / Pt / Pt \ee\e\e\fP or \fB\ee]11;rgba: Pt / Pt / Pt / Pt\ee\e\e\fP
where the first three parameters consist of one to four hex digits each, representing red, blue and green components.
.sp
This is used to populate \fBfish_terminal_color_theme\fP \%<#\:envvar-fish_terminal_color_theme>,
which is used to select a theme variant \%<#\:fish-config-theme-files> optimized for the terminal\(aqs color theme.
T}
_
T{
\fB\ee]52;c; Pt \ee\e\e\fP
T}	T{
T}	T{
Copy to clipboard (OSC 52). Used by fish_clipboard_copy \%<>\&.
T}
_
T{
\fB\ee]133;A; click_events=1\ee\e\e\fP
T}	T{
T}	T{
Mark prompt start (OSC 133), with kitty\(aqs \fBclick_events\fP extension.
The \fBclick_events\fP extension enables mouse clicks to move the cursor or select pager items,
assuming that cursor position reporting is available.
T}
_
T{
\fB\ee]133;B\ee\e\e\fP
T}	T{
T}	T{
Mark prompt end (OSC 133).
T}
_
T{
\fB\ee]133;C; cmdline_url= Pt \ee\e\e\fP
T}	T{
T}	T{
Mark command start (OSC 133), with kitty\(aqs \fBcmdline_url\fP extension whose parameter is the URL\-encoded command line.
T}
_
T{
\fB\ee]133;D; Ps \ee\e\e\fP
T}	T{
T}	T{
Mark command end (OSC 133);  Ps is the exit status.
T}
_
T{
\fB\eeP+q Pt \ee\e\e\fP
T}	T{
T}	T{
Request terminfo capability (XTGETTCAP).
The parameter is the capability\(aqs hex\-encoded terminfo code.
.sp
The response must be of the form
\fB\eeP1+q Pt \ee\e\e\fP (\(dqboolean\(dq) or \fB\eeP1+q Pt = Pt \ee\e\e\fP (\(dqstring\(dq).
In either variant, the first parameter must be the same as the request parameter.
.sp
fish queries the following string capabilities:
.INDENT 0.0
.IP \(bu 2
indn
.sp
The response\(aqs second parameter is ignored.
.IP \(bu 2
\fBquery\-os\-name\fP (for status terminal\-os \%<#\:status-terminal-os>)
.sp
Terminals running on Unix should respond with the hex encoding of \fB$(uname \-s)\fP as second parameter.
.UNINDENT
T}
.TE
.SS DCS commands and GNU screen
.sp
DCS parsing is optional because fish temporarily switches to the alternate screen before printing any DCS commands.
However, since GNU screen neither allows turning on the alternate screen buffer by default,
nor treats DCS commands in a compatible way,
fish\(aqs initial prompt may be garbled by a DCS payload like \fB+q696e646e\fP\&.
For the time being, fish works around this by checking for presence of the \fBSTY\fP environment variable.
If that doesn\(aqt work for some reason, you can add this to your \fB~/.screenrc\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
altscreen on
.EE
.UNINDENT
.UNINDENT
.sp
Or add this to your \fBconfig.fish\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
function GNU\-screen\-workaround \-\-on\-event fish_prompt
    commandline \-f repaint
    functions \-\-erase GNU\-screen\-workaround
end
.EE
.UNINDENT
.UNINDENT
.SS Unicode Codepoints
.sp
By default, fish outputs the following non\-ASCII characters:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
× ► ¶ ⏎ • ● … μ – ’ ‘ “ ” ← → ↑ ↓
.EE
.UNINDENT
.UNINDENT
.sp
as well as control pictures (U+2400 through U+241F),
and locale\-specific ones in translated strings \%<#\:variables-locale>\&.
.SS Contributing To Fish
.sp
This document tells you how you can contribute to fish.
.sp
Fish is free and open source software, distributed under the terms of the GPLv2.
.sp
Contributions are welcome, and there are many ways to contribute!
.sp
Whether you want to change some of the core Rust source, enhance or add a completion script or function,
improve the documentation or translate something, this document will tell you how.
.SS Mailing List
.sp
Send patches to the public mailing list: \%<mailto:~krobelus/\:fish-shell@\:lists\:.sr\:.ht>\&.
Archives are available at \%<https://\:lists\:.sr\:.ht/\:~krobelus/\:fish-shell/>\&.
.SS GitHub
.sp
Fish is available on GitHub, at \%<https://\:github\:.com/\:fish-shell/\:fish-shell>\&.
.sp
First, you\(aqll need an account there, and you\(aqll need a git clone of fish.
Fork it on GitHub and then run:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
git clone https://github.com/<USERNAME>/fish\-shell.git
.EE
.UNINDENT
.UNINDENT
.sp
This will create a copy of the fish repository in the directory fish\-shell in your current working directory.
.sp
Also, for most changes you want to run the tests and so you\(aqd get a setup to compile fish.
For that, you\(aqll require:
.INDENT 0.0
.IP \(bu 2
Rust \- when in doubt, try rustup
.IP \(bu 2
CMake
.IP \(bu 2
PCRE2 (headers and libraries) \- optional, this will be downloaded if missing
.IP \(bu 2
gettext (only the msgfmt tool) \- optional, for translation support
.IP \(bu 2
Sphinx \- optional, to build the documentation
.UNINDENT
.sp
Of course not everything is required always \- if you just want to contribute something to the documentation you\(aqll just need Sphinx,
and if the change is very simple and obvious you can just send it in. Use your judgement!
.sp
Once you have your changes, open a pull request on \%<https://\:github\:.com/\:fish-shell/\:fish-shell/\:pulls>\&.
.SS Guidelines
.sp
In short:
.INDENT 0.0
.IP \(bu 2
Be conservative in what you need (keep to the agreed minimum supported Rust version, limit new dependencies)
.IP \(bu 2
Use automated tools to help you (\fBcargo xtask check\fP)
.UNINDENT
.SS Commit History
.sp
We use a linear, recipe\-style \%<https://\:www\:.bitsnbites\:.eu/\:git-history-work-log-vs-recipe/> history.
Every commit should pass our checks.
We do not want \(dqfixup\(dq commits in our history.
If you notice an issue with a commit in a pull request, or get feedback suggesting changes,
you should rewrite the commit history and fix the relevant commits directly,
instead of adding new \(dqfixup\(dq commits.
When a pull request is ready, we rebase it on top of the current master branch,
so don\(aqt be shy about rewriting the history of commits which are not on master yet.
Rebasing (not merging) your pull request on the latest version of master is also welcome, especially if it resolves conflicts.
.sp
If you\(aqre using Git, consider using jj \%<https://\:www\:.jj-vcs\:.dev/> to make this easier.
.sp
If a commit should close an issue, add a \fBFixes #<issue\-number>\fP line at the end of the commit description.
.SS Contributing completions
.sp
Completion scripts are the most common contribution to fish, and they are very welcome.
.sp
In general, we\(aqll take all well\-written completion scripts for a command that is publicly available.
This means no private tools or personal scripts, and we do reserve the right to reject for other reasons.
.sp
Before you try to contribute them to fish, consider if the authors of the tool you are completing want to maintain the script instead.
Often that makes more sense, specifically because they can add new options to the script immediately once they add them,
and don\(aqt have to maintain one completion script for multiple versions. If the authors no longer wish to maintain the script,
they can of course always contact the fish maintainers to hand it over, preferably by opening a PR.
This isn\(aqt a requirement \- if the authors don\(aqt want to maintain it, or you simply don\(aqt want to contact them,
you can contribute your script to fish.
.sp
Completion scripts should
.INDENT 0.0
.IP 1. 3
Use as few dependencies as possible \- try to use fish\(aqs builtins like \fBstring\fP instead of \fBgrep\fP and \fBawk\fP,
use \fBpython\fP to read json instead of \fBjq\fP (because it\(aqs already a soft dependency for fish\(aqs tools)
.IP 2. 3
If it uses a common unix tool, use POSIX\-compatible invocations \- ideally it would work on GNU/Linux, macOS, the BSDs and other systems
.IP 3. 3
Option and argument descriptions should be kept short.
The shorter the description, the more likely it is that fish can use more columns.
.IP 4. 3
Function names should start with \fB__fish\fP, and functions should be kept in the completion file unless they\(aqre used elsewhere.
.IP 5. 3
Run \fBfish_indent\fP on your script.
.IP 6. 3
Try not to use minor convenience features right after they are available in fish \- we do try to keep completion scripts backportable.
If something has a real impact on the correctness or performance, feel free to use it,
but if it is just a shortcut, please leave it.
.UNINDENT
.sp
Put your completion script into share/completions/name\-of\-command.fish. If you have multiple commands, you need multiple files.
.sp
If you want to add tests, you probably want to add a littlecheck test. See below for details.
.SS Contributing documentation
.sp
The documentation is stored in \fBdoc_src/\fP, and written in ReStructured Text and built with Sphinx.
The builtins and various functions shipped with fish are documented in \fBdoc_src/cmds/\fP\&.
.sp
To build an HTML version of the docs locally, run:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cargo xtask html\-docs
.EE
.UNINDENT
.UNINDENT
.sp
will output to \fBtarget/fish\-docs/html\fP or, if you use CMake:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cmake \-\-build build \-t sphinx\-docs
.EE
.UNINDENT
.UNINDENT
.sp
will output to \fBbuild/cargo/fish\-docs/html/\fP\&. You can also run \fBsphinx\-build\fP directly, which allows choosing the output directory:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
sphinx\-build \-j auto \-b html doc_src/ /tmp/fish\-doc/
.EE
.UNINDENT
.UNINDENT
.sp
will output HTML docs to \fB/tmp/fish\-doc\fP\&.
.sp
After building them, you can open the HTML docs in a browser and see that it looks okay.
.SS Code Style
.sp
For formatting, we use:
.INDENT 0.0
.IP \(bu 2
\fBrustfmt\fP for Rust
.IP \(bu 2
\fBfish_indent\fP (shipped with fish) for fish script
.IP \(bu 2
\fBruff format\fP for Python
.UNINDENT
.sp
To reformat files, there is an xtask
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cargo xtask format \-\-all
cargo xtask format somefile.rs some.fish
.EE
.UNINDENT
.UNINDENT
.SS Fish Script Style Guide
.INDENT 0.0
.IP 1. 3
All fish scripts, such as those in the \fIshare/functions\fP and \fItests\fP
directories, should be formatted using the \fBfish_indent\fP command.
.IP 2. 3
Function names should be in all lowercase with words separated by
underscores. Private functions should begin with an underscore. The
first word should be \fBfish\fP if the function is unique to fish.
.IP 3. 3
The first word of global variable names should generally be \fBfish\fP
for public vars or \fB_fish\fP for private vars to minimize the
possibility of name clashes with user defined vars.
.UNINDENT
.SS Configuring Your Editor for Fish Scripts
.sp
If you use Vim: Install vim\-fish \%<https://\:github\:.com/\:dag/\:vim-fish>,
make sure you have syntax and filetype functionality in \fB~/.vimrc\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
syntax enable
filetype plugin indent on
.EE
.UNINDENT
.UNINDENT
.sp
Then turn on some options for nicer display of fish scripts in
\fB~/.vim/ftplugin/fish.vim\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
\(dq Set up :make to use fish for syntax checking.
compiler fish

\(dq Set this to have long lines wrap inside comments.
setlocal textwidth=79

\(dq Enable folding of block structures in fish.
setlocal foldmethod=expr
.EE
.UNINDENT
.UNINDENT
.sp
If you use Emacs: Install
fish\-mode \%<https://\:github\:.com/\:wwwjfy/\:emacs-fish> (also available in
melpa and melpa\-stable) and \fB(setq\-default indent\-tabs\-mode nil)\fP for
it (via a hook or in \fBuse\-package\fPs “:init” block). It can also be
made to run fish_indent via e.g.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
(add\-hook \(aqfish\-mode\-hook (lambda ()
    (add\-hook \(aqbefore\-save\-hook \(aqfish_indent\-before\-save)))
.EE
.UNINDENT
.UNINDENT
.SS Minimum Supported Rust Version (MSRV) Policy
.sp
We support at least the version of \fBrustc\fP available in Debian Stable.
.SS Testing
.sp
The source code for fish includes a large collection of tests. If you
are making any changes to fish, running these tests is a good way to make
sure the behaviour remains consistent and regressions are not
introduced. Even if you don’t run the tests on your machine, they will
still be run via GitHub Actions.
.sp
You are strongly encouraged to add tests when changing the functionality
of fish, especially if you are fixing a bug to help ensure there are no
regressions in the future (i.e., we don’t reintroduce the bug).
.sp
Unit tests live next to the implementation in Rust source files, in inline submodules (\fBmod tests {}\fP).
.sp
System tests live in \fBtests/\fP:
.INDENT 0.0
.IP \(bu 2
\fBtests/checks\fP are run by littlecheck \%<https://\:github\:.com/\:ridiculousfish/\:littlecheck>
and test noninteractive (script) behavior,
except for \fBtests/checks/tmux\-*\fP which test interactive scenarios.
.IP \(bu 2
\fBtests/pexpects\fP tests interactive scenarios using pexpect \%<https://\:pexpect\:.readthedocs\:.io/\:en/\:stable/>
.UNINDENT
.sp
When in doubt, the bulk of the tests should be added as a littlecheck test in tests/checks, as they are the easiest to modify and run, and much faster and more dependable than pexpect tests.
The syntax is fairly self\-explanatory.
It\(aqs a fish script with the expected output in \fB# CHECK:\fP or \fB# CHECKERR:\fP (for stderr) comments.
If your littlecheck test has a specific dependency, use \fB# REQUIRE: ...\fP with a POSIX sh script.
.sp
The pexpect tests are written in Python and can simulate input and output to/from a terminal, so they are needed for anything that needs actual interactivity.
The runner is in tests/pexpect_helper.py, in case you need to modify something there.
.sp
These tests can be run via the tests/test_driver.py Python script, which will set up the environment.
It sets up a temporary $HOME and also uses it as the current directory, so you do not need to create a temporary directory in them.
.sp
If you need a command to do something weird to test something, maybe add it to the \fBfish_test_helper\fP binary (in \fBtests/fish_test_helper.c\fP).
.SS Local testing
.sp
The tests can be run on your local system:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cargo build
# Run unit tests
cargo test
# Run system tests
tests/test_driver.py target/debug
# Run a specific system test.
tests/test_driver.py target/debug tests/checks/abbr.fish
.EE
.UNINDENT
.UNINDENT
.sp
Here, the first argument to test_driver.py refers to a directory with \fBfish\fP, \fBfish_indent\fP and \fBfish_key_reader\fP in it.
In this example we\(aqre in the root of the workspace and have run \fBcargo build\fP without \fB\-\-release\fP, so it\(aqs a debug build.
.sp
To run all tests and linters, use:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cargo xtask check
.EE
.UNINDENT
.UNINDENT
.SS Contributing Translations
.sp
Fish uses GNU gettext to translate messages from English to other languages.
We use custom tools for extracting messages from source files and to localize at runtime.
This means that we do not have a runtime dependency on the gettext library.
It also means that some features are not supported, such as message context and plurals.
We also expect all files to be UTF\-8\-encoded.
In practice, this should not matter much for contributing translations.
.sp
Translation sources are stored in the \fBlocalization/po\fP directory and named \fBll_CC.po\fP,
where \fBll\fP is the two (or possibly three) letter ISO 639\-1 language code of the target language
(e.g. \fBpt\fP for Portuguese). \fBCC\fP is an ISO 3166 country/territory code,
(e.g. \fBBR\fP for Brazil).
An example for a valid name is \fBpt_BR.po\fP, indicating Brazilian Portuguese.
These are the files you will interact with when adding translations.
.SS Adding translations for a new language
.sp
Creating new translations requires the Gettext tools.
More specifically, you will need \fBmsguniq\fP and \fBmsgmerge\fP for creating translations for a new
language.
To create a new translation, run:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
build_tools/update_translations.fish localization/po/ll_CC.po
.EE
.UNINDENT
.UNINDENT
.sp
This will create a new PO file containing all messages available for translation.
If the file already exists, it will be updated.
.sp
After modifying a PO file, you can recompile fish, and it will integrate the modifications you made.
This requires that the \fBmsgfmt\fP utility is installed (comes as part of \fBgettext\fP).
It is important that the \fBlocalize\-messages\fP cargo feature is enabled, which it is by default.
You can explicitly enable it using:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
cargo build \-\-features=localize\-messages
.EE
.UNINDENT
.UNINDENT
.sp
Use environment variables to tell fish which language to use, e.g.:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
LANG=pt_BR.utf8 fish
.EE
.UNINDENT
.UNINDENT
.sp
or within the running fish shell:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set LANG pt_BR.utf8
.EE
.UNINDENT
.UNINDENT
.sp
For more options regarding how to choose languages, see
the corresponding gettext documentation \%<https://\:www\:.gnu\:.org/\:software/\:gettext/\:manual/\:html_node/\:Locale-Environment-Variables\:.html>\&.
One neat thing you can do is set a list of languages to check for translations in the order defined
using the \fBLANGUAGE\fP variable, e.g.:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
set LANGUAGE pt_BR de_DE
.EE
.UNINDENT
.UNINDENT
.sp
to try to translate messages to Portuguese, if that fails try German, and if that fails too you will
see the English version defined in the source code.
.SS Modifying existing translations
.sp
If you want to work on translations for a language which already has a corresponding \fBpo\fP file, it
is sufficient to edit this file. No other changes are necessary.
.sp
After recompiling fish, you should be able to see your translations in action. See the previous
section for details.
.SS Editing PO files
.sp
Many tools are available for editing translation files, including
command\-line and graphical user interface programs. For simple use, you can use your text editor.
.sp
Open up the PO file, for example \fBlocalization/po/sv.po\fP, and you\(aqll see something like:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
msgid \(dq%s: No suitable job\en\(dq
msgstr \(dq\(dq
.EE
.UNINDENT
.UNINDENT
.sp
The \fBmsgid\fP here is the \(dqname\(dq of the string to translate, typically the English string to translate.
The second line (\fBmsgstr\fP) is where your translation goes.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
msgid \(dq%s: No suitable job\en\(dq
msgstr \(dq%s: Inget passande jobb\en\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Any \fB%s\fP or \fB%d\fP are placeholders that fish will use for formatting at runtime. It is important that they match \- the translated string should have the same placeholders in the same order.
.sp
Also any escaped characters, like that \fB\en\fP newline at the end, should be kept so the translation has the same behavior.
.sp
Our tests run \fBmsgfmt \-\-check\-format /path/to/file\fP, so they would catch mismatched placeholders \- otherwise fish would crash at runtime when the string is about to be used.
.sp
Be cautious about blindly updating an existing translation file.
\fBmsgid\fP strings should never be updated manually, only by running the appropriate script.
.SS Modifications to strings in source files
.sp
If a string changes in the sources, the old translations will no longer work.
They will be preserved in the PO files, but commented\-out (starting with \fB#~\fP).
If you add/remove/change a translatable strings in a source file,
run \fBbuild_tools/update_translations.fish\fP to propagate this to all translation files (\fBlocalization/po/*.po\fP).
This is only relevant for developers modifying the source files of fish or fish scripts.
.SS Setting Code Up For Translations
.sp
All non\-debug messages output for user consumption should be marked for
translation. In Rust, this requires the use of the \fBwgettext!\fP or \fBwgettext_fmt!\fP
macros:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
streams.out.append(wgettext_fmt!(\(dq%s: There are no jobs\en\(dq, argv[0]));
.EE
.UNINDENT
.UNINDENT
.sp
All messages in fish script must be enclosed in single or double quote
characters for our message extraction script to find them.
They must also be translated via a command substitution. This means
that the following are \fBnot\fP valid:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo (_ hello)
_ \(dqgoodbye\(dq
.EE
.UNINDENT
.UNINDENT
.sp
Above should be written like this instead:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
echo (_ \(dqhello\(dq)
echo (_ \(dqgoodbye\(dq)
.EE
.UNINDENT
.UNINDENT
.sp
You can use either single or double quotes to enclose the
message to be translated. You can also optionally include spaces after
the opening parentheses or before the closing parentheses.
.SS Updating Dependencies
.sp
To update dependencies, run \fBbuild_tools/update\-dependencies.sh\fP\&.
This currently requires updatecli \%<https://\:github\:.com/\:updatecli/\:updatecli> and a few other tools.
.SS Versioning
.sp
The fish version is constructed by the \fIbuild_tools/git_version_gen.sh\fP
script. For developers the version is the branch name plus the output of
\fBgit describe \-\-always \-\-dirty\fP\&. Normally the main part of the version
will be the closest annotated tag. Which itself is usually the most
recent release number (e.g., \fB2.6.0\fP).
.SS License
.SS License for fish
.sp
\fBfish\fP Copyright © 2005\-2009 Axel Liljencrantz, 2009\- fish\-shell contributors. \fBfish\fP is released under the GNU General Public License, version 2.
.sp
\fBfish\fP includes other code licensed under the GNU General Public License, version 2, including GNU \fBprintf\fP\&.
.sp
Copyright © 1990\-2007 Free Software Foundation, Inc. Printf (from GNU Coreutils 6.9) is released under the GNU General Public License, version 2.
.sp
The GNU General Public License agreement follows.
.sp
\fBGNU GENERAL PUBLIC LICENSE\fP
.sp
Version 2, June 1991
.INDENT 0.0
.INDENT 3.5
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA  02110\-1301, USA
.sp
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
.UNINDENT
.UNINDENT
.sp
\fBPreamble\fP
.sp
The licenses for most software are designed to take away your freedom to share and change it.  By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software \- to make sure the software is free for all its users.  This General Public License applies to most of the Free Software Foundation\(aqs software and to any other program whose authors commit to using it.  (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.)  You can apply it to your programs, too.
.sp
When we speak of free software, we are referring to freedom, not price.  Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
.sp
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
.sp
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.  You must make sure that they, too, receive or can get the source code.  And you must show them these terms so they know their rights.
.sp
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
.sp
Also, for each author\(aqs protection and ours, we want to make certain that everyone understands that there is no warranty for this free software.  If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors\(aq reputations.
.sp
Finally, any free program is threatened constantly by software patents.  We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone\(aqs free use or not licensed at all.
.sp
The precise terms and conditions for copying, distribution and modification follow.
.sp
\fBTERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\fP
.INDENT 0.0
.IP \(bu 2
This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License.  The \(dqProgram\(dq, below, refers to any such program or work, and a \(dqwork based on the Program\(dq means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.  (Hereinafter, translation is included without limitation in the term \(dqmodification\(dq.) Each licensee is addressed as \(dqyou\(dq.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope.  The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 1. 3
You may copy and distribute verbatim copies of the Program\(aqs source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 2. 3
You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
.IP \(bu 2
You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
.IP \(bu 2
If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
.UNINDENT
.sp
These requirements apply to the modified work as a whole.  If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.  But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
.sp
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
.sp
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 3. 3
You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
Accompany it with the complete corresponding machine\-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
.IP \(bu 2
Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine\-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
.IP \(bu 2
Accompany it with the information you received as to the offer to distribute corresponding source code.  (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
.UNINDENT
.sp
The source code for a work means the preferred form of the work for making modifications to it.  For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable.  However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
.sp
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 4. 3
You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
.IP 5. 3
You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works.  These actions are prohibited by law if you do not accept this License.  Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
.IP 6. 3
Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients\(aq exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
.IP 7. 3
If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License.  If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty\-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
.sp
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices.  Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
.sp
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 8. 3
If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded.  In such case, this License incorporates the limitation as if written in the body of this License.
.IP 9. 3
The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time.  Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
Each version is given a distinguishing version number.  If the Program specifies a version number of this License which applies to it and \(dqany later version\(dq, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation.  If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 10. 3
If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.  For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this.  Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
.UNINDENT
.INDENT 0.0
.INDENT 3.5
\fBNO WARRANTY\fP
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP 11. 4
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \(dqAS IS\(dq WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
.IP 12. 4
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
.UNINDENT
.SS License for the Python docs theme
.sp
In doc_src/python_docs_theme/, taken from \%<https://\:pypi\:.org/\:project/\:python-docs-theme/\:2020\:.1/>\&.
.sp
\fBPYTHON SOFTWARE FOUNDATION LICENSE VERSION 2\fP
.sp
1. This LICENSE AGREEMENT is between the Python Software Foundation
(\(dqPSF\(dq), and the Individual or Organization (\(dqLicensee\(dq) accessing and
otherwise using this software (\(dqPython\(dq) in source or binary form and
its associated documentation.
.sp
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty\-free, world\-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF\(aqs License Agreement and PSF\(aqs notice of copyright,
i.e., \(dqCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation; All Rights
Reserved\(dq are retained in Python alone or in any derivative version prepared by
Licensee.
.sp
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
.sp
4. PSF is making Python available to Licensee on an \(dqAS IS\(dq
basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
.sp
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
.sp
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
.sp
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee.  This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
.sp
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
.SS MIT License
.sp
\fBfish\fP includes a copy of Alpine.js, which is copyright 2019\-2021 Caleb Porzio and contributors, and licensed under the MIT License. It also uses FindRust.cmake, from the Corrosion project, which is copyright 2018 Andrew Gaspar and licensed under the MIT license. It also includes the Dracula theme, which is copyright 2018 Dracula Team, and the Nord theme, which is copyright 2016\-present Sven Greb. These themes are also used under the MIT license.
.sp
\fBfish\fP contains code derived from  musl\-libc \%<https://\:www\:.musl-libc\:.org>, which is copyright 2006\-2020 Rich Felker, et al., to implement printf. This code is used under the terms of the MIT license.
.sp
The MIT license follows.
.sp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \(dqSoftware\(dq), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
.sp
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
.sp
THE SOFTWARE IS PROVIDED \(dqAS IS\(dq, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.SS GNU Library General Public License
.sp
\fBfish\fP contains code derived from the GNU C Library, licensed under the GNU Library General Public
License. This code is copyright © 1989\-1994 Free Software Foundation, Inc.
.sp
The GNU Library General Public License agreement follows.
.sp
\fBGNU LIBRARY GENERAL PUBLIC LICENSE\fP
.sp
Version 2, June 1991
.sp
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA  02110\-1301  USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
.INDENT 0.0
.TP
.B [This is the first released version of the library GPL.  It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
.UNINDENT
.sp
\fBPreamble\fP
.sp
The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software\-\-to make sure the software is free for all its users.
.sp
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it.  You can use it for
your libraries, too.
.sp
When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
.sp
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
.sp
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you.  You must make sure that they, too, receive or can get the source
code.  If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it.  And you must show them these terms so they know their rights.
.sp
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
.sp
Also, for each distributor\(aqs protection, we want to make certain
that everyone understands that there is no warranty for this free
library.  If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors\(aq reputations.
.sp
Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software.  To prevent this,
we have made it clear that any patent must be licensed for everyone\(aqs
free use or not licensed at all.
.sp
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs.  This
license, the GNU Library General Public License, applies to certain
designated libraries.  This license is quite different from the ordinary
one; be sure to read it in full, and don\(aqt assume that anything in it is
the same as in the ordinary license.
.sp
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it.  Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program.  However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
.sp
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries.  We
concluded that weaker conditions might promote sharing better.
.sp
However, unrestricted linking of non\-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves.  This Library General Public License is intended to
permit developers of non\-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them.  (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.)  The hope is that this
will lead to faster development of free libraries.
.sp
The precise terms and conditions for copying, distribution and
modification follow.  Pay close attention to the difference between a
\(dqwork based on the library\(dq and a \(dqwork that uses the library\(dq.  The
former contains code derived from the library, while the latter only
works together with the library.
.sp
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
.sp
\fBTERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\fP
.sp
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called \(dqthis License\(dq).  Each licensee is
addressed as \(dqyou\(dq.
.sp
A \(dqlibrary\(dq means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
.sp
The \(dqLibrary\(dq, below, refers to any such software library or work
which has been distributed under these terms.  A \(dqwork based on the
Library\(dq means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language.  (Hereinafter, translation is
included without limitation in the term \(dqmodification\(dq.)
.sp
\(dqSource code\(dq for a work means the preferred form of the work for
making modifications to it.  For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
.sp
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it).  Whether that is true depends on what the Library does
and what the program that uses the Library does.
.sp
1. You may copy and distribute verbatim copies of the Library\(aqs
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
.sp
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
.sp
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP a. 3
The modified work must itself be a software library.
.UNINDENT
.sp
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
.sp
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
.sp
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
.sp
(For example, a function in a library to compute square roots has
a purpose that is entirely well\-defined independent of the
application.  Therefore, Subsection 2d requires that any
application\-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
.UNINDENT
.UNINDENT
.sp
These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
.sp
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
.sp
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
.sp
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library.  To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License.  (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.)  Do not make any other change in
these notices.
.sp
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
.sp
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
.sp
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine\-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
.sp
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
.sp
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a \(dqwork that uses the Library\(dq.  Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
.sp
However, linking a \(dqwork that uses the Library\(dq with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a \(dqwork that uses the
library\(dq.  The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
.sp
When a \(dqwork that uses the Library\(dq uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library.  The
threshold for this to be true is not precisely defined by law.
.sp
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work.  (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
.sp
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
.sp
6. As an exception to the Sections above, you may also compile or
link a \(dqwork that uses the Library\(dq with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer\(aqs own use and reverse
engineering for debugging such modifications.
.sp
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License.  You must supply a copy of this License.  If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License.  Also, you must do one
of these things:
.INDENT 0.0
.INDENT 3.5
a) Accompany the work with the complete corresponding
machine\-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine\-readable \(dqwork that
uses the Library\(dq, as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library.  (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
.sp
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
.sp
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
.sp
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
.UNINDENT
.UNINDENT
.sp
For an executable, the required form of the \(dqwork that uses the
Library\(dq must include any data and utility programs needed for
reproducing the executable from it.  However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
.sp
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system.  Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
.sp
7. You may place library facilities that are a work based on the
Library side\-by\-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
.INDENT 0.0
.INDENT 3.5
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities.  This must be distributed under the terms of the
Sections above.
.sp
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
.UNINDENT
.UNINDENT
.sp
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License.  Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License.  However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
.sp
9. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Library or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
.sp
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions.  You may not impose any further
restrictions on the recipients\(aq exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
.sp
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all.  For example, if a patent
license would not permit royalty\-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
.sp
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
.sp
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
.sp
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
.sp
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded.  In such case, this License incorporates the limitation as if
written in the body of this License.
.sp
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
.sp
Each version is given a distinguishing version number.  If the Library
specifies a version number of this License which applies to it and
\(dqany later version\(dq, you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation.  If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
.sp
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission.  For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this.  Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
.sp
\fBNO WARRANTY\fP
.sp
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY \(dqAS IS\(dq WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
.sp
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
.SH Author
fish-shell developers
.SH Copyright
fish-shell developers
.\" End of generated man page.
