reddit / emacs

How do you type without right alt key?

peliblando · 2022-07-30 16:19
Hi! I just started learning Emacs and I'm not from the US, and I thus my keyboard, instead of a right alt key, has an alt-gr one which I rely on to type. Those of you in a situation similar to mine, how do you press shortcuts like M-v or M-x (this one is particularly painful)? ​ Edit: I can't remap caps lock to esc because I don't have that key.
Horrih · 2022-07-30 16:24
I add a new more convenient key binding. Since outside of emacs i rarely use the Alt key, i don't want to modify my layout solely for emacs A package like [keychord](https://github.com/emacsorphanage/key-chord) really helps adding new key bindings without altering the defaults If you want to push the ergonomics a step further b, you can try modal edition to reduce drastically your use of Ctrl and Alt, see evil or xah flykeys for example
bocxorocx · 2022-07-30 16:46
Or if you don't want to commit to `vi` bindings immediately, there is [`god-mode`](https://github.com/emacsorphanage/god-mode) to set you up between editing mode and typing mode by not having to press control or alt/meta.
BetterEventually · 2022-07-30 16:46
Oldskool approach would be to use ESC v / ESC x which I believe still works on standard Gnu Emacs
jsled · 2022-07-30 17:06
I never use R-Alt for M … only ever L-Alt. (R-Alt is my Compose key.)
[deleted] · 2022-07-30 17:37
[removed]
astoff1 · 2022-07-30 18:42
Which finger do you use to press the keys next to the spacebar? Using the thumb, I find M-x okay to type. Similarly concerning, say, AltGr-m for µ.
tangonov · 2022-07-30 20:58
Are you able to swap a shift, or control key? Also "ESC" key counts as meta, wherever ESC is bound. "C-{" counts as escape, so it can be used as a Meta.
peliblando · 2022-07-30 21:24
So which finger do you use to press alt? Isn't it uncomfortable?
einSelbst · 2022-07-30 21:26
It's not the answer you are looking for but another solution. Consider an ergonomic keyboard. I started with the microsofts and later started using a kinesis, which I have since 10 years now. It was my best investment in hardware. On a kinesis you have a different layout anyway so you will make a layout which fits your needs. Yes, it's incompatible to other keyboards and yes, it's worth it.
peliblando · 2022-07-30 21:27
Sure, but it just isn't the same. I'd rather use Vim, then, if I have to rely so heavily on the esc key.
peliblando · 2022-07-30 21:37
Maybe the only solution is to go Evil mode. I hadn't heard of Xah, though. It looks promising, at least interesting.
peliblando · 2022-07-30 21:47
The thing is I don't know which one to use. In the Spanish layout, I need alt gr for keys far away from the space bar.
peliblando · 2022-07-30 21:57
Getting rid of one of them would just create another problem. I know esc counts as meta, but it's as hard to use or more, and C-{ is kind of worse. Thanks, though.
peliblando · 2022-07-30 21:57
Interesting...
xtifr · 2022-07-30 22:09
I have caps-lock mapped to compose/multi-key (the default for alt-gr), so I could (if I had one) remap alt-gr to alt. In fact, I'm 99% sure this is the solution I'd use if I had your keyboard, since I absolutely depend on having two alt (and two ctrl) keys.
peliblando · 2022-07-30 22:25
The problem is that I don't have caps lock and I need alt gr to type the at symbol, the pipe symbol, the numeral symbol, the curvy tilde and the curvy brackets. I need to write in Spanish, Catalan and French, so maybe I could switch to a US layout and type the special symbols that these languages require using a compose key which I don't know where to map from, so I'm fucked, basically.
peliblando · 2022-07-30 22:26
Yeah, but for a laptop... :/
Acebulf · 2022-07-31 02:08
Thumb
7890yuiop · 2022-07-31 07:28
> like M-v or M-x (this one is particularly painful)? If you can't give up Alt-Gr then I think you can only consider compromises. 1. Do `Alt-Gr v` and `Alt-Gr x` do anything (or anything you need)? If not, map them to `M-v` and `M-x`. Ditto for any other unused `Alt-Gr` sequences that are common Meta sequences in Emacs. Refer to `C-h i g (elisp)Translation Keymaps` 2. Is there *anything* on your keyboard that you don't need that you could turn into a right-hand Meta key? If your keyboard is programmable, some people do things like "holding down Enter while typing another key acts like a modifier key" (while pressing and releasing Enter on its own does the usual newline). Perhaps you have a right-hand `<menu>` key? My keyboard has one of those, and I've made it an Emacs-specific prefix key because I have no real need for that key in other programs. If so, you could tell your OS to make that another Alt key. 3. Your ideal option may be a different keyboard with all the keys you need. If that's a feasible solution at all, I would at least consider it. Emacs also has input methods, so potentially you could convert from using Alt-Gr for entering special characters to using one of the provided input methods. That's Emacs-only of course, so I doubt it's very appealing if you're used to using Alt-Gr in all applications.
nillefr · 2022-07-31 10:08
You could map caps to escape Edit: just saw that someone already suggested that
Lazy-Snail · 2022-07-31 11:45
If you have a menu key on your keyboard it will act as M-x (and that is better ergo). You may remap a key of your keyboard, eg remap ';' to AltGr, then remap another key to output ';' when you press it with AltGr. A lot of folks here have complex custom keyboard layouts, it does not imply to buy a new keyboard, you can do it with bare XKB configuration, or also use advanced tools like Xmonad. That will pay off anyway outside of Emacs. Edit: To answer the question since I have a qwerty keyboard on my machine, as an european I quickly learned how to remap keys with XKB. Now I have my modifiers on my homerow with Xmonad.
ruscaire · 2022-07-31 15:32
I used to have altgr mapped to left alt and that worked well, but I’ve tried to do it recently and with newer versions of windows it doesn’t seem to work the way I remember. But if I could get that to work for now that would be my solution.
arthurno1 · 2022-07-31 22:06
> how do you press shortcuts like M-v or M-x I personally don't like using thumb to press Alt key either, so I have redefined C-z and C-v to act as prefix keys, and I have bound a lot to C-z. For example, instead of typing M-x, I type C-z x, which I find easier to type even if it is one key more. If you are interested you can see [my setup](https://github.com/amno1/.emacs.d/blob/main/init.org), look below "packages" mostly under "helm", "Emacs" and "Dired". > Edit: I can't remap caps lock to esc because I don't have that key. Home built keyboard?
peliblando · 2022-07-31 23:24
No, I'm using a corebooted (ex)chromebook with GNU/Linux.
sebhoagie · 2022-08-01 13:01
I type in Spanish and English (and code). I use the keyboard in US layout for English and code, change it to US international to type Spanish in the browser and documents. Bound the keyboard change to Super + Space in Gnome, Ctrl + Option + Space in macOS.
MeticulousNicolas · 2022-08-01 13:51
Rebinding Right-Alt to be the same key as Left-Alt should fix your problem perfectly. I personally rebind Right-Alt to be another Left-Ctrl key so I can use both modifiers with my thumbs.
vcored · 2022-08-01 18:35
It’s actually C-[. No need to hold shift. I find it much more comfortable than ESC.