Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange behavior of vim color inside screen with 256 colors
    primarykey
    data
    text
    <p>I was trying to make the syntax highlighting (with 256 colors) of <code>vim</code> work inside <code>screen</code>, which is running inside <code>gterm</code>.</p> <p>It works quite fine in the beginning. What I mean by "in the beginning" is, after I start <code>screen</code>, and enter <code>vim</code>, the colors look fine, and there are really 256 colors.</p> <p>But after a while (I don't know exactly how long) the colors automatically change back to an appearance as if there are only 8 (or 16?) colors.</p> <p>For example, after this has already occurred, if I enter the command</p> <pre><code>hi Comment ctermfg=68 </code></pre> <p>inside <code>vim</code>, the comments appear to be "pure" green; however, if I open another <code>vim</code> outside screen (in the same terminal), then with the same command the comments appear to be a "yellowish" green.</p> <p>The following is my .screenrc settings related to color:</p> <pre><code>attrcolor b ".I" defbce "on" termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' term xterm-256color </code></pre> <p>After running a python script to display all the colors, I find out that maybe this is a problem of screen itself, and has nothing to do with vim.</p> <p>What I did is, inside the <code>screen</code> session with problems, this script gives 256 colors, but many of them are actually the same; however, when I start a new screen session with the same configuration, this script gives 256 colors which are distinct from each other.</p> <p>Edit:</p> <p>Last night I connected to my Linux computer (which is in my office and it is always on) with <code>putty</code>, then opened a <code>screen</code> session with multiple windows in it. The colors are correct last night. Then before I went to sleep I detached the <code>screen</code> session and closed <code>putty</code>.</p> <p>Now in the morning when I attach that <code>screen</code> session in <code>putty</code> again, the colors crash: they appear as if there are only 8 colors.</p> <p>The colors are fine outside <code>screen</code> (but still in <code>putty</code>).</p> <p>Edit:</p> <p>Three years later after I asked this question, today I saw a similar problem. The problem is that <code>vim</code> can display 256 colors outside <code>screen</code>, and <code>screen</code> can display 256 colors with a test script, but <code>vim</code> can't display any color (can only display black and white) inside <code>screen</code>. Just as a note to myself, here is the <code>.screenrc</code> file I am using</p> <pre><code>hardstatus alwayslastline "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %Y-%m-%d %c" shell "bash" startup_message off vbell off altscreen on attrcolor b ".I" defbce "on" termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l' termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' term screen-256color </code></pre> <p>The solution to the problem is already mentioned in the accepted answer, namely, I need to include</p> <pre><code>export TERM=xterm-256color </code></pre> <p>in <code>.bashrc</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload