Вопрос

Is there a way to make the emacs cursor a "thinner" bar when it is positioned on an empty line? If the line has whitespace, or text, it should be the default width block cursor. This is for emacs 24.

This is the default cursor behaviour on XEmacs, FWIW.

Это было полезно?

Решение

To change cursor dynamically, depending on the contents of the current line add this to your .emacs:

(defun cursor-shape-hook ()
    (if (equal (thing-at-point 'line) "\n") (setq cursor-type 'bar)
       (setq cursor-type 'box)))

(add-hook 'post-command-hook 'cursor-shape-hook)

All possibilities for cursor shape are:

nil       don't display a cursor
box       display a filled box cursor
hollow    display a hollow box cursor
bar       display a vertical bar cursor with default width
(bar . WIDTH)     display a vertical bar cursor with width WIDTH
hbar          display a horizontal bar cursor with default height
(hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT
ANYTHING ELSE     display a hollow box cursor
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top