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

[Bug] Some lisp parentheses not highlighted properly #136

Open
narimiran opened this issue Dec 18, 2019 · 5 comments
Open

[Bug] Some lisp parentheses not highlighted properly #136

narimiran opened this issue Dec 18, 2019 · 5 comments
Labels
config reference Some Advanced Configuration Examples Can be Referenced by other Users feature request

Comments

@narimiran
Copy link
Contributor

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

screenshot1

screenshot2

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.

@luochen1990
Copy link
Owner

@narimiran can you show me your configuration?

@narimiran
Copy link
Contributor Author

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.

@narimiran
Copy link
Contributor Author

Some lisp parentheses — those that have ' or ` before the opening parenthesis — are not highlighted properly.

@luochen1990 any chance that this might get fixed?

@narimiran
Copy link
Contributor Author

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?

@luochen1990
Copy link
Owner

@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.

@luochen1990 luochen1990 added config reference Some Advanced Configuration Examples Can be Referenced by other Users feature request labels May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config reference Some Advanced Configuration Examples Can be Referenced by other Users feature request
Projects
None yet
Development

No branches or pull requests

2 participants