Terminal Setup with Zsh + Tmux + Dracula Theme
Tags: productivity, linux, ubuntu, bash
Published: 2021-05-18 13:13:49

![Tmux Animation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wj14uwquctgcsvppq83j.gif)

I have just recently improved my terminal setup after learning how to use Tmux. It gave me a way to move faster between projects and even kept my session saved after machine shutdowns. My goal here is to help you configure a environment that will be both beautiful and functional. Let's get to it.

## What we will set up

**Guake**: top-down terminal that can be instantaneously opened with a keystroke.

**Zsh**: an extended Bourne Shell (sh) with many improvements, powerful command line editing options, and support for plugins and themes.

**Oh-My-Zsh**: an open source, community-driven framework for managing your Zsh configuration.

**Powerlevel10k**: a theme for Zsh with interface helpers, such as git current branch and execution time.

**Tmux**: an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window.

**Dracula Theme**: a famous dark theme created by [Zeno Rocha](https://github.com/zenorocha/), a Brazilian developer.

*Note: the following steps are done in Ubuntu. The same result can be achieved in MacOS with iTerm2 as the terminal.*

## Install Guake

When I worked with MacOS I used [iTerm2](https://iterm2.com/), but now on Linux I am using [Guake](http://guake-project.org/) as my default terminal. What I look for is to be able to open the command line in any monitor with a simple  `CTRL + SPACE` shortcut.

So if you're on Ubuntu, just install it with `apt`.

```json
sudo apt install guake
```

**Choose your shortcut**

Go to Preferences → Keyboard Shortcuts and choose your key to Toggle Guake Visibility.

**Change your theme to Dracula**

[Dracula](https://draculatheme.com/) is one of the most famous themes out there. I use it in both terminal and VSCode. Guake already comes with it pre-installed, so go to Preferences → Appearance and choose Dracula as a Built-in scheme.

**Other configs**

You might also want to change the transparency and height of the window. Check out their documentation for [more](https://guake.readthedocs.io/en/latest/user/index.html).

![Screenshot 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qg1qm5r9f3epnda9xei9.png)

## Zsh & Oh My Zsh

Now, let's install Z shell in Ubuntu. 

```bash
sudo apt install zsh
```

For other platforms, please check [this guide](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH).

Set it as your default shell.

```bash
chsh -s $(which zsh)
```

You will have to logout for the changes to take effect.

Again, in Guake go to Preferences → Shell and set your default interpreter to `/usr/bin/zsh`. Restart it and you should see the message below. 

Choose option 0. We will be setting this up with Oh My Zsh.

![Screenshot 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btgbxewae6wx53r1gx46.png)

**Installing Oh My Zsh**

[Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh) is a framework to manage your Zsh configuration, themes, plugins and much more.

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```

After the successful installation you should see the screen below.

![Screenshot 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xzbbv9r6pz5ipwoj8p6.png)

You are now ready to install autocomplete and multiple plugins that will make your life easier. Check out the available plugins at the [documentation](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins).

I suggest you start with the following:

`zsh-autosuggestions`: makes suggestions based on commands you have already made.

`zsh-syntax-highlighting`: enables highlighting of commands while they are typed.

Clone both plugins to your OhMyZsh custom folder.

```bash
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
```

Now, edit your `~/.zshrc` file to include them.

```bash
plugins=(
	git
	zsh-autosuggestions
	zsh-syntax-highlighting
)
```

Restart your Zsh with `source ~/.zshrc`.

![Screenshot 4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69tmy7tzr9c2dnaco5fl.png)

Now, if you start typing, you will see the suggestions and can press the `right arrow key` to quickly autocomplete.

## Powerlevel10k

[Powerlevel10k](https://github.com/romkatv/powerlevel10k) is a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.

**Install the required fonts**

- [MesloLGS NF Regular.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf)
- [MesloLGS NF Bold.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf)
- [MesloLGS NF Italic.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf)
- [MesloLGS NF Bold Italic.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf)

Configure Guake by opening Preferences → Apperance. Then, uncheck "Use the system fixed width font" and select MesloLGS NF Regular. For more details check their guide [here](https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k).

**Clone the repository**

```bash
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```

Then, add powerlevel10k to `~/.zshrc`

```bash
ZSH_THEME="powerlevel10k/powerlevel10k"
```

Restart Zsh with `source ~/.zshrc` and follow the configuration wizard.

![Screenshot 5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/17cqs4ksd4cft7cs41mr.png)

Choose your preferred style in the following screens.

![Screenshot 6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3q8mb8ilqdv1ptijmyov.png)

Apply the changes to your `zshrc` and you're done.

![Screenshot 7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/saxn34r2g808hi0y5doc.png)

You will end up with a result like the one below.

![Screenshot 8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3cq39rnmfc4zjn0gb38.png)

## Tmux & Dracula Theme

In this last section, we will be installing [Tmux](https://github.com/tmux/tmux/wiki) with [Dracula Theme](https://draculatheme.com/tmux). 

```bash
sudo apt install tmux
```

For other platforms, check [this guide](https://github.com/tmux/tmux/wiki/Installing).

Then run it.

```bash
tmux new
```

![Screenshot 9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q124a6mkmsz1skfzazsn.png)

You will notice that we have lost the colors we had before. Let's bring them back with the next configs.

Install [tpm](https://github.com/tmux-plugins/tpm) to handle tmux plugins.

```bash
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
```

Edit `~/.tmux.conf` and put this at the bottom.

```bash
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
```

Reload tmux environment

```bash
# type this in terminal if tmux is already running
tmux source ~/.tmux.conf
```

Now, let's install Dracula Theme as a tpm plugin. Add the following to your `~/.tmux.conf` file. 

```bash
set -g @plugin 'dracula/tmux'

# Set 256 colors
set -s default-terminal 'tmux-256color'
```

Press `<prefix> + I` (capital i) to install it. The default `<prefix>` is `ctrl + b`, so press `ctrl + b + I`.

![Screenshot 10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l16m5bdvm1i9qjfrmt1x.png)

You can now quit tmux by typing `exit` and then create a new session with `tmux new`. You should now have Powerlevel10k running with Tmux and Dracula Theme.

As an extra, install the following plugins to save and restore your tmux sessions any time.

```bash
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
```

And now you should be ready to go! 

![Terminal Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5glgb8epsrjqigc2x9l0.png)

Quick commands:

Remember that the default `<prefix>` is `ctrl+b`.

- Split panes by pressing `<prefix> + %` and `<prefix> + "`.
- Kill panes by pressing `<prefix> + x`.
- Switch panes with `<prefix> + arrow`.
- Create new windows by pressing `<prefix> + c`.
- Switch windows by pressing `<prefix> + number`.
- Rename windows with `<prefix> + ,`
- Zoom in and out a pane with `<prefix> + z`
- Detach with `<prefix> + d` and reattach with `tmux`.

You can check out my configurations at:

- [.tmux.conf](https://gist.github.com/andrenbrandao/701dc935b45666791183eb0948921bb7)
- [.zshrc](https://gist.github.com/andrenbrandao/59ef06962b95769ef3ac6bc6ec621790)

Please, leave a comment telling me what you think about this setup and if you know other ways I can improve it. :)

# Resources

- Guake: [http://guake-project.org/](http://guake-project.org/)
- Oh My Zsh: [https://github.com/ohmyzsh/ohmyzsh](https://github.com/ohmyzsh/ohmyzsh)
- Powerlevel10k: [https://github.com/romkatv/powerlevel10k](https://github.com/romkatv/powerlevel10k)
- Tmux: [https://github.com/tmux/tmux/wiki](https://github.com/tmux/tmux/wiki)
- Dracula Theme: [https://draculatheme.com/tmux](https://draculatheme.com/tmux)