'\" t .\" Man page generated from reStructuredText. . . .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" "Feb 28, 2025" "4.0" "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: \fI\%Syntax highlighting\fP, \fI\%Autosuggestions\fP, \fI\%tab completion\fP 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 \fI\%functions\fP 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 \fI\%tutorial\fP\&. .sp If you are already familiar with other shells like bash and want to see the scripting differences, see \fI\%Fish For Bash Users\fP\&. .sp For an overview of fish\(aqs scripting language, see \fI\%The Fish Language\fP\&. If it would be useful in a script file, it\(aqs here. .sp For information on using fish interactively, see \fI\%Interactive use\fP\&. 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 INSTALLATION .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 \X'tty: link https://fishshell.com/'\fI\%fish homepage\fP <\fBhttps://fishshell.com/\fP>\X'tty: link'\&. .sp To install the development version of fish, see the instructions on the \X'tty: link https://github.com/fish-shell/fish-shell'\fI\%project\(aqs GitHub page\fP <\fBhttps://github.com/fish-shell/fish-shell\fP>\X'tty: link'\&. .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 (eg 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 (if that\(aqs where fish is installed \- substitute another location as appropriate). .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 \fI\%PATH\fP\&. 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 > echo /usr/local/bin/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 /usr/local/bin/fish .EE .UNINDENT .UNINDENT .UNINDENT .sp Again, substitute the path to fish for \fB/usr/local/bin/fish\fP \- see \fBcommand \-s fish\fP inside fish. To change it back to another shell, just substitute \fB/usr/local/bin/fish\fP with \fB/bin/bash\fP, \fB/bin/tcsh\fP or \fB/bin/zsh\fP as appropriate in the steps above. .SS Uninstalling .sp For uninstalling fish: see \fI\%FAQ: Uninstalling fish\fP\&. .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 \fI\%PATH\fP 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 \fI\%PATH\fP\&. .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 \fI\%Configuration files\fP\&. .sp If you want to see what you changed over fish\(aqs defaults, see \fI\%fish_delta\fP\&. .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 \fI\%fish_add_path\fP 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 \fI\%event handler\fP 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 \X'tty: link https://github.com/fish-shell/fish-shell/'\fI\%GitHub page\fP <\fBhttps://github.com/fish-shell/fish-shell/\fP>\X'tty: link' .IP \(bu 2 The official \X'tty: link https://gitter.im/fish-shell/fish-shell'\fI\%Gitter channel\fP <\fBhttps://gitter.im/fish-shell/fish-shell\fP>\X'tty: link' .IP \(bu 2 The official mailing list at \X'tty: link https://lists.sourceforge.net/lists/listinfo/fish-users'\fI\%fish\-users@lists.sourceforge.net\fP <\fBhttps://lists.sourceforge.net/lists/listinfo/fish-users\fP>\X'tty: link' .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 \fI\%Fish for bash users\fP .SS How do I set or clear an environment variable? .sp Use the \fI\%set\fP 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 just 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 \fI\%scope\fP, 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 \fI\%variable scopes\fP 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 \fI\%configuration file\fP (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 normal echo \-n \(aq > \(aq end .EE .UNINDENT .UNINDENT .sp You can also use the Web configuration tool, \fI\%fish_config\fP, 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 \fI\%funced\fP and \fI\%funcsave\fP 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 \fI\%fish_right_prompt\fP and \fI\%fish_mode_prompt\fP\&. .SS Why does my prompt show a \fB[I]\fP? .sp That\(aqs the \fI\%fish_mode_prompt\fP\&. 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 \fI\%funced\fP\&. .SS How do I customize my syntax highlighting colors? .sp Use the web configuration tool, \fI\%fish_config\fP, or alter the \fI\%fish_color family of environment variables\fP\&. .sp You can also use \fBfish_config\fP on the commandline, 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 > fish_config theme save # to make the change permanent .EE .UNINDENT .UNINDENT .SS How do I change the greeting message? .sp Change the value of the variable \fBfish_greeting\fP or create a \fI\%fish_greeting\fP 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 \fI\%config.fish\fP\&. .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 \fI\%Searchable command history\fP 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 just 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 just 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 \fI\%documentation\fP for more details about line editing in fish. .sp That being said, you can use \fI\%Abbreviations\fP to implement history substitution. Here\(aqs just \fB!!\fP: .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 \fI\%config.fish\fP 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 just 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 \fI\%Conditions\fP and the documentation for \fI\%test\fP and \fI\%if\fP for more information. .SS My command prints \(dqNo matches for wildcard\(dq but works in bash .sp In short: \fI\%quote\fP or \fI\%escape\fP 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 \fI\%wildcard expansion\fP\&. 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 \X'tty: link http://mywiki.wooledge.org/BashFAQ/004'\fI\%http://mywiki.wooledge.org/BashFAQ/004\fP\X'tty: link') .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 \fI\%user configuration file\fP (\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 simply 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 the host system only supports Unicode 8, while you are running the terminal on a system that uses Unicode >= 9. In this case set $fish_emoji_width to 2. .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 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, just 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 \fI\%The Fish Language\fP for information on that. .SS Help .sp Fish has an extensive help system. Use the \fI\%help\fP command to obtain help on a specific subject or command. For instance, writing \fBhelp syntax\fP displays the \fI\%syntax section\fP 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 \fI\%fg\fP 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 \fI\%command history\fP, 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, just 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 just 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 \fI\%Writing your own completions\fP\&. .sp Completion scripts are loaded on demand, just like \fI\%functions are\fP\&. The difference is the \fB$fish_complete_path\fP \fI\%list\fP 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 \fI\%Variables for changing highlighting colors\fP section. .sp Fish also provides pre\-made color themes you can pick with \fI\%fish_config\fP\&. Running just \fBfish_config\fP opens a browser interface, or you can use \fBfish_config theme\fP in the terminal. .sp For example, to disable nearly all coloring: .INDENT 0.0 .INDENT 3.5 .sp .EX fish_config theme choose None .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 .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 \fI\%set_color\fP command. The modifier switches accepted by \fBset_color\fP like \fB\-\-bold\fP, \fB\-\-dim\fP, \fB\-\-italics\fP, \fB\-\-reverse\fP and \fB\-\-underline\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 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, 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 \fI\%abbr\fP 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 \fI\%bind function\fP 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 \fI\%fish_prompt\fP and \fI\%fish_right_prompt\fP 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 \fI\%vi mode\fP, the output of \fI\%fish_mode_prompt\fP will be prepended on the left. .sp Fish ships with a few prompts which you can see with \fI\%fish_config\fP\&. 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 \fI\%fish_greeting\fP 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 \fI\%universal variable\fP: .INDENT 0.0 .INDENT 3.5 .sp .EX set \-U fish_greeting .EE .UNINDENT .UNINDENT .sp or you can set it \fI\%globally\fP in \fI\%config.fish\fP: .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 \fI\%a function file\fP\&. You can also use \fI\%funced\fP and \fI\%funcsave\fP to edit it easily. .SS Programmable title .sp When using most terminals, it is possible to set the text displayed in the titlebar of the terminal window. Fish does this by running the \fI\%fish_title\fP function. It is executed before and after a command and the output is used as a titlebar message. .sp The \fI\%status current\-command\fP 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 \fI\%fish_title\fP 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 \fI\%searchable history\fP 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 \fI\%fish_vi_key_bindings\fP and switch back with \fI\%fish_default_key_bindings\fP\&. 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 \fI\%completes\fP 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 one word left or right (to the next space or punctuation mark), or moves forward/backward in the directory history if the command line is empty. 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 word in the suggestion. .IP \(bu 2 \fBctrl\fP\-\fBleft\fP (\fB←\fP) and \fBctrl\fP\-\fBright\fP (\fB→\fP) move the cursor one word left or right. 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 \fI\%history\fP 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 \fI\%history\fP 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 \fI\%killring\fP). .IP \(bu 2 \fBctrl\fP\-\fBl\fP 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 \fI\%Copy and paste (Kill Ring)\fP). .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 \fI\%fish_clipboard_copy\fP and \fI\%fish_clipboard_paste\fP) .IP \(bu 2 \fBalt\fP\-\fBd\fP or \fBctrl\fP\-\fBdelete\fP moves the next word to the \fI\%Copy and paste (Kill Ring)\fP\&. .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 to the \fI\%Copy and paste (Kill Ring)\fP\&. .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. .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. .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. .IP \(bu 2 \fBctrl\fP\-\fBspace\fP Inserts a space without expanding an \fI\%abbreviation\fP\&. For vi mode, this only applies to insert\-mode. .UNINDENT .SS Emacs mode commands .sp To enable emacs mode, use \fI\%fish_default_key_bindings\fP\&. 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 \fBalt\fP\-\fBbackspace\fP removes one word backwards. If supported by the terminal, \fBctrl\fP\-\fBbackspace\fP does the same. .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 \fI\%Copy and paste (Kill Ring)\fP). .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 \fI\%bind\fP builtin. .SS Vi mode commands .sp Vi mode allows for the use of vi\-like commands at the prompt. Initially, \fI\%insert mode\fP is active. \fBescape\fP enters \fI\%command mode\fP\&. The commands available in command, insert and visual mode are described below. Vi mode shares \fI\%some bindings\fP with \fI\%Emacs mode\fP\&. .sp To enable vi mode, use \fI\%fish_vi_key_bindings\fP\&. 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 \fI\%fish_mode_prompt\fP 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 \fI\%bind\fP) .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 \fI\%history\fP 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 \fI\%insert mode\fP at the current cursor position. .IP \(bu 2 \fBI\fP enters \fI\%insert mode\fP at the beginning of the line. .IP \(bu 2 \fBv\fP enters \fI\%visual mode\fP at the current cursor position. .IP \(bu 2 \fBa\fP enters \fI\%insert mode\fP after the current cursor position. .IP \(bu 2 \fBA\fP enters \fI\%insert mode\fP at the end of the line. .IP \(bu 2 \fBo\fP inserts a new line under the current one and enters \fI\%insert mode\fP .IP \(bu 2 \fBO\fP (capital\-\(dqo\(dq) inserts a new line above the current one and enters \fI\%insert mode\fP .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 \fI\%Copy and paste (Kill Ring)\fP\&. .IP \(bu 2 \fBD\fP deletes text after the current cursor position and moves it to the \fI\%Copy and paste (Kill Ring)\fP\&. .IP \(bu 2 \fBp\fP pastes text from the \fI\%Copy and paste (Kill Ring)\fP\&. .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 \fI\%history\fP 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\fP / \fBG\fP moves the cursor to the beginning/end of the commandline, respectively. .IP \(bu 2 \fB:,q\fP exits fish. .UNINDENT .SS Insert mode .INDENT 0.0 .IP \(bu 2 \fBescape\fP enters \fI\%command mode\fP\&. .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 \fI\%Copy and paste (Kill Ring)\fP and enter \fI\%command mode\fP\&. .IP \(bu 2 \fBescape\fP and \fBctrl\fP\-\fBc\fP enter \fI\%command mode\fP\&. .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 \fI\%Copy and paste (Kill Ring)\fP, and enters \fI\%command mode\fP\&. .IP \(bu 2 \fBy\fP copies the selection to the \fI\%Copy and paste (Kill Ring)\fP, and enters \fI\%command mode\fP\&. .IP \(bu 2 \fB~\fP toggles the case (upper/lower) on the selection, and enters \fI\%command mode\fP\&. .IP \(bu 2 \fB\(dq,*,y\fP copies the selection to the clipboard, and enters \fI\%command mode\fP\&. .UNINDENT .SS Custom bindings .sp In addition to the standard bindings listed here, you can also define your own with \fI\%bind\fP: .INDENT 0.0 .INDENT 3.5 .sp .EX # Just clear the commandline on control\-c bind ctrl\-c \(aqcommandline \-r \(dq\(dq\(aq .EE .UNINDENT .UNINDENT .sp Put \fBbind\fP statements into \fI\%config.fish\fP 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 simply 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 \fI\%vi bindings\fP, note that \fBbind\fP will by default bind keys in \fI\%command mode\fP\&. To bind something in \fI\%insert mode\fP: .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 \fI\%fish_key_reader\fP\&. .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 \fI\%fish_escape_delay_ms\fP 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 \fI\%fish_sequence_key_delay_ms\fP: .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 simply 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 \fI\%fish_cursor_selection_mode\fP 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 \fI\%end\fP 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 just 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_history\fP file); both before starting the shell and while the shell is running. .sp See the \fI\%history\fP 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 \fI\%bind\fP 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 \fI\%cd\fP command, but fish offers some advanced features as well. .sp The current working directory can be displayed with the \fI\%pwd\fP command, or the \fB$PWD\fP \fI\%special variable\fP\&. Usually your prompt already does this. .SS Directory history .sp Fish automatically keeps a trail of the recent visited directories with \fI\%cd\fP 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 \fI\%dirh\fP prints the history .IP \(bu 2 \fI\%cdh\fP displays a prompt to quickly navigate the history .IP \(bu 2 \fI\%prevd\fP moves backward through the history. It is bound to \fBalt\fP\-\fBleft\fP (\fB←\fP) .IP \(bu 2 \fI\%nextd\fP 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 \fI\%dirs\fP prints the stack .IP \(bu 2 \fI\%pushd\fP adds a directory on top of the stack and makes it the current working directory .IP \(bu 2 \fI\%popd\fP 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 \fI\%Interactive use\fP\&. .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 \fI\%echo\fP 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 \fI\%PATH\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 \fI\%cd\fP: 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 \fI\%open\fP: 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 \fI\%expansions\fP, 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 \fI\%variable expansion\fP and \fI\%command substitution\fP in the \fB$(command)\fP\&. No other kind of expansion (including \fI\%brace expansion\fP 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 \fI\%Quotes\fP). 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 \fI\%feature flag\fP 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 \fBDESTINATION\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\&. .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 \fBNDESTINATION\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 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 | 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 redirects both stdout and stderr to the same process. This is different from bash, which uses \fB|&\fP\&. .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 # Just 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 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. \fI\%fg\fP 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 \fI\%fg\fP (foreground) command. .sp If you instead want to put a suspended job into the background, use the \fI\%bg\fP command. .sp To get a listing of all currently started jobs, use the \fI\%jobs\fP command. These listed jobs can be removed with the \fI\%disown\fP command. .sp At the moment, functions cannot be started in the background. Functions that are stopped and then restarted in the background using the \fI\%bg\fP 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 simply 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. \fI\%$argv\fP is a \fI\%list variable\fP, which always contains all arguments sent to the function. In the example above, these are simply 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 \fI\%alias\fP\&. .sp Fish\(aqs prompt is also defined in a function, called \fI\%fish_prompt\fP\&. 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 \fI\%funced\fP, and to save a function \fI\%funcsave\fP\&. This will store it in a function file that fish will \fI\%autoload\fP when needed. .sp The \fI\%functions\fP builtin can show a function\(aqs current definition (and \fI\%type\fP will also do if given a function). .sp For more information on functions, see the documentation for the \fI\%function\fP 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 \fI\%$argv\fP 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 \fI\%alias\fP 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. \fI\%alias\fP immediately creates a function. Consider using \fBalias \-\-save\fP or \fI\%funcsave\fP to save the created function into an autoload file instead of recreating the alias each time. .sp For an alternative, try \fI\%abbreviations\fP\&. 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 \fI\%list variable\fP \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\&. .IP \(bu 2 The functions shipped with fish, usually installed in \fB/usr/share/fish/functions\fP (really \fB$__fish_data_dir/functions\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 \fI\%event handlers\fP, 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 \fI\%event handlers\fP 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, simply 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: \fI\%if\fP, \fI\%switch\fP, \fI\%and\fP and \fI\%or\fP, and also the familiar \fI\%&&/||\fP syntax. .SS The \fBif\fP statement .sp The \fI\%if\fP 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 \fI\%exit status\fP (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 \fI\%test\fP 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 just 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 \fI\%command substitution\fP: .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 \fI\%else\fP 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 \fI\%not\fP keyword can be used to invert the status: .INDENT 0.0 .INDENT 3.5 .sp .EX # Just see 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 \fI\%contains\fP \- to see if a list contains a specific element (\fBif contains \-\- /usr/bin $PATH\fP) .IP \(bu 2 \fI\%string\fP \- to e.g. match strings (\fBif string match \-q \-\- \(aq*\-\(aq $arg\fP) .IP \(bu 2 \fI\%path\fP \- to check if paths of some criteria exist (\fBif path is \-rf \-\- ~/.config/fish/config.fish\fP) .IP \(bu 2 \fI\%type\fP \- to see if a command, function or builtin exists (\fBif type \-q git\fP) .UNINDENT .SS The \fBswitch\fP statement .sp The \fI\%switch\fP command is used to execute one of possibly many blocks of commands depending on the value of a string. It can take multiple \fI\%case\fP blocks that are executed when the string matches. They can take \fI\%wildcards\fP\&. 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. \fI\%and\fP or \fB&&\fP run the second command if the first succeeded, while \fI\%or\fP 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 really just 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 \fI\%if\fP\&. 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 \fI\%while\fP and \fI\%for\fP loops. .sp \fBwhile\fP works like a repeated \fI\%if\fP: .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 just a list of arguments, so you can use any \fI\%expansions\fP 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 \fI\%break\fP is available to break out of a loop, and \fI\%continue\fP to jump to the next iteration. .sp \fI\%Input and output redirections\fP (including \fI\%pipes\fP) 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 \fI\%begin\fP block that just groups commands together so you can redirect to a block or use a new \fI\%variable scope\fP 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 \fI\%Wildcards\fP, to create filenames from patterns \- \fB*.jpg\fP .IP \(bu 2 \fI\%Variable expansion\fP, to use the value of a variable \- \fB$HOME\fP .IP \(bu 2 \fI\%Command substitution\fP, to use the output of another command \- \fB$(cat /path/to/file)\fP .IP \(bu 2 \fI\%Brace expansion\fP, to write lists with common pre\- or suffixes in a shorter way \fB{/usr,}/bin\fP .IP \(bu 2 \fI\%Tilde expansion\fP, 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 \fI\%unquoted\fP \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 \fI\%feature flag\fP, so \fB?\fP will just 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, \fI\%$status\fP 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 \fI\%set\fP and \fI\%path\fP, overriding variables in \fI\%overrides\fP, \fI\%count\fP and \fI\%for\fP\&. 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 In the simplest case, this is just something like: .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 \fI\%echo\fP, 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 \fI\%set\fP: .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 \fI\%Shell variables\fP 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 \fI\%brace expansion\fP\&. .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 \fI\%Shell variables\fP 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 \fI\%path variable\fP \- in that case it will use a colon (\fB:\fP) instead [3]\&. .sp Fish variables are all \fI\%lists\fP, 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 \fI\%set\fP: .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 \fI\%Combining Lists\fP 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 \fI\%test\fP: .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 \fI\%global/universal\fP or \fI\%exported\fP\&. 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 \fI\%slices\fP, 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[1] 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 \fI\%command\fP 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 \fI\%pwd\fP command, takes its output (more specifically what it wrote to the standard output \(dqstdout\(dq stream) and uses it as arguments to \fI\%echo\fP\&. 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 \fI\%string split or string split0\fP 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 \fI\%status\fP variable if the substitution happens in the context of a \fI\%set\fP command (so \fBif set \-l (something)\fP checks if \fBsomething\fP returned true). .sp To use only some lines of the output, refer to \fI\%slices\fP\&. .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 just 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 \fI\%psub\fP command: .INDENT 0.0 .INDENT 3.5 .sp .EX # Compare just 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 100 MiB 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 \fI\%read\fP command. .IP [4] 5 One exception: Setting \fB$IFS\fP to empty will disable line splitting. This is deprecated, use \fI\%string split\fP 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 \fI\%the Combining Lists\fP section): .INDENT 0.0 .INDENT 3.5 .sp .EX > echo foo\-{$undefinedvar} # Output is an empty line, just 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, \fI\%quote\fP or \fI\%escape\fP it. .SS Combining lists .sp Fish expands lists like \fI\%brace expansions\fP: .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 \fI\%PATH\fP, use .INDENT 0.0 .INDENT 3.5 .sp .EX for file in $PATH/* .EE .UNINDENT .UNINDENT .sp Because \fI\%PATH\fP is a list, this expands to all the files in all the directories in it. And if there are no directories in \fI\%PATH\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 \fI\%command substitution\fP\&. 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 \fI\%list\fP (all fish variables are lists), or some of the lines a \fI\%command substitution\fP 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{ \fI\%Variable expansion\fP T} T{ \fBecho $foo\fP T} _ T{ \fB$()\fP and \fB()\fP T} T{ \fI\%Command substitution\fP T} T{ \fBcat (grep foo bar)\fP or \fBcat $(grep foo bar)\fP T} _ T{ \fB<\fP and \fB>\fP T} T{ \fI\%Redirection\fP, like \fBcommand > file\fP T} T{ \fBgit shortlog \-nse . > authors\fP T} _ T{ \fB|\fP T} T{ \fI\%Pipe\fP, 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{ \fI\%Backgrounding\fP T} T{ \fBsleep 5m &\fP T} _ T{ \fB{}\fP T} T{ \fI\%Brace expansion\fP T} T{ \fBls {/usr,}/bin\fP T} _ T{ \fB&&\fP and \fB||\fP T} T{ \fI\%Combiners\fP T} T{ \fBmkdir foo && cd foo\fP or \fBrm foo || exit\fP T} _ T{ \fB*\fP and \fB**\fP T} T{ \fI\%Wildcards\fP T} T{ \fBcat *.fish\fP or \fBcount **.jpg\fP T} _ T{ \fB\e\e\fP T} T{ \fI\%Escaping\fP T} T{ \fBecho foo\enbar\fP or \fBecho \e$foo\fP T} _ T{ \fB\(aq\(aq\fP and \fB\(dq\(dq\fP T} T{ \fI\%Quoting\fP T} T{ \fBrm \(dqfile with spaces\(dq\fP or \fBecho \(aq$foo\(aq\fP T} _ T{ \fB~\fP T} T{ \fI\%Home directory expansion\fP T} T{ \fBls ~/\fP or \fBls ~root/\fP T} _ T{ \fB#\fP T} T{ \fI\%Comments\fP 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 \(dq\fI\%exported\fP\(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 \fI\%set\fP 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 \fI\%variable expansion\fP\&. .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 \fI\%use a variable\fP, 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 If you want to set some personal customization, universal variables are nice: .INDENT 0.0 .INDENT 3.5 .sp .EX # Typically you\(aqd run this interactively, fish takes care of keeping it. set \-U fish_color_autosuggestion 555 .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 \fI\%brace expansion\fP: .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 \fI\%glob\fP: .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. Fish stores many of its configuration options as universal variables. This means that in order to change fish settings, all you have to do is change the variable value once, and it will be automatically updated for all sessions, and preserved across computer reboots and login/logout. .sp To see universal variables in action, start two fish sessions side by side, and issue the following command in one of them \fBset fish_color_cwd blue\fP\&. Since \fBfish_color_cwd\fP is a universal variable, the color of the current working directory listing in the prompt will instantly change to blue on both terminals. .sp \fI\%Universal variables\fP 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 \fI\%config.fish\fP, because these variables will then get longer with each new shell instance. Instead, simply 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 \fI\%PATH\fP and \fI\%locale variables\fP\&. .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 \fI\%scope\fP, 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 \fI\%Overrides\fP\&. 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, just 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 \fI\%PATH\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, simply 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 \fI\%slices\fP 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 \fI\%variable expansion\fP\&. .sp When a list is exported as an environment variable, it is either space or colon delimited, depending on whether it is a \fI\%path variable\fP: .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 \fI\%PATH\fP, \fI\%CDPATH\fP or \fBMANPATH\fP), by splitting them on colons. Other variables are not automatically split. .sp Lists can be inspected with the \fI\%count\fP or the \fI\%contains\fP 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 just 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 \fI\%argparse\fP, 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 \fI\%the argparse documentation\fP\&. .SS PATH variables .sp Path variables are a special kind of variable used to support colon\-delimited path lists including \fI\%PATH\fP, \fI\%CDPATH\fP, \fBMANPATH\fP, \fBPYTHONPATH\fP, 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 \fI\%PATH\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 \fI\%cd\fP builtin looks for a new directory. .UNINDENT .INDENT 0.0 .TP .B Locale Variables The locale variables \fI\%LANG\fP, \fI\%LC_ALL\fP, \fI\%LC_COLLATE\fP, \fI\%LC_CTYPE\fP, \fI\%LC_MESSAGES\fP, \fI\%LC_MONETARY\fP, \fI\%LC_NUMERIC\fP, and \fI\%LANG\fP set the language option for the shell and subprograms. See the section \fI\%Locale variables\fP 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 \fI\%Variables for changing highlighting colors\fP for more information. .UNINDENT .INDENT 0.0 .TP .B fish_term24bit If this is set to 1, fish will assume the terminal understands 24\-bit RGB color sequences, and won\(aqt translate them to the 256 or 16 color palette. This is often detected automatically. .UNINDENT .INDENT 0.0 .TP .B fish_term256 If this is set to 1, fish will assume the terminal understands 256 colors, and won\(aqt translate matching colors down to the 16 color palette. This is usually autodetected. .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 should usually be auto\-detected. .UNINDENT .INDENT 0.0 .TP .B fish_autosuggestion_enabled controls if \fI\%Autosuggestions\fP are enabled. Set it to 0 to disable, anything else to enable. By default they are on. .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 \fI\%command\-line editor\fP\&. .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 \fI\%the chapter in the bind documentation\fP\&. .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 \fI\%Key sequences\fP\&. .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 \fI\%Copy and Paste\fP). .UNINDENT .INDENT 0.0 .TP .B fish_function_path determines where fish looks for functions. When fish \fI\%autoloads\fP 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 \fI\%funced\fP) .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 \fI\%FISH_DEBUG_OUTPUT\fP variable. It goes to stderr by default. .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 \fI\%PATH\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 \fI\%umask\fP function. An attempt to set umask to an invalid value will always fail. .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 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 \fI\%kill ring\fP of cut text. .UNINDENT .INDENT 0.0 .TP .B fish_read_limit how many bytes fish will process with \fI\%read\fP or in a \fI\%command substitution\fP\&. .UNINDENT .INDENT 0.0 .TP .B fish_pid the process ID (PID) of the shell. .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 \fI\%read\fP builtin. Setting this to the empty string will also disable line splitting in \fI\%command substitution\fP\&. 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 \fI\%exit status\fP\&. .UNINDENT .INDENT 0.0 .TP .B SHLVL the level of nesting of shells. Fish increments this in interactive shells, otherwise it simply passes it along. .UNINDENT .INDENT 0.0 .TP .B status the \fI\%exit status\fP 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 TERM the type of the current terminal. When fish tries to determine how the terminal works \- how many colors it supports, what sequences it sends for keys and other things \- it looks at this variable and the corresponding information in the terminfo database (see \fBman terminfo\fP). .sp Note: Typically this should not be changed as the terminal sets it to the correct value. .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 \fI\%not\fP (or \fB!\fP), which is useful in a \fI\%condition\fP\&. 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 \fI\%not\fP 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 \fI\%fish_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 that depend on language and cultural convention. In UNIX, these are made up of several categories. The categories 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 actual values are specific to their platform, except for special values like \fBC\fP or \fBPOSIX\fP\&. .sp The value of LANG is used for each category unless the variable for that category was set or LC_ALL is set. So typically you only need to set LANG. .sp An example value might be \fBen_US.UTF\-8\fP for the american version of english and the UTF\-8 encoding, or \fBde_AT.UTF\-8\fP for the austrian version of german and the UTF\-8 encoding. Your operating system might have a \fBlocale\fP command that you can call as \fBlocale \-a\fP to see a list of defined locales. .sp A UTF\-8 encoding is recommended. .UNINDENT .INDENT 0.0 .TP .B LC_ALL Overrides the \fI\%LANG\fP environment variable and the values of the other \fBLC_*\fP variables. If this is set, none of the other variables are used for anything. .sp Usually the other variables should be used instead. Use LC_ALL only when you need to override something. .UNINDENT .INDENT 0.0 .TP .B LC_COLLATE This determines the rules about equivalence of cases and alphabetical ordering: collation. .UNINDENT .INDENT 0.0 .TP .B LC_CTYPE This determines classification rules, like if the type of character is an alpha, digit, and so on. Most importantly, it defines the text \fIencoding\fP \- which numbers map to which characters. On modern systems, this should typically be something ending in \(dqUTF\-8\(dq. .UNINDENT .INDENT 0.0 .TP .B LC_MESSAGES \fBLC_MESSAGES\fP determines the language in which messages are diisplayed. .UNINDENT .INDENT 0.0 .TP .B LC_MONETARY Determines currency, how it is formatted, and the symbols used. .UNINDENT .INDENT 0.0 .TP .B LC_NUMERIC Sets the locale for formatting numbers. .UNINDENT .INDENT 0.0 .TP .B LC_TIME Sets the locale for formatting dates and times. .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 \- \fI\%cd\fP changes directory, \fI\%set\fP sets variables .IP \(bu 2 Builtins for dealing with data, like \fI\%string\fP for strings and \fI\%math\fP for numbers, \fI\%count\fP for counting lines or arguments, \fI\%path\fP for dealing with path .IP \(bu 2 \fI\%status\fP for asking about the shell\(aqs status .IP \(bu 2 \fI\%printf\fP and \fI\%echo\fP for creating output .IP \(bu 2 \fI\%test\fP for checking conditions .IP \(bu 2 \fI\%argparse\fP for parsing function arguments .IP \(bu 2 \fI\%source\fP to read a script in the current shell (so changes to variables stay) and \fI\%eval\fP to execute a string as script .IP \(bu 2 \fI\%random\fP to get random numbers or pick a random element from a list .IP \(bu 2 \fI\%read\fP 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 \fI\%list of commands\fP\&. 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 \fI\%function\fP\&. .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 \fI\%fish_function_path\fP, it \fI\%loads that\fP\&. (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 \fI\%builtin\fP\&. .IP 3. 3 It tries to find an executable file in \fI\%PATH\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 \fI\%fish_command_not_found\fP and sets \fI\%status\fP to 127. .sp You can use \fI\%type\fP 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 \fI\%read\fP builtin. .sp Let\(aqs make up an example. This function will \fI\%glob\fP the files in all the directories it gets as \fI\%arguments\fP, and \fI\%if\fP there are \fI\%more than five\fP 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 just 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 keyboard\-protocols on 4.0 Use keyboard protocols (kitty, xterm\(aqs modifyotherkeys .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 simply 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 i 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 \fI\%fish_pid\fP variable. .IP \(bu 2 \fBtest\-require\-arg\fP removes \fI\%builtin test\fP\(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 \fI\%debug message\fP of category \(dqdeprecated\-test\(dq, so starting fish with \fBfish \-\-debug=deprecated\-test\fP can be used to find offending calls. .IP \(bu 2 \fBkeyboard\-protocols\fP lets fish turn on various keyboard protocols including the kitty keyboard protocol. It was introduced in 4.0 and is on by default. Disable it with \fBno\-keyboard\-protocols\fP to work around bugs in your terminal. .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 \fI\%emit\fP 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 \fI\%source\fP or execute a function instead of relying on \fI\%autoloading\fP\&. One approach is to put it into your \fI\%configuration file\fP\&. .sp For more information on how to define new event handlers, see the documentation for the \fI\%function\fP 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 \fI\%printf\fP and \fI\%set\fP\&. As another example, you can run \fI\%status print\-stack\-trace\fP to see how the current breakpoint was reached. To resume normal execution of the script, simply type \fI\%exit\fP or \fBctrl\fP\-\fBd\fP\&. .sp To start a debug session simply insert the \fI\%builtin command\fP \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 \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 \fI\%fish_trace\fP variable, e.g. \fBfish_trace=1 fish_prompt\fP to see which commands fish executes when running the \fI\%fish_prompt\fP 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 \fI\%function\fP or \fI\%command substitutions\fP) 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 \fI\%fish\fP 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 \fI\%if\fP and \fI\%else\fP for conditions. .IP \(bu 2 \fI\%for\fP and \fI\%while\fP for loops. .IP \(bu 2 \fI\%break\fP and \fI\%continue\fP to control loops. .IP \(bu 2 \fI\%function\fP to define functions. .IP \(bu 2 \fI\%return\fP to return a status from a function. .IP \(bu 2 \fI\%begin\fP to begin a block and \fI\%end\fP to end any block (including ifs and loops). .IP \(bu 2 \fI\%and\fP, \fI\%or\fP and \fI\%not\fP to combine commands logically. .IP \(bu 2 \fI\%switch\fP and \fI\%case\fP to make multiple blocks depending on the value of a variable. .IP \(bu 2 \fI\%command\fP or \fI\%builtin\fP to tell fish what sort of thing to execute .IP \(bu 2 \fI\%time\fP to time execution .IP \(bu 2 \fI\%exec\fP tells fish to replace itself with a command. .IP \(bu 2 \fI\%end\fP to end a block .UNINDENT .SS Tools .sp Builtins to do a task, like .INDENT 0.0 .IP \(bu 2 \fI\%cd\fP to change the current directory. .IP \(bu 2 \fI\%echo\fP or \fI\%printf\fP to produce output. .IP \(bu 2 \fI\%set_color\fP to colorize output. .IP \(bu 2 \fI\%set\fP to set, query or erase variables. .IP \(bu 2 \fI\%read\fP to read input. .IP \(bu 2 \fI\%string\fP for string manipulation. .IP \(bu 2 \fI\%path\fP for filtering paths and handling their components. .IP \(bu 2 \fI\%math\fP does arithmetic. .IP \(bu 2 \fI\%argparse\fP to make arguments easier to handle. .IP \(bu 2 \fI\%count\fP to count arguments. .IP \(bu 2 \fI\%type\fP to find out what sort of thing (command, builtin or function) fish would call, or if it exists at all. .IP \(bu 2 \fI\%test\fP checks conditions like if a file exists or a string is empty. .IP \(bu 2 \fI\%contains\fP to see if a list contains an entry. .IP \(bu 2 \fI\%eval\fP and \fI\%source\fP to run fish code from a string or file. .IP \(bu 2 \fI\%status\fP to get shell information, like whether it\(aqs interactive or a login shell, or which file it is currently running. .IP \(bu 2 \fI\%abbr\fP manages \fI\%Abbreviations\fP\&. .IP \(bu 2 \fI\%bind\fP to change bindings. .IP \(bu 2 \fI\%complete\fP manages \fI\%completions\fP\&. .IP \(bu 2 \fI\%commandline\fP to get or change the commandline contents. .IP \(bu 2 \fI\%fish_config\fP to easily change fish\(aqs configuration, like the prompt or colorscheme. .IP \(bu 2 \fI\%random\fP 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 \fI\%fish_prompt\fP and \fI\%fish_right_prompt\fP and \fI\%fish_mode_prompt\fP to print your prompt. .IP \(bu 2 \fI\%fish_command_not_found\fP to tell fish what to do when a command is not found. .IP \(bu 2 \fI\%fish_title\fP to change the terminal\(aqs title. .IP \(bu 2 \fI\%fish_greeting\fP to show a greeting when fish starts. .IP \(bu 2 \fI\%fish_should_add_to_history\fP 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 \fI\%fish_git_prompt\fP and \fI\%fish_hg_prompt\fP to print information about the current git or mercurial repository. .IP \(bu 2 \fI\%fish_vcs_prompt\fP to print information for either. .IP \(bu 2 \fI\%fish_svn_prompt\fP to print information about the current svn repository. .IP \(bu 2 \fI\%fish_status_to_signal\fP to give a signal name from a return status. .IP \(bu 2 \fI\%prompt_pwd\fP to give the current directory in a nicely formatted and shortened way. .IP \(bu 2 \fI\%prompt_login\fP 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 \fI\%prompt_hostname\fP to give the hostname, shortened for use in the prompt. .IP \(bu 2 \fI\%fish_is_root_user\fP to check if the current user is an administrator user like root. .IP \(bu 2 \fI\%fish_add_path\fP to easily add a path to $PATH. .IP \(bu 2 \fI\%alias\fP to quickly define wrapper functions (\(dqaliases\(dq). .IP \(bu 2 \fI\%fish_delta\fP to show what you have changed from the default configuration. .IP \(bu 2 \fI\%export\fP 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 \fI\%fish_indent\fP to format fish code and \fI\%fish_key_reader\fP 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 It is equivalent to \fBgettext fish STRING\fP, meaning it can only be used to look up fish\(aqs own translations. .sp It requires fish to be built with gettext support. If that support is disabled, or there is no translation it will simply echo the argument back. .sp The language depends on the current locale, set with \fI\%LANG\fP and \fI\%LC_MESSAGES\fP\&. .SS Options .sp \fB_\fP takes no options. .SS Examples .INDENT 0.0 .INDENT 3.5 .sp .EX > _ File Datei .EE .UNINDENT .UNINDENT .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 \fINAME\fP \&... \fBabbr\fP \fB\-\-rename\fP \fIOLD_WORD\fP \fINEW_WORD\fP \fBabbr\fP \fB\-\-show\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 \fI\%Examples\fP 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 \fI\%config.fish\fP 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 \fI\%config.fish\fP, 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 \fI\%configuration file\fP 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 \fI\%funcsave\fP\&. .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 OLD_NAME NEW_NAME .EE .UNINDENT .UNINDENT .sp Renames an abbreviation, from \fIOLD_NAME\fP to \fINEW_NAME\fP .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] NAME .EE .UNINDENT .UNINDENT .sp Erases the abbreviation with the given name .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 \fI\%function\fP\&. .sp If you want to ease your interactive use, to save typing, consider using an \fI\%abbreviation\fP 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 \fI\%funcsave\fP\&. .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 \fI\%function\fP command this builds on. .IP 2. 3 \fI\%Functions\fP\&. .IP 3. 3 \fI\%Defining aliases\fP\&. .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 \fI\%while\fP or \fI\%if\fP 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 \fI\%$status\fP 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 \fI\%or\fP command .IP \(bu 2 \fI\%not\fP 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, and sets \fB$argv\fP to the remaining arguments. See the \fI\%usage\fP section below. .sp Each option specification (\fBOPTION_SPEC\fP) is written in the \fI\%domain specific language\fP 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 just 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 The command name for use 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\-i\fP or \fB\-\-ignore\-unknown\fP Ignores unknown options, keeping them and their arguments in $argv instead. .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\-\-ignore\-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, followed by a \fB/\fP if the short flag can be used by someone invoking your command or, for backwards compatibility, a \fB\-\fP if it should not be exposed as a valid short flag (in which case it will also not be exposed as a flag variable). .IP \(bu 2 An optional long flag name, which if not present the short flag can be used, and if that is also not present, an error is reported .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. .UNINDENT .UNINDENT .UNINDENT .IP \(bu 2 Optionally a \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 \fI\%Flag Value Validation\fP for more information. .UNINDENT .sp See the \fI\%fish_opt\fP 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 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 simply 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 just call \fB_validate_int\fP without those flags is to simply 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 \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 \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 \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. .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 just wants 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 \fI\%fish_add_path \- add to the path\fP 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 .SS Limitations .sp One limitation with \fB\-\-ignore\-unknown\fP is that, if an unknown option is given in a group with known options, the entire group will be kept in $argv. \fBargparse\fP will not do any permutations here. .sp For instance: .INDENT 0.0 .INDENT 3.5 .sp .EX argparse \-\-ignore\-unknown h \-\- \-ho echo $_flag_h # is \-h, because \-h was given echo $argv # is still \-ho .EE .UNINDENT .UNINDENT .sp This limitation may be lifted in future. .sp Additionally, it can only parse known options up to the first unknown option in the group \- the unknown option could take options, so it isn\(aqt clear what any character after an unknown option means. .SS begin \- start a new block of code .SS Synopsis .nf \fBbegin\fP\fB;\fP [\fICOMMANDS\fP \&...]\fB;\fP \fBend\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 \fI\%variable scope\fP, 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 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 \fI\%jobs\fP 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 \fI\%jobs\fP\&. .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 job specifier. .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] [\fIKEYS\fP] \fBbind\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-\-preset\fP] [\fB\-\-user\fP] \fBbind\fP (\fB\-f\fP | \fB\-\-function\-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, any existing binding in the given \fBMODE\fP will be printed. .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 and \fBshift\-\fP\&. 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 \fBminus\fP (\fB\-\fP), .IP \(bu 2 \fBpageup\fP, .IP \(bu 2 \fBpagedown\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 \fI\%fish_key_reader\fP\&. .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 \fI\%see below\fP 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 If no \fBKEYS\fP argument is provided, all bindings (in the given \fBMODE\fP) are printed. If \fBKEYS\fP is provided but no \fBCOMMAND\fP, just the binding matching that sequence is printed. .sp Key bindings may use \(dqmodes\(dq, which mimics vi\(aqs modal input behavior. The default mode is \(dqdefault\(dq. 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 \fI\%config.fish\fP\&. 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\-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 .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 some of the error messages, including for unknown key names and unbound sequences. .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\-bigword\fP move one whitespace\-delimited word to the left .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\-bigword\fP move the whitespace\-delimited word to the left of the cursor to the killring .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 .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. The \(dqword\(dq here is everything up to punctuation or whitespace. .TP .B \fBbackward\-word\fP move one word to the left .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, or otherwise cancel the current commandline and replace it with a new empty one .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. if the terminal doesn\(aqt support clearing the screen it is the same as \fBrepaint\fP\&. .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 first line .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\-bigword\fP move one whitespace\-delimited word to the right .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\-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. .TP .B \fBforward\-word\fP move one word to the right; or if at the end of the commandline, accept one word from the current autosuggestion. .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\-pager\-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 \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\-bigword\fP move the next whitespace\-delimited word to the killring .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\-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 .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 \fI\%fish_mode_prompt\fP 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 \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 \fI\%vi key bindings\fP 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 .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 \fI\%fish_key_reader \- explore what characters keyboard keys send\fP\&. 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 \fI\%fish_sequence_key_delay_ms\fP 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 \fI\%fish_escape_delay_ms\fP\&. .sp See also \fI\%Key sequences\fP\&. .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 \fI\%emit\fP, 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 \fI\%for\fP or \fI\%while\fP loop. It is usually added inside of a conditional block such as an \fI\%if\fP block. .sp There are no parameters for \fBbreak\fP\&. .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 \fI\%continue\fP 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 \fI\%Debugging fish scripts\fP 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 \fI\%HOME\fP environment variable will be used. .sp If \fIDIRECTORY\fP is a relative path, all the paths in the \fI\%CDPATH\fP will be tried as prefixes for it, in addition to \fI\%PWD\fP\&. It is recommended to keep \fB\&.\fP as the first element of \fI\%CDPATH\fP, or \fI\%PWD\fP 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 \fI\%prevd\fP\&. 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 \fI\%directory history\fP or the \fI\%directory stack\fP .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 \fI\%recently visited directories\fP\&. 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 \fI\%dirh\fP command to print the directory history .IP \(bu 2 the \fI\%prevd\fP command to move backward .IP \(bu 2 the \fI\%nextd\fP 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 \fI\%PATH\fP, 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 \fI\%PATH\fP\&. .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 \fI\%bind\fP 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 or \fB\-\-insert\fP Do not remove the current commandline, insert the specified string at the current cursor position .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. .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\-\-tokens\-raw\fP Print arguments in the selection as they appear on the command line, one per line. .TP \fB\-o\fP or \fBtokenize\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 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] \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 \fI\%Writing your own completions\fP 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 (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\-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 \fI\%autoloaded\fP, you will have to trigger them first. .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 \fI\%PATH\fP 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 \fI\%for\fP loop or a \fI\%while\fP loop. It is usually added inside of a conditional block such as an \fI\%if\fP statement or a \fI\%switch\fP statement. .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 \fI\%break\fP 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 \fI\%directory history\fP\&. 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 \fI\%cd\fP 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 \fI\%cdh\fP command to display a prompt to quickly navigate the history .IP \(bu 2 the \fI\%prevd\fP command to move backward .IP \(bu 2 the \fI\%nextd\fP 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 \fI\%directory stack\fP, as created by \fI\%pushd\fP and modified by \fI\%popd\fP\&. .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 \fI\%cdh\fP 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 \fI\%job\fP 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 \fI\%bg\fP and \fI\%fg\fP). 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 \fI\%bg\fP 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 \fI\%jobs\fP 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 \fI\%printf\fP 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 \fI\%if\fP 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 \fI\%event handlers\fP\&. 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 \fI\%begin\fP to start a block of commands .IP \(bu 2 \fI\%function\fP to define a function .IP \(bu 2 \fI\%if\fP, \fI\%switch\fP to conditionally execute commands .IP \(bu 2 \fI\%while\fP, \fI\%for\fP 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 \fI\%source\fP 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 \fI\%source\fP 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 \fI\%set\fP 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 \fI\%combine the list\fP\&. 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 \fI\%set\fP 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 \fI\%true\fP command .IP \(bu 2 \fI\%$status\fP 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 \fI\%job\fP 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 \fI\%jobs\fP\&. .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 \fI\%full manual\fP is available in HTML by using the \fBhelp\fP command from inside fish, and in the \fIfish\-doc(1)\fP man page. The \fI\%tutorial\fP 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, passing additional positional arguments through \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 \fI\%Debugging\fP 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 \fI\%fish_trace\fP\&. The default is standard error. .TP \fB\-i\fP or \fB\-\-interactive\fP The shell is interactive. .TP \fB\-\-install[=PATH]\fP When built as self\-installable (via cargo), this will unpack fish\(aqs data files and place them in \fB~/.local/share/fish/install/\fP\&. fish will also ask to do this automatically when run interactively. If PATH is given, fish will install itself into a relocatable directory tree rooted at that path. That means it will install the data files to PATH/share/fish and copy itself to PATH/bin/fish. .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 \fI\%private mode\fP: \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 \fI\%feature flags\fP\&. .UNINDENT .sp The \fBfish\fP exit status is generally the \fI\%exit status of the last foreground command\fP\&. .SS Debugging .sp While fish provides extensive support for \fI\%debugging fish scripts\fP, 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 \fI\%fish_trace\fP 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 \fI\%FISH_DEBUG\fP and \fI\%FISH_DEBUG_OUTPUT\fP 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 \fI\%FISH_DEBUG_OUTPUT\fP\&. .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 \fI\%PATH\fP\&. It does this by adding the directories either to \fI\%fish_user_paths\fP or directly to \fI\%PATH\fP (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 \fI\%universal variables\fP\&. 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 \fI\%fish_user_paths\fP if you have that already). If you need more control, consider modifying the variable yourself. .sp Directories are normalized with \fI\%realpath\fP\&. 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 \fI\%PATH\fP, so they still stay ahead of the system paths. If the \fB\-\-path\fP option is used, the paths are appended/prepended to \fI\%PATH\fP directly, so this doesn\(aqt happen. .sp With \fB\-\-path\fP, because \fI\%PATH\fP must be a global variable instead of a universal one, the changes won\(aqt persist, so those calls need to be stored in \fI\%config.fish\fP\&. This also applies to \fI\%fish_user_paths\fP if you make it global (for instance by passing \fB\-\-global\fP). .sp If no directory is new, the variable (\fI\%fish_user_paths\fP or \fI\%PATH\fP) 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 \fI\%fish_user_paths\fP\&. .TP \fB\-U\fP or \fB\-\-universal\fP Use a universal \fI\%fish_user_paths\fP \- this is the default if it doesn\(aqt already exist. .TP \fB\-P\fP or \fB\-\-path\fP Manipulate \fI\%PATH\fP 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 \fI\%set\fP 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 \fI\%breakpoint\fP command. .sp The exit status of commands within \fBfish_breakpoint_prompt\fP will not modify the value of \fI\%$status\fP 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 normal) \(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 \fI\%isatty\fP), 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. .UNINDENT .SS See also .INDENT 0.0 .IP \(bu 2 \fI\%fish_clipboard_paste \- get text from the system\(aqs clipboard\fP 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 \fI\%isatty\fP), 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 \fI\%fish_clipboard_copy \- copy text to the system\(aqs clipboard\fP 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 \fI\%event\fP 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 (\fBchoose\fP | \fBdemo\fP | \fBdump\fP | \fBlist\fP | \fBsave\fP | \fBshow\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 \fI\%funcsave\fP). .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 sample theme in the current session. .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 sample themes. .IP \(bu 2 \fBsave\fP saves the given theme to \fI\%universal variables\fP\&. .IP \(bu 2 \fBshow\fP shows what the given sample theme (or all) would look like. .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: \(aqCool Beans\(aq # preferred_background: black fish_color_autosuggestion 666 fish_color_cancel \-r fish_color_command normal fish_color_comment \(aq888\(aq \(aq\-\-italics\(aq fish_color_cwd 0A0 fish_color_cwd_root A00 fish_color_end 009900 .EE .UNINDENT .UNINDENT .sp The two comments at the beginning are the name and background that the web config tool shows. .sp The other lines are just like \fBset variable value\fP, except that no expansions are allowed. Quotes are, but aren\(aqt necessary. .sp Any color variable fish knows about that the theme doesn\(aqt set will be set to empty when it is loaded, so the old theme is completely overwritten. .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 \fI\%config.fish\fP to set the prompt. .sp \fBfish_config prompt save\fP saves the current prompt to an \fI\%autoloaded\fP 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 \fI\%here\fP\&. .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 (\fI\%fish_function_path\fP for functions and \fI\%fish_complete_path\fP 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 .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 \X'tty: link https://git-scm.com'\fI\%Git\fP <\fBhttps://git-scm.com\fP>\X'tty: link' must be installed. .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 \fI\%set\fP 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 \fI\%fish_vcs_prompt\fP, 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 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 \fI\%config.fish\fP\&. .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 normal) 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 \X'tty: link https://www.mercurial-scm.org/'\fI\%Mercurial\fP <\fBhttps://www.mercurial-scm.org/\fP>\X'tty: link' (\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 \-\-universal 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 \fI\%fish_vcs_prompt\fP, 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, appropriate for the current \fI\%TERM\fP, using the colors defined in the environment (such as \fI\%fish_color_command\fP). .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\-d\fP or \fB\-\-debug=DEBUG_CATEGORIES\fP Enable debug output and specify a pattern for matching debug categories. See \fI\%Debugging\fP in \fI\%fish\fP (1) for details. .TP \fB\-o\fP or \fB\-\-debug\-output=DEBUG_FILE\fP Specify a file path to receive the debug output, including categories and \fBfish_trace\fP\&. The default is standard error. .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 \fI\%bind\fP 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 variable\fP can be used to determine the current mode. It will be one of \fBdefault\fP, \fBinsert\fP, \fBreplace_one\fP, or \fBvisual\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 (\fI\%fish_prompt\fP and \fI\%fish_right_prompt\fP) will be executed as well in case they contain a mode display. .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 visual set_color \-\-bold brmagenta echo \(aqV\(aq case \(aq*\(aq set_color \-\-bold red echo \(aq?\(aq end set_color normal 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\-slor\fP | \fB\-\-multiple\-vals\fP\fB=\fP) \fIOPTNAME\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 \fI\%argparse\fP 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 Takes a single letter that is used as the short flag in the option being defined. This option is mandatory. .TP \fB\-l\fP or \fB\-\-long\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 The option being defined will only allow the long flag name to be used. The short flag name must still be defined (i.e., \fB\-\-short\fP must be specified) but it cannot be used when parsing arguments using this option specification. .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\-\-multiple\-vals\fP The option being defined requires a value each time it is seen. Each instance is stored. This means the resulting flag variable created by \fBargparse\fP will have one element for each instance of this option in the arguments. .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 \-\-required\-val) 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 the long flag name (\fB\-\-token\fP) can be used: .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) set options $options (fish_opt \-\-short=t \-\-long=token \-\-multiple\-vals \-\-long\-only) 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 \fI\%$status\fP outside of the \fBfish_prompt\fP function. .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 normal) 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\&. .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. \fI\%status\fP can\(aqt be checked. This is so commands that don\(aqt finish like \fI\%exec \- execute command in current process\fP 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 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 \X'tty: link https://subversion.apache.org/'\fI\%Subversion\fP <\fBhttps://subversion.apache.org/\fP>\X'tty: link' (\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 \fI\%fish_vcs_prompt\fP, 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_title \- define the terminal\(aqs title .SS Synopsis .nf \fBfish_title\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX function fish_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 fish_title contains the most recently executed foreground command as a string, if any. .sp This requires that your terminal supports programmable titles and the feature is turned on. .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 .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 \fI\%fish_git_prompt\fP .IP \(bu 2 \fI\%fish_hg_prompt\fP .IP \(bu 2 \fI\%fish_svn_prompt\fP .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 \fI\%funced\fP\&. .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 \fI\%vi mode\fP\&. .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 \fI\%config.fish\fP\&. .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 \fI\%set\fP, \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 \fI\%funcsave\fP\&. To view a function\(aqs current definition, use \fI\%functions\fP or \fI\%type\fP\&. .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 \fI\%automatically loaded\fP 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 \fI\%functions\fP\(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 \fI\%event handlers\fP until they are run or otherwise sourced. To activate an event handler for every new shell, add the function to the \fI\%configuration file\fP instead of using \fBfuncsave\fP\&. .sp This is often used after \fI\%funced\fP, 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 \fI\%functions\fP or \fI\%type\fP\&. .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 Has to be the last option. Assigns the value of successive command\-line arguments to the names given in \fINAMES\fP (separated by space). These are the same arguments given in \fI\%argv\fP, and are still available there. See also \fI\%Argument Handling\fP\&. .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\&. See the documentation for \fI\%complete\fP for more information. .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 \fI\%emit\fP 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 identifier \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 \fI\%disowned\fP 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 \fI\%disowned\fP 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 \fI\%emit\fP builtin. Fish already generates a few events, see \fI\%Event handlers\fP 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 \fI\%Functions\fP\&. .SS functions \- print or erase functions .SS Synopsis .nf \fBfunctions\fP [\fB\-a\fP | \fB\-\-all\fP] [\fB\-n\fP | \fB\-\-names\fP] \fBfunctions\fP [\fB\-D\fP | \fB\-\-details\fP] [\fB\-v\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 \fI\%funcsave\fP 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 \fI\%source\fP, and \fBn/a\fP if the function isn\(aqt available. (Functions created via \fI\%alias\fP 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\-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 \fI\%Functions\fP\&. .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 \fI\%BROWSER\fP 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 \fI\%fg\fP 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 \fI\%history of interactive commands\fP\&. .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 simply 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. Just 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. Note that prior to fish 2.4.0 the default was case\-sensitive. .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. .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\-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 \fI\%else\fP is given, \fBCOMMANDS_FALSE\fP will be executed. .sp You can use \fI\%and\fP or \fI\%or\fP 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 \fI\%$status\fP 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 \fI\%test \- perform tests on files and text\fP can compare numbers, strings and check paths .IP \(bu 2 \fI\%string \- manipulate strings\fP can perform string operations including wildcard and regular expression matches .IP \(bu 2 \fI\%path \- manipulate and check paths\fP can check paths for permissions, existence or type .IP \(bu 2 \fI\%contains \- test if a word is present in a list\fP 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 \fI\%jobs\fP 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 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 .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 \fI\%history of visited directories\fP; 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 \fI\%cdh\fP command to display a prompt to quickly navigate the history .IP \(bu 2 the \fI\%dirh\fP command to print the directory history .IP \(bu 2 the \fI\%prevd\fP 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 \fI\%if\fP or \fI\%while\fP 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 \fI\%$status\fP 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 \fI\%and\fP 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] [\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] [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 \fBpath is\fP is shorthand for \fBpath filter \-q\fP, i.e. just checking without producing output, see \fI\%The is subcommand\fP\&. .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! .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 \fI\%the test documentation\fP\&. .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 simply 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 \fI\%directory stack\fP and changes the working directory to the new top directory. Use \fI\%pushd\fP 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 \fI\%dirs\fP command to print the directory stack .IP \(bu 2 the \fI\%cdh\fP 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 \fI\%history of visited directories\fP; 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 \fI\%cdh\fP command to display a prompt to quickly navigate the history .IP \(bu 2 the \fI\%dirh\fP command to print the directory history .IP \(bu 2 the \fI\%nextd\fP 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 \fI\%echo\fP, \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 \fI\%echo\fP 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 \fI\%PWD\fP\&. .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 .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 \fI\%directory stack\fP and makes it the current working directory. \fI\%popd\fP 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 \fI\%dirs\fP command to print the directory stack .IP \(bu 2 the \fI\%cdh\fP 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 \fI\%directory history\fP or the \fI\%directory stack\fP .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 \fI\%set \- display and change shell variables\fP 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 \fI\%set \- display and change shell variables\fP, 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 normal; 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 \-or \fB\-\-tokenize\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 \fI\%IFS\fP (like fish\(aqs tokenizer). It saves the tokens in the manner they\(aqd be passed to commands on the commandline, so e.g. \fBa\e b\fP is stored as \fBa b\fP\&. Note that currently it leaves command substitutions intact along with the parentheses. .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 simply 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 \fI\%fish_read_limit\fP 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 \fI\%while\fP 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 \fI\%Querying for user input\fP\&. .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 \fI\%PATH\fP, printing the absolute path resolved. \fI\%fish\fP 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 \fI\%if\fP statement or a \fI\%switch\fP 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 \fI\%exit\fP\&. If at the top level in an interactive session, it will set \fI\%status\fP, 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\-q\fP | \fB\-\-query\fP) (\fB\-e\fP | \fB\-\-erase\fP) [\fB\-Uflg\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 \fI\%shell variables\fP\&. .sp If both \fINAME\fP and \fIVALUE\fP are provided, \fBset\fP assigns any values to variable \fINAME\fP\&. Variables in fish are \fI\%lists\fP, 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 \fI\%scope\fP or \fI\%export\fP 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 \fI\%path variable\fP; 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 \fI\%path variable\fP\&. 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. 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 \fI\%status\fP 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 \fI\%special read\-only variable\fP\&. .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. .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. Fish will choose the closest supported color. 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. Depending on the capabilities of your terminal (and the level of support \fBset_color\fP has for it) the actual color may be approximated by a nearby matching reserved color name or \fBset_color\fP may not have an effect on color. .sp A second color may be given as a desired fallback color. e.g. \fBset_color 124212 brblue\fP will instruct set_color to use \fIbrblue\fP if a terminal is not capable of the exact shade of grey desired. This is very useful when an 8 or 16 color terminal might otherwise not use a color. .sp The following options are available: .INDENT 0.0 .TP \fB\-b\fP or \fB\-\-background\fP \fICOLOR\fP Sets the background color. .TP \fB\-c\fP or \fB\-\-print\-colors\fP Prints the given colors or a colored list of the 16 named colors. .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 Sets italics mode. .TP \fB\-r\fP or \fB\-\-reverse\fP Sets reverse mode. .TP \fB\-u\fP or \fB\-\-underline\fP Sets underlined mode. .TP \fB\-h\fP or \fB\-\-help\fP Displays help about using this command. .UNINDENT .sp Using the \fBnormal\fP keyword will reset foreground, background, and all formatting back to default. .SS Notes .INDENT 0.0 .IP 1. 3 Using the \fBnormal\fP keyword will reset both background and foreground colors to whatever is the default for the terminal. .IP 2. 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 3. 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 4. 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 Terminal Capability Detection .sp Fish uses some heuristics to determine what colors a terminal supports to avoid sending sequences that it won\(aqt understand. .sp In particular it will: .INDENT 0.0 .IP \(bu 2 Enable 256 colors if \fI\%TERM\fP contains \(dqxterm\(dq, except for known exceptions (like MacOS 10.6 Terminal.app) .IP \(bu 2 Enable 24\-bit (\(dqtrue\-color\(dq) even if the $TERM entry only reports 256 colors. This includes modern xterm, VTE\-based terminals like Gnome Terminal, Konsole and iTerm2. .IP \(bu 2 Detect support for italics, dim, reverse and other modes. .UNINDENT .sp If terminfo reports 256 color support for a terminal, 256 color support will always be enabled. .sp To force true\-color support on or off, set \fI\%fish_term24bit\fP to \(dq1\(dq for on and 0 for off \- \fBset \-g fish_term24bit 1\fP\&. .sp To debug color palette problems, \fBtput colors\fP may be useful to see the number of colors in terminfo for a terminal. Fish launched as \fBfish \-d term_support\fP will include diagnostic messages that indicate the color support mode in use. .sp The \fBset_color\fP command uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and lack color information for terminals that support it. Fish assumes that all terminals can use the \X'tty: link https://en.wikipedia.org/wiki/ANSI_escape_code'\fI\%ANSI X3.64\fP <\fBhttps://en.wikipedia.org/wiki/ANSI_escape_code\fP>\X'tty: link' escape sequences if the terminfo definition indicates a color below 16 is not supported. .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 \fI\%argv\fP variable. The \fI\%argv\fP 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 \fI\%PATH\fP . .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 \fI\%local scope\fP; \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 Caveats .sp In fish versions prior to 2.3.0, the \fI\%argv\fP variable would have a single element (the name of the sourced file) if no arguments are present. Otherwise, it would contain arguments without the name of the sourced file. That behavior was very confusing and unlike other shells such as bash and zsh. .SS status \- query fish runtime information .SS Synopsis .nf \fBstatus\fP \fBstatus\fP \fBis\-login\fP \fBstatus\fP \fBis\-interactive\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 \fBbuildinfo\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 \fI\%breakpoint\fP command. See also the \fI\%fish_breakpoint_prompt\fP 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\-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 \fI\%PATH\fP\&. .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 \fI\%_\fP 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 \fI\%source\fP, 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 \fI\%PWD\fP (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. .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 \fBbuildinfo\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 .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 (but not before fish 4.0). .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] [\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\-\-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] \fISEP\fP [\fISTRING\fP \&...] \fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...] .fi .sp .sp \fBstring join\fP joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise. If \fB\-n\fP or \fB\-\-no\-empty\fP is specified, empty strings are excluded 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). .sp \fBstring join0\fP joins its \fISTRING\fP arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&. Exit status: 0 if at least one join was performed, or 1 otherwise. .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 \fI\%command substitution\fP) 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 .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 simply 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 simply 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(?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 \(aq?\(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*\e?\(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(?\ed+).(?\ed+).(?\ed+)\(aq \-\- $version >_ echo \(dqYou are using fish $major!\(dq You are using fish 3! >_ string match \-raq \(aq *(?[^.!?]+)(?[.!?])?\(aq \(dqhello, friend. goodbye\(dq >_ printf \(dq%s\en\(dq \-\- $sentence hello, friend goodbye >_ printf \(dq%s\en\(dq \-\- $punctuation \&. >_ string match \-rq \(aq(?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\-\-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 \fI\%fish_emoji_width\fP and \fI\%fish_ambiguous_width\fP\&. 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\-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 \fI\%printf\fP command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&. .IP \(bu 2 \fI\%string length\fP 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 \fI\%fish_emoji_width\fP and \fI\%fish_ambiguous_width\fP\&. 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 \fI\%string\fP\(aqs \fBpad\fP subcommand does the inverse of this command, adding padding to a specific width instead. .IP \(bu 2 The \fI\%printf\fP command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&. .IP \(bu 2 \fI\%string length\fP 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\-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 \&...] .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 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 \fI\%read\fP 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. .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. >_ 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] \fISEP\fP [\fISTRING\fP \&...] \fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...] .fi .sp .SS Description .sp \fBstring join\fP joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise. If \fB\-n\fP or \fB\-\-no\-empty\fP is specified, empty strings are excluded 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). .sp \fBstring join0\fP joins its \fISTRING\fP arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&. Exit status: 0 if at least one join was performed, or 1 otherwise. .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 \fI\%command substitution\fP) 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 .EE .UNINDENT .UNINDENT .SS string\-join0 \- join strings with zero bytes .SS Synopsis .nf \fBstring\fP \fBjoin\fP [\fB\-q\fP | \fB\-\-quiet\fP] \fISEP\fP [\fISTRING\fP \&...] \fBstring\fP \fBjoin0\fP [\fB\-q\fP | \fB\-\-quiet\fP] [\fISTRING\fP \&...] .fi .sp .SS Description .sp \fBstring join\fP joins its \fISTRING\fP arguments into a single string separated by \fISEP\fP, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise. If \fB\-n\fP or \fB\-\-no\-empty\fP is specified, empty strings are excluded 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). .sp \fBstring join0\fP joins its \fISTRING\fP arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL\-delimited input, such as \fBsort \-z\fP\&. Exit status: 0 if at least one join was performed, or 1 otherwise. .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 \fI\%command substitution\fP) 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 .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 simply 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 simply 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(?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 \(aq?\(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*\e?\(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(?\ed+).(?\ed+).(?\ed+)\(aq \-\- $version >_ echo \(dqYou are using fish $major!\(dq You are using fish 3! >_ string match \-raq \(aq *(?[^.!?]+)(?[.!?])?\(aq \(dqhello, friend. goodbye\(dq >_ printf \(dq%s\en\(dq \-\- $sentence hello, friend goodbye >_ printf \(dq%s\en\(dq \-\- $punctuation \&. >_ string match \-rq \(aq(?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\-\-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 \fI\%fish_emoji_width\fP and \fI\%fish_ambiguous_width\fP\&. 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\-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 \fI\%printf\fP command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&. .IP \(bu 2 \fI\%string length\fP 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 \fI\%fish_emoji_width\fP and \fI\%fish_ambiguous_width\fP\&. 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 \fI\%string\fP\(aqs \fBpad\fP subcommand does the inverse of this command, adding padding to a specific width instead. .IP \(bu 2 The \fI\%printf\fP command can do simple padding, for example \fBprintf %10s\en\fP works like \fBstring pad \-w10\fP\&. .IP \(bu 2 \fI\%string length\fP 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\-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 \&...] .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 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 \fI\%read\fP 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. .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. >_ 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\-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 \&...] .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 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 \fI\%read\fP 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. .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. >_ 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 \fI\%break\fP 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 \fI\%feature flag\fP, 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 \X'tty: link https://en.wikipedia.org/wiki/Sticky_bit'\fI\%https://en.wikipedia.org/wiki/Sticky_bit\fP\X'tty: link'\&. .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 \fI\%feature flag\fP \- 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 simply 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 \fI\%status\fP: .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 \X'tty: link https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html'\fI\%IEEE Std 1003.1\-2008 (POSIX.1) standard\fP <\fBhttps://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html\fP>\X'tty: link'\&. 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 \fI\%string \- manipulate strings\fP, which can do string operations including wildcard and regular expression matching .IP \(bu 2 \fI\%path \- manipulate and check paths\fP, 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 \fI\%$CMD_DURATION\fP\&. .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 \fI\%CMD_DURATION\fP, 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 \fI\%event handler\fP\&. .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 \fI\%false\fP command .IP \(bu 2 \fI\%$status\fP 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 \fI\%PATH\fP, 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 \fI\%PATH\fP environment variable, or nothing otherwise. \fB\-\-force\-path\fP explicitly resolves only the path to executable files in \fI\%PATH\fP, 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\-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 \fI\%and\fP or \fI\%or\fP for complex conditions. Even more complex control can be achieved with \fBwhile true\fP containing a \fI\%break\fP\&. .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 \fI\%string split\fP, \fI\%string split0\fP or \fI\%string collect\fP\&. 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 \fI\%set\fP 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 \fI\%Shell variables\fP 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 \fI\%Wildcards\fP 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 \fI\%Quotes\fP 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 \fI\%string\fP 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 just use: .INDENT 0.0 .INDENT 3.5 .sp .EX command | source .EE .UNINDENT .UNINDENT .sp as fish\(aqs \fI\%source\fP can read from stdin. .SS Heredocs .sp Fish does not have \fB< 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 \fI\%command substitutions\fP, 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 \fI\%glob\fP\&. .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 \fI\%fish_prompt\fP function, plus the \fI\%fish_mode_prompt\fP function if \fI\%vi mode\fP is enabled. The output of the \fI\%fish_right_prompt\fP 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> 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 normal) end .EE .UNINDENT .UNINDENT .sp This shows a few differences: .INDENT 0.0 .IP \(bu 2 Fish provides \fI\%set_color\fP 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 simply a function. To achieve the effect of \fB\eh\fP, fish provides helper functions like \fI\%prompt_hostname\fP, which prints a shortened version of the hostname. .IP \(bu 2 Fish offers other helper functions for adding things to the prompt, like \fI\%fish_vcs_prompt\fP for adding a display for common version control systems (git, mercurial, svn), and \fI\%prompt_pwd\fP 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 just 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 simply 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 \fI\%command substitutions\fP, 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 \fI\%string\fP \- 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 \fI\%math\fP \- this replaces \fB$((i + 1))\fP arithmetic and can also do floats and some simple functions (sine and friends). .IP \(bu 2 \fI\%argparse\fP \- this can handle a script\(aqs option parsing, for which bash would probably use \fBgetopt\fP (zsh provides \fBzparseopts\fP). .IP \(bu 2 \fI\%count\fP can be used to count things and therefore replaces \fB$#\fP and can be used instead of \fBwc\fP\&. .IP \(bu 2 \fI\%status\fP 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 \fI\%fish_trace\fP\&. .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 \fI\%page for the fish command\fP\&. .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 \fI\%how to change your prompt\fP\&. .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 \fI\%Fish For Bash Users\fP\&. .sp For the full, detailed description of how to use fish interactively, see \fI\%Interactive Use\fP\&. .sp For a comprehensive description of fish\(aqs scripting language, see \fI\%The Fish Language\fP\&. .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 \fI\%escape\fP with a backslash, or \fI\%quote\fP 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 \fI\%color variables\fP 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 \fI\%Variable expansion\fP\&. .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 \fI\%scope\fP! Usually you\(aqd make them global via \fBset \-gx MyVariable SomeValue\fP\&. .sp For more, see \fI\%Exporting variables\fP\&. .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 \fI\%Brace expansion\fP\&. 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 \fI\%Lists\fP\&. For more on combining lists with strings (or even other lists), see \fI\%cartesian products\fP and \fI\%Variable expansion\fP\&. .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 \fI\%Wildcards\fP\&. .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 \fI\%Input and output redirections\fP and \fI\%Pipes\fP\&. .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 \fI\%Command substitution\fP\&. .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 \fI\%The status variable\fP\&. .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 \fI\%and\fP, \fI\%or\fP, and \fI\%not\fP\&. 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 \fI\%the section on the semicolon\fP, 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 \fI\%if\fP and \fI\%else\fP 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 \fI\%test\fP, 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 \fI\%Combiners\fP 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 \fI\%begin\fP and \fI\%end\fP to group parts of them. .sp There is also a \fI\%switch\fP 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, \fI\%case\fP does not fall through, and can accept multiple arguments or (quoted) wildcards. .sp For more, see \fI\%Conditions\fP\&. .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 \fI\%function\fP 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 \fI\%functions\fP 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 \fI\%Functions\fP\&. .IP [2] 5 There is a function called \fI\%alias\fP, but it\(aqs just a shortcut to make functions. fish also provides \fI\%abbreviations\fP, through the \fI\%abbr\fP 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 \fI\%Loops and blocks\fP\&. .SS Prompt .sp Unlike other shells, there is no prompt variable like \fBPS1\fP\&. To display your prompt, fish executes the \fI\%fish_prompt\fP function and uses its output as the prompt. And if it exists, fish also executes the \fI\%fish_right_prompt\fP 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 \fI\%set_color\fP, 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 F00 echo (pwd) \(aq>\(aq (set_color normal) 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 You can choose among some 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 \fI\%list\fP, 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 \fI\%Exports\fP\&. .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 \fI\%path variable\fP, 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 \fI\%this example\fP\&. .sp A faster way is to use the \fI\%fish_add_path\fP 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 \fI\%universal variable\fP, 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 \fI\%config.fish\fP, 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 \fI\%Configuration Files\fP 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 \fI\%funced\fP and \fI\%funcsave\fP for ways to create these files automatically, and \fI\%$fish_function_path\fP 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 \fI\%config files\fP\&. For more details, see \fI\%Universal Variables\fP\&. .SS Ready for more? .sp If you want to learn more about fish, there is \fI\%lots of detailed documentation\fP, the \X'tty: link https://gitter.im/fish-shell/fish-shell'\fI\%official gitter channel\fP <\fBhttps://gitter.im/fish-shell/fish-shell\fP>\X'tty: link', an \X'tty: link https://lists.sourceforge.net/lists/listinfo/fish-users'\fI\%official mailing list\fP <\fBhttps://lists.sourceforge.net/lists/listinfo/fish-users\fP>\X'tty: link', and the \X'tty: link https://github.com/fish-shell/fish-shell/'\fI\%github page\fP <\fBhttps://github.com/fish-shell/fish-shell/\fP>\X'tty: link'\&. .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, 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 \fI\%complete\fP 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 > myprog \-\-output= .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 .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 > myprog \-\-output= > myprog \-o > myprog \-\-output .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_subcommands_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 \fI\%Further help and development\fP\&. .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 \fI\%fish_config\fP 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 \fI\%scripting language\fP\&. .sp Unlike other shells, fish\(aqs prompt is built by running a function \- \fI\%fish_prompt\fP\&. Or, more specifically, three functions: .INDENT 0.0 .IP \(bu 2 \fI\%fish_prompt\fP, which is the main prompt function .IP \(bu 2 \fI\%fish_right_prompt\fP, which is shown on the right side of the terminal. .IP \(bu 2 \fI\%fish_mode_prompt\fP, which is shown if \fI\%vi mode\fP is used. .UNINDENT .sp These functions are run, and whatever they print is displayed as the prompt (minus one trailing newline). .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 (\fI\%PWD\fP) and a \fB>\fP symbol to show where the prompt ends. The \fB>\fP is \fI\%quoted\fP because otherwise it would signify a \fI\%redirection\fP\&. .sp Because we\(aqve used \fI\%echo\fP, 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 \fI\%string join\fP 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 \fI\%printf\fP\&. .SS Adding color .sp This prompt is functional, but a bit boring. We could add some color. .sp Fortunately, fish offers the \fI\%set_color\fP 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 normal) \(aq>\(aq end .EE .UNINDENT .UNINDENT .sp A \(dqnormal\(dq color tells the terminal to go back to its normal 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 \fI\%PWD\fP can be a bit long, and we are typically only interested in the last few directories. We can shorten this with the \fI\%prompt_pwd\fP 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 normal) \(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 normal) \(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 \fI\%status\fP\&. 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 \fI\%set\fP) changes the status, you need to store it for later use as the first thing in your prompt. Use a \fI\%local variable\fP 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 normal) 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 normal) $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 normal) end string join \(aq\(aq \-\- (set_color green) (prompt_pwd) (set_color normal) $stat \(aq>\(aq end .EE .UNINDENT .UNINDENT .sp And it looks like: .INDENT 0.0 .INDENT 3.5 .sp .EX ~/M/L/Oneknowing[1]>_ .EE .UNINDENT .UNINDENT .sp after we run \fBfalse\fP (which returns 1). .SS Save the prompt .sp Once you are happy with your prompt, you can save it with \fBfuncsave fish_prompt\fP (see \fI\%funcsave \- save the definition of a function to the user\(aqs autoload directory\fP) 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 \fI\%funced \- edit a function interactively\fP). .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 \fI\%fish_right_prompt\fP or a vi mode prompt by changing \fI\%fish_mode_prompt\fP\&. .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 \fI\%fish_config\fP, 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.0.0 (released February 27, 2025) .sp fish\(aqs core code has been ported from C++ to Rust (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9512'\fI\%#9512\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9512\fP>\X'tty: link'). 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 \fI\%For Distributors\fP 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 \fI\%below\fP 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10935'\fI\%#10935\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10935\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9593'\fI\%#9593\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9593\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10249'\fI\%#10249\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10249\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9944'\fI\%#9944\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9944\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10506'\fI\%#10506\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10506\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5263'\fI\%#5263\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5263\fP>\X'tty: link'). 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 \X'tty: link https://sw.kovidgoyal.net/kitty/keyboard-protocol/'\fI\%kitty keyboard protocol\(aqs\fP <\fBhttps://sw.kovidgoyal.net/kitty/keyboard-protocol/\fP>\X'tty: link' progressive enhancements (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10359'\fI\%#10359\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10359\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/11056'\fI\%#11056\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/11056\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10367'\fI\%#10367\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10367\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10302'\fI\%#10302\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10302\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8186'\fI\%#8186\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8186\fP>\X'tty: link'). .IP \(bu 2 Special input functions run from bindings via \fBcommandline \-f\fP are now applied immediately, instead of after the currently executing binding (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3031'\fI\%#3031\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3031\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/10126'\fI\%#10126\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10126\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10131'\fI\%#10131\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10131\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9751'\fI\%#9751\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9751\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9411'\fI\%#9411\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9411\fP>\X'tty: link'). .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 \fI\%eval\fP in completion scripts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10212'\fI\%#10212\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10212\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10262'\fI\%#10262\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10262\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10365'\fI\%#10365\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10365\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10269'\fI\%#10269\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10269\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10774'\fI\%#10774\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10774\fP>\X'tty: link'). .UNINDENT .SS Scripting improvements .INDENT 0.0 .IP \(bu 2 \fBfor\fP loops will no longer remember local variables from the previous iteration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10525'\fI\%#10525\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10525\fP>\X'tty: link'). .IP \(bu 2 A new \fBhistory append\fP subcommand appends a command to the history, without executing it (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4506'\fI\%#4506\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4506\fP>\X'tty: link'). .IP \(bu 2 A new redirection: \fB\X'tty: link') .IP \(bu 2 A new option \fBcommandline \-\-tokens\-raw\fP prints a list of tokens without any unescaping (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10212'\fI\%#10212\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10212\fP>\X'tty: link'). .IP \(bu 2 A new option \fBcommandline \-\-showing\-suggestion\fP tests whether an autosuggestion is currently displayed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10586'\fI\%#10586\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10586\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions\fP and \fBtype\fP now show that a function was copied and its source, rather than solely \fBDefined interactively\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6575'\fI\%#6575\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6575\fP>\X'tty: link'). .IP \(bu 2 Stack trace now shows line numbers for copied functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6575'\fI\%#6575\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6575\fP>\X'tty: link'). .IP \(bu 2 \fBfoo & && bar\fP is now a syntax error, like in other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9911'\fI\%#9911\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9911\fP>\X'tty: link'). .IP \(bu 2 \fBif \-e foo; end\fP now prints a more accurate error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10000'\fI\%#10000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10000\fP>\X'tty: link'). .IP \(bu 2 \fBcd\fP into a directory that is not readable but accessible (permissions \fB\-\-x\fP) is now possible (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10432'\fI\%#10432\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10432\fP>\X'tty: link'). .IP \(bu 2 An integer overflow in \fBstring repeat\fP leading to a near\-infinite loop has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9899'\fI\%#9899\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9899\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9854'\fI\%#9854\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9854\fP>\X'tty: link'). .IP \(bu 2 \fBstring pad\fP no longer allows non\-printable characters as padding (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9854'\fI\%#9854\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9854\fP>\X'tty: link'). .IP \(bu 2 \fBstring repeat\fP now allows omission of \fB\-n\fP when the first argument is an integer (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10282'\fI\%#10282\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10282\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10587'\fI\%#10587\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10587\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10480'\fI\%#10480\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10480\fP>\X'tty: link'). .IP \(bu 2 Commas in command substitution output are no longer used as separators in brace expansion, preventing a surprising expansion in some cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5048'\fI\%#5048\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5048\fP>\X'tty: link'). .IP \(bu 2 Universal variables can now store strings containing invalid UTF\-8 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10313'\fI\%#10313\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10313\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10521'\fI\%#10521\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10521\fP>\X'tty: link'). .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\&. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9117'\fI\%#9117\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9117\fP>\X'tty: link'). .IP \(bu 2 \fBrandom\fP is now less strict about its arguments, allowing a start larger or equal to the end. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10879'\fI\%#10879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10879\fP>\X'tty: link') .IP \(bu 2 \fBfunction \-\-argument\-names\fP now produces an error if a read\-only variable name is used, rather than simply ignoring it (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10842'\fI\%#10842\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10842\fP>\X'tty: link'). .IP \(bu 2 Tilde expansion in braces (that is, \fB{~,}\fP) works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10610'\fI\%#10610\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10610\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10287'\fI\%#10287\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10287\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10396'\fI\%#10396\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10396\fP>\X'tty: link'). .IP \(bu 2 Abbreviations now expand after process separators like \fB;\fP and \fB|\fP\&. This fixes a regression in version 3.6 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9730'\fI\%#9730\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9730\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8603'\fI\%#8603\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8603\fP>\X'tty: link'). .IP \(bu 2 \fBctrl\fP\-\fBx\fP (\fBfish_clipboard_copy\fP) on multiline commands now includes indentation (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10437'\fI\%#10437\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10437\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5274'\fI\%#5274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5274\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9835'\fI\%#9835\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9835\fP>\X'tty: link'). .IP \(bu 2 Redirection in command position like \fB>echo\fP is now highlighted as error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8877'\fI\%#8877\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8877\fP>\X'tty: link'). .IP \(bu 2 \fBfish_vi_cursor\fP now works properly inside the prompt created by builtin \fBread\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10088'\fI\%#10088\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10088\fP>\X'tty: link'). .IP \(bu 2 fish no longer fails to open a FIFO if interrupted by a terminal resize signal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10250'\fI\%#10250\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10250\fP>\X'tty: link'). .IP \(bu 2 \fBread \-\-help\fP and friends no longer ignore redirections. This fixes a regression in version 3.1 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10274'\fI\%#10274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10274\fP>\X'tty: link'). .IP \(bu 2 Measuring a command with \fBtime\fP now considers the time taken for command substitution (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9100'\fI\%#9100\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9100\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10532'\fI\%#10532\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10532\fP>\X'tty: link'). .IP \(bu 2 fish no longer adopts TTY modes of failed commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10603'\fI\%#10603\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10603\fP>\X'tty: link'). .IP \(bu 2 \fBcomplete \-e cmd\fP now prevents autoloading completions for \fBcmd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6716'\fI\%#6716\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6716\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10758'\fI\%#10758\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10758\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/10786'\fI\%#10786\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10786\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7296'\fI\%#7296\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7296\fP>\X'tty: link'). .IP \(bu 2 Prompts that use external commands will no longer produce an infinite loop if the command crashes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9796'\fI\%#9796\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9796\fP>\X'tty: link'). .IP \(bu 2 Undo (\fBctrl\fP\-\fBz\fP) restores the cursor position too (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10838'\fI\%#10838\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10838\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10833'\fI\%#10833\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10833\fP>\X'tty: link'). .IP \(bu 2 Job expansion (\fB%1\fP syntax) works properly for jobs that are a mixture of external commands and functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10832'\fI\%#10832\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10832\fP>\X'tty: link'). .IP \(bu 2 Command lines which have more lines than the terminal can be displayed and edited correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10827'\fI\%#10827\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10827\fP>\X'tty: link'). .IP \(bu 2 Functions that have been erased are no longer highlighted as valid commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10866'\fI\%#10866\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10866\fP>\X'tty: link'). .IP \(bu 2 \fBnot\fP, \fBtime\fP, and variable assignments (that is \fBnot time a=b env\fP) is correctly recognized as valid syntax (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10890'\fI\%#10890\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10890\fP>\X'tty: link'). .IP \(bu 2 The Web\-based configuration removes old right\-hand\-side prompts again, fixing a regression in fish 3.4.0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10675'\fI\%#10675\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10675\fP>\X'tty: link'). .IP \(bu 2 Further protection against programs which crash and leave the terminal in an inconsistent state (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10834'\fI\%#10834\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10834\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/11038'\fI\%#11038\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/11038\fP>\X'tty: link'). .IP \(bu 2 A workaround for git being very slow on macOS has been applied, improving performance after a fresh boot (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10535'\fI\%#10535\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10535\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10266'\fI\%#10266\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10266\fP>\X'tty: link'). .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: \- The editor\(aqs cursor position is copied back to fish. This is currently supported for Vim and Kakoune. \- Cursor position synchronization is only supported for a set of known editors, which are now also detected in aliases which use \fBcomplete \-\-wraps\fP\&. For example, use \fBcomplete \-\-wraps my\-vim vim\fP to synchronize cursors when \fBEDITOR=my\-vim\fP\&. \- Multiline commands are indented before being sent to the editor, which matches how they are displayed in fish. .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10271'\fI\%#10271\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10271\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10430'\fI\%#10430\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10430\fP>\X'tty: link'). .IP \(bu 2 The following keys have refined behavior if the terminal supports \fI\%the new keyboard encodings\fP: \- \fBshift\fP\-\fBenter\fP now inserts a newline instead of executing the command line. \- \fBctrl\fP\-\fBbackspace\fP now deletes the last word instead of only one character (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10741'\fI\%#10741\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10741\fP>\X'tty: link'). \- \fBctrl\fP\-\fBdelete\fP deletes the next word (same as \fBalt\fP\-\fBd\fP). .IP \(bu 2 New special input functions: \- \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10398'\fI\%#10398\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10398\fP>\X'tty: link'). \- \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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2014'\fI\%#2014\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2014\fP>\X'tty: link'). \- \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10213'\fI\%#10213\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10213\fP>\X'tty: link'). .IP \(bu 2 The \fBaccept\-autosuggestion\fP special input function now returns false when there was nothing to accept (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10608'\fI\%#10608\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10608\fP>\X'tty: link'). .IP \(bu 2 Vi mode has seen some improvements but continues to suffer from the lack of people working on it. \- New default cursor shapes for insert and replace mode. \- \fBctrl\fP\-\fBn\fP in insert mode accepts autosuggestions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10339'\fI\%#10339\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10339\fP>\X'tty: link'). \- Outside insert mode, the cursor will no longer be placed beyond the last character on the commandline. \- When the cursor is at the end of the commandline, a single \fBl\fP will accept an autosuggestion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10286'\fI\%#10286\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10286\fP>\X'tty: link'). \- The cursor position after pasting (\fBp\fP) has been corrected. \- Added an additional binding, \fB_\fP, for moving to the beginning of the line (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10720'\fI\%#10720\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10720\fP>\X'tty: link'). \- When the cursor is at the start of a line, escaping from insert mode no longer moves the cursor to the previous line. \- Added bindings for clipboard interaction, like \fB\(dq,\fP+\fB,p\fP and \fB\(dq,\fP+\fB,y,y\fP\&. \- Deleting in visual mode now moves the cursor back, matching vi (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10394'\fI\%#10394\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10394\fP>\X'tty: link'). \- The \fB;\fP, \fB,\fP, \fBv\fP, \fBV\fP, \fBI\fP, and \fBgU\fP bindings work in visual mode (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10601'\fI\%#10601\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10601\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/10648'\fI\%#10648\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10648\fP>\X'tty: link'). \- Support \fB%\fP motion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10593'\fI\%#10593\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10593\fP>\X'tty: link'). \- \fBctrl\fP\-\fBk\fP to remove the contents of the line beyond the cursor in all modes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10648'\fI\%#10648\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10648\fP>\X'tty: link'). \- Support \fIab\fP and \fIib\fP vi text objects. New input functions are introduced \fBjump\-{to,till}\-matching\-bracket\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1842'\fI\%#1842\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1842\fP>\X'tty: link'). \- The \fBE\fP binding now correctly handles the last character of the word, by jumping to the next word (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9700'\fI\%#9700\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9700\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3707'\fI\%#3707\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3707\fP>\X'tty: link'). .IP \(bu 2 Option completion now uses fuzzy subsequence filtering, just like non\-option completion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/830'\fI\%#830\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/830\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5433'\fI\%#5433\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5433\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10820'\fI\%#10820\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10820\fP>\X'tty: link'). .IP \(bu 2 Generated completions are now stored in \fB$XDG_CACHE_HOME/fish\fP or \fB~/.cache/fish\fP by default (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10369'\fI\%#10369\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10369\fP>\X'tty: link') .IP \(bu 2 A regression in fish 3.1, where completing a command line could change it completely, has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10904'\fI\%#10904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10904\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10352'\fI\%#10352\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10352\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9955'\fI\%#9955\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9955\fP>\X'tty: link'). .IP \(bu 2 fish now sets the terminal window title (via OSC 0) unconditionally instead of only for some terminals (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10037'\fI\%#10037\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10037\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6942'\fI\%#6942\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6942\fP>\X'tty: link'). .IP \(bu 2 Cursor changes are applied to all terminals that support them, and the list of specifically\-supported terminals has been removed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10693'\fI\%#10693\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10693\fP>\X'tty: link'). .IP \(bu 2 If it cannot find the terminfo entry given by \fI\%TERM\fP environment variable, fish will now use an included \fBxterm\-256color\fP definition to match the vast majority of current terminal emulators (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10905'\fI\%#10905\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10905\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8164'\fI\%#8164\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8164\fP>\X'tty: link'). .UNINDENT .SS Other improvements .INDENT 0.0 .IP \(bu 2 \fBstatus\fP gained a \fBbuildinfo\fP subcommand, to print information on how fish was built, to help with debugging (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10896'\fI\%#10896\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10896\fP>\X'tty: link'). .IP \(bu 2 \fBfish_indent\fP will now collapse multiple empty lines into one (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10325'\fI\%#10325\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10325\fP>\X'tty: link'). .IP \(bu 2 \fBfish_indent\fP now preserves the modification time of files if there were no changes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10624'\fI\%#10624\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10624\fP>\X'tty: link'). .IP \(bu 2 Performance in launching external processes has been improved for many cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10869'\fI\%#10869\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10869\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10506'\fI\%#10506\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10506\fP>\X'tty: link'). .IP \(bu 2 On macOS, paths from \fB/etc/paths\fP and \fB/etc/manpaths\fP containing colons are handled correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10684'\fI\%#10684\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10684\fP>\X'tty: link'). .IP \(bu 2 Additional filesystems such as AFS are properly detected as remote, which avoids certain hangs due to expensive filesystem locks (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10818'\fI\%#10818\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10818\fP>\X'tty: link'). .IP \(bu 2 A spurious error when launching multiple instances of fish for the first time has been removed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10813'\fI\%#10813\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10813\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9924'\fI\%#9924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9924\fP>\X'tty: link'). CMake builds default to optimized release builds (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10799'\fI\%#10799\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10799\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/11116'\fI\%#11116\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/11116\fP>\X'tty: link'). .sp The Web\-based configuration has been rewritten to use Alpine.js (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9554'\fI\%#9554\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9554\fP>\X'tty: link'). .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 \X'tty: link https://github.com/fish-shell/fish-shell/milestone/43'\fI\%GitHub milestone page for 4.0\-final\fP <\fBhttps://github.com/fish-shell/fish-shell/milestone/43\fP>\X'tty: link'\&. .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10190'\fI\%#10190\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10190\fP>\X'tty: link'). .IP \(bu 2 Wildcards (\fB*\fP) will no longer sometimes generate paths that did not exist (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10205'\fI\%#10205\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10205\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10199'\fI\%#10199\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10199\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10318'\fI\%#10318\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10318\fP>\X'tty: link'). .IP \(bu 2 The warning for when a builtin returns a negative exit code was improved, now mentioning the original status (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10187'\fI\%#10187\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10187\fP>\X'tty: link'). .IP \(bu 2 Added completions for .INDENT 2.0 .IP \(bu 2 \fBcobra\-cli\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10293'\fI\%#10293\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10293\fP>\X'tty: link') .IP \(bu 2 \fBdmidecode\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10368'\fI\%#10368\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10368\fP>\X'tty: link') .IP \(bu 2 \fBmycli\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10309'\fI\%#10309\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10309\fP>\X'tty: link') .IP \(bu 2 \fBollama\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10327'\fI\%#10327\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10327\fP>\X'tty: link') .IP \(bu 2 \fBpstree\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10317'\fI\%#10317\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10317\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9476'\fI\%#9476\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9476\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10005'\fI\%#10005\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10005\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9934'\fI\%#9934\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9934\fP>\X'tty: link'). .UNINDENT .IP \(bu 2 Performance improvements for command completions and globbing, where supported by the operating system, especially on slow filesystems such as NFS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9891'\fI\%#9891\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9891\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9931'\fI\%#9931\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9931\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/10032'\fI\%#10032\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10032\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/10052'\fI\%#10052\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10052\fP>\X'tty: link'). .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 \fI\%fish_sequence_key_delay_ms\fP variable (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7401'\fI\%#7401\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7401\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10080'\fI\%#10080\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10080\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9659'\fI\%#9659\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9659\fP>\X'tty: link'). .IP \(bu 2 \fBfish \-\-command\fP will now return a non\-zero status if parsing failed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9888'\fI\%#9888\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9888\fP>\X'tty: link'). .IP \(bu 2 The \fBjobs\fP builtin will now escape the commands it prints (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9808'\fI\%#9808\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9808\fP>\X'tty: link'). .IP \(bu 2 \fBstring repeat\fP no longer overflows if the count is a multiple of the chunk size (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9900'\fI\%#9900\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9900\fP>\X'tty: link'). .IP \(bu 2 The \fBbuiltin\fP builtin will now properly error out with invalid arguments instead of doing nothing and returning true (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9942'\fI\%#9942\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9942\fP>\X'tty: link'). .IP \(bu 2 \fBcommand time\fP in a pipeline is allowed again, as is \fBcommand and\fP and \fBcommand or\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9985'\fI\%#9985\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9985\fP>\X'tty: link'). .IP \(bu 2 \fBexec\fP will now also apply variable overrides, so \fBFOO=bar exec\fP will now set \fB$FOO\fP correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9995'\fI\%#9995\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9995\fP>\X'tty: link'). .IP \(bu 2 \fBumask\fP will now handle empty symbolic modes correctly, like \fBumask u=,g=rwx,o=\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10177'\fI\%#10177\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10177\fP>\X'tty: link'). .IP \(bu 2 Improved error messages for errors occurring in command substitutions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10054'\fI\%#10054\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10054\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8285'\fI\%#8285\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8285\fP>\X'tty: link'). .IP \(bu 2 Vi mode now uses \fBfish_cursor_external\fP to set the cursor shape for external commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4656'\fI\%#4656\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4656\fP>\X'tty: link'). .IP \(bu 2 Opening the history search in vi mode switches to insert mode correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10141'\fI\%#10141\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10141\fP>\X'tty: link'). .IP \(bu 2 Vi mode cursor shaping is now enabled in iTerm2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9698'\fI\%#9698\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9698\fP>\X'tty: link'). .IP \(bu 2 Completing commands as root includes commands not owned by root, fixing a regression introduced in fish 3.2.0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9699'\fI\%#9699\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9699\fP>\X'tty: link'). .IP \(bu 2 Selection uses \fBfish_color_selection\fP for the foreground and background colors, as intended, rather than just the background (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9717'\fI\%#9717\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9717\fP>\X'tty: link'). .IP \(bu 2 The completion pager will no longer sometimes skip the last entry when moving through a long list (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9833'\fI\%#9833\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9833\fP>\X'tty: link'). .IP \(bu 2 The interactive \fBhistory delete\fP interface now allows specifying index ranges like \(dq1..5\(dq (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9736'\fI\%#9736\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9736\fP>\X'tty: link'), and \fBhistory delete \-\-exact\fP now properly saves the history (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10066'\fI\%#10066\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10066\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9817'\fI\%#9817\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9817\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9454'\fI\%#9454\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9454\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9986'\fI\%#9986\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9986\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10045'\fI\%#10045\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10045\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7910'\fI\%#7910\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7910\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10044'\fI\%#10044\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10044\fP>\X'tty: link'). .IP \(bu 2 The \fBalias\fP convenience function has better support for commands with unusual characters, like \fB+\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8720'\fI\%#8720\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8720\fP>\X'tty: link'). .IP \(bu 2 A longstanding issue where items in the pager would sometimes display without proper formatting has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9617'\fI\%#9617\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9617\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9954'\fI\%#9954\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9954\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10074'\fI\%#10074\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10074\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3707'\fI\%#3707\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3707\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9913'\fI\%#9913\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9913\fP>\X'tty: link'). .IP \(bu 2 The Dracula theme has now been synced with upstream (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9807'\fI\%#9807\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9807\fP>\X'tty: link'); use \fBfish_config\fP to re\-apply it to pick up the changes. .IP \(bu 2 \fBfish_vcs_prompt\fP now also supports fossil (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9497'\fI\%#9497\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9497\fP>\X'tty: link'). .IP \(bu 2 Prompts which display the working directory using the \fBprompt_pwd\fP function correctly display directories beginning with dashes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10169'\fI\%#10169\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10169\fP>\X'tty: link'). .UNINDENT .SS Completions .INDENT 0.0 .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBage\fP and \fBage\-keygen\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9813'\fI\%#9813\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9813\fP>\X'tty: link') .IP \(bu 2 \fBairmon\-ng\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10116'\fI\%#10116\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10116\fP>\X'tty: link') .IP \(bu 2 \fBar\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9720'\fI\%#9720\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9720\fP>\X'tty: link') .IP \(bu 2 \fBblender\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9905'\fI\%#9905\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9905\fP>\X'tty: link') .IP \(bu 2 \fBbws\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10165'\fI\%#10165\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10165\fP>\X'tty: link') .IP \(bu 2 \fBcalendar\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10138'\fI\%#10138\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10138\fP>\X'tty: link') .IP \(bu 2 \fBcheckinstall\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10106'\fI\%#10106\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10106\fP>\X'tty: link') .IP \(bu 2 \fBcrc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10034'\fI\%#10034\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10034\fP>\X'tty: link') .IP \(bu 2 \fBdoctl\fP .IP \(bu 2 \fBgimp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9904'\fI\%#9904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9904\fP>\X'tty: link') .IP \(bu 2 \fBgojq\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9740'\fI\%#9740\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9740\fP>\X'tty: link') .IP \(bu 2 \fBhorcrux\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9922'\fI\%#9922\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9922\fP>\X'tty: link') .IP \(bu 2 \fBibmcloud\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10004'\fI\%#10004\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10004\fP>\X'tty: link') .IP \(bu 2 \fBiwctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6884'\fI\%#6884\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6884\fP>\X'tty: link') .IP \(bu 2 \fBjava_home\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9998'\fI\%#9998\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9998\fP>\X'tty: link') .IP \(bu 2 \fBkrita\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9903'\fI\%#9903\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9903\fP>\X'tty: link') .IP \(bu 2 \fBoc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10034'\fI\%#10034\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10034\fP>\X'tty: link') .IP \(bu 2 \fBqjs\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9723'\fI\%#9723\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9723\fP>\X'tty: link') .IP \(bu 2 \fBqjsc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9731'\fI\%#9731\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9731\fP>\X'tty: link') .IP \(bu 2 \fBrename\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10136'\fI\%#10136\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10136\fP>\X'tty: link') .IP \(bu 2 \fBrpm\-ostool\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9669'\fI\%#9669\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9669\fP>\X'tty: link') .IP \(bu 2 \fBsmerge\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10135'\fI\%#10135\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10135\fP>\X'tty: link') .IP \(bu 2 \fBuserdel\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10056'\fI\%#10056\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10056\fP>\X'tty: link') .IP \(bu 2 \fBwatchexec\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10027'\fI\%#10027\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10027\fP>\X'tty: link') .IP \(bu 2 \fBwpctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10043'\fI\%#10043\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10043\fP>\X'tty: link') .IP \(bu 2 \fBxxd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10137'\fI\%#10137\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10137\fP>\X'tty: link') .IP \(bu 2 \fBzabbix\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9647'\fI\%#9647\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9647\fP>\X'tty: link') .UNINDENT .IP \(bu 2 The \fBzfs\fP completions no longer print errors about setting a read\-only variable (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9705'\fI\%#9705\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9705\fP>\X'tty: link'). .IP \(bu 2 The \fBkitty\fP completions have been removed in favor of keeping them upstream (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9750'\fI\%#9750\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9750\fP>\X'tty: link'). .IP \(bu 2 \fBgit\fP completions now support aliases that reference other aliases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9992'\fI\%#9992\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9992\fP>\X'tty: link'). .IP \(bu 2 The \fBgw\fP and \fBgradlew\fP completions are loaded properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10127'\fI\%#10127\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10127\fP>\X'tty: link'). .IP \(bu 2 Improvements to many other completions. .IP \(bu 2 Improvements to the manual page completion generator (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9787'\fI\%#9787\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9787\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9814'\fI\%#9814\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9814\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9961'\fI\%#9961\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9961\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9828'\fI\%#9828\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9828\fP>\X'tty: link'). .IP \(bu 2 Updates to the German translations (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9824'\fI\%#9824\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9824\fP>\X'tty: link'). .IP \(bu 2 The colors of the Nord theme better match their official style (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10168'\fI\%#10168\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10168\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/10162'\fI\%#10162\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/10162\fP>\X'tty: link'). .IP \(bu 2 The CMake configure step will now also look for libterminfo as an alternative name for libtinfo, as used in NetBSD curses (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9794'\fI\%#9794\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9794\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9468'\fI\%#9468\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9468\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9475'\fI\%#9475\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9475\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9460'\fI\%#9460\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9460\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9470'\fI\%#9470\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9470\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP will now print an error if told to set a read\-only variable, instead of silently doing nothing (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9346'\fI\%#9346\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9346\fP>\X'tty: link'). .IP \(bu 2 \fBset_color \-v\fP no longer crashes fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9640'\fI\%#9640\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9640\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9443'\fI\%#9443\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9443\fP>\X'tty: link'). .IP \(bu 2 The history pager now uses more screen space, usually half the screen (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9458'\fI\%#9458\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9458\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2613'\fI\%#2613\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2613\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9473'\fI\%#9473\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9473\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9488'\fI\%#9488\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9488\fP>\X'tty: link'). .IP \(bu 2 \fBctrl\fP\-\fBg\fP closes the history pager, like other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9484'\fI\%#9484\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9484\fP>\X'tty: link'). .IP \(bu 2 The documentation for the \fB:\fP, \fB[\fP and \fB\&.\fP builtin commands can now be looked up with \fBman\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9552'\fI\%#9552\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9552\fP>\X'tty: link'). .IP \(bu 2 fish no longer crashes when searching history for non\-ASCII codepoints case\-insensitively (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9628'\fI\%#9628\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9628\fP>\X'tty: link'). .IP \(bu 2 The \fBalt\fP\-\fBs\fP binding will now also use \fBplease\fP if available (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9635'\fI\%#9635\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9635\fP>\X'tty: link'). .IP \(bu 2 Themes that don\(aqt specify every color option can be installed correctly in the Web\-based configuration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9590'\fI\%#9590\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9590\fP>\X'tty: link'). .IP \(bu 2 Compatibility with Midnight Commander\(aqs prompt integration has been improved (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9540'\fI\%#9540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9540\fP>\X'tty: link'). .IP \(bu 2 A spurious error, noted when using fish in Google Drive directories under WSL 2, has been silenced (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9550'\fI\%#9550\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9550\fP>\X'tty: link'). .IP \(bu 2 Using \fBread\fP in \fBfish_greeting\fP or similar functions will not trigger an infinite loop (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9564'\fI\%#9564\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9564\fP>\X'tty: link'). .IP \(bu 2 Compatibility when upgrading from old versions of fish (before 3.4.0) has been improved (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9569'\fI\%#9569\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9569\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9572'\fI\%#9572\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9572\fP>\X'tty: link'). .UNINDENT .SS Completions .INDENT 0.0 .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBapkanalyzer\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9558'\fI\%#9558\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9558\fP>\X'tty: link') .IP \(bu 2 \fBneovim\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9543'\fI\%#9543\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9543\fP>\X'tty: link') .IP \(bu 2 \fBotool\fP .IP \(bu 2 \fBpre\-commit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9521'\fI\%#9521\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9521\fP>\X'tty: link') .IP \(bu 2 \fBproxychains\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9486'\fI\%#9486\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9486\fP>\X'tty: link') .IP \(bu 2 \fBscrypt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9583'\fI\%#9583\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9583\fP>\X'tty: link') .IP \(bu 2 \fBstow\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9571'\fI\%#9571\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9571\fP>\X'tty: link') .IP \(bu 2 \fBtrash\fP and helper utilities \fBtrash\-empty\fP, \fBtrash\-list\fP, \fBtrash\-put\fP, \fBtrash\-restore\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9560'\fI\%#9560\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9560\fP>\X'tty: link') .IP \(bu 2 \fBssh\-copy\-id\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9675'\fI\%#9675\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9675\fP>\X'tty: link') .UNINDENT .IP \(bu 2 Improvements to many completions, including the speed of completing directories in WSL 2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9574'\fI\%#9574\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9574\fP>\X'tty: link'). .IP \(bu 2 Completions using \fB__fish_complete_suffix\fP are now offered in the correct order, fixing a regression in 3.6.0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8924'\fI\%#8924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8924\fP>\X'tty: link'). .IP \(bu 2 \fBgit\fP completions for \fBgit\-foo\fP\-style commands was restored, fixing a regression in 3.6.0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9457'\fI\%#9457\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9457\fP>\X'tty: link'). .IP \(bu 2 File completion now offers \fB\&../\fP and \fB\&./\fP again, fixing a regression in 3.6.0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9477'\fI\%#9477\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9477\fP>\X'tty: link'). .IP \(bu 2 The behaviour of completions using \fB__fish_complete_path\fP matches standard path completions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9285'\fI\%#9285\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9285\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9502'\fI\%#9502\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9502\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/602'\fI\%#602\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/602\fP>\X'tty: link'). 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 Abbrevations are more flexible (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9313'\fI\%#9313\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9313\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5003'\fI\%#5003\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5003\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2287'\fI\%#2287\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2287\fP>\X'tty: link'): .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 \fI\%the documentation\fP 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9057'\fI\%#9057\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9057\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9156'\fI\%#9156\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9156\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3589'\fI\%#3589\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3589\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9130'\fI\%#9130\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9130\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9255'\fI\%#9255\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9255\fP>\X'tty: link'). .IP \(bu 2 \fBset \-\-erase\fP can now be used with multiple scopes at once, like \fBset \-efglU foo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7711'\fI\%#7711\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7711\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9280'\fI\%#9280\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9280\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8905'\fI\%#8905\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8905\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9296'\fI\%#9296\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9296\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9247'\fI\%#9247\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9247\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9245'\fI\%#9245\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9245\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1352'\fI\%#1352\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1352\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9274'\fI\%#9274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9274\fP>\X'tty: link'). 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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9006'\fI\%#9006\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9006\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9029'\fI\%#9029\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9029\fP>\X'tty: link'): .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 \fI\%fish_read_limit\fP is unset (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9129'\fI\%#9129\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9129\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP produces an error for division\-by\-zero, as well as augmenting some errors with their extent (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9190'\fI\%#9190\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9190\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9271'\fI\%#9271\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9271\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9085'\fI\%#9085\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9085\fP>\X'tty: link'). .UNINDENT .SS Interactive improvements .INDENT 0.0 .IP \(bu 2 If the terminal definition for \fI\%TERM\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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9026'\fI\%#9026\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9026\fP>\X'tty: link'). .IP \(bu 2 A new variable, \fI\%fish_cursor_selection_mode\fP, 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7762'\fI\%#7762\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7762\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9105'\fI\%#9105\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9105\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2698'\fI\%#2698\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2698\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9080'\fI\%#9080\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9080\fP>\X'tty: link'). .IP \(bu 2 \fBbind\fP output is now syntax\-highlighted when used interacively. .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9020'\fI\%#9020\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9020\fP>\X'tty: link'). .IP \(bu 2 If \fI\%fish_color_valid_path\fP contains an actual color instead of just modifiers, those will be used for valid paths even if the underlying color isn\(aqt \(dqnormal\(dq (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9159'\fI\%#9159\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9159\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9234'\fI\%#9234\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9234\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3741'\fI\%#3741\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3741\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9172'\fI\%#9172\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9172\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9197'\fI\%#9197\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9197\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9215'\fI\%#9215\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9215\fP>\X'tty: link'). .IP \(bu 2 fish\(aqs builtins now handle keyboard interrupts (\fBctrl\fP\-\fBc\fP) correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9266'\fI\%#9266\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9266\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9257'\fI\%#9257\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9257\fP>\X'tty: link') .IP \(bu 2 \fBclojure\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9272'\fI\%#9272\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9272\fP>\X'tty: link') .IP \(bu 2 \fBcsh\fP .IP \(bu 2 \fBdirenv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9268'\fI\%#9268\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9268\fP>\X'tty: link') .IP \(bu 2 \fBdive\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9082'\fI\%#9082\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9082\fP>\X'tty: link') .IP \(bu 2 \fBdolphin\fP .IP \(bu 2 \fBdua\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9277'\fI\%#9277\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9277\fP>\X'tty: link') .IP \(bu 2 \fBefivar\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9318'\fI\%#9318\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9318\fP>\X'tty: link') .IP \(bu 2 \fBeg\fP .IP \(bu 2 \fBes\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9388'\fI\%#9388\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9388\fP>\X'tty: link') .IP \(bu 2 \fBfirefox\-developer\-edition\fP and \fBfirefox\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9090'\fI\%#9090\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9090\fP>\X'tty: link') .IP \(bu 2 \fBfortune\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9177'\fI\%#9177\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9177\fP>\X'tty: link') .IP \(bu 2 \fBkb\fP .IP \(bu 2 \fBkind\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9110'\fI\%#9110\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9110\fP>\X'tty: link') .IP \(bu 2 \fBkonsole\fP .IP \(bu 2 \fBksh\fP .IP \(bu 2 \fBloadkeys\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9312'\fI\%#9312\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9312\fP>\X'tty: link') .IP \(bu 2 \fBokular\fP .IP \(bu 2 \fBop\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9300'\fI\%#9300\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9300\fP>\X'tty: link') .IP \(bu 2 \fBouch\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9405'\fI\%#9405\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9405\fP>\X'tty: link') .IP \(bu 2 \fBpix\fP .IP \(bu 2 \fBreadelf\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8746'\fI\%#8746\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8746\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9386'\fI\%#9386\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9386\fP>\X'tty: link') .IP \(bu 2 \fBqshell\fP .IP \(bu 2 \fBrc\fP .IP \(bu 2 \fBsad\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9145'\fI\%#9145\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9145\fP>\X'tty: link') .IP \(bu 2 \fBtcsh\fP .IP \(bu 2 \fBtoot\fP .IP \(bu 2 \fBtox\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9078'\fI\%#9078\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9078\fP>\X'tty: link') .IP \(bu 2 \fBwish\fP .IP \(bu 2 \fBxed\fP .IP \(bu 2 \fBxonsh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9389'\fI\%#9389\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9389\fP>\X'tty: link') .IP \(bu 2 \fBxplayer\fP .IP \(bu 2 \fBxreader\fP .IP \(bu 2 \fBxviewer\fP .IP \(bu 2 \fByash\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9391'\fI\%#9391\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9391\fP>\X'tty: link') .IP \(bu 2 \fBzig\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9083'\fI\%#9083\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9083\fP>\X'tty: link') .UNINDENT .IP \(bu 2 Improvements to many completions, including making \fBcd\fP completion much faster (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9220'\fI\%#9220\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9220\fP>\X'tty: link'). .IP \(bu 2 Completion of tilde (\fB~\fP) works properly even when the file name contains an escaped character (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9073'\fI\%#9073\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9073\fP>\X'tty: link'). .IP \(bu 2 fish no longer loads completions if the command is used via a relative path and is not in \fI\%PATH\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9133'\fI\%#9133\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9133\fP>\X'tty: link'). .IP \(bu 2 fish no longer completes inside of comments (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9320'\fI\%#9320\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9320\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9119'\fI\%#9119\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9119\fP>\X'tty: link'). .UNINDENT .SS Other improvements .INDENT 0.0 .IP \(bu 2 The Web\-based configuration tool now works on systems with IPv6 disabled (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3857'\fI\%#3857\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3857\fP>\X'tty: link'). .IP \(bu 2 Aliases can ignore arguments by ending them with \fB#\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9199'\fI\%#9199\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9199\fP>\X'tty: link'). .IP \(bu 2 \fBstring\fP is now faster when reading large strings from stdin (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9139'\fI\%#9139\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9139\fP>\X'tty: link'). .IP \(bu 2 \fBstring repeat\fP uses less memory and is faster. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9124'\fI\%#9124\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9124\fP>\X'tty: link') .IP \(bu 2 Builtins are much faster when writing to a pipe or file. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9229'\fI\%#9229\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9229\fP>\X'tty: link'). .IP \(bu 2 Performance improvements to highlighting (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9180'\fI\%#9180\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9180\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9066'\fI\%#9066\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9066\fP>\X'tty: link'). .IP \(bu 2 \fBprocess\-exit\fP and \fBjob\-exit\fP events are now generated for all background jobs, including those launched from event handlers (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9096'\fI\%#9096\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9096\fP>\X'tty: link'). .IP \(bu 2 A crash when completing a token that contained both a potential glob and a quoted variable expansion was fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9137'\fI\%#9137\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9137\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9123'\fI\%#9123\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9123\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9181'\fI\%#9181\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9181\fP>\X'tty: link'). .IP \(bu 2 The \(dqDisco\(dq sample prompt no longer prints an error in some working directories (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9164'\fI\%#9164\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9164\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9143'\fI\%#9143\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9143\fP>\X'tty: link'). .IP \(bu 2 \fBprintf\fP no longer tries to interpret the first argument as an option (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9132'\fI\%#9132\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9132\fP>\X'tty: link'). .IP \(bu 2 Interactive \fBread\fP in scripts will now have the correct keybindings again (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9227'\fI\%#9227\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9227\fP>\X'tty: link'). .IP \(bu 2 A possible stack overflow when recursively evaluating substitutions has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9302'\fI\%#9302\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9302\fP>\X'tty: link'). .IP \(bu 2 A crash with relative $CDPATH has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9407'\fI\%#9407\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9407\fP>\X'tty: link'). .IP \(bu 2 \fBprintf\fP now properly fills extra \fB%d\fP specifiers with 0 even on macOS and BSD (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9321'\fI\%#9321\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9321\fP>\X'tty: link'). .IP \(bu 2 \fBfish_key_reader\fP now correctly exits when receiving a SIGHUP (like after closing the terminal) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9309'\fI\%#9309\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9309\fP>\X'tty: link'). .IP \(bu 2 \fBfish_config theme save\fP now works as documented instead of erroring out (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9088'\fI\%#9088\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9088\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/9273'\fI\%#9273\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9273\fP>\X'tty: link'). .IP \(bu 2 fish no longer triggers prompts to install command line tools when first run on macOS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9343'\fI\%#9343\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9343\fP>\X'tty: link'). .IP \(bu 2 \fBfish_git_prompt\fP now quietly fails on macOS if the xcrun cache is not yet populated (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6625'\fI\%#6625\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6625\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8355'\fI\%#8355\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8355\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8363'\fI\%#8363\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8363\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8981'\fI\%#8981\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8981\fP>\X'tty: link'). .IP \(bu 2 \fBprintf\fP returns a better error when used with arguments interpreted as octal numbers (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9035'\fI\%#9035\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9035\fP>\X'tty: link'). .IP \(bu 2 \fBhistory merge\fP when in private mode is now an error, rather than wiping out other sessions\(aq history (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9050'\fI\%#9050\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9050\fP>\X'tty: link'). .IP \(bu 2 The error message when launching a command that is built for the wrong architecture on macOS is more helpful (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9052'\fI\%#9052\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9052\fP>\X'tty: link'). .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBchoose\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9065'\fI\%#9065\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9065\fP>\X'tty: link') .IP \(bu 2 \fBexpect\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9060'\fI\%#9060\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9060\fP>\X'tty: link') .IP \(bu 2 \fBnavi\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9064'\fI\%#9064\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9064\fP>\X'tty: link') .IP \(bu 2 \fBqdbus\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9031'\fI\%#9031\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9031\fP>\X'tty: link') .IP \(bu 2 \fBreflector\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9027'\fI\%#9027\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9027\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9053'\fI\%#9053\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9053\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9054'\fI\%#9054\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9054\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9019'\fI\%#9019\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9019\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9024'\fI\%#9024\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9024\fP>\X'tty: link'). .IP \(bu 2 The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9044'\fI\%#9044\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9044\fP>\X'tty: link'). .IP \(bu 2 Using special input functions in bindings, in combination with \fBand\fP/\fBor\fP conditionals, no longer crashes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9051'\fI\%#9051\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9051\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7659'\fI\%#7659\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7659\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8958'\fI\%#8958\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8958\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/954'\fI\%#954\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/954\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8593'\fI\%#8593\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8593\fP>\X'tty: link'). .IP \(bu 2 Scripts can now catch and handle the SIGINT and SIGTERM signals, either via \fBfunction \-\-on\-signal\fP or with \fBtrap\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6649'\fI\%#6649\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6649\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8857'\fI\%#8857\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8857\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8865'\fI\%#8865\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8865\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8473'\fI\%#8473\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8473\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3847'\fI\%#3847\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3847\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8769'\fI\%#8769\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8769\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8781'\fI\%#8781\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8781\fP>\X'tty: link') .IP \(bu 2 The meaning of an empty color variable has changed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8793'\fI\%#8793\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8793\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8980'\fI\%#8980\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8980\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9011'\fI\%#9011\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9011\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7918'\fI\%#7918\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7918\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8979'\fI\%#8979\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8979\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8849'\fI\%#8849\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8849\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8611'\fI\%#8611\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8611\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8496'\fI\%#8496\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8496\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8644'\fI\%#8644\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8644\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8646'\fI\%#8646\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8646\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8552'\fI\%#8552\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8552\fP>\X'tty: link'). .IP \(bu 2 \fBstring join\fP gained a new \fB\-\-no\-empty\fP flag to skip empty arguments (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8774'\fI\%#8774\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8774\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8351'\fI\%#8351\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8351\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP now only triggers the \fBfish_read\fP event, not the \fBfish_prompt\fP event (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8797'\fI\%#8797\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8797\fP>\X'tty: link'). 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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8705'\fI\%#8705\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8705\fP>\X'tty: link'). .IP \(bu 2 Some functions shipped with fish printed error messages to standard output, but they now they rightly go to standard error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8855'\fI\%#8855\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8855\fP>\X'tty: link'). .IP \(bu 2 \fBjobs\fP now correctly reports CPU usage as a percentage, instead of as a number of clock ticks (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8919'\fI\%#8919\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8919\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8914'\fI\%#8914\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8914\fP>\X'tty: link'). .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 \fI\%PATH\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8804'\fI\%#8804\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8804\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8699'\fI\%#8699\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8699\fP>\X'tty: link'). .IP \(bu 2 Case\-changing autosuggestions generated mid\-token now correctly append only the suffix, instead of duplicating the token (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8820'\fI\%#8820\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8820\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8823'\fI\%#8823\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8823\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8786'\fI\%#8786\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8786\fP>\X'tty: link'). .IP \(bu 2 The \fBvared\fP command can now successfully edit variables named \(dqtmp\(dq or \(dqprompt\(dq (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8836'\fI\%#8836\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8836\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8837'\fI\%#8837\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8837\fP>\X'tty: link'). .IP \(bu 2 \fBtime\fP now emits an error if used after the first command in a pipeline (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8841'\fI\%#8841\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8841\fP>\X'tty: link'). .IP \(bu 2 \fBfish_add_path\fP now prints a message for skipped non\-existent paths when using the \fB\-v\fP flag (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8884'\fI\%#8884\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8884\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8871'\fI\%#8871\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8871\fP>\X'tty: link'). .IP \(bu 2 A bug that caused multi\-line prompts to be moved down a line when pasting or switching modes has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3481'\fI\%#3481\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3481\fP>\X'tty: link'). .IP \(bu 2 The Web\-based configuration system no longer strips too many quotes in the abbreviation display (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8917'\fI\%#8917\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8917\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8918'\fI\%#8918\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8918\fP>\X'tty: link'). .IP \(bu 2 Fish started with \fB\-\-no\-config\fP will now use the default keybindings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8493'\fI\%#8493\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8493\fP>\X'tty: link') .IP \(bu 2 When fish inherits a \fI\%USER\fP environment variable value that doesn\(aqt correspond to the current effective user ID, it will now correct it in all cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8879'\fI\%#8879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8879\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8583'\fI\%#8583\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8583\fP>\X'tty: link'). .IP \(bu 2 Fish sets a new \fI\%EUID\fP variable containing the current effective user id (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8866'\fI\%#8866\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8866\fP>\X'tty: link'). .IP \(bu 2 \fBhistory search\fP no longer interprets the search term as an option (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8853'\fI\%#8853\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8853\fP>\X'tty: link') .IP \(bu 2 The status message when a job terminates should no longer be erased by a multiline prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8817'\fI\%#8817\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8817\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8942'\fI\%#8942\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8942\fP>\X'tty: link'). .IP \(bu 2 The \fBkill\-whole\-line\fP special input function now kills the newline preceeding 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8983'\fI\%#8983\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8983\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8874'\fI\%#8874\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8874\fP>\X'tty: link'). .UNINDENT .SS Improved prompts .INDENT 0.0 .IP \(bu 2 A new \fBAstronaut\fP prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8775'\fI\%#8775\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8775\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8911'\fI\%#8911\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8911\fP>\X'tty: link') .IP \(bu 2 \fBapk\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8951'\fI\%#8951\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8951\fP>\X'tty: link') .IP \(bu 2 \fBbrightnessctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8758'\fI\%#8758\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8758\fP>\X'tty: link') .IP \(bu 2 \fBefibootmgr\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/9010'\fI\%#9010\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/9010\fP>\X'tty: link') .IP \(bu 2 \fBfastboot\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8904'\fI\%#8904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8904\fP>\X'tty: link') .IP \(bu 2 \fBoptimus\-manager\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8913'\fI\%#8913\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8913\fP>\X'tty: link') .IP \(bu 2 \fBrclone\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8819'\fI\%#8819\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8819\fP>\X'tty: link') .IP \(bu 2 \fBsops\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8821'\fI\%#8821\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8821\fP>\X'tty: link') .IP \(bu 2 \fBtuned\-adm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8760'\fI\%#8760\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8760\fP>\X'tty: link') .IP \(bu 2 \fBwg\-quick\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8687'\fI\%#8687\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8687\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8536'\fI\%#8536\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8536\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8967'\fI\%#8967\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8967\fP>\X'tty: link'). .UNINDENT .SS Improved terminal support .INDENT 0.0 .IP \(bu 2 Working directory reporting is enabled for kitty (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8806'\fI\%#8806\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8806\fP>\X'tty: link'). .IP \(bu 2 Changing the cursor shape is now enabled by default in iTerm2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3696'\fI\%#3696\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3696\fP>\X'tty: link'). .UNINDENT .SS For distributors .INDENT 0.0 .IP \(bu 2 libatomic is now correctly detected as necessary when building on RISC\-V (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8850'\fI\%#8850\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8850\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8851'\fI\%#8851\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8851\fP>\X'tty: link'). .IP \(bu 2 In some cases, the build process found the wrong libintl on macOS. This has been corrected (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5244'\fI\%#5244\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5244\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8887'\fI\%#8887\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8887\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7816'\fI\%#7816\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7816\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8778'\fI\%#8778\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8778\fP>\X'tty: link') .IP \(bu 2 fish builds correctly on NetBSD (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8788'\fI\%#8788\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8788\fP>\X'tty: link') and OpenIndiana (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8780'\fI\%#8780\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8780\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8790'\fI\%#8790\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8790\fP>\X'tty: link'). .IP \(bu 2 \fBfuncsave \-q\fP and \fBfuncsave \-\-quiet\fP now work correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8830'\fI\%#8830\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8830\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/159'\fI\%#159\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/159\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8132'\fI\%#8132\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8132\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/565'\fI\%#565\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/565\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8145'\fI\%#8145\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8145\fP>\X'tty: link'): .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8182'\fI\%#8182\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8182\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7784'\fI\%#7784\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7784\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4012'\fI\%#4012\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4012\fP>\X'tty: link'): .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8376'\fI\%#8376\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8376\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8589'\fI\%#8589\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8589\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7991'\fI\%#7991\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7991\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8171'\fI\%#8171\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8171\fP>\X'tty: link'). 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 desireable (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8214'\fI\%#8214\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8214\fP>\X'tty: link'). .IP \(bu 2 \fB_\fP is now a reserved keyword (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8342'\fI\%#8342\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8342\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8538'\fI\%#8538\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8538\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8054'\fI\%#8054\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8054\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6056'\fI\%#6056\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6056\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8117'\fI\%#8117\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8117\fP>\X'tty: link'). \fI\%fish_add_path\fP 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8148'\fI\%#8148\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8148\fP>\X'tty: link'). .IP \(bu 2 An oversight prevented all syntax checks from running on commands given to \fBfish \-c\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8171'\fI\%#8171\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8171\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8197'\fI\%#8197\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8197\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8142'\fI\%#8142\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8142\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8485'\fI\%#8485\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8485\fP>\X'tty: link'). .IP \(bu 2 List expansion correctly reports an error when used with all zero indexes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8213'\fI\%#8213\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8213\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8258'\fI\%#8258\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8258\fP>\X'tty: link') .IP \(bu 2 Some error messages occuring 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8234'\fI\%#8234\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8234\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4183'\fI\%#4183\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4183\fP>\X'tty: link'). .IP \(bu 2 The \fBrealpath\fP builtin now also squashes leading slashes with the \fB\-\-no\-symlinks\fP option (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8281'\fI\%#8281\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8281\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8264'\fI\%#8264\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8264\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8264'\fI\%#8264\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8264\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8384'\fI\%#8384\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8384\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP now correctly prints negative values and values larger than \fB2**31\fP when in hex or octal bases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8417'\fI\%#8417\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8417\fP>\X'tty: link'). .IP \(bu 2 \fBdirs\fP always produces an exit status of 0, instead of sometimes returning 1 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8211'\fI\%#8211\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8211\fP>\X'tty: link'). .IP \(bu 2 \fBcd \(dq\(dq\fP no longer crashes fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8147'\fI\%#8147\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8147\fP>\X'tty: link'). .IP \(bu 2 \fBset \-\-query\fP can now query whether a variable is a path variable via \fB\-\-path\fP or \fB\-\-unpath\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8494'\fI\%#8494\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8494\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4570'\fI\%#4570\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4570\fP>\X'tty: link'). .IP \(bu 2 \fBset \-\-show\fP reports when a variable is read\-only (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8179'\fI\%#8179\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8179\fP>\X'tty: link'). .IP \(bu 2 Erasing \fB$fish_emoji_width\fP will reset fish to the default guessed emoji width (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8274'\fI\%#8274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8274\fP>\X'tty: link'). .IP \(bu 2 The \fBla\fP function no longer lists entries for \(dq.\(dq and \(dq..\(dq, matching other systems defaults (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8519'\fI\%#8519\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8519\fP>\X'tty: link'). .IP \(bu 2 \fBabbr \-q\fP returns the correct exit status when given multiple abbreviation names as arguments (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8431'\fI\%#8431\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8431\fP>\X'tty: link'). .IP \(bu 2 \fBcommand \-v\fP returns an exit status of 127 instead of 1 if no command was found (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8547'\fI\%#8547\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8547\fP>\X'tty: link'). .IP \(bu 2 \fBargparse\fP with \fB\-\-ignore\-unknown\fP no longer breaks with multiple unknown options in a short option group (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8637'\fI\%#8637\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8637\fP>\X'tty: link'). .IP \(bu 2 Comments inside command substitutions or brackets now correctly ignore parentheses, quotes, and brackets (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7866'\fI\%#7866\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7866\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8022'\fI\%#8022\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8022\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8695'\fI\%#8695\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8695\fP>\X'tty: link'). .IP \(bu 2 \fBcomplete \-C\fP supports a new \fB\-\-escape\fP option, which turns on escaping in returned completion strings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3469'\fI\%#3469\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3469\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8545'\fI\%#8545\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8545\fP>\X'tty: link'). .UNINDENT .SS Interactive improvements .INDENT 0.0 .IP \(bu 2 Vi mode cursors are now set properly after \fBctrl\fP\-\fBc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8125'\fI\%#8125\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8125\fP>\X'tty: link'). .IP \(bu 2 \fBfunced\fP will try to edit the whole file containing a function definition, if there is one (\X'tty: link https://github.com/fish-shell/fish-shell/issues/391'\fI\%#391\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/391\fP>\X'tty: link'). .IP \(bu 2 Running a command line consisting of just spaces now deletes an ephemeral (starting with space) history item again (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8232'\fI\%#8232\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8232\fP>\X'tty: link'). .IP \(bu 2 Command substitutions no longer respect job control, instead running inside fish\(aqs own process group (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8172'\fI\%#8172\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8172\fP>\X'tty: link'). 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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8157'\fI\%#8157\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8157\fP>\X'tty: link'). .IP \(bu 2 \fBhelp\fP now knows which section is in which document again (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8245'\fI\%#8245\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8245\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8292'\fI\%#8292\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8292\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8423'\fI\%#8423\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8423\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8467'\fI\%#8467\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8467\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8442'\fI\%#8442\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8442\fP>\X'tty: link'). .IP \(bu 2 Command lines spanning multiple lines will not be overwritten by the completion pager when it fills the entire terminal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8509'\fI\%#8509\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8509\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8405'\fI\%#8405\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8405\fP>\X'tty: link'). .IP \(bu 2 When redrawing a multiline prompt, the old prompt is now properly cleared (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8163'\fI\%#8163\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8163\fP>\X'tty: link'). .IP \(bu 2 Interactive completion would occasionally ignore the last word on the command line due to a race condition. This has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8175'\fI\%#8175\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8175\fP>\X'tty: link'). .IP \(bu 2 Propagation of universal variables from a fish process that is closing is faster (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8209'\fI\%#8209\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8209\fP>\X'tty: link'). .IP \(bu 2 The command line is drawn in the correct place if the prompt ends with a newline (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8298'\fI\%#8298\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8298\fP>\X'tty: link'). .IP \(bu 2 \fBhistory\fP learned a new subcommand \fBclear\-session\fP to erase all history from the current session (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5791'\fI\%#5791\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5791\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8510'\fI\%#8510\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8510\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8579'\fI\%#8579\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8579\fP>\X'tty: link'). .IP \(bu 2 When looking for locale information, the Debian configuration is now used when available (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8557'\fI\%#8557\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8557\fP>\X'tty: link'). .IP \(bu 2 Pasting text containing quotes from the clipboard trims spaces more appropriately (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8550'\fI\%#8550\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8550\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8641'\fI\%#8641\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8641\fP>\X'tty: link'). .IP \(bu 2 Holding down an arrow key won\(aqt freeze the terminal with long periods of flashing (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8610'\fI\%#8610\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8610\fP>\X'tty: link'). .IP \(bu 2 Multi\-char bindings are no longer interrupted if a signal handler enqueues an event. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8628'\fI\%#8628\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8628\fP>\X'tty: link'). .UNINDENT .SS New or improved bindings .INDENT 0.0 .IP \(bu 2 \fBescape\fP can now bound without breaking arrow key bindings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8428'\fI\%#8428\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8428\fP>\X'tty: link'). .IP \(bu 2 The \fBalt\fP\-\fBh\fP binding (to open a command’s manual page) now also ignores \fBcommand\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8447'\fI\%#8447\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8447\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8530'\fI\%#8530\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8530\fP>\X'tty: link'). .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\&. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8208'\fI\%#8208\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8208\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8434'\fI\%#8434\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8434\fP>\X'tty: link') .IP \(bu 2 \fBasd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8759'\fI\%#8759\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8759\fP>\X'tty: link') .IP \(bu 2 \fBaz\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8141'\fI\%#8141\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8141\fP>\X'tty: link') .IP \(bu 2 \fBblack\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8123'\fI\%#8123\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8123\fP>\X'tty: link') .IP \(bu 2 \fBclasp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8373'\fI\%#8373\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8373\fP>\X'tty: link') .IP \(bu 2 \fBcpupower\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8302'\fI\%#8302\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8302\fP>\X'tty: link') .IP \(bu 2 \fBdart\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8315'\fI\%#8315\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8315\fP>\X'tty: link') .IP \(bu 2 \fBdscacheutil\fP .IP \(bu 2 \fBelvish\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8416'\fI\%#8416\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8416\fP>\X'tty: link') .IP \(bu 2 \fBethtool\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8283'\fI\%#8283\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8283\fP>\X'tty: link') .IP \(bu 2 \fBexif\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8246'\fI\%#8246\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8246\fP>\X'tty: link') .IP \(bu 2 \fBfindstr\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8481'\fI\%#8481\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8481\fP>\X'tty: link') .IP \(bu 2 \fBgit\-sizer\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8156'\fI\%#8156\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8156\fP>\X'tty: link') .IP \(bu 2 \fBgnome\-extensions\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8732'\fI\%#8732\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8732\fP>\X'tty: link') .IP \(bu 2 \fBgping\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8181'\fI\%#8181\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8181\fP>\X'tty: link') .IP \(bu 2 \fBisatty\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8609'\fI\%#8609\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8609\fP>\X'tty: link') .IP \(bu 2 \fBistioctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8343'\fI\%#8343\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8343\fP>\X'tty: link') .IP \(bu 2 \fBkmutil\fP .IP \(bu 2 \fBkubectl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8734'\fI\%#8734\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8734\fP>\X'tty: link') .IP \(bu 2 \fBmatlab\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8505'\fI\%#8505\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8505\fP>\X'tty: link') .IP \(bu 2 \fBmono\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8415'\fI\%#8415\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8415\fP>\X'tty: link') and related tools \fBcsharp\fP, \fBgacutil\fP, \fBgendarme\fP, \fBikdasm\fP, \fBilasm\fP, \fBmkbundle\fP, \fBmonodis\fP, \fBmonop\fP, \fBsqlsharp\fP and \fBxsp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8452'\fI\%#8452\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8452\fP>\X'tty: link') .IP \(bu 2 Angular\(aqs \fBng\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8111'\fI\%#8111\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8111\fP>\X'tty: link') .IP \(bu 2 \fBnodeenv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8533'\fI\%#8533\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8533\fP>\X'tty: link') .IP \(bu 2 \fBoctave\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8505'\fI\%#8505\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8505\fP>\X'tty: link') .IP \(bu 2 \fBpabcnet_clear\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8421'\fI\%#8421\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8421\fP>\X'tty: link') .IP \(bu 2 \fBqmk\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8180'\fI\%#8180\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8180\fP>\X'tty: link') .IP \(bu 2 \fBrakudo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8113'\fI\%#8113\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8113\fP>\X'tty: link') .IP \(bu 2 \fBrc\-status\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8757'\fI\%#8757\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8757\fP>\X'tty: link') .IP \(bu 2 \fBroswell\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8330'\fI\%#8330\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8330\fP>\X'tty: link') .IP \(bu 2 \fBsbcl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8330'\fI\%#8330\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8330\fP>\X'tty: link') .IP \(bu 2 \fBstarship\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8520'\fI\%#8520\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8520\fP>\X'tty: link') .IP \(bu 2 \fBtopgrade\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8651'\fI\%#8651\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8651\fP>\X'tty: link') .IP \(bu 2 \fBwine\fP, \fBwineboot\fP and \fBwinemaker\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8411'\fI\%#8411\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8411\fP>\X'tty: link') .IP \(bu 2 Windows Subsystem for Linux (WSL)\(aqs \fBwslpath\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8364'\fI\%#8364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8364\fP>\X'tty: link') .IP \(bu 2 Windows\(aq \fBcolor\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8483'\fI\%#8483\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8483\fP>\X'tty: link'), \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8486'\fI\%#8486\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8486\fP>\X'tty: link') .IP \(bu 2 \fBzef\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8114'\fI\%#8114\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8114\fP>\X'tty: link') .UNINDENT .IP \(bu 2 Improvements to many completions, especially for \fBgit\fP aliases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8129'\fI\%#8129\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8129\fP>\X'tty: link'), subcommands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8134'\fI\%#8134\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8134\fP>\X'tty: link') and submodules (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8716'\fI\%#8716\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8716\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8121'\fI\%#8121\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8121\fP>\X'tty: link'). .IP \(bu 2 Directory history navigation works out of the box with Apple Terminal\(aqs default key settings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2330'\fI\%#2330\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2330\fP>\X'tty: link'). .IP \(bu 2 fish now assumes Unicode 9+ widths for emoji under iTerm 2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8200'\fI\%#8200\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8200\fP>\X'tty: link'). .IP \(bu 2 Skin\-tone emoji modifiers (U+1F3FB through U+1F3FF) are now measured as width 0 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8275'\fI\%#8275\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8275\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8167'\fI\%#8167\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8167\fP>\X'tty: link'). .IP \(bu 2 Vi cursor shaping and $PWD reporting is now also enabled on foot (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8422'\fI\%#8422\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8422\fP>\X'tty: link'). .IP \(bu 2 \fBls\fP will use colors also on newer versions of Apple Terminal.app (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8309'\fI\%#8309\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8309\fP>\X'tty: link'). .IP \(bu 2 The \fBdelete\fP and \fBshift\fP\-\fBtab\fP keys work more reliably under \fBst\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8352'\fI\%#8352\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8352\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/8354'\fI\%#8354\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8354\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7851'\fI\%#7851\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7851\fP>\X'tty: link') .IP \(bu 2 The HTML version of the documentation now includes copy buttons for code examples (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8218'\fI\%#8218\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8218\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8632'\fI\%#8632\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8632\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7845'\fI\%#7845\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7845\fP>\X'tty: link'). .IP \(bu 2 The macOS installer does not assert that Rosetta is required to install fish on machines with Apple Silicon (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8566'\fI\%#8566\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8566\fP>\X'tty: link'). .IP \(bu 2 The macOS installer now cleans up previous .pkg installations when upgrading. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2963'\fI\%#2963\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2963\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8150'\fI\%#8150\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8150\fP>\X'tty: link'). .IP \(bu 2 Building using NetBSD curses works on any platform (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8087'\fI\%#8087\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8087\fP>\X'tty: link'). .IP \(bu 2 The build system now uses the default linker instead of forcing use of the gold or lld linker (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8152'\fI\%#8152\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8152\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8088'\fI\%#8088\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8088\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8095'\fI\%#8095\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8095\fP>\X'tty: link'). .IP \(bu 2 The Vi mode indicator in the prompt is repainted correctly after \fBctrl\fP\-\fBc\fP cancels the current command (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8103'\fI\%#8103\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8103\fP>\X'tty: link'). .IP \(bu 2 fish builds correctly on platforms that do not have a \fBspawn.h\fP header, such as old versions of OS X (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8097'\fI\%#8097\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8097\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7958'\fI\%#7958\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7958\fP>\X'tty: link'). .IP \(bu 2 The documentation has been reorganized to be easier to understand (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7773'\fI\%#7773\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7773\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7650'\fI\%#7650\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7650\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7105'\fI\%#7105\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7105\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7958'\fI\%#7958\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7958\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7856'\fI\%#7856\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7856\fP>\X'tty: link'). \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7877'\fI\%#7877\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7877\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7802'\fI\%#7802\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7802\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7836'\fI\%#7836\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7836\fP>\X'tty: link'). .IP \(bu 2 fish should now better handle \fBcd\fP on filesystems with broken \fBstat(3)\fP responses (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7577'\fI\%#7577\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7577\fP>\X'tty: link'). .IP \(bu 2 Builtins now properly report a \fB$status\fP of 1 upon unsuccessful writes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7857'\fI\%#7857\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7857\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7938'\fI\%#7938\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7938\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7955'\fI\%#7955\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7955\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7921'\fI\%#7921\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7921\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1256'\fI\%#1256\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1256\fP>\X'tty: link'). .IP \(bu 2 When universal variables are unavailable for some reason, setting a universal variable now sets a global variable instead (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7921'\fI\%#7921\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7921\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5036'\fI\%#5036\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5036\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5832'\fI\%#5832\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5832\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7721'\fI\%#7721\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7721\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8082'\fI\%#8082\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8082\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7402'\fI\%#7402\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7402\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7864'\fI\%#7864\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7864\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7875'\fI\%#7875\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7875\fP>\X'tty: link'). .IP \(bu 2 \fBfish \-\-help\fP is more helpful if the documentation isn\(aqt installed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7824'\fI\%#7824\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7824\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7879'\fI\%#7879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7879\fP>\X'tty: link'). .IP \(bu 2 A new variable, \fBfish_killring\fP, containing entries from the killring, is now available (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7445'\fI\%#7445\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7445\fP>\X'tty: link'). .IP \(bu 2 \fBfish \-\-private\fP prints a note on private mode on startup even if \fB$fish_greeting\fP is an empty list (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7974'\fI\%#7974\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7974\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7968'\fI\%#7968\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7968\fP>\X'tty: link'). .IP \(bu 2 \fBwait\fP and \fBon\-process\-exit\fP work correctly with jobs that have already exited (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7210'\fI\%#7210\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7210\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7997'\fI\%#7997\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7997\fP>\X'tty: link'). .IP \(bu 2 Errors from \fBalias\fP are now printed to standard error, matching other builtins and functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7925'\fI\%#7925\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7925\fP>\X'tty: link'). .IP \(bu 2 \fBls\fP output is colorized on OpenBSD if colorls utility is installed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8035'\fI\%#8035\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8035\fP>\X'tty: link') .IP \(bu 2 The default pager color looks better in terminals with light backgrounds (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3412'\fI\%#3412\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3412\fP>\X'tty: link'). .IP \(bu 2 Further robustness improvements to the bash history import (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7874'\fI\%#7874\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7874\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8031'\fI\%#8031\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8031\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8043'\fI\%#8043\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8043\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8053'\fI\%#8053\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8053\fP>\X'tty: link'). .IP \(bu 2 \fBexit\fP run within \fBfish_prompt\fP now exits properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8033'\fI\%#8033\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8033\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6415'\fI\%#6415\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6415\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7847'\fI\%#7847\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7847\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7908'\fI\%#7908\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7908\fP>\X'tty: link'). .IP \(bu 2 \fBs\fP in Vi visual mode now does the same thing as \fBc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8039'\fI\%#8039\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8039\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7922'\fI\%#7922\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7922\fP>\X'tty: link'). .IP \(bu 2 \fBexit\fP works correctly in bindings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7967'\fI\%#7967\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7967\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7863'\fI\%#7863\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7863\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7905'\fI\%#7905\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7905\fP>\X'tty: link'). .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\&. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6258'\fI\%#6258\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6258\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7880'\fI\%#7880\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7880\fP>\X'tty: link'). .IP \(bu 2 Performance of the \(dqinformative\(dq git prompt is improved somewhat (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7871'\fI\%#7871\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7871\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7884'\fI\%#7884\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7884\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7897'\fI\%#7897\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7897\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7930'\fI\%#7930\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7930\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7932'\fI\%#7932\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7932\fP>\X'tty: link'). .IP \(bu 2 The Web\-based configuration\(aqs prompt picker now shows and installs right prompts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7930'\fI\%#7930\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7930\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7926'\fI\%#7926\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7926\fP>\X'tty: link'). .UNINDENT .SS Completions .INDENT 0.0 .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBfirewall\-cmd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7900'\fI\%#7900\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7900\fP>\X'tty: link') .IP \(bu 2 \fBsv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8069'\fI\%#8069\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8069\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4693'\fI\%#4693\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4693\fP>\X'tty: link'). .IP \(bu 2 The \fB\-\-force\-files\fP option to \fBcomplete\fP works for bare arguments, not just options (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7920'\fI\%#7920\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7920\fP>\X'tty: link'). .IP \(bu 2 Completion descriptions for functions don\(aqt include the function definition, making them more concise (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7911'\fI\%#7911\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7911\fP>\X'tty: link'). .IP \(bu 2 The \fBkill\fP completions no longer error on MSYS2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8046'\fI\%#8046\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8046\fP>\X'tty: link'). .IP \(bu 2 Completion scripts are now loaded when calling a command via a relative path (like \fB\&./git\fP) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6001'\fI\%#6001\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6001\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7992'\fI\%#7992\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7992\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7744'\fI\%#7744\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7744\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7893'\fI\%#7893\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7893\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8011'\fI\%#8011\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8011\fP>\X'tty: link'). .IP \(bu 2 If the prompt takes up the entire line, the last character should no longer be chopped off in certain terminals (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8002'\fI\%#8002\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8002\fP>\X'tty: link'). .IP \(bu 2 fish\(aqs reflow handling has been disabled by default for kitty (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7961'\fI\%#7961\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7961\fP>\X'tty: link'). .IP \(bu 2 The default prompt no longer produces errors when used with a dumb terminal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7904'\fI\%#7904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7904\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7782'\fI\%#7782\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7782\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8023'\fI\%#8023\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8023\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7841'\fI\%#7841\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7841\fP>\X'tty: link'). .IP \(bu 2 fish will no longer hang on exit if another process is in the foreground on macOS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7901'\fI\%#7901\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7901\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7853'\fI\%#7853\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7853\fP>\X'tty: link'). .IP \(bu 2 Arguments longer than 1024 characters no longer trigger excessive CPU usage on macOS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7837'\fI\%#7837\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7837\fP>\X'tty: link'). .IP \(bu 2 fish builds correctly on macOS when using new versions of Xcode (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7838'\fI\%#7838\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7838\fP>\X'tty: link'). .IP \(bu 2 Completions for \fBaura\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7865'\fI\%#7865\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7865\fP>\X'tty: link') and \fBtshark\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7858'\fI\%#7858\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7858\fP>\X'tty: link') should no longer produce errors. .IP \(bu 2 Background jobs no longer interfere with syntax highlighting (a regression introduced in fish 3.2.1, \X'tty: link https://github.com/fish-shell/fish-shell/issues/7842'\fI\%#7842\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7842\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7770'\fI\%#7770\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7770\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7771'\fI\%#7771\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7771\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7769'\fI\%#7769\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7769\fP>\X'tty: link'). .IP \(bu 2 Universal variables should be fully reliable regardless of operating system again (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7774'\fI\%#7774\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7774\fP>\X'tty: link'). .IP \(bu 2 \fBfish_git_prompt\fP no longer causes screen flickering in certain terminals (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7775'\fI\%#7775\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7775\fP>\X'tty: link'). .IP \(bu 2 \fBfish_add_path\fP manipulates the \fBfish_user_paths\fP variable correctly when moving multiple paths (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7776'\fI\%#7776\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7776\fP>\X'tty: link'). .IP \(bu 2 Pasting with a multi\-line command no longer causes a \fB__fish_tokenizer_state\fP error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7782'\fI\%#7782\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7782\fP>\X'tty: link'). .IP \(bu 2 \fBpsub\fP inside event handlers cleans up temporary files properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7792'\fI\%#7792\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7792\fP>\X'tty: link'). .IP \(bu 2 Event handlers declared with \fB\-\-on\-job\-exit $fish_pid\fP no longer run constantly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7721'\fI\%#7721\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7721\fP>\X'tty: link'), although these functions should use \fB\-\-on\-event fish_exit\fP instead. .IP \(bu 2 Changing terminal modes inside \fBconfig.fish\fP works (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7783'\fI\%#7783\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7783\fP>\X'tty: link'). .IP \(bu 2 \fBset_color \-\-print\-colors\fP no longer prints all colors in bold (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7805'\fI\%#7805\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7805\fP>\X'tty: link') .IP \(bu 2 Completing commands starting with a \fB\-\fP no longer prints an error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7809'\fI\%#7809\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7809\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7777'\fI\%#7777\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7777\fP>\X'tty: link'). .IP \(bu 2 The new \fBtype\fP builtin now has the (deprecated) \fB\-\-quiet\fP long form of \fB\-q\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7766'\fI\%#7766\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7766\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7789'\fI\%#7789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7789\fP>\X'tty: link'). .IP \(bu 2 The history file can be made a symbolic link without it being overwritten (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7754'\fI\%#7754\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7754\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7785'\fI\%#7785\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7785\fP>\X'tty: link'). .IP \(bu 2 Improvements to the \fBrsync\fP completions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7763'\fI\%#7763\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7763\fP>\X'tty: link'), some completion descriptions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7788'\fI\%#7788\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7788\fP>\X'tty: link'), and completions that use IP address (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7787'\fI\%#7787\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7787\fP>\X'tty: link'). .IP \(bu 2 Improvements to the appearance of \fBfish_config\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7811'\fI\%#7811\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7811\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1367'\fI\%#1367\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1367\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/904'\fI\%#904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/904\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6924'\fI\%#6924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6924\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2315'\fI\%#2315\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2315\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7704'\fI\%#7704\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7704\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6960'\fI\%#6960\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6960\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7028'\fI\%#7028\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7028\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6030'\fI\%#6030\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6030\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6500'\fI\%#6500\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6500\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7371'\fI\%#7371\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7371\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7523'\fI\%#7523\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7523\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/977'\fI\%#977\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/977\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7459'\fI\%#7459\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7459\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7226'\fI\%#7226\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7226\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2382'\fI\%#2382\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2382\fP>\X'tty: link'), and the completion tutorial has also been moved out into its own document (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6709'\fI\%#6709\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6709\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6574'\fI\%#6574\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6574\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7222'\fI\%#7222\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7222\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7342'\fI\%#7342\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7342\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7036'\fI\%#7036\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7036\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6854'\fI\%#6854\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6854\fP>\X'tty: link'). .IP \(bu 2 \fBset\fP and backgrounded jobs no longer overwrite \fB$pipestatus\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6820'\fI\%#6820\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6820\fP>\X'tty: link'), improving its use in command substitutions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6998'\fI\%#6998\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6998\fP>\X'tty: link'). .IP \(bu 2 Computed (\(dqelectric\(dq) variables such as \fBstatus\fP are now only global in scope, so \fBset \-Uq status\fP returns false (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7032'\fI\%#7032\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7032\fP>\X'tty: link'). .IP \(bu 2 The output for \fBset \-\-show\fP has been shortened, only mentioning the scopes in which a variable exists (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6944'\fI\%#6944\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6944\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6824'\fI\%#6824\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6824\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6822'\fI\%#6822\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6822\fP>\X'tty: link'). .IP \(bu 2 A new subcommand, \fBstring pad\fP, allows extending strings to a given width (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7340'\fI\%#7340\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7340\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7102'\fI\%#7102\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7102\fP>\X'tty: link'). .IP \(bu 2 \fBstring sub\fP has a new \fB\-\-end\fP option to specify the end index of a substring (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6765'\fI\%#6765\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6765\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5974'\fI\%#5974\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5974\fP>\X'tty: link'). .IP \(bu 2 \fBstring split\fP has a new \fB\-\-fields\fP option to specify fields to output, similar to \fBcut \-f\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6770'\fI\%#6770\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6770\fP>\X'tty: link'). .IP \(bu 2 \fBstring trim\fP now also trims vertical tabs by default (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6795'\fI\%#6795\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6795\fP>\X'tty: link'). .IP \(bu 2 \fBstring replace\fP no longer prints an error if a capturing group wasn\(aqt matched, instead treating it as empty (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7343'\fI\%#7343\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7343\fP>\X'tty: link'). .IP \(bu 2 \fBstring\fP subcommands now quit early when used with \fB\-\-quiet\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7495'\fI\%#7495\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7495\fP>\X'tty: link'). .IP \(bu 2 \fBstring repeat\fP now handles multiple arguments, repeating each one (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5988'\fI\%#5988\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5988\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7030'\fI\%#7030\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7030\fP>\X'tty: link'). .IP \(bu 2 \fBfish_indent\fP now removes unnecessary quotes in simple cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6722'\fI\%#6722\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6722\fP>\X'tty: link') and gained a \fB\-\-check\fP option to just check if a file is indented correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7251'\fI\%#7251\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7251\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6947'\fI\%#6947\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6947\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6959'\fI\%#6959\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6959\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2727'\fI\%#2727\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2727\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4319'\fI\%#4319\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4319\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7076'\fI\%#7076\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7076\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1818'\fI\%#1818\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1818\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7038'\fI\%#7038\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7038\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6809'\fI\%#6809\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6809\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6812'\fI\%#6812\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6812\fP>\X'tty: link'). .IP \(bu 2 \fBjobs\fP now shows continued child processes correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6818'\fI\%#6818\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6818\fP>\X'tty: link') .IP \(bu 2 \fBdisown\fP should no longer create zombie processes when job control is off, such as in \fBconfig.fish\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7183'\fI\%#7183\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7183\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7276'\fI\%#7276\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7276\fP>\X'tty: link'). .IP \(bu 2 \fBargparse\fP no longer requires a short flag letter for long\-only options (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7585'\fI\%#7585\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7585\fP>\X'tty: link') and only prints a backtrace with invalid options to argparse itself (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6703'\fI\%#6703\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6703\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7321'\fI\%#7321\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7321\fP>\X'tty: link'). .IP \(bu 2 \fBset_color \-b\fP (without an argument) no longer prints an error message, matching other invalid invocations of this command (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7154'\fI\%#7154\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7154\fP>\X'tty: link'). .IP \(bu 2 \fBexec\fP no longer produces a syntax error when the command cannot be found (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6098'\fI\%#6098\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6098\fP>\X'tty: link'). .IP \(bu 2 \fBset \-\-erase\fP and \fBabbr \-\-erase\fP can now erase multiple things in one go, matching \fBfunctions \-\-erase\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7377'\fI\%#7377\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7377\fP>\X'tty: link'). .IP \(bu 2 \fBabbr \-\-erase\fP no longer prints errors when used with no arguments or on an unset abbreviation (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7376'\fI\%#7376\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7376\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7732'\fI\%#7732\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7732\fP>\X'tty: link'). .IP \(bu 2 \fBtest \-t\fP, for testing whether file descriptors are connected to a terminal, works for file descriptors 0, 1, and 2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4766'\fI\%#4766\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4766\fP>\X'tty: link'). It can still return incorrect results in other cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1228'\fI\%#1228\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1228\fP>\X'tty: link'). .IP \(bu 2 Trying to execute scripts with Windows line endings (CRLF) produces a sensible error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2783'\fI\%#2783\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2783\fP>\X'tty: link'). .IP \(bu 2 Trying to execute commands with arguments that exceed the operating system limit now produces a specific error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6800'\fI\%#6800\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6800\fP>\X'tty: link'). .IP \(bu 2 An \fBalias\fP that delegates to a command with the same name no longer triggers an error about recursive completion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7389'\fI\%#7389\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7389\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP now has a \fB\-\-base\fP option to output the result in hexadecimal or octal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7496'\fI\%#7496\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7496\fP>\X'tty: link') and produces more specific error messages (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7508'\fI\%#7508\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7508\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP learned bitwise functions \fBbitand\fP, \fBbitor\fP and \fBbitxor\fP, used like \fBmath \(dqbitand(0xFE, 5)\(dq\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7281'\fI\%#7281\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7281\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7540'\fI\%#7540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7540\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7230'\fI\%#7230\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7230\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP can now read interactively from other files, and can be used to read from the terminal via \fBread \X'tty: link'). .IP \(bu 2 A new \fBfish_status_to_signal\fP function for transforming exit statuses to signal names has been added (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7597'\fI\%#7597\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7597\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7595'\fI\%#7595\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7595\fP>\X'tty: link'). .IP \(bu 2 The fallback \fBrealpath\fP builtin supports the \fB\-s\fP/\fB\-\-no\-symlinks\fP option, like GNU realpath (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7574'\fI\%#7574\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7574\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7614'\fI\%#7614\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7614\fP>\X'tty: link'). .IP \(bu 2 fish now finds user configuration even if the \fBHOME\fP environment variable is not set (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7620'\fI\%#7620\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7620\fP>\X'tty: link'). .IP \(bu 2 fish no longer crashes when started from a Windows\-style working directory (eg \fBF:\epath\fP) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7636'\fI\%#7636\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7636\fP>\X'tty: link'). .IP \(bu 2 \fBfish \-c\fP now reads the remaining arguments into \fB$argv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2314'\fI\%#2314\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2314\fP>\X'tty: link'). .IP \(bu 2 The \fBpwd\fP command supports the long options \fB\-\-logical\fP and \fB\-\-physical\fP, matching other implementations (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6787'\fI\%#6787\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6787\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7648'\fI\%#7648\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7648\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7698'\fI\%#7698\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7698\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7702'\fI\%#7702\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7702\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3303'\fI\%#3303\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3303\fP>\X'tty: link'). .UNINDENT .SS Interactive improvements .INDENT 0.0 .IP \(bu 2 fish will now always attempt to become process group leader in interactive mode (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7060'\fI\%#7060\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7060\fP>\X'tty: link'). This helps avoid hangs in certain circumstances, and allows tmux\(aqs current directory introspection to work (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5699'\fI\%#5699\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5699\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1018'\fI\%#1018\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1018\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6928'\fI\%#6928\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6928\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6863'\fI\%#6863\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6863\fP>\X'tty: link'). .IP \(bu 2 \fBhelp string match/replace/\fP will show the help for string subcommands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6786'\fI\%#6786\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6786\fP>\X'tty: link'). .IP \(bu 2 \fBfish_key_reader\fP sets the exit status to 0 when used with \fB\-\-help\fP or \fB\-\-version\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6964'\fI\%#6964\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6964\fP>\X'tty: link'). .IP \(bu 2 \fBfish_key_reader\fP and \fBfish_indent\fP send output from \fB\-\-version\fP to standard output, matching other fish binaries (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6964'\fI\%#6964\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6964\fP>\X'tty: link'). .IP \(bu 2 A new variable \fB$status_generation\fP is incremented only when the previous command produces an exit status (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6815'\fI\%#6815\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6815\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7265'\fI\%#7265\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7265\fP>\X'tty: link'). .IP \(bu 2 Events are properly emitted after a job is cancelled (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2356'\fI\%#2356\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2356\fP>\X'tty: link'). .IP \(bu 2 \fBfish_preexec\fP and \fBfish_postexec\fP events are no longer triggered for empty commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4829'\fI\%#4829\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4829\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7085'\fI\%#7085\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7085\fP>\X'tty: link'). .IP \(bu 2 Functions triggered by the \fBfish_exit\fP event are correctly run when the terminal is closed or the shell receives SIGHUP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7014'\fI\%#7014\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7014\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7039'\fI\%#7039\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7039\fP>\X'tty: link'). .IP \(bu 2 A new \fBfish_posterror\fP event is emitted when attempting to execute a command with syntax errors (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6880'\fI\%#6880\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6880\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6816'\fI\%#6816\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6816\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6511'\fI\%#6511\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6511\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6630'\fI\%#6630\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6630\fP>\X'tty: link'): .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7007'\fI\%#7007\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7007\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7254'\fI\%#7254\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7254\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7359'\fI\%#7359\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7359\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6970'\fI\%#6970\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6970\fP>\X'tty: link'), and after closing a command substitution (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6658'\fI\%#6658\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6658\fP>\X'tty: link'). .IP \(bu 2 The history file is now created with user\-private permissions, matching other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6926'\fI\%#6926\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6926\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6726'\fI\%#6726\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6726\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6714'\fI\%#6714\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6714\fP>\X'tty: link') and no longer depends on locale (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6757'\fI\%#6757\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6757\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7293'\fI\%#7293\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7293\fP>\X'tty: link'). .IP \(bu 2 \fBctrl\fP\-\fBc\fP handling has been reimplemented in C++ and is therefore quicker (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5259'\fI\%#5259\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5259\fP>\X'tty: link'), no longer occasionally prints an \(dqunknown command\(dq error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7145'\fI\%#7145\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7145\fP>\X'tty: link') or overwrites multiline prompts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3537'\fI\%#3537\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3537\fP>\X'tty: link'). .IP \(bu 2 \fBctrl\fP\-\fBc\fP no longer kills background jobs for which job control is disabled, matching POSIX semantics (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6828'\fI\%#6828\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6828\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6861'\fI\%#6861\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6861\fP>\X'tty: link'). .IP \(bu 2 Autosuggestions work properly after \fBctrl\fP\-\fBc\fP cancels the current commmand line (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6937'\fI\%#6937\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6937\fP>\X'tty: link'). .IP \(bu 2 History search is now case\-insensitive unless the search string contains an uppercase character (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7273'\fI\%#7273\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7273\fP>\X'tty: link'). .IP \(bu 2 \fBfish_update_completions\fP gained a new \fB\-\-keep\fP option, which improves speed by skipping completions that already exist (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6775'\fI\%#6775\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6775\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6796'\fI\%#6796\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6796\fP>\X'tty: link'). .IP \(bu 2 Aliases containing an embedded backslash appear properly in the output of \fBalias\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6910'\fI\%#6910\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6910\fP>\X'tty: link'). .IP \(bu 2 \fBopen\fP no longer hangs indefinitely on certain systems, as a bug in \fBxdg\-open\fP has been worked around (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7215'\fI\%#7215\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7215\fP>\X'tty: link'). .IP \(bu 2 Long command lines no longer add a blank line after execution (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6826'\fI\%#6826\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6826\fP>\X'tty: link') and behave better with \fBbackspace\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6951'\fI\%#6951\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6951\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions \-t\fP works like the long option \fB\-\-handlers\-type\fP, as documented, instead of producing an error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6985'\fI\%#6985\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6985\fP>\X'tty: link'). .IP \(bu 2 History search now flashes when it found no more results (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7362'\fI\%#7362\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7362\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7335'\fI\%#7335\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7335\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7314'\fI\%#7314\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7314\fP>\X'tty: link'). .IP \(bu 2 The fish Web configuration tool (\fBfish_config\fP) shows prompts correctly on Termux for Android (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7298'\fI\%#7298\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7298\fP>\X'tty: link') and detects Windows Services for Linux 2 properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7027'\fI\%#7027\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7027\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7158'\fI\%#7158\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7158\fP>\X'tty: link'). Finally, a bug in the Source Code Pro font may cause browsers to hang, so this font is no longer chosen by default (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7714'\fI\%#7714\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7714\fP>\X'tty: link'). .IP \(bu 2 \fBfuncsave\fP gained a new \fB\-\-directory\fP option to specify the location of the saved function (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7041'\fI\%#7041\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7041\fP>\X'tty: link'). .IP \(bu 2 \fBhelp\fP works properly on MSYS2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7113'\fI\%#7113\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7113\fP>\X'tty: link') and only uses \fBcmd.exe\fP if running on WSL (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6797'\fI\%#6797\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6797\fP>\X'tty: link'). .IP \(bu 2 Resuming a piped job by its number, like \fBfg %1\fP, works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7406'\fI\%#7406\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7406\fP>\X'tty: link'). Resumed jobs show the correct title in the terminal emulator (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7444'\fI\%#7444\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7444\fP>\X'tty: link'). .IP \(bu 2 Commands run from key bindings now use the same TTY modes as normal commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7483'\fI\%#7483\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7483\fP>\X'tty: link'). .IP \(bu 2 Autosuggestions from history are now case\-sensitive (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3978'\fI\%#3978\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3978\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7555'\fI\%#7555\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7555\fP>\X'tty: link'). .IP \(bu 2 Updated localisations for pt_BR (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7480'\fI\%#7480\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7480\fP>\X'tty: link'). .IP \(bu 2 \fBfish_trace\fP output now starts with \fB\->\fP (like \fBfish \-\-profile\fP), making the depth more visible (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7538'\fI\%#7538\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7538\fP>\X'tty: link'). .IP \(bu 2 Resizing the terminal window no longer produces a corrupted prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6532'\fI\%#6532\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6532\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7404'\fI\%#7404\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7404\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions\fP produces an error rather than crashing on certain invalid arguments (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7515'\fI\%#7515\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7515\fP>\X'tty: link'). .IP \(bu 2 A crash in completions with inline variable assignment (eg \fBA= b\fP) has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7344'\fI\%#7344\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7344\fP>\X'tty: link'). .IP \(bu 2 \fBfish_private_mode\fP may now be changed dynamically using \fBset\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7589'\fI\%#7589\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7589\fP>\X'tty: link'), and history is kept in memory in private mode (but not stored permanently) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7590'\fI\%#7590\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7590\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1383'\fI\%#1383\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1383\fP>\X'tty: link'). .IP \(bu 2 Importing bash history or reporting errors with recursive globs (\fB**\fP) no longer hangs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7407'\fI\%#7407\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7407\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7497'\fI\%#7497\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7497\fP>\X'tty: link'). .IP \(bu 2 \fBbind\fP now shows \fB\ex7f\fP for the del key instead of a literal DEL character (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7631'\fI\%#7631\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7631\fP>\X'tty: link') .IP \(bu 2 Paths containing variables or tilde expansion are only suggested when they are still valid (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7582'\fI\%#7582\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7582\fP>\X'tty: link'). .IP \(bu 2 Syntax highlighting can now color a command as invalid even if executed quickly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5912'\fI\%#5912\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5912\fP>\X'tty: link'). .IP \(bu 2 Redirection targets are no longer highlighted as error if they contain variables which will likely be defined by the current commandline (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6654'\fI\%#6654\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6654\fP>\X'tty: link'). .IP \(bu 2 fish is now more resilient against broken terminal modes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7133'\fI\%#7133\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7133\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4873'\fI\%#4873\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4873\fP>\X'tty: link'). .IP \(bu 2 fish handles being in control of the TTY without owning its own process group better, avoiding some hangs in special configurations (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7388'\fI\%#7388\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7388\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7678'\fI\%#7678\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7678\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7694'\fI\%#7694\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7694\fP>\X'tty: link'). .IP \(bu 2 Commands with a trailing escaped space are saved in history correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7661'\fI\%#7661\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7661\fP>\X'tty: link'). .IP \(bu 2 \fBfish_prompt\fP no longer mangles Unicode characters in the private\-use range U+F600\-U+F700. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7723'\fI\%#7723\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7723\fP>\X'tty: link'). .IP \(bu 2 The universal variable file, \fBfish_variables\fP, can be made a symbolic link without it being overwritten (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7466'\fI\%#7466\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7466\fP>\X'tty: link'). .IP \(bu 2 fish is now more resilient against \fBmktemp\fP failing (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7482'\fI\%#7482\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7482\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6570'\fI\%#6570\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6570\fP>\X'tty: link'). .IP \(bu 2 \fBctrl\fP\-\fBz\fP is now available for binding (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7152'\fI\%#7152\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7152\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7433'\fI\%#7433\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7433\fP>\X'tty: link'). .IP \(bu 2 \fBfish_clipboard_paste\fP (\fBctrl\fP\-\fBv\fP) trims indentation from multiline commands, because fish already indents (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7662'\fI\%#7662\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7662\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6648'\fI\%#6648\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6648\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6755'\fI\%#6755\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6755\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6769'\fI\%#6769\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6769\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7442'\fI\%#7442\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7442\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7516'\fI\%#7516\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7516\fP>\X'tty: link'). .IP \(bu 2 Vi mode bindings support \fB~\fP (tilde) to toggle the case of the selected character (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6908'\fI\%#6908\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6908\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7217'\fI\%#7217\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7217\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4984'\fI\%#4984\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4984\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7217'\fI\%#7217\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7217\fP>\X'tty: link'). This includes \fBsuppress\-autosuggestion\fP to reflect whether an autosuggestion was suppressed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1419'\fI\%#1419\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1419\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6838'\fI\%#6838\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6838\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6855'\fI\%#6855\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6855\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6138'\fI\%#6138\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6138\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6954'\fI\%#6954\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6954\fP>\X'tty: link'). .IP \(bu 2 \fB__fish_prepend_sudo\fP (\fBalt\fP\-\fBs\fP) now toggles a \fBsudo\fP prefix (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7012'\fI\%#7012\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7012\fP>\X'tty: link') and avoids shifting the cursor (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6542'\fI\%#6542\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6542\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7079'\fI\%#7079\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7079\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7137'\fI\%#7137\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7137\fP>\X'tty: link'). .IP \(bu 2 \fB__fish_whatis_current_token\fP (\fBalt\fP\-\fBw\fP) prints descriptions for functions and builtins (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7191'\fI\%#7191\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7191\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2083'\fI\%#2083\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2083\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7353'\fI\%#7353\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7353\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7354'\fI\%#7354\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7354\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4025'\fI\%#4025\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4025\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7328'\fI\%#7328\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7328\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7325'\fI\%#7325\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7325\fP>\X'tty: link') .IP \(bu 2 fish\(aqs clipboard bindings now also support Windows Subsystem for Linux via PowerShell and clip.exe (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7455'\fI\%#7455\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7455\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7458'\fI\%#7458\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7458\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7398'\fI\%#7398\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7398\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6566'\fI\%#6566\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6566\fP>\X'tty: link'). .IP \(bu 2 git prompts include all untracked files in the repository, not just those in the current directory (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6086'\fI\%#6086\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6086\fP>\X'tty: link'). .IP \(bu 2 The git prompts correctly show stash states (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6876'\fI\%#6876\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6876\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7136'\fI\%#7136\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7136\fP>\X'tty: link') and clean states (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7471'\fI\%#7471\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7471\fP>\X'tty: link'). .IP \(bu 2 The Mercurial prompt correctly shows untracked status (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6906'\fI\%#6906\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6906\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7033'\fI\%#7033\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7033\fP>\X'tty: link'). .IP \(bu 2 The Subversion prompt was broken in a number of ways in 3.1.0 and has been restored (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6715'\fI\%#6715\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6715\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7278'\fI\%#7278\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7278\fP>\X'tty: link'). .IP \(bu 2 A new helper function \fBfish_is_root_user\fP simplifies checking for superuser privilege (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7031'\fI\%#7031\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7031\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7123'\fI\%#7123\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7123\fP>\X'tty: link'). .IP \(bu 2 New colorschemes \- \fBayu Light\fP, \fBayu Dark\fP and \fBayu Mirage\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7596'\fI\%#7596\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7596\fP>\X'tty: link'). .IP \(bu 2 Bugs related to multiline prompts, including repainting (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5860'\fI\%#5860\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5860\fP>\X'tty: link') or navigating directory history (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3550'\fI\%#3550\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3550\fP>\X'tty: link') leading to graphical glitches have been fixed. .IP \(bu 2 The \fBnim\fP prompt now handles vi mode better (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6802'\fI\%#6802\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6802\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6968'\fI\%#6968\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6968\fP>\X'tty: link'). The \fBfish_vi_cursor\fP option \fB\-\-force\-iterm\fP has been deprecated. .IP \(bu 2 \fBdiff\fP will now colourize output, if supported (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7308'\fI\%#7308\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7308\fP>\X'tty: link'). .IP \(bu 2 Autosuggestions appear when the cursor passes the right prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6948'\fI\%#6948\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6948\fP>\X'tty: link') or wraps to the next line (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7213'\fI\%#7213\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7213\fP>\X'tty: link'). .IP \(bu 2 The cursor shape in Vi mode changes properly in Windows Terminal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6999'\fI\%#6999\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6999\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6478'\fI\%#6478\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6478\fP>\X'tty: link'). .IP \(bu 2 The spurious warning about terminal size in small terminals has been removed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6980'\fI\%#6980\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6980\fP>\X'tty: link'). .IP \(bu 2 Dynamic titles are now enabled in Alacritty (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7073'\fI\%#7073\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7073\fP>\X'tty: link') and emacs\(aq vterm (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7122'\fI\%#7122\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7122\fP>\X'tty: link'). .IP \(bu 2 Current working directory updates are enabled in foot (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7099'\fI\%#7099\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7099\fP>\X'tty: link') and WezTerm (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7649'\fI\%#7649\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7649\fP>\X'tty: link'). .IP \(bu 2 The width computation for certain emoji agrees better with terminals (especially flags). (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7237'\fI\%#7237\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7237\fP>\X'tty: link'). .IP \(bu 2 Long command lines are wrapped in all cases, instead of sometimes being put on a new line (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5118'\fI\%#5118\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5118\fP>\X'tty: link'). .IP \(bu 2 The pager is properly rendered with long command lines selected (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2557'\fI\%#2557\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2557\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7491'\fI\%#7491\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7491\fP>\X'tty: link'). .IP \(bu 2 fish now sets terminal modes sooner, which stops output from appearing before the greeting and prompt are ready (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7489'\fI\%#7489\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7489\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6994'\fI\%#6994\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6994\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7220'\fI\%#7220\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7220\fP>\X'tty: link') .IP \(bu 2 \fBalias\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7035'\fI\%#7035\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7035\fP>\X'tty: link') .IP \(bu 2 \fBalternatives\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7616'\fI\%#7616\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7616\fP>\X'tty: link') .IP \(bu 2 \fBapk\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7108'\fI\%#7108\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7108\fP>\X'tty: link') .IP \(bu 2 \fBasciidoctor\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7000'\fI\%#7000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7000\fP>\X'tty: link') .IP \(bu 2 \fBavifdec\fP and \fBavifenc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7674'\fI\%#7674\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7674\fP>\X'tty: link') .IP \(bu 2 \fBbluetoothctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7438'\fI\%#7438\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7438\fP>\X'tty: link') .IP \(bu 2 \fBcjxl\fP and \fBdjxl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7673'\fI\%#7673\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7673\fP>\X'tty: link') .IP \(bu 2 \fBcmark\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7000'\fI\%#7000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7000\fP>\X'tty: link') .IP \(bu 2 \fBcreate_ap\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7096'\fI\%#7096\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7096\fP>\X'tty: link') .IP \(bu 2 \fBdeno\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7138'\fI\%#7138\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7138\fP>\X'tty: link') .IP \(bu 2 \fBdhclient\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6684'\fI\%#6684\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6684\fP>\X'tty: link') .IP \(bu 2 Postgres\-related commands \fBdropdb\fP, \fBcreatedb\fP, \fBpg_restore\fP, \fBpg_dump\fP and \fBpg_dumpall\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6620'\fI\%#6620\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6620\fP>\X'tty: link') .IP \(bu 2 \fBdotnet\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7558'\fI\%#7558\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7558\fP>\X'tty: link') .IP \(bu 2 \fBdowngrade\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6751'\fI\%#6751\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6751\fP>\X'tty: link') .IP \(bu 2 \fBgapplication\fP, \fBgdbus\fP, \fBgio\fP and \fBgresource\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7300'\fI\%#7300\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7300\fP>\X'tty: link') .IP \(bu 2 \fBgh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7112'\fI\%#7112\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7112\fP>\X'tty: link') .IP \(bu 2 \fBgitk\fP .IP \(bu 2 \fBgroups\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6889'\fI\%#6889\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6889\fP>\X'tty: link') .IP \(bu 2 \fBhashcat\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7746'\fI\%#7746\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7746\fP>\X'tty: link') .IP \(bu 2 \fBhikari\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7083'\fI\%#7083\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7083\fP>\X'tty: link') .IP \(bu 2 \fBicdiff\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7503'\fI\%#7503\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7503\fP>\X'tty: link') .IP \(bu 2 \fBimv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6675'\fI\%#6675\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6675\fP>\X'tty: link') .IP \(bu 2 \fBjohn\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7746'\fI\%#7746\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7746\fP>\X'tty: link') .IP \(bu 2 \fBjulia\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7468'\fI\%#7468\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7468\fP>\X'tty: link') .IP \(bu 2 \fBk3d\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7202'\fI\%#7202\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7202\fP>\X'tty: link') .IP \(bu 2 \fBldapsearch\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7578'\fI\%#7578\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7578\fP>\X'tty: link') .IP \(bu 2 \fBlightdm\fP and \fBdm\-tool\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7624'\fI\%#7624\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7624\fP>\X'tty: link') .IP \(bu 2 \fBlosetup\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7621'\fI\%#7621\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7621\fP>\X'tty: link') .IP \(bu 2 \fBmicro\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7339'\fI\%#7339\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7339\fP>\X'tty: link') .IP \(bu 2 \fBmpc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7169'\fI\%#7169\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7169\fP>\X'tty: link') .IP \(bu 2 Metasploit\(aqs \fBmsfconsole\fP, \fBmsfdb\fP and \fBmsfvenom\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6930'\fI\%#6930\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6930\fP>\X'tty: link') .IP \(bu 2 \fBmtr\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7638'\fI\%#7638\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7638\fP>\X'tty: link') .IP \(bu 2 \fBmysql\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6819'\fI\%#6819\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6819\fP>\X'tty: link') .IP \(bu 2 \fBncat\fP, \fBnc.openbsd\fP, \fBnc.traditional\fP and \fBnmap\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6873'\fI\%#6873\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6873\fP>\X'tty: link') .IP \(bu 2 \fBopenssl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6845'\fI\%#6845\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6845\fP>\X'tty: link') .IP \(bu 2 \fBprime\-run\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7241'\fI\%#7241\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7241\fP>\X'tty: link') .IP \(bu 2 \fBps2pdf{12,13,14,wr}\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6673'\fI\%#6673\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6673\fP>\X'tty: link') .IP \(bu 2 \fBpyenv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6551'\fI\%#6551\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6551\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7019'\fI\%#7019\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7019\fP>\X'tty: link') .IP \(bu 2 \fBspago\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7381'\fI\%#7381\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7381\fP>\X'tty: link') .IP \(bu 2 \fBsphinx\-apidoc\fP, \fBsphinx\-autogen\fP, \fBsphinx\-build\fP and \fBsphinx\-quickstart\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7000'\fI\%#7000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7000\fP>\X'tty: link') .IP \(bu 2 \fBstrace\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6656'\fI\%#6656\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6656\fP>\X'tty: link') .IP \(bu 2 systemd\(aqs \fBbootctl\fP, \fBcoredumpctl\fP, \fBhostnamectl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7428'\fI\%#7428\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7428\fP>\X'tty: link'), \fBhomectl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7435'\fI\%#7435\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7435\fP>\X'tty: link'), \fBnetworkctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7668'\fI\%#7668\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7668\fP>\X'tty: link') and \fBuserdbctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7667'\fI\%#7667\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7667\fP>\X'tty: link') .IP \(bu 2 \fBtcpdump\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6690'\fI\%#6690\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6690\fP>\X'tty: link') .IP \(bu 2 \fBtig\fP .IP \(bu 2 \fBtraceroute\fP and \fBtracepath\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6803'\fI\%#6803\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6803\fP>\X'tty: link') .IP \(bu 2 \fBwindscribe\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6788'\fI\%#6788\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6788\fP>\X'tty: link') .IP \(bu 2 \fBwireshark\fP, \fBtshark\fP, and \fBdumpcap\fP .IP \(bu 2 \fBxbps\-*\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7239'\fI\%#7239\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7239\fP>\X'tty: link') .IP \(bu 2 \fBxxhsum\fP, \fBxxh32sum\fP, \fBxxh64sum\fP and \fBxxh128sum\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7103'\fI\%#7103\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7103\fP>\X'tty: link') .IP \(bu 2 \fByadm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7100'\fI\%#7100\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7100\fP>\X'tty: link') .IP \(bu 2 \fBzopfli\fP and \fBzopflipng\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6872'\fI\%#6872\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6872\fP>\X'tty: link') .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7075'\fI\%#7075\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7075\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7652'\fI\%#7652\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7652\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4358'\fI\%#4358\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4358\fP>\X'tty: link') .IP \(bu 2 \fBmake\fP completions no longer second\-guess make\(aqs file detection, fixing target completion in some cases (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7535'\fI\%#7535\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7535\fP>\X'tty: link'). .IP \(bu 2 Command completions now correctly print the description even if the command was fully matched (like in \fBls\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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7086'\fI\%#7086\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7086\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6879'\fI\%#6879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6879\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7187'\fI\%#7187\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7187\fP>\X'tty: link'). .IP \(bu 2 Significant performance improvements to completion of the available commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7153'\fI\%#7153\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7153\fP>\X'tty: link'), especially on macOS Big Sur where there was a significant regression (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7365'\fI\%#7365\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7365\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7511'\fI\%#7511\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7511\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7040'\fI\%#7040\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7040\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7547'\fI\%#7547\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7547\fP>\X'tty: link'). 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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5451'\fI\%#5451\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5451\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6825'\fI\%#6825\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6825\fP>\X'tty: link'). .IP \(bu 2 The CHANGELOG was moved to restructured text, allowing it to be included in the documentation (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7057'\fI\%#7057\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7057\fP>\X'tty: link'). .IP \(bu 2 fish handles ncurses installed in a non\-standard prefix better (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6600'\fI\%#6600\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6600\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/7219'\fI\%#7219\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7219\fP>\X'tty: link'), and uses variadic tparm on NetBSD curses (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6626'\fI\%#6626\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6626\fP>\X'tty: link'). .IP \(bu 2 The Web\-based configuration tool no longer uses an obsolete Angular version (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7147'\fI\%#7147\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7147\fP>\X'tty: link'). .IP \(bu 2 The fish project has adopted the Contributor Covenant code of conduct (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7151'\fI\%#7151\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7151\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7039'\fI\%#7039\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7039\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7659'\fI\%#7659\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7659\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5460'\fI\%#5460\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5460\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6952'\fI\%#6952\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6952\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6792'\fI\%#6792\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6792\fP>\X'tty: link'). .IP \(bu 2 Building on on macOS earlier than 10.13.6 succeeds, instead of failing on code\-signing (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6791'\fI\%#6791\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6791\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6778'\fI\%#6778\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6778\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6952'\fI\%#6952\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6952\fP>\X'tty: link'). .IP \(bu 2 Running the full interactive test suite now requires Python 3.5+ and the pexpect package (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6825'\fI\%#6825\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6825\fP>\X'tty: link'); 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6537'\fI\%#6537\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6537\fP>\X'tty: link'). .IP \(bu 2 The Web\-based configuration tool is compatible with Python 3.10 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7600'\fI\%#7600\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7600\fP>\X'tty: link') and no longer requires Python\(aqs distutils package (\X'tty: link https://github.com/fish-shell/fish-shell/issues/7514'\fI\%#7514\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/7514\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6955'\fI\%#6955\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6955\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6613'\fI\%#6613\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6613\fP>\X'tty: link'). .IP \(bu 2 Conflicts between upstream packages for ripgrep and bat, and the fish packages, have been resolved (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5822'\fI\%#5822\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5822\fP>\X'tty: link'). .IP \(bu 2 Starting fish in a directory without read access, such as via \fBsu\fP, no longer crashes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6597'\fI\%#6597\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6597\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6593'\fI\%#6593\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6593\fP>\X'tty: link'). .IP \(bu 2 Redirections using the deprecated caret syntax to a file descriptor (eg \fB^&2\fP) work correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6591'\fI\%#6591\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6591\fP>\X'tty: link'). .IP \(bu 2 Redirections that append to a file descriptor (eg \fB2>>&1\fP) work correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6614'\fI\%#6614\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6614\fP>\X'tty: link'). .IP \(bu 2 Building fish on macOS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6602'\fI\%#6602\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6602\fP>\X'tty: link') or with new versions of GCC (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6604'\fI\%#6604\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6604\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6609'\fI\%#6609\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6609\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6598'\fI\%#6598\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6598\fP>\X'tty: link'). .IP \(bu 2 Exported universal variables now update properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6612'\fI\%#6612\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6612\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6635'\fI\%#6635\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6635\fP>\X'tty: link'). .IP \(bu 2 \fBtest\fP no longer crashes when used with “\fBnan\fP” or “\fBinf\fP” arguments, erroring out instead (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6655'\fI\%#6655\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6655\fP>\X'tty: link'). .IP \(bu 2 Copying from the end of the command line no longer crashes fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6680'\fI\%#6680\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6680\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6650'\fI\%#6650\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6650\fP>\X'tty: link'). .IP \(bu 2 Functions using \fB\-\-on\-job\-exit\fP and \fB\-\-on\-process\-exit\fP work reliably again (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6679'\fI\%#6679\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6679\fP>\X'tty: link'). .IP \(bu 2 Functions using \fB\-\-on\-signal INT\fP work reliably in interactive sessions, as they did in fish 2.7 and before (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6649'\fI\%#6649\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6649\fP>\X'tty: link'). 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” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6653'\fI\%#6653\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6653\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6701'\fI\%#6701\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6701\fP>\X'tty: link'). .IP \(bu 2 The Mercurial (\fBhg\fP) prompt no longer produces an error when the current working directory is removed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6699'\fI\%#6699\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6699\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6681'\fI\%#6681\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6681\fP>\X'tty: link'). .IP \(bu 2 Pasting of commands has been sped up (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6713'\fI\%#6713\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6713\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6736'\fI\%#6736\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6736\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6739'\fI\%#6739\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6739\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6763'\fI\%#6763\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6763\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6927'\fI\%#6927\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6927\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6624'\fI\%#6624\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6624\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6806'\fI\%#6806\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6806\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6564'\fI\%#6564\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6564\fP>\X'tty: link'). .IP \(bu 2 Fixes a number of problems in compiling and testing on Cygwin (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6549'\fI\%#6549\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6549\fP>\X'tty: link') and Solaris\-derived systems such as Illumos (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6553'\fI\%#6553\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6553\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6554'\fI\%#6554\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6554\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6555'\fI\%#6555\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6555\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6556'\fI\%#6556\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6556\fP>\X'tty: link', and \X'tty: link https://github.com/fish-shell/fish-shell/issues/6558'\fI\%#6558\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6558\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6584'\fI\%#6584\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6584\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5632'\fI\%#5632\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5632\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1396'\fI\%#1396\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1396\fP>\X'tty: link'). .IP \(bu 2 An overhaul of error messages for builtin commands, including a removal of the overwhelming usage summary, more readable stack traces (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3404'\fI\%#3404\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3404\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5434'\fI\%#5434\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5434\fP>\X'tty: link'), and stack traces for \fBtest\fP (aka \fB[\fP) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5771'\fI\%#5771\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5771\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5879'\fI\%#5879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5879\fP>\X'tty: link'). 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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/159'\fI\%#159\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/159\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5521'\fI\%#5521\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5521\fP>\X'tty: link'). .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 “.” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4484'\fI\%#4484\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4484\fP>\X'tty: link'). .IP \(bu 2 fish now correctly handles \fBCDPATH\fP entries that start with \fB\&..\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6220'\fI\%#6220\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6220\fP>\X'tty: link') or contain \fB\&./\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5887'\fI\%#5887\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5887\fP>\X'tty: link'). .IP \(bu 2 The \fBfish_trace\fP variable may be set to trace execution (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3427'\fI\%#3427\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3427\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3845'\fI\%#3845\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3845\fP>\X'tty: link'). .IP \(bu 2 The fish Web configuration tool (\fBfish_config\fP) prints a list of commands it is executing, to help understanding and debugging (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5584'\fI\%#5584\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5584\fP>\X'tty: link'). .IP \(bu 2 Major performance improvements when pasting (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5866'\fI\%#5866\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5866\fP>\X'tty: link'), executing lots of commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5905'\fI\%#5905\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5905\fP>\X'tty: link'), importing history from bash (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6295'\fI\%#6295\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6295\fP>\X'tty: link'), and when completing variables that might match \fB$history\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6288'\fI\%#6288\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6288\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/117'\fI\%#117\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/117\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5869'\fI\%#5869\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5869\fP>\X'tty: link'). .IP \(bu 2 New redirections \fB&>\fP and \fB&|\fP may be used to redirect or pipe stdout, and also redirect stderr to stdout (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6192'\fI\%#6192\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6192\fP>\X'tty: link'). .IP \(bu 2 \fBswitch\fP now allows arguments that expand to nothing, like empty variables (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5677'\fI\%#5677\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5677\fP>\X'tty: link'). .IP \(bu 2 The \fBVAR=val cmd\fP syntax can now be used to run a command in a modified environment (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6287'\fI\%#6287\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6287\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6089'\fI\%#6089\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6089\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP‘s exponent operator,’\fB^\fP‘, was previously left\-associative, but now uses the more commonly\-used right\-associative behaviour (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6280'\fI\%#6280\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6280\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6480'\fI\%#6480\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6480\fP>\X'tty: link'). .UNINDENT .SS Scripting improvements .INDENT 0.0 .IP \(bu 2 \fBstring split0\fP now returns 0 if it split something (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5701'\fI\%#5701\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5701\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5631'\fI\%#5631\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5631\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP now accepts \fB\-\-scale=max\fP for the maximum scale (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5579'\fI\%#5579\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5579\fP>\X'tty: link'). .IP \(bu 2 \fBbuiltin $var\fP now works correctly, allowing a variable as the builtin name (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5639'\fI\%#5639\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5639\fP>\X'tty: link'). .IP \(bu 2 \fBcd\fP understands the \fB\-\-\fP argument to make it possible to change to directories starting with a hyphen (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6071'\fI\%#6071\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6071\fP>\X'tty: link'). .IP \(bu 2 \fBcomplete \-\-do\-complete\fP now also does fuzzy matches (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5467'\fI\%#5467\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5467\fP>\X'tty: link'). .IP \(bu 2 \fBcomplete \-\-do\-complete\fP can be used inside completions, allowing limited recursion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3474'\fI\%#3474\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3474\fP>\X'tty: link'). .IP \(bu 2 \fBcount\fP now also counts lines fed on standard input (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5744'\fI\%#5744\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5744\fP>\X'tty: link'). .IP \(bu 2 \fBeval\fP produces an exit status of 0 when given no arguments, like other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5692'\fI\%#5692\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5692\fP>\X'tty: link'). .IP \(bu 2 \fBprintf\fP prints what it can when input hasn’t been fully converted to a number, but still prints an error (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5532'\fI\%#5532\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5532\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5646'\fI\%#5646\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5646\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5835'\fI\%#5835\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5835\fP>\X'tty: link'). .IP \(bu 2 \fBargparse\fP has a new \fB\-\-ignore\-unknown\fP option to keep unrecognized options, allowing multiple argparse passes to parse options (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5367'\fI\%#5367\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5367\fP>\X'tty: link'). .IP \(bu 2 \fBargparse\fP correctly handles flag value validation of options that only have short names (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5864'\fI\%#5864\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5864\fP>\X'tty: link'). .IP \(bu 2 \fBread \-S\fP (short option of \fB\-\-shell\fP) is recognised correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5660'\fI\%#5660\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5660\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5846'\fI\%#5846\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5846\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3823'\fI\%#3823\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3823\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6406'\fI\%#6406\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6406\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5859'\fI\%#5859\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5859\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5267'\fI\%#5267\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5267\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP now also understands \fBx\fP for multiplication, provided it is followed by whitespace (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5906'\fI\%#5906\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5906\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP reports the right error when incorrect syntax is used inside parentheses (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6063'\fI\%#6063\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6063\fP>\X'tty: link'), and warns when unsupported logical operations are used (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6096'\fI\%#6096\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6096\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions \-\-erase\fP now also prevents fish from autoloading a function for the first time (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5951'\fI\%#5951\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5951\fP>\X'tty: link'). .IP \(bu 2 \fBjobs \-\-last\fP returns 0 to indicate success when a job is found (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6104'\fI\%#6104\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6104\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6214'\fI\%#6214\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6214\fP>\X'tty: link'). .IP \(bu 2 A bug where \fBstring split\fP would drop empty strings if the output was only empty strings has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5987'\fI\%#5987\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5987\fP>\X'tty: link'). .IP \(bu 2 \fBeval\fP no long creates a new local variable scope, but affects variables in the scope it is called from (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4443'\fI\%#4443\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4443\fP>\X'tty: link'). \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5812'\fI\%#5812\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5812\fP>\X'tty: link'). .IP \(bu 2 Empty universal variables may now be exported (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5992'\fI\%#5992\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5992\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5258'\fI\%#5258\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5258\fP>\X'tty: link'). .IP \(bu 2 A bug where \fBfor\fP could use invalid variable names has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5800'\fI\%#5800\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5800\fP>\X'tty: link'). .IP \(bu 2 A bug where local variables would not be exported to functions has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6153'\fI\%#6153\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6153\fP>\X'tty: link'). .IP \(bu 2 The null command (\fB:\fP) now always exits successfully, rather than passing through the previous exit status (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6022'\fI\%#6022\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6022\fP>\X'tty: link'). .IP \(bu 2 The output of \fBfunctions FUNCTION\fP matches the declaration of the function, correctly including comments or blank lines (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5285'\fI\%#5285\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5285\fP>\X'tty: link'), and correctly includes any \fB\-\-wraps\fP flags (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1625'\fI\%#1625\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1625\fP>\X'tty: link'). .IP \(bu 2 \fBtype\fP supports a new option, \fB\-\-short\fP, which suppress function expansion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6403'\fI\%#6403\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6403\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6411'\fI\%#6411\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6411\fP>\X'tty: link'). .IP \(bu 2 The \fB$hostname\fP variable is no longer truncated to 32 characters (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5758'\fI\%#5758\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5758\fP>\X'tty: link'). .IP \(bu 2 Line numbers in function backtraces are calculated correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6350'\fI\%#6350\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6350\fP>\X'tty: link'). .IP \(bu 2 A new \fBfish_cancel\fP event is emitted when the command line is cancelled, which is useful for terminal integration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5973'\fI\%#5973\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5973\fP>\X'tty: link'). .UNINDENT .SS Interactive improvements .INDENT 0.0 .IP \(bu 2 New Base16 color options are available through the Web\-based configuration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6504'\fI\%#6504\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6504\fP>\X'tty: link'). .IP \(bu 2 fish only parses \fB/etc/paths\fP on macOS in login shells, matching the bash implementation (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5637'\fI\%#5637\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5637\fP>\X'tty: link') and avoiding changes to path ordering in child shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5456'\fI\%#5456\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5456\fP>\X'tty: link'). It now ignores blank lines like the bash implementation (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5809'\fI\%#5809\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5809\fP>\X'tty: link'). .IP \(bu 2 The locale is now reloaded when the \fBLOCPATH\fP variable is changed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5815'\fI\%#5815\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5815\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP no longer keeps a history, making it suitable for operations that shouldn’t end up there, like password entry (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5904'\fI\%#5904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5904\fP>\X'tty: link'). .IP \(bu 2 \fBdirh\fP outputs its stack in the correct order (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5477'\fI\%#5477\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5477\fP>\X'tty: link'), and behaves as documented when universal variables are used for its stack (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5797'\fI\%#5797\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5797\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5625'\fI\%#5625\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5625\fP>\X'tty: link'). .IP \(bu 2 Builtins now pipe their help output to a pager automatically (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6227'\fI\%#6227\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6227\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5872'\fI\%#5872\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5872\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5658'\fI\%#5658\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5658\fP>\X'tty: link') and redirections to close file descriptors (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6092'\fI\%#6092\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6092\fP>\X'tty: link'). .IP \(bu 2 \fBhelp\fP works properly on Windows Subsytem for Linux (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5759'\fI\%#5759\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5759\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/6338'\fI\%#6338\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6338\fP>\X'tty: link'). .IP \(bu 2 A bug where \fBdisown\fP could crash the shell has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5720'\fI\%#5720\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5720\fP>\X'tty: link'). .IP \(bu 2 fish will not autosuggest files ending with \fB~\fP unless there are no other candidates, as these are generally backup files (\X'tty: link https://github.com/fish-shell/fish-shell/issues/985'\fI\%#985\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/985\fP>\X'tty: link'). .IP \(bu 2 Escape in the pager works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5818'\fI\%#5818\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5818\fP>\X'tty: link'). .IP \(bu 2 Key bindings that call \fBfg\fP no longer leave the terminal in a broken state (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2114'\fI\%#2114\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2114\fP>\X'tty: link'). .IP \(bu 2 Brackets (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5831'\fI\%#5831\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5831\fP>\X'tty: link') and filenames containing \fB$\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6060'\fI\%#6060\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6060\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6120'\fI\%#6120\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6120\fP>\X'tty: link'), and launches correctly under Termux (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6248'\fI\%#6248\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6248\fP>\X'tty: link') and OpenBSD (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6522'\fI\%#6522\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6522\fP>\X'tty: link'). .IP \(bu 2 \fBfunction\fP now correctly validates parameters for \fB\-\-argument\-names\fP as valid variable names (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6147'\fI\%#6147\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6147\fP>\X'tty: link') and correctly parses options following \fB\-\-argument\-names\fP, as in “\fB\-\-argument\-names foo \-\-description bar\fP” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6186'\fI\%#6186\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6186\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6269'\fI\%#6269\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6269\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6299'\fI\%#6299\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6299\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6316'\fI\%#6316\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6316\fP>\X'tty: link'). .IP \(bu 2 Ctrl\-C always repaints the prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6394'\fI\%#6394\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6394\fP>\X'tty: link'). .IP \(bu 2 When run interactively from another program (such as Python), fish will correctly start a new process group, like other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5909'\fI\%#5909\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5909\fP>\X'tty: link'). .IP \(bu 2 Job identifiers (for example, for background jobs) are assigned more logically (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6053'\fI\%#6053\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6053\fP>\X'tty: link'). .IP \(bu 2 A bug where history would appear truncated if an empty command was executed was fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6032'\fI\%#6032\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6032\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4327'\fI\%#4327\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4327\fP>\X'tty: link'). .IP \(bu 2 Shift\-Left and Shift\-Right now default to moving backwards and forwards by one bigword (words separated by whitespace) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1505'\fI\%#1505\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1505\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3904'\fI\%#3904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3904\fP>\X'tty: link'). .IP \(bu 2 The \fBforward\-bigword\fP binding now interacts correctly with autosuggestions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5336'\fI\%#5336\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5336\fP>\X'tty: link'). .IP \(bu 2 The \fBfish_clipboard_*\fP functions support Wayland by using \X'tty: link https://github.com/bugaevc/wl-clipboard'\fI\%wl\-clipboard\fP <\fBhttps://github.com/bugaevc/wl-clipboard\fP>\X'tty: link' (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5450'\fI\%#5450\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5450\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6395'\fI\%#6395\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6395\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5783'\fI\%#5783\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5783\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5841'\fI\%#5841\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5841\fP>\X'tty: link'). .IP \(bu 2 The NULL character can now be bound via \fBbind \-k nul\fP\&. Terminals often generate this character via control\-space. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3189'\fI\%#3189\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3189\fP>\X'tty: link'). .IP \(bu 2 A new readline command \fBexpand\-abbr\fP can be used to trigger abbreviation expansion (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5762'\fI\%#5762\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5762\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6140'\fI\%#6140\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6140\fP>\X'tty: link'). .IP \(bu 2 The Alt\-W binding to describe a command should now work better with multiline prompts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6110'\fI\%#6110\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6110\fP>\X'tty: link') .IP \(bu 2 The Alt\-H binding to open a command’s man page now tries to ignore \fBsudo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6122'\fI\%#6122\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6122\fP>\X'tty: link'). .IP \(bu 2 A new pair of bind functions, \fBhistory\-prefix\-search\-backward\fP (and \fBforward\fP), was introduced (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6143'\fI\%#6143\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6143\fP>\X'tty: link'). .IP \(bu 2 Vi mode now supports R to enter replace mode (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6342'\fI\%#6342\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6342\fP>\X'tty: link'), and \fBd0\fP to delete the current line (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6292'\fI\%#6292\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6292\fP>\X'tty: link'). .IP \(bu 2 In Vi mode, hitting Enter in replace\-one mode no longer erases the prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6298'\fI\%#6298\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6298\fP>\X'tty: link'). .IP \(bu 2 Selections in Vi mode are inclusive, matching the actual behaviour of Vi (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5770'\fI\%#5770\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5770\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6375'\fI\%#6375\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6375\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5524'\fI\%#5524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5524\fP>\X'tty: link'). .IP \(bu 2 Better detection and support for using fish from various system consoles, where limited colors and special characters are supported (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5552'\fI\%#5552\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5552\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5722'\fI\%#5722\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5722\fP>\X'tty: link'). .IP \(bu 2 Improvements to the display of wide characters, particularly Korean characters and emoji (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5583'\fI\%#5583\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5583\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5729'\fI\%#5729\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5729\fP>\X'tty: link'). .IP \(bu 2 The Vi mode cursor is correctly redrawn when regaining focus under terminals that report focus (eg tmux) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4788'\fI\%#4788\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4788\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6052'\fI\%#6052\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6052\fP>\X'tty: link') .IP \(bu 2 \fBbosh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5700'\fI\%#5700\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5700\fP>\X'tty: link') .IP \(bu 2 \fBbtrfs\fP .IP \(bu 2 \fBcamcontrol\fP .IP \(bu 2 \fBcf\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5700'\fI\%#5700\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5700\fP>\X'tty: link') .IP \(bu 2 \fBchronyc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6496'\fI\%#6496\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6496\fP>\X'tty: link') .IP \(bu 2 \fBcode\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6205'\fI\%#6205\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6205\fP>\X'tty: link') .IP \(bu 2 \fBcryptsetup\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6488'\fI\%#6488\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6488\fP>\X'tty: link') .IP \(bu 2 \fBcsc\fP and \fBcsi\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6016'\fI\%#6016\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6016\fP>\X'tty: link') .IP \(bu 2 \fBcwebp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6034'\fI\%#6034\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6034\fP>\X'tty: link') .IP \(bu 2 \fBcygpath\fP and \fBcygstart\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6239'\fI\%#6239\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6239\fP>\X'tty: link') .IP \(bu 2 \fBepkginfo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5829'\fI\%#5829\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5829\fP>\X'tty: link') .IP \(bu 2 \fBffmpeg\fP, \fBffplay\fP, and \fBffprobe\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5922'\fI\%#5922\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5922\fP>\X'tty: link') .IP \(bu 2 \fBfsharpc\fP and \fBfsharpi\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6016'\fI\%#6016\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6016\fP>\X'tty: link') .IP \(bu 2 \fBfzf\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6178'\fI\%#6178\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6178\fP>\X'tty: link') .IP \(bu 2 \fBg++\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6217'\fI\%#6217\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6217\fP>\X'tty: link') .IP \(bu 2 \fBgpg1\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6139'\fI\%#6139\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6139\fP>\X'tty: link') .IP \(bu 2 \fBgpg2\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6062'\fI\%#6062\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6062\fP>\X'tty: link') .IP \(bu 2 \fBgrub\-mkrescue\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6182'\fI\%#6182\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6182\fP>\X'tty: link') .IP \(bu 2 \fBhledger\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6043'\fI\%#6043\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6043\fP>\X'tty: link') .IP \(bu 2 \fBhwinfo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6496'\fI\%#6496\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6496\fP>\X'tty: link') .IP \(bu 2 \fBirb\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6260'\fI\%#6260\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6260\fP>\X'tty: link') .IP \(bu 2 \fBiw\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6232'\fI\%#6232\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6232\fP>\X'tty: link') .IP \(bu 2 \fBkak\fP .IP \(bu 2 \fBkeepassxc\-cli\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6505'\fI\%#6505\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6505\fP>\X'tty: link') .IP \(bu 2 \fBkeybase\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6410'\fI\%#6410\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6410\fP>\X'tty: link') .IP \(bu 2 \fBloginctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6501'\fI\%#6501\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6501\fP>\X'tty: link') .IP \(bu 2 \fBlz4\fP, \fBlz4c\fP and \fBlz4cat\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6364'\fI\%#6364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6364\fP>\X'tty: link') .IP \(bu 2 \fBmariner\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5718'\fI\%#5718\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5718\fP>\X'tty: link') .IP \(bu 2 \fBnethack\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6240'\fI\%#6240\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6240\fP>\X'tty: link') .IP \(bu 2 \fBpatool\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6083'\fI\%#6083\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6083\fP>\X'tty: link') .IP \(bu 2 \fBphpunit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6197'\fI\%#6197\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6197\fP>\X'tty: link') .IP \(bu 2 \fBplutil\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6301'\fI\%#6301\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6301\fP>\X'tty: link') .IP \(bu 2 \fBpzstd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6364'\fI\%#6364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6364\fP>\X'tty: link') .IP \(bu 2 \fBqubes\-gpg\-client\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6067'\fI\%#6067\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6067\fP>\X'tty: link') .IP \(bu 2 \fBresolvectl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6501'\fI\%#6501\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6501\fP>\X'tty: link') .IP \(bu 2 \fBrg\fP .IP \(bu 2 \fBrustup\fP .IP \(bu 2 \fBsfdx\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6149'\fI\%#6149\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6149\fP>\X'tty: link') .IP \(bu 2 \fBspeedtest\fP and \fBspeedtest\-cli\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5840'\fI\%#5840\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5840\fP>\X'tty: link') .IP \(bu 2 \fBsrc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6026'\fI\%#6026\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6026\fP>\X'tty: link') .IP \(bu 2 \fBtokei\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6085'\fI\%#6085\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6085\fP>\X'tty: link') .IP \(bu 2 \fBtsc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6016'\fI\%#6016\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6016\fP>\X'tty: link') .IP \(bu 2 \fBunlz4\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6364'\fI\%#6364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6364\fP>\X'tty: link') .IP \(bu 2 \fBunzstd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6364'\fI\%#6364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6364\fP>\X'tty: link') .IP \(bu 2 \fBvbc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6016'\fI\%#6016\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6016\fP>\X'tty: link') .IP \(bu 2 \fBzpaq\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6245'\fI\%#6245\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6245\fP>\X'tty: link') .IP \(bu 2 \fBzstd\fP, \fBzstdcat\fP, \fBzstdgrep\fP, \fBzstdless\fP and \fBzstdmt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6364'\fI\%#6364\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6364\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5634'\fI\%#5634\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5634\fP>\X'tty: link'). .IP \(bu 2 Tab completion will no longer add trailing spaces if they already exist (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6107'\fI\%#6107\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6107\fP>\X'tty: link'). .IP \(bu 2 Completion of subcommands to builtins like \fBand\fP or \fBnot\fP now works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6249'\fI\%#6249\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6249\fP>\X'tty: link'). .IP \(bu 2 Completion of arguments to short options works correctly when multiple short options are used together (\X'tty: link https://github.com/fish-shell/fish-shell/issues/332'\fI\%#332\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/332\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4124'\fI\%#4124\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4124\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5586'\fI\%#5586\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5586\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5556'\fI\%#5556\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5556\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/6372'\fI\%#6372\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6372\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5777'\fI\%#5777\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5777\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5489'\fI\%#5489\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5489\fP>\X'tty: link'). .IP \(bu 2 Some bugs preventing building on Solaris\-derived systems such as Illumos were fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5458'\fI\%#5458\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5458\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5461'\fI\%#5461\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5461\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5611'\fI\%#5611\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5611\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5029'\fI\%#5029\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5029\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5647'\fI\%#5647\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5647\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5449'\fI\%#5449\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5449\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4982'\fI\%#4982\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4982\fP>\X'tty: link'). .IP \(bu 2 \fBread \-\-silent\fP no longer echoes to the tty when run from a non\-interactive script (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5519'\fI\%#5519\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5519\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5481'\fI\%#5481\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5481\fP>\X'tty: link'). .IP \(bu 2 fish starts correctly under Cygwin/MSYS2 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5426'\fI\%#5426\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5426\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5588'\fI\%#5588\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5588\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5578'\fI\%#5578\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5578\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5574'\fI\%#5574\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5574\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5476'\fI\%#5476\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5476\fP>\X'tty: link'), and ignoring shell aliases, so enterprising users can set up the wrapping command (via \fBset \-g __fish_git_alias_$command $whatitwraps\fP) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5412'\fI\%#5412\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5412\fP>\X'tty: link'). .IP \(bu 2 Significant performance improvements to core shell functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5447'\fI\%#5447\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5447\fP>\X'tty: link') and to the \fBkill\fP completions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5541'\fI\%#5541\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5541\fP>\X'tty: link'). .IP \(bu 2 Starting in symbolically\-linked working directories works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5525'\fI\%#5525\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5525\fP>\X'tty: link'). .IP \(bu 2 The default \fBfish_title\fP function no longer contains extra spaces (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5517'\fI\%#5517\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5517\fP>\X'tty: link'). .IP \(bu 2 The \fBnim\fP prompt now works correctly when chosen in the Web\-based configuration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5490'\fI\%#5490\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5490\fP>\X'tty: link'). .IP \(bu 2 \fBstring\fP now prints help to stdout, like other builtins (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5495'\fI\%#5495\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5495\fP>\X'tty: link'). .IP \(bu 2 Killing the terminal while fish is in vi normal mode will no longer send it spinning and eating CPU. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5528'\fI\%#5528\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5528\fP>\X'tty: link') .IP \(bu 2 A number of crashes have been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5550'\fI\%#5550\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5550\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5548'\fI\%#5548\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5548\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5479'\fI\%#5479\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5479\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5453'\fI\%#5453\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5453\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5619'\fI\%#5619\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5619\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5407'\fI\%#5407\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5407\fP>\X'tty: link') .IP \(bu 2 handles huge numeric arguments to \fBtest\fP correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5414'\fI\%#5414\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5414\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5423'\fI\%#5423\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5423\fP>\X'tty: link'), but does not run correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5426'\fI\%#5426\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5426\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4230'\fI\%#4230\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4230\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1202'\fI\%#1202\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1202\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4236'\fI\%#4236\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4236\fP>\X'tty: link'). .IP \(bu 2 A literal \fB{}\fP now expands to itself, rather than nothing. This makes working with \fBfind \-exec\fP easier (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1109'\fI\%#1109\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1109\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4632'\fI\%#4632\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4632\fP>\X'tty: link'). .IP \(bu 2 Literally accessing a zero\-index is now illegal syntax and is caught by the parser (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4862'\fI\%#4862\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4862\fP>\X'tty: link'). (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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3002'\fI\%#3002\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3002\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4632'\fI\%#4632\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4632\fP>\X'tty: link'). .IP \(bu 2 \fBfor\fP loop control variables are no longer local to the \fBfor\fP block (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1935'\fI\%#1935\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1935\fP>\X'tty: link'). .IP \(bu 2 Variables set in \fBif\fP and \fBwhile\fP conditions are available outside the block (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4820'\fI\%#4820\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4820\fP>\X'tty: link'). .IP \(bu 2 Local exported (\fBset \-lx\fP) vars are now visible to functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1091'\fI\%#1091\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1091\fP>\X'tty: link'). .IP \(bu 2 The new \fBmath\fP builtin (see below) does not support logical expressions; \fBtest\fP should be used instead (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4777'\fI\%#4777\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4777\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4490'\fI\%#4490\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4490\fP>\X'tty: link'). .IP \(bu 2 \fBcd\fP no longer resolves symlinks. fish now maintains a virtual path, matching other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3350'\fI\%#3350\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3350\fP>\X'tty: link'). .IP \(bu 2 \fBsource\fP now requires an explicit \fB\-\fP as the filename to read from the terminal (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2633'\fI\%#2633\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2633\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3000'\fI\%#3000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3000\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4414'\fI\%#4414\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4414\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/436'\fI\%#436\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/436\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4403'\fI\%#4403\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4403\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4940'\fI\%#4940\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4940\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4156'\fI\%#4156\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4156\fP>\X'tty: link'). Use the \fBread \-\-delimiter\fP option instead. .IP \(bu 2 The \fBfunction \-\-on\-process\-exit\fP switch will be removed in future (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4700'\fI\%#4700\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4700\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/813'\fI\%#813\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/813\fP>\X'tty: link'). 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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4394'\fI\%#4394\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4394\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4520'\fI\%#4520\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4520\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4620'\fI\%#4620\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4620\fP>\X'tty: link'). .IP \(bu 2 Variables may be used as commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/154'\fI\%#154\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/154\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4498'\fI\%#4498\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4498\fP>\X'tty: link'). .IP \(bu 2 \fBmath\fP is now a builtin rather than a wrapper around \fBbc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3157'\fI\%#3157\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3157\fP>\X'tty: link'). Floating point computations is now used by default, and can be controlled with the new \fB\-\-scale\fP option (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4478'\fI\%#4478\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4478\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2969'\fI\%#2969\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2969\fP>\X'tty: link'). .IP \(bu 2 \fBwhile\fP sets \fB$status\fP to a non\-zero value if the loop is not executed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4982'\fI\%#4982\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4982\fP>\X'tty: link'). .IP \(bu 2 Command substitution output is now limited to 10 MB by default, controlled by the \fBfish_read_limit\fP variable (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3822'\fI\%#3822\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3822\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4422'\fI\%#4422\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4422\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5191'\fI\%#5191\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5191\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4878'\fI\%#4878\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4878\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4188'\fI\%#4188\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4188\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4431'\fI\%#4431\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4431\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/361'\fI\%#361\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/361\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4668'\fI\%#4668\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4668\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions\fP has a new \fB\-\-handlers\fP option to show functions registered as event handlers (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4694'\fI\%#4694\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4694\fP>\X'tty: link'). .IP \(bu 2 \fBhistory search\fP supports globs for wildcard searching (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3136'\fI\%#3136\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3136\fP>\X'tty: link') and has a new \fB\-\-reverse\fP option to show entries from oldest to newest (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4375'\fI\%#4375\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4375\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4256'\fI\%#4256\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4256\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP writes directly to stdout if called without arguments (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4407'\fI\%#4407\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4407\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1326'\fI\%#1326\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1326\fP>\X'tty: link'). .IP \(bu 2 \fBstring match\fP with an empty pattern and \fB\-\-entire\fP in glob mode now matches everything instead of nothing (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4971'\fI\%#4971\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4971\fP>\X'tty: link'). .IP \(bu 2 \fBstring split\fP supports a new \fB\-\-no\-empty\fP option to exclude empty strings from the result (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4779'\fI\%#4779\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4779\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4605'\fI\%#4605\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4605\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1285'\fI\%#1285\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1285\fP>\X'tty: link'). .IP \(bu 2 Italics and dim support out of the box on macOS for Terminal.app and iTerm (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4436'\fI\%#4436\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4436\fP>\X'tty: link'). .IP \(bu 2 \fBcd\fP tab completions no longer descend into the deepest unambiguous path (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4649'\fI\%#4649\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4649\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4680'\fI\%#4680\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4680\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2249'\fI\%#2249\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2249\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5213'\fI\%#5213\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5213\fP>\X'tty: link'). .IP \(bu 2 The pager will now show the full command instead of just its last line if the number of completions is large (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4702'\fI\%#4702\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4702\fP>\X'tty: link'). .IP \(bu 2 Abbreviations can be tab\-completed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3233'\fI\%#3233\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3233\fP>\X'tty: link'). .IP \(bu 2 Tildes in file names are now properly escaped in completions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2274'\fI\%#2274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2274\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1976'\fI\%#1976\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1976\fP>\X'tty: link'). The \fBalias\fP function has been updated to respect this behavior. .IP \(bu 2 Path completions now support expansions, meaning expressions like \fBpython ~/\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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4962'\fI\%#4962\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4962\fP>\X'tty: link'). .IP \(bu 2 The screen is no longer reset after a BEL, fixing graphical glitches (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3693'\fI\%#3693\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3693\fP>\X'tty: link'). .IP \(bu 2 vi\-mode now supports ‘;’ and ‘,’ motions. This introduces new {forward,backward}\-jump\-till and repeat\-jump{,\-reverse} bind functions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5140'\fI\%#5140\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5140\fP>\X'tty: link'). .IP \(bu 2 The \fB*y\fP vi\-mode binding now works (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5100'\fI\%#5100\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5100\fP>\X'tty: link'). .IP \(bu 2 True color is now enabled in neovim by default (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2792'\fI\%#2792\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2792\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/904'\fI\%#904\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/904\fP>\X'tty: link'). .IP \(bu 2 Multi\-line prompts no longer repeat when the terminal is resized (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2320'\fI\%#2320\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2320\fP>\X'tty: link'). .IP \(bu 2 \fBxclip\fP support has been added to the clipboard integration (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5020'\fI\%#5020\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5020\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5011'\fI\%#5011\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5011\fP>\X'tty: link'). .IP \(bu 2 Deleting a one\-character word no longer erases the next word as well (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4747'\fI\%#4747\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4747\fP>\X'tty: link'). .IP \(bu 2 Token history search (Alt\-Up) omits duplicate entries (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4795'\fI\%#4795\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4795\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5206'\fI\%#5206\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5206\fP>\X'tty: link'). .IP \(bu 2 \fBcommandline\fP can now be used to set the commandline for the next command, restoring a behavior in 3.4.1 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/8807'\fI\%#8807\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/8807\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4697'\fI\%#4697\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4697\fP>\X'tty: link') .IP \(bu 2 \fBbb\-power\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4800'\fI\%#4800\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4800\fP>\X'tty: link') .IP \(bu 2 \fBbd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4472'\fI\%#4472\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4472\fP>\X'tty: link') .IP \(bu 2 \fBbower\fP .IP \(bu 2 \fBclang\fP and \fBclang++\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4174'\fI\%#4174\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4174\fP>\X'tty: link') .IP \(bu 2 \fBconda\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4837'\fI\%#4837\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4837\fP>\X'tty: link') .IP \(bu 2 \fBconfigure\fP (for autoconf\-generated files only) .IP \(bu 2 \fBcurl\fP .IP \(bu 2 \fBdoas\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5196'\fI\%#5196\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5196\fP>\X'tty: link') .IP \(bu 2 \fBebuild\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4911'\fI\%#4911\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4911\fP>\X'tty: link') .IP \(bu 2 \fBemaint\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4758'\fI\%#4758\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4758\fP>\X'tty: link') .IP \(bu 2 \fBeopkg\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4600'\fI\%#4600\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4600\fP>\X'tty: link') .IP \(bu 2 \fBexercism\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4495'\fI\%#4495\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4495\fP>\X'tty: link') .IP \(bu 2 \fBhjson\fP .IP \(bu 2 \fBhugo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4529'\fI\%#4529\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4529\fP>\X'tty: link') .IP \(bu 2 \fBj\fP (from autojump \X'tty: link https://github.com/fish-shell/fish-shell/issues/4344'\fI\%#4344\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4344\fP>\X'tty: link') .IP \(bu 2 \fBjbake\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4814'\fI\%#4814\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4814\fP>\X'tty: link') .IP \(bu 2 \fBjhipster\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4472'\fI\%#4472\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4472\fP>\X'tty: link') .IP \(bu 2 \fBkitty\fP .IP \(bu 2 \fBkldload\fP .IP \(bu 2 \fBkldunload\fP .IP \(bu 2 \fBmakensis\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5242'\fI\%#5242\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5242\fP>\X'tty: link') .IP \(bu 2 \fBmeson\fP .IP \(bu 2 \fBmkdocs\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4906'\fI\%#4906\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4906\fP>\X'tty: link') .IP \(bu 2 \fBngrok\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4642'\fI\%#4642\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4642\fP>\X'tty: link') .IP \(bu 2 OpenBSD’s \fBpkg_add\fP, \fBpkg_delete\fP, \fBpkg_info\fP, \fBpfctl\fP, \fBrcctl\fP, \fBsignify\fP, and \fBvmctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4584'\fI\%#4584\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4584\fP>\X'tty: link') .IP \(bu 2 \fBopenocd\fP .IP \(bu 2 \fBoptipng\fP .IP \(bu 2 \fBopkg\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5168'\fI\%#5168\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5168\fP>\X'tty: link') .IP \(bu 2 \fBpandoc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2937'\fI\%#2937\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2937\fP>\X'tty: link') .IP \(bu 2 \fBport\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4737'\fI\%#4737\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4737\fP>\X'tty: link') .IP \(bu 2 \fBpowerpill\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4800'\fI\%#4800\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4800\fP>\X'tty: link') .IP \(bu 2 \fBpstack\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5135'\fI\%#5135\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5135\fP>\X'tty: link') .IP \(bu 2 \fBserve\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5026'\fI\%#5026\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5026\fP>\X'tty: link') .IP \(bu 2 \fBttx\fP .IP \(bu 2 \fBunzip\fP .IP \(bu 2 \fBvirsh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5113'\fI\%#5113\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5113\fP>\X'tty: link') .IP \(bu 2 \fBxclip\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5126'\fI\%#5126\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5126\fP>\X'tty: link') .IP \(bu 2 \fBxsv\fP .IP \(bu 2 \fBzfs\fP and \fBzpool\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4608'\fI\%#4608\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4608\fP>\X'tty: link') .UNINDENT .IP \(bu 2 Lots of improvements to completions (especially \fBdarcs\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5112'\fI\%#5112\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5112\fP>\X'tty: link'), \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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4048'\fI\%#4048\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4048\fP>\X'tty: link'), setting variables (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4200'\fI\%#4200\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4200\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4341'\fI\%#4341\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4341\fP>\X'tty: link'), executing functions, globs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4579'\fI\%#4579\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4579\fP>\X'tty: link'), \fBstring\fP reading from standard input (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4610'\fI\%#4610\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4610\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5149'\fI\%#5149\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5149\fP>\X'tty: link') and \fBfish_emoji_width\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2652'\fI\%#2652\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2652\fP>\X'tty: link') variables. Alternatively, a new build\-time option INTERNAL_WCWIDTH can be used to use the system’s wcwidth instead (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4816'\fI\%#4816\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4816\fP>\X'tty: link'). .IP \(bu 2 \fBfunctions\fP correctly supports \fB\-d\fP as the short form of \fB\-\-description\fP\&. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5105'\fI\%#5105\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5105\fP>\X'tty: link') .IP \(bu 2 \fB/etc/paths\fP is now parsed like macOS’ bash \fBpath_helper\fP, fixing $PATH order (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4336'\fI\%#4336\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4336\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4852'\fI\%#4852\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4852\fP>\X'tty: link') on macOS. .IP \(bu 2 Using a read\-only variable in a \fBfor\fP loop produces an error, rather than silently producing incorrect results (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4342'\fI\%#4342\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4342\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1912'\fI\%#1912\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1912\fP>\X'tty: link'). .IP \(bu 2 Exported variables in the global or universal scope no longer have their exported status affected by local variables (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2611'\fI\%#2611\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2611\fP>\X'tty: link'). .IP \(bu 2 Major rework of terminal and job handling to eliminate bugs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3805'\fI\%#3805\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3805\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3952'\fI\%#3952\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3952\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4178'\fI\%#4178\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4178\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4235'\fI\%#4235\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4235\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4238'\fI\%#4238\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4238\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4540'\fI\%#4540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4540\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4929'\fI\%#4929\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4929\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/5210'\fI\%#5210\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5210\fP>\X'tty: link'). .IP \(bu 2 Improvements to the manual page completion generator (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2937'\fI\%#2937\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2937\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4313'\fI\%#4313\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4313\fP>\X'tty: link'). .IP \(bu 2 \fBsuspend \-\-force\fP now works correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4672'\fI\%#4672\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4672\fP>\X'tty: link'). .IP \(bu 2 Pressing Ctrl\-C while running a script now reliably terminates fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/5253'\fI\%#5253\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/5253\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4521'\fI\%#4521\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4521\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2847'\fI\%#2847\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2847\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4190'\fI\%#4190\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4190\fP>\X'tty: link'). .IP \(bu 2 Invalid array indexes are now silently ignored (\X'tty: link https://github.com/fish-shell/fish-shell/issues/826'\fI\%#826\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/826\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4127'\fI\%#4127\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4127\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1310'\fI\%#1310\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1310\fP>\X'tty: link'). .IP \(bu 2 \fBstring\fP supports new \fBlower\fP and \fBupper\fP subcommands, for altering the case of strings (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4080'\fI\%#4080\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4080\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4150'\fI\%#4150\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4150\fP>\X'tty: link'), and can be reversed with \fBstring unescape\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3543'\fI\%#3543\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3543\fP>\X'tty: link'). .IP \(bu 2 History can now be split into sessions with the \fBfish_history\fP variable, or not saved to disk at all (\X'tty: link https://github.com/fish-shell/fish-shell/issues/102'\fI\%#102\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/102\fP>\X'tty: link'). .IP \(bu 2 Read history is now controlled by the \fBfish_history\fP variable rather than the \fB\-\-mode\-name\fP flag (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1504'\fI\%#1504\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1504\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2778'\fI\%#2778\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2778\fP>\X'tty: link'). .IP \(bu 2 fish can run commands before starting an interactive session using the new \fB\-\-init\-command\fP/\fB\-C\fP options (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4164'\fI\%#4164\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4164\fP>\X'tty: link'). .IP \(bu 2 \fBset\fP has a new \fB\-\-show\fP option to show lots of information about variables (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4265'\fI\%#4265\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4265\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4141'\fI\%#4141\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4141\fP>\X'tty: link'). .IP \(bu 2 \fBcomplete\fP’s \fB\-\-no\-files\fP option works as intended (\X'tty: link https://github.com/fish-shell/fish-shell/issues/112'\fI\%#112\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/112\fP>\X'tty: link'). .IP \(bu 2 \fBecho \-h\fP now correctly echoes \fB\-h\fP in line with other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4120'\fI\%#4120\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4120\fP>\X'tty: link'). .IP \(bu 2 The \fBexport\fP compatibility function now returns zero on success, rather than always returning 1 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4435'\fI\%#4435\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4435\fP>\X'tty: link'). .IP \(bu 2 Stop converting empty elements in MANPATH to “.” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4158'\fI\%#4158\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4158\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4189'\fI\%#4189\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4189\fP>\X'tty: link'). .IP \(bu 2 An attempt to \fBread\fP which stops because too much data is available still defines the variables given as parameters (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4180'\fI\%#4180\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4180\fP>\X'tty: link'). .IP \(bu 2 A regression in fish 2.4.0 which prevented \fBpushd +1\fP from working has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4091'\fI\%#4091\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4091\fP>\X'tty: link'). .IP \(bu 2 A regression in fish 2.6.0 where multiple \fBread\fP commands in non\-interactive scripts were broken has been fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4206'\fI\%#4206\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4206\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4196'\fI\%#4196\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4196\fP>\X'tty: link'). .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBas\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4130'\fI\%#4130\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4130\fP>\X'tty: link') .IP \(bu 2 \fBcdh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2847'\fI\%#2847\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2847\fP>\X'tty: link') .IP \(bu 2 \fBdhcpd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4115'\fI\%#4115\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4115\fP>\X'tty: link') .IP \(bu 2 \fBezjail\-admin\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4324'\fI\%#4324\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4324\fP>\X'tty: link') .IP \(bu 2 Fabric’s \fBfab\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4153'\fI\%#4153\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4153\fP>\X'tty: link') .IP \(bu 2 \fBgrub\-file\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4119'\fI\%#4119\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4119\fP>\X'tty: link') .IP \(bu 2 \fBgrub\-install\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4119'\fI\%#4119\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4119\fP>\X'tty: link') .IP \(bu 2 \fBjest\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4142'\fI\%#4142\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4142\fP>\X'tty: link') .IP \(bu 2 \fBkdeconnect\-cli\fP .IP \(bu 2 \fBmagneto\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4043'\fI\%#4043\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4043\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4108'\fI\%#4108\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4108\fP>\X'tty: link') .IP \(bu 2 \fBmdadm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4198'\fI\%#4198\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4198\fP>\X'tty: link') .IP \(bu 2 \fBpasswd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4209'\fI\%#4209\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4209\fP>\X'tty: link') .IP \(bu 2 \fBpip\fP and \fBpipenv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4448'\fI\%#4448\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4448\fP>\X'tty: link') .IP \(bu 2 \fBs3cmd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4332'\fI\%#4332\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4332\fP>\X'tty: link') .IP \(bu 2 \fBsbt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4347'\fI\%#4347\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4347\fP>\X'tty: link') .IP \(bu 2 \fBsnap\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4215'\fI\%#4215\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4215\fP>\X'tty: link') .IP \(bu 2 Sublime Text 3’s \fBsubl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4277'\fI\%#4277\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4277\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4061'\fI\%#4061\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4061\fP>\X'tty: link') .IP \(bu 2 \fBcomposer\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4295'\fI\%#4295\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4295\fP>\X'tty: link') .IP \(bu 2 \fBeopkg\fP .IP \(bu 2 \fBflatpak\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4456'\fI\%#4456\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4456\fP>\X'tty: link') .IP \(bu 2 \fBgit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4117'\fI\%#4117\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4117\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4147'\fI\%#4147\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4147\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4329'\fI\%#4329\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4329\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/4368'\fI\%#4368\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4368\fP>\X'tty: link') .IP \(bu 2 \fBgphoto2\fP .IP \(bu 2 \fBkillall\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4052'\fI\%#4052\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4052\fP>\X'tty: link') .IP \(bu 2 \fBln\fP .IP \(bu 2 \fBnpm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4241'\fI\%#4241\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4241\fP>\X'tty: link') .IP \(bu 2 \fBssh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4377'\fI\%#4377\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4377\fP>\X'tty: link') .IP \(bu 2 \fBtail\fP .IP \(bu 2 \fBxdg\-mime\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4333'\fI\%#4333\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4333\fP>\X'tty: link') .IP \(bu 2 \fBzypper\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4325'\fI\%#4325\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4325\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4043'\fI\%#4043\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4043\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2810'\fI\%#2810\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2810\fP>\X'tty: link'). .IP \(bu 2 Command substitutions now have access to the terminal, like in other shells. This allows tools like \fBfzf\fP to work properly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1362'\fI\%#1362\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1362\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3922'\fI\%#3922\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3922\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3772'\fI\%#3772\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3772\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/3788'\fI\%#3788\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3788\fP>\X'tty: link') and improved German (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3834'\fI\%#3834\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3834\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2007'\fI\%#2007\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2007\fP>\X'tty: link'). .IP \(bu 2 Performance improvements in prompts and functions that set lots of colours (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3793'\fI\%#3793\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3793\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3295'\fI\%#3295\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3295\fP>\X'tty: link'), and a \fB\-\-details \-\-verbose\fP option which includes the function description (\X'tty: link https://github.com/fish-shell/fish-shell/issues/597'\fI\%#597\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/597\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/838'\fI\%#838\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/838\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/802'\fI\%#802\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/802\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4103'\fI\%#4103\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4103\fP>\X'tty: link'). .IP \(bu 2 \fBbind\fP supports a new \fB\-\-list\-modes\fP option (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3872'\fI\%#3872\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3872\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3909'\fI\%#3909\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3909\fP>\X'tty: link'). .IP \(bu 2 \fBfunced\fP warns if the function being edited has not been modified (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3961'\fI\%#3961\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3961\fP>\X'tty: link'). .IP \(bu 2 \fBprintf\fP correctly outputs “long long” integers (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3352'\fI\%#3352\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3352\fP>\X'tty: link'). .IP \(bu 2 \fBstatus\fP supports a new \fBcurrent\-function\fP subcommand to print the current function name (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1743'\fI\%#1743\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1743\fP>\X'tty: link'). .IP \(bu 2 \fBstring\fP supports a new \fBrepeat\fP subcommand (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3864'\fI\%#3864\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3864\fP>\X'tty: link'). \fBstring match\fP supports a new \fB\-\-entire\fP option to emit the entire line matched by a pattern (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3957'\fI\%#3957\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3957\fP>\X'tty: link'). \fBstring replace\fP supports a new \fB\-\-filter\fP option to only emit lines which underwent a replacement (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3348'\fI\%#3348\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3348\fP>\X'tty: link'). .IP \(bu 2 \fBtest\fP supports the \fB\-k\fP option to test for sticky bits (\X'tty: link https://github.com/fish-shell/fish-shell/issues/733'\fI\%#733\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/733\fP>\X'tty: link'). .IP \(bu 2 \fBumask\fP understands symbolic modes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/738'\fI\%#738\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/738\fP>\X'tty: link'). .IP \(bu 2 Empty components in the \fBCDPATH\fP, \fBMANPATH\fP and \fBPATH\fP variables are now converted to “.” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2106'\fI\%#2106\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2106\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3914'\fI\%#3914\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3914\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2855'\fI\%#2855\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2855\fP>\X'tty: link'). .IP \(bu 2 Some systems’ \fBsu\fP implementations do not set the \fBUSER\fP environment variable; it is now reset for root users (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3916'\fI\%#3916\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3916\fP>\X'tty: link'). .IP \(bu 2 Under terminals which support it, bracketed paste is enabled, escaping problematic characters for security and convience (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3871'\fI\%#3871\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3871\fP>\X'tty: link'). Inside single quotes (\fB\(aq\fP), single quotes and backslashes in pasted text are escaped (\X'tty: link https://github.com/fish-shell/fish-shell/issues/967'\fI\%#967\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/967\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1926'\fI\%#1926\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1926\fP>\X'tty: link'). This behaviour matches other shells mre closely. .IP \(bu 2 All functions requiring Python work with whichever version of Python is installed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3970'\fI\%#3970\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3970\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3963'\fI\%#3963\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3963\fP>\X'tty: link'). .IP \(bu 2 Added completions for: .IP \(bu 2 \fBcaddy\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4008'\fI\%#4008\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4008\fP>\X'tty: link') .IP \(bu 2 \fBcastnow\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3744'\fI\%#3744\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3744\fP>\X'tty: link') .IP \(bu 2 \fBclimate\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3760'\fI\%#3760\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3760\fP>\X'tty: link') .IP \(bu 2 \fBflatpak\fP .IP \(bu 2 \fBgradle\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3859'\fI\%#3859\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3859\fP>\X'tty: link') .IP \(bu 2 \fBgsettings\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4001'\fI\%#4001\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4001\fP>\X'tty: link') .IP \(bu 2 \fBhelm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3829'\fI\%#3829\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3829\fP>\X'tty: link') .IP \(bu 2 \fBi3\-msg\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3787'\fI\%#3787\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3787\fP>\X'tty: link') .IP \(bu 2 \fBipset\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3924'\fI\%#3924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3924\fP>\X'tty: link') .IP \(bu 2 \fBjq\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3804'\fI\%#3804\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3804\fP>\X'tty: link') .IP \(bu 2 \fBlight\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3752'\fI\%#3752\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3752\fP>\X'tty: link') .IP \(bu 2 \fBminikube\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3778'\fI\%#3778\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3778\fP>\X'tty: link') .IP \(bu 2 \fBmocha\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3828'\fI\%#3828\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3828\fP>\X'tty: link') .IP \(bu 2 \fBmkdosfs\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/4017'\fI\%#4017\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/4017\fP>\X'tty: link') .IP \(bu 2 \fBpv\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3773'\fI\%#3773\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3773\fP>\X'tty: link') .IP \(bu 2 \fBsetsid\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3791'\fI\%#3791\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3791\fP>\X'tty: link') .IP \(bu 2 \fBterraform\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3960'\fI\%#3960\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3960\fP>\X'tty: link') .IP \(bu 2 \fBusermod\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3775'\fI\%#3775\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3775\fP>\X'tty: link') .IP \(bu 2 \fBxinput\fP .IP \(bu 2 \fByarn\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3816'\fI\%#3816\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3816\fP>\X'tty: link') .IP \(bu 2 Improved completions for \fBadb\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3853'\fI\%#3853\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3853\fP>\X'tty: link'), \fBapt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3771'\fI\%#3771\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3771\fP>\X'tty: link'), \fBbzr\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3769'\fI\%#3769\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3769\fP>\X'tty: link'), \fBdconf\fP, \fBgit\fP (including \X'tty: link https://github.com/fish-shell/fish-shell/issues/3743'\fI\%#3743\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3743\fP>\X'tty: link'), \fBgrep\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3789'\fI\%#3789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3789\fP>\X'tty: link'), \fBgo\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3789'\fI\%#3789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3789\fP>\X'tty: link'), \fBhelp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3789'\fI\%#3789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3789\fP>\X'tty: link'), \fBhg\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3975'\fI\%#3975\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3975\fP>\X'tty: link'), \fBhtop\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3789'\fI\%#3789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3789\fP>\X'tty: link'), \fBkillall\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3996'\fI\%#3996\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3996\fP>\X'tty: link'), \fBlua\fP, \fBman\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3762'\fI\%#3762\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3762\fP>\X'tty: link'), \fBmount\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3764'\fI\%#3764\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3764\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/3841'\fI\%#3841\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3841\fP>\X'tty: link'), \fBobnam\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3924'\fI\%#3924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3924\fP>\X'tty: link'), \fBperl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3856'\fI\%#3856\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3856\fP>\X'tty: link'), \fBportmaster\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3950'\fI\%#3950\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3950\fP>\X'tty: link'), \fBpython\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3840'\fI\%#3840\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3840\fP>\X'tty: link'), \fBssh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3781'\fI\%#3781\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3781\fP>\X'tty: link'), \fBscp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3781'\fI\%#3781\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3781\fP>\X'tty: link'), \fBsystemctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3757'\fI\%#3757\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3757\fP>\X'tty: link') and \fBudisks\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3764'\fI\%#3764\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3764\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3731'\fI\%#3731\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3731\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3497'\fI\%#3497\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3497\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3619'\fI\%#3619\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3619\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3556'\fI\%#3556\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3556\fP>\X'tty: link'). .IP \(bu 2 \fBfunction\fP now returns an error when called with invalid options, rather than defining the function anyway (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3574'\fI\%#3574\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3574\fP>\X'tty: link'). 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 compatiblity with Android (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3585'\fI\%#3585\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3585\fP>\X'tty: link'), MSYS/mingw (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2360'\fI\%#2360\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2360\fP>\X'tty: link'), and Solaris (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3456'\fI\%#3456\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3456\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3340'\fI\%#3340\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3340\fP>\X'tty: link'). .IP \(bu 2 Like other shells, the \fBtest\fP builting now returns an error for numeric operations on invalid integers (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3346'\fI\%#3346\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3346\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3581'\fI\%#3581\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3581\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3526'\fI\%#3526\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3526\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3684'\fI\%#3684\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3684\fP>\X'tty: link'). .IP \(bu 2 List indexes are handled better, and a bit more liberally in some cases (\fBecho $PATH[1 .. 3]\fP is now valid) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3579'\fI\%#3579\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3579\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3641'\fI\%#3641\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3641\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3557'\fI\%#3557\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3557\fP>\X'tty: link'). .IP \(bu 2 \fBcommand\fP accepts \fB\-q\fP/\fB\-\-quiet\fP in combination with \fB\-\-search\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3591'\fI\%#3591\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3591\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3610'\fI\%#3610\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3610\fP>\X'tty: link'). .IP \(bu 2 The command synopses printed by \fB\-\-help\fP options work better with copying and pasting (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2673'\fI\%#2673\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2673\fP>\X'tty: link'). .IP \(bu 2 \fBhelp\fP launches the browser specified by the \fB$fish_help_browser variable\fP if it is set (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3131'\fI\%#3131\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3131\fP>\X'tty: link'). .IP \(bu 2 History merging could lose items under certain circumstances and is now fixed (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3496'\fI\%#3496\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3496\fP>\X'tty: link'). .IP \(bu 2 The \fB$status\fP variable is now set to 123 when a syntactically invalid command is entered (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3616'\fI\%#3616\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3616\fP>\X'tty: link'). .IP \(bu 2 Exiting fish now signals all background processes to terminate, not just stopped jobs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3497'\fI\%#3497\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3497\fP>\X'tty: link'). .IP \(bu 2 A new \fBprompt_hostname\fP function which prints a hostname suitable for use in prompts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3482'\fI\%#3482\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3482\fP>\X'tty: link'). .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3678'\fI\%#3678\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3678\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1215'\fI\%#1215\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1215\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3627'\fI\%#3627\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3627\fP>\X'tty: link'). .IP \(bu 2 \fBset_color\fP now supports italics (\fB\-\-italics\fP), dim (\fB\-\-dim\fP) and reverse (\fB\-\-reverse\fP) modes (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3650'\fI\%#3650\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3650\fP>\X'tty: link'). .IP \(bu 2 Filesystems with very slow locking (eg incorrectly\-configured NFS) will no longer slow fish down (\X'tty: link https://github.com/fish-shell/fish-shell/issues/685'\fI\%#685\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/685\fP>\X'tty: link'). .IP \(bu 2 Improved completions for \fBapt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3695'\fI\%#3695\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3695\fP>\X'tty: link'), \fBfusermount\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3642'\fI\%#3642\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3642\fP>\X'tty: link'), \fBmake\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3628'\fI\%#3628\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3628\fP>\X'tty: link'), \fBnetctl\-auto\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link'), \fBnmcli\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3648'\fI\%#3648\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3648\fP>\X'tty: link'), \fBpygmentize\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link'), and \fBtar\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3719'\fI\%#3719\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3719\fP>\X'tty: link'). .IP \(bu 2 Added completions for: .IP \(bu 2 \fBVBoxHeadless\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBVBoxSDL\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBbase64\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBcaffeinate\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBdconf\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3638'\fI\%#3638\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3638\fP>\X'tty: link') .IP \(bu 2 \fBdig\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3495'\fI\%#3495\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3495\fP>\X'tty: link') .IP \(bu 2 \fBdpkg\-reconfigure\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3521'\fI\%#3521\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3521\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/3522'\fI\%#3522\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3522\fP>\X'tty: link') .IP \(bu 2 \fBfeh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBlaunchctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3682'\fI\%#3682\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3682\fP>\X'tty: link') .IP \(bu 2 \fBlxc\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3554'\fI\%#3554\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3554\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/3564'\fI\%#3564\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3564\fP>\X'tty: link'), .IP \(bu 2 \fBmddiagnose\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBmdfind\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBmdimport\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBmdls\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBmdutil\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBmkvextract\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3492'\fI\%#3492\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3492\fP>\X'tty: link') .IP \(bu 2 \fBnvram\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .IP \(bu 2 \fBobjdump\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBsysbench\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3491'\fI\%#3491\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3491\fP>\X'tty: link') .IP \(bu 2 \fBtmutil\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3524'\fI\%#3524\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3524\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3499'\fI\%#3499\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3499\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3478'\fI\%#3478\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3478\fP>\X'tty: link'). .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). (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3061'\fI\%#3061\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3061\fP>\X'tty: link') .IP \(bu 2 \fBhistory\fP uses subcommands (\fBhistory delete\fP) rather than options (\fBhistory \-\-delete\fP) for its actions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3367'\fI\%#3367\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3367\fP>\X'tty: link'). 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3175'\fI\%#3175\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3175\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3244'\fI\%#3244\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3244\fP>\X'tty: link'), 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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3236'\fI\%#3236\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3236\fP>\X'tty: link'). .IP \(bu 2 \fBhistory delete\fP now correctly handles multiline commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/31'\fI\%#31\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/31\fP>\X'tty: link'). .IP \(bu 2 Vi\-style bindings no longer include all of the default emacs\-style bindings; instead, they share some definitions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3068'\fI\%#3068\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3068\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/277'\fI\%#277\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/277\fP>\X'tty: link'). .IP \(bu 2 A number followed by a caret (e.g.\ \fB5^\fP) is no longer treated as a redirection (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1873'\fI\%#1873\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1873\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3400'\fI\%#3400\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3400\fP>\X'tty: link'). It is used only for systems without a \fBrealpath\fP or \fBgrealpath\fP utility (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3374'\fI\%#3374\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3374\fP>\X'tty: link'). .IP \(bu 2 Improved color handling on terminals/consoles with 8\-16 colors, particularly the use of bright named color (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3176'\fI\%#3176\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3176\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3260'\fI\%#3260\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3260\fP>\X'tty: link'). .IP \(bu 2 \fBfish_indent\fP can now read from files given as arguments, rather than just standard input (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3037'\fI\%#3037\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3037\fP>\X'tty: link'). .IP \(bu 2 Fuzzy tab completions behave in a less surprising manner (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3090'\fI\%#3090\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3090\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3211'\fI\%#3211\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3211\fP>\X'tty: link'). .IP \(bu 2 \fBjobs\fP should only print its header line once (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3127'\fI\%#3127\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3127\fP>\X'tty: link'). .IP \(bu 2 Wildcards in redirections are highlighted appropriately (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2789'\fI\%#2789\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2789\fP>\X'tty: link'). .IP \(bu 2 Suggestions will be offered more often, like after removing characters (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3069'\fI\%#3069\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3069\fP>\X'tty: link'). .IP \(bu 2 \fBhistory \-\-merge\fP now correctly interleaves items in chronological order (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2312'\fI\%#2312\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2312\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3191'\fI\%#3191\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3191\fP>\X'tty: link'). .IP \(bu 2 The display of bindings in the Web\-based configuration has been greatly improved (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3325'\fI\%#3325\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3325\fP>\X'tty: link'), as has the rendering of prompts (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2924'\fI\%#2924\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2924\fP>\X'tty: link'). .IP \(bu 2 fish should no longer hang using 100% CPU in the C locale (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3214'\fI\%#3214\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3214\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3050'\fI\%#3050\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3050\fP>\X'tty: link'). .IP \(bu 2 Prompts which show git repository information (via \fB__fish_git_prompt\fP) are faster in large repositories (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3294'\fI\%#3294\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3294\fP>\X'tty: link') and slow filesystems (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3083'\fI\%#3083\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3083\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3261'\fI\%#3261\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3261\fP>\X'tty: link'). .IP \(bu 2 Vi mode changes the cursor depending on the current mode (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3215'\fI\%#3215\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3215\fP>\X'tty: link'). .IP \(bu 2 Command lines with escaped space characters at the end tab\-complete correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2447'\fI\%#2447\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2447\fP>\X'tty: link'). .IP \(bu 2 Added completions for: .INDENT 2.0 .IP \(bu 2 \fBarcanist\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3256'\fI\%#3256\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3256\fP>\X'tty: link') .IP \(bu 2 \fBconnmanctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3419'\fI\%#3419\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3419\fP>\X'tty: link') .IP \(bu 2 \fBfiglet\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBmdbook\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBninja\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3415'\fI\%#3415\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3415\fP>\X'tty: link') .IP \(bu 2 \fBp4\fP, the Perforce client (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3314'\fI\%#3314\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3314\fP>\X'tty: link') .IP \(bu 2 \fBpygmentize\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .IP \(bu 2 \fBranger\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link') .UNINDENT .IP \(bu 2 Improved completions for \fBaura\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3297'\fI\%#3297\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3297\fP>\X'tty: link'), \fBabbr\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3267'\fI\%#3267\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3267\fP>\X'tty: link'), \fBbrew\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3309'\fI\%#3309\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3309\fP>\X'tty: link'), \fBchown\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3380'\fI\%#3380\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3380\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3383'\fI\%#3383\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3383\fP>\X'tty: link'),\fBcygport\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3392'\fI\%#3392\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3392\fP>\X'tty: link'), \fBgit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3274'\fI\%#3274\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3274\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3226'\fI\%#3226\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3226\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3225'\fI\%#3225\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3225\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3094'\fI\%#3094\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3094\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3087'\fI\%#3087\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3087\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3035'\fI\%#3035\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3035\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3021'\fI\%#3021\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3021\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2982'\fI\%#2982\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2982\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3230'\fI\%#3230\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3230\fP>\X'tty: link'), \fBkill\fP & \fBpkill\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3200'\fI\%#3200\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3200\fP>\X'tty: link'), \fBscreen\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3271'\fI\%#3271\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3271\fP>\X'tty: link'), \fBwget\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3470'\fI\%#3470\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3470\fP>\X'tty: link'), and \fBxz\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3378'\fI\%#3378\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3378\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3248'\fI\%#3248\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3248\fP>\X'tty: link'). .IP \(bu 2 Improved compatibility with minor platforms including musl (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2988'\fI\%#2988\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2988\fP>\X'tty: link'), Cygwin (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2993'\fI\%#2993\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2993\fP>\X'tty: link'), Android (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3441'\fI\%#3441\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3441\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/3442'\fI\%#3442\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3442\fP>\X'tty: link'), Haiku (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3322'\fI\%#3322\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3322\fP>\X'tty: link') 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2991'\fI\%#2991\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2991\fP>\X'tty: link'). .IP \(bu 2 \fBfish_mode_prompt\fP has been updated to reflect the changes in the way the Vi input mode is set up (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3067'\fI\%#3067\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3067\fP>\X'tty: link'), making this more reliable. .IP \(bu 2 \fBfish_config\fP can now properly be launched from the OS X app bundle (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3140'\fI\%#3140\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3140\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2859'\fI\%#2859\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2859\fP>\X'tty: link'). .IP \(bu 2 The \fBstring\fP builtin’s \fBmatch\fP mode now handles the combination of \fB\-rnv\fP (match, invert and count) correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3098'\fI\%#3098\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3098\fP>\X'tty: link'). .IP \(bu 2 Improvements to TTY special character handling (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3064'\fI\%#3064\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3064\fP>\X'tty: link'), locale handling (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3124'\fI\%#3124\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3124\fP>\X'tty: link') and terminal environment variable handling (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3060'\fI\%#3060\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3060\fP>\X'tty: link'). .IP \(bu 2 Work towards handling the terminal modes for external commands launched from initialisation files (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2980'\fI\%#2980\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2980\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3057'\fI\%#3057\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3057\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3123'\fI\%#3123\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3123\fP>\X'tty: link'). .IP \(bu 2 Improved completions for \fBapt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3097'\fI\%#3097\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3097\fP>\X'tty: link'), \fBaura\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3102'\fI\%#3102\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3102\fP>\X'tty: link'),\fBgit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3114'\fI\%#3114\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3114\fP>\X'tty: link'), \fBnpm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3158'\fI\%#3158\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3158\fP>\X'tty: link'), \fBstring\fP and \fBsuspend\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3154'\fI\%#3154\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3154\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2996'\fI\%#2996\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2996\fP>\X'tty: link'). .IP \(bu 2 Define a few extra colours on first start (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2987'\fI\%#2987\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2987\fP>\X'tty: link'). .IP \(bu 2 Multiple documentation updates. .IP \(bu 2 Added completions for rmmod (\X'tty: link https://github.com/fish-shell/fish-shell/issues/3007'\fI\%#3007\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/3007\fP>\X'tty: link'). .IP \(bu 2 Improved completions for git (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2998'\fI\%#2998\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2998\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2619'\fI\%#2619\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2619\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2932'\fI\%#2932\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2932\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2952'\fI\%#2952\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2952\fP>\X'tty: link') and RedHat Enterprise Linux/CentOS 5 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2955'\fI\%#2955\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2955\fP>\X'tty: link'). .IP \(bu 2 Avoid confusing the terminal line driver with non\-printing characters in \fBfish_title\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2453'\fI\%#2453\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2453\fP>\X'tty: link'). .IP \(bu 2 Improved completions for busctl, git (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2585'\fI\%#2585\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2585\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2879'\fI\%#2879\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2879\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2984'\fI\%#2984\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2984\fP>\X'tty: link'), 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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2296'\fI\%#2296\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2296\fP>\X'tty: link') .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1356'\fI\%#1356\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1356\fP>\X'tty: link') .IP \(bu 2 Add new directories for vendor functions and configuration snippets (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2500'\fI\%#2500\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2500\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2719'\fI\%#2719\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2719\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1428'\fI\%#1428\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1428\fP>\X'tty: link') .IP \(bu 2 \fBset \-ql\fP now searches up to function scope for variables (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2502'\fI\%#2502\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2502\fP>\X'tty: link') .IP \(bu 2 \fBstatus \-f\fP will now behave the same when run as the main script or using \fBsource\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2643'\fI\%#2643\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2643\fP>\X'tty: link') .IP \(bu 2 \fBsource\fP no longer puts the file name in \fB$argv\fP if no arguments are given (\X'tty: link https://github.com/fish-shell/fish-shell/issues/139'\fI\%#139\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/139\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/744'\fI\%#744\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/744\fP>\X'tty: link') .UNINDENT .SS Other notable fixes and improvements .INDENT 0.0 .IP \(bu 2 Fish no longer silences errors in config.fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2702'\fI\%#2702\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2702\fP>\X'tty: link') .IP \(bu 2 Directory autosuggestions will now descend as far as possible if there is only one child directory (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2531'\fI\%#2531\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2531\fP>\X'tty: link') .IP \(bu 2 Add support for bright colors (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1464'\fI\%#1464\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1464\fP>\X'tty: link') .IP \(bu 2 Allow Ctrl\-J (\fB\ecj\fP) to be bound separately from Ctrl\-M (\fB\ecm\fP) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/217'\fI\%#217\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/217\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2495'\fI\%#2495\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2495\fP>\X'tty: link') .IP \(bu 2 Support for SVN status in the prompt (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2582'\fI\%#2582\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2582\fP>\X'tty: link') .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) (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2592'\fI\%#2592\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2592\fP>\X'tty: link') .IP \(bu 2 export now handles variables with a “=” in the value (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2403'\fI\%#2403\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2403\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2390'\fI\%#2390\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2390\fP>\X'tty: link') .IP \(bu 2 entr \- the “Event Notify Test Runner” (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2265'\fI\%#2265\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2265\fP>\X'tty: link') .IP \(bu 2 Fedora’s dnf (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2638'\fI\%#2638\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2638\fP>\X'tty: link') .IP \(bu 2 OSX diskutil (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2738'\fI\%#2738\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2738\fP>\X'tty: link') .IP \(bu 2 pkgng (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2395'\fI\%#2395\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2395\fP>\X'tty: link') .IP \(bu 2 pulseaudio’s pacmd and pactl .IP \(bu 2 rust’s rustc and cargo (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2409'\fI\%#2409\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2409\fP>\X'tty: link') .IP \(bu 2 sysctl (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2214'\fI\%#2214\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2214\fP>\X'tty: link') .IP \(bu 2 systemd’s machinectl (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2158'\fI\%#2158\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2158\fP>\X'tty: link'), busctl (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2144'\fI\%#2144\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2144\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2245'\fI\%#2245\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2245\fP>\X'tty: link') .IP \(bu 2 A rewrite of the completions for cd, fixing a few bugs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2299'\fI\%#2299\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2299\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/2300'\fI\%#2300\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2300\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/562'\fI\%#562\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/562\fP>\X'tty: link') .IP \(bu 2 Linux VTs now run in a simplified mode to avoid issues (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2311'\fI\%#2311\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2311\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2268'\fI\%#2268\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2268\fP>\X'tty: link') .IP \(bu 2 A new \fBsuspend\fP function (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2269'\fI\%#2269\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2269\fP>\X'tty: link') .IP \(bu 2 Subcommand completion now works better with split /usr (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2141'\fI\%#2141\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2141\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2332'\fI\%#2332\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2332\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2473'\fI\%#2473\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2473\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2799'\fI\%#2799\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2799\fP>\X'tty: link') .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/731'\fI\%#731\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/731\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/65'\fI\%#65\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/65\fP>\X'tty: link'). .IP \(bu 2 New inline and interactive pager, which will be familiar to users of zsh (\X'tty: link https://github.com/fish-shell/fish-shell/issues/291'\fI\%#291\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/291\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1567'\fI\%#1567\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1567\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1585'\fI\%#1585\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1585\fP>\X'tty: link'). It is no longer exported to other commands (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1896'\fI\%#1896\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1896\fP>\X'tty: link'). .IP \(bu 2 \fBif\fP / \fBelse\fP conditional statements now return values consistent with the Single Unix Specification, like other shells (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1443'\fI\%#1443\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1443\fP>\X'tty: link'). .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. (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1908'\fI\%#1908\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1908\fP>\X'tty: link') .UNINDENT .SS Other notable fixes and improvements .INDENT 0.0 .IP \(bu 2 New documentation design (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1662'\fI\%#1662\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1662\fP>\X'tty: link'), 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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1549'\fI\%#1549\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1549\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1482'\fI\%#1482\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1482\fP>\X'tty: link'). .IP \(bu 2 The \fB\&.\fP command is deprecated and the \fBsource\fP command is preferred (\X'tty: link https://github.com/fish-shell/fish-shell/issues/310'\fI\%#310\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/310\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1833'\fI\%#1833\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1833\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1540'\fI\%#1540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1540\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/393'\fI\%#393\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/393\fP>\X'tty: link'), and \fBcomplete \-e\fP now correctly erases completions (\X'tty: link https://github.com/fish-shell/fish-shell/issues/380'\fI\%#380\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/380\fP>\X'tty: link'). .IP \(bu 2 Completions are now generated from manual pages by default on the first run of fish (\X'tty: link https://github.com/fish-shell/fish-shell/issues/997'\fI\%#997\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/997\fP>\X'tty: link'). .IP \(bu 2 \fBfish_indent\fP can now produce colorized (\fB\-\-ansi\fP) and HTML (\fB\-\-html\fP) output (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1827'\fI\%#1827\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1827\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/825'\fI\%#825\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/825\fP>\X'tty: link'). .IP \(bu 2 \fBjobs\fP returns 1 if there are no active jobs (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1484'\fI\%#1484\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1484\fP>\X'tty: link'). .IP \(bu 2 \fBread\fP has several new options: .IP \(bu 2 \fB\-\-array\fP to break input into an array (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1540'\fI\%#1540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1540\fP>\X'tty: link') .IP \(bu 2 \fB\-\-null\fP to break lines on NUL characters rather than newlines (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1694'\fI\%#1694\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1694\fP>\X'tty: link') .IP \(bu 2 \fB\-\-nchars\fP to read a specific number of characters (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1616'\fI\%#1616\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1616\fP>\X'tty: link') .IP \(bu 2 \fB\-\-right\-prompt\fP to display a right\-hand\-side prompt during interactive read (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1698'\fI\%#1698\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1698\fP>\X'tty: link'). .IP \(bu 2 \fBtype\fP has a new \fB\-q\fP option to suppress output (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1540'\fI\%#1540\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1540\fP>\X'tty: link' and, like other shells, \fBtype \-a\fP now prints all matches for a command (\X'tty: link https://github.com/fish-shell/fish-shell/issues/261'\fI\%#261\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/261\fP>\X'tty: link'). .IP \(bu 2 Pressing \fBf1\fP now shows the manual page for the current command (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1063'\fI\%#1063\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1063\fP>\X'tty: link'). .IP \(bu 2 \fBfish_title\fP functions have access to the arguments of the currently running argument as \fB$argv[1]\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1542'\fI\%#1542\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1542\fP>\X'tty: link'). .IP \(bu 2 The OS command\-not\-found handler is used on Arch Linux (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1925'\fI\%#1925\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1925\fP>\X'tty: link'), nixOS (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1852'\fI\%#1852\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1852\fP>\X'tty: link'), openSUSE and Fedora (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1280'\fI\%#1280\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1280\fP>\X'tty: link'). .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 (\X'tty: link https://github.com/fish-shell/fish-shell/issues/89'\fI\%#89\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/89\fP>\X'tty: link'). .IP \(bu 2 The \fBSHLVL\fP environment variable is incremented correctly (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1634'\fI\%#1634\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1634\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1693'\fI\%#1693\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1693\fP>\X'tty: link'). .IP \(bu 2 Added completions for \fBadb\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1165'\fI\%#1165\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1165\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1211'\fI\%#1211\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1211\fP>\X'tty: link'), \fBapt\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2018'\fI\%#2018\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2018\fP>\X'tty: link'), \fBaura\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1292'\fI\%#1292\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1292\fP>\X'tty: link'), \fBcomposer\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1607'\fI\%#1607\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1607\fP>\X'tty: link'), \fBcygport\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1841'\fI\%#1841\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1841\fP>\X'tty: link'), \fBdropbox\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1533'\fI\%#1533\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1533\fP>\X'tty: link'), \fBelixir\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1167'\fI\%#1167\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1167\fP>\X'tty: link'), \fBfossil\fP, \fBheroku\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1790'\fI\%#1790\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1790\fP>\X'tty: link'), \fBiex\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1167'\fI\%#1167\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1167\fP>\X'tty: link'), \fBkitchen\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/2000'\fI\%#2000\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/2000\fP>\X'tty: link'), \fBnix\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1167'\fI\%#1167\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1167\fP>\X'tty: link'), \fBnode\fP/\fBnpm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1566'\fI\%#1566\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1566\fP>\X'tty: link'), \fBopam\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1615'\fI\%#1615\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1615\fP>\X'tty: link'), \fBsetfacl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1752'\fI\%#1752\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1752\fP>\X'tty: link'), \fBtmuxinator\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1863'\fI\%#1863\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1863\fP>\X'tty: link'), and \fByast2\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1739'\fI\%#1739\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1739\fP>\X'tty: link'). .IP \(bu 2 Improved completions for \fBbrew\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1090'\fI\%#1090\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1090\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1810'\fI\%#1810\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1810\fP>\X'tty: link'), \fBbundler\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1779'\fI\%#1779\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1779\fP>\X'tty: link'), \fBcd\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1135'\fI\%#1135\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1135\fP>\X'tty: link'), \fBemerge\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1840'\fI\%#1840\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1840\fP>\X'tty: link'),\fBgit\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1680'\fI\%#1680\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1680\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1834'\fI\%#1834\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1834\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1951'\fI\%#1951\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1951\fP>\X'tty: link'), \fBman\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/960'\fI\%#960\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/960\fP>\X'tty: link'), \fBmodprobe\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1124'\fI\%#1124\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1124\fP>\X'tty: link'), \fBpacman\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1292'\fI\%#1292\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1292\fP>\X'tty: link'), \fBrpm\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1236'\fI\%#1236\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1236\fP>\X'tty: link'), \fBrsync\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1872'\fI\%#1872\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1872\fP>\X'tty: link'), \fBscp\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1145'\fI\%#1145\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1145\fP>\X'tty: link'), \fBssh\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1234'\fI\%#1234\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1234\fP>\X'tty: link'), \fBsshfs\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1268'\fI\%#1268\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1268\fP>\X'tty: link'), \fBsystemctl\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1462'\fI\%#1462\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1462\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/1950'\fI\%#1950\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1950\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1972'\fI\%#1972\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1972\fP>\X'tty: link'), \fBtmux\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1853'\fI\%#1853\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1853\fP>\X'tty: link'), \fBvagrant\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1748'\fI\%#1748\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1748\fP>\X'tty: link'), \fByum\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1269'\fI\%#1269\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1269\fP>\X'tty: link'), and \fBzypper\fP (\X'tty: link https://github.com/fish-shell/fish-shell/issues/1787'\fI\%#1787\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1787\fP>\X'tty: link'). .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. \X'tty: link https://github.com/fish-shell/fish-shell/issues/1859'\fI\%#1859\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1859\fP>\X'tty: link' .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). \X'tty: link https://github.com/fish-shell/fish-shell/issues/1438'\fI\%#1438\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1438\fP>\X'tty: link' .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). \X'tty: link https://github.com/fish-shell/fish-shell/issues/1437'\fI\%#1437\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1437\fP>\X'tty: link' .IP \(bu 2 \fBfishd\fP uses a secure path for its socket, preventing a local privilege escalation attack (closing CVE\-2014\-2905). \X'tty: link https://github.com/fish-shell/fish-shell/issues/1436'\fI\%#1436\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1436\fP>\X'tty: link' .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). \X'tty: link https://github.com/fish-shell/fish-shell/issues/1440'\fI\%#1440\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1440\fP>\X'tty: link' .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. \X'tty: link https://github.com/fish-shell/fish-shell/issues/1084'\fI\%#1084\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1084\fP>\X'tty: link' & \X'tty: link https://github.com/fish-shell/fish-shell/issues/1690'\fI\%#1690\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1690\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/568'\fI\%#568\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/568\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/110'\fI\%#110\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/110\fP>\X'tty: link', \X'tty: link https://github.com/fish-shell/fish-shell/issues/877'\fI\%#877\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/877\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/1008'\fI\%#1008\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/1008\fP>\X'tty: link' .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. \X'tty: link https://github.com/fish-shell/fish-shell/issues/995'\fI\%#995\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/995\fP>\X'tty: link' .IP \(bu 2 VTE based terminals should now know the working directory. \X'tty: link https://github.com/fish-shell/fish-shell/issues/906'\fI\%#906\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/906\fP>\X'tty: link' .IP \(bu 2 The autotools build now works on Mavericks. \X'tty: link https://github.com/fish-shell/fish-shell/issues/968'\fI\%#968\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/968\fP>\X'tty: link' .IP \(bu 2 The end\-of\-line binding (ctrl+E) now accepts autosuggestions. \X'tty: link https://github.com/fish-shell/fish-shell/issues/932'\fI\%#932\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/932\fP>\X'tty: link' .IP \(bu 2 Directories in \fB/etc/paths\fP (used on OS X) are now prepended instead of appended, similar to other shells. \X'tty: link https://github.com/fish-shell/fish-shell/issues/927'\fI\%#927\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/927\fP>\X'tty: link' .IP \(bu 2 Option\-right\-arrow (used for partial autosuggestion completion) now works on iTerm2. \X'tty: link https://github.com/fish-shell/fish-shell/issues/920'\fI\%#920\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/920\fP>\X'tty: link' .IP \(bu 2 Tab completions now work properly within nested subcommands. \X'tty: link https://github.com/fish-shell/fish-shell/issues/913'\fI\%#913\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/913\fP>\X'tty: link' .IP \(bu 2 \fBprintf\fP supports \fB\ee\fP, the escape character. \X'tty: link https://github.com/fish-shell/fish-shell/issues/910'\fI\%#910\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/910\fP>\X'tty: link' .IP \(bu 2 \fBfish_config history\fP no longer shows duplicate items. \X'tty: link https://github.com/fish-shell/fish-shell/issues/900'\fI\%#900\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/900\fP>\X'tty: link' .IP \(bu 2 \fB$fish_user_paths\fP is now prepended to $PATH instead of appended. \X'tty: link https://github.com/fish-shell/fish-shell/issues/888'\fI\%#888\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/888\fP>\X'tty: link' .IP \(bu 2 Jobs complete when all processes complete. \X'tty: link https://github.com/fish-shell/fish-shell/issues/876'\fI\%#876\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/876\fP>\X'tty: link' .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. \X'tty: link https://github.com/fish-shell/fish-shell/issues/875'\fI\%#875\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/875\fP>\X'tty: link' .IP \(bu 2 fish no longer tries to add \fB/bin\fP to \fB$PATH\fP unless PATH is totally empty. \X'tty: link https://github.com/fish-shell/fish-shell/issues/852'\fI\%#852\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/852\fP>\X'tty: link' .IP \(bu 2 History token substitution (alt\-up) now works correctly inside subshells. \X'tty: link https://github.com/fish-shell/fish-shell/issues/833'\fI\%#833\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/833\fP>\X'tty: link' .IP \(bu 2 Flow control is now disabled, freeing up ctrl\-S and ctrl\-Q for other uses. \X'tty: link https://github.com/fish-shell/fish-shell/issues/814'\fI\%#814\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/814\fP>\X'tty: link' .IP \(bu 2 sh\-style variable setting like \fBfoo=bar\fP now produces better error messages. \X'tty: link https://github.com/fish-shell/fish-shell/issues/809'\fI\%#809\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/809\fP>\X'tty: link' .IP \(bu 2 Commands with wildcards no longer produce autosuggestions. \X'tty: link https://github.com/fish-shell/fish-shell/issues/785'\fI\%#785\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/785\fP>\X'tty: link' .IP \(bu 2 funced no longer freaks out when supplied with no arguments. \X'tty: link https://github.com/fish-shell/fish-shell/issues/780'\fI\%#780\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/780\fP>\X'tty: link' .IP \(bu 2 fish.app now works correctly in a directory containing spaces. \X'tty: link https://github.com/fish-shell/fish-shell/issues/774'\fI\%#774\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/774\fP>\X'tty: link' .IP \(bu 2 Tab completion cycling no longer occasionally fails to repaint. \X'tty: link https://github.com/fish-shell/fish-shell/issues/765'\fI\%#765\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/765\fP>\X'tty: link' .IP \(bu 2 Comments now work in eval’d strings. \X'tty: link https://github.com/fish-shell/fish-shell/issues/684'\fI\%#684\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/684\fP>\X'tty: link' .IP \(bu 2 History search (up\-arrow) now shows the item matching the autosuggestion, if that autosuggestion was truncated. \X'tty: link https://github.com/fish-shell/fish-shell/issues/650'\fI\%#650\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/650\fP>\X'tty: link' .IP \(bu 2 Ctrl\-T now transposes characters, as in other shells. \X'tty: link https://github.com/fish-shell/fish-shell/issues/128'\fI\%#128\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/128\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/527'\fI\%#527\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/527\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/300'\fI\%#300\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/300\fP>\X'tty: link' .IP \(bu 2 \fBNew syntax for index ranges\fP (sometimes known as “slices”) \X'tty: link https://github.com/fish-shell/fish-shell/issues/212'\fI\%#212\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/212\fP>\X'tty: link' .IP \(bu 2 \fBfish now supports an \(ga\(gaelse if\(ga\(ga statement\fP \X'tty: link https://github.com/fish-shell/fish-shell/issues/134'\fI\%#134\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/134\fP>\X'tty: link' .IP \(bu 2 \fBProcess and pid completion now works on OS X\fP \X'tty: link https://github.com/fish-shell/fish-shell/issues/129'\fI\%#129\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/129\fP>\X'tty: link' .IP \(bu 2 \fBfish is now relocatable\fP, and no longer depends on compiled\-in paths \X'tty: link https://github.com/fish-shell/fish-shell/issues/125'\fI\%#125\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/125\fP>\X'tty: link' .IP \(bu 2 \fBfish now supports a right prompt (RPROMPT)\fP through the fish_right_prompt function \X'tty: link https://github.com/fish-shell/fish-shell/issues/80'\fI\%#80\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/80\fP>\X'tty: link' .IP \(bu 2 \fBfish now uses posix_spawn instead of fork when possible\fP, which is much faster on BSD and OS X \X'tty: link https://github.com/fish-shell/fish-shell/issues/11'\fI\%#11\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/11\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/696'\fI\%#696\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/696\fP>\X'tty: link' .IP \(bu 2 Control\-D (forward delete) no longer stops at a period \X'tty: link https://github.com/fish-shell/fish-shell/issues/667'\fI\%#667\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/667\fP>\X'tty: link' .IP \(bu 2 Completions for many new commands .IP \(bu 2 fish now respects rxvt’s unique keybindings \X'tty: link https://github.com/fish-shell/fish-shell/issues/657'\fI\%#657\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/657\fP>\X'tty: link' .IP \(bu 2 xsel is no longer built as part of fish. It will still be invoked if installed separately \X'tty: link https://github.com/fish-shell/fish-shell/issues/633'\fI\%#633\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/633\fP>\X'tty: link' .IP \(bu 2 __fish_filter_mime no longer spews \X'tty: link https://github.com/fish-shell/fish-shell/issues/628'\fI\%#628\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/628\fP>\X'tty: link' .IP \(bu 2 The –no\-execute option to fish no longer falls over when reaching the end of a block \X'tty: link https://github.com/fish-shell/fish-shell/issues/624'\fI\%#624\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/624\fP>\X'tty: link' .IP \(bu 2 fish_config knows how to find fish even if it’s not in the $PATH \X'tty: link https://github.com/fish-shell/fish-shell/issues/621'\fI\%#621\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/621\fP>\X'tty: link' .IP \(bu 2 A leading space now prevents writing to history, as is done in bash and zsh \X'tty: link https://github.com/fish-shell/fish-shell/issues/615'\fI\%#615\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/615\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/613'\fI\%#613\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/613\fP>\X'tty: link' .IP \(bu 2 printf is now a builtin \X'tty: link https://github.com/fish-shell/fish-shell/issues/611'\fI\%#611\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/611\fP>\X'tty: link' .IP \(bu 2 Event handlers should no longer fire if signals are blocked \X'tty: link https://github.com/fish-shell/fish-shell/issues/608'\fI\%#608\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/608\fP>\X'tty: link' .IP \(bu 2 set_color is now a builtin \X'tty: link https://github.com/fish-shell/fish-shell/issues/578'\fI\%#578\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/578\fP>\X'tty: link' .IP \(bu 2 man page completions are now located in a new generated_completions directory, instead of your completions directory \X'tty: link https://github.com/fish-shell/fish-shell/issues/576'\fI\%#576\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/576\fP>\X'tty: link' .IP \(bu 2 tab now clears autosuggestions \X'tty: link https://github.com/fish-shell/fish-shell/issues/561'\fI\%#561\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/561\fP>\X'tty: link' .IP \(bu 2 tab completion from within a pair of quotes now attempts to “appropriate” the closing quote \X'tty: link https://github.com/fish-shell/fish-shell/issues/552'\fI\%#552\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/552\fP>\X'tty: link' .IP \(bu 2 $EDITOR can now be a list: for example, \fBset EDITOR gvim \-f\fP) \X'tty: link https://github.com/fish-shell/fish-shell/issues/541'\fI\%#541\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/541\fP>\X'tty: link' .IP \(bu 2 \fBcase\fP bodies are now indented \X'tty: link https://github.com/fish-shell/fish-shell/issues/530'\fI\%#530\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/530\fP>\X'tty: link' .IP \(bu 2 The profile switch \fB\-p\fP no longer crashes \X'tty: link https://github.com/fish-shell/fish-shell/issues/517'\fI\%#517\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/517\fP>\X'tty: link' .IP \(bu 2 You can now control\-C out of \fBread\fP \X'tty: link https://github.com/fish-shell/fish-shell/issues/516'\fI\%#516\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/516\fP>\X'tty: link' .IP \(bu 2 \fBumask\fP is now functional on OS X \X'tty: link https://github.com/fish-shell/fish-shell/issues/515'\fI\%#515\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/515\fP>\X'tty: link' .IP \(bu 2 Avoid calling getpwnam on the main thread, as it can hang \X'tty: link https://github.com/fish-shell/fish-shell/issues/512'\fI\%#512\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/512\fP>\X'tty: link' .IP \(bu 2 Alt\-F or Alt\-right\-arrow (Option\-F or option\-right\-arrow) now accepts one word of an autosuggestion \X'tty: link https://github.com/fish-shell/fish-shell/issues/435'\fI\%#435\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/435\fP>\X'tty: link' .IP \(bu 2 Setting fish as your login shell no longer kills OpenSUSE \X'tty: link https://github.com/fish-shell/fish-shell/issues/367'\fI\%#367\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/367\fP>\X'tty: link' .IP \(bu 2 Backslashes now join lines, instead of creating multiple commands \X'tty: link https://github.com/fish-shell/fish-shell/issues/347'\fI\%#347\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/347\fP>\X'tty: link' .IP \(bu 2 echo now implements the \-e flag to interpret escapes \X'tty: link https://github.com/fish-shell/fish-shell/issues/337'\fI\%#337\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/337\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/335'\fI\%#335\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/335\fP>\X'tty: link' .IP \(bu 2 Descriptions now have their own muted color \X'tty: link https://github.com/fish-shell/fish-shell/issues/279'\fI\%#279\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/279\fP>\X'tty: link' .IP \(bu 2 Wildcards beginning with a . (for example, \fBls .*\fP) no longer match \&. and .. \X'tty: link https://github.com/fish-shell/fish-shell/issues/270'\fI\%#270\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/270\fP>\X'tty: link' .IP \(bu 2 Recursive wildcards now handle symlink loops \X'tty: link https://github.com/fish-shell/fish-shell/issues/268'\fI\%#268\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/268\fP>\X'tty: link' .IP \(bu 2 You can now delete history items from the fish_config web interface \X'tty: link https://github.com/fish-shell/fish-shell/issues/250'\fI\%#250\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/250\fP>\X'tty: link' .IP \(bu 2 The OS X build now weak links \fBwcsdup\fP and \fBwcscasecmp\fP \X'tty: link https://github.com/fish-shell/fish-shell/issues/240'\fI\%#240\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/240\fP>\X'tty: link' .IP \(bu 2 fish now saves and restores the process group, which prevents certain processes from being erroneously reported as stopped \X'tty: link https://github.com/fish-shell/fish-shell/issues/197'\fI\%#197\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/197\fP>\X'tty: link' .IP \(bu 2 funced now takes an editor option \X'tty: link https://github.com/fish-shell/fish-shell/issues/187'\fI\%#187\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/187\fP>\X'tty: link' .IP \(bu 2 Alternating row colors are available in fish pager through \fBfish_pager_color_secondary\fP \X'tty: link https://github.com/fish-shell/fish-shell/issues/186'\fI\%#186\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/186\fP>\X'tty: link' .IP \(bu 2 Universal variable values are now stored based on your MAC address, not your hostname \X'tty: link https://github.com/fish-shell/fish-shell/issues/183'\fI\%#183\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/183\fP>\X'tty: link' .IP \(bu 2 The caret ^ now only does a stderr redirection if it is the first character of a token, making git users happy \X'tty: link https://github.com/fish-shell/fish-shell/issues/168'\fI\%#168\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/168\fP>\X'tty: link' .IP \(bu 2 Autosuggestions will no longer cause line wrapping \X'tty: link https://github.com/fish-shell/fish-shell/issues/167'\fI\%#167\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/167\fP>\X'tty: link' .IP \(bu 2 Better handling of Unicode combining characters \X'tty: link https://github.com/fish-shell/fish-shell/issues/155'\fI\%#155\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/155\fP>\X'tty: link' .IP \(bu 2 fish SIGHUPs processes more often \X'tty: link https://github.com/fish-shell/fish-shell/issues/138'\fI\%#138\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/138\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/121'\fI\%#121\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/121\fP>\X'tty: link' .IP \(bu 2 \fBset \-e\fP no longer crashes \X'tty: link https://github.com/fish-shell/fish-shell/issues/100'\fI\%#100\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/100\fP>\X'tty: link' .IP \(bu 2 fish now will automatically import history from bash, if there is no fish history \X'tty: link https://github.com/fish-shell/fish-shell/issues/66'\fI\%#66\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/66\fP>\X'tty: link' .IP \(bu 2 Backslashed\-newlines inside quoted strings now behave more intuitively \X'tty: link https://github.com/fish-shell/fish-shell/issues/52'\fI\%#52\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/52\fP>\X'tty: link' .IP \(bu 2 Tab titles should be shown correctly in iTerm2 \X'tty: link https://github.com/fish-shell/fish-shell/issues/47'\fI\%#47\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/47\fP>\X'tty: link' .IP \(bu 2 scp remote path completion now sometimes works \X'tty: link https://github.com/fish-shell/fish-shell/issues/42'\fI\%#42\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/42\fP>\X'tty: link' .IP \(bu 2 The \fBread\fP builtin no longer shows autosuggestions \X'tty: link https://github.com/fish-shell/fish-shell/issues/29'\fI\%#29\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/29\fP>\X'tty: link' .IP \(bu 2 Custom key bindings can now be set via the \fBfish_user_key_bindings\fP function \X'tty: link https://github.com/fish-shell/fish-shell/issues/21'\fI\%#21\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/21\fP>\X'tty: link' .IP \(bu 2 All Python scripts now run correctly under both Python 2 and Python 3 \X'tty: link https://github.com/fish-shell/fish-shell/issues/14'\fI\%#14\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/14\fP>\X'tty: link' .IP \(bu 2 The “accept autosuggestion” key can now be configured \X'tty: link https://github.com/fish-shell/fish-shell/issues/19'\fI\%#19\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/19\fP>\X'tty: link' .IP \(bu 2 Autosuggestions will no longer suggest invalid commands \X'tty: link https://github.com/fish-shell/fish-shell/issues/6'\fI\%#6\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/6\fP>\X'tty: link' .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 \X'tty: link https://github.com/fish-shell/fish-shell/issues/13'\fI\%#13\fP <\fBhttps://github.com/fish-shell/fish-shell/issues/13\fP>\X'tty: link'). .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 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 Getting Set Up .sp Fish is developed on Github, at \X'tty: link https://github.com/fish-shell/fish-shell'\fI\%https://github.com/fish\-shell/fish\-shell\fP\X'tty: link'\&. .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//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 (headers and libraries) \- 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 \X'tty: link https://github.com/fish-shell/fish-shell/pulls'\fI\%https://github.com/fish\-shell/fish\-shell/pulls\fP\X'tty: link'\&. .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 (including \fBmake fish_run_tests\fP and \fBbuild_tools/style.fish\fP) .UNINDENT .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 publically 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. .sp To build it locally, run from the main fish\-shell directory: .INDENT 0.0 .INDENT 3.5 .sp .EX sphinx\-build \-j 8 \-b html \-n doc_src/ /tmp/fish\-doc/ .EE .UNINDENT .UNINDENT .sp which will build the docs as html in /tmp/fish\-doc. You can open it in a browser and see that it looks okay. .sp The builtins and various functions shipped with fish are documented in doc_src/cmds/. .SS Code Style .sp To ensure your changes conform to the style rules run .INDENT 0.0 .INDENT 3.5 .sp .EX build_tools/style.fish .EE .UNINDENT .UNINDENT .sp before committing your change. That will run our autoformatters: .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 \fBblack\fP for python .UNINDENT .sp If you’ve already committed your changes that’s okay since it will then check the files in the most recent commit. This can be useful after you’ve merged another person’s change and want to check that it’s style is acceptable. However, in that case it will run \fBclang\-format\fP to ensure the entire file, not just the lines modified by the commit, conform to the style. .sp If you want to check the style of the entire code base run .INDENT 0.0 .INDENT 3.5 .sp .EX build_tools/style.fish \-\-all .EE .UNINDENT .UNINDENT .sp That command will refuse to restyle any files if you have uncommitted changes. .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 \X'tty: link https://github.com/dag/vim-fish'\fI\%vim\-fish\fP <\fBhttps://github.com/dag/vim-fish\fP>\X'tty: link', 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 \X'tty: link https://github.com/wwwjfy/emacs-fish'\fI\%fish\-mode\fP <\fBhttps://github.com/wwwjfy/emacs-fish\fP>\X'tty: link' (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 Rust Style Guide .sp Use \fBcargo fmt\fP and \fBcargo clippy\fP\&. Clippy warnings can be turned off if there\(aqs a good reason to. .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 The tests can be found in three places: .INDENT 0.0 .IP \(bu 2 src/tests for unit tests. .IP \(bu 2 tests/checks for script tests, run by \X'tty: link https://github.com/ridiculousfish/littlecheck'\fI\%littlecheck\fP <\fBhttps://github.com/ridiculousfish/littlecheck\fP>\X'tty: link' .IP \(bu 2 tests/pexpects for interactive tests using \X'tty: link https://pexpect.readthedocs.io/en/stable/'\fI\%pexpect\fP <\fBhttps://pexpect.readthedocs.io/en/stable/\fP>\X'tty: link' .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. .sp The pexpects 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 build_tools/pexpect_helper.py, in case you need to modify something there. .SS Local testing .sp The tests can be run on your local computer on all operating systems. .INDENT 0.0 .INDENT 3.5 .sp .EX cmake path/to/fish\-shell make fish_run_tests .EE .UNINDENT .UNINDENT .SS Git hooks .sp Since developers sometimes forget to run the tests, it can be helpful to use git hooks (see githooks(5)) to automate it. .sp One possibility is a pre\-push hook script like this one: .INDENT 0.0 .INDENT 3.5 .sp .EX #!/bin/sh #### A pre\-push hook for the fish\-shell project # This will run the tests when a push to master is detected, and will stop that if the tests fail # Save this as .git/hooks/pre\-push and make it executable protected_branch=\(aqmaster\(aq # Git gives us lines like \(dqrefs/heads/frombranch SOMESHA1 refs/heads/tobranch SOMESHA1\(dq # We\(aqre only interested in the branches while read from _ to _; do if [ \(dqx$to\(dq = \(dqxrefs/heads/$protected_branch\(dq ]; then isprotected=1 fi done if [ \(dqx$isprotected\(dq = x1 ]; then echo \(dqRunning tests before push to master\(dq make fish_run_tests RESULT=$? if [ $RESULT \-ne 0 ]; then echo \(dqTests failed for a push to master, we can\(aqt let you do that\(dq >&2 exit 1 fi fi exit 0 .EE .UNINDENT .UNINDENT .sp This will check if the push is to the master branch and, if it is, only allow the push if running \fBmake fish_run_tests\fP succeeds. In some circumstances it may be advisable to circumvent this check with \fBgit push \-\-no\-verify\fP, but usually that isn’t necessary. .sp To install the hook, place the code in a new file \fB\&.git/hooks/pre\-push\fP and make it executable. .SS Coverity Scan .sp We use Coverity’s static analysis tool which offers free access to open source projects. While access to the tool itself is restricted, fish\-shell organization members should know that they can login \X'tty: link https://scan.coverity.com/projects/fish-shell-fish-shell?tab=overview'\fI\%here\fP <\fBhttps://scan.coverity.com/projects/fish-shell-fish-shell?tab=overview\fP>\X'tty: link' with their GitHub account. Currently, tests are triggered upon merging the \fBmaster\fP branch into \fBcoverity_scan_master\fP\&. Even if you are not a fish developer, you can keep an eye on our statistics there. .SS Contributing Translations .sp Fish uses the GNU gettext library to translate messages from English to other languages. .sp Creating and updating translations requires the Gettext tools, including \fBxgettext\fP, \fBmsgfmt\fP and \fBmsgmerge\fP\&. Translation sources are stored in the \fBpo\fP directory, named \fBLANG.po\fP, where \fBLANG\fP is the two letter ISO 639\-1 language code of the target language (eg \fBde\fP for German). .sp To create a new translation: .INDENT 0.0 .IP \(bu 2 generate a \fBmessages.pot\fP file by running \fBbuild_tools/fish_xgettext.fish\fP from the source tree .IP \(bu 2 copy \fBmessages.pot\fP to \fBpo/LANG.po\fP .UNINDENT .sp To update a translation: .INDENT 0.0 .IP \(bu 2 generate a \fBmessages.pot\fP file by running \fBbuild_tools/fish_xgettext.fish\fP from the source tree .IP \(bu 2 update the existing translation by running \fBmsgmerge \-\-update \-\-no\-fuzzy\-matching po/LANG.po messages.pot\fP .UNINDENT .sp The \fB\-\-no\-fuzzy\-matching\fP is important as we have had terrible experiences with gettext\(aqs \(dqfuzzy\(dq translations in the past. .sp Many tools are available for editing translation files, including command\-line and graphical user interface programs. For simple use, you can just use your text editor. .sp Open up the po file, for example \fBpo/sv.po\fP, and you\(aqll see something like: .INDENT 0.0 .INDENT 3.5 .sp .EX msgid \(dq%ls: 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%ls: No suitable job\en\(dq msgstr \(dq%ls: Inget passande jobb\en\(dq .EE .UNINDENT .UNINDENT .sp Any \fB%s\fP / \fB%ls\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. Trivial changes to an existing message (eg changing the punctuation) will cause existing translations to be removed, since the tools do literal string matching. Therefore, in general, you need to carefully review any recommended deletions. .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%ls: 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 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\-2024 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 \X'tty: link https://pypi.org/project/python-docs-theme/2020.1/'\fI\%https://pypi.org/project/python\-docs\-theme/2020.1/\fP\X'tty: link'\&. .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 \X'tty: link https://www.musl-libc.org'\fI\%musl\-libc\fP <\fBhttps://www.musl-libc.org\fP>\X'tty: link', 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 2024, fish-shell developers .\" Generated by docutils manpage writer. .