I couldn't get my colour schemes looking nice in Vim under tmux and it took me a while to sort it out. Here's what I did. Using:
The steps are:
- Get tmux running in 256 colours
- Add some stuff to your Vim start-up
- Select an appropriate colour scheme
I'm kind of a newb at messing with this type of thing so would be keen to hear about any errs, omissions or inefficiencies :) This is mainly a record for me and maybe helpful to anyone else with similar noob levels of experience trying to sort out a similar problem.
Get Tmux Running in 256 Colours
First of all I needed to get tmux working in 256 colour mode as is it was only running in 16 colours and was the cause of every Vim colour scheme I tried look very horrid. How did I know the amount of colours tmux was using? There's handy Perl script called 256color.pl which you can get here. Running it gave me this:
And then I got the right output from 256color.pl. Phew!
I didn't want to type TERM=xterm-256color tmux every time I wanted tmux so I added this to my .zshrc file (.bashrc if you're running bash I guess)
alias tmux="TERM=xterm-256color tmux"
Add Some Stuff To Your Vim Start-up
Vim needs to know there are 256 colours for it play with so you need to tell it in your .vimrc. That's pretty easy, just add this line:
Select An Appropriate Colour Scheme
I have a shit load of Vim colour schemes installed from some bundle I got from here :D What I didn't realise is not all of them will work properly in Vim as they were designed for Gvim. To find ones that did I type:
And I get a list of all the schemes designed for 256 colours. A bunch of schemes without 256 colours in the name work as well but it's a bit hit and miss whether they do.
And here we are using wombat256 :)
- cljs compiler auto-building any files that change
- http server
- Irc (obviously)
They're all terminal apps (I use irssi) and this makes it easy to have all of them running nicely together in split windows as per below. There's no http server on that screen. It's running as part of the tmux session but as I don't need to see it's output very often I just run it in another window.