Supercharge Your Fish Shell! A Beginner's Guide to Customization with Fisher and Oh My Fish π
Hello, web creators! Do you use the terminal (that black screen!) in your daily development work?
Actually, customizing this terminal to your liking can dramatically improve your development efficiency and, above all, make your work more enjoyable.
This time, we'll thoroughly explain how to customize the "Fish" shell, which is known for being modern and easy to use. In particular, with plugin managers like "Fisher" and "Oh My Fish," you can add themes and useful features as easily as installing apps on your smartphone.
The goal of this article is to let even beginners experience things "just working" by simply copying and pasting. Forget the difficult theories for now! First, let's change the appearance and add convenient functions to experience the fun of customization.
π First, Let's Get Ready: What Is a Plugin Manager?
Before we start customizing Fish, let's briefly explain what a "plugin manager" is.
It's a tool that allows you to easily add, manage, and delete Fish's appearance (themes) and functions (plugins). Without it, you would have to go through the tedious process of manually downloading files, placing them in specific locations, and rewriting configuration files.
With a plugin manager, you can automate all that troublesome work just by running a single command. This time, we'll introduce two particularly popular ones.
- Fisher: Simple and fast. Its charm lies in the ease of installing plugins directly from GitHub repositories.
- Oh My Fish: A rich collection of themes and plugins are gathered in the official repository, making them easy to find and install. Its all-in-one usability is its key feature.
Both are great tools, but they have different characteristics. This article will explain how to use both, so you can choose the one that suits you best.
*This article assumes that the Fish shell is already installed. If you haven't installed it yet, you can easily do so with Homebrew (macOS) or the package manager of your Linux distribution.
# For macOS (Homebrew)
brew install fish
π£ Let's Try Fisher! Simple-is-Best Customization
First, let's try Fisher, which is attractive for its simplicity. All settings are consolidated in the `~/.config/fish/config.fish` file, which makes it easy to manage.
1. Install Fisher
Installation is as simple as pasting the following command into your terminal and running it.
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
2. Change the Look by Installing a Theme
Now that Fisher is ready, let's change the look of your terminal right away. Here, we'll install a simple and popular theme called "nospace."
fisher install jorgebucaran/nospace.fish
The moment you run the command, the appearance of your prompt (the `>` or `$` part before you type a command) should have changed. As you can see, you can easily add themes and plugins just by specifying the GitHub `username/repository-name` after `fisher install`.
There are many other themes available. For example, let's also try the popular theme "bobthefish," which displays a lot of information.
fisher install oh-my-fish/theme-bobthefish
Note: High-functionality themes like bobthefish may require the separate installation of special fonts like "Nerd Fonts." If the display is corrupted, try reviewing the font settings of your terminal application.
3. Add Functionality with Plugins
After changing the look, let's add some useful features. Here, we'll install a plugin called "z," which allows you to easily jump back to directories you've visited before.
fisher install jethrokuan/z
After installation, try moving through a few directories with the `cd` command. Then, by typing `z` followed by a part of a directory name and pressing the Tab key, it will autocomplete candidates from your history. For example, if you have previously navigated to `/var/www/html/my-project`, you can just type `z my-p` and press Tab to go there, which is very efficient.
4. Check and Remove Installed Packages
To check what is currently installed, use the `list` command.
fisher list
It's also easy to remove themes or plugins you no longer need. Specify the package name after `remove`. Let's remove the `bobthefish` theme we just installed.
fisher remove oh-my-fish/theme-bobthefish
π Let's Try Oh My Fish! Fun Customization with a Wealth of Options
Next, let's try Oh My Fish (OMF). A major advantage of OMF is that many themes and plugins are officially cataloged, making it easy for beginners who don't know what to install to find something.
[Important] Using both Fisher and Oh My Fish at the same time is not recommended. If you want to try OMF after trying Fisher, it's recommended to first remove Fisher's plugins and then install OMF, or try it in a different environment.
1. Install Oh My Fish
Installation is also completed with a single command.
curl -L https://get.oh-my.fish | fish
Once the installation is complete, the default OMF theme should be applied.
2. Find and Apply a Theme
The great thing about OMF is that you can easily find and try themes. First, let's see a list of available themes.
omf theme
A list of many theme names will be displayed. To apply a theme you're interested in, specify the theme name after `omf theme`. For example, let's try the popular theme `agnoster`.
omf theme agnoster
This alone will install and immediately apply the theme. Try out various themes and find your favorite.
3. Install a Plugin
Installing plugins is also easy. Specify the plugin name after `omf install`. Here, let's install the very useful plugin "fzf," which allows you to interactively search your command history with `Ctrl+R`. (*Requires prior installation of the `fzf` main executable.)
omf install fzf
After installation, try pressing `Ctrl+R` in your terminal. A list of your previously executed commands should appear, allowing you to perform a filtered search. This is a feature so convenient you won't be able to live without it once you use it.
Available packages can be searched with `omf search -t` (themes) or `omf search -p` (plugins).
4. Check and Remove Installed Packages
You can check the list of packages (themes and plugins) installed with OMF using the `list` command.
omf list
Remove plugins you no longer need with `remove`.
omf remove fzf
π€ Fisher vs Oh My Fish: Which One is Better After All?
We've introduced both tools so far, but some of you might be wondering, "So, which one should I use?" Here's a simple guide to help you choose.
-
π£ Who Should Use Fisher
- People who prefer a simple and lightweight environment.
- People who want to find plugins from GitHub and other sources and combine them freely.
- People who want to manage their settings centrally in one place, `config.fish`.
-
π Who Should Use Oh My Fish
- Beginners to terminal customization who don't know where to start.
- People who want to easily choose from a rich, cataloged selection of themes and plugins.
- People who value simple operations, such as switching themes with a single command.
It's a good idea to try one first, and if you feel it doesn't suit you, try the other.
βοΈ Advanced: Further Customize by Directly Editing `config.fish`!
Even without using a plugin manager, you can perform various customizations by directly editing the Fish configuration file, `config.fish`. By combining this with plugin functionality, you can build an even more powerful environment.
The configuration file is usually located at `~/.config/fish/config.fish`. Commands written in this file will be automatically loaded when Fish starts.
Set Aliases to Shorten Commands
It's very convenient to replace frequently used long commands with short keywords (aliases). For example, let's make the command `ls -laF` runnable with `ll`.
Add the following line to your `config.fish` file.
alias ll="ls -laF"
After saving the file, open a new terminal or run `source ~/.config/fish/config.fish` to apply the settings. Now, just typing `ll` will execute `ls -laF`.
Git command aliases are also a classic.
alias gco="git checkout"
alias gst="git status"
alias gaa="git add ."
Set Environment Variables
Variables that you want to use system-wide, such as editor settings, are set as "environment variables." In Fish, you use `set -x`. For example, to set the default editor to `vim`, you would write the following in `config.fish`.
set -x EDITOR "vim"
β οΈ Points to Be Careful About
Customization is fun, but there are a few things to keep in mind.
- Be careful not to install too many plugins: While convenient, adding a large number of plugins can affect performance, such as slowing down shell startup. Be selective and only install what you really need.
- Backup your configuration file: It is strongly recommended to back up your `config.fish` file before editing it directly or making major changes to your plugin manager's configuration. If something goes wrong, you can quickly revert to the previous state.
- Compatibility issues: Rarely, plugins can interfere with each other and not work properly. If you encounter a problem, try disabling recently added plugins one by one to isolate the cause.
π Conclusion
In this article, as a first step into Fish shell customization, we introduced how to use the plugin managers "Fisher" and "Oh My Fish," as well as basic customization methods through the `config.fish` configuration file.
Just trying things out by copying and pasting is enough at first. Simply changing the look of your prompt or being able to use new commands should make your daily development work much more enjoyable.
From here, explore various themes and plugins, and build your own "ultimate terminal environment"!