aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2017-11-05 11:17:58 +0000
committerGitHub2017-11-05 11:17:58 +0000
commit291e5c4f37c6ce979b8739f0ccbfd12cc8a63115 (patch)
tree1f87e69c061f235343f791e007b30cba3ae74296
parent1eceb1413b43b0b43f225a5270dc9f2e6c212836 (diff)
parent87f017e48aa04ecc44dc06c1e4c35ffc5ecf611f (diff)
downloadvimium-291e5c4f37c6ce979b8739f0ccbfd12cc8a63115.tar.bz2
Merge pull request #2772 from smblott-github/enable-more-keys-v2
Add more named keys (version 2)
-rw-r--r--README.md8
-rw-r--r--lib/keyboard_utils.coffee8
2 files changed, 8 insertions, 8 deletions
diff --git a/README.md b/README.md
index 1896a662..5e0d18d7 100644
--- a/README.md
+++ b/README.md
@@ -141,9 +141,10 @@ The following special keys are available for mapping:
- `<c-*>`, `<a-*>`, `<m-*>` for ctrl, alt, and meta (command on Mac) respectively with any key. Replace `*`
with the key of choice.
-- `<left>`, `<right>`, `<up>`, `<down>` for the arrow keys
-- `<space>` and `<backspace>` for the space and backspace keys
-- `<f1>` through `<f12>` for the function keys
+- `<left>`, `<right>`, `<up>`, `<down>` for the arrow keys.
+- `<f1>` through `<f12>` for the function keys.
+- `<space>` for the space key.
+- `<tab>`, `<enter>`, `<delete>`, `<backspace>`, `<insert>`, `<home>` and `<end>` for the corresponding non-printable keys (version 1.62 onwards).
Shifts are automatically detected so, for example, `<c-&>` corresponds to ctrl+shift+7 on an English keyboard.
@@ -171,6 +172,7 @@ Release Notes
In `master` (not yet released)
- Backup and restore Vimium options (see the very bottom of the options page, below *Advanced Options*).
+- It is now possible to map `<tab>`, `<enter>`, `<delete>`, `<insert>`, `<home>` and `<end>`.
1.61 (2017-10-27)
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee
index 681ee139..8cd2a490 100644
--- a/lib/keyboard_utils.coffee
+++ b/lib/keyboard_utils.coffee
@@ -5,7 +5,7 @@ Utils?.monitorChromeStorage "mapKeyRegistry", (value) => mapKeyRegistry = value
KeyboardUtils =
# This maps event.key key names to Vimium key names.
keyNames:
- "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space", "Backspace": "backspace"
+ "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space"
init: ->
if (navigator.userAgent.indexOf("Mac") != -1)
@@ -38,10 +38,8 @@ KeyboardUtils =
""
else if key.length == 1
key
- else if key.length == 2 and "F1" <= key <= "F9"
- key.toLowerCase() # F1 to F9.
- else if key.length == 3 and "F10" <= key <= "F12"
- key.toLowerCase() # F10 to F12.
+ else if 1 < key.length
+ key.toLowerCase()
else
""