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"
Related
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
I've googled it for hours but I can't find a solution.
I use raspian, on a raspberry pi and I want to have colorscheems work on it.
Default terminal in raspian seems to be set at 8 colors as when I enter
tput colors
I get 8.
I'm sure there must be a way to have the term work with 256 colors but I don't know how. Anyway I set tmux in the config file to support 256 colors, so I created a .tmux.conf file in my home directory and have
set -g default-terminal "screen-256color"
now if I check with tput within tmux I get 256.
Anyway I know you can set VIM to force think you support 256 color by adding
set t_Co=256
but this seems to make no actual change.
If I run this color test
:runtime syntax/colortest.vim
in normal terminal from raspian I get only 8 different colors. If I do this on tmux I get more but not all of them because some of them (red and lightred for example) still look the same.
did you add set t_Co=256 after the line colorscheme <yourColourScheme>? That was a problem I had early on.
Let me know if you're still having trouble, because I managed to solve a similar problem (only I'm using MobaXterm and GNU screen), and wouldn't mind the excuse to dig into this a bit more.
I was having a similar problem and have solved it with the following setup. .zshrc on my OSX laptop contains:
TERM=xterm-256color
after I ssh into raspbian, tput colors returns 256. On raspbian, I don't have TERM explicitly set (which means it pulls it from ssh), and have the following in .tmux.conf:
set -g default-terminal "xterm-256color"
Then after I do tmux (and I don't even need the -2), tputs colors still reports 256 colors and vim looks right. I am using vanilla solarized with no edits in .vimrc or elsewhere in the vim configs.
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
I'd really like to get in on all the colorful goodness of the solarized colorscheme, but I can't seem to get it configured just right.
I have the main solarized file in my .vim/colors folder, I've set my terminal profile colors to what is listed on the site, and I've added the lines
set background=dark
let g:solarized_termcolors=16
colorscheme solarized
to my .vimrc file, but Vim looks greyed out and is using a bright green color as the default. How can I do it?
Here's my recommendation for things to try:
ensure syntax on is in your .vimrc file
Check what t_Co Vim has picked up from your term emulator (a quick :echo &t_Co). If it's 8, you'll want to se t_Co=16. You might also try se t_Co=256 though without let g:solarized_termcolors=16 this will use the 256 fallback mode, which isn't quite the correct color scheme.
set t_Co=16 and let g:solarized_termcolors=16 did not work for me. This is what worked:
syntax on
let g:solarized_termcolors=256
set t_Co=256
set background=dark
colorscheme solarized
I found out how do do it from this article.
I wrote the following script to do the gnome-terminal stuff.
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#00002B2B3636"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#838394949696"
If you are trying to use Vim with solarized inside of tmux, this is the fix for your issue:
Fix solarized theme in tmux
Trying it out myself, it seems to work better without the
let g:solarized_termcolors=16
Setting it to 16, I get the bright green color you seem to describe. Maybe try leaving it at the default of 256?
This doesn't, however, perfectly mimic the colors from the screenshots (although the light version looks fairly close). I only get the colors with the screenshot if I use gVim.
I didn't use the terminal profile colors provided, however, so you may get a different result.
For the copy and paste lovers, this is how you install the solarized Vim colorscheme on Ubuntu:
sudo apt-get install wget unzip curl
cd
wget http://ethanschoonover.com/solarized/files/solarized.zip
unzip solarized.zip
mkdir .vim
mkdir .vim/colors/
mv solarized/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/
cp .vimrc .vimrc.old
echo "syntax enable" > .vimrc
echo "set background=dark" >> .vimrc
echo "colorscheme solarized" >> .vimrc
curl https://raw.github.com/seebi/dircolors-solarized/master/dircolors.256dark > ~/.dircolors
source .bashrc
rm -r solarized
rm solarized.zip
And presto.
From the README (emphasis mine):
IMPORTANT NOTE FOR TERMINAL USERS:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI
version like gvim or macvim), please please please consider
setting your terminal emulator's colorscheme to used the Solarized
palette. I've included palettes for some popular terminal emulator as
well as Xdefaults in the official Solarized download available from
[Solarized homepage]. If you use Solarized without these colors,
Solarized will need to be told to degrade its colorscheme to a set
compatible with the limited 256 terminal palette (whereas by using
the terminal's 16 ansi color values, you can set the correct, specific
values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work
out of the box for you. If you are using a terminal emulator that
supports 256 colors and don't want to use the custom Solarized
terminal colors, you will need to use the degraded 256 colorscheme.
To do so, simply add the following line before the colorschem solarized line:
let g:solarized_termcolors=256
Again, I recommend just changing your terminal colors to Solarized
values either manually or via one of the many terminal schemes
available for import.
Simply selecting Solarized for both "Text and Background Color" (choose light or dark) and "Palette" in Terminal → Preferences → Profiles → (select yours) → Edit → Colors worked for me on Ubuntu 16.04 (Xenial Xerus) with the included Terminal application.
Some other answers recommend choosing a 256 color palette but, as mentioned in the documentation, this gives you a degraded (and visibly worse in my opinion) color scheme.
This worked for me for exherbo
git clone https://github.com/sigurdga/gnome-terminal-colors-solarized
cd gnome-terminal-colors-solarized
sh install.sh -s dark -p <my_current_profile>
256 colors in vim may also help