简体   繁体   中英

Multiple highlight with autocmd in vimrc

I would like to use two autocmd, to highlight lines too long, and to highlight spaces at the end of lines, but I don't succeed, only the last of the two commands is displayed... Is it possible ?

Here is the lines concerned:

augroup vimrc_autocmds
    autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929
    autocmd BufEnter * match OverLength /\%81v.*/
    autocmd BufEnter * highlight UnwantedSpaces ctermbg=red guibg=#red
    autocmd BufEnter * match UnwantedSpaces /\s\+$/
augroup END

You can only use one match at a time. If you want to use multiple you can use 2match and 3match . You only have three of these to use simultaneously without defining syntax highlighting for what you're trying to match.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM