emacs:highlight the current line by underline it

emacs

Solution

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.

Problem

In vim, we can use "set cursorline" in dotvim file to turn it on. Is there a way to do this in emacs?

Original source

Related problems