Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pocco81/2ea37d5b1e31ce068d98774e907096d0 to your computer and use it in GitHub Desktop.
Save pocco81/2ea37d5b1e31ce068d98774e907096d0 to your computer and use it in GitHub Desktop.
True Color and Italics w/alacritty + tmux + vim

This should make true-color and italics work in your tmux session.

Tested successfully in bash and zsh with latest packages from Arch (with exception of Neovim from Git) 20019-07-07.

Notes

  1. Don't use &t_8f and &t_8b in your vim config
  2. Don't set $TERM in your zshrc, bashrc, etc. Let your terminal set this. So far xterm-256color has worked best for me.

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

Configuration files

Alacritty

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

env:
  TERM: xterm-256color

Tmux

In ~/.tmux.conf

This also works in other terminals

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

Vim

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

set termguicolors

You might have to set your colorscheme after this entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment