Introduction

To catch your attention, I could have named the title X shell sucks, but that would piss people off. A good blog post would compare at least 2 similar things to get a clear picture, but to be honest, I don't use other shells. So, I can't help but explain only the usage of fish. Now, let's catch some fish.

Installation

Follow this to install. Note that this tutorial assume that you are on Linux.

Making binaries available in fish shell

Suppose that you want to expose binaries from a directory to fish shell.

Edit the ~/.config/fish/config.fish file by adding

fish_add_path

Then restart the shell to make it work.

Function calls in fish shell

The syntax of a function declaration is the following:

function <function_name>

<function_body>

end

Suppose that we want to make an alias of the Vlang binary. Add the following lines to ~/.config/fish/config.fish :

# This is a comment.
function vv

# Syntax : <path_to_bin> $argv
~/tools/v/v $argv

end

Now, we can use vv as an alias, where $argv represents function arguments.

Note that we need to restart the fish shell.

Organizing custom scripts

As our config.fish grows, we may want to tidy things up to calm down our background anxiety.

  1. We can create a directory named cust (the name does not matter) inside ~/.config/fish/.

  2. Then cd into cust and create a file named custom.fish.

  3. After that, we move our custom script there.

  4. Finally, add the following line to config.fish :

source ~/.config/fish/cust/custom.fish

Themes

The research showed that bad themes reduce programmers' productivity by 123.456%.

Use oh-my-posh to make your terminal cute.

Don't forget to config nerd font for the terminal!!

Before you go

This is my first blog post. If you have any suggestions, never hesitate to let me know. Thank you for your attention.