Repository navigation
Evil makes hidden cursor reappear on window configuration changes #592
Description
Activity
Original comment by Vasilij Schneidermann (Bitbucket: wasamasa, GitHub: wasamasa):
I've settled for a workaround.
blink-cursor-modeusesinternal-show-cursorto hide and display the cursor in regular intervals. I'll still leave this open though because the semantics ofcursor-typeandinternal-show-cursorare different.I'm not sure if this will help anyone, but I found a way to hide the cursor in
evil mode. I tried this as a last-ditch effort and I have now idea how or why this works. I've only tested inorg-agendausingsetq-local, so your milage may vary. But before settingcursor-typetonil, setevil-default-cursorto'(ignore).You can also do:
(setq-local evil-normal-state-cursor '(bar . 0))
You might also need to set other
evil-*-state-cursorvariables, depending on what you want to do.;; Helpers for hiding the cursor in evil. (defun >evil-nil-cursor-spec () (setq cursor-type nil)) (defun >evil-hide-cursor-local () "Hide the cursor in the current buffer." (interactive) (setq-local evil-default-cursor #'>evil-nil-cursor-spec ;; Add more states here as desired evil-normal-state-cursor #'>evil-nil-cursor-spec evil-motion-state-cursor #'>evil-nil-cursor-spec))
edit: Or, use this much simpler alternative:
(setq-local evil-default-cursor (list nil) ;; Add more states here as desired evil-normal-state-cursor (list nil) evil-motion-state-cursor (list nil))
- added a commit that references this issue
on Apr 27, 2026 - added a commit that references this issue
on Jun 2, 2026 - added a commit that references this issue
on Jun 2, 2026 @tomdl89 this fix seems to cause the block cursor to be invisible in
insertnormal mode in a bare config (nextstep, macOS). For me I'm seeingevil-refresh-cursorfirst callevil-set-cursorwitht, but the secondevil-set-cursorcall is thennil(from(evil-state-property 'normal :cursor t)).@tomdl89 this fix seems to cause the block cursor to be invisible in insert mode in a bare config (nextstep, macOS). For me I'm seeing
evil-refresh-cursorfirst callevil-set-cursorwitht, but the secondevil-set-cursorcall is thennil(from(evil-state-property 'normal :cursor t)).In insert mode or in normal mode? I see that this would be a problem in normal mode. So far,
:cursor nil(which is probably implicitly set if no:cursoris given) was used to indicate that a cursor should use the default cursor. But now that nil actually means "no cursor", we don't have a value for indicating "use the default cursor". We'd probably need something likeunspecifiedin faces.Maybe it's easier to revert this and simply change the docs to say that
(list nil)should be passed for "no cursor" (instead of justnil).Sorry I missed this. I use doom Emacs which has explicit settings for all states.
Oops, yes, the cursor is only invisible in normal (and IIRC visual mode)—my mistake.
I've reverted this. My mistake for not checking before merging. I don't have much time for evil these days but blindly merging PRs is admittedly not a good solution. @real-or-random if you want to make a new PR that actually fixes this properly, and you can thoroughly test it in vanilla evil, not just Doom, then go ahead.
@real-or-random if you want to make a new PR that actually fixes this properly, and you can thoroughly test it in vanilla evil, not just Doom, then go ahead.
Sorry for not testing in vanilla Emacs. I didn't expect that this could cause trouble here.
Given the maturity of the codebase, I tend to think that it's best to simply change the docs to match the actual behavior. This won't require touching actual code and so no testing will be required. See #2026.
- added 2 commits that reference this issue
on Jun 2, 2026 - added a commit that references this issue
on Jun 3, 2026 Agreed, that seems like a sensible approach. Thanks @real-or-random !
Originally reported by: Vasilij Schneidermann (Bitbucket: wasamasa, GitHub: wasamasa)
I wrote a package that hides the cursor by setting
cursor-typetonil. This works initially, however changing the window configuration restores it because Evil hasevil-refresh-cursorinwindow-configuration-change-hook. The comment above suggests it should just be changing the cursor color...See also zone-nyan#5.