[vim/vim] using tmux breaks vim's colors and termguicolors (#3608)

912 views
Skip to first unread message

Vedant Roy

unread,
Nov 13, 2018, 7:07:21 PM11/13/18
to vim/vim, Subscribed

I am using Ubuntu 18 LTS, with gnome-terminal.

Normally - set termguicolors does its job by generally enhancing the look of VIM. However, if I use tmux, then VIM looks off and "set termguicolors" completely breaks all highlighting.

Note - I'm not using a colorscheme, this just my terminal's color scheme.
Before termguicolors:
before_termguicolors
After termguicolors:
after_termguicolors

However, tmux breaks set termguicolors

Before termguicolors (tmux):
before_termguicolors_tmux

After termguicolors (tmux):
after_termguicolors_tmux


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Vedant Roy

unread,
Nov 13, 2018, 7:10:18 PM11/13/18
to vim/vim, Subscribed

Solution:

Add the following lines before "set termguicolors" into my .vimrc:

" This is only necessary if you use "set termguicolors". It ensures the last screenshot does not occur
let &t_8f = "<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "<Esc>[48;2;%lu;%lu;%lum"

" fixes glitch? in colors when using vim with tmux
set background=dark
set t_Co=256

Vedant Roy

unread,
Nov 13, 2018, 7:10:19 PM11/13/18
to vim/vim, Subscribed

Closed #3608.

Akash Kumar Dutta

unread,
May 26, 2021, 3:53:48 PM5/26/21
to vim/vim, Subscribed

With the latest tmux version next-3.3, I did not need to make any changes in vimrc (I kept termguicolors only enabled), but added the following in tmux, and it worked for me:

# tmux colors
set -g default-terminal "xterm-256color"
set -ag terminal-overrides ",xterm-256color:Tc"


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
May 28, 2021, 4:23:51 PM5/28/21
to vim/vim, Subscribed


> With the latest tmux version next-3.3, I did not need to make any changes in vimrc (I kept termguicolors only enabled), but added the following in tmux, and it worked for me:
> ```
> # tmux colors
> set -g default-terminal "xterm-256color"
> set -ag terminal-overrides ",xterm-256color:Tc"
> ```

Assuming this will work for most users, let me add this in the help,
where cterm colors are explained:

*tmux*
When using tmux you may want to use this in the tmux config: >

# tmux colors
set -g default-terminal "xterm-256color"
set -ag terminal-overrides ",xterm-256color:Tc"

Let me know if something needs to be changed.

--
Be nice to your kids... they'll be the ones choosing your nursing home.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Maxim Kim

unread,
May 29, 2021, 6:45:32 AM5/29/21
to vim_dev


пятница, 28 мая 2021 г. в 23:23:51 UTC+3, Bram Moolenaar:


*tmux*
When using tmux you may want to use this in the tmux config: >
# tmux colors
set -g default-terminal "xterm-256color"
set -ag terminal-overrides ",xterm-256color:Tc"

Let me know if something needs to be changed.



This works for me too (on debian):

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

 

Bram Moolenaar

unread,
May 29, 2021, 11:57:42 AM5/29/21
to vim...@googlegroups.com, Maxim Kim

Maxim Kim wrote:

> > *tmux*
> > When using tmux you may want to use this in the tmux config: >
> > # tmux colors
> > set -g default-terminal "xterm-256color"
> > set -ag terminal-overrides ",xterm-256color:Tc"
> >
> > Let me know if something needs to be changed.
> >
> >
> >
> This works for me too (on debian):
>
> set -g default-terminal "tmux-256color"
> set -ag terminal-overrides ',*:RGB'

OK, so which one of the two should we recommend?

--
When I look deep into your eyes, I see JPEG artifacts.
I can tell by the pixels that we're wrong for each other. (xkcd)

Maxim Kim

unread,
May 29, 2021, 12:10:26 PM5/29/21
to vim_dev


суббота, 29 мая 2021 г. в 18:57:42 UTC+3, Bram Moolenaar:

Maxim Kim wrote:

> > *tmux*
> > When using tmux you may want to use this in the tmux config: >
> > # tmux colors
> > set -g default-terminal "xterm-256color"
> > set -ag terminal-overrides ",xterm-256color:Tc"
> >
> > Let me know if something needs to be changed.
> >
> >
> >
> This works for me too (on debian):
>
> set -g default-terminal "tmux-256color"
> set -ag terminal-overrides ',*:RGB'

OK, so which one of the two should we recommend?

 
I guess it depends on what terminfo is more common to be installed by default:


quote>

> The newest version of ncurses ships with a tmux-256color terminfo entry (the FAQ does mention this).
> As an example, a benefit of using tmux-256color over screen-256color is that italics is properly rendered (screen doesn't support italics).

> So if you are using tmux 2.6 or above, and have the latest ncurses package, the following will work as well:

> set -g default-terminal "tmux-256color"

Maxim Kim

unread,
May 29, 2021, 1:35:45 PM5/29/21
to vim_dev

Bram Moolenaar

unread,
May 30, 2021, 10:43:57 AM5/30/21
to vim...@googlegroups.com, Maxim Kim
Thanks, I'll include those links.

--
TIM: To the north there lies a cave, the cave of Caerbannog, wherein, carved
in mystic runes, upon the very living rock, the last words of Olfin
Bedwere of Rheged make plain the last resting place of the most Holy
Grail.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

norogoth

unread,
Sep 27, 2021, 11:14:16 AM9/27/21
to vim/vim, Subscribed

@vedantroy life-changing oh my gosh. My vim looks so much nicer.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Reply all
Reply to author
Forward
0 new messages