How To Configure Fish Shell with Oh My Fish

Fish, short for Friendly Interactive Shell, is an easy to install and use shell for Unix systems. The shell comes with interesting features such as auto-completion suggestions. It has a lot of themes that you can switch among to make your shell look beautiful, with different colors and highlights. Other features include searchable history, smart search and web-based configurations.

Oh My Fish

OMF is a Fish shell utility that allows one to install themes, change shell look, install, remove, list and update packages. You need to have first installed fish shell on your system in order to configure Oh My Fish.

Install Fish Shell on Linux

Use the guide in the link below to install Fish Shell on Linux:

Fish Shell Usage

To begin using fish, just type the command fish and your terminal will switch to fish shell.

$ fish

Or if you want to permanently use fish shell, run the below command:

chsh -s /usr/bin/fish

Installing Oh My Fish on Linux

On fish shell, run the below command to install Oh My Fish.

Requirements
  • fish shell, version 2.2 or later
  • git, version 1.9.5 or later

The command will download the installer script and begins installation.

curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish

You can also opt to first download the installer script and customize the install.

curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
fish install --path=~/.local/share/omf --config=~/.config/omf

Another option is to install Oh My Fish from Git with the following commands:

git clone https://github.com/oh-my-fish/oh-my-fish
cd oh-my-fish
bin/install --offline

Or get from releases page and install offline

curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
fish install --offline=omf.tar.gz

Fish Configuration Files

Once you install Fish shell and Oh My Fish, you should find the configuration files in /.config in home directory

⋊> cloudspinx@elearning ⋊> ~/.config ls -l 
total 92
drwx------ 2 cloudspinx cloudspinx 4096 Mar 31 21:35 dconf/
drwx------ 2 cloudspinx cloudspinx 4096 Mar 31 18:09 eog/
drwx------ 3 cloudspinx cloudspinx 4096 Mar 18 15:26 evolution/
drwx------ 5 cloudspinx cloudspinx 4096 Apr  1 11:42 fish/
-rw-rw-r-- 1 cloudspinx cloudspinx    3 Mar 18 15:27 gnome-initial-setup-done
drwx------ 3 cloudspinx cloudspinx 4096 Mar 30 09:48 gnome-session/
-rw-rw-r-- 1 cloudspinx cloudspinx   27 Mar 18 15:27 GNOME-xdg-terminals.list
drwxr-xr-x 2 cloudspinx cloudspinx 4096 Mar 18 15:26 goa-1.0/
drwx------ 2 cloudspinx cloudspinx 4096 Mar 31 09:42 gtk-3.0/
drwx------ 3 cloudspinx cloudspinx 4096 Mar 18 15:26 ibus/
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Mar 31 18:59 kitty/
-rw------- 1 cloudspinx cloudspinx 1062 Mar 31 18:58 konsolerc
-rw------- 1 cloudspinx cloudspinx   43 Mar 31 18:58 konsolesshconfig
drwxr-xr-x 2 cloudspinx cloudspinx 4096 Mar 18 15:26 nautilus/
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Apr  1 11:59 omf/

Using OMF

Oh My Fish comes with a utility, omf, that is used in installing, listing, updating and removing packages and themes. Examples:

# Update all packages and repositories
$ omf upate
Oh My Fish is up to date. 
You are now using Oh My Fish version 7. 
Updating https://github.com/oh-my-fish/packages-main master... Done! 
default is already up-to-date.

# To update omf only
$ omf update omf 
Oh My Fish is up to date. 
You are now using Oh My Fish version 7. 
Updating https://github.com/oh-my-fish/packages-main master...Done!

# List installed packages
$ omf list
Plugins 
fish-spec       omf 
Themes         
default

# List available themes
$ omf theme                                                                                                                                                                                                                                                         10:37:34 
Installed: 
default 

Available: 
agnoster                boxfish                 dangerous               fishbone                gnuykeaj                krisleech               nai                     plain                   sashimi                 spacefish               uggedal 
aight                   budspencer              default                 fishface                godfather               l                       nelsonjchen             pure                    scorphish               sushi                   will 
ays                     cbjohnson               dmorrell                fishy-drupal            graystatus              lambda                  neolambda               pygmalion               separation              syl20bnr                wolf-theme 
barracuda               chain                   doughsay                fisk                    harleen                 lavender                numist                  random                  shellder                taktoa                  yimmy 
batman                  clearance               eclm                    flash                   idan                    lolfish                 ocean                   randomrussel            simple-ass-prompt       technopagan             zeit 
beloglazov              cmorrell                edan                    fox                     integral                mars                    one                     redfish                 simplevi                toaster                 zephyr 
bira                    coffeeandcode           eden                    gentoo                  jacaetevha              mish                    pastfish                red-snapper             slacker                 tomita                  zish 
bobthefish              cor                     emoji-powerline         gianu                   johanson                mokou                   perryh                  rider                   slavic-cat              trout 
bongnoster              cyan                    es                      gitstatus               kawasaki                mtahmed                 pie                     robbyrussell            solarfish               tweetjay

