From c540d1809515b0fe4e9322e4cfc67197ad13b803 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 28 Sep 2023 09:45:57 -0500 Subject: [PATCH] config: default TERM to xterm-ghostty Default the TERM value to "xterm-ghostty" to prevent breaking vim. Consider changing back to ghostty in the future --- src/config/Config.zig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 2891e24e9..2cac07b35 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -411,8 +411,13 @@ keybind: Keybinds = .{}, /// Debug builds of Ghostty have a separate single-instance ID. @"gtk-single-instance": bool = true, -/// This will be used to set the TERM environment variable -term: []const u8 = "ghostty", +/// This will be used to set the TERM environment variable. +/// HACK: We set this with an "xterm" prefix because vim uses that to enable key +/// protocols (specifically this will enable 'modifyOtherKeys'), among other +/// features. An option exists in vim to modify this: `:set +/// keyprotocol=ghostty:kitty`, however a bug in the implementation prevents it +/// from working properly. https://github.com/vim/vim/pull/13211 fixes this. +term: []const u8 = "xterm-ghostty", /// This is set by the CLI parser for deinit. _arena: ?ArenaAllocator = null, @@ -904,7 +909,8 @@ pub fn finalize(self: *Config) !void { // Prevent setting TERM to an empty string if (self.term.len == 0) { - self.term = "ghostty"; + // HACK: See comment above at definition + self.term = "xterm-ghostty"; } // The default for the working directory depends on the system.