Thursday, April 5, 2012

Re: highlighting spaces

On Thursday, April 5, 2012 1:39:43 PM UTC-5, Ben Fritz wrote:
> On Thursday, April 5, 2012 12:20:01 PM UTC-5, Zetah Ghamin wrote:
> > Hi,
> >
> > I find it convenience to highlight the tab and trailing spaces. So I wrote these line in my .vimrc:
> >
> > hi Tab guibg=Blue ctermbg=Blue
> > hi TrailSpace guibg=Red ctermbg=Red
> > match Tab /\t\+/
> > match TrailSpace / \+$/
> >
> > But only Tabs turn blue, and space looks the same. If I switch the last two lines, then only tailing spaces turn red.
> >
> > How come?
> >
>
> The :match command only allows a single matched pattern at a time. Use :2match or even better the matchadd() function to add multiple matches.
>
> Note that matches are local to the window and any split windows will not contain any matches defined directly in the .vimrc.
>
> See here for a more complete discussion:
>
> http://vim.wikia.com/wiki/Highlight_long_lines
> http://vim.wikia.com/wiki/Highlight_unwanted_spaces

Also read through :help match-highlight in its entirety.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: