Swordfish90 / cool-retro-term

A good looking terminal emulator which mimics the old cathode display...
22.4k stars 855 forks source link

Question: "command key + letter" outputs hostnames #855

Closed Ferrisx4 closed 3 months ago

Ferrisx4 commented 3 months ago

I am wondering what command or shortcut is being triggered when I press the command key and any letter (numbers and punctuation don't appear to do anything). Somehow, it is triggering crt to output a list of hostnames from the /etc/hostnames but without the IP addresses. It actually seems like a useful feature, but I have no idea what it is or if I can recreate it in a normal terminal session. I discovered this because of muscle memory when trying to run command+k to clear the screen, which is the standard shortcut in macOS' terminal to do so. There's already an issue for this: https://github.com/Swordfish90/cool-retro-term/issues/839

If it matters, I'm on version 1.1.1 of cool-retro-term because of still being on macOS 10.12.

Screenshot:

Screen Shot 2024-08-23 at 10 25 11 PM
yurikhan commented 3 months ago

This is your shell’s hostname completion feature. In bash, it’s bound to M-@ and C-x @ by default. (M- stands for Meta which in terminal emulator context mostly means prefixing a key with ESC, sometimes also available by holding Alt; and C- stands for Ctrl.)

Command (properly portably named GUI or Super) is a prefix that some terminal emulators do not relay at all, and some relaying differently. CRT seems to translate it into Emacs-inspired C-x @ s sequence followed by the base key, which is why Super+k gives you a list of hostnames (C-x @) followed by adding s (leftover from the C-x @ s sequence) and k (base key) to your command line.

Read the manual for your shell (which might not be bash) on how to unbind hostname completion or rebind it to a different key sequence.

Also, the conventional key to clear the terminal is Ctrl+L at shell prompt.

Ferrisx4 commented 3 months ago

Thanks @yurikhan, your response was hugely informative and exactly what I was looking for!