LostInTranslation
LostInTranslation

Reputation: 159

vim in screen: vim does not highlight syntax when I'm in a screen session

I cannot see any syntax highlighting in any language (e.g. python, c++ and sh) when I use vim within a screen session. The line numbers are in color though. I precise that my terminal (in screen too) is able to show 256 colors schemes (I tested with the 256colors perl script found here: http://frexx.de/xterm-256-notes/ ).

How can I fix that?

Upvotes: 1

Views: 1997

Answers (2)

BTRUE
BTRUE

Reputation: 390

I had this problem. In my case, I was running a version of screen from brew. brew doesn't use ~/.screenrc as its startup file. So there's two solutions to this.

1) Set your term in the screenrc that brew_screen is expecting. This might be /opt/etc/screenrc. I didn't try this method, so I'm not sure.

2) Make an alias for screen that sets the term to what you want it to be. In this case, screen-256color is sufficient. I added the following line to my bash_profile, which is symlinked to my bashrc (mac problems):

alias screen='screen -T screen-256color'

Upvotes: 0

LostInTranslation
LostInTranslation

Reputation: 159

OK, here is the issue/solution: I used to call vim by using $vi, indeed:

$ which vi
alias vi='vim'
    /usr/bin/vim

But:

$ screen
$ which vi
/bin/vi

I just learnt that screen doesn't load this system level alias which is tricky.

Upvotes: 2

Related Questions