From 66b11f98f480bbd83cb2cf720e219d0df8203f80 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 14 Oct 2017 12:38:26 +0100 Subject: Allow to be mapped as a regular command. If map someCommand is configured, then the hardwired `` meaning `Escape` behaviour is disabled. Users who want to map `` probably *never* use it as `Escape`. Fixes #2722. --- lib/keyboard_utils.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/keyboard_utils.coffee') diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee index e14e8b3e..1a1ea797 100644 --- a/lib/keyboard_utils.coffee +++ b/lib/keyboard_utils.coffee @@ -60,9 +60,13 @@ KeyboardUtils = keyChar = mapKeyRegistry[keyChar] ? keyChar keyChar - isEscape: (event) -> - # is mapped to Escape in Vim by default. - event.key == "Escape" || @getKeyCharString(event) == "" + isEscape: do -> + useVimLikeEscape = true + Utils.monitorChromeStorage "useVimLikeEscape", (value) -> useVimLikeEscape = value + + (event) -> + # is mapped to Escape in Vim by default. + event.key == "Escape" or (useVimLikeEscape and @getKeyCharString(event) == "") isBackspace: (event) -> event.key in ["Backspace", "Delete"] -- cgit v1.2.3