Home | Catalogue | Robert's Blog
Last Updated: [2023-03-31 Fri 07:10]
This is an ever changing page, I doubt my terminal will ever be “complete”, just continually improved. Feel free to take ideas from my set up for yourself, almost anything is better than the defaults.
A copy of my dotfiles can be found here: Github link to my dotfiles
This is currently aimed at macOS and Linux users, but at some point I’ll see how well this can work on WSLv2
Whether you like it or not, the command line is one of the most powerful tools on any system, but let’s face it, when you launch it for the first time on a fresh system, what you’re greeted with is hardly inspiring.
One of the greatest updated Apple did to macOS was to swap out BASH for ZSH, something I've done on both my macOS and Linux machines for a while, however it’s had zero configuration applied, a blank canvas if you will.
The default Vim experience is very similar.
Firstly, we’re going to need some tools, firstly, if you're using a Mac, we need to replace Apple’s default terminal application with a popular, free, 3rd party application: iTerm2.
Next, we’ll want Homebrew to allow us to install terminal-based applications that aren’t included with macOS. I've done a writeup on Homebrew already to get you started.
You'll want to ensure you have tmux
and
neovim
installed, as we'll be using those
here.
To make use of the powerline interfaces, we need a font that has these extra symbols included. The best source for this is to install one of the Nerd Fonts packages.
I personally use the VictorMono font. Once you’ve chosen and installed a font, you can go to your profile settings and change the font used in your iTerm2 profile.
This will enable the fancy dividers in the powerline style interfaces we’ll be adding to Tmux, NeoVim, and the ZSH terminal.
ZSH (pronounced “Zee Shell”) is highly configurable, and one of the most popular ways of doing this is by using Oh My Zsh.
To install Oh My Zsh, run the following:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
After this has been installed, your terminal prompt will change to Oh My Zsh’s default theme: robbyrussell
The theme I use is Powerlevel10k which is a fork of an older theme called Powerlevel9k.
This theme adds a lot of useful information to the prompt, including git branch status, nodejs information, terraform version, azure account names, and much much more!
Follow the Installation instructions for Oh My Zsh users.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Powerlevel10k should launch its own configuration wizard on first
startup, however, if this doesn’t happen, you can run p10k configure
to launch it yourself or to run
it again later.
Oh My Zsh has a large selection of plugins to enhance your Zsh experience, here are the ones I use:
esc
twiceofd
to open the current path in Finder, or
cdf
to change your terminal directory to
the currently open finder location.history | grep
to hs
)These can be added to the PLUGINS section in your ~/.zshrc
file, which is where you configure
Zsh.
I also use a couple of plugins that aren’t included in Oh My Zsh, but I think they are pretty neat:
I often add a few aliases to my ~/.zshrc
file for things that aren’t covered by
plugins (such as DF-SHOW) or replacing
other commands:
alias s=show # launch DF-SHOW's `show` application
alias sr="show --running" # check for running instances of `show`
alias git=hub # replace the `git` command with `hub` - a wrapper that adds GitHub specific commands
alias vi=nvim # replace the `vi` command with `nvim` (Neovim)
alias vim=nvim # replace the `vim` command with `nvim` (Neovim)
There are a couple of other lines I’ve added to my ~/.zshrc
:
ZSH_TMUX_AUTOSTART=true
- this
launches Tmux on startupZLE_RPROMPT_INDENT=0
- this fixes the
right-hand prompt of Powerlevel10k to reach the edge of the window
correctly.So far, you should now have a terminal that looks like this (if you have Tmux set to start with your terminal)
The prompts are looking good, but Tmux’s default appearance isn’t great. You can set iTerm2 to wrap the functions of Tmux into iTerm2 itself which hides the ugly bar at the bottom, however, I, like many others, don’t like how clunky it feels when iTerm2 takes over Tmux’s duties.
Back in the day, I used to recommend people use Powerline for improving the look and usability of both Tmux and Vim, however I no longer use this as its reliance on Python can make the terminal lag, or completely break on Python updates.
I currently recommend “Oh my tmux!”, a versatile tmux configuration file.
cd ~
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
With my custom configuration, my Tmux now looks like this:
Section coming soon.
DISCLAIMER: The information provided on this website is generated from my own notes and is provided "as is" and without warranties. Robert Ian Hawdon can not be held responsible for damages caused by following a guide published on this site. This website contains links to other third-party websites. Such links are provided as convienice of the reader. I do not endorce the contents of these third party sites.