This is a newbie question.
I'd like to have a red cursor with a width of 4. This code doesn't work:
(setf cursor-type '(bar . 4))
(set-cursor-color "#FF0000")
how can i correct this to display a red cursor with a width of 4?
Since cursor-type
is a buffer-local variable, if you use setf
(or setq
) you only change its value in the temporary buffer used while reading the init file (ref.). When a variable's doc string says "Automatically becomes buffer-local when set" it means you have to use setq-default
to change it.
This works for me
(setq-default cursor-type '(bar . 4))
(set-cursor-color "#FF0000") ; You can also use ‘"red"’.
From the comments: You can change the shape of the cursor in unselected windows by setting cursor-in-non-selected-windows
, for example (setq-default cursor-in-non-selected-windows '(bar . 1))
.
cursor-in-non-selected-windows
, for example (setq-default cursor-in-non-selected-windows '(bar . 1))
, or you can make it invisible by setting the variable to nil
(see C-h v cursor-in-non-selected-windows
for all the options). Regarding the color, I don't know how make Emacs use a different one for the unselected windows' cursor. Maybe How do I change the cursor face per buffer? is of help?
Commented
Feb 13, 2021 at 17:41