My command line setup with Fish

Posted on August 29, 2014 by Stefan Bleibinhaus

In this post I am describing my terminal and shell setup under Mac OS X. It uses the combination of iTerm2 [1] and Fish [2] enhanced by a few selected plugins and scripts namely oh-my-fish [3] , autojump [4] and bd [5] . iTerm2 is a powerful replacement of Terminal [6] , while Fish is an interactive and user friendly modern shell.

1 iTerm2

iTerm2 [1] is a more powerful replacement for the built in Terminal application [6] of Mac OS X. Most of its features are listed on its feature page [7] . I personally enjoy its customization options and all the small enhancements over Terminal. The picture seen in Image 1 shows how it currently looks like for me. I am using the Solarized Dark color scheme [8] and a 12pt Monaco (for Powerline) [9] font. iTerm2 can be downloaded and easily installed from here [10] . More color themes can be acquired at the iTerm2 color schemes page [11] .

Image 1
Image 1: This is how my configuration currently looks like.

2 Fish

2.1 Introduction

"Finally, a command line shell for the 90s"

Fish shell ( [2]

Fish [2] was initially released in 2005 and is nowadays mostly developed by a guy naming himself ridiculousfish [12] . It is a Unix shell attempting to be more interactive and user-friendly than other shells. Its name actually stands for Friendly interactive shell [13] .

Most features are enabled out of the box and it comes among others with autosuggestions and color. It also allows scripting, but I feel the need to give you a little heads-up here: Fish scripts are not Bash compatible. Fish comes with its own syntax which is "simple, clean, and consistent". As I personally do not do a lot of shell scripting I am fine with this, but if you do often, this might be the most interesting aspect for you. On Wikipedia [14] is a short comparison of the syntax Fish uses against the one of Bash. Fish also has a great documentation [15] including a tutorial [16] and frequently asked questions [17] . The picture taken from Wikipedia [13] seen in Image 2 shows some autosuggestion and coloring. I have installed my Fish using Homebrew [18] .

Image 2
Image 2: The Friendly interactive shell as shown on Wikipedia [13] .
2.2 Oh-my-fish

Oh-my-fish [3] is a framework for managing your Fish configuration inspired by oh-my-zsh [19] . It includes optional plugins (brew, git, rails, python, node, etc) [20] and themes [21] . I have installed it using the curl and pipe command given on Github [22] . Note that by default it creates a new config but you can easily link your own config into it the same way they are loading their oh-my-fish config in it.

Personally I am currently not using any of the plugins, but I am a huge fan of the agnoster theme [23] . The theme bobthefish [24] would be my close second choice. Both themes are Powerline-style [25] , Git-aware Fish themes. They are especially nice if you are a heavy user of Git as they use the Powerline to show lots of relevant information to you once you are working in a Git repository. Please note that you need a Powerline enabled font [26] . I am using Monaco (for Powerline) [9] 1. You can see a picture of how it looks like for me in Image 1. The following Image 3 shows the bobthefish theme.

Image 3
Image 3: The bobthefish [24] Fish theme.
2.3 Autojump

Autojump [4] is a cd command that learns and facilitates navigating directories from the command line. It does that by storing the directories you are navigating to and then allows to jump quickly to them by just typing out (parts) of their name. Really helpful. Read more about its usage here [28] . I have installed it using the manual way described here [29] .

2.4 Bd

Bd [5] is another handy command. It allows to quickly go back to a parent directory in your current path. The concise readme page [5] on Github explains its further usage. Additionally I have also added the following cd aliases seen in Code snippet 1 to my config but to be honest I barely use them thanks to Bd.

Code snippet 1

3 References

comments powered by Disqus
Admin login