vim icon indicating copy to clipboard operation
vim copied to clipboard

My colorscheme is incorrect on Go syntax.

Open hoenirvili opened this issue 3 years ago • 12 comments

So I tried using nord as my colorscheme in neovim but some colors are not consistent with the screenshot. I'm using linux manjaro, neovim (NVIM v0.5.0-dev+1062-gcc1851c9f)

I've added arrows to illustrate where is the problem.

Mine

image

How it should be

image

if exists('+termguicolors')
	let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
	let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
	set termguicolors
endif
colorscheme nord

...

" go syntax color bs
let g:go_highlight_methods = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_format_strings = 1

hoenirvili avatar Feb 06 '21 21:02 hoenirvili

Hi @hoenirvili 👋🏼 Looks like this is the same problem like reported and resolved in #203. Could you please try the suggestions I've posted there?

arcticicestudio avatar Feb 07 '21 08:02 arcticicestudio

Hi @arcticicestudio.

I've just copy-pasted everything from that comment you suggested and I commented on all of my previous settings. It still does not look like in the picture. I'm wondering if this is an issue on Linux because a couple of years ago I was using the same setup with neovim on my mac using iterm2 and I didn't have any problem.

image

image

hoenirvili avatar Feb 07 '21 09:02 hoenirvili

Have you also tried to use vimgo instead of vim-go? Under the hood it simply makes use of the official editor tool gopls which natively understands Go while vim-go makes use of the common Vim approach by using regular expressions to tokenize the syntax elements. All these options are part of the vim-go plugin while vimgo should work out-of-the-box™️. I know that this naming is kind of confusing, but that's kind of normal when things evolve 😄

arcticicestudio avatar Feb 07 '21 12:02 arcticicestudio

Have you also tried to use vimgo instead of vim-go?

No, but looks like vimgo which is govim only supports vim8. I'm using neovim and I want to use still neovim. I'll try using govim with my neovim and see if that does make a difference.

BTW for using gopls LSP protocol I'm using coc-vim and I just disable the whole lsp options in vim-go. Because in reality I only need just a small number of features like running gofmt + goimports/goreturns but maybe I should use prettify or something from the coc marketplace.

hoenirvili avatar Feb 07 '21 13:02 hoenirvili

Looks like it doesn't even let me load govim in a neovim instance.

I would rewrite/hardcore color changes myself but I don't know where to start or which colors are used and I don't have that much experience writing vimscript.

It's there a possibility that this can be solved somehow by Nord ?

hoenirvili avatar Feb 07 '21 13:02 hoenirvili

I'm back with an update. After searching some time I've come up with a solution but IDK how good it is.

This fixes the format string, the function call but I still have to figure out now the ; and the ".

"vim-go syntax highlighting bs
let g:go_highlight_operators = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1

highlight goFunctionCall guifg=#88C0D0
highlight goFormatSpecifier guifg=#EBCB8B
highlight goEscapeOctal guifg=#EBCB8B                 
highlight goEscapeC guifg=#EBCB8B
highlight goEscapeX guifg=#EBCB8B
highlight goEscapeU guifg=#EBCB8B     
highlight goEscapeBigU guifg=#EBCB8B           
highlight goEscapeError guifg=#EBCB8B

Further investigation

Looks like these are the color assign to these variables or IDK what is this in vim.

s:nord13_gui => #EBCB8B
s:s:nord8_gui => #88C0D0

I tried setting things like this

highlight goFunctionCall guifg=s:s:nord8_gui
highlight goFormatSpecifier guifg=s:nord13_gui 
highlight goEscapeC guifg=s:nord13_gui
...

But this doesn't work. Now comes the question, (I did solve the rendering in Go, it's a hacky solution, but it works) if go syntax was broken, this mans that every syntax lang color is broken into a certain extent? What's your opinion on this?

Also in order to identify all the groups I used this.

This is how It looks now.

image

hoenirvili avatar Feb 07 '21 15:02 hoenirvili

Thanks for the investigation and feedback 👍🏼 Seems like vim-go got some interesting updates. The last time I checked the implementation most of the syntax highlighting groups were not public so they couldn't be used for themes. Nord currently only supports two syntax groups, but we should definitely add all the ones that are public available now.

I'll move this issue into the backlog.

arcticicestudio avatar Feb 07 '21 19:02 arcticicestudio

There are any chances that this will be solved in the near future?

hoenirvili avatar Feb 08 '21 12:02 hoenirvili

I've taken matters in my own hands. Could you please @arcticicestudio check the PR?

hoenirvili avatar Feb 08 '21 13:02 hoenirvili

Same here! Looking forward to the PR!

chengleqi avatar Feb 28 '22 05:02 chengleqi

@chengleqi the pr is here still w8 for review.

hoenirvili avatar Mar 01 '22 08:03 hoenirvili

Thank you for your patience! 🙏🏼 It‘s been a while since I had free time to focus more on Nord, and my open source projects in general, and invest time in this issue due to work-life balance.

I recently published the first “Northern Post — The state and roadmap of Nord“ announcement which includes all details about the plans and future of the Nord project, including the goal of catching up with the backlog. This issue is part of the backlog and therefore I want to triage and process it to get one step closer to a “clean state“. Read the announcement about reaching the “clean“ contribution triage state in Nord‘s discussions for more details about the goal.

Therefore it has been added to the queue in the central and single-source-of-truth project board that is also described in more detail in the roadmap announcement.


@hoenirvili Thanks again for your contribution! Your PR #246 will be added to the queue also later for further processing.

svengreb avatar Jun 04 '23 09:06 svengreb