Oxidizing My Terminal with Alacritty, Zellij and NuShell

2023-11-08

terminal

I felt it was time for a change of terminal environment - why not try all Rust-based:

It turned out that configuration was not exactly straight-forward. I did find several resources, but none of them worked fully:

  1. Switching to Alacritty - uses a relatively old way of launching zellij
  2. Completely Oxidizing My Terminal Setup - launches zellij directly from alacritty (before shell), which causes it to not have environment varibles set propoerly

So, after some back and forth, few friendly suggestions on discord, I ended up with the following setup:

For Alacritty, I am starting up nushell, then zellij in ~/.config/alacritty/alacritty.yml:

shell:
  program: /opt/homebrew/bin/nu
  args:
    - -l
    - -c
    - zellij attach --create

Also, I am binding the left option key to alt to enable some of the key bindings in Zellij. I am specifically not binding both to keep the right option key for umlauts (e.g. option+a for รค)

window:
  option_as_alt: left

zellij attach --create takes care of attaching to an existing session (the first in case of multiple) or creating in case no session exists yet.

For zellij, I am changing the default_shell to nu in ~/.config/zellij/config.kdl

default_shell "nu"

For nushell, I am

In $nu.env-path:

# homebrew for macOS ARM64 (Apple Silicon)
$env.PATH = ($env.PATH | split row (char esep) | prepend '/opt/homebrew/bin')

$env.EDITOR = hx

mkdir ~/.cache/starship
starship init nu | save -f ~/.cache/starship/init.nu

In $nu.config-path:

use ~/.cache/starship/init.nu

Finally, I select a starship template with this command: starship preset pastel-powerline -o ~/.config/starship.toml

Hint: If something doesn't work, make sure there is no 'stale' instance of zellij running in the background, e.g. by killing'em'all with zellij kill-all-sessions.

Caveat: At the moment, I can't seem to display umlauts properly in Alacritty for files named via MacOS. :( I assume it has something to do with fonts.

This is what I get as a result: