LoginSignup
51
27

More than 3 years have passed since last update.

tmux 上で Vim を True Color (24 bit color) で使う

Last updated at Posted at 2016-12-14

Vim には、termguicolors というオプションがあり、端末上でも True Color を使用することが出来ます。

set termguicolors

tmux 上で Vim を使う場合

tmux で True Color を用いる場合、以下のような設定をします。
コメントに @ttdoda さんによる terminal-overrides の解説がありますのでそちらも御覧ください

set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"

TERM=screen-256color を設定した場合、Vim でも追加の設定が必要です。
:h xterm-true-color を参照すると解説が書いてあります。

set termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

TERM=xterm-256color の場合は、t_8ft_8b はデフォルトの値が設定されるようです。

環境

  • iTerm 2 3.0.12
  • tmux 2.3
  • MacVim 8.0.124

調べた動機

以下のツイートを見かけて調べてみました。

51
27
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
51
27