Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Saturday, January 2, 2016

lose vim colorscheme in tmux mode

lose vim colorscheme in tmux mode


I'm running iterm2 and when I'm in tmux mode the colorscheme I have set in vim does not show up. Only the color scheme I've set in iterm. If I run vim from shell the colorscheme appears correct - its only when I'm in tmux mode.

I've tried setting :colorscheme molokai when in vim (see screenshot below) and it doesn't change - again, the default colorscheme for iterm2 remains.

Am I missing some setting to iterm or tmux.conf? My dotfles are up on github here.

Any help would be grand :)

Answer by tristen for lose vim colorscheme in tmux mode


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 :)

Answer by Seyeong Jeong for lose vim colorscheme in tmux mode


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.

Answer by Jpatrick for lose vim colorscheme in tmux mode


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.

Answer by ElefEnt for lose vim colorscheme in tmux mode


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

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

Answer by Patrick Lewis for lose vim colorscheme in tmux mode


I didn't have much luck trying to export a different TERM or set default-terminal in my .tmux.conf.

My solution for fixing vim colors within tmux was adding this line to .tmux.conf:

set -g terminal-overrides 'xterm:colors=88'

I'm not sure why this override was needed given that my TERM=xterm and I have iTerm set to xterm as well, but it seems to work.

Answer by Chev for lose vim colorscheme in tmux mode


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.

Answer by RyanLiu for lose vim colorscheme in tmux mode


From the tmux man page, adding flag as following:

tmux -2

This works for me

Answer by Andrew Johnston for lose vim colorscheme in tmux mode


I needed vim to display correctly with tmux in terminal on ubuntu and cygwin/mintty on windows. I got it to work by combining the answers like this.

In .bashrc:

alias tmux="tmux -2"  

In .vimrc:

" use 256 colors in terminal  if !has("gui_running")      set t_Co=256      set term=screen-256color  endif    " fix cursor display in cygwin  if has("win32unix")      let &t_ti.="\e[1 q"      let &t_SI.="\e[5 q"      let &t_EI.="\e[1 q"      let &t_te.="\e[0 q"  endif  

based on answers from this question, this Vim wiki page and this block cursor question

Answer by qingxp9 for lose vim colorscheme in tmux mode


If you use tmuxinator,you need to add these in .bashrc or .zshrc:

alias tmux='TERM=screen-256color tmux -2'  alias tmuxinator='TERM=screen-256color tmuxinator'  alias mux='TERM=screen-256color mux'  

Then tmux ,tmuxinator and mux command all work.

Answer by Munish for lose vim colorscheme in tmux mode


In order to set up correct color and to get rid of rendering issue in both Ubuntu and Mac:

check this


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.