Using space instead of control to avoid emacs pinky?

I designed the emacs pinky case from pressing Cx too much. Ideally, I would like to use the space instead of control as a prefix command, since it is much easier to press and hold the thumb. Pressing and freeing space should still add a space, but pressing Space + x at the same time should be bound to the command. For instance:

(local-set-key (kbd "SPC-s") 'search-forward) 

Does anyone have any ideas on how this can be implemented? Is it possible to do this using only elisp or will I need to change the emacs source and compile my own version?

I would prefer an OS independent solution as I use emacs for both Windows and Linux.

EDIT: I tried key-chord.el, which helps in some cases, but not for all (Cx Cs). I would prefer a small mode like hold-space-is-control or hold-space-is-meta p>

EDIT: Thanks for all the feedback. I am currently using key-chord to map many C- * commands to j * or f *, depending on whether * is the left or right key. For example, I replaced Cx b with jb. It works great for all the commands that you usually type once, but not for the commands that you reuse (like forward or backward paragraph). This is the best cross-platform solution since it only requires a custom .emacs and key-chord.el file. I would prefer a solution that requires less reassignment and reduces the risk of entering "fyi" and getting "<yank> i". I believe that using space can work, but I don’t know enough about the technical details of emacs to make it work.

I considered replacing Caps-Lock or Alt with Ctrl, but this only helps for the left little finger. Many common commands are executed using the correct little finger (Cx, Cs, Cw, Cy).

+4
source share
10 answers

I reassigned my CapsLock to Control to avoid pain (although using KDE to do the mapping, not emacs).

Update: I was also able to do this in LXDE and MS Windows.

+6
source

On Windows, AutoHotKey is a very flexible and scriptable solution for most types of key reassignment requirements.

+6
source

Xah Lee has written nice articles on this subject, especially if he recommends

use your palm or half-fist instead of your little finger to press the key control button

+4
source

I do not think this is possible in Emacs Lisp. In order to do what you want, it would be necessary to check whether the space bar is still held or if it was released. However, keyboard events in Emacs are just symbols, not “pressed” and “released” events, for example, for mouse buttons. I don’t know enough about Emacs C code to say whether this can be implemented there without breaking the normal event loop.

So let me move on to OS-dependent solutions. Under Xorg, you can map modifiers to regular keys (using xmodmap); however, when you press the "space", a space will still be generated, as well as working as a modifier, which you do not want. The only solution I know of is the special Xorg keyboard driver:

https://gitlab.com/at-home-modifier/at-home-modifier-evdev/wikis/home

I do not know if something like this exists for Windows.

+3
source

This should do what you want:

http://www.emacswiki.org/emacs/space-chord.el

(space-chord-definition-global "s" search)

This is "chording", so you will need to enter space and s at the same time, but doing so is easy.

Or, if you can use a control lock to avoid holding control as much as possible (this is like a cover lock for a control key).

+3
source

Over the past few weeks, I have written and used an AutoHotKey script that provides all the Windows features to accomplish exactly what you described. It is now available on GitHub . Although this is not an OS-independent solution, Linux has nearly identical implementations (for example, At-Home-Modifier and Space2Ctrl ), so you must have the same user interface on any platform. On the plus side, you can also use it in other programs for tasks such as copying, pasting, and switching browser tabs. Hope this helps.

+2
source

The exact solution is described here. it consists of using additional software (available for each OS). http://emacswiki.org/emacs/MovingTheCtrlKey#toc24

+2
source

What I'm doing is alt toggle keys for controls and super-keys for alt-meta, this avoids clicking on the annoying left control. In addition, I switch Caps Lock for Hyper to have an additional modifier that I use to switch between Hp Hn buffers and other things. If you have Ubuntu, this change is trivial in your keyboard settings.

+1
source

You can look at cua-mode , which does something similar for Cx and Cc (when the sign is active). Of course, I'm not an expert (I don’t even use cua-mode ), but after briefly reviewing the code, there is a timer that dispatches the timeout event so that (in your case) you attach [?\s timeout] to the insert space and attach other keys to what you want. You also cannot (I don't think) bind keys as if SPC was a modifier:

 (local-set-key (kbd "SPC-s") 'search-forward) 

but you will bind them like (say)

 (define-key space-as-prefix-map (kbd "s") 'search-forward) 

I tried to run a quick test using cua-mode , but unfortunately the timer only works when the sign is active. Well, it's a little more complicated than that, but suffice it to say that I have not persisted long enough to understand all this. But it is definitely possible to make space for controlling that escape in meta.

+1
source

This is not the answer to your question, but it is a way to avoid Emacs emotions: do not use one hand to press modifiers and key. So (if you have a Qwerty keyboard), use your right hand to press “Control” and your left hand to “x”.

0
source

Source: https://habr.com/ru/post/1389232/


All Articles