Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    partizan
    @last-partizan
    image.png

    Hi all :)

    How to change underline color of diagnostic messages reported by coc-nvim? in console nvim it matches text color, but in gnvim underline is red. But red is not applicable to each diagnostic message.

    image.png
    I want it to look like this.
    Ville Hakulinen
    @vhakulinen
    I think its dependent on your color scheme. I'm not sure which hl rule that is tho'
    check :h coc-highlight
    partizan
    @last-partizan
    @vhakulinen yeah, i'm not sure too. Underline is default color in neovim-gtk, neovim, goneovim and fvim. And red only in gnvim and neovide.
    gnvim does not define any special highlight groups?
    partizan
    @last-partizan
    folks at coc-nvim saying 'underline' it's just a style, like bold or italic, and coc can not customize it, but GUI can.
    Ville Hakulinen
    @vhakulinen
    right, see :h guisp
    there is a "special" color (both default, and per highlight rule afaik) that is used for the underline/undercurl color
    partizan
    @last-partizan
    This is what i needed! thanks
    partizan
    @last-partizan
    Hmmm, it works if i do it in editor :hi Default guisp=Gray, but it doesnt if i put in init.vim.
    Ville Hakulinen
    @vhakulinen
    are you setting it before or after your colorscheme is loaded?
    partizan
    @last-partizan
    After colorscheme.
    partizan
    @last-partizan

    I have found this code in gnvim, but even after i change default to 0, special color is the same value, 16711680, which is red.

    Where does it comes from?

    image.png
    Ville Hakulinen
    @vhakulinen
    unwrap_or(123) returns value 123if the value on which the unwrap_or is called is None. If you change it to 0 (like you said) and still get red, it means that neovim is reporting the default value as red too.
    But since :hi Default guisp=Gray in fact results in the default sp to be gray, it means that that line of code shouldn't be the problem. If doing that same thing from init.vim doesn't work, it likely means that something else somewhere is overwriting that change.
    people at neovim's gitter are probably better at solving such issue than I am. I would suggest you try if someone there could help with this
    partizan
    @last-partizan

    Yeah, i understand how unwrap_or works.

    I had a look at neovim-gtk code, and they have Option<Color> for special in some places, and gnvim does not. Maybe i'll try to find out source of this red color some time later.

    I'm writing here becouse gnvim is the only gui with default red underline (besides neovide, but i doesnt work well on my computer).

    Ville Hakulinen
    @vhakulinen
    perhaps gnvim and neovide are the only ones doing the sp color correctly? :smiley:
    partizan
    @last-partizan
    I would say the same, if i was a developer of gnvim :)
    Ville Hakulinen
    @vhakulinen
    there likely are differences on how different GUIs handle these situations, where data might or might not be there. In this case, I would guess that neovide (like gnvim) defaults missing sp color of a highlight to the "global" default sp, while other GUIs default to the highlight's fg color. Just a guess - should be relatively easy to check other GUI's code for that (which is what I actually do quite often :smiley: ).
    partizan
    @last-partizan

    I tried to dig this issue, and it can be fixed with this hack.

    diff --git a/src/ui/grid/render.rs b/src/ui/grid/render.rs
    index c991277..f626fc1 100644
    --- a/src/ui/grid/render.rs
    +++ b/src/ui/grid/render.rs
    @@ -89,7 +89,7 @@ fn render_text(
    
         // Since we can't (for some reason) use pango attributes to draw
         // underline and undercurl, we'll have to do that manually.
    -    let sp = hl.special.unwrap_or(hl_defs.default_sp);
    +    let sp = hl.special.unwrap_or(hl.foreground.unwrap_or(hl_defs.default_fg));
         cr.set_source_rgb(sp.r, sp.g, sp.b);
         if hl.undercurl {
             pangocairo::functions::show_error_underline(

    But i don't think it's a good idea to do this. If i understand correctly, my colorscheme must set default special color.
    And something like hi Default guisp=fg will fix issue for me. But, this is not working as expected. And guisp=Gray doesn't work too. Probably it worked once for me by some happy accident.

    partizan
    @last-partizan

    I found highlight group, for me it's CocUnderline. It is defined like this:

    CocUnderline cterm=underline gui=underline
    But there is nothing about red guisp. And i assume other editors defaults to current foreground color for special, and neovide and gnvim - to red.

    Ville Hakulinen
    @vhakulinen
    If the hl doesn't define the sp color, it'll default to the default sp (which is likely red, if your colorscheme doesn't specify it)
    Can you try specify CocUnderline guisp=<color>?
    partizan
    @last-partizan
    @vhakulinen yes, it works as expected, now underline is orange. But, i don't know how to make it match current color. guisp=fg makes it white.
    Ville Hakulinen
    @vhakulinen
    You'll need to specify the guisp color to the color you want. Whats the fg color you're using?
    partizan
    @last-partizan
    I'm using white color, but syntax highlighting uses many colors. So in default nvim underline is always the same as current word.

    I'd probably just set it to some dark gray, so it would be almost invisible.

    Btw, there is comment in source code:

            // TODO(ville): make the underline thickness a bit thicker (one 10th of the cell height?).
            self.underline_thickness =
                f64::from(fm.get_underline_thickness()) / scale * 2.0;

    Why you want to do this? It's perfectly thick as it is. (actually, i would prefer it to be thinner)

    Ville Hakulinen
    @vhakulinen
    Thats old todo comment. You should define the sp color for all the hl rules
    k0ral
    @k0ral
    Would you accept a PR to document the usage of guifont ? It seems that setting the font is not standardized across neovim GUIs so I believe it is worth an explicit section in the README of gnvim
    Eorclus
    @Eorclus
    is it possible for fzf window to use external pop up?
    Ville Hakulinen
    @vhakulinen
    @k0ral yes

    @Eorclus Also yes. I currently have fzf configured like this:

    let g:fzf_layout = { 'window': 'call FloatingFZF()' }
    
    function! FloatingFZF()
      let buf = nvim_create_buf(v:false, v:true)
      call setbufvar(buf, '&signcolumn', 'no')
    
      let height = 20
      let width = 120
      let horizontal = float2nr(width / 2)
      let vertical = 1
    
      let opts = {
            \ 'relative': 'editor',
            \ 'row': vertical,
            \ 'col': horizontal,
            \ 'width': width,
            \ 'height': height,
            \ 'style': 'minimal'
            \ }
    
      call nvim_open_win(buf, v:true, opts)
    endfunction

    You could adjust that nvim_open_win call to open a external window

    Eorclus
    @Eorclus
    @vhakulinen thanks
    Jan Christoph Uhde
    @ObiWahn
    Hi i am using sway (wayland wm - swaywm.org) on debian/sid and I have compiled gnvim from yesterdays master. The statusline where you type the commands like :q is in the middel of the screen? Is that on purpose or is it possibly broken? I have read some bugreports that said the popup menus have been off.
    screenshot_2021-09-15_21:44:45.png