top | item 32492846

(no title)

jetpackjoe | 3 years ago

Being able to CMD+c to copy things in a terminal is one of my favorite things about programming on a Mac. Ctrl+c to copy everywhere, except the terminal (there it instead is an interrupt) is a major annoyance working in Linux

discuss

order

horsawlarway|3 years ago

If it helps, the vast majority of linux terminal emulators support rebinding ctrl-c to copy and ctrl-v to paste. Or simply copying to clipboard on select: https://wiki.archlinux.org/title/Copying_text_from_a_termina...

The default is usually ctrl-shift-c to copy and ctrl-c to send sigint - but setting the copy command to ctrl-c will usually flip them, making sigint ctrl-shift-c.

I enable this on basically all the terminals I use. I also immediately rebind cmd to ctrl in mac, since I can't stand the RSI inducing placement of the cmd key.

sbuk|3 years ago

Ctrl-v was SIGINT long before it was a shortcut for paste (first added in Windows 3.1). Although it can be switched now, it hasn't always been so. Of all the things that desktops (I'm not going to say Linux, as it isn't a Linux issue as it affect every system that uses KDE/GNOME and the like) designed to run on top of *nix like systems that were copied from Windows, this one really boggles my mind.

jmprspret|3 years ago

I don't use a Mac. How does one interrupt a program if Ctrl+C is bound to copy? At this point when I'm in a terminal Ctrl+C is muslce memory for interrupting a running program.

wodenokoto|3 years ago

On Mac, ctr+c is not bound to copy. cmd+c is bound to copy. ctr+c will interrupt in a terminal.

On Windows, ctr+c in a terminal will interrupt a running process, or, if text is highlighted, will copy that text instead of interrupting.

It works really well, and took me a long time of doing this without issues to realize what I was actually doing.

kalleboo|3 years ago

Macs have a Meta key called Command that can be dedicated to the shortcuts defined in GUI applications while leaving Ctrl free to be used by console stuff. So all the GUI copy/paste/windowing etc controls use Command key shortcuts.

The original 1984 Mac keyboard did not even have a Ctrl key, it was added to later keyboards as people wanted access to terminal applications.

samtheprogram|3 years ago

Ctrl-C is still bound to an interrupt — it’s Cmd-C (i.e. Super-C / Win-C) that is bound to copy. Most things that a regular user can think of (paste, print, select all, to name a few) that would be control mapped in user facing programs are typically mapped to the “command” key instead.

gregsadetsky|3 years ago

On Macs, Cmd+C to copy and Ctrl+C to interrupt in the terminal i.e. they’re different.

tasuki|3 years ago

It isn't an annoyance for me: just select text and paste it with middle click? Why bother with ctrl+c ?

trebbble|3 years ago

Then you can select other text to paste over.

prmoustache|3 years ago

The difference being that on linux you are for the most part free to implement the keybindings you want.

Example on Kitty, my current preferred terminal emulator this is just a few map directives away in the config:

map ctrl+c copy_to_clipboard

map ctrl+v paste_from_clipboard

map ctrl+shift+c send_text all \x03