set -x key value set -e key
Edit the file
~/.config/fish/config.fish, creating it if it does not exist (Note the leading period).
The prompt is the output of the
fish_prompt function. Put it in
~/.config/fish/functions/fish_prompt.fish. For example, a simple prompt is:
function fish_prompt set_color $fish_color_cwd echo -n (prompt_pwd) set_color normal echo -n ' > ' end
You can also use the Web configuration tool,
fish_config, to preview and choose from a gallery of sample prompts.
Type some part of the command, and then hit the ↑ or ↓ arrow keys to navigate through history matches.
fish uses parentheses for subcommands. For example:
for i in (ls) echo $i end
$status variable. This replaces the
$? variable used in some other shells.
SOME_VAR=1 command produces an error:
Unknown command "SOME_VAR=1".
env SOME_VAR=1 command
You can also declare a local variable in a block:
begin set -lx SOME_VAR 1 command end
For example if
~/images is a symlink to
~/Documents/Images, if I write '
cd images', my prompt will say
Because it is impossible to consistently keep symlinked directories unresolved. It is indeed possible to do this partially, and many other shells do so. But it was felt there are enough serious corner cases that this is a bad idea. Most such issues have to do with how '..' is handled, and are variations of the following example:
cd images; ls .. given the above directory structure would list the contents of
~/Documents, not of
~, even though using
cd .. changes the current directory to
~, and the prompt, the
pwd builtin and many other directory information sources suggest that the current directory is
~/images and its parent is
~. This issue is not possible to fix without either making every single command into a builtin, breaking Unix semantics or implementing kludges in every single command. This issue can also be seen when doing IO redirection.
Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example,
find $PWD -name '*.txt' silently fails in shells that don't resolve symlinked paths.
If fish is unable to locate a command with a given name, and it starts with '
/' or '
~', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press
~ and enter.
open command uses the MIME type database and the
.desktop files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider asking for more help.
If you installed fish manually (e.g. by compiling it, not by using a package manager), you first need to add fish to the list of shells by executing the following command (assuming you installed fish in /usr/local):
echo /usr/local/bin/fish | sudo tee -a /etc/shells
If you installed a prepackaged version of fish, the package manager should have already done this for you.
In order to change your default shell, type:
chsh -s /usr/local/bin/fish
You may need to adjust the above path to e.g.
/usr/bin/fish. Use the command
which fish if you are unsure of where fish is installed.
Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.
Run the following command in fish:
function fish_title; end; funcsave fish_title
The long answer:
Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible to detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.
Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.
Change the value of the variable
fish_greeting or create a
fish_greeting function. For example, to remove the greeting use:
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".
Fish history recall is very simple yet effective:
See documentation for more details about line editing in fish.
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run
chsh -s /bin/bash if you are not sure.
Next, do the following (assuming fish was installed to /usr/local):
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
Fish reserves the Unicode private-use character range from U+F600 thru U+F73F for internal use. Any attempt to feed characters in that range to fish will result in them being replaced by the Unicode "replacement character" U+FFFD. This includes both interactive input as well as any file read by fish (but not programs run by fish).
The fish user community extends fish in unique and useful ways via scripts that aren't always appropriate for bundling with the fish package. Typically because they solve a niche problem unlikely to appeal to a broad audience. You can find those extensions, including prompts, themes and useful functions, in various third-party repositories. These include:
This is not an exhaustive list and the fish project has no opinion regarding the merits of the repositories listed above or the scripts found therein. We mention these only because you may find within them a solution to a need you have such as supporting the
|| operators or improved integration with other tools that you use.