Pimp my *nix

McPotato
7 min readDec 30, 2020

My wife to-be needed a new computer, so I gave her my 2018 MBP and made use of this opportunity to buy the new M1 MBP 13".

And so I decided it was time to brush up my setup and give it some new look & feel !

Previous Setup

I’ve been a Mac fan since I won a little Macbook Air 11" at a hackathon. To be clear, I was planning on giving it as a gift. Everything changed when I started using it out of curiosity.. eheh.

Before that I had a Windows 7 / OpenSuse dual boot on a HP machine I had for school. Nothing very exciting, no IDE and some basic configuration for emacs. Windows was for gaming, what else would you use it for anyways ?

It did get me accustomed to bash and the basics of Linux though. So when I got the Air, I started by downloading VS Code, iTerm2 and stumbled on oh-my-fish. And coming from an almost bare opensuse, that was already mind-blowing. I went on with this configuration for a few years, adding little bits and pieces like JetBrains products, replicating this on my work setups. I did get a Windows computer for work once, BEFORE WSL, it wasn’t a great experience. Thank goodness for cygwin & co.

There goes the next few hours of my life

I thought this was going to be easy, spoiler, it wasn’t.

A quick note on the M1 chip

Things are not very well supported as of December 2020. Reading release notes, blog posts, and github issues I’m seeing that support is coming, so patience. I also found this website which might come in handy.

It’ll be a Rosetta setup for the moment !

Init

For starters, you can find all my configuration files on github. Also, the final result is at the bottom of the article !

What I do is simply add symbolic links with ln -s to the files in my git repository, very practical to have a backup + allows for future ansible coolness 😎

If like me you are running macOS, you’ll first need to install xcode :

$> xcode-select --install

Package manager

I personally use homebrew. I believe most packages I talk about here are available with other package managers.

I recently discovered homebrew was available on Linux. This is good news, switching to other platforms will be less painful. What I like with Homebrew is that it has a huge list of packages available, from my experience up to date & it doesn’t require sudo.

Terminal

Alacritty & tmux

Like most of the tools I found out about during this journey, I didn’t think they existed ! I landed on Alacritty thanks to Jon Gjengset’s setup video. It’s faster than iTerm2 although the difference is quite subtle. I’ve had a little graphical issue but other than that I’m quite satisfied. If like me you’re a fan of terminal splitting, you’ll need tmux.

tmux is a terminal multiplexer. It allows you to divide your terminal window into multiple sessions. It’ll keep sessions open regardless of Alacritty’s rendering, this way in case of a crash you can pop your session back open. There are lots of features, you should go check the documentation out !

The following snippet automatically attaches you to an existing tmux session on startup, if one exists :

This is Alacritty’s configuration file, it can be placed in multiple locations.

If you don’t know where to start, there is oh-my-tmux, configuration ready for use. There are loads of people with great configs out there on the web, do inspire yourself from them as I did.

kitty

I’m planning on giving kitty a shot, it also looks appealing. *EDIT: I did give kitty a shot.

Like Alacritty, it offloads rendering to the GPU. BUT, it feels better and it seems to me that it is faster. It’s also simpler than tmux, it’s ready to use out of the box. And since it supports tiling natively, no need for tmux anymore !

Others

Here’s a list of other terms I’ve used / use / have eyes on for different platforms :

macOS

linux

windows

android

Colors

Check out base16. It’s great and integrates with A LOT of different things, namely Alacritty, iTerm2, kitty, vim, neovim, your shell, tmux, and many more.

Shell

I’ve been using fish for a while now. It has extra features compared to bash or zsh such as autosuggestion. Below are a few examples :

Latest command suggestion, press TAB or right arrow to autocomplete
man page parsing for smart autocomplete, TAB for navigation

If you’re new to all of this and feel a bit overwhelmed oh-my-fish and oh-my-zsh can help you out.
I prefer going my own separate way as I like to have control and understanding over my configuration. It does take time though, but it sure is worth it.
*EDIT: I’ve tried oh-my-zsh and it was very slow compared to my setup !

One of the shortcomings of fish in my opinion is that the keyboard mappings predefined overlap with other utilities such as fzf. I’m considering switching to zsh, it’s more bare-bone but I guess it’ll be easier to configure.

*EDIT: I’ve switched to zsh. I do miss smart autocompletion but I’m starting to get used to using fzf for that. I believe with time my workflow will be faster !

Command utilities

fzf is the reason why I’m considering zsh. It’s autocomplete super charged. It lets you fuzzy search through :

  • your command history with Ctrl+R
  • paths with Ctrl+T
  • paths and cd directly to them with Alt+C / Esc+C
  • ssh history with the double star syntax
$> ssh **<TAB>
  • process list with the double star syntax with kill
  • more ?

bat is, as described by the github repo :

A cat(1) clone with syntax highlighting and Git integration.

Neat right ? It even shows the git diff !

I also stumbled on fd & ripgrep which are, respectively, like find & grep with better performance. They are often used as replacements to the two older commands in fzf. You can do this by setting the following environment variable FZF_DEFAULT_COMMAND, check the doc & additional ressources below for extra information.

bpytop as a replacement of htop.

exa as a colourful replacement of ls.

hexyl is a colorful command line hex viewer.

jq is very practical for parsing json directly in the command line. Definitely check out the tutorial page, it got me hooked right away !

tldr

Simplified and community-driven man pages

bpython as a replacement of the python default interpreter. It is colorful and has autocomplete ! Very nice if like me you use the python interpreter to test out some ideas.

Development setup

Now for the hard part. I mostly use VS Code for my day to day job. Recently I landed a job at Cityscoot where we do C# on .NET Core. VS Code isn’t great for that, so I got Rider.

For my personal computer, I wanted a fresh setup and thanks to Jon Gjengset I found neovim. As its name states, it’s the new vim. This introduced me to the Language Server Protocol, and I also now have a better understanding of how IDEs work.

Vim/neovim have loads of plugins, so much it can get hard to choose which are actually good for you / don’t have conflicting parameter settings.

I use vim-plug as my plugin manager.

You can scroll up to see the full list of packages I use, here are the nicest imo

  • coc.vim Conquer of Completion, gives a VS Code feel to completion ! It can integrate with a lot of LSPs, you can check if it has support for your language by typing coc + whatever you’re interested in on google.
  • fzf.vim to have fzf in Vim. More on that below.
  • I’m planning on trying vim-fugitive a popular vim git plugin.

You can open files easily with fuzzy search on file names + content with previously mentioned rg command (ripgrep).
First you’ll need to create an Rg command that tells fzf to do a grep search with ripgrep. Here’s what it looks like :

Next Steps

I want to write an ansible playbook that installs and sets up my configuration. The first step was taking notes and creating the repository for my configuration - ✅

Add a C# configuration. Maybe use this new setup for work ? 😎

I’ll probably do a follow up blog post or update this one after spending some time with this setup. This post is mainly a synthesis of what I learnt looking for new tools to make me more productive as a developper.

Additional ressources

As Vim Diesel said, vimtutor !

Et voilà !

--

--

McPotato

Software Engineer @ 🤗. Rust & distributed systems enthusiast 🦀