Use xterm-256color With Alacritty For Better ls Output

Written By: Jake Bauer | Posted: 2020-08-05 | Last Updated: 2020-08-05

In switching to alacritty, I noticed something off about my ls output. Previously, when I was using st, ls would highlight different files in different colours. For example, image files would be bold and purple and other files like .deb. or .zip files would be bold and red. Here is an example:

A
    screenshot of a terminal where ls shows media files highlighted in purple
    and .deb files in red.

As opposed to what I was encountering:

A
    screenshot of a terminal where ls shows every non-folder and non-executable
    with default colours (i.e. non-bold white)

Which is what you get if you use a TERM variable set to alacritty in your alacritty.yml while you have another TERM variable set in .profile. Since changing that variable in my alacritty.yml file to xterm-256color and removing it entirely from my .profile, the highlights have returned.

It would seem that the terminfo for alacritty is not in the default installations for any of the systems I use (Debian and OpenBSD, at the moment) nor is it included in the .deb package I grabbed from their GitHub releases page. Therefore, setting the TERM variable to alacritty in alacritty.yml without having anything in .profile actually results in an almost completely broken terminal experience where there are no colours by default and SSH sessions do not behave well unless I export TERM=xterm-256color beforehand.

Also, Alacritty 0.5 is out which includes a new Vi mode!

This is my eighty-fifth post for the #100DaysToOffload challenge. You can learn more about this challenge over at https://100daystooffload.com.