56

What is the best way to highlight the whole current line in Vim? In some IDEs I am able to set some sort of 20% opacity of the line I am editing, this is great to find where I am rather quickly.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Helmut Granda
  • 4,565
  • 7
  • 35
  • 51

3 Answers3

109

To highlight the current line use

:set cursorline

To highlight the current column use

:set cursorcolumn

The visual appearance of this can be modified. Have a look around :help hl-CursorLine or hl-CursorColumn.

Benjamin Bannier
  • 55,163
  • 11
  • 60
  • 80
16

See the Vim wiki on this subject for the complete story.

I especially found the following bit handy (when working with more than one window).

autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline

Only highlight the current line in the active window.

Niels Bom
  • 8,728
  • 11
  • 46
  • 62
9

Shift + V puts you in visual mode, highlighting the entire line.

Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
Andrew Cowenhoven
  • 2,778
  • 22
  • 27