tags:

views:

394

answers:

1

Is there any way to make Vim/gVim highlight the right-margin at the current document? I have just begun to work with Vim for a while and I found it annoyed without the right-margin at column 80.

+5  A: 

There's no simple way to visualize vertical line of textwidth-margin. But you can highlight all symbols after position 80 on their lines:

:match ErrorMsg /\%>80v.\+/

So, general solution is to put in .vimrc something like that:

:autocmd BufWinEnter * call matchadd('ErrorMsg', '\%>' . &l:textwidth . 'v.\+', -1)

(By the way, as an example of similar, but more complicated highlighting you could take a look at my answer to question http://stackoverflow.com/questions/2158305/is-it-possible-to-display-indentation-guides-in-vim).

ib
Thank you, that does work :-).
CMPITG