I've always used a light-background terminal and a dark-background editor (vim). On this I'm not willing to compromise. In any case, I've just switched from xterm to urxvt ($TERM == rxvt-unicode-256color) mainly to due an unresolved fontconfig/xft font truncation bug in xterm, and urxvt's ability to reflow text properly (there are other perks though, so please don't blindly suggest switching terminals). Unfortunately I have one problem with urxvt that I can't solve: the cursor color in vim is invisible. Let me explain with each terminal's default behaviour:


  • cursor color defaults to the foreground color of the underlying text, and therefore varies. If there is no underlying text, it defaults to the foreground color (white or black, usually)
  • text color under cursor is pulled to the background color (black or white, usually)
  • XTerm ignores a cursorColor setting of "#000000" and instead uses default behaviour

Therefore, text under the cursor is only invisible in XTerm when the cursor color matches (as near as possible) the background color.


  • cursor color defaults to black.
  • text color under cursor is pulled to white.

Therefore, text under the cursor is only invisible in URxvt when the cursor color is white

Back to the problem:

The URxvt cursor is invisible in vim because I use a dark colorscheme (black cursor on black background). I can't change the cursor to color to white in ~/.Xdefaults because I use a light-background terminal, this would lead to a white cursor in a white background over white text: both invisible cursor and invisible font. However, while vim normally doesn't support changing the cursor color, with a little bit of hackery in ~/.vimrc it becomes possible. Unfortunately, a white or lighter-colored cursor leads to either invisible text or at least much less legible text.


Invisible Cursor:

  • explanation: black cursor on black background.
  • solution: change cursor color to white (or a lighter color)
  • problem: leads to invisible text (or harder to read text)

Invisible Text:

  • explanation: white cursor over white text
  • solution: ????


I'm hoping either that URxvt can support XTerm's cursorColor/cursorTextColor behaviour, or at least support modifying the color of the text under the cursor, though of course I'm open to other solutions.

  • Did you try setting the cursor color to "reverse"? – romainl Mar 10 '14 at 21:59
  • I'm not sure what you mean. -xrm "*cursorColor: reverse" -> urxvt: unable to parse color 'reverse', using pink instead. – user19087 Mar 10 '14 at 22:24
  • Well, the urxvt-specific resource is cursorColor2, with such a nondescript name no wonder I didn't originally find it. Unfortunately it seems incompatible with the vim hack because I have yet to find a corresponding escape sequence. – user19087 Mar 10 '14 at 22:51
  • And the reset sequence in the vim hack doesn't actually work with urxvt. – user19087 Mar 10 '14 at 22:52
  • Yes, urxvt doesn't seem to care at all about vim's cterm=reverse. That's unfortunate. – romainl Mar 10 '14 at 23:20

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.