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

Function names not highlighted in Go #203

Closed
jdzikowski opened this issue Apr 28, 2020 · 2 comments
Closed

Function names not highlighted in Go #203

jdzikowski opened this issue Apr 28, 2020 · 2 comments

Comments

@jdzikowski
Copy link

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
Copy link
Contributor

arcticicestudio commented Apr 28, 2020

Hi @jdzikowski 👋

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
Copy link
Author

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.

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

No branches or pull requests

3 participants