C-d to act as a kind of modifier for the
<right> arrow keys in a similar way to how
Shift is a modifier that allows letters to be capitalized.
- When I press
- When I hold
Shiftand then press
- When I hold
Shiftand then hold
C-dis held down,
C-dis held down, if
<right>) is also held down, then repeatedly call
In other words, I want
C-d to act as a sort of "delete-modifier" so that as long as
C-d is held, I can press
<right> to delete backwards and forwards. Note If
C-d is not being held down,
<right> should have their default behavior (moving backward and forward one character).
One of my perceived road-blocks is mentioned in the emacs manual on the topic of modifier keys:
Although only the Control and Meta modifier keys are commonly used, Emacs supports three other modifier keys. These are called Super, Hyper, and Alt.
I've had a terrible time in the past trying to get
Hyper to work correctly on any of (much less across) my computers, but even if I could get them working properly, I don't think these will be enough; if I use
Super to act as the "delete-modifier", then I only have room for one or maybe two more before I've run out of the default modifiers emacs has to offer.
If I wanted (in addition to a "delete-modifier") a "search-modifier" that allowed me to hold down
C-s and then use
<right> to search backwards and forwards, then
Hyper would have their hands full.
I want to make extensive use of this type of functionality, and I really want to believe that if the computer games I played as a child could implement something like it, then a tool as praised for its customizability as emacs could do the same, but so far the consensus among people I ask is that they do not really know if its even possible to implement this kind of functionality.
The closest I can get on my own is to use
(global-unset-key (kbd "C-d")) (defhydra hydra-delete (global-map "C-d") "delete" ("C-<left>" delete-backward-char) ("C-<right>" delete-char))
The problem with this is that if I accidentally press any key other than
<right> after holding down
C-d, I'll be kicked out of this 'deletion' mode, and the only way to step back in is hold down
C-d again. In practice this behavior is a lot less natural than the modifier functionality of the
Ideally, if I hold down
C-d, as long as
C-d is held down,
<right> do what they are bound to do, but if a key is not bound to anything, pressing it while
C-d is held down does nothing.