From 8c2233fe0cb5fc831363739aa803b59cf21bd6b3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 22 Dec 2024 20:03:56 -0800 Subject: [PATCH] macOS: change default keybinds for equalize splits, jump to prompt -1/+1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: https://github.com/ghostty-org/ghostty/discussions/2363#discussioncomment-11645228 The justification there makes sense to me and I think it would be a good change to make. Copied here: > There are a few bindings that feel a little weird on macOS. My suggestions: > > (1) Equalize Splits > ``` > keybind = shift+opt+equal=unbind > keybind = ctrl+cmd+equal=equalize_splits > ``` > The default hijacks the `±` character on US keyboards. Believe it or not, I do use ± in the terminal. Ctrl+cmd+equal matches the arrow key bindings in the Window > Resize Split menu and thus looks more elegant and is easier to memorize. > > (2) Jump to Prompt > ``` > keybind = cmd+up=jump_to_prompt:-1 > keybind = cmd+down=jump_to_prompt:1 > ``` > These are the bindings in Terminal.app. The default shift-cmd-up/down is usually associated with extending a selection. Cmd-up/down are available (they currently act as simple up/down). I bind them additionally to the defaults. --- src/config/Config.zig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 31d1f4f1b..4727da832 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2503,10 +2503,22 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config { ); try result.keybind.set.put( alloc, - .{ .key = .{ .translated = .equal }, .mods = .{ .shift = true, .alt = true } }, + .{ .key = .{ .translated = .equal }, .mods = .{ .super = true, .ctrl = true } }, .{ .equalize_splits = {} }, ); + // Jump to prompt, matches Terminal.app + try result.keybind.set.put( + alloc, + .{ .key = .{ .translated = .up }, .mods = .{ .super = true } }, + .{ .jump_to_prompt = -1 }, + ); + try result.keybind.set.put( + alloc, + .{ .key = .{ .translated = .down }, .mods = .{ .super = true } }, + .{ .jump_to_prompt = 1 }, + ); + // Inspector, matching Chromium try result.keybind.set.put( alloc,