My Ultimate Zsh and Vim Config [ July 2022 Version ]

shell-ls

I feel most at home inside of a shell. Specifically a zsh shell.

I’ve done dozens of shell optimization posts over the years, and I thought it was time for an update. Here’s what I’m currently using and why.

Every shell I use on every box looks identical to this.

Shell Basics

  • OS: MacOS

  • Terminal: Terminal (built-in)

  • Terminal Font: Meslo LG L Regular Nerd Font Complete 15

  • Shell Upgrade: Oh-My-Zsh

  • Shell Icons:lsd

  • Theme: af-magic

The top image is the result of an ls -lah in my home directory on this box. Couple of things to notice:

lsd requires that you install Nerd Fonts.

  1. If you’re wondering why everything looks so awesome, it’s because I have lsd installed, which gives you those sick-looking colors and icons. It also makes stuff way more human-readable. It’s just generally a must.

  2. I use a super-minimal PS1 prompt, which is from the af-magic theme in oh-my-zsh. It’s super clean on the left side, but also gives you user@host in grey on the right side. Love. It.

Vim Basics

vim-conf

Editing my vim config using my vim conf

Explaining why I use neovim over vim will take a while.

  • Vim Base: NeoVim

  • Colorscheme: afterglow

  • Powerline: vim-airline

My Vim window is ideally decorated for my taste:

  1. Buffer indicator in the top left.

  2. Mode and path in bottom left.

  3. Filetype.

  4. Location information.

  5. Any issues with the file (such as trailing spaces).

vim-options

My vim plugins directory

Functionality

The pieces above are mostly about appearance. Here are some of the main things I do to improve my shell’s functionality:

Basic Mappings

  • jk for ESC: As I talk about in my Vim tutorial, I use jk as my ESC key.

  • ' for Mapleader: I use Leader shortcuts a lot, and it’s nice to be able to just slide my right pinky over one key to activate them.

Zsh-Plugins

My most common leader shortcuts are '-s and '-sp for spelling stuff, and '-n for line numbers.

  • zsh-autosuggestions: This gives you fish-like autocomplete for commands. Trust me, it’s rad.

  • zsh-syntax-highlighting: This one gives you either red or green feedback based on whether you’ve typed a valid command. Combined with autosuggestions it’s a massive shell upgrade.

CLI Enhancements

vim-mode

Vim commands on the CLI for the win

One of my favorite parts about Vim is being able to use it to navigate and edit my command line.

So if I mess up something on the command line, I can type jk to move into NORMAL mode, use my Vim commands to move around the command with w or b, press i to go back into INSERT mode, and continue on. Plus I can scroll through my command history using j and k.

Summary

If you enjoy the power of UNIX and Linux, and you spend a lot of time in the shell, it’s worth making that time as efficient and good-looking as possible.

  1. zsh

  2. oh-my-zsh

  3. lsd

  4. Zsh Plugins to make zsh work like fish.

  5. Zsh and Vim plugins to make them stand out visually.

  6. Config changes to make both zsh and vim more efficient.

Plus, hacking is 349% more fun if your shell is 🔥, and there’s no pride like having someone gush over your setup 👀.

So yeah—even if you don’t use my exact settings I hope this inspires you to do some upgrades!