Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lose vim colorscheme in tmux mode

People also ask

How do I change my color scheme on tmux?

How to toggle between light-background and dark-background themes in tmux. Now Ctrl + b Shift + t toggles between light and dark mode. You might want to add more lines to the script to change other options like pane-border-style and pane-active-border-style (the colours of the pane borders) between light and dark mode.

How do I change the Colorscheme in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

Where does Vim install Colorscheme?

To install a new color scheme for Vim, you will need to download it from the git hub repository. Here I am going to download a vim theme “Monokai” from the Git repository. For Monokai color scheme, open the following link, then right-click and save it as . vim in your Downloads directory.

What is Vim default Colorscheme?

The default Vim color scheme in a light terminal is peachpuff . If you use a dark terminal, the initial color scheme is ron .


I had the same problem. Only difference was I am using solarize rather then molokai.

To fix the issue, I have set up an alias in ~/.bashrc:

alias tmux="TERM=screen-256color-bce tmux"

And set up the default-terminal option in ~/.tmux.conf:

set -g default-terminal "xterm"

Lastly, do $ source ~/.bashrc to load new alias.


I tried all the solutions above and what finally worked for me is putting the following lines in .tmux.conf:

set -g default-terminal "xterm-256color"

As @romainl mentions above, I needed to force tmux to use 256 colors by adding the -2 flag:

$ tmux -2

I added alias tmux='tmux -2' to my bash_profile, so, I don't forget :)


I just discovered why I was having a lot of confusion. I, like others here, was having a difficult time getting the default-terminal setting to take effect. I remembered that I had a tmux session in the background. I re-attached my session, closed out my processes, and closed ALL tmux processes. The next time I restarted tmux the default-terminal setting in .tmux.conf began to take effect. I don't know if others are doing this as well but I recommend closing all tmux processes before modifying the .tmux.conf file.

I got my setup to work on my local machine (OSX 10.9.5 with iTerm2) without any modification to .bashrc or .bash_profile. All I did was add the line set -g default-terminal "xterm-256color" to ~/.tmux.conf and restarted all tmux processes.

I got my remote setup (ssh to Ubuntu 14.04) to work exactly the same way without any modifications to .bashrc. I simply added set -g default-terminal "xterm-256color" to ~/.tmux.conf on my remote machine and restarted all remote tmux processes.

You can test what Vim is seeing by doing echo $TERM from within a tmux session. It kept saying screen as the value until I restarted all tmux processes, at which point it reflected xterm-256color as expected.

Hope that helps.


So this a bit on the stale side, but it's might be worth mentioning that using screen will often break the Home and End keys. Using

export TERM="xterm-256color"

in should keep the functionality of these and allow the color scheme (or powerline) to work fine.