Friday, August 10, 2012

Only 8 colours on ssh-ed terminals?

Vim (i.e. consolevim, but not gvim) on my primary workstation uses 256 colours and with syntax highlighting on, editing source code is a much pleasant experience (vs. being limited to 8 colours).

However, every time I ssh a different machine, Vim on the remote machine always used 8 colours. I’m a big fan of seeing a lot of colours and hated the 8-colours environment of the remote machines. After some digging, I found out the cause for this problem. My primary machine has COLORFGBG environment variable set, but the remote machines don’t. Check Skåne Sjælland Linux User Group to see how you can fix this issue. (Essentially, you’ll have to configure ssh on your machine and the remote machine to pass COLORFGBG environment variable.)

Update: Actually, adding the line set background=dark to my ~/.vimrc seems like a much easier solution. And also, “only 8 colours” is not the real problem. Real problem is that vim is using a different set of colours (dark blue instead of light blue, for instance) on the new machine.