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.
Highlight the whole current line
Asked Answered
Related: vimrc - How can I change the colour of the line highlighted with the 'cursorline' option? - Vi and Vim Stack Exchange –
Adrianeadrianna
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
.
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.
Shift + V puts you in visual mode, highlighting the entire line.
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.