Remix.run Logo
jasonjayr a day ago

Eons ago, Ctrl-C was mapped to 'Break' on various terminals, which will halt the running program, and was a useful function. Desktop/GUI's mapped Ctrl-C to (C)opy, since the mnemonic made way more sense, and interrupting a GUI program hard like Break tends to do was not very useful.

vintermann a day ago | parent | next [-]

It's not just the mnemonic, it's also that the location on the keyboard makes ctrl-c "prime real estate" so to say, and cutting and pasting is one of the most common and useful things you do.

thaumasiotes a day ago | parent [-]

> It's not just the mnemonic, it's also that the location on the keyboard makes ctrl-c "prime real estate" so to say

Considering the hotkeys for xut and vaste, I think it's safe to say the mnemonic accounts for zero of the decision and the keyboard location accounts for all of it.

andrewshadura 21 hours ago | parent [-]

X is for the scissors, V is for the insertion mark

yoz-y a day ago | parent | prev | next [-]

This is where I find cmd+c/v better. It just works everywhere. On windows win+v works, not sure if win+c does, it’s been a while.

bmacho a day ago | parent [-]

Win+c works too on windows. So does ctrl+insert/shift+insert on the terminals I just tested (cmd.exe, microsoft terminal with tabs, git bash, blue powershell terminal).

Win+c/win+v looks like a good compromise, using the Windows button for OS/DE commands, instead of application commands.

int_19h 9 hours ago | parent [-]

On Win11 Win+C launches Copilot by default these days. Win+X and Win+V also have functions assigned to them that are in no way related to the keyboard.

bmacho 9 hours ago | parent [-]

Eww, that's very unfortunate. Well, so much for a cross-os copy-paste shortcut.

fc417fc802 a day ago | parent | prev | next [-]

Also worth noting that many other ctrl-letter combinations map to signals in the terminal. In all the terminal emulators that I've used shift-ctrl-c & co are mapped by default for clipboard operations.

mprovost a day ago | parent [-]

On terminals, the control key masked off the 6th and 7th bits of the 8-bit value sent by the letter key. That's a bitwise AND with octal 037, or in decimal subtracting 96 from the lower case key value. This happens in the terminal (or keyboard) itself, so the computer doesn't see it as two pressed keys, it just gets the masked value. In ASCII 'c' is 99 (decimal), so when modified with control is 3, ETX (end of text), which teletypes used to indicate the end of text. So unix shells reused that control character to terminate the current program with SIGINT. But every letter key maps to a control character at the start of the ASCII range, like 'g' maps to BEL for the bell, or 'h' maps to BS (backspace). '[' maps to ESC (escape) which is handy when Apple decides to move the escape key on their laptop keyboard.

int_19h 9 hours ago | parent | next [-]

Unless we're talking about ancient hardware terminals, the computer sees the actual raw scancodes coming from the keyboard. Control (whether by itself or in combination with something else) is no different than any other key. It's the software that maps those combinations to ASCII control characters, which is why this works the way you described on most Unices (where, if I remember correctly, it's the tty that is doing the mapping) but not e.g. on DOS/Windows.

tedunangst 20 hours ago | parent | prev [-]

The funny bit is the other six control codes are mapped ctrl-2 to nul, and ctrl-3 forward to the five remaining.

ZoomZoomZoom a day ago | parent | prev | next [-]

> and interrupting a GUI program hard like Break tends to do was not very useful.

I find it extremely useful, GUI or not. Too bad it doesn't work half the time when it matters, especially on Windows.

hiAndrewQuinn a day ago | parent [-]

Alt-F4 is pretty reliable on Windows, but it's not as catchy because no one likes craning their left hand to reach the function key (even though you could just hold right Alt).

tom_ a day ago | parent [-]

Right Alt doesn't exist on all keyboard layouts. On the UK layout it's replaced by AltGr, which doesn't do much appart from fail to act as Alt for Alt+F4 purposes, but it has actual uses in other layouts: https://en.wikipedia.org/wiki/AltGr_key

makapuf 20 hours ago | parent | next [-]

In French and other European countries, #[@{}|\] need altgr. You re using this quite a lot developing on Linux.

thaumasiotes a day ago | parent | prev [-]

Nobody ever uses right alt even if it exists, but it's straightforward to hit F4 with your right hand.

Alt+F4 on Windows has the undesirable property that if you hit it several times, and it works, you'll close several different things. Ctrl-C in the terminal won't do this.

spauldo 16 hours ago | parent [-]

American Emacs-using touch typists use right ALT all the time. ALT-x prompts you for a command, ALT-q in most modes runs fill-paragraph, ALT-f moves the cursor forward by one word, etc.

thaumasiotes 14 hours ago | parent [-]

When I want alt in emacs I use C-[.

spauldo 5 hours ago | parent [-]

I suspect you're in the minority there.

thaumasiotes 3 hours ago | parent [-]

I can believe that.

whartung a day ago | parent | prev | next [-]

What’s funny is when I started on SCO Unix ages ago, the default break key was DEL.

It quickly morphed into ^C, but the first few months were interesting.

Coming from the VAX, it was ^T.

lupusreal a day ago | parent | prev [-]

The mnemonic logic of the copy shortcut is undermined by the arbitrary paste shortcut. Also, from what I've seem a whole lot of average Joe computer users don't know or use these shortcuts, I think they're a lot further to the power user side of the skill spectrum than a lot of people here might expect.

layer8 a day ago | parent | next [-]

The V isn’t arbitrary. Apart from the close location on the keyboard, the V looks like the handwritten mark often used to insert text in a physical document. This is similar to how the X suggests crossing out something.

chuckadams a day ago | parent | prev [-]

On a US keyboard where these shortcuts were developed, you'd have to stretch your hand across the keyboard to reach Ctrl-P. That's why it's Ctrl-V, it wasn't arbitrary.

I miss Sun keyboards and their dedicated copy/paste keys.

Henchman21 a day ago | parent | next [-]

And a control key in the right place. Dammit.

silon42 a day ago | parent [-]

I have a conspiracy theory that MS made IBM move the control key to kill WordStar, which had the superior keyboard shortcuts.

physicles 15 hours ago | parent [-]

Seems plausible. If anyone else is curious about the history here, I found [1]:

> The original computer terminals and microcomputers for which WordStar was developed, many running the CP/M operating system, did not have function keys or cursor control keys (arrow keys, Page Up/Page Down). WordStar used sequences of alphabetic keys combined with the "Control" key, which on keyboards of the time was conveniently next to the letter A in the position now usually occupied by the Caps Lock key. For touch typists, in addition, reaching the function and cursor keys generally requires them to take their fingers off the "home keys" with consequent loss of typing rhythm.

[1]: https://www.wikiwand.com/en/articles/Wordstar

lupusreal a day ago | parent | prev [-]

Ctrl-V is arbitrary from a mnemonic sense. "Vaste"?

andrewshadura 21 hours ago | parent | next [-]

V looks like the insertion mark

chuckadams a day ago | parent | prev [-]

eh, vy vaste ze energy zinking about eet too moch ah ha ha...</the-count>

:)=