helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
32.52k stars 2.4k forks source link

Keybind to exit sticky view mode #11166

Open lefp opened 1 month ago

lefp commented 1 month ago

As far as I can tell, there is no way to exit sticky view mode (Z) except by pressing Esc. I don't like reaching over to hit Esc.

The ability to configure a keybind for this would solve this problem. E.g. via a dedicated command:

[keys.normal.Z]
C-l = "exit_minor_mode"
archseer commented 1 month ago

Esc has a binding just like any other key that you can bind to other keys: https://github.com/helix-editor/helix/blob/22a051408a467ff8b3e43457961d5497903dc7d0/helix-term/src/keymap/default.rs#L183

(I also recommend remapping esc to a better place on the keyboard)

lefp commented 1 month ago

Esc has a binding just like any other key that you can bind to other keys:

https://github.com/helix-editor/helix/blob/22a051408a467ff8b3e43457961d5497903dc7d0/helix-term/src/keymap/default.rs#L183

If you're suggesting this:

[keys.normal.Z]
C-l = "normal_mode"

I've already tried it (latest master, 22a051408a467ff8b3e43457961d5497903dc7d0), and pressing the keybind in sticky view mode doesn't do anything. Does it work on your machine?

lefp commented 1 month ago

After messing around a little more, it looks like running any mode-switching command from Sticky View causes it to switch to that mode, but also does not exit Sticky View.

Here, for example, I enter insert_mode from Sticky View. Instead of leaving Sticky View, it allows me to insert any characters that are not bound to a Sticky View key. https://asciinema.org/a/wBztUNYfjZf8kc14jz25QB0nq

the-mikedavis commented 1 month ago

Yeah sticky is only able to be cleared currently by escape: https://github.com/helix-editor/helix/blob/22a051408a467ff8b3e43457961d5497903dc7d0/helix-term/src/keymap.rs#L323-L329