Hacker News new | ask | show | jobs
by jetpackjoe 1396 days 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
4 comments

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.

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.
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.
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.

I have used Windows all my life, and I learned this just now. No one ever told me that!
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.

Of course! Sorry, I did know this but I always forget macs have Cmd and Control
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.
On Macs, Cmd+C to copy and Ctrl+C to interrupt in the terminal i.e. they’re different.
It isn't an annoyance for me: just select text and paste it with middle click? Why bother with ctrl+c ?
Then you can select other text to paste over.
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