Oh My Fish! Make Your Shell Beautiful
A few days ago, we discussed how to install Fish shell, a robust, fully-usable shell that ships with many cool features out of the box such as auto-suggestions, built-in search functionality, syntax highlighting, web based configuration and a lot more. Today, we are going to discuss how to make our Fish shell beautiful and elegant using Oh My Fish (shortly omf). It is a Fishshell framework that allows you to install packages which extend or modify the look and feel of your shell. It is easy to use, fast and extensible. Using omf, you can easily install themes that enriches the look of your shell and install plugins to tweak your fish shell as per your wish.
Install Oh My Fish
Installing omf is not a big deal. All you have to do is just run the following command in your fish shell.
curl -L https://get.oh-my.fish | fish
Once the installation has completed, you will see the the prompt has automatically changed as shown in the above picture. Also, you will notice that the current time on the right side of the shell window.
Alternatively, you can download the installer and customize your install:
curl -L https://get.oh-my.fish > install
fish install --path=~/.local/share/omf --config=~/.config/omf
You can verify the integrity of the downloaded installer by verifying the script against this checksum:
That’s it. Let us go ahead and tweak our fish shell.
Now, Let Us Make Our Fish Shell Beautiful
To list all installed packages, run:
This command will display both the installed themes and plugins. Please note that a package can be either a theme or plugin. Installing packages means installing themes or plugins.
All official and community supported packages (both plugins and themes) are hosted in the main Omf repository. In this repository, you can see a whole bunch of repositories that contains a lot of plugins and themes.
Now let us see the list of available and installed themes. To do so, run:
As you can see, we have only one installed theme, which is default, and a whole bunch of available themes. You can preview all available themes here before installing it. This page contains all theme details, features, a sample screenshot of each theme and which theme is suitable for whom.
Installing a new theme
Allow me to install a theme, for example clearance theme – a minimalist fish shell theme for people who use git a lot. To do so, run:
omf install clearance
As you see in the above picture, the look of fish prompt has changed immediately after installing the new theme.
Let me browse through the file system and see how it looks like.
Not bad! It is really simple theme. It distinguishes the current working directory, folders and files with different color. As you may notice, it also displays the current working directory on top of the prompt. Currently, clearance is my default theme.
Like I already said, the theme will be applied immediately after installing it. If you have more than one themes, you can switch to a different theme using the following command:
omf theme <theme-name>
omf theme agnoster
Now I am using “agnoster” theme. Here is how agnoster theme changed the look of my shell.
For instance, I am going to install the weather plugin. To do so, just run:
omf install weather
The weather plugin depends on jq. So, you might need to install jq as well. It is mostly available in the default repositories of any Linux distro. So, you can install it using the default package manager. For example, the following command will install jq in Arch Linux and its variants.
sudo pacman -S jq
Now, check your weather from your fish shell using command:
To search for a theme or plugin, do:
omf search <search_string>
omf search nvm
To limit the search to themes, use -t flag.
omf search -t chain
This command will only search for themes that contains the string “chain”.
To limit the search to plugins, use -p flag.
omf search -p emacs
To update only the core (omf itself), run:
omf update omf
If it is up-to-date, you would see the following output:
Oh My Fish is up to date. You are now using Oh My Fish version 6. Updating https://github.com/oh-my-fish/packages-main master... Done!
To update all packages:
To selectively update packages, just include the packages names as shown below.
omf update clearance agnoster
Displaying information about a package
When you want to know the information about a theme or plugin, use this command:
omf describe clearance
This command will show the information about the given package.
Package: clearance Description: A minimalist fish shell theme for people who use git Repository: https://github.com/oh-my-fish/theme-clearance Maintainer:
To remove a package, for example emacs, run:
omf remove emacs
By default, the official repository is added automatically when you install Oh My Fish. This repository contains all packages built by the developers. To manage user-installed package repositories, use this command:
omf repositories [list|add|remove]
To list installed repositories, run:
omf repositories list
To add a repository:
omf repositories add <URL>
omf repositories add https://github.com/ostechnix/theme-sk
To remove a repository:
omf repositories remove <repository-name>
Troubleshooting Oh My Fish
Omf is smart enough to guide you to fix things on your own if something went wrong. It will list what to do to fix an issue. For example, I removed and installed clearance package and got file conflicting error. Luckily, Oh My Fish instructed me what to do before continuing. So, I simply ran the following to know how to fix the error:
And fixed the issued the error by running the following command:
Whenever you ran into a problem, just run ‘omf doctor’ command and try all suggested workarounds.
To display help section, run:
Uninstalling Oh My Fish
To uninstall Oh My Fish, run this command:
Go ahead and start customizing your fish shell. For more details, refer the project’s GitHub page.