I installed dracula colorscheme in neovim and configured tmux to use 24-bit color.
Outside of tmux everything works well, but when i enter vim inside of tmux, background changes.
Note: nothing changes except background.
Same issue appears in all colorschemes i tried.
In my init.vim file i have:
set termguicolors
without tmux
with tmux
Related
I am having an issue with tmux and vim where the background colors differ, but only when I am ssh'd into another machine. No solutions for posted questions I've found so far have worked for me.
On the left is my local machine, the right is when I'm ssh'd into my devbox. This is one tmux session.
On both machines:
TERM is set to "screen-256color"
using bash
.vimrc contains set term=screen-256color
.tmux.conf contains set -g default-terminal "screen-256color"
I'm using Gnome. The background color in tmux when I'm in ssh and just using the cli is normal, this only occurs when I open vim and it returns to the normal color scheme when I exit.
I was able to resolve this by using colo default in my .vimrc. I was tunnel visioned convinced it was a tmux issue, and completely forgot vim was sourcing a system .vimrc on the remote box.
I'm somewhat new to Vim and NeoVim, so I installed the plugins and started up NeoVim and for some reason the 256 colors are not showing on NeoVim, instead I get this,
I'm using Konsole on KDE linux to run NeoVim and my NeoVim init file looks like this after loading the plugins before these lines,
syntax on
set encoding=utf8
set t_Co=256 "Explicitly tell vim that the terminal supports 256 colors"
colorscheme base16-solarized
My $TERM variable is xterm.
How can I fix this? Thanks.
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 have an issue where my tmux status bar colour scheme changes after opening Vim and I would prefer it not to.
My tmux status bar colour scheme works fine by itself. See the following image for an example:
...notice the white bar and the blue/black/red sections of the status bar as well, this is all as expected and you can see the settings for this here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.tmux.conf#L78-L86
When I open Vim inside tmux the status bar colour scheme is overridden by Vim's colour scheme (Tomorrow Night). See the following image for an example:
And when I close Vim the tmux status bar colour scheme stays changed. See the following image for an example:
Again, even if there wasn't a way to prevent Vim from overriding the tmux status bar colour scheme while Vim was open I'd prefer it if there was a way to change the tmux status bar colour scheme back to normal when Vim was closed.
I've tried checking the $TERM env var and it seems it is always set to screen-256color. For example...
echo $TERM (tmux only) == screen-256color
echo $TERM (Vim only) == screen-256color
echo $TERM (Vim inside tmux) == screen-256color
echo $TERM (tmux only, but after opening Vim) == screen-256color
My .zshrc file has the following setting: export TERM="screen-256color" you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.zshrc
My .vimrc file has the following setting: set background=light and colorscheme Tomorrow-Night you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.vimrc
My .tmux.conf file has the following setting: set -g default-terminal "screen-256color" you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.tmux.conf
The following is my software set-up:
Mac OSX 10.9.2
Standard Mac Terminal.app (I don't use iTerm)
tmux 1.9a (installed via Homebrew)
Vim 7.4 (installed via Homebrew)
Does any one have any suggestions on how to resolve this issue? I'm hoping it's I'm just missing a setting somewhere in the .tmux.conf file to say "don't allow your colours to be overridden" or "when vim is opened, reapply tmux status bar colour scheme".
Any help greatly appreciated. Thanks.
I didn't go deep into your vim config, but in your plugin list I found tmuxline, This plugin applies your vim *-line color theme on your tmux status line. very likely it doesn't restore your original tmux color settings when you exit vim.
try to disable the plugin and see if it helps.
I'm struggling to make the Solarized colorscheme correctly working on an Ubuntu 13.10 machine inside Vim inside tmux inside the gnome-terminal.
I've started configuring gnome-terminal using the script on this repository and it displays the colors correctly. The same goes if I run Vim (with the official Solarized colorscheme) inside the terminal, without tmux.
Then I tried to configure tmux using this. It happens that when I run Vim the syntax highlight for php or javascript code is wrong or, at least, different from the one I see running Vim without tmux. I've tried also running tmux as tmux -2. The colors are different, but still the syntax highlight is not correct.
I tested it out and got it working in the following way:
Install gnome solarized colorscheme. You can get it from https://github.com/aruhier/gnome-terminal-colors-solarized.
Install solarized colorscheme for vim. You can get it from https://github.com/altercation/vim-colors-solarized. In .vimrc you should add following settings:
set t_Co=256
set background=dark
colorscheme solarized
Set correct TERM variable by adding following line to your .bashrc/.zshrc
export TERM=screen-256color-bce
Run gnome-terminal, tmux, vim and profit.
These days GNOME Terminal comes with Solarized colours built in. To use it, you need to change two settings in the profile that you're using. The obvious one is the text and background colour. You also need to set the palette to Solarized, though. You can find this setting below the one for the text and background colour. At this point, setting t_Co or g:solarized_termcolors in Vim shouldn't be necessary.
The palette is the part that I missed at first, which caused me to puzzle why the text in Vim and other applications was bright blue.