From 92e90a1e102825aa9149262cacfc991264db05df Mon Sep 17 00:00:00 2001 From: Casey Tucker Date: Thu, 25 Jan 2024 22:44:00 +0100 Subject: patch 9.1.0058: Cannot map Super Keys in GTK UI Problem: Cannot map Super Keys in GTK UI (Casey Tucker) Solution: Enable Super Key mappings in GTK using (Casey Tucker) As a developer who works in both Mac and Linux using the same keyboard, it can be frustrating having to remember different key combinations or having to rely on system utilities to remap keys. This change allows `` `` `` `` etc. to be recognized by the `map` commands, along with the `` shifted variants. ```vimrc if has('gui_gtk') nnoremap u nnoremap vnoremap "+d vnoremap "+y cnoremap + inoremap "+gP nnoremap "+P vnoremap "-d"+P nnoremap :w inoremap :w nnoremap :q nnoremap :qa nnoremap :tabe nnoremap :vs#T nnoremap ggVG vnoremap ggVG inoremap ggVG nnoremap / nnoremap n nnoremap N vnoremap "+x endif ``` closes: #12698 Signed-off-by: Casey Tucker Signed-off-by: Christian Brabandt --- src/gui_gtk_x11.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/gui_gtk_x11.c') diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 87838b9488..4dfa5ff3cb 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -1119,11 +1119,14 @@ modifiers_gdk2vim(guint state) if (state & GDK_MOD1_MASK) modifiers |= MOD_MASK_ALT; #if GTK_CHECK_VERSION(2,10,0) - if (state & GDK_SUPER_MASK) + if (state & GDK_META_MASK) modifiers |= MOD_MASK_META; -#endif + if (state & GDK_SUPER_MASK) + modifiers |= MOD_MASK_CMD; +#else if (state & GDK_MOD4_MASK) - modifiers |= MOD_MASK_META; + modifiers |= MOD_MASK_CMD; +#endif return modifiers; } -- cgit v1.2.3