I tried many manuals how to deal with alt key in emacs in iTerm, but no of them helped me. The problem is that all suggestions work for alt key, but not for combination of alt shift.
What do I want:
(global-set-key (kbd "M-S-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "M-S-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "M-S-<down>") 'shrink-window
(global-set-key (kbd "M-S-<up>") 'enlarge-window)
So, alt shift arrow must change the window size. I can easily support this for alt arrow using this manual:
https://azaleasays.com/2013/07/05/setting-up-mac-os-x-and-iterm2-for-emacs/.
But all this doesn't work for alt shift.
Also I tried these suggestions. It doesn't work in this particular case:
Making iTerm to translate 'meta-key' in the same way as in other OSes
I don't think it's important, but for pure picture I connect via SSH to instance and work under tmux.
Did anybody try to do this?
CodePudding user response:
Okay, I mostly fixed it. The main problem is that I couldn't find any description of how to correctly write "Key Mappings" for Iterm2 (googled a lot). After some attempts I could somehow resolve this as a puzzle, but it's really strange to do it like this not having any good documentation. If somebody has a link, please share it.
For people who potentially have this problem I'll write what I could find:
- Find the actual code of the key using "showkey -a" command. It usually has 2 values, let's name them X and Y. In this case the code "1A" (arrow up) would have X = 1, Y = A.
- Use the following list as reference. I found the codes only by entering numbers and check. No documentation found on this. You can try another numbers if you need another key combinations:
- SHIFT – 2
- ALT – 3
- ALT SHIFT – 4
- CTRL – 5
- CTRL SHIFT – 6
- CTRL ALT – 7
- Let's name the previous value with variable Z.
- The format for the "Key Mappings" is "[X;ZY" in this case. So, we split the source code to 2 parts, put "[" before and ";Z" inside.
So, CTRL SHIFT "Arrow up" would be "[1;6A".
It's not full though. For example, I couldn't understand how to code letters with ALT. For example, CTRL ALT z. If somebody knows, please comment also.