How to setup Bobthefish theme for Fish shell on Docker/Server
28, January 2022

It's been years since I became fan of FISH shell (Friendly Interactive Shell). Fish is a modern shell which can work alongside with similar shells like Bash, Zsh. While I still write my scripts in Bash, fish has been default shell on my desktop. It has lots of fancy features that I like over bash.

Fish is not POSIX compliant, so it has different syntax than Bash and alike. Here is a list of features that helps me with everyday tasks:

  • When I start writing anything, fish suggests possible command according to history or current directory or available commands.
  • Search through commands via arrow key. While CTRL+r in bash works great, navigating through arrow key feels better.
  • Advanced Tab completion.
  • Syntax highlighting and error checking.
  • Colors :p


Why Bobthefish?

Fish is already great on its default installation, but as a developer I live in git repositories all day. A huge portion of my commands are just git commands. Bobthefish is a fish theme that improves that experience.

Bobthefish is git-aware powerline-styled theme. When your terminal is in git repository, Bobthefish can present some visual feedback about your repo status. It also utilizes powerline-styled fonts, so we get some great-looking icons.


Installation

Head over to official repository for installation guide:

https://github.com/oh-my-fish/theme-bobthefish


While official guide is great to complete setup on my desktop, I did notice a issue on my servers and docker containers. After installing bobthefish, everything was fine except the icons. The powerline-styled icons were showing as broken.

At first I thought maybe I didn't setup the fonts properly. But even after ensuring proper fonts, icons were missing.

After lot of frustration-filled debugging, I found that these icons relies on locale settings of server/docker containers. I checked the difference of locale on both my server and home computer. I found that on server/docker container, LANG wasn't set to a UTF-8 encoding supported value. Once I set it to en_US.UTF-8, icons were being shown just fine.

So here's what I had to do on my docker container to allow bobthefish to show

sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen

This command will edit /etc/locale.gen file and uncomment en_US.UTF-8 line.

locale-gen

Above command will generate locales according to /etc/locale.gen file.

update-locale LANG=en_US.UTF-8

Now we are updating system locale by setting LANG to en_US.UTF-8


Logging out and in might be needed to set this change in effect.


Write comment about this article: