emacs-evil / evil

The extensible vi layer for Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

provide vim-like indication of mode in statusline

saurik opened this issue · comments

Issue type

  • Enhancement request

Environment

Emacs version: 26.3
Operating System: Ubuntu 20.04.1
Evil version: 1.15.0 (20240128.957)
Evil installation type: MELPA
Graphical/Terminal: Terminal
Tested in a make emacs session (see CONTRIBUTING.md): Yes

Reproduction steps

  • Start Emacs
  • Press i or R from normal (or Insert from normal/insert/replace)
  • Type something
  • Glance at the bottom left and freak out because it is blank

Expected behavior

When I'm in vim, and I enter either insert or replace mode, it is very very obvious as the statusline shows "-- INSERT --" or "-- REPLACE --". (This is also true of visual mode, but I happen to not use that mode.)

Actual behavior

When I'm in emacs with evil mode, and I enter the insert or replace states the... whatever emacs calls it... momentarily shows "-- INSERT --" or "-- REPLACE --"; but, it then disappears when I start typing :(.

If I switch between the replace/insert states using the Insert key, I am momentarily shown "Overwrite mode enabled in current buffer" (or "disabled"); but, this indication also goes away if I start to type.

Further notes

I was trying evil out again (every now and then I get excited to switch and then run into some usually-serious bug that I end up filing which somehow only I run into, seemingly as I'm not an emacs user yet).

This time, I didn't notice any blocking bugs :D, but I was surprised at how disorienting the experience felt... after playing with it, I realized that I was relying a lot on this visual indication of my current mode.

(As it stands, there is literally no indication of the mode I'm in once I start typing, which seems lacking something very important. Is this maybe something vim added but vi didn't have, and I'm just spoiled?)

:( I just read through more of the evil documentation and realized that I guess I'm supposed to be staring at a single character in the emacs modeline for this purpose? I went back into the make emacs session (to get the modeline) and, sure enough, I hadn't noticed the N become an I. Is there no way for this information to be kept in the vim statusline? It seems strange to go out of the way to replicate the "-- INSERT --" display but then reinterpret it from a constant status to a transient message... I think I'd have been less confused if it didn't show anything, as it wouldn't trigger the now 25-year-old brain habituation that, if "-- INSERT --" suddenly disappears, I've been thrown back to normal mode... this is so deeply ingrained that it isn't even a conscious thought process I experience: it is just this subconscious vibe I get in my peripheral vision about what is going on in my editor.

(I have now discovered evil-echo-state, which has given me the name of the statusline in emacs/evil as well as provided me at least some reprieve from the constant nagging feeling that I've exited insert mode every time that message disappears.)

(BTW: I'm sorry I keep leaving little updates. I really am. Honestly. Like, that prior post only felt necessary as I had added that extra paragraph in my first message about the lack of any visual indication at all: there was one, it was just very subtle, and only if you use a modeline. But, in that message, I also noted the side thought about how I'd figured out that what was really causing the disorientation was more-so the message disappearing than failing to be a status, and so rather than waste someone else's time writing me a message to try evil-echo-state that seems like my job to correct myself. Wow, this is getting so meta. I'm sorry. I still, though, feel like evil would feel a lot more natural to a vim user if the statusline persisted.)

@saurik I think you make a good point. Maybe it's an option we can add. I went here: https://github.com/emacs-evil/evil/blob/master/evil-states.el#L37 and changed the tag to " --NORMAL-- " and that persists in the modeline:
image
So can see that's it's trivial to hack in. If you like the look of it, I can have a think about making this a defcustom so it doesn't need to be a hack..?