Configure the Alacritty terminal emulator to use a custom font
- Install of Linux (I use arch: https://archlinux.org/)
- xorg/Window Manager (I will use i3 for this example)
- Alacritty Terminal Emulator
- Text Editor (I use Micro, highly recommend for quick edits in the terminal)
1. Choose a font you would like to use in terminal.
You can find examples of most fonts by searching for their name in a web browser. programmingfonts.org also lets you live preview many popular programing fonts.
to see all the fonts currently installed on your system, you can use fontconfig:
Or if you want to check for one font in particular you can use:
fc-match NameOfFont -s
Where ‘NameOfFont’ is the font you’re checking for.
- Most distros provide packages pre-installed for popular fonts.
- There are many fonts available as packages from official distro repositories.
- If you are on Arch Linux, you can find lots of font packages on the AUR. (Including patched Nerd-Fonts)
- If you can’t find a font package you like or want to manually install, you can see my guide here: Install Nerd Font on Arch Linux. Or check out the Arch Wiki.
2. Copy the Alacrity config file over.
When you install Alacritty it comes with a default config file in:
Alacritty will search a few different places for a custom config, but I recommend using:
.config should already be created for your user. To double check you can do ‘cd .config’ from your home directory. Once you are there you can run :
(from ~/.config): mkdir alacritty
to make the alacritty directory.
Now to copy over the default config file run:
cp /usr/share/doc/alacritty/example/alacritty.yml ~/.config/alacritty/
- ‘.config’ in a users home directory is usually the default place for config files and it prevents you from having to search all over the place to find them.
3. Edit the config file
I’m using the micro text editor, but use whichever editor you like to open it:
You’ll want to scroll down in the file until you find the section marked ‘Font Configuration’
Everything is commented out right now. You need to un-comment the lines 105, 107, 114 and 117.
On 114 after ‘family:’ you want to replace ‘monospace’ with the name of the font you want to use.
If you forgot the name, open another terminal and run fc-match from step one. It should look like this:
Once you save the file the font should take effect depending on your window manager/Alacritty settings. If you don’t see the font change over:
- Try restarting the terminal or window manager.
- be sure that you used the correct font name.
- Double check that your spacing is correct in the config, and that you didn’t make any typos. Alacritty is very picky about spacing and you may see an error that the file cannot be read if you use the wrong spacing.
Once the ‘Regular’ style is working you can repeat this process for the ‘Bold’ and ‘Italic’ sections.
- Most fonts have separate files for the bold and italic variations, or they will say ‘Complete’. Complete means that the bold and italic variations are contained in the same file, either way you can just repeat the same family name