Running M-x hl-line-mode
enables highlighting for the current buffer.
How can i set highlighting current line to be enabled in init.el
?
just add this to your .emacs or init.el file : (global-hl-line-mode 1)
.
M-x RET customize-group RET emacs RET
. A buffer will open listing all the groups you can customize in emacs(like editing, programming, environment, etc.). There will also be a search field in the top of the buffer. You could also enabled hl-line globally by going to customize-group, and setting the global-hl-line-mode to a non-nil value.
Commented
Jul 31, 2016 at 19:16
@Chakravarthy Raghunandan answered your question completely and succinctly.
But you owe it to yourself to learn to ask Emacs -- that will help you much more, both immediately and in the long run. One of the goals of this particular Stack-Exchange site is to help not only by answering specific questions, but by helping you learn to help yourself.
This kind of question is answered immediately by asking the Emacs manual (C-h r
) what it has about hl-line-mode
: just type i hl-line-mode
(i
is bound to the command Info-index
). That takes you immediately to node Cursor Display of the manual, where you see this:
To make the cursor even more visible, you can use HL Line mode, a minor mode that highlights the line containing point. Use
M-x hl-line-mode
to enable or disable it in the current buffer.M-x global-hl-line-mode
enables or disables the same mode globally.
It really couldn't be simpler, in this case. No need to open a web browser, go to a Q&A site, and type up your question. Just ask Emacs.
You have the hypertext manual(s) ready-to-hand at all times when you are in Emacs. C-h i
opens the manuals browser (Info) for any installed manual, including the Emacs manual and the Elisp (Emacs-Lisp) manual. If you haven't yet taken time to get to know Info, I recommend you start by looking at the Info manual about Info: C-h i m Info
.
C-h r i
gives me The Info diretory node has no index_?
M-x report-emacs-bug
if it is part of regular Emacs. i
is generally recommended as the best (or one of the best) ways to find stuff in Emacs. If some manual has no index then I'd consider that a bug, or at least a place where there's room for improvement.
C-h r
.
C-h r
doesn't take you to the Emacs manual then the problem is likely in your init file. Do you see the same problem when you start using emacs -Q
?
(global-hl-line-mode t) ;; put this in your .emacs.d/init.el or .emacs file
if you want to trigger this only when you are in gui emacs then put this instead
(when window-system (global-hl-line-mode t))
you can toggle this minor mode using the command
M-x global-hl-line-mode
when you just want it temporarily
if you only want to trigger this in your current buffer use M-x hl-line-mode Note this is a toggle so that M-x hl-line-mode (a second time) will disable it.