vim-scala
vim-scala copied to clipboard
Cannot give ScalaSquareBrackets a custom color
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!
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.
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.
If you've got a fix, could you put in a PR?
@fldef Thanks! :grinning:
When I get back to my working on my colorscheme, I'll take this into account.