On Tue, Jun 16, 2009 at 17:36, Charles Campbell <[email protected]
> wrote:

>
> Victor Noagbodji wrote:
> > hello i'm having problems with these lines in my vimrc. i modified
> > them twice and i always encounter new cases where it does not work. so
> > i'm trying here too.
> >
> > the idea is to highlight those columns with more than 80 characters. i
> > started with:
> >
> > hi rightMargin term=Bold ctermfg=Blue ctermbg=White guibg=Blue
> guifg=White
> > match rightMargin
> > match rightMargin /.\%>80v/
> >
> > but then it wouldn't work with tabe, and i have been told that match
> > was window local so i changed it to:
> >
> > hi rightMargin term=Bold ctermfg=Blue ctermbg=White guibg=Blue
> guifg=White
> > autocmd BufRead,BufNew * match rightMargin /.\%>80v/
> >
> > and today it did not work with tabnew (a command i did not know
> > about). and i have been told to use:
> >
> > hi rightMargin term=Bold ctermfg=Blue ctermbg=White guibg=Blue
> guifg=White
> > au VimEnter,WinEnter * match rightMargin /.\%>80v/
> >
> > now it does not work at all.
> >
> > i will appreciate any help in solving this issue.
> > thanks
> >
> >
> "match" does operate only in the current window.  Syntax highlighting
> files generally clear syntax any currently present highlighting, so your
> "rightMargin" highlighting group is often no longer defined.  You can
> get around that by putting the "hi rightMargin..." into some autocmds,
> too.  So, try:
>
> au VimEnter,BufNew,BufRead,TabEnter    *    hi rightMargin term=Bold
> ctermfg=Blue ctermbg=White guibg=Blue guifg=White
> au VimEnter,BufNew,BufRead,TabEnter    *    windo match rightMargin
> /.\%>80v/
>
> Regards,
> Chip Campbell
>

Hello,

I use:

set textwidth=80
au BufNewFile,BufRead  * exec 'match Error /\%>' .  &textwidth . 'v.\+/'

You can use your pre-defined "rightMargin" instead "Error"
Regards,
J. F. Mitre

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to