In this tutorial, you will learn how to tweak your Windows terminal in order to become 100 times more productive as well as make it look bang tidy. A bold claim, absolutely, but true!
This step-by-step guide and related video will teach you how to add extra capabilities to your terminal like running multiple shells within a wing window, session management, autocomplete, and keyboard shortcuts that will prevent you from having to type so much! After implementing these tips, I promise (pinky swear) that you will save yourself hours of time during your daily development activities.
If you use the terminal a lot and you want to save yourself a lot of agro and save yourself a lot of time, this is the tutorial for you 🔥🔥🔥
The Software
In order to get the most usefulness out of a terminal in Windows, you will need some additional software. To kick things off, I will start with the easy things and then go more in-depth bits as we progress. To apply the changes within this guide, you will need these prerequisites installed:
If you are unsure of how to install any of the software listed above, the good news is that I have also created a walkthrough video detailing the steps. This video is available here. If you encounter any issues installing any of these things, read/watch that guide💥
Zsh and Oh My ZSH
After installing Ubuntu, you can switch from using the Windows command prompt as your default terminal to bash. Bash is a better option for most developers as it will give you more controls and power compared to normal Windows and even Powershell
Even though Bash on its own is pretty good, your shell can be further enhanced to make it even more useful. Nowadays, a majority of Linux users favour Zsh and Oh My Zsh instead of Bash. The syntax between Zsh and Bash is pretty indistinguishable. The real benefit of switching to Zsh is Oh My Zsh 🤔
Oh My Zsh is an extension to Zsh that will allow you to easily customise your prompt to add themes, plugins and shortcuts. Through the Oh My Zsh config file, it makes it easy peasy to add some pretty cool customisations!
Installing Zsh and Oh My Zsh is easy enough. The first step towards terminal greatness is to install Zsh. After Zsh we can install Oh My Zsh and then pimp up our prompt 💁👌🎍😍
Step one is to use apt-get
to install these packages:
With ZSH installed, you can then set it as your default shell using this command:
The next step is to install Oh My Zsh. We can install Oh My Zsh using Curl. If you haven't got Curl installed locally, you can install it with this command:
With Curl installed, you can now install Oh My ZSH:
Make The Zsh Shell More Productive With A Theme And Some Plugins
If you look at your shell immediately after installing Zsh and Oh My Zsh its appearance might be improved slightly, however, it is not great. You can configure how Oh My ZSHlokos and feel within a config file called .zshrc
. You can edit this file using this command:
Oh My Zsh has lots of useful plugins and themes. After you pick the items you are interested in, it is possible to manually install these items inside of .zshrc
. We as developers are busy peeps, we don't have time to manually install things, we demand ease!
The easiest way to install and manage Oh My Zsh plugins is via a package manager. The package manager will do all the heavy lifting for you. There are a few available package managers for Oh My Zsh, a good one and the one I use is called Antigen . One of the main reasons why I like Antigen is its ability to install these as well as plugins. To install Antigen, make sure you are in your root folder (\
) within a terminal. YOu can install antigen in any folder, it's just the script below will throw an error on this line source ~/antigen.zsh
line. You can install Antigen with this command:
After installing Autogen, we can then install some plugins and themes. The Oh My Zsh plug-ins that I recommend you checkout and install are:
You can install off of these really easy just using either the antigen bundle
or antigen theme
command. You can install the three plug-ins above by adding this config to the end of your .zshrc
. Note this will also install the git
module and a theme called avit
:
After making this change and updating .zshrc
, you will need to reload your shell. You can do this using this command:
TMUX
We now have a nicer looking shell, however, we have yet to super-charge its functionality. One of the simplest ways to level up your terminal experience is to install TMUX. TMUX is a program that has lots of features, however, the one you should really care about is the quick and easy ability to create spit panels within a single terminal window. Need to run your app, have a terminal to push your code into GIT, as well as run your unit tests, TMUX has you covered 💥
INstalling TMUX is super simple, type this:
apt install tmux
One issue is that the default keyboard shortcut for TMUX is a pain in the ass to remember. Over the years I have tried to use TMUX but always found these shortcuts were the reason why I gave up on it. This all changed after I changed the default keyboard aliases. After installing TMUX, I recommend that you remap the commands to make them super easy to remember. Doing this will help you get the real benefit from TMUX. In order to customise TMUX, you need to edit .tmux.conf
. You can do this using this command:
TMUX has lots of useful features, the main reason I recommend TMUX is the ability to create panes within a single terminal window. The TMUX default shortcut key is a pain to remember, this is why I recommend this configuration:
Cntrl
+⬆️
andCntrl
+⬇️
to create a new vertical paneCntrl
+➡️
andCntrl
+⬅️
to create a new horizontal paneAlt
+ (⬆️
or➡️
or⬇️
or⬅️
) to move between the shellCntrl
+ `x to kill a terminal Window
To do this you can use these shortcut keys: `
If you use the terminal a lot, the beeps and bells that are made whenever you make a mistake are VERY annoying. If you want to disable these annoyances, you can add this extra config within .tmux.conf
:
You can also enable the mouse with this config:
TMUX Plugins and Package Manager
The next step in this journey is to customise the TMUX with some plugins. Just like Oh My Zsh you can install plugins to get extra useful features. Also, just like Ok My Zsh, the easiest way to install plugins is to use a package manager
TMUX also has a number of plugins you can install. The easiest way to install these packages is via the TMUX package manager. The package manager for TMUX is called TMP. To install it use this command:
You can then add this line to the bottom of the TMUX config file .tmux.conf
:
With the package manager installed, all you need to do is add references to the plugins you want to install and job done. You can find a complete list of plugins that you can install here. The extensions that I recommend you install are:
- tmux-continuum: Continuum will automatically save you session state
- tmux-resurrect: Resurrect will restre your session state if your computer is reset
- tmux-sidebar: Press
Cntrl
+\
to get a menu to do all sorts of TMUX options. Handy so you do not need to remember loads of shortcuts - tmux-weather: Adds weather information into the status bar
To install these plugins, this is the config you would need to add within .tmux.conf
:
I listed the TMUX weather plugin above, however, what does it do? This plugin will add local weather information to the status bar. This raises the question, WTF is the TMUX status bar?
⚠️⚠️ IMPORTANT⚠️⚠️: None of the plugins will load unless you do a Hit prefix + I to fetch the plugin and source it. That's it!
Also, while getting this working you may want to reload the config a lot. To make life easier, you can create a binding.
As my binding is Control
+ Z
. The reason why I picked Z
to reload the config is that it's right next to CTRL
on the keyboard, making it super quick 💨💨💨.
If you want to do the same, the command you need to add is shown below:
The status bar is that little green stripe at the bottom of the terminal. It is pretty unremarkable and missable With some plug-ins and a little bit of the custom configuration, you can make the status bar look lot nicer and display more useful information.
IMAGE
There are loads of different ways of configuring how the status bar looks. You can do it yourself and spend ages tweaking it, or, you can copy config yourself from someone who spent ages at it. I recommend the second approach. There's some good example config in this article. The final complete .zshrc
looks like this:
The final tmux.config
file:
With all these combined, you should now have a pretty kick-ass terminal 🔥🔥🔥
Happy Coding 🤘