Highlight the whole current line
Asked Answered
A

3

59

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.

Adminicle answered 5/1, 2012 at 22:27 Comment(1)
E
113

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.

Embryotomy answered 5/1, 2012 at 22:30 Comment(0)
N
17

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.

Nomadic answered 13/6, 2012 at 12:59 Comment(0)
D
10

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

Detritus answered 5/1, 2012 at 22:30 Comment(3)
It makes sense. Sorry for the confusion.Adminicle
This enters Vim in Visual Mode though. When you are going to move to another line, the lines in between will be highlighted as well.Navar
good point, although because this changes mode, it's unusable for cases when i'm iterating over * search results.Excruciation

© 2022 - 2024 — McMap. All rights reserved.