Key chord support #26196
AlexDaniel
started this conversation in
Ideas From Emacs
Key chord support
#26196
Replies: 2 comments
-
See https://github.com/zed-industries/feedback/discussions/369#discussioncomment-3212115 for some thoughts on this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@kevinsjoberg yeah, but key chords are different from layers. When you press a key chord, you're left at the same layer. And the keys can be pressed in any order. It's basically a way to have a shortcut without using any modifiers, without using modes and without interrupting your normal flow of typing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
In some editors (for example emacs) it is possible to bind actions not just to key shortcuts, but to key chords. A key chord is a press of two non-modifier buttons at the same time. For example, you can bind pressing
x
c
to perform some common action (save the file, search for a file, autocomplete the current word, etc.). Usually, you'd press the two buttons with two fingers at the same time.It is extremely useful because it allows to perform actions without changing modes and without reaching for a modifier. The actions then become part of the typing experience.
As an example, one of the most commonly used key chords that I have is
.,
(I'm using Dvorak, in Qwerty that'd bewe
, just so that you understand the key placement). In emacs I have it set to dabbrev-expand which autocompletes the word based on anything it has seen so far. If I have a class called HelloWorld, then typingH
e
.,
(imagine typingH
e
we
on Qwerty) immediately gives meHelloWorld
. Out of all ways of doing auto completion, I have never seen anything that'd be as efficient, ergonomic and just overall useful.The way it's implemented is that whenever you type any character that is part of a key chord, it will be held back for a certain timeout/delay (≈200ms). That character will be entered:
Note that the delay is only applied to characters that are part of configured key chords, so the rest of the typing experience is not affected.
Some notes:
h
e
is a terrible choice for a key chord because you'll keep triggering it by accident when typing “hello”). But no worries, turns out there are lots of character combinations that you'll never type in your life.Describe the solution you'd like
I think Zed is in a unique situation wrt key chord support because it can actually remove the visual delay. From what I understand, because Zed takes control of the entire stack, it should be possible to “draw” the typed character without actually entering it. This way, typing can be instantaneous and fluid even if the user has certain key chords configured.
Beta Was this translation helpful? Give feedback.
All reactions