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
Related
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
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 am trying to highlight the 80 character column in vim to help me keep my code short.
I've added this to my .vimrc:
" Highlight column 80
if exists('+colorcolumn')
highlight ColorColumn ctermbg=4
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
I've looked at the available colors with :help ctermbg but no matter what argument I use for ctermbg, I get a dark red highlight which is very annoying. how can I change this color?
Many thanks
With an output of
ColorColumn xxx term=reverse ctermbg=4 guibg=DarkRed
you're probably using GVIM, which uses the gui..= definitions. You need (and should always do, unless you're solely using terminal or graphical Vim) add GUI definitions (:h gui-colors has a list):
:highlight ColorColumn ctermbg=4 guibg=blue
Especially if you're switching colorschemes, there may also be left-over attributes from that. It's safer to specify all attributes (see :help :hi):
:highlight ColorColumn term=reverse cterm=NONE ctermfg=NONE ctermbg=4 gui=NONE guifg=NONE guibg=blue
Try for example:
highlight ColorColumn ctermbg=Blue
Hope it helps!
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.
Is there a way to highlight only the current line number (in the left hand coloumn) in vim, without highlighting the background of the current line? Ideally, I would Like to make the current line number bold.
There are two groups that determine highlighting of line displayed when &cursorline option is active: CursorLine and CursorLineNR. First is used to highlight the whole line, second for the line number. So to achieve what you want you must
Clear the highlighting of CursorLine: just hi clear CursorLine after any :colorscheme and set background= call.
hi clear CursorLine
augroup CLClear
autocmd! ColorScheme * hi clear CursorLine
augroup END
Set the highlighting of CursorLineNR if it is not set in your colorscheme:
hi CursorLineNR cterm=bold
augroup CLNRSet
autocmd! ColorScheme * hi CursorLineNR cterm=bold
augroup END
(better to check whether it is already set in the colorscheme, maybe it will look better in that case).
You can join both autocommands in one of course.
CursorLineNR has been added relatively recently around version 7.3.488.
You want to look at
:se cursorline
and perhaps even/also
:se cursorcolumn
This is what worked for me:
highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
set cursorline
I'm just using this in my .vimrc after having set the color scheme. Of course you could also set a specific background color but setting all of them to NONE just highlights the line number (i.e. makes it brighter).
I guess you could just use :hi CursorLine cterm=NONE but I just wanted to make sure I'm making everything transparent (gvim included).
With CursorLineNR I was then able to set the foreground and background colors of the highlighted number.
I'm only writing this because for me it worked without any autocommands and it may be what most people require.
You can set cursorline to highlight only the numbers
'cursorlineopt' 'culopt' string (default: "number,line")
local to window
{not available when compiled without the +syntax
feature}
Comma separated list of settings for how 'cursorline' is displayed.
Valid values:
"line" Highlight the text line of the cursor with
CursorLine hl-CursorLine.
"screenline" Highlight only the screen line of the cursor with
CursorLine hl-CursorLine.
"number" Highlight the line number of the cursor with
CursorLineNr hl-CursorLineNr.
And to override your colorscheme use autocmd
So, the following works:
set cursorline
set cursorlineopt=number
autocmd ColorScheme * highlight CursorLineNr cterm=bold term=bold gui=bold
This worked for me to highlight the line number and not the rest of the line:
highlight CursorLineNr cterm=NONE ctermbg=15 ctermfg=8 gui=NONE guibg=#ffffff guifg=#d70000
The help for highlight-groups does not mention an exclusive "number of current line" syntax group, so the official answer might be no.
You may want to take a look in the cursorline option which highlights the entire line, if it helps.