How to customize your terminal!
Intro
This is a tutorial-type of blogpost, sorry for being away so long, but there’s a lot of blogposts coming to your way, so expect some new ones!
What we want to achieve in this tutorial:
- To have a fast terminal emulator
- To have a better shell with auto-completition
- To have a cool-looking with color scheme terminal
So let’s start with that!
Alacritty, the fastest openGL terminal emulator
Alacritty is the fastest terminal emulator out there, and the best of all is that is cross-platform! so you can install it on windows too! Although this guide is more toward linux users but if you are here from windows you can follow along too!
Fish, the friendly interactive shell from the 90’s
Fish is a smart and user-friendly shell for every unix-like OS, it offers:
- Autosuggestions
- Sane Scripting
- Tab completitions and syntax highlighting
And a lot more! Overall, is the way to go, time to go fishing
Neovim, Hyperextensible Vim-based text editor
Neovim being a vim-based editor is not for everyone, since navigating vim is not the easiest task of all, but neovim what it does is to take vim (VI-iMproved, since vim is a fork from VI) and eliminates all the deprecated and legacy packages (30% less code base than vim), then improve it even more with plugins, extensions, and more!
Is a beutiful text-editor, one of my favourites!
Nerd Fonts, the best fonts to code with!
Nerd fonts are fonts designed for coding in mind, and it has icons as text that is the awesome part, since we are going to use those icons for customizing our terminal
Bat, the cat with wings!
bat
is cat
but with super powers, with syntax highlighting and supports git integration, and it displays it’s text in a well readable format, once you go bat you never go back!
Install Alacritty, Fish, Bat and Neovim
Ubuntu/Debian:
sudo add-apt-repository ppa:aslatter/ppa && sudo add-apt-repository ppa:fish-shell/release-3
That is to add the personal package archives, that is a personal repository where you can download software from the owner of the software, being the latest version and overall better, in this case from alacritty and fish devs.
sudo apt update && sudo apt install alacritty bat fish neovim -y
This will refresh the repo list and install it!
Fedora/RHEL:
sudo dnf install alacritty bat fish neovim
Easy isn’t it?
Arch (btw):
sudo pacman -S alacritty bat fish neovim
You already know.
Uninstalling Alacritty, Fish, Bat and Neovim
This is the case if you don’t like it
Ubuntu/Debian:
First, remove the software:
sudo apt remove --auto-remove alacritty fish bat neovim
Then, the PPA’s
sudo add-apt-repository --remove ppa:aslatter/ppa && sudo add-apt-repository --remove ppa:fish-shell/release-3
Fedora/RHEL:
sudo dnf remove fish alacritty bat neovim
Arch (btw):
sudo pacman -R alacritty fish bat neovim
Installing nerd fonts!
You can go to the official nerd fonts github and follow their installation guides or use a bash script I created for installing nerd fonts the easiest way!
Download the bash script
1wget https://github.com/DarthNeder/nerdy/releases/download/v1.0.0/nerdy && bash nerdy -h
This will download the script and run the help command so you can see the usage of the script
Install some fonts! Is just as easy to
1bash nerdy RobotoMono
This means you are installing RobotoMono nerd font on your system! If you are not sure which one to install you can go to programming fonts and decide which one to install!
After installing nerd fonts, neovim, fish and alacritty, time to configurate them!
Hacking alacritty
First in your new terminal we are going to create the alacritty.yml
file, this is the configuration file,
and is going to be store in ~/.config/alacritty/
.
So now this is what we are going to do:
1$ cd
2$ mkdir .config/alacritty
3$ nvim .config/alacritty/alacritty.yml
(The first cd
was for changing directories to your home folder)
Now, before we get into the code, just for reference you can see this alacritty config to take for example, and the arch wiki since it has a nice page explaining about it.
Running fish as our default shell
1shell:
2 program: /bin/fish
This means everytime alacritty is going to open is running the fish shell.
Remember the YAML Is the format used to configure alacritty, in key-value pairs.
Running nerd fonts as our default font
First of all check the family name of your font by running this command:
1fc-list | grep Hack
Being Hack replaced with your font’s name, once you know that time to create the font table like this:
1font:
2 normal:
3 family: RobotoMono Nerd Font
4 style: Regular
5
6 bold:
7 family: RobotoMono Nerd Font
8 style: Bold
9
10 italic:
11 family: RobotoMono Nerd Font
12 style: Italic
13
14 bold_italic:
15 family: RobotoMono Nerd Font
16 style: Bold Italic
17
18 size: 9.0
Specifying the font family and the size of it, if you want, (I know you do) we can specify the padding of the prompt and the background opacity of it
1background_opacity: 0.75
2window:
3 padding:
4 x: 4
5 y: 4
And we are done with alacritty and fish!
Now we are going to install starship to beutify our prompt and plus is written on rust!, then there’s exa that is the new replacement for the ls
command.
Installing starship and exa
For starship:
Just run the installer:
1bash sh -c "$(curl -fsSL https://starship.rs/install.sh)"
2## if you are in fish, if not just run without `bash` at the beginning
and add this to the config.fish, that is located in ~/.config/fish/config.fish
1# ~/.config/fish/config.fish
2
3starship init fish | source
Side note:
If you don’t like the “welcome to the fish shell!” greeting message, you can delete it by so:
set -g fish_greeting
writing this in config.fish
.
More docs…
For exa:
Ubuntu/Debian: sudo apt install exa
RHEL/Fedora: sudo dnf install exa
Arch Linux (btw): sudo pacman -S exa
And that’s it! now you have starship and exa in your terminal!
Now replace cat
and ls
with aliases:
In config.fish
:
1alias ls="exa -la --icons"
2alias cat="bat"
Now last but not least final step…
Theming Alacritty
First of all let’s install node.js that makes running javascript on the backend possible!
Ubuntu/Debian: sudo apt install nodejs
RHEL/Fedora: sudo dnf install nodejs
Arch (Btw): sudo pacman -s nodejs
Now let’s install alacritty themes!
1npm i -g alacritty-themes
If you get npm errors, try to update npm:
npm update
Now the moment of truth!
Just run the script!
alacritty-themes
and select the theme you like and enjoy!