Highlighting the current line & column in VIM

Welcome to the news archive. Here you'll find all the news items, ordered by date. You can use the links below to read other news items, or go back to the archive overview.

2007-07-20 12:35 - Highlighting the current line & column in VIM

It's already in the VIM help file, but I never found it until now. To highlight the current row/line and the current column use this in your .vimrc:

  au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
set cursorline cursorcolumn

I found this quite useful while programming. Eclipse has a similar feature; when I got used to that I started missing it in VIM. Until now that is :)

Post a comment


Comments

Doesn't seem to work here...strangely.

by Mike - 1 year, 4 months ago.


Thanks for letting me know. It only works after switching windows. I've updated the post by adding:

  set cursorline cursorcolumn

If you add that to your vimrc I'm sure it'll work - it does here.

by Sybren Stüvel - 1 year, 4 months ago.


Yep. In fact, that's what I ended up doing, except sans the bit about the column. Not sure I need that.

by Mike - 1 year, 4 months ago.


Here is also doesn't seem to work - I get the horizontal line, but no vertical line! I've got all three lines in my ~/.vimrc.

by Paul van der Walt - 9 months, 3 weeks ago.

Post a comment

Use Restructured Text to markup the comment. The link opens in a new window.


All fields are required, except when otherwise noted. You can use a limited subset of Restructured Text to markup the comment.

It might take up to five minutes for your comment to show up, due to caching of the pages.