Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do SIGINT with Ctrl C and use Ctrl C for Copy? #3696

Closed
rationalthinker1 opened this issue May 7, 2020 · 10 comments
Closed

How do SIGINT with Ctrl C and use Ctrl C for Copy? #3696

rationalthinker1 opened this issue May 7, 2020 · 10 comments

Comments

@rationalthinker1
Copy link

rationalthinker1 commented May 7, 2020

I just installed Alacritty and coming from gnome-terminal. Usually, I can tail -f *.log and it would split out the new logs but I would use Ctrl+C to terminate the tail command. I can't do that here because I've set Ctrl+C set to Copy.

System

OS: Linux
Version: alacritty 0.4.1
Linux/BSD: Ubuntu 19.10 Tmux

Logs

Crashes: STDERR, STDOUT
Font/Terminal size: alacritty -vv
Created log file at "/tmp/Alacritty-28330.log"
[2020-05-07 06:12] [INFO] Welcome to Alacritty
[2020-05-07 06:12] [INFO] Configuration loaded from "/home/nookta/.config/alacritty/alacritty.yml"
[2020-05-07 06:12] [DEBUG] Estimated DPR: 1
[2020-05-07 06:12] [DEBUG] Estimated Cell Size: 10 x 20
[2020-05-07 06:12] [DEBUG] Estimated Dimensions: None
[2020-05-07 06:12] [INFO] Device pixel ratio: 1
[2020-05-07 06:12] [INFO] Initializing glyph cache...
[2020-05-07 06:12] [INFO] ... finished initializing glyph cache in 0.042658813s
[2020-05-07 06:12] [INFO] Cell Size: 10 x 20
[2020-05-07 06:12] [INFO] Padding: 0 x 0
[2020-05-07 06:12] [INFO] Width: 800, Height: 600
[2020-05-07 06:12] [INFO] PTY Dimensions: Line(30) x Column(80)
[2020-05-07 06:12] [INFO] Initialisation complete
[2020-05-07 06:12] [DEBUG] Term::resize dimensions unchanged
[2020-05-07 06:12] [INFO] Width: 800, Height: 600
[2020-05-07 06:12] [DEBUG] New num_cols is 192 and num_lines is 50
[2020-05-07 06:12] [INFO] Width: 1920, Height: 1009
[2020-05-07 06:12] [DEBUG] New num_cols is 80 and num_lines is 30
[2020-05-07 06:12] [INFO] Width: 800, Height: 600
[2020-05-07 06:12] [INFO] Goodbye
Deleted log file at "/tmp/Alacritty-28330.log"

Keyboard and bindings: alacritty --print-events

@kchibisov
Copy link
Member

Don't use Ctrl + C as copy? If you want to copy and send a Ctrl + C character at the same time, you can define a binding for it.

@nixpulvis
Copy link
Contributor

FWIW, there's some more discussion on this topic in #1919.

@pokebadgerswithspoon
Copy link

pokebadgerswithspoon commented Aug 27, 2020

I'm new to alacritt. Tho this seems to work (Ctrl-C to copy, Ctrl-V to paste and ctrl-shift-C to ^C)

key_bindings:
  - { key: V,        mods: Control, action: Paste                  }
  - { key: V,        mods: Control|Shift, chars: "\x16"            }
  - { key: C,        mods: Control, action: Copy                   }
  - { key: C,        mods: Control|Shift, chars: "\x03"         }

@chrisduerr
Copy link
Member

chrisduerr commented Aug 27, 2020

They don't, they will make your terminal unusable, since you now can't use the ^V binding anymore.

@TRPB
Copy link

TRPB commented Feb 18, 2022

Does this make it unusable? What is Ctrl-V used for by default? I just tried this myself and it seems to work fine. If it is needed for some terminal applications couldn't we have a Ctrl+Shift+V send ^V instead?

It would be nice to have a context aware ctrl-c (if something is running, cancel, if not then copy) but this is a fair compromise.

On the discussion, this isn't just a Mac -> Linux thing, I've been using Linux exclusively for 10 years. Every other application across Windows/Mac and Linux uses Ctrl-C to copy. Having to use a different key for one application messes with my muscle memory.

@nixpulvis
Copy link
Contributor

nixpulvis commented Feb 24, 2022

It would be nice to have a context aware ctrl-c (if something is running, cancel, if not then copy) but this is a fair compromise.

I think I might actually prefer just swapping them... but I'd need to actually think through the possible consequences of this, beside just confusing the notion of control being ^ for the ^C interrupt.

One thing that I find ironic right off the bat, is that this suddenly makes my macOS interrupt require one additional key for no good reason, to be consistent.

@malteneuss
Copy link

key_bindings:

  • { key: V, mods: Control, action: Paste }
  • { key: C, mods: Control, action: Copy }
  • { key: C, mods: Control|Shift, chars: "\x03" }

@pokebadgerswithspoon Thanks. This works for me and could be highlighted as a quickfix in the docs or somewhere.

@trens
Copy link

trens commented Jul 26, 2022

Look I get why it isn't a great idea to not use ctrl-c for copy, but if nothing is selected at the time and you press ctrl-c why not have it ^C interrupt as well? Is it even possible to have the alacritty do both with the way it is right now? (sorry i do not know)
Personally I usually use shift-insert and right click to pasta my console and highlight with mouse.

BTW -- Alacritty is beautiful / fast / and well it is beautiful. <3 u all.

@bluz71
Copy link

bluz71 commented Aug 12, 2023

My current approach (for those interested):

key_bindings:
  - { key: C, mods: Control, action: Copy }
  - { key: K, mods: Control, chars: "\x03" }

Control-C for copy (as per usual for all standard Linux GUI apps).
Control-K for SIGINT / cancel / kill (I am using K for Kill mnemonic); my muscle memory is adapting to this (slowly). Note, some shells use Control-K for kill-line, but I simply never used that binding, so I don't care to lose that capability.

In my Alacritty setup I do NOT define Control-V for paste, I don't need to do so since my new preferred Shell, Fish Shell, already defines Control-V for Paste (fish_clipboard_paste binding); this seems to work great inside and outside of tmux (with no deleterious effects that I have encountered, it just works). I also define a Neovim insert mode paste mapping for Control-V as inoremap <C-v> <C-r>+.

Nothing seems to have broken.
Nothing I care about seems to be inaccessible to me (Control-v block mode selection in Neovim/Vim still works fine, for example).

I am glad to junk Control-Shift-C and Control-Shift-V to the dustbin of my keyboard history (after all these years, even going back to my Xterm days stretching back decades).

@berisap
Copy link

berisap commented Feb 24, 2024

I wanted to achieve the same goal and tried this approach. Then I noticed that alacritty switched to a toml based configuration. Of course it wouldn't accept "\x03" since it is a YAML specific thing I spend a good few hours to make it work with TOML. I want to spare you guys the same effort and show you how it is done in TOML:

[keyboard]
bindings = [
{ key = "C", mods = "Control", action = "Copy" },
{ key = "K", mods = "Control", chars = "\u0003"}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

10 participants