I am using vim under GNU screen via ssh on a remote machine. When I visually select text, the text normally appears as reversed (highlighted) to indicate that it is selected. However, after a while working (switching screen windows, detaching, reattaching...) the visually selected text appears as underlined.

Why is this behavior, and can I somehow prevent it?

I prefer visually selected text to stay always reversed, otherwise it is very confusing.

-- versions used: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 15 2016 13:40:39). Included patches: 1-4. Screen version 4.00.03 (FAU) 23-Oct-06

  • 1
    Are you overriding your TERM environmental variable in any shell startup scripts? What's the value of TERM outside screen, and within screen, and within Vim? – Heptite Mar 8 '17 at 17:16
  • Inside screen: "screen". Outside screen: "xterm-256color". Within VIM: I do not know how to check this. – user50105 Mar 9 '17 at 12:09
  • 1
    The command would be ":echo $TERM" but it's unlikely to be anything unusual. What does the output of ":verbose set t_Co?" (with the question mark as part of the command) show? – Heptite Mar 10 '17 at 4:46
  • :echo $TERM "screen" – user50105 Mar 10 '17 at 12:34
  • :verbose set t_Co? "t_Co=256 Last set from ~/.vimrc" – user50105 Mar 10 '17 at 12:34

A discussions on vim_use suggests that X server disconnection is one--if not the only--cause for this. There supposedly is a fix for this in 8.1.0615.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy