I have an issue where the pmenu generated by the coc.vim have colors that do not align well with my desired background color for the pmenu.
This is my generic pmenu. Note that the color scheme is just a black foreground and a green background:
This is specifically the hint box that comes up when I write a function or method that Coc Vim recognizes and I press tab to autocomplete. This is how I want it to look, mostly all black color scheme with the pmenu background I configured:
Here is the ugly one. This one shows up when I do the SHIFT + K to bring up the help/documentation on a function/method after the fact:
Is this a configuration issue with vim or with coc? Here is the configuration file I source with my .vimrc file :
hi Pmenu ctermfg=black ctermbg=DarkGreen
hi PmenuSel ctermfg=white ctermbg=DarkGreen
hi CocErrorSign ctermfg=red guibg=red
hi CocErrorFloat ctermfg=white ctermbg=red
hi CocInfoSign ctermfg=blue
hi CocInfoFloat ctermfg=white ctermbg=blue
hi CocWarningSign ctermfg=white ctermbg=yellow
" I have tried all of the below, but to no avail
" hi CocHighlightText ctermfg=black ctermbg=DarkGreen
" hi CocHintSign ctermfg=black ctermbg=DarkGreen
" hi CocHintHighlight ctermfg=black ctermbg=DarkGreen
" hi CocHintVirtualText ctermfg=black
Trying really hard to understand the help page with coc. I think this is the issue:
I think that coc is using some of the syntax highlighting that comes with my vim and imposing it on the help box, though I am unsure. I want to remove this behavior. I tried CocHighlightText, since the help page mentioned symbols (not sure what that is) but it didn't seem to work. How can I configure the hint box color scheme when I press SHIFT + K?
I found a couple related highlighting groups:
highlight CocFloating ctermfg={fg color} ctermbg={bg color} gui={gui color}
highlight CocErrorFloat ctermfg={fg color} ctermbg={bg color} gui={gui color}
highlight CocMenueSel ctermfg={fg color} ctermbg={bg color} gui={gui color}
I think that CocFloating might be the one you are looking for, this is the one that changes coc's pmenu text and background. CocMenuSel changes the selected entry colors of coc's pmenu, and CocErrorFloat changes the colors of error messages from when you hover over errors.
There are also some more popup menu highlight groups if you do :h CocPum
Delet or comment this lines. So the pmenu will follow your color scheme.
"hi Pmenu ctermfg=black ctermbg=DarkGreen
"hi PmenuSel ctermfg=white ctermbg=DarkGreen
Related
I am using dracula theme for vim and am not able to get the number pane, that is, the side panel which contains the line numbers, to be displayed in a sort of translucent manner. The preview image shows that it's possible.
How the terminal should look like
(source: draculatheme.com)
How it actually looks
To fix this issue, I think I need to configure some attributes accordingly, but being a beginner, I don't know which ones, therefore any help and guidance would be appreciated.
As a reference, these are my dotvim files.
The background of the line numbers column is set in the colorscheme to NONE for color terminals and #282a36 for GUIs:
hi LineNr ctermfg=60 ctermbg=NONE cterm=NONE guifg=#6272a4 guibg=#282a36 gui=NONE
From there you have three options:
Enable the 'termguicolors' option so that Vim uses the gui* attributes instead of the cterm* attributes.
This is how the screenshot was taken but it will only work in select terminal emulators.
See :help 'termguicolors'.
Edit the colorscheme directly:
hi LineNr ctermfg=60 ctermbg=242 cterm=NONE guifg=#6272a4 guibg=#282a36 gui=NONE
I've chosen 242 arbitrarily but you can choose whatever color you want in this chart
Override your colorscheme in your vimrc:
function! MyHighlights() abort
hi LineNr ctermfg=60 ctermbg=242 cterm=NONE guifg=#6272a4 guibg=#282a36 gui=NONE
endfunction
augroup MyColors
autocmd!
autocmd ColorScheme * call MyHighlights()
augroup END
colorscheme dracula
I want my vim background to be dark but as you can see it's not, its half black half grey, im using ubuntu 15.10 with latest vim version. How to fix this?
pic
If you want your background was of all the same colour, which is set in your colorsheme, you need to comment the line about highlighting nonText.
" highlight Normal ctermbg=black
" highlight nonText ctermbg=black
If you wish to override the settings in your colorscheme, just uncomment the line about highlighting Normal
highlight Normal ctermbg=black
highlight nonText ctermbg=black
If you want to see the current settings of the highlighting, you can use :highlight command.
Read more in help
:h highlight-groups
How can I customize the highlight color for the unclosed bracket in Vim?
This is how Vim highlights an unclosed bracket when the cursor is not over the same line as the bracket:
This is nice, but when I move the cursor over the line where the bracket lies, this is how it looks:
Now, I barely can see where the bracket is. How can I change this? By the way, I'm using :set cursorline option to highlight the current line.
The CursorLine highlight group has more "weight" than other highlight groups, including Error which can lead to that kind of situation where the background color of Error is overruled.
The solution I've found while working on my colorscheme is to set the foreground and background colors of Error to the inverse of what I want: red on black vs black on red and use the reverse value for cterm and gui:
hi Error ctermbg=NONE ctermfg=131 guibg=NONE guifg=#af5f5f cterm=reverse gui=reverse
And make sure CursorLine doesn't set any foreground color:
hi CursorLine ctermbg=236 ctermfg=NONE guibg=#303030 guifg=NONE cterm=NONE gui=NONE
It works pretty well:
You'll need to edit the colorscheme you are using and, if possible, send a pull request to its author.
After I upgrade my vim to 7.4 in Ubuntu system, I found that the popup menu is too dark(I have tried many colors schemes like evening, dark...)
Is there any solution?
Well, you could set your own colors in your vimrc (after your colorscheme command).
:help hl-Pmenu lists 4 highlighting groups for the popup menu. If you never used a highlight group before, have a look at some colorscheme files.
A quick & dirty config using all the same colors because I'm lazy:
colorscheme foo
highlight Pmenu ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
highlight PmenuSbar ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
highlight PmenuThumb ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
I use iTerm2 (Build 1.0.0.20130319) and Vim (bin of MacVim Snapshot 66) on top of OS X 10.7.5 as my CLI editing team.
iTerm2:
Color scheme: Solarized Dark
Terminal type: xterm
Minimum contrast: lowest
Transparency: none
Dimming: disabled
Background image: none
Vim:
set t_Co=16
set background=dark
colorscheme solarized
echo &t_Co returns 16.
Generally I do not seem to have issues with a basic setup. But additionally I try to give "NonText" and "SpecialKey" characters a color value avaiable from the solarized color palette (palette can be found here).
highlight NonText ctermfg=0
highlight NonText guifg=#073642
highlight SpecialKey ctermfg=0
highlight SpecialKey guifg=#073642
The strange thing is while the "SpecialKey" group displays the "cterm" color value correctly, the "nonText" group does not. It seems that it displays the value 8 which is used by "ctermbg". As a consequence all "NonText" characters are not visible anymore. Both groups accept the "guifg" values btw.
Am I missing something which could interfere with my setup?
I found a solution on the solarized bugtracker.
This config lets one assign colors to certain elements and groups:
highlight CursorLineNr cterm=none ctermfg=0 guifg=#073642
highlight NonText cterm=none ctermfg=0 guifg=#073642
highlight SpecialKey cterm=none ctermfg=0 guifg=#073642 ctermbg=8 guibg=#002b36
Notice the
cterm=none
which fixes the problem.