aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-02-12 07:43:55 +0000
committerStephen Blott2016-02-18 07:35:07 +0000
commit38509ce26afd1df7288255bfbcae1705f7bf9d86 (patch)
treed0ac44c1ee050c256e3e03de244a3b0efb50d02f
parent0ddc7a28d17e94296f209d3d8d06357de281e1d1 (diff)
downloadvimium-38509ce26afd1df7288255bfbcae1705f7bf9d86.tar.bz2
PassNextKey; exclude single-character mappings.
Consider: map q passNextKey This works fine in normal mode. However, in insert mode, when the user types "q" they expect "q" to be input. Any other behaviour would be pretty weird. Here, we filter out such mappings before the front end sees them. So, with: map q passNextKey map <c-]> passNextKey both mappings work in normal mode, but only the second works in insert mode. This is probably the behaviour likely to cause least user confusion.
-rw-r--r--background_scripts/commands.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 7367e696..80ca0f96 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -68,9 +68,11 @@ Commands =
@keyToCommandRegistry = {}
# Push the key mapping for passNextKey into Settings so that it's available in the front end for insert
+ # mode. We exclude single-key mappings (that is, printable keys) because when users press printable keys
+ # in insert mode they expect the character to be input, not to be droppped into some special Vimium
# mode.
Settings.set "passNextKeyKeys",
- (key for own key of @keyToCommandRegistry when @keyToCommandRegistry[key].command == "passNextKey")
+ (key for own key of @keyToCommandRegistry when @keyToCommandRegistry[key].command == "passNextKey" and 1 < key.length)
clearKeyMappingsAndSetDefaults: ->
@keyToCommandRegistry = {}