From b0cb46dab9325a67a2342d5e4ca5df391dc3100c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 16 Mar 2023 23:27:21 -0700 Subject: [PATCH] linux copy/paste defaults to ctrl+shift+c/v --- src/config.zig | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/config.zig b/src/config.zig index 212d7ffbf..7c3fed022 100644 --- a/src/config.zig +++ b/src/config.zig @@ -180,16 +180,25 @@ pub const Config = struct { const alloc = result._arena.?.allocator(); // Add our default keybindings - try result.keybind.set.put( - alloc, - .{ .key = .c, .mods = ctrlOrSuper(.{}) }, - .{ .copy_to_clipboard = {} }, - ); - try result.keybind.set.put( - alloc, - .{ .key = .v, .mods = ctrlOrSuper(.{}) }, - .{ .paste_from_clipboard = {} }, - ); + { + // On macOS we default to super but Linux ctrl+shift since + // ctrl+c is to kill the process. + const mods: inputpkg.Mods = if (builtin.target.isDarwin()) + .{ .super = true } + else + .{ .ctrl = true, .shift = true }; + + try result.keybind.set.put( + alloc, + .{ .key = .c, .mods = mods }, + .{ .copy_to_clipboard = {} }, + ); + try result.keybind.set.put( + alloc, + .{ .key = .v, .mods = mods }, + .{ .paste_from_clipboard = {} }, + ); + } // Some control keys try result.keybind.set.put(alloc, .{ .key = .up }, .{ .cursor_key = .{