Solutions to Problems that Occurred When Configuring Hyper
Tags: hyper, zsh
Published: 2020-09-12 12:15:45

A year and a half ago, a coworker sat down with me to elevate my terminal experience. It was a game-changer, because since then working without the efficient configuration I have setup on my work laptop turned discouraging quickly.

This became particularly relevant recently when the newfound time quarantine granted had me dusting off my personal laptop to begin some projects that were bubbling in my head for some time.

I hadn't approached my personal laptop from a developer lens in some time. The first thing I noticed? My terminal. My sad, default-state-appearing terminal. The time had come to revitalize the experience - I was far too accustomed to the short-cuts my coworker had installed for the terminal on my work laptop. But, that was a while back and I didn't have any documentation tracking all the changes they made. So, it was time for me to list all the conveniences I wanted to implement, and partake on a journey to configure Hyper from scratch.

### Step 1
I didn't even have Hyper to begin with. So I began by [installing it here](https://hyper.is/#installation).

### Step 2
Next came what easily ranks highest amongst the priorities of the developer experience: Changing the colors. I went ahead and ran: 

`hyper i theme-of-your-choosing`

But running this sparked the first error of the journey:

`bash: hyper: command not found`

I found a thread of responses to this error. For me, [this response of three commands](https://github.com/vercel/hyper/issues/2829#issuecomment-468933774) in particular fixed it.

Or, if you're getting the error `zsh: command not found: hyper` then [this response](https://github.com/vercel/hyper/issues/3262#issuecomment-521434435) fixes it.

### Step 3
If you don't have zsh, then I recommend installing it. When I tried to [install it however](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH), I ran into an error displaying `non-standard shell` when trying to set it as my default shell. 

The [last answer here](https://stackoverflow.com/questions/31034870/making-zsh-default-shell-in-macosx) is what fixed it for me.

That is, first running this command:
`sudo chsh -s /usr/local/bin/zsh my_user_name`

Then in my `.bash-profile` file I made bash switch to z-shell:
```
touch ~/.bash_profile
echo 'export SHELL=$(which zsh)' >> ~/.bash_profile
echo 'exec $(which zsh) -l' >> ~/.bash_profile
```

### Step 4
One of the handiest features from my work laptop's terminal experience is [Spaceship prompt](https://denysdovhan.com/spaceship-prompt/). This will update the default prompt terminal with information like what directory you're on, current branch, node version and more. Following [this short tutorial](https://www.robertcooper.me/elegant-development-experience-with-zsh-and-hyper-terminal#prompt) helped get it working for me. Or, just skip to step 7 where we go through a different way to set up spaceship.

### Step 5
Next on the priority list was changing the font and adding ligatures. For this, I followed section **1.2.1 Font** in [this tutorial](https://tjay.dev/howto-my-terminal-shell-setup-hyper-js-zsh-starship/). 

As for the font, in Mac it's as simple as [downloading and installing the font families](https://github.com/tonsky/FiraCode/wiki/Installing) and then setting it as the font of choice in Hyper's config.

*Note to self: when setting up ligatures, the tutorial says to add `webGLRenderer: false,` to the config as the last step but I didn't realize that line was already in there, so in actuality you're just updating the line, not adding it.*

If the tutorial does not work, then while Hyper is open in the top left-hand corner go to "Hyper" and click on "Settings". Look at the url input to see where this file is located then cd to that file in Hyper. Use your text editor / IDE of choice to edit it.

### Step 6
Setup [some handy aliases](https://thorsten-hans.com/5-types-of-zsh-aliases) in the `~/.zshrc` file.

### Step 7
Two features I definitely wanted to transfer over were auto-suggestions and syntax highlighting. I went through a few tutorials (some of which are linked here) and nothing seemed to work. Until, [this one saved the day](https://levelup.gitconnected.com/zsh-antigen-oh-my-zsh-a-beautiful-powerful-robust-shell-ca5873821671).

Some notes for clarity in the level up article:
1. In your `~/.zshrc` when they say to add the following line: `source /path-to-your/antigen.zsh`, your source will most likely be the root, so you can do: `source ~/antigen.zsh`. Remember, this is in regards to the same file that we put our aliases in for Step 6.
2. Under the _Configure_ heading where it says to load those bundles, that all goes in your `.antigenrc` file (create one if you don't already have one): `vim ~/.antigenrc`.
3. Remember to quit and restart your terminal to apply all the changes.

I had forgotten I used antigen on my work laptop to make those two features work, which Level Up Coding's tutorial walked me through perfectly.

### Final configuration

![Final Configuration](https://dev-to-uploads.s3.amazonaws.com/i/3avc6yakzhrp416urvve.png)

The next thing I'm looking to do is add folder and file icons when listing out directories. I've messed around with [Color LS](https://github.com/athityakumar/colorls) but it seems Fira Code is not compatible (icons don't show) and using Hack Nerd Font removes the ligatures. Looks like the terminal configuration journey continues...🤔  

---

Cover photo courtesy of the [Hyperpower extension](https://hyper.is/#hyperpower).