# Install theme, e.g ocean
$ omf install ocean                                                                                                                                                                                                                                                 10:39:56 
Updating https://github.com/oh-my-fish/packages-main master... Done! 
Installing package ocean 
✔ ocean successfully installed.

# Apply theme, e.g Ocean
$ omf theme ocean

# Install Plugins, e.g weather
$ omf install weather                                                                                                                                                                                                                                                    ~ 10ms 
Updating https://github.com/oh-my-fish/packages-main master... Done! 
Installing package weather 
Installing package config 
✔ config successfully installed. 
Installing package spark 
Submodule 'spark' (https://github.com/holman/spark) registered for path 'spark' 
Cloning into '/home/lorna/.local/share/omf/pkg/spark/spark'... 
Submodule path 'spark': checked out 'ab88ac6f8f33698f39ece2f109b1117ef39a68eb' 
✔ spark successfully installed. 
✔ weather successfully installed.

# plugin-git
$ omf install https://github.com/jhillyerd/plugin-git                                                                                                                                                                                                                     ~ 0ms 
Updating https://github.com/oh-my-fish/packages-main master... Done! 
Installing package git 
✔ git successfully installed.

# fzf (fuzzy finder) plugin.
$ omf install https://github.com/jethrokuan/fzf                                                                                                                                                                                                                        ~ 1.018s 
Updating https://github.com/oh-my-fish/packages-main master... Done! 
Installing package fzf 
✔ fzf successfully installed.

# manage omf repositories; obtained from omf install
$ omf repositories list                                                                                                                                                                                                                                                 ~ 2.58s 
https://github.com/oh-my-fish/packages-main master

# Remove a package or theme
$ omf remove <package|theme name>

# Unistall Oh My Fish
$ omf destroy

Dotfiles

Fish and OMF configuration files contain the current state of Fish shell set up.

⋊> cloudspinx@elearning ⋊> ~ ls -l /home/cloudspinx/.config/                                                                                           12:03:11
drwx------ 5 cloudspinx cloudspinx 4096 Apr  1 11:42 fish
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Apr  1 11:59 omf

For fish, you should get the following files:

⋊> cloudspinx@elearning ⋊> ~ ls -l /home/cloudspinx/.config/fish/                                                                                                  12:08:13
total 20
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Apr  1 11:42 completions/
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Apr  1 11:59 conf.d/
-rw-rw-r-- 1 cloudspinx cloudspinx   87 Apr  1 11:42 config.fish
-rw-r--r-- 1 cloudspinx cloudspinx 1310 Apr  1 11:42 fish_variables
drwxrwxr-x 2 cloudspinx cloudspinx 4096 Apr  1 11:42 functions/
  • Conf.d – individual configurations
  • functions – custom functions
  • fish_variables – custom variables

For omf you will find three files; themes, bundle and channel.

⋊> cloudspinx@elearning ⋊> ~ ls -l /home/cloudspinx/.config/omf/                                                                                                   12:10:05
total 12
-rw-rw-r-- 1 cloudspinx cloudspinx 14 Apr  1 11:59 bundle
-rw-rw-r-- 1 cloudspinx cloudspinx  7 Apr  1 11:59 channel
-rw-rw-r-- 1 cloudspinx cloudspinx  8 Apr  1 11:59 theme
  • Theme – theme currently active
  • Bundle – all installed packages and themes
  • Channel – where OMF gets updates e.g stable

You can choose to create and customize the files to be used by Fish when it boots up. Fish reads from the configuration files for the currently applied settings.

  • init.fish – Custom script sourced after shell start
  • before.init.fish – Custom script sourced before shell start
  • key_bindings.fish – Custom key bindings where you can use the bind command freely

Init.fish

The file contains startup commands for fish shell and the most used setting is variables. You can globally define your preferred variables as shown in the examples below:

# For Golang developers
set -xg GOPATH $HOME/gocode

# Python developers
set -xg PYTHONDONTWRITEBYTECODE 1

This has been a guide on how to install and configure Fish with Oh My Fish. Fish shell is quite interesting due to the various themes and plugins it supports. It provides you with a beautiful terminal and it is easy to use. It also has a web-based configuration that can enable you to easily customize it. Enjoy!

You might also want to look at:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Kitty is a cross-platform GPU-based terminal emulator. It is feature-rich, written in Python and Objective C. It can easily be […]

Alacritty is the fastest available Linux terminal emulator. It makes use of GPU (Graphical Processing Unit) for rendering ensuring optimization […]

On this tutorial, we will look at how to install and configure eDEX-UI terminal emulator on Linux Mint. eDex-UI is […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.