Does anyone know why when I'm within tmux, the background is darker on the right side and lighter on the left side?
Put
set -g default-terminal "screen-256color" in .tmux.conf
and
xterm-256color in the iTerm 2 settings.
Related
if I echo $TERM from my terminal, I get rxvt-unicode-256color and tput colors shows 256. I like the custom color scheme that I have there as defined in my .Xresources file. However, when I launch tmux -2, things change. echo $TERM shows tmux-256color while tput colors still shows 256, but all text is single color unless I am in vim...and that is even more strange because the color scheme in vim (inside tmux) is different than the color scheme of vim in my regular terminal (rxvt).
Only line that I currently have in ~/.tmux.conf is set -g default-terminal "tmux-256color"
Can someone please help me line these two up to match?
Perhaps you meant
set -g default-terminal "tmux-256color"
rather than
set -g default-termainal "tmux-256color"
I am new to tmux and also not an expert on VIM, I tried to use tmux these days, but seems that airline disappeared when I used vim inside tmux. I would like to show you the screen shots and hopefully anyone can help me solve this problem.
airline in vim
airline inside tmux
You need to correctly set $TERM environment variable to make vim properly detect 256 colors support by doing the following before opening vim:
export TERM=screen-256color
While the accepted answer works, it is not cheap. Manually setting the value of the $TERM variable will usually be set correctly by itself.
It is usually a good a idea to force tmux to assume the terminal supports 256 colors.
In your ~/.bash_aliases, add:
tmux='tmux -2'
Answer based on the following posts:
What is the difference between screen-256 color and xterm-256color
tmux vim colorscheme background is not showing
Add the following line in your .tmux.conf
set -g default-terminal screen-256color
In my case, using ubuntu 20.04 inside windows with WSL2, the accepted answer (export TERM=screen-256color), just freeze the tmux pane.
The fix for me was add to ~/.vim/vimrc:
set t_Co=256
I've been working on moving my development setup to a new Ubuntu based partition from Mac OS.
I'm currently having trouble getting the background to stay solid inside of tmux.
I have TERM set to xterm-256color in my .bashrc and vim works as intended outside of tmux. I have also aliased tmux to "tmux -2" and added
set -g default-terminal "screen-256color"
to my .tmux.conf.
My .vimrc contains:
set t_Co=256
set background=dark
color Tomorrow-Night
I suppose the best way to explain this is with images... Here is the intended look outside of tmux
(Tomorrow-Night colorscheme):
And here is what I am experiencing inside of tmux:
As you can see, the terminal background is bleeding through where there is no text.
Thanks!
I just tried reproducing your setup on my machine and I get a similar problem with the background.
It seems setting TERM to xterm-256color in your .bashrc overrides set -g default-terminal "screen-256color" from tmux and that causes issues. This makes sense as bash is running inside tmux and its setting override those from tmux.
You can easily verify this by running echo $TERM in bash within tmux. With your current setup it will be xterm-256color which is a no-go as Tmux explicitly requires this to be set to screen-256color.
A quickfix to verify this theory is just removing or commenting out a line in your .bashrc where you set TERM and trying things out.
A proper solution would be to have something like this .bashrc:
[ -z "$TMUX" ] && export TERM="xterm-256color"
The above line will:
set TERM to xterm-256color if bash is running standalone (no tmux)
will not override TERM if running inside tmux
When I run vim in tmux, the syntax highlighting works fine except for the visual mode, it works but doesn't change the colors of the selected text, which I find quite annoying.
The problem stays the same even when I switch the colorscheme(I am currently using molokai)
I have the option set t_Co=256 on my vimrc
My .tmux.conf file is the same as the t-williams.conf example(just added the line "set -f default-terminal "xterm"")
I already tried some solutions to problems related to the 256 color support
any tips?
The recommended setting for tmux is
set -g default-terminal "screen-256color"
and you don't need
set t_Co=256
in your ~/.vimrc.
Make sure your terminal declares itself as a 256 color supported terminal (for example, xterm-256color). This will set the TERM in bash, which is read by tmux, and will automatically set the default-terminal setting to screen-256color.
For example, in the Terminal on OS X you can change this in the settings under the "Advanced" tab. The "Declare terminal as" option:
I'm trying to set up base16-tomorrow colorscheme in my Vim, which runs on top of tmux+Putty. I exausted nearly every link on Google to get it working, but nothing happens =S
This is how the colorscheme looks like now:
How it was supposed to be:
The odd part is, no matter which base16 colorscheme I chose, it still looks the same.
Some informations about my shell:
$ echo $TERM # on Putty
xterm-256color # I configured putty to 256 colors and use this identifier
$ tmux
$ echo $TERM
screen-256color
Also, in Vim, t_Co variable is set with 256.
How can I solve this problem?
Despite having this in my .tmux.conf file, it didn't help: set -g default-terminal "screen-256color"
However, this from #xthrd helped me:
Have you tried running tmux with tmux -2 to force 256-color mode?
I had a simular issue with displaying colorschemes in tmux.
Have you tried adding set -g default-terminal "screen-256color" to your .tmux.conf