aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2017-10-14 12:38:26 +0100
committerStephen Blott2017-10-14 12:38:26 +0100
commit66b11f98f480bbd83cb2cf720e219d0df8203f80 (patch)
tree46359c70004eec34a3063276ed0ebd3e1c1d5d09 /lib
parentac9eba9b89c3c29d155a159c57acde3d28fd03ce (diff)
downloadvimium-66b11f98f480bbd83cb2cf720e219d0df8203f80.tar.bz2
Allow <c-[> to be mapped as a regular command.
If map <c-[> someCommand is configured, then the hardwired `<c-[>` meaning `Escape` behaviour is disabled. Users who want to map `<c-[>` probably *never* use it as `Escape`. Fixes #2722.
Diffstat (limited to 'lib')
-rw-r--r--lib/keyboard_utils.coffee10
1 files changed, 7 insertions, 3 deletions
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) ->
- # <c-[> is mapped to Escape in Vim by default.
- event.key == "Escape" || @getKeyCharString(event) == "<c-[>"
+ isEscape: do ->
+ useVimLikeEscape = true
+ Utils.monitorChromeStorage "useVimLikeEscape", (value) -> useVimLikeEscape = value
+
+ (event) ->
+ # <c-[> is mapped to Escape in Vim by default.
+ event.key == "Escape" or (useVimLikeEscape and @getKeyCharString(event) == "<c-[>")
isBackspace: (event) ->
event.key in ["Backspace", "Delete"]