diff --git a/lib/keyboard_utils.js b/lib/keyboard_utils.js index cb31513d6..492211023 100644 --- a/lib/keyboard_utils.js +++ b/lib/keyboard_utils.js @@ -31,9 +31,14 @@ const KeyboardUtils = { } }, + // Adds support for Mac Option + Keypress. See #3197. + // (Vimium will ignore the symbols and treat them like letters, at least on a US Laptop keyboard). getKeyChar(event) { let key; - if (!Settings.get("ignoreKeyboardLayout")) { + if ( + !Settings.get("ignoreKeyboardLayout") && + !(this.platform === "Mac" && Settings.get("macOptionKeyFix") && event.altKey) + ) { key = event.key; } else if (!event.code) { key = event.key != null ? event.key : ""; // Fall back to event.key (see #3099). diff --git a/lib/settings.js b/lib/settings.js index 1df454512..11584bd8e 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -68,6 +68,7 @@ w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedi regexFindMode: false, waitForEnterForFilteredHints: true, helpDialog_showAdvancedCommands: false, + macOptionKeyFix: true, ignoreKeyboardLayout: false, }; diff --git a/pages/options.css b/pages/options.css index c5dcf44e9..13f38430e 100644 --- a/pages/options.css +++ b/pages/options.css @@ -157,6 +157,10 @@ div#exampleKeyMapping { margin-top: 5px; } +div#macos { + display: none; +} + #linkHintCharactersContainer, #linkHintNumbersContainer, #waitForEnterForFilteredHintsContainer { diff --git a/pages/options.html b/pages/options.html index cfe03d813..7446f90ec 100644 --- a/pages/options.html +++ b/pages/options.html @@ -176,6 +176,20 @@

Switch back to plain find mode by using the \R escape sequence. +

+
+ +
+ This forces Vimium to treat an Option + Key keypress that would produce a + symbol on macOS as the equivalent Alt + Letter keypress. (With this + enabled, you can create maps such as <a-j> rather than + <a-Δ>.) +
+
+