Installing Alacritty, Zellij, and Neovim in macOS

til
alacritty
zellij
neovim
Published

June 8, 2024

Ever since I saw The Matrix, I’ve wanted to be a hacker.

When I say hacker, I mean having a cool-looking terminal. The kind that makes people think I’m a stealing millions from banks when, in reality, I’m just struggling to exit vim.

I use macOS. The closest I’ve been to being a hacker is using vim hotkeys in VSCode.

It’s not that I haven’t tried to look the part. I was a just one audio driver away from saying “I use Arch btw”. I did succeed with Ubuntu, but honestly, using Linux as my main OS always felt like too much work1. So that didn’t last long.

But, today, after reading about DHH’s Omakub, I though it was time to give my hacker dreams a second shot.

Installing Ubuntu felt like a bit too much work2, so I decided to settle on just upgrading my terminal.

I decided to set up Alacritty, Zellij, and Neovim on my M3 MacBook Pro.

Sure, I have client projects to deliver. But how could I let go of one-in-a-lifetime opportunity to procrastinate and imagine I’m a genius hacker for an afternoon?

Installing Alacritty

Alacritty is a terminal emulator, similar to Iterm2 and others. It’s selling point is that it’s very fast due to GPU-acceleration. Plus, you also get 256 colors support by default.

The best way to install it is using Homebrew:

brew install --cask alacritty

Then, you you can customize it to your liking by creating a ~/.config/alacritty/alacritty.toml file.

I ended up modifying just a couple of things:

  1. Increase padding.
  2. Change the font.
  3. Change the color scheme. I used One Dark from this gist.
Show the code
[window]
padding.x = 16
padding.y = 14
decorations = "none" # Removes the window decoration (title bar, etc.)

[font]
size = 13

# FiraCode Nerd Font
normal = { family = "FiraCode Nerd Font", style = "Regular" }
bold = { family = "FiraCode Nerd Font", style = "Bold" }
italic = { family = "FiraCode Nerd Font", style = "Italic" }

# One Dark theme
[colors]
[colors.primary]
background = '0x1e2127'
foreground = '0xabb2bf'
bright_foreground = '0xe6efff'

# Normal colors
[colors.normal]
black = '0x1e2127'
red = '0xe06c75'
green = '0x98c379'
yellow = '0xd19a66'
blue = '0x61afef'
magenta = '0xc678dd'
cyan = '0x56b6c2'
white = '0x828791'

# Bright colors
[colors.bright]
black = '0x5c6370'
red = '0xe06c75'
green = '0x98c379'
yellow = '0xd19a66'
blue = '0x61afef'
magenta = '0xc678dd'
cyan = '0x56b6c2'
white = '0xe6efff'

# Dim colors
[colors.dim]
black = '0x1e2127'
red = '0xe06c75'
green = '0x98c379'
yellow = '0xd19a66'
blue = '0x61afef'
magenta = '0xc678dd'
cyan = '0x56b6c2'
white = '0x828791'

I use FiraCode Nerd Font. Nerd Fonts are a collection of fonts that include glyphs such as icons that represent folders, file types, weird arrows, etc.

You can install them using Homebrew:

brew install font-<name-of-the-font>-nerd-font # For example, font-fira-code-nerd-font

Installing Zellij

Zellij is an improved version of tmux. Whenever I used tmux, I spent half my time figuring out the key bindings. Zellij shows the key bindings on screen (unless you disable it), which greatly improves the user experience.

This is what it looks like:

Zellij

Zellij

Same as before, the best way to install it is using Homebrew.

brew install zellij

You can customize it by creating a ~/.config/zellij/config.kdl file.

I just copied the One Half Dark theme they provide.

theme "one-half-dark"

themes {
    one-half-dark {
        fg 169 177 214
        bg 26 27 38
        black 56 62 90
        red 249 51 87
        green 158 206 106
        yellow 224 175 104
        blue 122 162 247
        magenta 187 154 247
        cyan 42 195 222
        white 192 202 245
        orange 255 158 100
    }
}

Is One Half Dark the same as One Dark? I don’t really know. I like to live dangerously.

Making Zellij play nice with Alacritty

Getting Alacritty to work with Zellij took me a while to figure out. But luckily it’s as simple as adding the full path to the zellij binary in the ~/.config/alacritty/alacritty.toml file.

[shell]
     program = "/opt/homebrew/bin/zellij"

Installing Neovim and LazyVim

Neovim is a fork from Vim, that solves some of Vim’s issues3. I didn’t really know if it was better or worse than Vim, but given that DHH recommended it, I thought it was a good idea to give it a shot.

LazyVim is a premade configuration for Neovim. The purists will probably hate it, but it’s a good start.

I had my own .vimrc, and after trying LazyVim for 30 minutes or so, I realized my config sucked.

First, install Neovim using Homebrew.

brew install neovim

Then, install LazyVim.

git clone https://github.com/LazyVim/starter ~/.config/nvim

So far, I’ve only made a few changes:

The plugins I mentioned are available in :LazyExtras, so it’s very easy to install them. Run :LazyExtras, select the plugins, and then install them with I.

To install One Dark, you must create a new file in ~/.config/nvim/lua/plugins/ containing the following code:

return {
  { "navarasu/onedark.nvim" },

  -- Configure LazyVim to load One Dark
  {
    "LazyVim/LazyVim",
    opts = {
      colorscheme = "onedark",
    },
  },
}

Other useful tools

While exploring Omakub’s repository, I also learned about other useful tools that I’ve now included in my daily workflow:

lazydocker

lazydocker: A simple terminal UI to manage everything Docker. Much better than everything else I’ve used.

Docker is great. But, until now, the experience of managing Docker containers sucked.

Take a look at the main screen:

lazydocker

lazydocker

lazygit

lazygit is a simple terminal UI for git.

I’ve found it better than GitHub Desktop when doing complex operations.

Here’s a screenshot of the main screen:

lazygit

lazygit

eza

eza is an improved version of ls.

I also added a couple of aliases from Omakub:

alias ls='eza -lh --group-directories-first --icons --hyperlink'
alias lsa='ls -a'
alias lt='eza --tree --level=2 --long --icons --git'
alias lta='lt -a'

If you run lta you’ll get a nice view of the current directory.

eza

eza

Conclusion

That’s all. I hope you learned something from this post or, at least, got a cool looking terminal.

There’s nothing else to say except that I’m never going to recover those 4 hours of my life.

I should get back to work.

Footnotes

  1. I’m sure you’re itching to explain how I’m completely wrong about this, and how you haven’t had to fix anything in years. Please reach me at [email protected]↩︎

  2. Can you even install Ubuntu on a Mac?↩︎

  3. Including its horrible website.↩︎