Hacker News new | ask | show | jobs
by H3g3m0n 4493 days ago
Just spent half an hour trying to figure out why 256 color mode stopped working in Vim.

I'm blaming you =P

In all seriousness actually trying to get 256 colour mode auto detecting and working reliability across different xterms, tmux/screen, ssh and so on, without some hack that forces the 256 on even when it's not supported seems impossible :/

I added the following to my zshrc, which seems to have helped. Why don't these terminals report 256 color mode by default?

    if [ "$COLORTERM" == "yes" -a "$TERM" == "xterm" ]; then
       export TERM=xterm-256color
    fi
1 comments

The escape sequences to set 256 colors were previously hardcoded into tmux, instead of detected from terminfo. That works fine, until you use a program that uses different escape sequences.

I suspect terminals don't set 256 colors by default for backward compatibility reasons. tmux itself didn't assume, you needed something in your config file or a command line option. Now though, I believe it can detect it based on your term.