0

I'm using Vim 8.2 on Fedora 32. I have the following lines in ~/.vimrc for highlighting the Cursor, lCursor, CursorLine, and MatchParen highlight groups:

highlight Cursor guibg=Green guifg=Black
highlight lCursor guibg=Green guifg=Black
highlight CursorLine cterm=NONE guibg=Gray7
highlight MatchParen guibg=fg guifg=bg

I also enabled RGB colors for vim with the below lines:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors

In gvim, when the matching pair of a charachter included in 'matchpairs' is higlighted (as specified by the above highlight command for the MatchParen highlight group), the character under the cursor is highligted exactly as specified by the above highlight command for the Cursor highlight group (i.e. green bg and black fg). However, in vim, the foreground color of Cursor becomes the same as the background color of MatchParen.

Also, to disable any defaults unknown to me, I tried setting cterm, ctermbg, and ctermfg to NONE for all highlight commands, and disabling highlighting the current line, but nothing I did fixed the issue. I checked :hi for the set colors, and nothing surprising there. It seems strange to me that the highlighting is fine in gvim but not in vim.

UPDATE: The issue exists in xterm, but not in Gnome terminal.

  • Are you using termguicolors or no? If not, I wouldn't expect gui.. highlighting to affect cterm highlighting—is it possible this is a case of "not specifying the attribute means use the default (whatever it is)"? Welcome to Vi and Vim! – D. Ben Knoble Oct 20 '20 at 14:44
  • @D.BenKnoble Thanks. Yes, I have set termguicolors (along with let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" and let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum") in ~/.vimrc. I checked :hi for the set colors, and nothing surprising there. Also, to disable any defaults unknown to me, I explicitly set cterm, ctermbg, and ctermfg to NONE for all highlight commands as I said in the Question. Don't really know what's causing this, can it be a bug in matchparen.vim plugin? – detic Oct 20 '20 at 14: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.