diff --git a/include/ghostty.h b/include/ghostty.h index 890e5f50e..818c0041a 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -252,6 +252,10 @@ typedef enum { GHOSTTY_KEY_BACKSPACE, GHOSTTY_KEY_PRINT_SCREEN, GHOSTTY_KEY_PAUSE, + GHOSTTY_KEY_UNDO, + GHOSTTY_KEY_CUT, + GHOSTTY_KEY_COPY, + GHOSTTY_KEY_PASTE, // function keys GHOSTTY_KEY_F1, diff --git a/src/config/Config.zig b/src/config/Config.zig index b783741b0..d2fbef629 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1125,6 +1125,16 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config { .{ .paste_from_clipboard = {} }, ); } + try result.keybind.set.put( + alloc, + .{ .key = .copy }, + .{ .copy_to_clipboard = {} }, + ); + try result.keybind.set.put( + alloc, + .{ .key = .paste }, + .{ .paste_from_clipboard = {} }, + ); // Fonts try result.keybind.set.put( diff --git a/src/input/key.zig b/src/input/key.zig index 7886d0b55..96c32de15 100644 --- a/src/input/key.zig +++ b/src/input/key.zig @@ -307,6 +307,10 @@ pub const Key = enum(c_int) { backspace, print_screen, pause, + undo, + cut, + copy, + paste, // function keys f1, @@ -616,6 +620,10 @@ pub const Key = enum(c_int) { // These keys aren't represented in cimgui .plus, + .undo, + .cut, + .copy, + .paste, => null, }; } diff --git a/src/input/keycodes.zig b/src/input/keycodes.zig index 47190a841..ec472701f 100644 --- a/src/input/keycodes.zig +++ b/src/input/keycodes.zig @@ -153,6 +153,10 @@ const code_to_key = code_to_key: { .{ "Numpad0", .kp_0 }, .{ "NumpadDecimal", .kp_decimal }, .{ "NumpadEqual", .kp_equal }, + .{ "Undo", .undo }, + .{ "Cut", .cut }, + .{ "Copy", .copy }, + .{ "Paste", .paste }, .{ "ControlLeft", .left_control }, .{ "ShiftLeft", .left_shift }, .{ "AltLeft", .left_alt },