Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ellisonleao/b822117385144318e9f33a33beb478c9 to your computer and use it in GitHub Desktop.
Save ellisonleao/b822117385144318e9f33a33beb478c9 to your computer and use it in GitHub Desktop.
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Tested successfully in bash and zsh with latest packages from Arch Linux (with exception of neovim built from source):

  • 2019-07-07
  • 2021-08-07

Notes

  1. Don't use &t_8f, &t_8b and t_Co in your vim config
  2. Don't set $TERM in your zshrc, bashrc, etc. Configure this in your terminal (alacritty).
  3. Alacritty has no undercurl support, even though tmux has

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
bash 24-bit-color.sh

colors

Configuration files

Alacritty

In ~/.config/alacritty/alacritty.yml:

env:
  TERM: xterm-256color

tmux

In ~/.tmux.conf (or ~/.config/tmux/tmux.conf):

set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

vim (neovim)

In ~/.vimrc or ~/.config/nvim/init.vim:

set termguicolors
colorscheme yourfavcolorscheme

or ~/.config/nvim/init.lua:

vim.o.termguicolors = true
vim.cmd'colorscheme yourfavcolorscheme'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment