A vim script for making the Rust attribute highlighting a tiny bit better
Copy the file to '~/.config/nvim/after/syntax/rust.vim'
Copy the file to '~/.vim/after/syntax/rust.vim'
syn region rustAttribute start="#!\?\[" end="\]" contains=CONTAINED | |
syn region rustFuncAttribute start="#!\?\[\_s*\w\+\_s*(" end=")\_s*\]" contains=rustAttributeContents keepend | |
syn match rustSimpleAttribute "#!\?\[\_s*\w\+\_s*\]" | |
syn region rustDeriveAttribute start="#!\?\[\_s*derive\_s*(" end=")\_s*\]" keepend | |
syn region rustAttributeContents matchgroup=rustAttributeParens start="(" end=")" contains=CONTAINED contained | |
syn region rustAttributeBalance start="(" end=")" containedin=rustAttributeContents contained contains=TOP | |
syn region rustAttributeBalance start="\[" end="\]" containedin=rustAttributeContents contained contains=CONTAINED | |
hi def link rustSimpleAttribute Define | |
hi def link rustFuncAttribute Define | |
hi def link rustDeriveAttribute Define |