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

Cannot give ScalaSquareBrackets a custom color #64

Open
fdietze opened this issue May 27, 2014 · 4 comments
Open

Cannot give ScalaSquareBrackets a custom color #64

fdietze opened this issue May 27, 2014 · 4 comments

Comments

@fdietze
Copy link

fdietze commented May 27, 2014

Hi, I'm writing my own colorscheme with focus on Scala.

When I'm trying to give ScalaSquareBrackets a custom one it doesn't work:

hi scalaSquareBrackets guifg=#006fe6 guibg=NONE guisp=NONE gui=bold

Is this a bug or am I doing something wrong?

Thanks!

@derekwyatt
Copy link
Owner

AFAIK that's not the way to do it. What you can specify is the colour highlighting for Type, which is what the scalaSquareBrackets is specified to be. If you want to change the highlighting group that scalaSquareBrackets is defined for, we do that a different way. Effectively, we would specify the value for the matchgroup in a variable and you could override that. A pull request for the change (or a better idea) would be heavily appreciated.

@fldef
Copy link

fldef commented Jun 29, 2018

I'm four years late, but here goes...

Is this a bug or am I doing something wrong?

Use scalaSquareBracketsBrackets (note the extra Brackets) to highlight the end brackets. The scalaSquareBrackets region contains other matches, and vim uses those for inner colors.

What you can specify is the colour highlighting for Type... (or a better idea) ...

It's common for syntax scripts to use hi def link rather than hi link to link a language style name to a global style name (syntax/scala.vim is one of the few that doesn't). This allows the user to relink a language name to whatever they want from their .vimrc file. Using hi link instead requires the user to change global styles (as mentioned) or to modify the language's syntax file directly.

vim-ruby, for example, uses hi def link. I don't like the special treatment vim gives to Ruby's regular expressions, so I change it by adding the following lines in my .vimrc:

hi! link rubyRegexpDelimiter rubyRegexp
hi! link rubyRegexpSpecial rubyRegexp

Using hi def link in syntax/scala.vim would give users the same kind of options.

More details from :help :highlight-default:

Using [default] is especially useful to overrule the highlighting of a
specific syntax file.  For example, the C syntax file contains:
        :highlight default link cComment Comment
If you like Question highlighting for C comments, put this in your vimrc file:
        :highlight link cComment Question
Without the "default" in the C syntax file, the highlighting would be
overruled when the syntax file is loaded.

@derekwyatt
Copy link
Owner

If you've got a fix, could you put in a PR?

@fdietze
Copy link
Author

fdietze commented Jul 2, 2018

@fldef Thanks! 😀

When I get back to my working on my colorscheme, I'll take this into account.

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

3 participants