Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neovim and vim not exactly the same #197

Open
Masber opened this issue Oct 1, 2024 · 1 comment
Open

neovim and vim not exactly the same #197

Masber opened this issue Oct 1, 2024 · 1 comment

Comments

@Masber
Copy link

Masber commented Oct 1, 2024

Dear gruvbox community,

I noticed gruvbox-community/gruvbox looks slightly different in vim and neovim.

VIM
image

NVIM
image

I installed guvbox in vim using Plug

Plug 'gruvbox-community/gruvbox'

And in neovim using lazy

  {
    'gruvbox-community/gruvbox',
    priority = 1000,
    init = function()
      vim.cmd.colorscheme 'gruvbox'
    end,
  },

I also tried this trick

      vim.g.gruvbox_legacy_language_groups = 1
      vim.g.gruvbox_treesitter = 0

But still not as the original

I also tried ellisonleao/gruvbox.nvim but it is totally different (it adds italics and the colors are quite different)

Any idea how to make gruvbox in nvim to look the same as in vim?

thank you

@rbong
Copy link

rbong commented Oct 2, 2024

Thanks for reporting. The screenshots likely show a difference in syntax matching, not in highlight group colors. Neovim and Vim have significantly different syntax files for many languages, including VimScript. Gruvbox does not define syntax match patterns, it just maps colors to highlight groups.

See the Neovim VimScript syntax file:

" Note: Be careful when merging the upstream version of this file.
"       Much of this is generated by scripts/genvimvim.lua

You could also be using the Treesitter highlight groups in Neovim, in which case colors would be even more different and out of our control.

If you are using the syntax files though, you can use this function to find the highlight match under the cursor:

function! SynStack()
  if !exists("*synstack")
    return
  endif
  echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc

You can use that to find the specific highlight group names that don't match, then use the :highlight <group-name> command to view which colors are mapped to that group. This might clear up some of the differences.

That all said, we currently have customized highlight groups for the original Vim version of the VimScript syntax groups, not some of the new Neovim vimscript syntax groups. If someone wants to contribute a PR for the Neovim VimScript syntax groups, I would accept it, though for the most part it seems correct.

However, the idea behind this ticket - that they should be "exactly the same" - is likely impossible, unless if Vim merges the Neovim syntax group changes for some reason. For instance, the Vim syntax match patterns make highlighting all punctuation impossible last time I checked, where in Neovim they are mapped exactly (on that note: I think your screenshots have Vim/Neovim flipped).

If you do find some fundamental difference in how Gruvbox is mapping groups to colors or want to rephrase your issue, please let me know. But otherwise this ticket can be closed because we have little to no control over making Neovim and Vim exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants