Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Term-keys – Lossless keyboard input for Emacs (github.com/cybershadow)
23 points by harryday 22 hours ago | hide | past | favorite | 6 comments




MacOS user here. So many times over the last decade I’ve journeyed to get terminal Emacs working with my litany of weird keybindings. But I always end up back in the GUI.

I switched to Colemak about 15 years ago and thought it would be a good idea to rethink all my Emacs keybindings, since my muscle memory was shot in that transition. (I don’t recommend this in hindsight.)

I have yet to get a terminal working fully like the GUI. Partly because I refuse to install a third-party key mapper.

Anyway, just tried this and Alacritty. It’s the closest I’ve got to fully working. My guess is another hour of tweaking and I could maybe get all the way there.


This feels like something I want but it's hard to be sure. An example use case in the Introduction would be helpful

Terminals can't send certain modified keys, something like M-S-;. What this thig does:

- Uniformly describes different key codes across different terminal emulators and platforms;

- Sends the codes which native platforms support, but the terminal protocol does not, via a custom prefix. It gets decoded on the Emacs side, and mapped back to a native-matching key code. You can press fancy keys and have a uniform reaction in Emacs, no matter if you're using a local graphical Emacs, or remote Emacs in a terminal.

I confirm, this is a great approach; I used a much simplified version of it with WezTerm and remote Emacs.


The intro gives Ctrl+1 and Ctrl+Shift+A as examples. If you tried configuring emacs keyboad shortcuts that won't work with your terminal then this software might help to make them configurable.

If you don't already have this problem it's not really relevant.


My Emacs config heavily used the Hyper key: although I'm not japanese I'm using japanese keyboards (I've got several HHKB Pro JP, since years and years and years) and they've got more modifiers than regular US/EU keyboards. So I remapped the Henkan/Muhenkan (or whatever modifier whose japanese name I forgot) thinggies to be Hyper.

I can't even begin to imagine how complicated it'd be to get that working in "emacs -nw" (Emacs No Window, aka terminal)...

Thankfully I don't have no real need for terminal Emacs.

[1] Space-cadet keyboard with "Hyper" keys and, overall, really a lot of modifier keys: https://en.wikipedia.org/wiki/Space-cadet_keyboard#/media/Fi...


Regardless, that’s kind of the beauty of this project: term-keys generates the terminal config file based on all your bespoke keybindings for you. Would probably be easier to setup than you imagine.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: