In vim, we can use "set cursorline" in dotvim file to turn it on. Is there a way to do this in emacs?
I don't think there's an exact equivalent built in. You can use hl-line-mode to highlight the current line, and customising that mode lets you set the highlighting to be underlining rather than the default different background colour -- but the underline you get stops at the end of the text in the line, rather than continuing to the edge of the window.
In your .emacs, customize the face for hl-line-mode
, with something like:
(global-hl-line-mode 1)
(set-face-attribute hl-line-face nil :underline t)
hl-line-face
is a variable that stores the name of the face hl-line-mode
uses to show the current line. You can customize the :foreground
:background
and a bunch of other attributes to your liking. Check the docs here.
The global-hl-line-mode
turns on highlighting the current line in all buffers. If you just want it in some buffers, turn it on with M-x hl-line-mode.