vhda / verilog_systemverilog.vim

Verilog/SystemVerilog Syntax and Omni-completion
359 stars 86 forks source link

Rainbow 'begin/end' Support #204

Open tnguyen-tx opened 3 years ago

tnguyen-tx commented 3 years ago

Thanks for the awesome plugin. I've tried to match begin/end with matching colors just like rainbow plugin does for parentheses. image However even I changed the parentheses setting in rainbow it still doesn't work image image I believe this is due to syntax priority between verilog_systemverilog and rainbow. What should I do to solve this issue? Thanks.

vhda commented 3 years ago

I can't find a way of disabling this highlight on my side, as it is. I've looked at some of those rainbow plugins and some have an "after" option that could be used to overcome this. Could you give it a try?

netvolcano commented 2 years ago

Try to add the following lines into you rainbow setting (i.e. put them into let s:rainbow_conf = {...} )

\    'verilog_systemverilog': {
\        'parentheses': [
\              'start=/(/ end=/)/ fold',
\              'start=/\[/ end=/\]/ fold',
\              'start=/{/ end=/}/ fold',
\              'start=/\<begin\>/ end=/\<end\>/',
\         ],
\        'after': [
\              'syn clear verilogBeginEnd',
\              'syn match verilogOperator "[&|~><!*#%@+/=?:;}{,.\^\-\[\]]" ',
\              'syn region verilogComment start="/\*" end="\*/" contains=verilogTodo,@Spell ',
\              'syn match  verilogComment "//.*" contains=verilogTodo,@Spell ',
\           ],
\    },
vhda commented 1 year ago

@tnguyen-tx did @netvolcano solution work for you?

netvolcano commented 1 year ago

Snipaste_2023-05-11_10-02-13

With my setting in the rainbow plugin.

real-bird-kun commented 6 months ago

Try to add the following lines into you rainbow setting (i.e. put them into let s:rainbow_conf = {...} )

\    'verilog_systemverilog': {
\        'parentheses': [
\              'start=/(/ end=/)/ fold',
\              'start=/\[/ end=/\]/ fold',
\              'start=/{/ end=/}/ fold',
\              'start=/\<begin\>/ end=/\<end\>/',
\         ],
\        'after': [
\              'syn clear verilogBeginEnd',
\              'syn match verilogOperator "[&|~><!*#%@+/=?:;}{,.\^\-\[\]]" ',
\              'syn region verilogComment start="/\*" end="\*/" contains=verilogTodo,@Spell ',
\              'syn match  verilogComment "//.*" contains=verilogTodo,@Spell ',
\           ],
\    },

Hi~ I am trying to use your solution, but it doesn't work for me. The error info is in the following picture. Would you please help me figure it out? image

My configuration is: image

Thank your for your help in advance :)

netvolcano commented 6 months ago

Have you installed the the verilog syntax plugin as below? Plugin 'vhda/verilog_systemverilog.vim'

If it will not take effects after you installed the plugin, you need delete a line of "syn keyword verilogLabel begin end fork join" from the verilog_systemverilog.vim file in the syntax directory.

netvolcano commented 6 months ago

You need to modify the below statement in the verilog_systemverilog.vim file in the syntax directory (I think it is the root for your error messages): # syn keyword verilogStatement begin end syn keyword verilogStatement begin end image

real-bird-kun commented 6 months ago

You need to modify the below statement in the verilog_systemverilog.vim file in the syntax directory (I think it is the root for your error messages): # syn keyword verilogStatement begin end syn keyword verilogStatement begin end image

Cool, you're totally right. It works. Thanks a lot. I am wondering how your vimrc looks like, because I think you must have a lot great config for writing veirlog/sv efficiently. Anyway, thank you for your help in time :)