[Bug] Some lisp parentheses not highlighted properly
Describe the bug
Some lisp parentheses — those that have ' or ` before the opening parenthesis — are not highlighted properly.
To Reproduce
In the following example, notice #'(lambda ... part. Everything following it won't be highlighted.
(defun where (&key title artist rating)
#'(lambda (cd)
(and
(if title (equal (getf cd :tit) title) t)
(if artist (equal (getf cd :art) artist) t)
(if rating (equal (getf cd :rat) rating) t))))
If you introduce a whitespace between #' and (lambda then it is highlighted normally. (See screenshot below)
Screenshots


Additional context
I've tried to manually fix it by changing the rule for parentheses to allow optional characters before (, but I was not able to make it work.
@narimiran can you show me your configuration?
let g:rainbow_conf = {
\ 'guifgs': ['lightblue', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['green', 'yellow', 'darkblue', 'magenta'],
\ 'separately': {
\ 'pascal': {
\ 'parentheses': ['start=/(\ze[^*]/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/\[|/ end=/|\]/ fold', 'start=/{/ end=/}/ fold']
\ }}
\}
let g:rainbow_active = 1
nmap <leader>hh :RainbowToggle<CR>
And I use https://github.com/kovisoft/slimv for Lisp.
Some lisp parentheses — those that have
'or`before the opening parenthesis — are not highlighted properly.
@luochen1990 any chance that this might get fixed?
Update:
I've managed to fix this by adding the following rule to my config for racket (the same should be for lisp too):
let g:rainbow_conf = {
\ 'guifgs': ['lightblue', 'darkorange2', 'darkcyan', 'firebrick', 'seagreen2', 'magenta'],
\ 'ctermfgs': ['green', 'yellow', 'darkblue', 'magenta'],
\ 'separately': {
\ 'pascal': {
\ 'parentheses': ['start=/(\ze[^*]/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/\[|/ end=/|\]/ fold', 'start=/{/ end=/}/ fold'],
\ },
\ 'racket': {
\ 'parentheses': ["start=/(/ end=/)/ fold", "start=/`(/ end=/)/ fold", "start=/'(/ end=/)/ fold", 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\} } }
Is there a better way than doing this one by one, and also duplicating what is in default rule for parentheses?
@narimiran
Is there a better way than doing this one by one, and also duplicating what is in default rule for parentheses?
Actually, VimScript provided the map function, so you can use this to reduce the duplications, use :h map() for more details.