nordtheme / vim

An arctic, north-bluish clean and elegant Vim theme.
https://www.nordtheme.com/ports/vim
MIT License
2.51k stars 275 forks source link

Function names not highlighted in Go #203

Closed jdzikowski closed 4 years ago

jdzikowski commented 4 years ago

According to Nord golang has colored function names (See official Nord page), however they are missing on my setup. Could you please help me figure out why functions aren't highlighted? Screenshot from 2020-04-28 18-32-55

OS: Ubuntu 20.04 Terminal: Gnome Terminal (with Nord theme) Vim 8.1 with Nord theme. Here the .vimrc

arcticicestudio commented 4 years ago

Hi @jdzikowski :wave:

I mostly use Goland (respectively IntelliJ Ultimate with the official Go plugin to make it the same like the standalone Goland DE) so I'm currently not up-to-date regarding the state of editor support for Go in Vim, but I know that there's also the govim project that aims to be the main Go plugin for Vim. The plugin is mainly written in Go using the fantastic gopls project which is finally an official language server for Go. This means it natively understands it's own syntax better than Vimscript. vimgo is mostly developed and maintained by members of the Go team so I guess this is a goof sign for the future of the project 😄

Anyway, the vim-go project was the first Go plugin, is still very popular and after checking out the repository right now I see it's still actively developed and also already makes use of gopls as main engine. The plugin is kept minimal, but it can be configured in almost all aspects so you need to enable some option in order to “beautify“ the highlighting. Make sure to check out their extensive tutorial as well as their great :help documentation that also includes the required information about the highlighting configurations. To answer your question: I guess the option you're looking for it g:go_highlight_functions. Here's an example with only some of the options you'd like to enable for a better highlighting, but also see :help go.syntax for even more options and details:

let g:go_highlight_structs = 1
let g:go_highlight_methods = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_operators = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_format_strings = 1
let g:go_highlight_variable_declarations = 1
let g:go_highlight_variable_assignments = 1
let g:go_auto_type_info =1
let g:go_fmt_autosave = 1
let g:go_mod_fmt_autosave = 1
let g:go_gopls_enabled = 1

I hope this helps to fix your problem 😄

jdzikowski commented 4 years ago

Thanks, that did the job. This line here is the most important though the others come in handy: let g:go_highlight_functions = 1 I'm closing the issue since it's resolved.