Tuesday, September 7, 2010

Re: highlight lines longer than 80 chars for a specific file types.

On Sep 4, 6:17 pm, bill lam <cbill....@gmail.com> wrote:
>
> try (untest):
>
> au FileType cpp       match ErrorMsg '\%>80v.\+'
> au FileType java      match ErrorMsg '\%>100v.\+'
>

This will almost work, except that matches are window-local. So
loading another buffer of a different filetype into the same window
will not clear the highlight, and additionally loading the same buffer
in a new window will not add the file type.

In Vim 7.2 I had a setup that would call a function on WinEnter as
well as FileType (or maybe BufWinEnter?) to clear/add the appropriate
highlighting. Some of my methods are captured in the following tips:

http://vim.wikia.com/wiki/Highlight_long_lines
http://vim.wikia.com/wiki/Detect_window_creation_with_WinEnter

However, in Vim 7.3, I found all this unneccessary with the addition
of the 'colorcolumn' option. I highly reccommend upgrading to version
7.3 and using this option instead of trying to get the long-line
highlight working.

--
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: