tmux: fix truecolor in tmux

So story time, I discovered :checkhealth in Neovim, and it gave a fairly
decent explanation of how to fix terminal truecolor support.

Namely, use `tmux-256color` (or `screen-256color`) for the
default-terminal, then force truecolor (Tc) in the terminal-overrides

It also mentioned that `focus-events` needs to be enabled for n/vim to
detect changes to its buffers. Notably, this allows vim to rerender
changed content when switching into a tmux pane containing a vim
session.
This commit is contained in:
Paul Stemmet 2022-09-10 07:19:01 +00:00
parent 138e66f245
commit c815f5aa25
Signed by: Paul Stemmet
GPG Key ID: EDEA539F594E7E75
1 changed files with 7 additions and 3 deletions

View File

@ -27,10 +27,14 @@ set -g status-right '#T #[fg=yellow,bold]#(uptime -p)#[default] #[fg=cyan,bold]%
set -g set-titles on
setw -g aggressive-resize on
setw -g monitor-activity on
# The following three makes italics work in tmux
set -g xterm-keys on
set -g default-terminal "xterm-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# Correctly set up terminal for truecolor support
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ',xterm-256color:Tc'
# Fix :h 'autoread' in Vim
set -g focus-events on
# Refresh status line every 5 seconds
set -g status-interval 5