How To Use Hyper With Fish and Oh My Posh

How To Use Hyper With Fish and Oh My Posh

Introduction

  1. Hyper is a terminal built on web technologies.
  2. fish is a highly customizable shell.
  3. Oh My Posh is a theme engine for a shell (bash, zsh, fish, etc)

Installing fish and Oh My Posh

Install fish on macOS using Homebrew

brew install fish

Install Oh My Posh

brew tap jandedobbeleer/oh-my-posh
brew install oh-my-posh

Installing Oh My Posh Themes

Visit themes and choose one that you like. For now, let's go for Spaceship theme. Click on it to reveal the JSON file. Copy it.

Create a .poshthemes folder in the root of your file directory and make spaceship.json file inside it.

~/.poshthemes/spaceship.json

Paste the contents into spaceship.json.


It's time to let fish know the existence of Oh My Posh and the desired theme that we chose.

Open config.fish located at

~/.config/fish/config.fish

If the file is not there then create it.

Put the below contents in the config.fish file.

if status is-interactive
    # Commands to run in interactive sessions can go here
end
fish_add_path /opt/homebrew/bin
oh-my-posh --init --shell fish --config ~/.poshthemes/spaceship.json | source

Installing Hyper Themes and Plugins

Install Hyper with Homebrew.

brew install hyper

At this point, you have got a barebones version of Hyper. Let's customize it with a theme and some cool plugins.

Open .hyper.js located at the root of your file directory with a text editor.

vim ~/.hyper.js

Find the plugins property and add the following:

plugins: [
  'hyper-ayu-mirage',
  'hyperpower', 
  'hyperborder',
  'hyperterm-tab-icons',
  'hyper-blink',
  'hyperterm-cursor',
  'gitrocket'
],

hyper-ayu-mirage is the theme for our terminal and the rest are plugins that enhance its functionality. You can find more at awesome-hyper.

Let's make Hyper choose fish shell. Find the shell property in .hyper.js and edit it.

shell: '/usr/local/bin/fish'

In case you don't know where fish is installed on you machine, type the below command in your terminal.

which fish

Here's my Hyper Config in case you are wondering.

This is how your Hyper terminal will look like with fish shell and Spaceship theme.

hyper_terminal_spaceship_theme.png

Change Oh My Posh Theme

What if you want to change to another Oh My Posh theme. Let's say you want to change the theme from Spaceship to M365Princess.

Create m365princess.json file in the poshthemes folder.

~/.poshthemes/m365princess.json

Copy the JSON file contents into m365princess.json file that we just created.

Open config.fish located at

~/.config/fish/config.fish

and change

 --config ~/.poshthemes/spaceship.json

to

 --config ~/.poshthemes/m365princess.json

This is how M365Princess theme will look like.

hyper_terminal_m365princess_theme.png