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.
Related
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
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 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'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.
I'm having difficulty getting my colorscheme to change. I've opened both ~/.vimrc and /usr/share/vim/vimrc and added:
colorscheme desert
...and nothing. I noticed the color schemes are here:
/usr/share/vim/vim72/colors/desert.vim (...along with a bunch or others)
which seems like the wrong place so I:
cp /usr/share/vim/vim72/colors/desert.vim ~/.vim/colors/
and still no go.
Try setting your terminal colours in your .bashrc/.bash_profile to:
export TERM=xterm-256color
& in your .vimrc
let g:"your_colourscheme"_termcolors=256
& that should stick. Bit of a kludge I know but it should work.
Saves typing
:colorscheme whatever everytime you start Vim
Custom colorschemes should go in ~/.vim/colors/, and adding the colorscheme line in your ~/.vimrc should work. So it sounds like you're doing that right.
Double-check that you don't have some other colorscheme line lower down in your vimrc or in an included config file that might be overriding it.
Also double-check that your .vimrc is being loaded as expected. One easy way to tell is by trying to load a nonexistant colorscheme name - if the line is being parsed, then you should get an error like:
E185: Cannot find color scheme foobarbaz
If your colorscheme line is being correctly parsed, you need to check if your terminal is correctly configured to display the colors.
The situation with terminals is a mess when it comes to colors and fonts. It is quite probable that your terminal emulator (gnome-terminal? kterm?) and vim aren't using the same encodings for colors, or one is partially overriding the settings of the other. When it comes to the eternal war between console apps and modern colors and font rendering, your three options are:
Side with the old school, switch to xterm or rxvt, where the colors are more likely to just work, but got help you if you want antialiased fonts.
Side with the new school, sidestep the console entirely and use gvim, where fonts and colors will likely both just work.
Get caught in the middle and forever fight with getting fonts and colors to work properly for old console programs running in new terminal emulators, i.e. gnome-terminal, kterm, etc...
apt-get install vim or yum install vim <-- need full vim vs mini vim
ls /usr/share/vim/vim ##/colors <-- ## 72 or 73, etc list color schemes
cd ~
vi .vimrc
# Add the following two lines if the don't exist
syntax on
colorscheme elflord
# replace elfloard with what ever color scheme you like
If you are using vim-tiny in Ubuntu (the default one). Try to install vim-nox, vim-gtk or vim-gnome.
make sure that you are enabling syntax with :syntax enable.
Currently, using Ubuntu and VIM 8, I did this:
Browse to your user directory:
cd ~
Create and open a .vimrc file:
vim .vimrc
Click i for insert mode.
Type the following command below to enable syntax and give a specific colorscheme. This example uses the desert colorscheme:
syntax on
colorscheme desert
Hold Shift and hit : then type wq! to save and quit the file.
You should now be able to use vi and the colorscheme you choose to edit files on your Grid.
Below the default set of colour schemes for Vim 8:
blue
darkblue
delek
desert
elflord
evening
industry
koehler
morning
murphy
pablo
peachpuff
ron
shine
slate
torte
zellner