Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    After colorscheme.

    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?

    Ville Hakulinen
    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

    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
    perhaps gnvim and neovide are the only ones doing the sp color correctly? :smiley:
    I would say the same, if i was a developer of gnvim :)
    Ville Hakulinen
    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: ).

    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 {

    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.


    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
    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>?
    @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
    You'll need to specify the guisp color to the color you want. Whats the fg color you're using?
    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
    Thats old todo comment. You should define the sp color for all the hl rules
    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
    is it possible for fzf window to use external pop up?
    Ville Hakulinen
    @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)

    You could adjust that nvim_open_win call to open a external window

    @vhakulinen thanks
    Jan Christoph Uhde
    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.