1

I set the following highlight:

:hi Normal ctermfg=250 ctermbg=235

The text is a nice light gray on dark gray, as intended. But the cursor has become dark blue. I'd love to have it just be the reverse of Normal.

desc

Setting similar Normal highlights has different effects:

  • :hi Normal ctermfg=250 ctermbg=234 medium blue
  • :hi Normal ctermfg=250 ctermbg=233 green
  • :hi Normal ctermfg=250 ctermbg=232 teal

Of course, those also change the background as expected. Changing the ctermfg doesn't seem to do anything to the cursor color.

I'm using Vim 8.0 (also tried 7.4) on CentOS 7 via xterm (term=xterm-256color).
(Update: I'm ssh-ing to the CentOS system from SecureCRT 8 on Windows 10. My SecureCRT session is set to xterm emulation.)

Escape codes for xterm have no effect on the cursor color.
There doesn't seem to be anything in :help hi-normal-cterm about cursor color.
Someone who knows a lot more about xterm than me says that it should just invert the fg/bg colors.

I don't know much about terminal types and such, but is there a way I can get my cursor to a normal color combo?

  • In the xterm bash prompt, can you show the result of ps x | grep $PPID ? – tivn Mar 20 '18 at 8:57
  • @tivn 30043 ? S 0:00 sshd: <username>@pts/22 (besides the grep line) – P1h3r1e3d13 Mar 20 '18 at 15:53
  • 1
    @P1 Can you first exit your ssh session before running the command? Actually I am expecting xterm or gnome-terminal etc. Cursor color usually controlled by your terminal setting rather then by the vim itself -- unless you use gvim. Are you using CentOS 7 ? – tivn Mar 21 '18 at 20:31
  • 1
    @tivn Aha! I ssh'ed to the CentOS 7 system from SecureCRT (with xterm emulation) in Win 10. When I ssh'ed from a MacOS terminal and vim'ed, I got the gray cursor I expected. So the problem isn't where I thought. Is SecureCRT's xterm emulation broken? Where should I be looking? – P1h3r1e3d13 Mar 21 '18 at 20:42
  • I don't think it is broken. I am not using SecureCRT but I found there is setting to change its cursor color: vandyke.com/support/tips/colorconfig.html – tivn Mar 21 '18 at 20:51

Your Answer

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

Browse other questions tagged or ask your own question.