Avoiding Insert/Normal mode confusion

The most obvious downside to modal editing is confusion among modes – not remembering whether one is in Normal or Insert mode.

A possible solution is to signal the current mode with background color:

In my case, however, I found that the only way to prevent mode confusion was to change the color of the cursor (where attention is focused).

To understand why, here is a short video that you may find entertaining:

1 Like

I already knew about the gorilla so I’m biased :joy:

Having some infos to the left of the status line help me honestly but @mawww keeps refusing it in core. I wouldn’t rely to the color of the cursor only—I know it’s on the right but it’s a long reach—to have the mode information for disabled people. Something similar to Helix with color modes would be neat.

I knew about the gorilla too, which I why I missed the curtain and player trick.

I meant that in my case, I managed to miss mode changes even with something as drastic as white/dark background changes (analogous to the curtain trick in the video). As I said, the only effective alert about mode changes was changes in the appearance of the cursor (the focus of attention).

Aligning mode info on the left of the modeline would help, too.

How about changing the shape of the cursor?

Yes, that would make it too. I assume you would use underlining vs. a colored block.

Helix changes the cursor shape of the main cursor, which is neat, but it’s not possible in Kakoune.

yeah a cursor shape for insert mode will be easy to add

I know this has been discussed in the past, but the situation was still with ncurses.

Maybe changing the cursor shape would now be possible.

Issues related to the discussion:

While Kakoune doesn’t use ncurses anymore, it’s still true that the terminal only supports one cursor (while Kakoune supports multiple) and Kakoune’s editing model defines the cursor to be at least 1 character cell wide, not 0, so the “vertical line” cursor often used to indicate insert mode would be inaccurate.

It would be possible to “blink” the character cell under the cursor so that most of the time it displayed the actual character, but some of the time switched to displaying something like U+258F LEFT ONE EIGHTH BLOCK “▏” but that would be clunky in its own way.

If I ever decide to write my own text editor for some reason, I’ll experiment with an editing model that supports zero-width selections, but I expect it’s a bit late to change that in Kakoune.

1 Like

Mode confusion is an issue for me as well. I’d like to try changing the colour of the cursor, could you please share your recipe?

this is similar to Blinking statusline when selections are out of current view

I would also be interested in trying sound feedback, perhaps having a click/beep sound in insert mode. I’m not sure if I could tolerate this but would be interested in experimenting. Any sound recipes welcomed.

We can still ask the terminal to make the main cursor a vertical line while in insert mode.
It won’t be as configurable in terms of faces but I don’t think that’s a big deal

To change cursor color, you can try something like this:

hook -group tell_mode global ModeChange push:.*:insert %{
    set-face window PrimaryCursor        black,bright-red+b
    set-face window PrimaryCursorEol     black,bright-red+b
    set-face window SecondaryCursor      bright-magenta,magenta+b
    set-face window SecondaryCursorEol   bright-magenta,magenta+b
}

hook -group tell_mode global ModeChange pop:insert:.* %{
    set-face window PrimaryCursor        black,bright-green+b
    set-face window PrimaryCursorEol     black,bright-green+b
    set-face window SecondaryCursor      black,bright-white+b
    set-face window SecondaryCursorEol   black,bright-white+b
}

Of course, the choice of colors is yours.

Please note that Kakoune starts in Normal mode, so the colors you choose for these hooks must be consistent with the colors when Kakoune starts (which depend on your colorscheme).

pepper looks to support zero-width selections, with an active selection mode, e.g., in normal mode, you can try d and it will do nothing.

https://git.sr.ht/~lessa/pepper