reddit / emacs

Emacs' key bindings and keyboard layout: How do you type?

rrdoa · 2022-07-22 20:19
My first language is not English and so my keyboard layout is not the US layout. In many international layouts, the right Alt is AltGr and does not work as a Meta key. I like this keyboard layout otherwise. Ideally, I would like to not have to move my hands away from the home row, but having only the left Alt available as Meta and reaching for AltGr (right Alt) from time to time breaks my flow. I tried switching CapsLock with AltGr and this would be the ideal layout. Using xmodmap, I think I was able to do it, but I could not understand what I did satisfactorily even after reading the doc. I don't like using tools that I cannot understand. Also something does not feel right about having a "non standard" keyboard layout. I don't want to make my life harder if I use another computer or OS. Do you have an opinion on that? What is your personal setup?
varsderk · 2022-07-22 21:21
I went all-in on customizing my keyboard and keyboard layout. Since I have access to my personal machine 99% or better, I decided to optimize for that. I have a [Moonlander from ZSA](https://zsa.io); you can see my layout [here](https://configure.zsa.io/moonlander/layouts/jLR0Z/latest/0). Note that I've moved modifier keys to either where I can reach them with my thumbs or they're available as mod-taps on the bottom row. (I like being able to hold home-row keys to quickly repeat e.g. movement commands in `evil-mode`.) I figure that I can customize this layout to be efficient for me when I'm typing in Emacs, because I'm mostly on my computer where my Emacs config lives. If I have to move to another computer for some reason (rarely have to) I can either take my keyboard with me, or everything will be different and I might as well just deal with the entire layout being different altogether. That's perhaps not the most satisfying answer. :/ How often do you find yourself working on another computer where your Emacs configuration is not available?
rrdoa · 2022-07-22 21:30
You are probably right and I should optimize for my setup instead of some possible future setup. I think I will make the necessary modifications. What tool are you using?
xircon · 2022-07-22 21:37
I use: https://emacsredux.com/blog/2020/07/05/remap-enter-to-control-in-gnu-linux-2020-edition/ And: https://forum.endeavouros.com/t/how-to-convert-caps-lock-to-hyper-key/24575 To turn my capslock into hyper. Bozhidar's method can change all the modifiers and works well. I turn AltGr into a home/end key as I use a laptop and the keys are a stretch
donio · 2022-07-23 01:02
This is probably not very helpful since it's the opposite of what you are asking but this is what I do: Most of my typing in English but I often type in another language that makes heavy use of accents. I use the US layout (with Caps mapped to Ctrl) and I use one of the quail prefix input methods built into Emacs for the accents. So for example I type `'e` for `é`. I am so used to this that I think I'd stick to it even if most of my typing required accents. Having to switch to a totally different layout for punctuation would too painful, especially for coding.
rrdoa · 2022-07-23 02:29
I have tought about this as well and I still consider it. It is good to know that it works for some people. I will keep it in mind. Thanks!
varsderk · 2022-07-23 02:37
> What tool are you using? I’m not sure I understand… what tool am I using to modify my keyboard layout? I use an ergonomic keyboard that runs QMK firmware. You could use eg Karabiner Elements on macOS or something else for Linux to get some mod-tap behavior if that’s what you’re looking for.
tmting · 2022-07-23 02:45
What exactly is hyper used for?
rrdoa · 2022-07-23 03:12
Are you typing french? If so, how do you type `c'est` using your method? The apostrophe and `e` will make `é`.
rrdoa · 2022-07-23 03:14
I was thinking you used something to remap keys. Thanks for the response!
donio · 2022-07-23 04:12
If you follow the `'` with anything that doesn't take an accent you get the literal `'`. ~~Fastest is to just double up so I'd type `c''est`~~. Or for longer sequences of punctuation you can toggle the input method with `C-\` Edit, just realizing that the "doubling up" works because of a local customization of the keymap I made many years ago. But `'` followed by a space should work everywhere.
RoninTarget · 2022-07-23 06:21
I'm using Colemak, as I do a lot of typing in English. It has plenty of dead keys that can be used via AltGR. Caps lock is a backspace on Colemak by default.
tigre200 · 2022-07-23 08:04
I type the alt key with my left thumb
_tsuujin · 2022-07-23 08:12
I have tried a ton of layouts, partially because I was suffering from hand pain due to a neuropathy issue, but also because I was looking for the sweet spot where editing didn’t require crazy finger manipulation. I picked up colemak which really helped with my hand pain, and eventually found [miryoku](https://github.com/manna-harbour/miryoku) which has been far and away the best experience I’ve had so far. I also use a custom built ergo split keyboard, which means I don’t have to worry about my layout when I switch machines, it’s built right into the board itself.
rrdoa · 2022-07-23 08:27
Thanks! That is something I would have to fix if I end up using this method. I don't want to think about my typing when I am writing.
richardgoulter · 2022-07-23 08:51
> What tool are you using? https://github.com/kmonad/kmonad kmonad is a tool which supports stuff like the mod-taps.
richardgoulter · 2022-07-23 08:57
> Also something does not feel right about having a "non standard" keyboard layout. I don't want to make my life harder if I use another computer or OS. Do you have an opinion on that? The two main things I'd consider: what different computers you'll use; and, whether other people will be able to use your computer. You'll be a bit slower on your other computers if you have a different setup that you use infrequently. I think that's an acceptable cost for a non-standard layout. If your layout is non-standard, it makes it more difficult for others to use your computer. You'll need to "drive" the computer, as such; or have an easy way to revert to the standard layout. In my case, I'm the only person using my computers, so I don't have to worry about this.
xircon · 2022-07-23 09:53
It is an additional modifier.
tmting · 2022-07-23 11:51
So you give up entirely on caps lock? So that you get a new modifier
xircon · 2022-07-23 12:54
Yes, capslock is the most pointless key on the keyboard, a lot of people remap to escape or control, I prefer hyper.
tmting · 2022-07-23 13:01
Really interesting. Gonna give this a try, thanks for the info!
donio · 2022-07-23 15:03
If you decide to make a custom input method check out [emacs/lisp/leim/quail/latin-pre.el](https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/leim/quail/latin-pre.el) for some examples. You pretty much just need a quail-define-package definition followed by quail-define-rules with the mapping rules.
_viz_ · 2022-07-23 15:35
>I tried switching CapsLock with AltGr and this would be the ideal layout. Using xmodmap, I think I was able to do it, but I could not understand what I did satisfactorily even after reading the doc. I don't like using tools that I cannot understand. I think no one really understands how most Xorg tools work.
rrdoa · 2022-07-23 17:51
Thank you! It seems simple. I can also use a `-postfix` input method to help with the issues I raised above.
perkinslr · 2022-07-25 07:16
It depends on how non standard you get, and if you get to use emacs when on borrowed machines. I got into using emacs because I needed a powerful editor available when borrowing OSX machines at clients' locations. (Far easier to just use one of the lab machines than get permission to add my dev laptop to their network). That meant restricting myself to what could be deployed in a minute or less, using an *ancient* version of emacs (I think emacs 23 is still the OSX default). If you need something similar, I'd probably tell emacs to treat AltGr as Alt, and otherwise keep things stock. Then if you borrow a machine with emacs, the most you need to do is the same rebinding. The *other* bit of advice I learned from using emacs on OSX is ESC is a "sticky" meta. That is, you can press and release ESC, *then* type the next character and it will interpret it is `M-`whatever. This may remove the need to even rebind the right alt, as typing ESC-x with just the left hand is not an issue.