VIM Highlight the whole current line

VimNavigationHighlight

Vim Problem Overview


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.

Vim Solutions


Solution 1 - Vim

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.

Solution 2 - Vim

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.

Solution 3 - Vim

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHelmut GrandaView Question on Stackoverflow
Solution 1 - VimBenjamin BannierView Answer on Stackoverflow
Solution 2 - VimNiels BomView Answer on Stackoverflow
Solution 3 - VimAndrew CowenhovenView Answer on Stackoverflow