8

I have not been able to use vim in tmux for about a week now. I keep all of my dotfiles in Github (here https://github.com/jordanjones98/dotfiles) and when I got a computer I thought it would be an easy git pull, and some other simple setup. When I pulled, and installed my plugins everything works outside of tmux, but not inside. I am using vim 8.0 and tmux 2.6. I am using a zsh shell inside of iTerm.

It is worth noting that this same configuration worked on my old computer, and works on my current work computer. I even copied the iTerm configuration from my work computer to try and get this working.

A few things I have tried..
running tmux -2
running TERM=screen-256color-bce tmux
setting set -g default-terminal "screen-256color" in my .tmux.conf
setting "report terminal type" to xterm-256color in my iterm preferences.

I have also tried running it in regular mac terminal and once again vim runs fine outside of tmux, but not inside of tmux.

I have researched this for days now and have not found anything that works. I do know my .tmux.conf and .vimrc files are being loaded in tmux, because of the plugins, and bottom bar in my tmux.

My dotfiles are pretty large. So please view them here. https://github.com/jordanjones98/dotfiles

1 Answer 1

14

I notice you don't set TERM in ~/.zshrc

Try this,

add

export TERM="screen-256color"

to .zshrc

instead of the bce entry - then make sure you source ~/.zshrc before starting a new tmux session

note. I am using osx so my tmux.conf uses set -g default-terminal "screen-256color", if you are on linux it may be different. the point is that this problem is often fixed with export TERM in my .zshrc.

edit

I tried your dot files and I think I reproduced the issue. The issue went away with this ugly workaround. Try adding the following to your ~/.vimrc file around line 44 before setting color scheme:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
Sign up to request clarification or add additional context in comments.

6 Comments

Hi and thanks for the response, That did not work unfortunately, I updated it and put it in Github so you can view it, but I am still having the same issue.
Your tmux.conf worked for me. I'll try your dot files all together next, what OS are you on?
I am on MacOS 10.13.2 I am on this with another computer, and everything works there as well. Seems to only be this computer
I was able to repro no-colors in iterm with a fresh user account. there are bug reports out there with an ugly workaround that worked for me. I'll update my answer with the work around vimrc edit for you to try.
Thank you for the edit. That worked. May be ugly, but works for now. Thank you!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.